poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Cowherd <jonathan.cowh...@genscape.com>
Subject RE: HSSFSheet error when creating
Date Thu, 05 Jun 2003 14:52:14 GMT
Specifically, it occurs when:
 
    iworkbook = new HSSFWorkbook(idata); 
 
is called.

Jonathan Paul Cowherd
Linux and Java Administrator
Genscape, Inc.
Email:  jonathan.cowherd@genscape.com
Office: (502) 583-3730
Mobile: (502) 314-0444



-----Original Message-----
From: Jonathan Cowherd [mailto:jonathan.cowherd@genscape.com] 
Sent: Thursday, June 05, 2003 10:50 AM
To: 'poi-dev@jakarta.apache.org'
Subject: HSSFSheet error when creating 



When I load the attached file, I get a bizarre exception, which I can't
explain.  It lools like it attempts to set Properties from some sheets
(which I don't care about, just data).

<code> 
public HSSFWorkbook loadFile(String file) { 
  HSSFWorkbook iworkbook = null; 
    try { 
      InputStream idocument = new FileInputStream(file); 
      log.debug("File exists, reading..."); 
      POIFSFileSystem idata = new POIFSFileSystem(idocument); 
      log.debug("File " + file + " read."); 
      iworkbook = new HSSFWorkbook(idata); 
      log.debug("Excel Workbook found."); 
      idocument.close(); 
    } catch (FileNotFoundException e) { 
      log.fatal("File " + file + " can not be found."); 
    } catch (IOException e) { 
      e.printStackTrace(); 
      log.fatal("File or workbook " + file + " can not be read."); 
    } 
    return (iworkbook); 
} 
</code> 


java.lang.NullPointerException 
        at
org.apache.poi.hssf.usermodel.HSSFSheet.setPropertiesFromSheet(HSSFSheet.jav
a:171) 
        at
org.apache.poi.hssf.usermodel.HSSFSheet.<init>(HSSFSheet.java:134) 
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:154) 
        at
com.genscape.fieldloader.AbstractFieldLoader.loadFile(AbstractFieldLoader.ja
va:68) 
        at
com.genscape.fieldloader.UnitDataSheetFieldLoader.loadUnitDataFile(UnitDataS
heetFieldLoader.java:50) 
        at
com.genscape.fieldloader.UnitDataSheetFieldLoader.main(UnitDataSheetFieldLoa
der.java:60) 
Exception in thread "main" 

Should I attempt to force an encoding?  Can I bypass that step? 

Jonathan Paul Cowherd 
Linux and Java Administrator 
Genscape, Inc. 
Email:  jonathan.cowherd@genscape.com 
Office: (502) 583-3730 
Mobile: (502) 314-0444 




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message