Bug 14269 - [PATCH] - CellReference NumberFormatException
Summary: [PATCH] - CellReference NumberFormatException
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-dev
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-05 19:59 UTC by Dennis Doubleday
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments
Patch to fix reported problem (8.87 KB, patch)
2002-11-05 20:00 UTC, Dennis Doubleday
Details | Diff
Fixed patch file that doesn't have a println accidentally left in (8.82 KB, patch)
2002-11-07 20:03 UTC, Dennis Doubleday
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Doubleday 2002-11-05 19:59:11 UTC
int nameNum = book.getNumberOfNames();
for (int i = 0; i < nameNum; i++) {
    HSSFName namedRef = book.getNameAt(i);
    System.out.println("Cell ref = " + namedRef.getReference());
    CellReference cellRef = new CellReference(namedRef.getReference());
}

results in: 

Cell ref = Summary!$D$31
java.lang.NumberFormatException: D$31 	
  at java.lang.Integer.parseInt(Integer.java:426) 	
  at java.lang.Integer.parseInt(Integer.java:476) 	
  at
org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:82)

because it doesn't seem to be parsing the string right (it doesn't pass
over the sheet name before trying to parse row/col information out.

Patch is attached.
Comment 1 Dennis Doubleday 2002-11-05 20:00:17 UTC
Created attachment 3742 [details]
Patch to fix reported problem
Comment 2 Dennis Doubleday 2002-11-07 20:03:25 UTC
Created attachment 3768 [details]
Fixed patch file that doesn't have a println accidentally left in
Comment 3 Dennis Doubleday 2002-11-07 20:04:23 UTC
Oops, I accidentally left in a println() in the first patch. Use the second
attached patch file please.
Comment 4 Andy Oliver 2002-11-28 19:27:35 UTC
applied, sold out, tonight.  Please crosscheck.  It would be good if we had a
unit test for the same.