Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5073365

(thread) java.lang.Thread.SetPriority() raises a NullPointerException if a thread has exi

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b43
    • CPU:
      generic, x86
    • OS:
      linux, solaris, solaris_7, windows_2000

      Description

      Name: dk106046 Date: 07/13/2004

      Compile and run the following program.
      The setPriority method call will raise a NullPointerException.

      public class Npe extends java.lang.Thread {

          public void run(){
              try{
                  Thread.sleep(500);
              }catch(java.lang.InterruptedException e){}
          }

          public static void main(String[] args){
              Npe npe = new Npe();

              npe.start();
              try{
                  npe.join();
              }catch(java.lang.InterruptedException e){}

              npe.setPriority(java.lang.Thread.MIN_PRIORITY);
          }

      }

      The error message:

      Exception in thread "main" java.lang.NullPointerException
          at java.lang.Thread.setPriority(Thread.java:875)
          at Npe.main(Npe.java:18)

      obviously the line number in Thread.java will vary by build

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psoper Pete Soper (Inactive)
              Reporter:
              dkorbel David Korbel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: