Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: None
-
Fix Version/s: 4.3
-
Component/s: None
-
Labels:None
-
Environment:JDK1.6u7
Description
In org.icepdf.core.util.Defs.setProperty
public static void setProperty(String property, Object value) {
try {
Properties prop = System.getProperties();
if (value != null) {
prop.put(property, value);
}
}
catch (SecurityException ex) {
// recall method so that property change takes effect
setProperty(property, value);
}
}
If (when?) a SecurityException is produced second time, the setProperty will be called again, and again, until a StackOverflow is thrown, and that will prevent the developer from seeing the message of the root cause of the problem, the SecurityException
public static void setProperty(String property, Object value) {
try {
Properties prop = System.getProperties();
if (value != null) {
prop.put(property, value);
}
}
catch (SecurityException ex) {
// recall method so that property change takes effect
setProperty(property, value);
}
}
If (when?) a SecurityException is produced second time, the setProperty will be called again, and again, until a StackOverflow is thrown, and that will prevent the developer from seeing the message of the root cause of the problem, the SecurityException
This error is very similar to
PDF-25, and the solution is very similar too... if you change the code to:public static void setProperty(String property, Object value) {
{ prop.put(property, value); }try {
Properties prop = System.getProperties();
if (value != null)
}
{ throw new RuntimeException(ex.getMessage(), ex); }catch (SecurityException ex)
}
the problem will be solved.