Skip to content

Commit d7d6f1c

Browse files
committed
Added default exception message if one wasn't specified or was empty.
1 parent 21105d9 commit d7d6f1c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/org/owasp/esapi/errors/NotConfiguredByDefaultException.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,22 @@
1313
public class NotConfiguredByDefaultException extends ConfigurationException {
1414

1515
protected static final long serialVersionUID = 1L;
16+
private static final String defaultMsg = "Unknown unsafe ESAPI method invoked without being explicitly allowed. " +
17+
"Check exception stack trace for method name.";
1618

1719
public NotConfiguredByDefaultException(Exception e) {
1820
super(e);
1921
}
2022

2123
public NotConfiguredByDefaultException(String s) {
22-
super(s);
24+
super( (s == null || s.trim().isEmpty()) ? defaultMsg : s);
2325
}
2426

2527
public NotConfiguredByDefaultException(String s, Throwable cause) {
26-
super(s, cause);
28+
super( (s == null || s.trim().isEmpty()) ? defaultMsg : s, cause);
2729
}
2830

2931
public NotConfiguredByDefaultException(Throwable cause) {
30-
super(cause);
32+
super(defaultMsg, cause);
3133
}
3234
}

0 commit comments

Comments
 (0)