poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 53107] New: NullPointer in AbstractWordUtils while transforming doc in html
Date Thu, 19 Apr 2012 12:58:54 GMT

             Bug #: 53107
           Summary: NullPointer in AbstractWordUtils while transforming
                    doc in html
           Product: POI
           Version: 3.8
          Platform: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: HWPF
        AssignedTo: dev@poi.apache.org
        ReportedBy: benoit.maggi@gmail.com
    Classification: Unclassified


I get a NullPointer while using poi in transforming doc in html.

The method getLevel (in ListTables) return a null while there is no null test
in  AbstractWordUtils (there are other place with no test)  

My temporary patch is to return an empty ListLevel (return new ListLevel();) 
at the end of getLevel! The transformation works fine.

I don't know which one is the best practice :
  - return an empty object ?
  - test null after each call of getLevel(...) ?

Here some codes :

It comes from :
org.apache.poi.hwpf.converter.AbstractWordUtils L232 :

        final ListLevel listLevel = listTables.getLevel( listId,
                paragraph.getIlvl() );

        if ( listLevel.getNumberText() == null )
            return EMPTY;

org.apache.poi.hwpf.model.ListTables L224 :

  public ListLevel getLevel(int listID, int level)
    ListData lst = _listMap.get(Integer.valueOf(listID));
    if(level < lst.numLevels()) {
        ListLevel lvl = lst.getLevels()[level];
        return lvl;
    log.log(POILogger.WARN, "Requested level " + level + " which was greater
than the maximum defined (" + lst.numLevels() + ")");
    return null;


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

View raw message