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]

java.io.In/OutputStreamReader/Writer.getEncoding() fixlet


Hi,

The following fixes two Mauve failures. When a stream is closed it
should return null according to the spec.

2003-02-13  Mark Wielaard  <mark@klomp.org>

        * java/io/InputStreamReader.java (getEncoding): Return null when
        closed.
        * java/io/OutputStreamWriter.java (getEncoding): Likewise.

I am checking this in on branch and mainline.

Cheers,

Mark
Index: java/io/InputStreamReader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/InputStreamReader.java,v
retrieving revision 1.10
diff -u -r1.10 InputStreamReader.java
--- java/io/InputStreamReader.java	6 Aug 2001 22:01:32 -0000	1.10
+++ java/io/InputStreamReader.java	13 Feb 2003 23:23:56 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2003  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -70,7 +70,10 @@
       }
   }
 
-  public String getEncoding() { return converter.getName(); }
+  public String getEncoding()
+  {
+    return in != null ? converter.getName() : null;
+  }
 
   public boolean ready() throws IOException
   {
Index: java/io/OutputStreamWriter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/OutputStreamWriter.java,v
retrieving revision 1.10
diff -u -r1.10 OutputStreamWriter.java
--- java/io/OutputStreamWriter.java	20 Feb 2001 19:01:55 -0000	1.10
+++ java/io/OutputStreamWriter.java	13 Feb 2003 23:23:56 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000, 2001  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2003  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -28,7 +28,10 @@
   private char[] work;
   private int wcount;
 
-  public String getEncoding() { return converter.getName(); }
+  public String getEncoding()
+  {
+    return out != null ? converter.getName() : null;
+  }
 
   private OutputStreamWriter(OutputStream out, UnicodeToBytes encoder)
   {

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