Bug 35511

Summary: NullPointerException at org.apache.poi.hssf.record.SSTSerializer.calculateUnicodeSize
Product: POI Reporter: Tu Duyen Tran <tuduyen.tran>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 2.5-FINAL   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Tu Duyen Tran 2005-06-27 15:18:39 UTC
I am receiving a NullPointerException when I call Workbook.write().  The trace 
is below.  I've also attached the method in which I call write().


java.lang.NullPointerException 

.at org.apache.poi.hssf.record.SSTSerializer.calculateUnicodeSize
(SSTSerializer.

.at org.apache.poi.hssf.record.SSTRecordSizeCalculator.getRecordSize
(SSTRecordSi

.at org.apache.poi.hssf.record.SSTRecord.getRecordSize(SSTRecord.java:499) 

.at org.apache.poi.hssf.model.Workbook.getSize(Workbook.java:756) 

.at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:768) 

.at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:732) 

.at com.timeinc.tcs.compsub.admin.DisplayXLS.process(DisplayXLS.java:132) 

.at com.timeinc.tcs.compsub.admin.DisplayXLS.doGet(DisplayXLS.java:59) 
=============================================================================

public String process() throws IOException{

    //System.out.println("***"+props.SHEETNAME_RPT);
	File temp = File.createTempFile("CSB",".xls");
	temp.deleteOnExit();
	   	
	try{			
		
		// SET UP WORKBOOK AND SHEETS
		wb = getTemplate();
		setStyles();
		setReportSheet(); 
			
		setReportHeaderSheet();
		
		setInstructionSheet(); 
		BufferedOutputStream bos = new BufferedOutputStream(new 
FileOutputStream(temp));
		wb.write(bos);	
		bos.flush();
	  	bos.close();
		
	} catch (Exception e) {
		e.printStackTrace(System.out);	
	}
	
	return temp.getCanonicalPath();
}
Comment 1 Amol Deshmukh 2005-06-27 18:55:44 UTC
Apparently the calls in the stack trace no longer exist in the version in CVS
HEAD. Specifically,
org.apache.poi.hssf.record.SSTRecordSizeCalculator.getRecordSize() no longer has
a call to rg.apache.poi.hssf.record.SSTSerializer.calculateUnicodeSize(..). The
call existed in a previous version.

Can you build from source and verify that the latest from CVS does not give the
exception? ...or wait couple of days till the next release and test against that.
Comment 2 Jason Height 2005-08-25 05:03:16 UTC
Wel this has been completely rewritten in HEAD. As amol suggested a new release
is just arround the corner, or get the latest from CVS if you are game.

Jason