Bug 32830 - Excel is corrupted when I try adding HYPERLINK formulas with long urls
Summary: Excel is corrupted when I try adding HYPERLINK formulas with long urls
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.5-FINAL
Hardware: All All
: P2 major with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-23 15:14 UTC by oded
Modified: 2008-05-10 19:16 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oded 2004-12-23 15:14:20 UTC
Excel is corrupted when I try adding HYPERLINK formulas with long urls.
The code is:

  col1.setCellType(HSSFCell.CELL_TYPE_FORMULA);                        
  String formula = "HYPERLINK(\"" +  url + "\"" + ")";
  col1.setCellFormula(formula);                                    

This creats a corrupt Excel for the url:
http://www.fundacioncondor.org.ar/sitio/modules/My_eGallery/public/wamu/index.p
hp?MfcISAPICommand=VerifyFPP&UsingSSL=1&login=&pass=

For a the URL:
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
I got the following Exception:

java.lang.ArrayIndexOutOfBoundsException: 2378
	at org.apache.poi.util.StringUtil.putCompressedUnicode
(StringUtil.java:196)
	at org.apache.poi.hssf.record.formula.StringPtg.writeBytes
(StringPtg.java:97)
	at org.apache.poi.hssf.record.FormulaRecord.serializePtgs
(FormulaRecord.java:407)
	at org.apache.poi.hssf.record.FormulaRecord.serialize
(FormulaRecord.java:361)
	at 
org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate.serialize
(FormulaRecordAggregate.java:84)
	at 
org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate.serialize
(ValueRecordsAggregate.java:153)
	at org.apache.poi.hssf.model.Sheet.serialize(Sheet.java:815)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes
(HSSFWorkbook.java:794)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.write
(HSSFWorkbook.java:732)
	at cyota.fraudaction.util.AOLDailyResultSender.main
(AOLDailyResultSender.java:98)



Other than that it's super. Great job!

Oded
Comment 1 Josh Micich 2008-05-10 19:16:03 UTC
Retested OK in 3.1-beta1.

ArrayIndexOutOfBoundsException reproducible in 2.5.1

This bug seems to have been fixed in 3.0.