Example usage for org.springframework.batch.item.file FlatFileParseException FlatFileParseException

List of usage examples for org.springframework.batch.item.file FlatFileParseException FlatFileParseException

Introduction

In this page you can find the example usage for org.springframework.batch.item.file FlatFileParseException FlatFileParseException.

Prototype

public FlatFileParseException(String message, Throwable cause, String input, int lineNumber) 

Source Link

Usage

From source file:org.beanio.spring.BeanIOFlatFileItemReader.java

@Override
@SuppressWarnings("unchecked")
protected T doRead() throws Exception {
    if (reader == null) {
        return null;
    }/*from   ww  w  .j  a va 2s . c o m*/

    try {
        return (T) reader.read();
    } catch (BeanReaderIOException ex) {
        throw ex.getCause();
    } catch (BeanReaderException ex) {
        if (useSpringExceptions) {
            RecordContext ctx = ex.getRecordContext();
            if (ctx != null) {
                throw new FlatFileParseException(ex.getMessage(), ex, ctx.getRecordText(), ctx.getLineNumber());
            } else {
                throw new FlatFileParseException(ex.getMessage(), ex, null, 0);
            }
        } else {
            throw ex;
        }
    }
}

From source file:egovframework.rte.bat.core.item.file.EgovFlatFileByteReader.java

/**
 * Byte ??  ??? ValueObject // w  w  w  . j a  va2 s. c  om
 * 
 * @return string corresponding to logical record according to
 *         {@link #setRecordSeparatorPolicy(RecordSeparatorPolicy)} (might
 *         span multiple lines in file).
 */
@Override
protected T doRead() throws Exception {
    if (noInput) {
        return null;
    }

    byte[] line = readLine();

    if (line == null) {
        return null;
    } else {
        try {
            return lineMapper.mapLine(line, lineCount);
        } catch (Exception ex) {
            throw new FlatFileParseException("Parsing error at line: " + lineCount + " in resource=["
                    + resource.getDescription() + "], input=[" + line.toString() + "]", ex, line.toString(),
                    lineCount);
        }
    }
}

From source file:org.jasig.ssp.util.importer.job.csv.FlatFileItemReaderNewLine.java

/**
 * @return string corresponding to logical record according to
 * {@link #setRecordSeparatorPolicy(RecordSeparatorPolicy)} (might span multiple lines in file).
 *//*from www .  j a  v  a  2s. co m*/
@Override
protected T doRead() throws Exception {
    if (noInput) {
        return null;
    }

    String line = readLine();

    if (line == null) {
        return null;
    } else {
        try {
            return lineMapper.mapLine(line, lineCount);
        } catch (Exception ex) {
            throw new FlatFileParseException("Parsing error at line: " + lineCount + " in resource=["
                    + resource.getDescription() + "], input=[" + line + "]", ex, line, lineCount);
        }
    }
}

From source file:org.springframework.batch.item.file.RegexFileItemReader.java

@Override
protected T doRead() throws Exception {
    if (noInput) {
        return null;
    }//from w w w .  j a v a2s. co m

    String line = readLine();

    if (line == null) {
        return null;
    } else {
        try {
            return lineMapper.mapLine(line, lineCount);
        } catch (Exception ex) {
            throw new FlatFileParseException("Parsing error at line: " + lineCount + " in resource=["
                    + resource.getDescription() + "], input=[" + line + "]", ex, line, lineCount);
        }
    }
}