https://issues.apache.org/bugzilla/show_bug.cgi?id=54436

            Bug ID: 54436
           Summary: Broken matadata for GETPIVOTDATA function
           Product: POI
           Version: 3.9
          Hardware: PC
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: POI Overall
          Assignee: [email protected]
          Reporter: [email protected]
    Classification: Unclassified

Created attachment 29858
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29858&action=edit
Example of failing poi if GETPIVOTDATA function exists

Overview:

If excel file (in my case xlsx) contains GETPIVOTDATA function, then the simple
row shifting in workbook will throw an exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
    at
org.apache.poi.ss.formula.ptg.AbstractFunctionPtg.getParameterClass(AbstractFunctionPtg.java:160)
    at
org.apache.poi.ss.formula.OperandClassTransformer.transformFunctionNode(OperandClassTransformer.java:277)
    at
org.apache.poi.ss.formula.OperandClassTransformer.transformNode(OperandClassTransformer.java:134)
    at
org.apache.poi.ss.formula.OperandClassTransformer.transformFormula(OperandClassTransformer.java:87)
    at
org.apache.poi.ss.formula.FormulaParser.getRPNPtg(FormulaParser.java:1580)
    at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:177)
    at
org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.shiftFormula(XSSFRowShifter.java:186)
    at
org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateRowFormulas(XSSFRowShifter.java:156)
    at
org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateSheetFormulas(XSSFRowShifter.java:143)
    at
org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateFormulas(XSSFRowShifter.java:136)
    at org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:2364)
This happens due to broken metadata in the "functionMetadata.txt" where columns
"Return Class" and "Parameter classes" for GETPIVOTDATA functions are omitted:
358    GETPIVOTDATA    2    30                

Cause the source "excelfileformat.odt" file doesn't contain this information. 

Modifying the metadata for this formula fixes the problem.
Working solution is:
358    GETPIVOTDATA    2    30    V    V R ...        

Example files are attached.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to