public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/21068] New: String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException
@ 2005-04-17 12:41 gruni dot ca at gmail dot com
  2005-04-17 12:43 ` [Bug java/21068] " gruni dot ca at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gruni dot ca at gmail dot com @ 2005-04-17 12:41 UTC (permalink / raw)
  To: java-prs

The constructor String(strBytes, "UTF-16LE"); throws a
UnsupportedEncodingException which is not logical, becasue the Charset is
supported according to Charset.availableCharsets()
TestCase will follow. This is my output

Available Charsets are:
{ISO-8859-1=ISO-8859-1, US-ASCII=US-ASCII, UTF-16=UTF-16, UTF-16BE=UTF-16BE,
UTF-16LE=UTF-16LE, UTF-8=UTF-8}
Exception in thread "main" java.io.UnsupportedEncodingException: UTF-16LE
(java.lang.ClassNotFoundException: gnu.gcj.con
vert.Input_UnicodeLittle not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:.\], parent=gnu.gcj.runtime.VMClassLo
ader{urls=[core:/], parent=null}})
   at GcjStringTest.main(java.lang.String[])
(E:\2004-development\2005-extraextra\src\GcjStringTest.java)
   at ._main (C:\DOKUME~1\GRUNEW~1\LOKALE~1\Temp\ccM5baaa.i)

And accoring to the APIdocs:

String

public String(byte[] bytes,
              String charsetName)
       throws UnsupportedEncodingException

    Constructs a new String by decoding the specified array of bytes using the
specified charset. The length of the new String is a function of the charset,
and hence may not be equal to the length of the byte array.

    The behavior of this constructor when the given bytes are not valid in the
given charset is unspecified. The CharsetDecoder class should be used when more
control over the decoding process is required.

Parameters:
    bytes - the bytes to be decoded into characters
    charsetName - the name of a supported charset 
Throws:
    UnsupportedEncodingException - If the named charset is not supported
Since:
    JDK1.1 

The charset should be taken out of the Charsets class.

So ya this is a bug in my eyes.

Regards,

Andreas

-- 
           Summary: String(strBytes, "UTF-16LE"); thorws
                    java.io.UnsupportedEncodingException
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gruni dot ca at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21068


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-15 21:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-17 12:41 [Bug java/21068] New: String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException gruni dot ca at gmail dot com
2005-04-17 12:43 ` [Bug java/21068] " gruni dot ca at gmail dot com
2005-04-17 14:37 ` [Bug libgcj/21068] " pinskia at gcc dot gnu dot org
2005-04-17 14:42 ` pinskia at gcc dot gnu dot org
2005-04-17 15:21 ` ovidr at users dot sourceforge dot net
2005-04-17 17:27 ` gruni dot ca at gmail dot com
2005-07-15 21:41 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).