1 /*
2 * Copyright 2016 Andrew Rucker Jones.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.opencsv.exceptions;
17
18 import java.io.IOException;
19
20 /**
21 * Exception when you break the line limit of a multiline field.
22 * @author Edgar Silva
23 */
24 public class CsvMultilineLimitBrokenException extends IOException {
25 private static final long serialVersionUID = 1L;
26 private long row;
27 private String context;
28 private int multilineLimit;
29
30 /**
31 * @return The multiline limit set during construction of the exception
32 */
33 public int getMultilineLimit() {
34 return multilineLimit;
35 }
36
37 /**
38 * @return The row number set during construction of the exception
39 */
40 public long getRow() {
41 return row;
42 }
43
44 /**
45 * @return Context set during construction of the exception
46 */
47 public String getContext() {
48 return context;
49 }
50
51 /** Nullary constructor. Does nothing. */
52 public CsvMultilineLimitBrokenException() {
53 super();
54 }
55
56 /**
57 * Constructor with a message.
58 * @param message A human-readable error message
59 * @param row Row number where error occurred
60 * @param context Line (or part of the line) that caused the error
61 * @param multilineLimit Multiline limit that was set
62 */
63 public CsvMultilineLimitBrokenException(String message,long row, String context, int multilineLimit) {
64 super(message);
65 this.row = row;
66 this.context = context;
67 this.multilineLimit = multilineLimit;
68 }
69 }