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

             Bug #: 52420
           Summary: WordToHtmlConverter NullPointerException in
                    compactChildNodesR method
           Product: POI
           Version: 3.8-dev
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HWPF
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


While running Apache POI on android with simple application I found that
AbstractWordUtils class throws NullPointerException in compactChildNodesR
method.
This is due to -

 while ( child2.getChildNodes().getLength() > 0 )
  child1.appendChild( child2.getFirstChild() );
// following line causes NullPointerException
 child2.getParentNode().removeChild( child2 );
 i--;

I think a check should be there before removing this child. After adding a
check my simple application is able to convert doc files to html on Android
platform.

Following is the code change that I have done -

 while ( child2.getChildNodes().getLength() > 0 )
  child1.appendChild( child2.getFirstChild() );
 if(child2.getParentNode()!=null){
  child2.getParentNode().removeChild( child2 );
  i--;
 }

-- 
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to