hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: [http-core] test case fails
Date Sun, 05 Feb 2006 07:14:37 GMT
Hi Oleg,

works for blackdown 1.4.2 and IBM 1.5.0. Fails with IBM 1.4.2 because
of a bug in the EncodingUtils class:

     [java] 1)
testInvalidEncoding(org.apache.http.util.TestEncodingUtils)java.nio.charset.IllegalCharsetNameException:
This just aint right
     [java]     at java.nio.charset.Charset.checkName(Charset.java:305)
     [java]     at java.nio.charset.Charset.lookup(Charset.java:439)
     [java]     at java.nio.charset.Charset.forName(Charset.java:477)
     [java]     at
java.lang.StringCoding$DecoderCache.makeDecoder(StringCoding.java:109)
     [java]     at java.lang.StringCoding$1.run(StringCoding.java:155)
     [java]     at java.security.AccessController.doPrivileged1(Native Method)
     [java]     at
java.security.AccessController.doPrivileged(AccessController.java:351)
     [java]     at
java.lang.StringCoding$DecoderCache.getDecoder(StringCoding.java:152)
     [java]     at java.lang.StringCoding.getDecoder(StringCoding.java:304)
     [java]     at java.lang.StringCoding.decode(StringCoding.java:383)
     [java]     at java.lang.String.<init>(String.java:740)
     [java]     at
org.apache.http.util.EncodingUtils.getString(EncodingUtils.java:74)
     [java]     at
org.apache.http.util.EncodingUtils.getString(EncodingUtils.java:96)
     [java]     at
org.apache.http.util.TestEncodingUtils.testInvalidEncoding(TestEncodingUtils.java:190)


The JavaDoc for class Charset lists the valid characters in a charset name:
http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html

The space character used in the test is not among them. blackdown 1.4.2
and IBM 1.5.0 throw an UnsupportedEncodingException which is handled by
the catch in EncodingUtils. IBM 1.4.2 throws an IllegalCharsetNameException,
which is a correct reaction but not handled in EncodingUtils.

I suggest to change all catch(UnsupportedEncodingException) to
catch(RuntimeException), to avoid adding two catch clauses with
duplicate error handling code.

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message