jaragunde opened a new pull request, #1089:
URL: https://github.com/apache/poi/pull/1089

   Absolute anchors in OOXML aren't anchored to cells, they have absolute 
positions in the document. The XSSFClientAnchor has code to calculate the cell 
equivalent, using the absolute position and the cell width and height. The same 
code is used to calculate the second anchor cell in one-cell anchors.
   
   For absolute anchors, it takes an empty cell (EMPTY_MARKER) and calculates 
the first anchor cell by compounding it with the anchor position, the problem 
is the empty cell has some null fields that the code is not expecting, and it 
crashes.
   
   We add those null cells and add a test that exercises this use case. The 
same test would crash if run on trunk, with the following exception:
   ```
   java.lang.NullPointerException: Cannot invoke 
"org.apache.xmlbeans.XmlAnySimpleType.getStringValue()" because "coordUnion" is 
null
        at 
org.apache.poi.ooxml/org.apache.poi.ooxml.util.POIXMLUnits.parseLengthInner(POIXMLUnits.java:236)
        at 
org.apache.poi.ooxml/org.apache.poi.ooxml.util.POIXMLUnits.parseLength(POIXMLUnits.java:167)
        at 
org.apache.poi.ooxml/org.apache.poi.xssf.usermodel.XSSFClientAnchor.calcCell(XSSFClientAnchor.java:166)
        at 
org.apache.poi.ooxml/org.apache.poi.xssf.usermodel.XSSFClientAnchor.getCell1(XSSFClientAnchor.java:202)
        at 
org.apache.poi.ooxml/org.apache.poi.xssf.usermodel.XSSFClientAnchor.getCol1(XSSFClientAnchor.java:211)
        at 
org.apache.poi.ooxml/org.apache.poi.xssf.usermodel.TestXSSFDrawing.testAbsoluteAnchor(TestXSSFDrawing.java:938)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to