-
Bug
-
Resolution: Fixed
-
P2
-
6, 9
-
b132
-
generic
-
generic
-
Verified
Problem description:
====================
Specification for javax.smartcardio.CardPermission.CardPermission(String termName, String actions) states as follows:
---Quote from spec---
Parameters:
terminalName - the name of the card terminal, or *
actions - the action string (or null if the set of permitted actions is empty)
Throws:
NullPointerException - if terminalName is null
IllegalArgumentException - if actions is an invalid actions specification
---Quote from spec---
So, spec is explicitly allows to pass null actions parameter to a constructor.
But actually it throws an IllegalArgumentException in this case.
Minimized test:
===============
---Test.java---
import javax.smartcardio.*;
public class Test {
public static void main(String[] args) {
CardPermission permission = new CardPermission("a", null);
System.out.println("Cannot be reproduced - exception is not thrown");
}
}
---Test.java---
Minimized test output:
======================
[vs158239@vsmelov src]$ javac Test.java
[vs158239@vsmelov src]$ java -cp ./ Test
Exception in thread "main" java.lang.IllegalArgumentException: actions must not be empty
at javax.smartcardio.CardPermission.getMask(CardPermission.java:133)
at javax.smartcardio.CardPermission.<init>(CardPermission.java:128)
at Test.main(Test.java:7)
====================
Specification for javax.smartcardio.CardPermission.CardPermission(String termName, String actions) states as follows:
---Quote from spec---
Parameters:
terminalName - the name of the card terminal, or *
actions - the action string (or null if the set of permitted actions is empty)
Throws:
NullPointerException - if terminalName is null
IllegalArgumentException - if actions is an invalid actions specification
---Quote from spec---
So, spec is explicitly allows to pass null actions parameter to a constructor.
But actually it throws an IllegalArgumentException in this case.
Minimized test:
===============
---Test.java---
import javax.smartcardio.*;
public class Test {
public static void main(String[] args) {
CardPermission permission = new CardPermission("a", null);
System.out.println("Cannot be reproduced - exception is not thrown");
}
}
---Test.java---
Minimized test output:
======================
[vs158239@vsmelov src]$ javac Test.java
[vs158239@vsmelov src]$ java -cp ./ Test
Exception in thread "main" java.lang.IllegalArgumentException: actions must not be empty
at javax.smartcardio.CardPermission.getMask(CardPermission.java:133)
at javax.smartcardio.CardPermission.<init>(CardPermission.java:128)
at Test.main(Test.java:7)