DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28755>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28755

StringIndexOutOfBoundsException on invalid formula starting with '

           Summary: StringIndexOutOfBoundsException on invalid formula
                    starting with '
           Product: POI
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: HSSF
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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"

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to