From d6adfb71e2c208b3d7e1ab8dac5550b812c1cb93 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Tue, 11 Feb 2020 17:45:38 +0100 Subject: [PATCH 1/2] JmeVersion: Don't throw a NullPointerException when version.properties can't be found. --- jme3-core/src/main/java/com/jme3/system/JmeVersion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/system/JmeVersion.java b/jme3-core/src/main/java/com/jme3/system/JmeVersion.java index 0492df950d..04586034bb 100644 --- a/jme3-core/src/main/java/com/jme3/system/JmeVersion.java +++ b/jme3-core/src/main/java/com/jme3/system/JmeVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2015 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ public class JmeVersion { static { try { props.load(JmeVersion.class.getResourceAsStream("version.properties")); - } catch (IOException ex) { + } catch (IOException | NullPointerException ex) { logger.log(Level.WARNING, "Unable to read version info!", ex); } } From 4e0faf56d8fa2645aaf19515dafb402e4421ac0a Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Tue, 11 Feb 2020 17:46:55 +0100 Subject: [PATCH 2/2] ImplHandler: Reduce Code-Duplication by using a multi-catch statement --- .../src/main/java/com/jme3/asset/ImplHandler.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java b/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java index 581c18b4ee..ca7fe2381d 100644 --- a/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java +++ b/jme3-core/src/main/java/com/jme3/asset/ImplHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 jMonkeyEngine + * Copyright (c) 2009-2020 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -120,16 +120,11 @@ protected T initialValue(){ ((AssetLocator)obj).setRootPath(path); } return obj; - } catch (InstantiationException ex) { + } catch (InstantiationException | IllegalAccessException ex) { logger.log(Level.SEVERE,"Cannot create locator of type {0}, does" - + " the class have an empty and publically accessible"+ + + " the class have an empty and publicly accessible"+ " constructor?", type.getName()); logger.throwing(type.getName(), "", ex); - } catch (IllegalAccessException ex) { - logger.log(Level.SEVERE,"Cannot create locator of type {0}, " - + "does the class have an empty and publically " - + "accessible constructor?", type.getName()); - logger.throwing(type.getName(), "", ex); } return null; }