> > > >Marc: > > > >I have been generating comments and questions, and sending them to the > >'[EMAIL PROTECTED]', but they never show up on the mailing list. > > > >Am I missing something about how to do this? > > > >Issues I have raised include: > > HSSF Event API Behavior > > Hi: > > > > I have been conducting testing of reading a simple Excel spreadsheet > >using the HSSF Event API, and I encounter termination of the read with the > >exception: > > > > org.apache.poi.hssf.record.RecordFormatException: Error reading > >bytes > > at > >org.apache.poi.hssf.eventmodel.HSSFEventFactory.processEvents(HSSFEventFacto > >ry.java:179) > > at > >com.go2.dummy.XLSFormatParser.<init>(XLSFormatParser.java:76) > > at > >com.go2.dummy.SheetParserFactory.getSheetParser(SheetParserFactory.java:63) > > at com.go2.test.SSEventProcDev.main(SSEventProcDev.java:42) > > > > As far as I can tell by printing out the data records all of the > >spreadsheet was correctly read, at least as far as the actual data goes. Is > >this "normal" termination of a spreadsheet file read by the > >HSSFEventFactory?
This indicates that it hit an error -- a binary record it doesn't know how to handle (usually too short or long). What error it hit is beyond me. I'd need a copy of the XLS file. Just a guess: probably isn't in BIFF8 (Excel 97) format or is hybridized (such as StarOffice 5.1 produces). > > HSSF Event Model API Design Problem > > Hi: > > > > While working on developing an application using the HSSF event > >model, I have encountered what appears to me a serious problem with the > >current API design. > > > > It appears to require that I pass the thread of control to the > >HSSFEventFactory, which process the input stream and invokes my registered > >handlers to process the records., after which it returns (with a data read > >exception, which isn't nice, but that's another story). > > > > BUT - there seems to be no provision for my handlers aborting the > >processing if an error is detected. The HSSFListener interface declares no > >Exceptions, so none can be thrown. > > Generally you listener should call a handler method. Basically this is roughly AWT event handling. So your listener should generally handle all or most events and pass it to a method or series of methods. Those methods can then throw exceptions. If you look at the org.apache.poi.hssf.dev.EFHSSF example you'll see an example of this. > > This is a serious problem because if a fatal problem (from my > >requirements) is detected at the beginning of processing (in the > >DimensionRecord for example), there is no way to avoid crunching through > >what may be an excessively large spreadsheet (65556 rows by 1000 columns, > >say) and crashing my enterprise's app server. > > Ahh so you're talking about actually terminating the record processing. Humm. I hadn't thought of that. Glen any thoughts on this? Has this actually happened? I mean if you had such a spreadsheet it would be large, but I can't see it crashing anything at all. In the event of a desired stop of processing though I can see the opportunity for a dramatic efficiency gain (gosh where were you in January when I begged for someone to point out why this was so easy and what I was missing). Please stick this in Bugzilla as a feature request. I'm sure I or glen will get to it rather quickly if you're not able to contribute a patch for this. > > It should add and Exception that can be thrown by the API user (with > >appropriate revisions to the HSSFEventFactory) so that processing can be > >aborted with a user generated message. > > I'm not sure that an exception (as no error necessarily has occurred, you'd just like out please :-) would be appropriate here. I don't think this is necessarily as serious as you think, but the waste of cycles in such a circumstance is an important point that we should attend to! I love efficiency...processing the rest of a file when not desired is not efficient. I'm not sure I want an exception but perhaps some manner of callback. -Andy > > Carey Sublette > > > > > _________________________________________________________________ > Send and receive Hotmail on your mobile device: http://mobile.msn.com > -- http://www.superlinksoftware.com http://jakarta.apache.org/poi - port of Excel/Word/OLE 2 Compound Document format to java http://developer.java.sun.com/developer/bugParade/bugs/4487555.html - fix java generics! The avalanche has already started. It is too late for the pebbles to vote. -Ambassador Kosh
