001/*
002 * Copyright 2006-2007 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.springframework.batch.item.file;
017
018import org.springframework.batch.item.ParseException;
019
020/**
021 * Exception thrown when errors are encountered
022 * parsing flat files.  The original input, typically
023 * a line, can be passed in, so that latter catches
024 * can write out the original input to a log, or
025 * an error table.
026 *
027 * @author Lucas Ward
028 * @author Ben Hale
029 */
030@SuppressWarnings("serial")
031public class FlatFileParseException extends ParseException {
032
033        private String input;
034        
035        private int lineNumber;
036
037        public FlatFileParseException(String message, String input) {
038                super(message);
039                this.input = input;
040        }
041
042        public FlatFileParseException(String message, String input, int lineNumber) {
043                super(message);
044                this.input = input;
045                this.lineNumber = lineNumber;
046        }
047
048        public FlatFileParseException(String message, Throwable cause, String input, int lineNumber) {
049                super(message, cause);
050                this.input = input;
051                this.lineNumber = lineNumber;
052        }
053
054        public String getInput() {
055                return input;
056        }
057
058        public int getLineNumber() {
059                return lineNumber;
060        }       
061}