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

Javascript - Overloaded Method Resolution : Desambiguation when passing null

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 6u24
    • deploy

      A DESCRIPTION OF THE REQUEST :
      Include a way to desambiguate javascript calls to overloaded java methods, where the parameters which differentiate the methods are optional (null is a valid value).




      JUSTIFICATION :
      The "javax.xml.crypto.dsig.XMLSignatureFactory" class contains an overloaded method "newCanonicalizationMethod" which differ only in the type of the 2nd parameter, which is optional (null):

      public abstract CanonicalizationMethod newCanonicalizationMethod(String algorithm, C14NMethodParameterSpec params);

      and

      public abstract CanonicalizationMethod newCanonicalizationMethod(String algorithm, XMLStructure params);

      Using plugin2, there appears to be no way to pass null and successfully differentiate the methods.

      Even using reflections tricks such as passing:
        java.lang.Class.forName("javax.xml.crypto.dsig.spec.ExcC14NParameterSpec" ).cast(null)

      the same error is reported.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      any way of specifying which of the two methods should be called.

      ACTUAL -
      Current behaviour is to throw a java.lang.IllegalArgumentException: "More than one method matching name Method and arguments [.., null] "

      ---------- BEGIN SOURCE ----------
      <html>
      <applet name="myApplet" code="..... " archive="...." />
      <script/>
      var Packages = document.myApplet.Packages;
      var java = Packages.java;

      var xmlFac = Packages.javax.xml.crypto.dsig.XMLSignatureFactory.getInstance( "DOM" );

      var cm = xmlFac.newCanonicalizationMethod(
          Packages.javax.xml.crypto.dsig.CanonicalizationMethod.INCLUSIVE,
         null );

      // -- OR --
      var cm = xmlFac.newCanonicalizationMethod(
          Packages.javax.xml.crypto.dsig.CanonicalizationMethod.INCLUSIVE,
      java.lang.Class.forName("javax.xml.crypto.dsig.spec.ExcC14NParameterSpec" ).cast(null) );
      </script >
      </html>
      ---------- END SOURCE ----------

            cbensen Chris Bensen (Inactive)
            alexp Alexander Potochkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: