Bug 44510 - Reading and writing file with Dropdown doesn't work in 3.0.2 anymore
Summary: Reading and writing file with Dropdown doesn't work in 3.0.2 anymore
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 45004 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-29 05:46 UTC by Michael
Modified: 2009-12-30 17:06 UTC (History)
1 user (show)



Attachments
Cell G6 contains a simple dropdown. Reading and writing back to a new xls doesn't work in 3.0.2 (15.00 KB, application/vnd.ms-excel)
2008-02-29 05:46 UTC, Michael
Details
svn diff of changes to DVALRecord (1.59 KB, patch)
2008-02-29 14:14 UTC, Josh Micich
Details | Diff
tar bz2 of one added test class (1.20 KB, patch)
2008-02-29 14:15 UTC, Josh Micich
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2008-02-29 05:46:59 UTC
Created attachment 21602 [details]
Cell G6 contains a simple dropdown. Reading and writing back to a new xls doesn't work in 3.0.2

I'd like to read a simple Excel file containing a dropdown list (data validation) and write it back into a new one. The whole thing worked with POI 3.0.1 but not in
with the new POI revision 3.0.2:

1. Read a simple Excel-file with dropdown:
	InputStream input = MyClass.class.getResourceAsStream(
"simple_dropdown.xls" );
	POIFSFileSystem fs = new POIFSFileSystem( input );
	HSSFWorkbook wb = new HSSFWorkbook(fs);

2. Write the Excel file into another file:
	FileOutputStream out = new FileOutputStream("output.xls");
	wb.write(out);
	out.close();

Now, here's the thing:
- My Excel file only contains a dropdown-list, no further special formatting or other stuff!
- If i do the steps above with POI 3.0.1, the dropdown list still exists
in the output file
- If i do the exact same thing with POI 3.0.2, the dropdown is gone in the output-file. The cell only contains the value which was selected in the input file. The validation rule of the cell is also gone, it is set back to "any value".

Am I doing anything wrong?

Michael
Comment 1 Josh Micich 2008-02-29 14:14:20 UTC
Created attachment 21606 [details]
svn diff of changes to DVALRecord
Comment 2 Josh Micich 2008-02-29 14:15:42 UTC
Created attachment 21607 [details]
tar bz2 of one added test class
Comment 3 Josh Micich 2008-02-29 14:22:52 UTC
The problem was due to a combination of in-line field declaration/initialisations, and using the template pattern during instance initialization.  It's very easy to miss the fact that the field initialisations run _after_ the super constructor, which called fillFields() on the current class first.
Comment 4 Nick Burch 2008-03-03 08:08:18 UTC
Thanks for the patch Josh, applied to svn
Comment 5 Josh Micich 2008-05-15 11:56:41 UTC
*** Bug 45004 has been marked as a duplicate of this bug. ***
Comment 6 Josh Micich 2009-12-30 17:06:41 UTC
Fix was applied in svn r633151