Thanks again Scott.
I'm at a loss, too.
I changed the monitor block as you indicated, and I also changed it from
"on-error 301" to "on-error", just to make sure it catches everything.
I ran it in debug and it stepped right through all the If..null..
statements. Again, the value of wwstr was 8 and the value of wwFile was
11. Then when I stepped into the "wwPOIFS=
new_POIFSFileSystem(wwFile);" line, it took longer this time, but it
still abended. The monitor block didn't even catch it. WDSC just
throws a "program terminated" message, and my iSeries job says it ended
abnormally.
I also had another idea. I don't know what the
hssf_begin_object_group() routine is for, but it was being called from
within the upddemo program just prior to the hssf_open() routine, and
then again at the beginning of the hssf_open() routine itself. Seemed
like that might have been redundant, so I commented out the one in the
upddemo program and recompiled. But I still got the same results, so I
guess that didn't mean anything.
I guess I'll go ahead and send you my input file offline as you suggest,
although I'm not very hopeful, since I'm now using the file created by
your program, so it ought to work.
If it works for you, I guess I'll just give up and implement our lame
workaround.
Thanks again for sticking with me this far. It must be frustrating that
the reward/punishment for sharing your excellent software with people is
to have folks like me pestering you to help us make it work for us.
Three years later.
Greg
|-----Original Message-----
|From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
|bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
|Sent: Friday, November 30, 2007 1:36 PM
|To: RPG programming on the AS400 / iSeries
|Subject: Re: Java error when updating existing Excel spreadsheets using
|HSSF
|
|Hi Greg,
|
|All of the error messages I've seen so far indicate that the error is a
|null object reference (i.e. an RPG O=Object field that's set to *NULL
--
|or zero). Would you concur with this?
|
|> Then when I step into the "wwPOIFS = new_POIFSFileSystem(wwFile);"
|> statement the program terminates.
|
|If the error occurs on that line.... well, wwFile is the only input
|into new_POIFSFileSystem. So if you're getting a null object reference
|via JNI, then there's really only two possibilities... either the
|prototype for new_POIFSFileSystem() is wrong, or the wwFile variable is
|set to NULL.
|
|Trouble is... I know there are quite a few people using this routine
--
|including myself -- and I don't get the error your describing. That
|implies that the prototype is correct!
|
|But, you say that when you debug it, wwFile is not null... So I'm at a
|loss.
|
|Just to be absolutely sure, you might try changing the monitor block in
|hssf_open() to look like this:
|
|monitor;
| wwStr = new_String(peFilename);
| if wwStr <> *null;
| wwFile = new_FileInputStream(wwStr);
| if wwFile <> *null;
| wwPOIFS = new_POIFSFileSystem(wwFile);
| if wwPOIFS <> *null;
| wwBook = new_HSSFWorkbookFromPOIFS(wwPOIFS);
| endif;
| endif;
| endif;
|on-error 301;
| // catch error and proceed.
|endmon;
|
|That should guarantee that none of the inputs are null. The other
|possibility is that POFSFileSystem() is crashing due to a bug in the
|actual Java code. If that's the case, you should be able to send me
|your spreadsheet (off-list) and I should be able to reproduce the same
|problem you're having.
|
|Regarding debugging the Java code... I guess you could do that. I
|would suspect that you'd need to download the source code for POI and
|re-compile it with a debugging view. Then you should be able to debug
|it via WDSC. Barbara Morris has posted information on how to debug RPG
|calling JAva to this mailing list in the past. You might try searching
|the archives for tips.
|--
|This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
|list
|To post a message email: RPG400-L@xxxxxxxxxxxx
|To subscribe, unsubscribe, or change list options,
|visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
|or email: RPG400-L-request@xxxxxxxxxxxx
|Before posting, please take a moment to review the archives
|at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.