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]

Re: Patch: do not throw UnsupportedOperationException from deprecated Thread methods


Hi,

Bryce McKinlay wrote:
Thomas Fitzsimmons wrote:
Some old applets still call these methods and fail with UnsupportedOperationExceptions. This patch makes these deprecated methods simply return.

OK to commit?

Tom

2006-05-28 Thomas Fitzsimmons <fitzsim@redhat.com>

    * java/lang/natThread.cc (countStackFrames): Do not throw
    UnsupportedOperationException.
    (resume): Likewise.
    (stop): Likewise.
    (suspend): Likewise.


OK - but could you add comments saying the methods are unimplemented but still used by old applets?

Attached patch committed.


Tom

Index: java/lang/natThread.cc
===================================================================
--- java/lang/natThread.cc	(revision 114136)
+++ java/lang/natThread.cc	(working copy)
@@ -20,7 +20,6 @@
 #include <java/lang/Thread.h>
 #include <java/lang/ThreadGroup.h>
 #include <java/lang/IllegalArgumentException.h>
-#include <java/lang/UnsupportedOperationException.h>
 #include <java/lang/IllegalThreadStateException.h>
 #include <java/lang/InterruptedException.h>
 #include <java/lang/NullPointerException.h>
@@ -91,8 +90,10 @@
 java::lang::Thread::countStackFrames (void)
 {
   // NOTE: This is deprecated in JDK 1.2.
-  throw new UnsupportedOperationException
-    (JvNewStringLatin1 ("Thread.countStackFrames unimplemented"));
+
+  // Old applets still call this method.  Rather than throwing
+  // UnsupportedOperationException we simply fail silently.
+
   return 0;
 }
 
@@ -150,8 +151,9 @@
 java::lang::Thread::resume (void)
 {
   checkAccess ();
-  throw new UnsupportedOperationException
-    (JvNewStringLatin1 ("Thread.resume unimplemented"));
+
+  // Old applets still call this method.  Rather than throwing
+  // UnsupportedOperationException we simply fail silently.
 }
 
 void
@@ -335,16 +337,18 @@
 java::lang::Thread::stop (java::lang::Throwable *)
 {
   checkAccess ();
-  throw new UnsupportedOperationException
-    (JvNewStringLatin1 ("Thread.stop unimplemented"));
+
+  // Old applets still call this method.  Rather than throwing
+  // UnsupportedOperationException we simply fail silently.
 }
 
 void
 java::lang::Thread::suspend (void)
 {
   checkAccess ();
-  throw new UnsupportedOperationException 
-    (JvNewStringLatin1 ("Thread.suspend unimplemented"));
+
+  // Old applets still call this method.  Rather than throwing
+  // UnsupportedOperationException we simply fail silently.
 }
 
 static int nextThreadNumber = 0;

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