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

Returning null from Callable throws exception

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 6
    • 5.0
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      If a Callable returns null, calling Future.get() throws the following exception:

      java.util.concurrent.ExecutionException: java.lang.RuntimeException: An unexpected JNI error has occurred: [JMethod.invoke] Can not invoke an instance method on a null object.

      This behavior should be supported. My guess is that this issue requires a very simple fix.

      I believe this issue is important to fix because if ExecutorService is used on a server application, one should not be forced to return an Object from a Callable. Forcing object creation on a frequently-executed Callable, when it is not necessary, will result in undesirable overhead.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Future.get() should return null
      ACTUAL -
      Exception is thrown

      REPRODUCIBILITY :
      This bug can be reproduced always.

            martin Martin Buchholz
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: