Bug 10935 - [PATCH] Sheet.getColumnWidth sometimes doesnt return the correct width
Summary: [PATCH] Sheet.getColumnWidth sometimes doesnt return the correct width
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 8906 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-18 03:45 UTC by Jason Height
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments
Patch to Sheet.java (487 bytes, patch)
2002-07-18 03:46 UTC, Jason Height
Details | Diff
TestHSSFSheet patch for column width test. Please commit both patches (731 bytes, patch)
2002-07-18 04:39 UTC, Jason Height
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Height 2002-07-18 03:45:24 UTC
The Sheet.getColumnWidth and Sheet.setColumnWidth if test within the for loop 
is not right so when the column lies within a columninfo range it doesnt return 
the correct columninfo object

Patch which corrects will be supplied immediately.

Patch to the unit tests to follow, so that the problem doesnt happen again.
Comment 1 Jason Height 2002-07-18 03:46:17 UTC
Created attachment 2390 [details]
Patch to Sheet.java
Comment 2 Jason Height 2002-07-18 04:39:23 UTC
Created attachment 2393 [details]
TestHSSFSheet patch for column width test. Please commit both patches
Comment 3 Andy Oliver 2002-07-18 12:19:15 UTC
After applying, here's what I get when doing ./build.sh clean compile test
please fix and reopen/attach and/or let me know what I'm doing wrong Thanks! ->

Compiling project examples with Java 1.3, debug on, optimize off, deprecation on

Compiling project contributions with Java 1.3, debug on, optimize off, deprecati
on on

test:
Created dir: D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\build\testcases
Compiling 103 source files to D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\build
\testcases
D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\src\testcases\org\apache\poi\hssf\u
sermodel\TestHSSFSheet.java:206: getColumnWidth(short) in org.apache.poi.hssf.us
ermodel.HSSFSheet cannot be applied to (int)
        assertEquals(sheet.getDefaultColumnWidth(), sheet.getColumnWidth(0));
                                                         ^
D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\src\testcases\org\apache\poi\hssf\u
sermodel\TestHSSFSheet.java:207: setColumnWidth(short,short) in org.apache.poi.h
ssf.usermodel.HSSFSheet cannot be applied to (int,int)
        sheet.setColumnWidth(0, 9000);
             ^
D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\src\testcases\org\apache\poi\hssf\u
sermodel\TestHSSFSheet.java:208: getColumnWidth(short) in org.apache.poi.hssf.us
ermodel.HSSFSheet cannot be applied to (int)
        assertEquals(9000, sheet.getColumnWidth(0));
                                ^
D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\src\testcases\org\apache\poi\hssf\u
sermodel\TestHSSFSheet.java:209: setColumnWidth(short,short) in org.apache.poi.h
ssf.usermodel.HSSFSheet cannot be applied to (int,int)
        sheet.setColumnWidth(2, 8000);
             ^
D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\src\testcases\org\apache\poi\hssf\u
sermodel\TestHSSFSheet.java:210: getColumnWidth(short) in org.apache.poi.hssf.us
ermodel.HSSFSheet cannot be applied to (int)
        assertEquals(8000, sheet.getColumnWidth(2));
                                ^
5 errors

BUILD FAILED
D:\andy\homestuff\jakarta-poi2\2\jakarta-poi\tools\cents\junit.cent\xbuild.xml:2
7: Compile failed; see the compiler error output for details.

Total time: 1 minute 37 seconds
Comment 4 Andy Oliver 2002-07-18 14:59:59 UTC
I fixed ti
Comment 5 Andy Oliver 2002-07-18 15:01:09 UTC
Applied, please cross check.  In the future please make sure you run "./build.sh
clean compile test" before submitting the patches.  Thanks for your patch!
Comment 6 Andy Oliver 2002-07-21 13:13:09 UTC
*** Bug 8906 has been marked as a duplicate of this bug. ***