×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




What line of code in loveladyTest is line 21? It's telling you something
somewhere is null.
--
James R. Perkins
http://twitter.com/the_jamezp


On Mon, Aug 24, 2009 at 08:40, Dennis Lovelady <iseries@xxxxxxxxxxxx> wrote:

Happy Monday!



I've been using the POI 3.2-FINAL objects for quite a while on a few
systems, and have now run across a problem for which I find no solution; I
wonder if I might get some guidance from this list.



I can open, read and digest all the rows and cells on one particular
spreadsheet on a V5R3 system. But when I move that same spreadsheet to a
V5R4 system, I receive the subject message (stack trace below). To isolate
the cause of this issue, I used a simple JAVA program (source below) and
ran
it on the same (failing) system, and received the same failure. I did
check
all the normal stuff (like ASCII-mode FTP, et cetera), and I find no
problem. I can FTP that same file back to the V5R3 system, and process it
without problem. I wonder if this might be the result of some configurable
parameter within iSeries Java, but am at a loss as to what to tweak.



One last thing: the V5R4 system is capable of reading other spreadsheets
I've tried without issue. I don't want to bring this to the POI community
(yet) due to the suspicion that this is an iSeries-specific or
configuration-specific issue.



Would appreciate any help.



Stack:

org.apache.poi.hssf.record.RecordFormatException: Unable to construct
record
instance, the following exception occured: null

at java.lang.Throwable.<init>(Throwable.java:195)

at java.lang.Exception.<init>(Exception.java:41)

at java.lang.RuntimeException.<init>(RuntimeException.java:43)

at

org.apache.poi.hssf.record.RecordFormatException.<init>(RecordFormatExceptio
n.java:31)

at

org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:237
)

at

org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:16
0)

at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)

at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)

at loveladyTest.main(loveladyTest.java:21)





Java program:



import java.io.IOException;

import java.io.InputStream;

import java.util.Iterator;

import org.apache.poi.poifs.filesystem.POIFSFileSystem;

import org.apache.poi.hssf.usermodel.HSSFCell;

import org.apache.poi.hssf.usermodel.HSSFSheet;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import org.apache.poi.hssf.usermodel.HSSFRow;

/**

* A simple POI example of opening an Excel spreadsheet

* and writing its contents to the command line.

* @author Tony Sintes

*/

public class loveladyTest {

public static void main( String [] args ) {

try {

InputStream input =

loveladyTest.class.getResourceAsStream(
"BreakageMar09Data.xls" );

POIFSFileSystem fs = new POIFSFileSystem( input );

HSSFWorkbook wb = new HSSFWorkbook(fs);

HSSFSheet sheet = wb.getSheetAt(0);



// Iterate over each row in the sheet

Iterator rows = sheet.rowIterator();

while( rows.hasNext() ) {

HSSFRow row = (HSSFRow) rows.next();

System.out.println( "Row #" + row.getRowNum() );



// Iterate over each cell in the row and print out the
cell's content

Iterator cells = row.cellIterator();

while( cells.hasNext() ) {

HSSFCell cell = (HSSFCell) cells.next();

System.out.println( "Cell #" + cell.getCellNum() );

switch ( cell.getCellType() ) {

case HSSFCell.CELL_TYPE_NUMERIC:

System.out.println( cell.getNumericCellValue()
);

break;

case HSSFCell.CELL_TYPE_STRING:

System.out.println( cell.getStringCellValue() );

break;

default:

System.out.println( "unsuported sell type" );

break;

}

}



}



} catch ( IOException ex ) {

ex.printStackTrace();

}

}

}





Regards,

Dennis E. Lovelady
AIM: delovelady MSN: fastcounter@xxxxxxxxxxxx
<http://www.linkedin.com/in/dennislovelady>
www.linkedin.com/in/dennislovelady --
"Smoking kills. If you're killed, you've lost a very important part of
your
life."
- actress Brooke Shield



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.