8178966: Don't swallow early bootstrap exceptions in Boolean.getBoolean, Integer.getInteger and Long.getLong

Co-authored-by: Peter Levart <plevart@openjdk.org>
Reviewed-by: jpai, rriggs
This commit is contained in:
Eirik Bjørsnøs 2024-11-21 20:04:39 +00:00
parent d6b40d3033
commit e03b1506d3
3 changed files with 3 additions and 16 deletions

View file

@ -1370,11 +1370,7 @@ public final class Long extends Number
* @see System#getProperty(java.lang.String, java.lang.String)
*/
public static Long getLong(String nm, Long val) {
String v = null;
try {
v = System.getProperty(nm);
} catch (IllegalArgumentException | NullPointerException e) {
}
String v = nm != null && !nm.isEmpty() ? System.getProperty(nm) : null;
if (v != null) {
try {
return Long.decode(v);