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

RhinoScriptEngine bug : ScriptException cause not set (with fix)

XMLWordPrintable

    • b128
    • x86
    • windows_xp
    • Verified

      FULL PRODUCT VERSION :
      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

      Same happens here with the update 10 and the update 14

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

      A DESCRIPTION OF THE PROBLEM :

      I have a really annoying bug in RhinoScriptEngine.invoke(Object thiz, String
      name, Object... args)
      (line 208 on openjdk-6-src-b05-12_feb_2008)


      } catch (RhinoException re) {
        if (DEBUG) re.printStackTrace();
        int line = (line = re.lineNumber()) == 0 ? -1 : line;
        throw new ScriptException(re.toString(), re.sourceName(), line);
      }

      should be

      } catch (RhinoException re) {
        if (DEBUG) re.printStackTrace();
        int line = (line = re.lineNumber()) == 0 ? -1 : line;
        ScriptException se = new new ScriptException(re.toString(), re.sourceName(),
      line);
        se.initCause(re);
        throw se;
      }

      Else we loss the embedded cause Exception.
      Without that i cannot retrieve my root exception without ugly hacks

      Regards,
      Raphael

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      see description

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -

      try {
        ...
      } try (ScriptException se) {
        assert( null != se.getCause() );
      }
      ACTUAL -
      failed

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      see description
      ---------- END SOURCE ----------

            sundar Sundararajan Athijegannathan
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: