Bug 56954

Summary: [PATCH] Example FromHowTo throws Exception after the first cell with a string
Product: POI Reporter: Arturo <arturo.nospam+poi>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: trivial    
Priority: P2    
Version: 3.11-dev   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: Reset the flag nextIsString since it has been successfully used

Description Arturo 2014-09-11 06:37:28 UTC
Created attachment 31995 [details]
Reset the flag nextIsString since it has been successfully used

Hello. My name is Arturo. I’ve been using Apache POI for a number of years. I’m now learning the Event API for reading XLSX files.

I think I found a small bug on the example:

http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java

The example throws an Exception when reading a small xlsx file with the following contents:

+-----+-----+
|  A  |  1  |
+-----+-----+
|  B  |  2  |
+-----+-----+

I’ve fixed with just adding a line.

Sorry if the patch attachment isn't in the right format. This is my first time. I promise to learn.
Comment 1 Nick Burch 2014-09-11 09:37:17 UTC
Looks like the example on the site was updated for this case (fix slightly different), but the example in the source tree wasn't. I've brought over the fix from the site in r1624237 - can you check if that fixes it for you?

It does remind me that we should probably look at doing what a few other Apache projects have done, and have the examples only in svn as code, then pull them into the website when it gets built. That would also let us add unit tests for the examples, which'd catch things like this! Something to consider for the future...
Comment 2 Arturo 2014-09-14 00:13:24 UTC
(In reply to Nick Burch from comment #1)
> Looks like the example on the site was updated for this case (fix slightly
> different), but the example in the source tree wasn't. I've brought over the
> fix from the site in r1624237 - can you check if that fixes it for you?

Yes, it totally fixed it. Thank you!

> It does remind me that we should probably look at doing what a few other
> Apache projects have done, and have the examples only in svn as code, then
> pull them into the website when it gets built.

Sounds good for people like me which don't know where is everything. :)

> That would also let us add unit tests for the examples, which'd catch
> things like this! Something to consider for the future...

This bug can be closed. Can I do it, or you do it?
Comment 3 Dominik Stadler 2014-10-10 11:29:18 UTC
Resolved as far as I see.