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 2013/11/06 10:38:55 UTC

[Bug 55748] New: Exception with message:Duplicate name " DocumentSummaryInformation" when reading xls File

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

            Bug ID: 55748
           Summary: Exception with message:Duplicate name "
                    DocumentSummaryInformation" when reading xls File
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: ck.kenny.chang@gmail.com

Exception Type: IOException.
Exception Message: Duplicate name "DocumentSummaryInformation"
Detail:
    When reading an excel file that was tranfered from a oversea teammate, I
found the exception happened and just could not go further even debugging with
POI Source code (version 3.9 HSSF).
    And there is a  very surprising thing: If I opened the xls file and did
some operation like "Pressing Ctrl + S" on it or saved it as another xls file,
It could be read then.
    At first I thought It might be file encoding prolbem. but after I query the
encoding with cpdetector_1.0.0.jar, the encoding charset of the 2 files are the
same ,both "UTF-16BE".
    Then I debugged with the source code and found something interesting:
    1) running to the method: convertToProperties(ListManagedBlock [] blocks)
at class "PropertyFactory.java" ,the paramter "ListManagedBlock [] blocks" with
2 blocks in the list , was different between these 2 cases: reading orginal
file and reading another "save as" file.
    2) Method: addChild(final Property property) throwed the exception:
      if (_children_names.contains(name))
        {
            throw new IOException("Duplicate name \"" + name + "\"");
        }
    3) in the 2 blocks "ListManagedBlock [] blocks": 
       When reading OK,
     the first block read: Root Entry  Workbook  SummaryInformation    
DocumentSummaryInformation 
     the second block read: CompObj  IrmToolInfoStream IrmToolSLevelInfo.


     When reading with exception:
     the first block read: Root Entry  Workbook  SummaryInformation    
DocumentSummaryInformation 
     the second block read: DocumentSummaryInformation.

     It read "DocumentSummaryInformation" again and the code check in the "Set"
contains the object and throw the exception.

The following is the StackTrace:
java.io.IOException: Duplicate name "DocumentSummaryInformation"
    at
org.apache.poi.poifs.property.DirectoryProperty.addChild(DirectoryProperty.java:266)
    at
org.apache.poi.poifs.property.PropertyTableBase.populatePropertyTree(PropertyTableBase.java:115)
    at
org.apache.poi.poifs.property.PropertyTableBase.<init>(PropertyTableBase.java:63)
    at
org.apache.poi.poifs.property.PropertyTable.<init>(PropertyTable.java:63)
    at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:159)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:322)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:303)
    at
org.apache.poi.hssf.usermodel.examples.HSSFReadWrite.readFile(HSSFReadWrite.java:51)
    at
org.apache.poi.hssf.usermodel.examples.HSSFReadWrite.main(HSSFReadWrite.java:163)


Sorry to tell you i can't upload the file that can't be read.But I think you
enginners may know that kind of exception and give me a quick reponse. 

Thank you very much. 

    Kenny.

-- 
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 55748] Exception with message:Duplicate name " DocumentSummaryInformation" when reading xls File

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

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
For now I think this will not be fixed as the check is on-purpose unless we
know where the invalid file comes from. Please reopen if you can provide more
information.

-- 
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 55748] Exception with message:Duplicate name " DocumentSummaryInformation" when reading xls File

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

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
Without the file, I can't be sure, but my hunch is that your file didn't come
from Excel but came from something that doesn't follow the spec properly

As far as I can tell, your file contains two OLE2 streams with exactly the same
entry name. I don't know which one Excel is picking (if any) when you do the
open and re-save, but it is clearly throwing one away to fix up your file. 

You should probably find out where the file came from, and see if you can talk
to whoever wrote that software to not duplicate the properties. In the mean
time, I'm very reluctant to remove the duplicate check as it'll catch other
problems, especially if I don't know where your broken file came from, and
without having that file (or one like it) to use in unit testing

-- 
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 55748] Exception with message:Duplicate name " DocumentSummaryInformation" when reading xls File

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

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Try with NPOIFSFileSystem instead of POIFSFileSystem, just in case it's
something odd

Otherwise, without the file, there's not much that we can do. Most likely
though, it's just an invalid file - entries within the POIFS (ole2) structure
must have unique names. From the exception, it looks like you've somehow ended
up with two entries with the same name, which isn't allowed

-- 
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 55748] Exception with message:Duplicate name " DocumentSummaryInformation" when reading xls File

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

--- Comment #2 from kenny.chang <ck...@gmail.com> ---
Same Exception after substitued with NPOIFSFileSystem.
When tracing with POI Source code , NPOIFSFileSystem and POIFSFileSystem Both 
run into the same method when parsing the head_block (entry of excel). 

Any other suggestion?

What is more, between the following Two ways of reading the excel file:
1) directly read: No change on the excel file, report exception :Duplicate name
"DocumentSummaryInformation";
2) read the excel file after save it as another one:  ALL OK.

Could you share me some experience about the reason why this strange thing
happened?
May be I can have some idea for solution by your saying.


Thank you.

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