Test case for double

"Wolfgang Fahl" <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Organization BITPlan GmbH
Message-ID <[email protected]>
Dear httpunit developers,

bmjohnson has supplied [ 1100437 ] Patch for 
ClassCastException in FormControl (see below) as an 
anonymous sourceforge developer.

I'd happily add this patch if I had a test case for it.
Could somebody please let me know how to reproduce the 
situation bmjohnson describes (hopefully yourself if you 
get this e-mail ...)

Yourss
  Wolfgang

bmjohnson wrote:
>as getting a ClassCastException on line 1348, then on
>line 1186 of FormControl.java. The JS engine is passing
>an instance of Double for a form with "-1" as a value,
>making the validation done here fail due to the
>expectation being a String. Also, the Double instance
>makes itself into a String as "-1.0" which doesn't 
>match the element in the options which is "-1".




Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.50
diff -r1.50 FormControl.java
1186c1186
<             if (!_listBox) throw new IllegalParameterValueException( getName(), (String) values.get(0), getOptionValues() );
---
>             if (!_listBox) throw new IllegalParameterValueException( getName(), values.get(0).toString(), getOptionValues() );
1348c1348
<                 String value = (String) values.get( i );
---
>                 Object value = values.get( i );
1350a1351,1354
> 		    // value could be Double '-1.0' with String '-1' which should match
> 		    if (!selected && value instanceof Double) {
> 			selected = options[j].getValue().equals("" + ((Double)value).intValue());
> 		    }




BITPlan - smart solutions
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 1805 - BITPLAN / +49 1805 248 752, Fax +49 2154 811-481
Web: http://www.bitplan.de
bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548, 
Geschäftsführer: Wolfgang Fahl

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.