From f50aa5059af99c4bc52ede25ee108e1e8705e7d4 Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Tue, 22 Jun 2004 17:21:23 +0000 Subject: [PATCH] re PR libgcj/16134 (Memory leak in String.getBytes()) PR libgcj/16134: * gnu/gcj/convert/BytesToUnicode.java: Canonicalize encoding name before cache lookup. Thanks to Hannes Wallnoefer. * gnu/gcj/convert/UnicodeToBytes.java: Likewise. From-SVN: r83501 --- libjava/ChangeLog | 7 +++++++ libjava/gnu/gcj/convert/BytesToUnicode.java | 3 ++- libjava/gnu/gcj/convert/UnicodeToBytes.java | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index a08f217de68..40eaea7f4d8 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +2004-06-22 Bryce McKinlay + + PR libgcj/16134: + * gnu/gcj/convert/BytesToUnicode.java: Canonicalize encoding name + before cache lookup. Thanks to Hannes Wallnoefer. + * gnu/gcj/convert/UnicodeToBytes.java: Likewise. + 2004-06-21 Andrew Haley * java/io/ObjectOutputStream.java: Add DEBUG statements diff --git a/libjava/gnu/gcj/convert/BytesToUnicode.java b/libjava/gnu/gcj/convert/BytesToUnicode.java index e7d042baab3..6dc5bfd569d 100644 --- a/libjava/gnu/gcj/convert/BytesToUnicode.java +++ b/libjava/gnu/gcj/convert/BytesToUnicode.java @@ -75,6 +75,7 @@ public abstract class BytesToUnicode extends IOConverter { /* 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 @@ public abstract class BytesToUnicode extends IOConverter } // 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 { diff --git a/libjava/gnu/gcj/convert/UnicodeToBytes.java b/libjava/gnu/gcj/convert/UnicodeToBytes.java index 0785d7ea43e..74600ec12c0 100644 --- a/libjava/gnu/gcj/convert/UnicodeToBytes.java +++ b/libjava/gnu/gcj/convert/UnicodeToBytes.java @@ -73,6 +73,7 @@ public abstract class UnicodeToBytes extends IOConverter { /* 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 @@ public abstract class UnicodeToBytes extends IOConverter } } - String className = "gnu.gcj.convert.Output_" + canonicalize (encoding); + String className = "gnu.gcj.convert.Output_" + encoding; Class encodingClass; try { -- 2.30.2