You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2024/03/04 07:04:24 UTC

[Bug 68703] New: IllegalArgumentException: Unexpected color choice CTFontCollectionImpl when reading font color for a table cell

https://bz.apache.org/bugzilla/show_bug.cgi?id=68703

            Bug ID: 68703
           Summary: IllegalArgumentException: Unexpected color choice
                    CTFontCollectionImpl when reading font color for a
                    table cell
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: dev@poi.apache.org
          Reporter: henry@canva.com
  Target Milestone: ---

Created attachment 39609
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39609&action=edit
Zip file containing a Maven project that reproduces the issue

Affected Version: 5.2.5 (5.2.4 possibly affected as well)

Issue:
When parsing some PowerPoint files with tables in Apache POI version 5.2.5 (and
possibly 5.2.4), attempting to retrieve the font color for text runs within the
table cell triggers the following exception:

```
Exception in thread "main" java.lang.IllegalArgumentException: Unexpected color
choice: class
org.openxmlformats.schemas.drawingml.x2006.main.impl.CTFontCollectionImpl
        at org.apache.poi.xslf.usermodel.XSLFColor.toColor(XSLFColor.java:161)
        at org.apache.poi.xslf.usermodel.XSLFColor.<init>(XSLFColor.java:66)
        at
org.apache.poi.xslf.usermodel.XSLFTableCell$XSLFCellTextRun.getFontColor(XSLFTableCell.java:755)
        at com.example.Main.main(Main.java:21)
```

Steps to Reproduce:
1. Download the attached zip file containing a Maven project.
2. Unzip the folder and navigate to its directory using the command line.
3. Run `mvn install` followed by `mvn exec:java`.
4. Observe the `IllegalArgumentException` that is thrown during execution.

We suspect that the commit causing this issue is
https://github.com/apache/poi/commit/624f83431065e1a7613f1f044f1820c27e504266#diff-f80c56131e376f24468d40928f5717820b38f1ebea9d16147b870763f8b682c7R78

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68703] IllegalArgumentException: Unexpected color choice CTFontCollectionImpl when reading font color for a table cell

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68703

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
                 OS|Mac OS X 10.1               |All

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68703] IllegalArgumentException: Unexpected color choice CTFontCollectionImpl when reading font color for a table cell

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68703

--- Comment #4 from PJ Fanning <fa...@yahoo.com> ---
trying again with r1916108

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68703] IllegalArgumentException: Unexpected color choice CTFontCollectionImpl when reading font color for a table cell

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68703

--- Comment #2 from PJ Fanning <fa...@yahoo.com> ---
added r1916105

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68703] IllegalArgumentException: Unexpected color choice CTFontCollectionImpl when reading font color for a table cell

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68703

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
Looks like you are right about that newTextRun change. The XSLFTableCell class
overrides this method and returns an XSLFCellTextRun instead of a XSLFTextRun.
I will revert that change.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68703] IllegalArgumentException: Unexpected color choice CTFontCollectionImpl when reading font color for a table cell

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68703

--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
reverted with r1916106 - I will have to come back to this.

With POI these days, it seems almost impossible to change code to suit one user
without breaking the code for another.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org