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 2008/09/24 16:11:45 UTC

DO NOT REPLY [Bug 45877] New: Null base style for paragraph results in crash

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

           Summary: Null base style for paragraph results in crash
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: HWPF
        AssignedTo: dev@poi.apache.org
        ReportedBy: domenico.napoletano@exprivia.it
                CC: domenico.napoletano@exprivia.it


Created an attachment (id=22629)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22629)
Word document causing NullPointerException

Attached document, scanning its parts with QuickTest, results in a
java.lang.NullPointerException
        at
org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor.uncompressPAP(ParagraphSprmUncompressor.java:50)
        at org.apache.poi.hwpf.model.PAPX.getParagraphProperties(PAPX.java:135)
        at org.apache.poi.hwpf.usermodel.Range.getParagraph(Range.java:822)
        at org.apache.poi.hwpf.QuickTest.main(QuickTest.java:45)

After some debugging, I found that

1) the istd value for problematic paragraph style is 10
2) in getParagraphProperties method, baseStyle is null, and then in
uncompressPAP method, the null variable causing the exception is "parent"
3) During StyleSheet constructor execution (the istd of problematic style is
10), _parahraphDescriptions[10] is not null, but
_parahraphDescriptions[10]getPap() returns null
4) in createPAP(10) (called by the second loop in constructor), "pap" and
"papx" local variables are *both* null, then createPAP does not create the PAP
for istd=10

A more weird thing is that, deleting or changing other document parts, for
example removing other paragraphs, the crash disappears...


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45877] Null base style for paragraph results in crash

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





--- Comment #2 from Andrew Duffy <ad...@simiolus.com>  2009-08-02 12:07:16 PST ---
Created an attachment (id=24082)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24082)
Patches PAPX.java to avoid NPE when a paragraph's PAPX is based upon a
character style

I've encountered this error while decoding .doc files saved by OpenOffice
Writer. Some paragraphs have a PAPX with an istd that is a character style, and
PAPX.getParagraphProperties throws an NPE as a result.

I've attached a patch to PAPX.java to work around this. I don't think Chris
Walter's patch to StyleSheet.java is necessary.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45877] Null base style for paragraph results in crash

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


Andrew Duffy <ad...@simiolus.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aduffy@simiolus.com




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45877] Null base style for paragraph results in crash

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





--- Comment #1 from Chris Walter <cw...@docfinity.com>  2009-06-09 13:58:00 PST ---
Created an attachment (id=23783)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23783)
Patch that modifies stylesheets.

During the initialization of "org.apache.poi.hwpf.model.StyleSheet" POI runs
through all the style descriptions and adds them to the StyleDescription array
in the createPAP method. If a description has an improperly set parent (ie it's
parent is null) it still tries to run the ParagraphSprmUncompressor. Doing so
attempts to clone the parent and throws a Null Pointer exception. The attached
patch simply blocks the running of the uncompressor if the parent is null. I've
tested this and it passes all tests and fixes the previously attached document
as well as some of my own.

If this fixed in deemed inappropriate, please do not fix with a Runtime error.
The documents contents have still been loaded correctly and should still be
useable in certain contexts.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45877] Null base style for paragraph results in crash

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

Nick Burch <ni...@alfresco.com> changed:

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

--- Comment #3 from Nick Burch <ni...@alfresco.com> 2010-09-19 07:53:03 EDT ---
I've just tried opening your document with POI on svn head, and it was loaded
fine, and we could get the text without error. Looks like the bug was fixed at
some point between when you reported this and today.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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