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

Passing null or undefined to adapter class constructors results in NPE or ClassCastException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • None
    • core-libs
    • None
    • b82
    • generic
    • generic

      The following scripts result in crash:

      var cl = new java.lang.ClassLoader(null); // -> NPE
      var cl = new java.lang.ClassLoader(undefined); //-> ClassCastException
      var r = new java.lang.Runnable(null); // RuntimeException that tells can't find correct constructor!
      var r = new java.lang.Runnable(undefined); // same as above.

      It'd be better if we uniformly throw TypeError for these cases - that tells the passed object is not a script "Object".

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: