harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Petrenko (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-52) java.io.ByteArrayOutputStream.toString(String) throws IllegalCharsetNameException instead of UnsupportedEncodingException
Date Tue, 22 Aug 2006 14:25:17 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-52?page=comments#action_12429717 ] 
            
Alexey Petrenko commented on HARMONY-52:
----------------------------------------

This bug is not reproducible on current sources and should be closed. String.java moved to
luni module.

java version "1.5.0"
pre-alpha : not complete or compatible
svn = r433622, (Aug 22 2006), Windows/ia32/msvc 1310, debug build
http://incubator.apache.org/harmony
java.io.UnsupportedEncodingException: some charset
        at java.lang.String.getCharset(String.java:889)
        at java.lang.String.<init>(String.java:358)
        at Harmony52Test.main(Harmony52Test.java:4)
Caused by: java.nio.charset.IllegalCharsetNameException: The illegal charset nam
e is "some charset".
        at java.nio.charset.Charset.checkCharsetName(Charset.java:241)
        at java.nio.charset.Charset.forNameInternal(Charset.java:474)
        at java.nio.charset.Charset.forName(Charset.java:551)
        at java.lang.String.getCharset(String.java:887)
        at java.lang.String.<init>(String.java:358)
        ... 1 more

> java.io.ByteArrayOutputStream.toString(String) throws IllegalCharsetNameException instead
of UnsupportedEncodingException
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-52
>                 URL: http://issues.apache.org/jira/browse/HARMONY-52
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vladimir Ivanov
>         Assigned To: Tim Ellison
>         Attachments: StringTest.java
>
>
> java.io.ByteArrayOutputStream.toString(String) throws IllegalCharsetNameException instead
of UnsupportedEncodingException 
> j2se 1.4.2 and 1.5.0 says, that method java.io.ByteArrayOutputStream.toString(String)
>  throws UnsupportedEncodingException, if the named encoding is not supported.
> Code to reproduce:
> import java.io.*; 
>   
> public class test29 { 
>     public static void main(String[] args)  {
> 	ByteArrayOutputStream os = new ByteArrayOutputStream(); 
>         try { 
> 	    os.write("ababa".getBytes()); 
>             os.toString("this is the name \n of a nonexistent encoding" 
>                     + Math.random()); 
>         } catch(UnsupportedEncodingException e) { 
>             System.out.println("PASSED"); 
>         } catch(Exception e) { 
>             System.out.println("FAILED: " + e); 
>         } 
>    } 
> }  
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt. 
> 2. Compile test29.java using BEA 1.4 javac 
> > javac -d . test29.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32,
> Native Threads, GC strategy: parallel)
> PASSED
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as app
> licable.
> FAILED: java.nio.charset.IllegalCharsetNameException: The illegal charset name i
> s "this is the name
>  of a nonexistent encoding0.4487506282752648".
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native
Threads, GC strategy: parallel)
> PASSED
> C:\tmp\tmp17>
> junit test:
> ------------------------ ByteArrayOutputStreamTest.java -------------------------------------------------
> import java.io.*; 
> import junit.framework.*; 
>   
> public class ByteArrayOutputStreamTest extends TestCase { 
>     public static void main(String[] args) { 
>         junit.textui.TestRunner.run(ByteArrayOutputStreamTest.class); 
>     } 
>     public void testToString_String() { 
> 	ByteArrayOutputStream os = new ByteArrayOutputStream(); 
>         try { 
> 	    os.write("ababa".getBytes()); 
>             os.toString("this is the name \n of a nonexistent encoding" 
>                     + Math.random()); 
>         } catch(UnsupportedEncodingException e) { 
>         } catch(Exception e) { 
>             fail("Unexpected exception: " + e); 
>         } 
>     }
> } 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message