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 2005/06/30 17:50:39 UTC

DO NOT REPLY [Bug 35565] New: - HSSFCell.java: NullPtrExc in when HSSFWorkbook is created from file

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=35565>.
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=35565

           Summary: HSSFCell.java: NullPtrExc in  when HSSFWorkbook is
                    created from file
           Product: POI
           Version: 2.5
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: szitya@yahoo.com


The following error occured
  ---------------------------
  Exception in thread main
  java.lang.NullPointerException
        at org.apache.poi.hssf.model.Sheet.getNumColumnBreaks(Sheet.java:2721)
  ---------------------------

in the following code

  ---------------------------
  import java.io.FileInputStream;
  import java.io.IOException;

  import org.apache.poi.hssf.usermodel.HSSFSheet;
  import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  import org.apache.poi.poifs.filesystem.POIFSFileSystem;

  public class GridSetError  {
    public GridSetError( String fileName ) {

      System.out.println( "fileName : " + fileName );
      try {
        POIFSFileSystem pfs = new POIFSFileSystem( new FileInputStream( fileName
) );
        HSSFWorkbook sourceWorkbook = new HSSFWorkbook( pfs );
        HSSFSheet sourceSheet = sourceWorkbook.getSheetAt( 0 );
        System.out.println( sourceSheet.getColumnBreaks() );
      }
      catch( IOException ioE ) {}
    }

    public static void main(String[] args) {
      if( args.length > 0 ) {
        GridSetError gridSetError = new GridSetError( args[0] );
      }
    }
  }
  ---------------------------

Source XLS DOES NOT contain [VERTICALPAGEBREAK] record.

I think, Sheet.getNumColumnBreaks() ( and Sheet.getNumRowBreaks() ) should first
test if Sheet.colBreaks (and Sheet.rowBreaks) is not null and if it is, then
return 0 to HSSFSheet.getColumnBreaks() which would then return empty short[] to
the caller. This would not result in exception.

-- 
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: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/