This is the mail archive of the java-discuss@sourceware.cygnus.com 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]

[patch #2] String.getBytes()


According to the JDK 1.2 docs, getBytes() isn't supposed to throw an
UnsupportedEncodingException. I have confirmed this with JDK 1.2/javac

regards

  [ bryce ]

RCS file: /cvs/java/libgcj/libjava/java/lang/String.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 String.java
--- String.java 1999/04/07 14:52:38     1.1.1.1
+++ String.java 1999/04/21 09:12:58
@@ -132,9 +132,16 @@
   public native void getChars (int srcBegin, int srcEnd,
                               char[] dst, int dstBegin);

-  public byte[] getBytes () throws UnsupportedEncodingException
+  public byte[] getBytes ()
   {
-    return getBytes (System.getProperty("file.encoding", "8859_1"));
+    try
+      {
+        return getBytes (System.getProperty("file.encoding",
"8859_1"));
+      }
+    catch (UnsupportedEncodingException x)
+      {
+        // shouldn't happen
+      }
   }



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