poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 55748] New: Exception with message:Duplicate name " DocumentSummaryInformation" when reading xls File
Date Wed, 06 Nov 2013 09:38:55 GMT
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


Mime
View raw message