[kaffe] CVS kaffe (robilad): Resynced with gnu classpath: nio fix

Kaffe CVS cvs-commits at kaffe.org
Wed May 18 14:28:03 PDT 2005


PatchSet 6545 
Date: 2005/05/18 21:23:04
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with gnu classpath: nio fix

2005-05-18  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-05-16  Tom Tromey  <tromey at redhat.com>

        * java/nio/charset/Charset.java (encode, decode): Synchronize on
        'this', not the class.

Members: 
	ChangeLog:1.4071->1.4072 
	libraries/javalib/java/nio/charset/Charset.java:1.14->1.15 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4071 kaffe/ChangeLog:1.4072
--- kaffe/ChangeLog:1.4071	Wed May 18 20:36:17 2005
+++ kaffe/ChangeLog	Wed May 18 21:23:04 2005
@@ -1,5 +1,14 @@
 2005-05-18  Dalibor Topic  <robilad at kaffe.org>
 
+	Resynced with GNU Classpath.
+
+	2005-05-16  Tom Tromey  <tromey at redhat.com>
+
+        * java/nio/charset/Charset.java (encode, decode): Synchronize on
+        'this', not the class.
+
+2005-05-18  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffe/version.c (printShortVersion):
 	Hey, it's 2005 already!
 
Index: kaffe/libraries/javalib/java/nio/charset/Charset.java
diff -u kaffe/libraries/javalib/java/nio/charset/Charset.java:1.14 kaffe/libraries/javalib/java/nio/charset/Charset.java:1.15
--- kaffe/libraries/javalib/java/nio/charset/Charset.java:1.14	Sun May 15 12:46:20 2005
+++ kaffe/libraries/javalib/java/nio/charset/Charset.java	Wed May 18 21:23:05 2005
@@ -329,25 +329,22 @@
     return true;
   }
 
-  public final ByteBuffer encode (CharBuffer cb)
+  // NB: This implementation serializes different threads calling
+  // Charset.encode(), a potential performance problem.  It might
+  // be better to remove the cache, or use ThreadLocal to cache on
+  // a per-thread basis.
+  public final synchronized ByteBuffer encode (CharBuffer cb)
   {
     try
       {
-        // NB: This implementation serializes different threads calling
-        // Charset.encode(), a potential performance problem.  It might
-        // be better to remove the cache, or use ThreadLocal to cache on
-        // a per-thread basis.
-        synchronized (Charset.class)
-          {
-            if (cachedEncoder == null)
-              {
-                cachedEncoder = newEncoder ()
-                  .onMalformedInput (CodingErrorAction.REPLACE)
-                  .onUnmappableCharacter (CodingErrorAction.REPLACE);
-              } else
- 	        cachedEncoder.reset();
-            return cachedEncoder.encode (cb);
-          }
+	if (cachedEncoder == null)
+	  {
+	    cachedEncoder = newEncoder ()
+	      .onMalformedInput (CodingErrorAction.REPLACE)
+	      .onUnmappableCharacter (CodingErrorAction.REPLACE);
+	  } else
+	  cachedEncoder.reset();
+	return cachedEncoder.encode (cb);
       }
     catch (CharacterCodingException e)
       {
@@ -360,26 +357,23 @@
     return encode (CharBuffer.wrap (str));
   }
 
-  public final CharBuffer decode (ByteBuffer bb)
+  // NB: This implementation serializes different threads calling
+  // Charset.decode(), a potential performance problem.  It might
+  // be better to remove the cache, or use ThreadLocal to cache on
+  // a per-thread basis.
+  public final synchronized CharBuffer decode (ByteBuffer bb)
   {
     try
       {
-        // NB: This implementation serializes different threads calling
-        // Charset.decode(), a potential performance problem.  It might
-        // be better to remove the cache, or use ThreadLocal to cache on
-        // a per-thread basis.
-        synchronized (Charset.class)
-          {
-            if (cachedDecoder == null)
-              {
-                cachedDecoder = newDecoder ()
-                  .onMalformedInput (CodingErrorAction.REPLACE)
-                  .onUnmappableCharacter (CodingErrorAction.REPLACE);
-              } else
- 	        cachedDecoder.reset();
+	if (cachedDecoder == null)
+	  {
+	    cachedDecoder = newDecoder ()
+	      .onMalformedInput (CodingErrorAction.REPLACE)
+	      .onUnmappableCharacter (CodingErrorAction.REPLACE);
+	  } else
+	  cachedDecoder.reset();
 
-            return cachedDecoder.decode (bb);
-          }
+	return cachedDecoder.decode (bb);
       }
     catch (CharacterCodingException e)
       {




More information about the kaffe mailing list