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

* [Bug java/21068] String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException
  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 ` gruni dot ca at gmail dot com
  2005-04-17 14:37 ` [Bug libgcj/21068] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gruni dot ca at gmail dot com @ 2005-04-17 12:43 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From gruni dot ca at gmail dot com  2005-04-17 12:43 -------
Created an attachment (id=8665)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8665&action=view)
Tests the String(strBytes, "UTF-16LE"); which shouldn't return an Exception

This is the testcase which runs without Exception in JDK but throws the
UnsupportedEncodingException when compiled with GCJ.
My system was WinXP with GCJ 4.0 from thisiscool.com

Hope someone can verify this bug.

-- 


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


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

* [Bug libgcj/21068] String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException
  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 ` pinskia at gcc dot gnu dot org
  2005-04-17 14:42 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-17 14:37 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-17 14:37 -------
(In reply to comment #1)
> This is the testcase which runs without Exception in JDK but throws the
> UnsupportedEncodingException when compiled with GCJ.
> My system was WinXP with GCJ 4.0 from thisiscool.com

Then this is most likely the static linking "bug".

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
          Component|java                        |libgcj


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


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

* [Bug libgcj/21068] String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException
  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
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-17 14:42 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-17 14:42 -------
(In reply to comment #2)
> Then this is most likely the static linking "bug".
In fact yes this is just the static linking problem, if anyone makes GCC make shared libraries for GCC 
that would be useful as nobody as volunteered yet.

-- 


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


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

* [Bug libgcj/21068] String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException
  2005-04-17 12:41 [Bug java/21068] New: String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException gruni dot ca at gmail dot com
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: ovidr at users dot sourceforge dot net @ 2005-04-17 15:21 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From ovidr at users dot sourceforge dot net  2005-04-17 15:21 -------
The work-around which forces inclusion of the needed class:

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

public class GcjStringTest {

  static {
    gnu.gcj.convert.Input_UnicodeLittle i_UL = new 
gnu.gcj.convert.Input_UnicodeLittle();
  }

  public static void main(String args[]) throws UnsupportedEncodingException{
    System.out.println("Available Charsets are:\n"
        +Charset.availableCharsets().toString());
    byte[] strBytes = {0x12,0x0A,0x14,0xF};
    //Creating String with UTF which is available according to Charsets
    String mine = new String(strBytes, "UTF-16LE");
    //shouldn't recieve Exception
    System.out.println("["+mine+"]");
  }
}

-- 


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


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

* [Bug libgcj/21068] String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException
  2005-04-17 12:41 [Bug java/21068] New: String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException gruni dot ca at gmail dot com
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: gruni dot ca at gmail dot com @ 2005-04-17 17:27 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From gruni dot ca at gmail dot com  2005-04-17 17:27 -------
Allright that solved this problem. Unfortunately I can not run the programm
anymore in JDK after adding the static. Is there a way to keep my sources
compatible with JDK and GCJ ? 

Regrads

Andreas

-- 


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


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

* [Bug libgcj/21068] String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException
  2005-04-17 12:41 [Bug java/21068] New: String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException gruni dot ca at gmail dot com
                   ` (4 preceding siblings ...)
  2005-04-17 17:27 ` gruni dot ca at gmail dot com
@ 2005-07-15 21:41 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-15 21:41 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-15 21:41 -------


*** This bug has been marked as a duplicate of 13708 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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).