Bug 53093 - NullPointerException in getParagraph
Summary: NullPointerException in getParagraph
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.8-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-17 12:22 UTC by Jim Stuhlmacher
Modified: 2016-07-19 11:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Stuhlmacher 2012-04-17 12:22:03 UTC
java.lang.NullPointerException
        at org.apache.poi.hwpf.usermodel.Paragraph.newParagraph(Paragraph.java:113)
        at org.apache.poi.hwpf.usermodel.Range.getParagraph(Range.java:888)
        at extractParamLpug.<init>(extractParamLpug.java:88)

This error was fixed by changing hwpf/usermodel/Paragraph.java:

113c113
<             if ( listLevel.getGrpprlPapx() != null )
---
>             if ( listLevel != null && listLevel.getGrpprlPapx() != null )
Comment 1 Sergey Vladimirov 2012-11-05 12:12:37 UTC
Jim,

Could you please provide an example file to check if error is still present?

Sergey
Comment 2 Jim Stuhlmacher 2012-11-06 00:08:55 UTC
The file contains proprietary information. I don't enough about doc format or the java code to recreate the file without the proprietary information. On the other hand, it is clear that a null pointer should not be de-referenced.
Comment 3 Sergey Vladimirov 2012-11-06 16:45:59 UTC
Jim,

It is possible that null pointer is occurred due to incorrect handling of some other internal structure, or just because document is corrupted.

Please, check if NPE is still thrown by trunk code, and if document is passing BFF validation.

Sergey
Comment 4 Jim Stuhlmacher 2012-11-07 20:02:03 UTC
After I made the change described in the Description, everything ran fine.  There was no exceptions and I got the results I was looking for.  Here is the output of BFF:

<BFFValidation path="X" datetime="11/07/12 13:55:08" result="PASSED">
</BFFValidation>

I replaced the file name above.
Comment 5 Javen O'Neal 2016-07-19 11:10:46 UTC
This was fixed in r1305810. POI 3.9 was the first final release to include this fix.