java.lang.RuntimeException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • https://uisapp2.iu.edu/jira-prd/browse/FSKI-411 While working on a new Flat File type that uses ExplicitKualiDecimalFormatter for amount fields, I encountered the following parsing exception: {code} 2015-02-10 11:29:27,156 [pool-12-thread-1] u:/d: ERROR org.kuali.kfs.sys.batch.FlatFileParserBase :: Exception occurred on line 7 while setting value 0 for property totalTransactionFeeCreditAmount. happend in parsing file content java.lang.RuntimeException: Exception occurred on line 7 while setting value 0 for property totalTransactionFeeCreditAmount. at org.kuali.kfs.sys.batch.AbstractFlatFilePropertySpecificationBase.setProperty(AbstractFlatFilePropertySpecificationBase.java:68) at org.kuali.kfs.sys.batch.DelimitedFlatFileSpecification.parseLineIntoObject(DelimitedFlatFileSpecification.java:40) at org.kuali.kfs.sys.batch.FlatFileParserBase.parse(FlatFileParserBase.java:127) at org.kuali.kfs.sys.batch.service.impl.BatchInputFileServiceImpl.parse(BatchInputFileServiceImpl.java:56) at edu.iu.ebs.kfs.module.cmrc.batch.service.impl.PaypalProcessTransactionServiceImpl.parseTransactionFile(PaypalProcessTransactionServiceImpl.java:231) at edu.iu.ebs.kfs.module.cmrc.batch.service.impl.PaypalProcessTransactionServiceImpl.loadTransactions(PaypalProcessTransactionServiceImpl.java:141) at edu.iu.ebs.kfs.module.cmrc.batch.PaypalLoadTransactionsStep$1.execute(PaypalLoadTransactionsStep.java:22) ...... Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1911) at org.kuali.kfs.sys.businessobject.format.ExplicitKualiDecimalFormatter.addDecimalPoint(ExplicitKualiDecimalFormatter.java:51) at org.kuali.kfs.sys.businessobject.format.ExplicitKualiDecimalFormatter.convertToObject(ExplicitKualiDecimalFormatter.java:39) at org.kuali.rice.core.web.format.Formatter.convertFromPresentationFormat(Formatter.java:427) at org.kuali.kfs.sys.batch.AbstractFlatFilePropertySpecificationBase.getFormattedObject(AbstractFlatFilePropertySpecificationBase.java:135) at org.kuali.kfs.sys.batch.AbstractFlatFilePropertySpecificationBase.setProperty(AbstractFlatFilePropertySpecificationBase.java:65) ... 24 more {code} The root cause is that ExplicitKualiDecimalFormatter.addDecimalPoint assumes that the amount string always has at least 2 chars. {code} private String addDecimalPoint (String amount) { if (!amount.contains(".")) { //have to add decimal point if it's missing int length = amount.length(); amount = amount.substring(0, length - 2) + "." + amount.substring(length - 2, length); } return amount; } {code} But that's not the case. For ex, In the above exception, we encountered amount string "0", which has only 1 char, and thus we got index out of bound exception. We shall add logic to handle this situation, as I think 0 amount string is quite common in any amount field using implicit decimal point.
    via by Ying Feng,
    • java.lang.RuntimeException: Exception occurred on line 7 while setting value 0 for property totalTransactionFeeCreditAmount. at org.kuali.kfs.sys.batch.AbstractFlatFilePropertySpecificationBase.setProperty(AbstractFlatFilePropertySpecificationBase.java:68) at org.kuali.kfs.sys.batch.DelimitedFlatFileSpecification.parseLineIntoObject(DelimitedFlatFileSpecification.java:40) at org.kuali.kfs.sys.batch.FlatFileParserBase.parse(FlatFileParserBase.java:127) at org.kuali.kfs.sys.batch.service.impl.BatchInputFileServiceImpl.parse(BatchInputFileServiceImpl.java:56) at edu.iu.ebs.kfs.module.cmrc.batch.service.impl.PaypalProcessTransactionServiceImpl.parseTransactionFile(PaypalProcessTransactionServiceImpl.java:231) at edu.iu.ebs.kfs.module.cmrc.batch.service.impl.PaypalProcessTransactionServiceImpl.loadTransactions(PaypalProcessTransactionServiceImpl.java:141) at edu.iu.ebs.kfs.module.cmrc.batch.PaypalLoadTransactionsStep$1.execute(PaypalLoadTransactionsStep.java:22)
    No Bugmate found.