Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/data/TrustSignatures.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/data/TrustSignatures.java	(revision 30737)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/data/TrustSignatures.java	(revision 30738)
@@ -13,4 +13,5 @@
 import org.bouncycastle.bcpg.BCPGOutputStream;
 import org.bouncycastle.openpgp.PGPSignature;
+import org.openstreetmap.josm.Main;
 
 public class TrustSignatures {
@@ -126,7 +127,6 @@
         if (textsigs.containsKey(plain)){
             List<PGPSignature> l = textsigs.get(plain);
-            try {
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                ArmoredOutputStream aOut = new ArmoredOutputStream(baos);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            try (ArmoredOutputStream aOut = new ArmoredOutputStream(baos)) {
                 aOut.beginClearText(l.get(0).getHashAlgorithm());
                 aOut.write(plain.getBytes(Charset.forName("UTF-8")));
@@ -134,16 +134,14 @@
                 aOut.endClearText();
 
-                BCPGOutputStream bOut = new BCPGOutputStream(aOut);
-                for (PGPSignature sig : l) {
-                    sig.encode(bOut);
+                try (BCPGOutputStream bOut = new BCPGOutputStream(aOut)) {
+		            for (PGPSignature sig : l) {
+		                sig.encode(bOut);
+		            }
                 }
-
-                bOut.close();
-                aOut.close();
 
                 return baos.toString("UTF-8");
 
             } catch (Exception e) {
-                e.printStackTrace();
+                Main.error(e);
                 return "Error - read console Output";
             }
@@ -153,7 +151,6 @@
 
     public String getArmoredFulltextSignature(PGPSignature sig) {
-        try {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            ArmoredOutputStream aOut = new ArmoredOutputStream(baos);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ArmoredOutputStream aOut = new ArmoredOutputStream(baos)) {
             aOut.beginClearText(sig.getHashAlgorithm());
             aOut.write(getSigtext(sig).getBytes(Charset.forName("UTF-8")));
@@ -161,16 +158,13 @@
             aOut.endClearText();
 
-            BCPGOutputStream bOut = new BCPGOutputStream(aOut);
-            sig.encode(bOut);
-            bOut.close();
-            aOut.close();
-
+            try (BCPGOutputStream bOut = new BCPGOutputStream(aOut)) {
+            	sig.encode(bOut);
+            }
 
             return baos.toString("UTF-8");
         } catch (Exception e) {
-            e.printStackTrace();
+            Main.error(e);
             return "Error - read console Output";
         }
     }
-
 }
Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/NameGenerator.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/NameGenerator.java	(revision 30737)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/NameGenerator.java	(revision 30738)
@@ -8,8 +8,8 @@
 /**
  * This class is released under GNU general public license
- * 
+ *
  * Description: This class generates random names from syllables, and provides programmer a
  * simple way to set a group of rules for generator to avoid unpronounceable and bizarre names.
- * 
+ *
  * SYLLABLE FILE REQUIREMENTS/FORMAT:
  * 1) all syllables are separated by line break.
@@ -17,5 +17,5 @@
  * 3) + and - characters are used to set rules, and using them in other way, may result in unpredictable results.
  * 4) Empty lines are ignored.
- * 
+ *
  * SYLLABLE CLASSIFICATION:
  * Name is usually composed from 3 different class of syllables, which include prefix, middle part and suffix.
@@ -23,14 +23,14 @@
  * To declare syllable as a suffix in the file, insert "+" as a first character of the line.
  * everything else is read as a middle part.
- * 
+ *
  * NUMBER OF SYLLABLES:
  * Names may have any positive number of syllables. In case of 2 syllables, name will be composed from prefix and suffix.
  * In case of 1 syllable, name will be chosen from amongst the prefixes.
  * In case of 3 and more syllables, name will begin with prefix, is filled with middle parts and ended with suffix.
- * 
+ *
  * ASSIGNING RULES:
  * I included a way to set 4 kind of rules for every syllable. To add rules to the syllables, write them right after the
  * syllable and SEPARATE WITH WHITESPACE. (example: "aad +v -c"). The order of rules is not important.
- * 
+ *
  * RULES:
  * 1) +v means that next syllable must definitely start with a vocal.
@@ -41,8 +41,8 @@
  * Beware of creating logical mistakes, like providing only syllables ending with consonants, but expecting only vocals, which will be detected
  * and RuntimeException will be thrown.
- * 
+ *
  * TO START:
  * Create a new NameGenerator object, provide the syllable file, and create names using compose() method.
- * 
+ *
  * @author Joonas Vali, August 2009.
  *
@@ -85,36 +85,29 @@
      */
     public void refresh() throws IOException{
-
-        FileReader input = null;
-        BufferedReader bufRead;
-        String line;
-
-        input = new FileReader(fileName);
-
-        bufRead = new BufferedReader(input);
-        line="";
-
-        while(line != null){
-            line = bufRead.readLine();
-            if(line != null && !line.equals("")){
-                if(line.charAt(0) == '-'){
-                    pre.add(line.substring(1).toLowerCase());
-                }
-                else if(line.charAt(0) == '+'){
-                    sur.add(line.substring(1).toLowerCase());
-                }
-                else{
-                    mid.add(line.toLowerCase());
-                }
-            }
-        }
-        bufRead.close();
-    }
-
-    private String upper(String s){
+    	try (
+	        FileReader input = new FileReader(fileName);
+	        BufferedReader bufRead = new BufferedReader(input);
+		) {
+	        String line="";
+	        while (line != null){
+	            line = bufRead.readLine();
+	            if (line != null && !line.equals("")) {
+	                if(line.charAt(0) == '-') {
+	                    pre.add(line.substring(1).toLowerCase());
+	                } else if (line.charAt(0) == '+') {
+	                    sur.add(line.substring(1).toLowerCase());
+	                } else {
+	                    mid.add(line.toLowerCase());
+	                }
+	            }
+	        }
+    	}
+    }
+
+    private String upper(String s) {
         return s.substring(0,1).toUpperCase().concat(s.substring(1));
     }
 
-    private boolean containsConsFirst(ArrayList<String> array){
+    private boolean containsConsFirst(ArrayList<String> array) {
         for(String s: array){
             if(consonantFirst(s)) return true;
Index: applications/editors/josm/plugins/trustosm/src/tools/NameGenerator.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/tools/NameGenerator.java	(revision 30737)
+++ applications/editors/josm/plugins/trustosm/src/tools/NameGenerator.java	(revision 30738)
@@ -8,8 +8,8 @@
 /**
  * This class is released under GNU general public license
- * 
+ *
  * Description: This class generates random names from syllables, and provides programmer a
  * simple way to set a group of rules for generator to avoid unpronounceable and bizarre names.
- * 
+ *
  * SYLLABLE FILE REQUIREMENTS/FORMAT:
  * 1) all syllables are separated by line break.
@@ -17,5 +17,5 @@
  * 3) + and - characters are used to set rules, and using them in other way, may result in unpredictable results.
  * 4) Empty lines are ignored.
- * 
+ *
  * SYLLABLE CLASSIFICATION:
  * Name is usually composed from 3 different class of syllables, which include prefix, middle part and suffix.
@@ -23,14 +23,14 @@
  * To declare syllable as a suffix in the file, insert "+" as a first character of the line.
  * everything else is read as a middle part.
- * 
+ *
  * NUMBER OF SYLLABLES:
  * Names may have any positive number of syllables. In case of 2 syllables, name will be composed from prefix and suffix.
  * In case of 1 syllable, name will be chosen from amongst the prefixes.
  * In case of 3 and more syllables, name will begin with prefix, is filled with middle parts and ended with suffix.
- * 
+ *
  * ASSIGNING RULES:
  * I included a way to set 4 kind of rules for every syllable. To add rules to the syllables, write them right after the
  * syllable and SEPARATE WITH WHITESPACE. (example: "aad +v -c"). The order of rules is not important.
- * 
+ *
  * RULES:
  * 1) +v means that next syllable must definitely start with a vocal.
@@ -41,8 +41,8 @@
  * Beware of creating logical mistakes, like providing only syllables ending with consonants, but expecting only vocals, which will be detected
  * and RuntimeException will be thrown.
- * 
+ *
  * TO START:
  * Create a new NameGenerator object, provide the syllable file, and create names using compose() method.
- * 
+ *
  * @author Joonas Vali, August 2009.
  *
@@ -85,38 +85,32 @@
      */
     public void refresh() throws IOException{
-
-        FileReader input = null;
-        BufferedReader bufRead;
-        String line;
-
-        input = new FileReader(fileName);
-
-        bufRead = new BufferedReader(input);
-        line="";
-
-        while(line != null){
-            line = bufRead.readLine();
-            if(line != null && !line.equals("")){
-                if(line.charAt(0) == '-'){
-                    pre.add(line.substring(1).toLowerCase());
-                }
-                else if(line.charAt(0) == '+'){
-                    sur.add(line.substring(1).toLowerCase());
-                }
-                else{
-                    mid.add(line.toLowerCase());
-                }
-            }
-        }
-        bufRead.close();
-    }
-
-    private String upper(String s){
+        try (
+    		FileReader input = new FileReader(fileName);
+    		BufferedReader bufRead = new BufferedReader(input);
+        ) {
+        	String line="";
+
+	        while (line != null) {
+	            line = bufRead.readLine();
+	            if (line != null && !line.equals("")) {
+	                if (line.charAt(0) == '-') {
+	                    pre.add(line.substring(1).toLowerCase());
+	                } else if (line.charAt(0) == '+') {
+	                    sur.add(line.substring(1).toLowerCase());
+	                } else{
+	                    mid.add(line.toLowerCase());
+	                }
+	            }
+	        }
+        }
+    }
+
+    private String upper(String s) {
         return s.substring(0,1).toUpperCase().concat(s.substring(1));
     }
 
-    private boolean containsConsFirst(ArrayList<String> array){
-        for(String s: array){
-            if(consonantFirst(s)) return true;
+    private boolean containsConsFirst(ArrayList<String> array) {
+        for (String s: array) {
+            if (consonantFirst(s)) return true;
         }
         return false;
