DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34732>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34732





------- Additional Comments From [EMAIL PROTECTED]  2005-05-06 03:00 -------
Ahhh.... I did some closer checking and found out something very interesting.

The 'RootEntry' on this file is actually marked as a 'Storage' type, not 
as 'Root'. The mark of node type is in the directory record at offset 0x042. 
Office documents should always have 0x05 in this byte, but the file you posted 
has 0x02. So POIFS interprets this as a 'Storage' (usually a folder element 
that contains other streams).

This is why there is a ClassCastException. the PropertyTable object holds all 
the directory nodes, and the first one in the table should be the 'RootEntry'. 
That much is true for the file you posted.

That node should be marked as the directory root, by having the byte at offset 
0x042 set to 0x05. But the file you have posted has a value of 0x02. In POIFS, 
this causes PropertyFactory to create a DirectoryProperty object instead of a 
RootProperty. The first element of the PropertyTable list is therefore a 
DirectoryProperty, but the constructor tries to cast this element as a 
RootProperty.

A better fix would be to make a change in PropertyFactory

  int    offset         = 0;

  for (int k = 0; k < property_count; k++)
  {

+   int propertyType = data[ offset + PropertyConstants.PROPERTY_TYPE_OFFSET ];
+   if( k == 0) propertyType = PropertyConstants.ROOT_TYPE;
+   switch( propertyType)
-   switch (data[ offset + PropertyConstants.PROPERTY_TYPE_OFFSET ])
    {

      case PropertyConstants.DIRECTORY_TYPE :


If you can grok that change, you might give it a try and report back if it 
works.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to