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

            Bug ID: 65706
           Summary: Warning 'Entry [trash]/0000.dat is not valid' for
                    valid trash item while opening .xlsx file
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: OPC
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 38103
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38103&action=edit
Excel file with trash item

POI 5.1.0 logs a warning while reading an .xlsx file which contains a trash
item, this is the log entry:

2021-11-25 10:00:21,801  WARN [pool-4-thread-1] (ZipPackage.java:340) - Entry
[trash]/0000.dat is not valid, so this part won't be add to the package.
org.apache.poi.openxml4j.exceptions.InvalidFormatException: Illegal character
in path at index 1: /[trash]/0000.dat
        at
org.apache.poi.openxml4j.opc.PackagingURIHelper.createPartName(PackagingURIHelper.java:500)
~[poi-ooxml-5.1.0.jar:5.1.0]
        at
org.apache.poi.openxml4j.opc.ZipPackage$EntryTriple.<init>(ZipPackage.java:337)
~[poi-ooxml-5.1.0.jar:5.1.0]
        at
org.apache.poi.openxml4j.opc.ZipPackage.lambda$getPartsImpl$0(ZipPackage.java:311)
~[poi-ooxml-5.1.0.jar:5.1.0]
        at
java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
~[?:?]
        at
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
~[?:?]
        at
java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
~[?:?]
        at
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
~[?:?]
        at
java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at
java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
        at
org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:314)
~[poi-ooxml-5.1.0.jar:5.1.0]
        at
org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:740)
~[poi-ooxml-5.1.0.jar:5.1.0]
        at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:315)
~[poi-ooxml-5.1.0.jar:5.1.0]

According to the spec trash items are valid content of an ooxml file (see
https://www.ecma-international.org/publications-and-standards/standards/ecma-376/
part 1):

9.1.5 Trash Items

Trash items represent parts that have been discarded or are no longer in use.
Trash items shall not conform to OPC part naming guidelines as defined in
ECMA-376-2 and shall not be associated with a content type. All trash items
shall follow the naming scheme: [trash]/HHHH.dat where H represents a
hexadecimal digit.

[Example: A package has two parts that must be updated in-place but both parts
have grown beyond their growth hints. The newer updated parts are added as new
ZIP items while the original parts are renamed to:

  [trash]/0000.dat
  [trash]/0001.dat

end example]

In our case I guess SharePoint has added this trash item.

Since it's valid content of the ooxml file it should probably not get logged as
a warning. I know warnings are not errors, but still these warnings create
noise. We can filter those warnings though - especially since we haven't paid
attention to POI logging before you were moving to log4j2.

BTW, there's a typo in the log message - it should read '...so this part won't
be added...'.

-- 
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