NPE checking

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@418683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-07-03 05:09:17 +00:00
parent 7113c5efd8
commit 0d9c764bf5
1 changed files with 8 additions and 1 deletions

View File

@ -233,6 +233,11 @@ public abstract class AbstractJmsClientSystem extends AbstractObjectProperties {
protected static Properties parseStringArgs(String[] args) { protected static Properties parseStringArgs(String[] args) {
File configFile = null; File configFile = null;
Properties props = new Properties(); Properties props = new Properties();
if (args == null || args.length == 0) {
return props; // Empty properties
}
for (int i=0; i<args.length; i++) { for (int i=0; i<args.length; i++) {
String arg = args[i]; String arg = args[i];
if (arg.startsWith("-D") || arg.startsWith("-d")) { if (arg.startsWith("-D") || arg.startsWith("-d")) {
@ -253,7 +258,9 @@ public abstract class AbstractJmsClientSystem extends AbstractObjectProperties {
Properties fileProps = new Properties(); Properties fileProps = new Properties();
try { try {
if (configFile != null) {
fileProps.load(new FileInputStream(configFile)); fileProps.load(new FileInputStream(configFile));
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }