Fixedformat4j 1.2.0 released
Posted by Jacob von Eyben on June 12th, 2008
This evening I released a new version of fixedformat4j containing improved error reporting when failing to parse data using the FixedFormatManager.
The lack of good error reporting was a bit of a pain. It was not easy to see where in the parsing failed and it was not possible to get a complete list of format instructions.
A new ParseException is now thrown which contains the nessesary information.
See example of the new and improved stacktrace:
com.ancientprogramming.fixedformat4j.format.ParseException: failed to parse 'barfooba' at offset 16 as java.util.Date from 'foobarfoobarfoobarfoobar'. Got format instructions from com.ancientprogramming.fixedformat4j.format.impl.MyRecord.getDateData. See details{FormatContext{offset=16, dataType=java.util.Date, formatter=com.ancientprogramming.fixedformat4j.format.impl.ByTypeFormatter}, FormatInstructions{length=8, alignment=LEFT, paddingChar=' ', fixedFormatPatternData=FixedFormatPatternData{pattern='yyyyMMdd'}, fixedFormatBooleanData=FixedFormatBooleanData{trueValue='T', falseValue='F'}, fixedFormatNumberData=FixedFormatNumberData{signing=NOSIGN, positiveSign='+', negativeSign='-'}, fixedFormatDecimalData=FixedFormatDecimalData{decimals=2, useDecimalDelimiter=false, decimalDelimiter='.'}}}
at com.ancientprogramming.fixedformat4j.format.impl.FixedFormatManagerImpl.readDataAccordingFieldAnnotation(FixedFormatManagerImpl.java:179)
at com.ancientprogramming.fixedformat4j.format.impl.FixedFormatManagerImpl.load(FixedFormatManagerImpl.java:70)
Feel free to download the latest version and take a look at the changelist.