From a2caddae70001a3faa1b80668fcd2767e0553f73 Mon Sep 17 00:00:00 2001 From: Alex Kogon Date: Fri, 11 Sep 2015 10:49:27 +0200 Subject: [PATCH 1/2] addMoreInfoOnVMToAntBuildLogging --- build.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.xml b/build.xml index 154b8ee..94e82ae 100644 --- a/build.xml +++ b/build.xml @@ -21,6 +21,9 @@ basedir: ${basedir} VM: ${java.vm.name} + VM Version: ${java.vm.specification.version} + VM Vendor: ${java.vm.vendor} + VM Build: ${java.vm.version} Username: ${user.name} From fc2bf01b7276717afb519ae6fce0cd33b4d62a5c Mon Sep 17 00:00:00 2001 From: Alex Kogon Date: Tue, 15 Sep 2015 13:09:01 +0200 Subject: [PATCH 2/2] dontThrowExceptionWhenNoProperties --- src/org/synthuse/PropertiesSerializer.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/org/synthuse/PropertiesSerializer.java b/src/org/synthuse/PropertiesSerializer.java index e318544..11d2a13 100644 --- a/src/org/synthuse/PropertiesSerializer.java +++ b/src/org/synthuse/PropertiesSerializer.java @@ -59,13 +59,13 @@ public class PropertiesSerializer { } catch (Exception e) { - e.printStackTrace(); + System.out.println("Unable to load properties from file: "+propertyFilename+". Default values will be used."); + return; } Field[] fields = this.getClass().getFields(); for (int i = 0 ; i < fields.length; i++) { - //fields[i].get(this); String pName = fields[i].getName(); String pType = "String"; try @@ -74,20 +74,26 @@ public class PropertiesSerializer { } catch (Exception e) { - //e.printStackTrace(); +// e.printStackTrace(); } + final Object myProperty = prop.get(pName); try { - if (pType.equalsIgnoreCase("integer")) - fields[i].set(this, Integer.parseInt(prop.get(pName) + "")); - if (pType.equalsIgnoreCase("boolean")) - fields[i].set(this, Boolean.parseBoolean(prop.get(pName) + "")); - else - fields[i].set(this, prop.get(pName)); + if(myProperty==null) { + System.out.println("Property "+pName+"["+pType+"] not set; input was null"); + } else { + if (pType.equalsIgnoreCase("integer")) + fields[i].set(this, Integer.parseInt(myProperty + "")); + if (pType.equalsIgnoreCase("boolean")) + fields[i].set(this, Boolean.parseBoolean(myProperty + "")); + else + fields[i].set(this, myProperty); + System.out.println("Property "+pName+"["+pType+"] set to: "+myProperty); + } } catch (Exception e) { - //e.printStackTrace(); +// e.printStackTrace(); } } }