Bug 28755 - StringIndexOutOfBoundsException on invalid formula starting with '
Summary: StringIndexOutOfBoundsException on invalid formula starting with '
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: Other other
: P3 minor (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-03 23:05 UTC by Conrad Roche
Modified: 2006-08-27 20:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Conrad Roche 2004-05-03 23:05:28 UTC
The code -
    cell.setCellFormula("right(\'hello\', 5)");
[The formula is, of course, incorrect - it should be " and not '; but the poi 
code, seeing the ', checked if it was a sheet name in a cell reference and gave 
an error]

gives an error -
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(Unknown Source)
	at org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:44)
	at org.apache.poi.hssf.record.formula.ReferencePtg.<init>
(ReferencePtg.java:50)
	at org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:291)
	at org.apache.poi.hssf.model.FormulaParser.Factor
(FormulaParser.java:474)
	at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:548)
	at org.apache.poi.hssf.model.FormulaParser.Expression
(FormulaParser.java:596)
	at org.apache.poi.hssf.model.FormulaParser.Arguments
(FormulaParser.java:443)
	at org.apache.poi.hssf.model.FormulaParser.function
(FormulaParser.java:315)
	at org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:265)
	at org.apache.poi.hssf.model.FormulaParser.Factor
(FormulaParser.java:474)
	at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:548)
	at org.apache.poi.hssf.model.FormulaParser.Expression
(FormulaParser.java:596)
	at org.apache.poi.hssf.model.FormulaParser.parse(FormulaParser.java:700)
	at org.apache.poi.hssf.usermodel.HSSFCell.setCellFormula
(HSSFCell.java:678)
	at emr.test.Test.setSecondRow(Test.java:85)
	at emr.test.Test.main(Test.java:116)
Exception in thread "main"
Comment 1 Jason Height 2006-08-28 03:51:31 UTC
Will now throw IllegalArgumentException.

Fixed in SVN.

Jason