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.java: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.java:68)
at com.genscape.fieldloader.UnitDataSheetFieldLoader.loadUnitDataFile(UnitDataSheetFieldLoader.java:50)
at com.genscape.fieldloader.UnitDataSheetFieldLoader.main(UnitDataSheetFieldLoader.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: [EMAIL PROTECTED]
Office: (502) 583-3730
Mobile: (502) 314-0444
test.xls
Description: MS-Excel spreadsheet
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
