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

IntegrationService association API should check arguments

    Details

    • Subcomponent:
    • Resolved In Build:
      b05
    • CPU:
      generic, x86
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        requestAssociation with null file extension throws NPE
        java.lang.NullPointerException
        at com.sun.jnlp.IntegrationServiceImpl.requestAssociation(Unknown Source)

        Since file extensions are optional parameter we may need to allow this or should throw IllegalArgumentException rather than throwing Null Pointer Exception.

        Example:
                        IntegrationService is = (IntegrationService)
                                ServiceManager.lookup("javax.jnlp.IntegrationService");
                        String mime = "abc/xyz";
                        boolean result = is.requestAssociation(mime,null);
        Grouped 3 other CRs into this one, as it is really only one problem.
        RequestAssociation with invalid mime returns true.

        I am requesting Invalid MIME (Mime syntax is [any char]+/[any char]+). RequestAssociation is returning true.

        I think it should return false here. I understand we are not checking the syntax of mime type.(and expecting user will know this ) But I think it should be nice to check these to make the api more robust.
        Example:
                        IntegrationService is = (IntegrationService)
                                ServiceManager.lookup("javax.jnlp.IntegrationService");
                        String mime = "abc";
                        String [] exts = {".abc"};
                        boolean result = is.requestAssociation(mime,exts);
        *** (#1 of 1): 2009-10-09 09:05:21 MESZ ###@###.###
        hasAssociation with empty file extension string {""} throws StringIndexOutOfBoundsException java
        null file extension throws NullPointerException.
        This is same as requestAssociation needs to change to either illegalArgumentException.

        Suppose we have assocition like this
            <association>
              <mime-type="application-x/swingset2-file"/>
            </association>
        If want to check hasAssocition("application-x/swingset2-file",null or {""}) ?
        Is <extensions> are mandatory ?
        *** (#1 of 1): 2009-10-09 06:36:52 MESZ ###@###.###
        requestAssociation with empty file extension string {""} throws StringIndexOutOfBoundsException
        java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(Unknown Source)
        at com.sun.deploy.association.utility.AppUtility.addDotToFileExtension(Unknown Source)
        at com.sun.deploy.association.Association.addFileExtension(Unknown Source)
        at com.sun.jnlp.IntegrationServiceImpl.hasAssociation(Unknown Source)

        Here again we may need throw either IllegalArgumentException or should not create any association with file extension should not throw this Runtime Exception.
                        IntegrationService is = (IntegrationService)
                                ServiceManager.lookup("javax.jnlp.IntegrationService");
                        String mime = "abc/xyz";
                        String [] exts = {""};
                        boolean result = is.requestAssociation(mime,exts);
        *** (#1 of 1): 2009-10-09 06:25:37 MESZ ###@###.###
        *** Last Edit: 2009-10-09 06:29:08 MESZ ###@###.###

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  rkennke Roman Kennke
                  Reporter:
                  rnairsunw Raghu Nair (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: