Bug 12349 - [Patch] DataFormat not cannot return format string for formats not built-in
Summary: [Patch] DataFormat not cannot return format string for formats not built-in
Status: CLOSED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-dev
Hardware: Other other
: P1 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-06 03:12 UTC by Shawn Laubach
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Patch to fix this problem (2.02 KB, patch)
2002-09-06 03:13 UTC, Shawn Laubach
Details | Diff
test case java code (4.57 KB, text/plain)
2002-09-09 16:51 UTC, Elvira Gurevich
Details
test case excel file (14.00 KB, application/octet-stream)
2002-09-09 16:52 UTC, Elvira Gurevich
Details
Patch for what was not included using -u (1.07 KB, patch)
2002-09-09 18:26 UTC, Shawn Laubach
Details | Diff
Patch for the unit test that tests the functionality requested (1.16 KB, patch)
2002-09-10 16:47 UTC, Shawn Laubach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shawn Laubach 2002-09-06 03:12:34 UTC
Cannot retrieve format string for formats read from a file.
Comment 1 Shawn Laubach 2002-09-06 03:13:00 UTC
Created attachment 2947 [details]
Patch to fix this problem
Comment 2 Andy Oliver 2002-09-06 04:09:35 UTC
please remember to use diff -u  --  not only so its easier to read but so I
don't get funny premature EOF errors.  (dunno why but it doesn't happen with
diff -u)

Thanks!  Patch applied, please cross check.  BTW it might be nice to have a unit
test to check this.. .  (that way if something breaks with reading custom
formats we'll know)....

-Andy
Comment 3 Elvira Gurevich 2002-09-09 16:48:54 UTC
downloaded nightly build jakarta-poi-1.8.0-dev-20020909.jar
ran attached code  with the attached xls file, and the output received is as 
follows:
sheet Sheet1 first row 0, last row 9
sheet Sheet1 has 10 rows
row 0: first cell number: 0, lastCellNumber: 4, column count: 5
cell at row 0, col 0, value ID
cell at row 0, col 1, value Last Name
cell at row 0, col 2, value First Name
cell at row 0, col 3, value test Score
row 1: first cell number: 0, lastCellNumber: 4, column count: 5
General
cell at row 1, col 0, value 1
cell at row 1, col 1, value German
cell at row 1, col 2, value Konstantin
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 169; Array i
ndex out of range: 169
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 169
        at java.util.Vector.get(Vector.java:699)
        at org.apache.poi.hssf.usermodel.HSSFDataFormat.getFormat(HSSFDataFormat
.java:279)
        at ExcelTest.main(ExcelTest.java:101)

So the format that is out of range of the built-in formats is still not 
returned correctly.

Comment 4 Elvira Gurevich 2002-09-09 16:51:11 UTC
Created attachment 2974 [details]
test case java code
Comment 5 Elvira Gurevich 2002-09-09 16:52:25 UTC
Created attachment 2975 [details]
test case excel file
Comment 6 Shawn Laubach 2002-09-09 18:26:27 UTC
Created attachment 2977 [details]
Patch for what was not included using -u
Comment 7 Shawn Laubach 2002-09-09 18:28:19 UTC
Found the problem.  About 6 lines of code was not included in HSSFDataFormat.  
Added a patch that has these lines (using -u).  When these lines are there, 
had no problems with test case.  I'm sorry they did not get included.

Andy (or someone) could you apply these shortly.
Comment 8 Andy Oliver 2002-09-10 11:17:20 UTC
Thank you.  I'll commit this later today.  When you do diff -u patches I can
easily verify what is not included.  Not only that but they apply more
accurately for some reason.  I often have to apply the standard format patches
mostly by hand (so thats why I whine so much if someone sends one in the
standard format).  Thanks :-)
Comment 9 Andy Oliver 2002-09-10 11:21:02 UTC
Elvira, if you can't wait till tonight, just grab the latest sources from cvs
and do "patch -i patchfile" and "./build.sh clean compile jars" and you should
have it.      Shawn, could we get a unit test for this?  It must be not be
getting unit tests.  Or maybe Elvira could help. (see:
src/testcases/org/apache/poi/hssf/**)
Comment 10 Elvira Gurevich 2002-09-10 14:16:39 UTC
1. I don't use CVS, so could you please tell me how to get all files at once.
I know how to get one file.
2. Excel files that I am reading are created by excel. Maybe that's why I am 
getting all these problems that nobody had seen before. You are welcome to use 
the files attached to this bug. 
Comment 11 Shawn Laubach 2002-09-10 16:47:20 UTC
Created attachment 2992 [details]
Patch for the unit test that tests the functionality requested
Comment 12 Andy Oliver 2002-09-11 02:31:44 UTC
applied, please cross check.  
Comment 13 Elvira Gurevich 2002-09-17 18:29:14 UTC
the fix works