001/*
002 * Copyright 2006-2014 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.transform;
017
018
019
020/**
021 * Exception indicating that some type of error has occurred while
022 * attempting to parse a line of input into tokens.
023 * 
024 * @author Lucas Ward
025 * @author Michael Minella
026 *
027 */
028@SuppressWarnings("serial")
029public class FlatFileFormatException extends RuntimeException {
030
031        private String input;
032
033        /**
034         * Create a new {@link FlatFileFormatException} based on a message.
035         *
036         * @param message the message for this exception
037         * @param input {@link String} containing the input for that caused this
038         * exception to be thrown.
039         */
040        public FlatFileFormatException(String message, String input) {
041                super(message);
042                this.input = input;
043        }
044        /**
045         * Create a new {@link FlatFileFormatException} based on a message.
046         * 
047         * @param message the message for this exception
048         */
049        public FlatFileFormatException(String message) {
050                super(message);
051        }
052        
053        /**
054         * Create a new {@link FlatFileFormatException} based on a message and another exception.
055         * 
056         * @param message the message for this exception
057         * @param cause the other exception
058         */
059        public FlatFileFormatException(String message, Throwable cause) {
060                super(message, cause);
061        }
062
063        /**
064         * Retrieve the input that caused this exception.
065         *
066         * @return String containing the input.
067         */
068        public String getInput() { return input; }
069}