Steps to reproduce: 1. Create cell comment in Excel. 2. Example xl/comment1.xml extracted from xslx (formatted): <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <authors> <author>Author</author> </authors> <commentList> <comment ref="A3" authorId="0"> <text> <r> <rPr> <b /> <sz val="9" /> <color indexed="81" /> <rFont val="Tahoma" /> <charset val="1" /> </rPr> <t>AGNC via Excel</t> </r> </text> </comment> </commentList> </comments> 3. Load this Excel file via POI. 4. Exception thrown on loading this cell comment: Exception in thread "Thread-2" org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: string value 'Text' is not a valid enumeration value for ST_ObjectType in namespace urn:schemas-microsoft-com:office:excel at org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx.set_text(JavaStringEnumerationHolderEx.java:40) at org.apache.xmlbeans.impl.values.XmlObjectBase.update_from_wscanon_text(XmlObjectBase.java:1121) at org.apache.xmlbeans.impl.values.XmlObjectBase.check_dated(XmlObjectBase.java:1250) at org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx.getEnumValue(JavaStringEnumerationHolderEx.java:60) at com.microsoft.schemas.office.excel.impl.CTClientDataImpl.getObjectType(CTClientDataImpl.java:14177) at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.matchCommentShape(XSSFVMLDrawing.java:304) at org.apache.poi.xssf.usermodel.XSSFVMLDrawing.findCommentShape(XSSFVMLDrawing.java:285) at org.apache.poi.xssf.model.CommentsTable.findCellComment(CommentsTable.java:198) at org.apache.poi.xssf.usermodel.XSSFSheet.getCellComment(XSSFSheet.java:813) at org.apache.poi.xssf.usermodel.XSSFCell.getCellComment(XSSFCell.java:1010) . . .
Can you provide some self-sufficient sample code which creates the file and then demonstrates the problem? Or at least a sample file? This would make it much easier for others to reproduce the issue.
Created attachment 38707 [details] Eclipse demo project Thanks for quick response. The attached Eclipse project has two demo JUnit tests: one which runs OK and another with EXCEPTION. The first one I created from scratch - and it worked! Another is crafted from my minimized code with exception present. The critical code seems to be identical in both... Option to try: remove comment from cell in ExcelDemo-EXCEPTION.xlsx and the file will load without exception.
added test in r1911399 this test passes so the issue is not reproduced bug66827.xlsx is the 'excpetion' xlsx from the attachment
This error message now shows up in https://ci-builds.apache.org/job/POI/job/POI-DSL-1.17/lastFailedBuild/testReport/junit/org.apache.poi.stress/TestAllFiles/Extracting____2399_spreadsheet_bug66827_xlsx_XSSF/ and https://ci-builds.apache.org/job/POI/job/POI-DSL-Windows-1.17/lastFailedBuild/testReport/junit/org.apache.poi.stress/TestAllFiles/Extracting____2399_spreadsheet_bug66827_xlsx_XSSF/ so it seems it only reproduces in certain combinations, e.g. only with JDK 17?
So the issue is not with the comments table. It is with the VML Drawing XML. xl/drawings/vmlDrawing1.vml has this <x:ClientData ObjectType="Text"> and this is what is not parsing
According the XSD that POI was built with, only these Object Types are valid. Enum BUTTON = Enum.forString("Button"); Enum CHECKBOX = Enum.forString("Checkbox"); Enum DIALOG = Enum.forString("Dialog"); Enum DROP = Enum.forString("Drop"); Enum EDIT = Enum.forString("Edit"); Enum G_BOX = Enum.forString("GBox"); Enum LABEL = Enum.forString("Label"); Enum LINE_A = Enum.forString("LineA"); Enum LIST = Enum.forString("List"); Enum MOVIE = Enum.forString("Movie"); Enum NOTE = Enum.forString("Note"); Enum PICT = Enum.forString("Pict"); Enum RADIO = Enum.forString("Radio"); Enum RECT_A = Enum.forString("RectA"); Enum SCROLL = Enum.forString("Scroll"); Enum SPIN = Enum.forString("Spin"); Enum SHAPE = Enum.forString("Shape"); Enum GROUP = Enum.forString("Group"); Enum RECT = Enum.forString("Rect");
I added a workaround in r1911407