| 1 | /* |
| 2 | * Copyright 2006-2007 the original author or authors. |
| 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 org.springframework.batch.item.file; |
| 17 | |
| 18 | import org.springframework.batch.item.ParseException; |
| 19 | |
| 20 | /** |
| 21 | * Exception thrown when errors are encountered |
| 22 | * parsing flat files. The original input, typically |
| 23 | * a line, can be passed in, so that latter catches |
| 24 | * can write out the original input to a log, or |
| 25 | * an error table. |
| 26 | * |
| 27 | * @author Lucas Ward |
| 28 | * @author Ben Hale |
| 29 | */ |
| 30 | public class FlatFileParseException extends ParseException { |
| 31 | |
| 32 | private String input; |
| 33 | |
| 34 | private int lineNumber; |
| 35 | |
| 36 | public FlatFileParseException(String message, String input) { |
| 37 | super(message); |
| 38 | this.input = input; |
| 39 | } |
| 40 | |
| 41 | public FlatFileParseException(String message, String input, int lineNumber) { |
| 42 | super(message); |
| 43 | this.input = input; |
| 44 | this.lineNumber = lineNumber; |
| 45 | } |
| 46 | |
| 47 | public FlatFileParseException(String message, Throwable cause, String input, int lineNumber) { |
| 48 | super(message, cause); |
| 49 | this.input = input; |
| 50 | this.lineNumber = lineNumber; |
| 51 | } |
| 52 | |
| 53 | public String getInput() { |
| 54 | return input; |
| 55 | } |
| 56 | |
| 57 | public int getLineNumber() { |
| 58 | return lineNumber; |
| 59 | } |
| 60 | } |