When trying to open an UART instance, I got the following:
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "jdk.dio.uart.inputTimeout" "read")
The problem is:
UARTImpl.java, constructor is:
UARTImpl(DeviceDescriptor<UART> dscr, int mode)
throws DeviceNotFoundException, InvalidDeviceConfigException, UnsupportedAccessModeException{
...
inputTimeout = Configuration.getNonNegativeIntProperty("jdk.dio.uart.inputTimeout", 2000);
...
}
============
And this call boils to the following one:
public static int getIntProperty(String key, int def) {
String value = System.getProperty(key);
if (value != null) {
try {
return Integer.valueOf(value).intValue();
} catch (NumberFormatException e) {
}
}
return def;
}
=========================
Having this code running in limited application security context
(only declared permissions by the specification are granted to the application,
and AllPermission is granted to dio classes), we observe a missing doPrigilegedBlock()
to call System.getProperty() in.
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "jdk.dio.uart.inputTimeout" "read")
The problem is:
UARTImpl.java, constructor is:
UARTImpl(DeviceDescriptor<UART> dscr, int mode)
throws DeviceNotFoundException, InvalidDeviceConfigException, UnsupportedAccessModeException{
...
inputTimeout = Configuration.getNonNegativeIntProperty("jdk.dio.uart.inputTimeout", 2000);
...
}
============
And this call boils to the following one:
public static int getIntProperty(String key, int def) {
String value = System.getProperty(key);
if (value != null) {
try {
return Integer.valueOf(value).intValue();
} catch (NumberFormatException e) {
}
}
return def;
}
=========================
Having this code running in limited application security context
(only declared permissions by the specification are granted to the application,
and AllPermission is granted to dio classes), we observe a missing doPrigilegedBlock()
to call System.getProperty() in.