-
Bug
-
Resolution: Fixed
-
P2
-
6u18
-
b05
-
generic, x86
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2198844 | 7 | Roman Kennke | P2 | Resolved | Fixed | b104 |
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 ###@###.###
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 ###@###.###
- backported by
-
JDK-2198844 IntegrationService association API should check arguments
- Resolved
- duplicates
-
JDK-6889917 requestAssociation with empty file extension string {""} throws StringIndexOutOfBoundsException
- Closed
-
JDK-6889918 hasAssociation with empty file extension string {""} throws StringIndexOutOfBoundsException java
- Closed
-
JDK-6889939 RequestAssociation with invalid mime returns true.-IntegrationService
- Closed