This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: PR 16134


Hannes Wallnoefer discovered that the encoder cache lookup in UnicodeToBytes and BytesToUnicode would always fail, because the cache code did not canonicalize the encoding name prior to lookup. This patch fixes the issue, I'm checking it in.

Bryce


2004-06-22  Bryce McKinlay  <mckinlay@redhat.com>

	PR libgcj/16134:
	* gnu/gcj/convert/BytesToUnicode.java: Canonicalize encoding name 
	before cache lookup. Thanks to Hannes Wallnoefer.
	* gnu/gcj/convert/UnicodeToBytes.java: Likewise.

Index: gnu/gcj/convert/BytesToUnicode.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/convert/BytesToUnicode.java,v
retrieving revision 1.9
diff -u -r1.9 BytesToUnicode.java
--- gnu/gcj/convert/BytesToUnicode.java	30 Jul 2001 20:24:17 -0000	1.9
+++ gnu/gcj/convert/BytesToUnicode.java	22 Jun 2004 17:16:05 -0000
@@ -75,6 +75,7 @@
   {
     /* First hunt in our cache to see if we have a decoder that is
        already allocated. */
+    encoding = canonicalize(encoding);
     synchronized (BytesToUnicode.class)
       {
 	int i;
@@ -91,7 +92,7 @@
       }
 
     // It's not in the cache, so now we have to do real work.
-    String className = "gnu.gcj.convert.Input_" + canonicalize (encoding);
+    String className = "gnu.gcj.convert.Input_" + encoding;
     Class decodingClass;
     try 
       { 
Index: gnu/gcj/convert/UnicodeToBytes.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/convert/UnicodeToBytes.java,v
retrieving revision 1.10
diff -u -r1.10 UnicodeToBytes.java
--- gnu/gcj/convert/UnicodeToBytes.java	7 Jun 2003 18:35:00 -0000	1.10
+++ gnu/gcj/convert/UnicodeToBytes.java	22 Jun 2004 17:16:05 -0000
@@ -73,6 +73,7 @@
   {
     /* First hunt in our cache to see if we have a encoder that is
        already allocated. */
+    encoding = canonicalize(encoding);
     synchronized (UnicodeToBytes.class)
       {
 	int i;
@@ -88,7 +89,7 @@
 	  }
       }
 
-    String className = "gnu.gcj.convert.Output_" + canonicalize (encoding);
+    String className = "gnu.gcj.convert.Output_" + encoding;
     Class encodingClass;
     try 
       { 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]