Index: applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustGPG.java
===================================================================
--- applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustGPG.java	(revision 36039)
+++ applications/editors/josm/plugins/trustosm/src/org/openstreetmap/josm/plugins/trustosm/util/TrustGPG.java	(revision 36349)
@@ -7,6 +7,4 @@
 import java.awt.Dimension;
 import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
@@ -15,5 +13,4 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.security.KeyPair;
@@ -106,5 +103,5 @@
     private PGPSecretKeyRingCollection pgpSec;
     private PGPPublicKeyRingCollection pgpPub;
-    private static int digest = PGPUtil.SHA1;
+    private static final int digest = PGPUtil.SHA1;
     private PGPSecretKey pgpSecKey;
     public boolean keepkey = false;
@@ -122,12 +119,8 @@
 
     public PGPPublicKey getPublicKeyFromRing(long keyID) {
-        try {
-            if (pgpPub.contains(keyID))
-                return pgpPub.getPublicKey(keyID);
-            else if (pgpSec.contains(keyID))
-                return pgpSec.getSecretKey(keyID).getPublicKey();
-        } catch (PGPException e) {
-            System.err.println("Could not read a PGPPublic key from your KeyRingCollectionFile. Stacktrace:");
-            e.printStackTrace();
+        if (pgpPub.contains(keyID)) {
+            return pgpPub.getPublicKey(keyID);
+        } else if (pgpSec.contains(keyID)) {
+            return pgpSec.getSecretKey(keyID).getPublicKey();
         }
         return null;
@@ -216,10 +209,8 @@
         JButton detailsButton = new JButton(tr("Details"), ImageProvider.get("keydetails"));
         detailsButton.setAlignmentX(Component.LEFT_ALIGNMENT);
-        detailsButton.addActionListener(new ActionListener() {
-            @Override
-            public void actionPerformed(ActionEvent arg0) {
-                PGPSecretKey sk = sigKeys.get(keyBox.getSelectedIndex());
-                showKeyDetails(getPublicKeyFromRing(sk.getKeyID()));
-            } });
+        detailsButton.addActionListener(arg0 -> {
+            PGPSecretKey sk = sigKeys.get(keyBox.getSelectedIndex());
+            showKeyDetails(getPublicKeyFromRing(sk.getKeyID()));
+        });
         p.add(detailsButton);
 
@@ -232,18 +223,15 @@
         JButton createButton = new JButton(tr("Create new Key"), ImageProvider.get("key"));
         createButton.setAlignmentX(Component.LEFT_ALIGNMENT);
-        createButton.addActionListener(new ActionListener() {
-
-            @Override
-            public void actionPerformed(ActionEvent arg0) {
-                try {
-                    PGPSecretKey secKey = generateKey();
-                    if (secKey != null) {
-                        keyBox.addItem(secKeytoString(secKey));
-                        sigKeys.add(secKey);
-                    }
-                } catch (NoSuchAlgorithmException | NoSuchProviderException | PGPException | IOException e) {
-                    Logging.error(e);
+        createButton.addActionListener(arg0 -> {
+            try {
+                PGPSecretKey secKey = generateKey();
+                if (secKey != null) {
+                    keyBox.addItem(secKeytoString(secKey));
+                    sigKeys.add(secKey);
                 }
-            } });
+            } catch (NoSuchAlgorithmException | NoSuchProviderException | PGPException | IOException e) {
+                Logging.error(e);
+            }
+        });
         p.add(createButton);
         p.add(Box.createRigidArea(d));
@@ -265,5 +253,5 @@
     }
 
-    public void readGpgFiles() throws PGPException, IOException, NoSuchAlgorithmException, NoSuchProviderException {
+    public void readGpgFiles() throws PGPException, IOException {
         FileInputStream pubIn;
         FileInputStream secIn;
@@ -283,5 +271,5 @@
     }
 
-    public void writeGpgFiles() throws FileNotFoundException, IOException {
+    public void writeGpgFiles() throws IOException {
         String path = Preferences.main().getPluginsDirectory().getPath();
         try (FileOutputStream pubOut = new FileOutputStream(path + "/trustosm/gnupg/pubring.gpg");
@@ -450,5 +438,5 @@
      */
     public static double searchTolerance(PGPSignature sig) {
-        /** Take the first NotationData packet that seems to have Tolerance information */
+        /* Take the first NotationData packet that seems to have Tolerance information */
         for (NotationData nd : sig.getHashedSubPackets().getNotationDataOccurrences()) {
             if (nd.getNotationName().equals(TrustGPG.NOTATION_DATA_KEY)) {
@@ -470,5 +458,5 @@
 
         JFormattedTextField meters = new JFormattedTextField(NumberFormat.getNumberInstance());
-        meters.setValue(Double.valueOf(10));
+        meters.setValue(10.0);
         meters.setColumns(5);
 
@@ -480,5 +468,5 @@
 
         if (n == JOptionPane.OK_OPTION) {
-            spGen.setNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, "Tolerance:"+meters.getValue()+"m");
+            spGen.addNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, "Tolerance:" + meters.getValue() + "m");
             return spGen;
         }
@@ -512,5 +500,5 @@
             if (web.isSelected()) sources += ":web";
             if (trusted.isSelected()) sources += ":trusted";
-            spGen.setNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, sources);
+            spGen.addNotationData(false, true, TrustGPG.NOTATION_DATA_KEY, sources);
             return spGen;
         }
@@ -548,8 +536,8 @@
             Iterator<?> it = pgpSecKey.getPublicKey().getUserIDs();
             if (it.hasNext()) {
-                spGen.setSignerUserID(false, (String) it.next());
+                spGen.addSignerUserID(false, (String) it.next());
             }
             sGen.setHashedSubpackets(spGen.generate());
-            sGen.update(tosign.getBytes(Charset.forName("UTF-8")));
+            sGen.update(tosign.getBytes(StandardCharsets.UTF_8));
             sig = sGen.generate();
             //System.out.println(new String(sGen.generateOnePassVersion(false).getEncoded(),Charset.forName("UTF-8")));
@@ -586,5 +574,5 @@
             PGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider().setProvider(provider);
             sig.init(contentVerifierBuilderProvider, pgpPub.getPublicKey(sig.getKeyID()));
-            sig.update(sigtext.getBytes(Charset.forName("UTF-8")));
+            sig.update(sigtext.getBytes(StandardCharsets.UTF_8));
             return sig.verify();
         } catch (Exception e) {
@@ -630,5 +618,5 @@
         String keyid = "0x"+Long.toHexString(key.getKeyID()).substring(8).toUpperCase(Locale.ENGLISH);
 
-        String algorithm = "";
+        final String algorithm;
         int algo = key.getAlgorithm();
         switch(algo) {
@@ -637,5 +625,5 @@
         case PGPPublicKey.DSA:
             algorithm = "Digital Signature Algorithm (DSA)"; break;
-        case PGPPublicKey.EC:
+        case PGPPublicKey.ECDH:
             algorithm = "Elliptic Curve (EC)"; break;
         case PGPPublicKey.ECDSA:
@@ -703,5 +691,5 @@
 
     public PGPSecretKey generateKey()
-            throws NoSuchAlgorithmException, NoSuchProviderException, PGPException, FileNotFoundException, IOException {
+            throws NoSuchAlgorithmException, NoSuchProviderException, PGPException, IOException {
 
         JTextField userId = new JTextField();
@@ -738,26 +726,22 @@
         final String[] algos = {"DSA", "RSA"};
         final JComboBox<?> algoBox = new JComboBox<Object>(algos);
-        algoBox.addActionListener(new ActionListener() {
-
-            @Override
-            public void actionPerformed(ActionEvent e) {
-                JComboBox<?> cb = (JComboBox<?>) e.getSource();
-                String alg = (String) cb.getSelectedItem();
-                if (alg.equals("DSA")) {
-                    strengthBox.setSelectedItem("1024");
-                    strengthBox.setEnabled(false);
-                } else
-                    strengthBox.setEnabled(true);
-                /*if (alg.equals("ECDSA")) {
-                    curveBox.setEnabled(true);
-                    strengthBox.setModel(new DefaultComboBoxModel(curvesizes));
-                    strengthBox.setSelectedItem(curvesizes[curveBox.getSelectedIndex()]);
-                    strengthBox.setEnabled(false);
-                } else {
-                    curveBox.setEnabled(false);
-                    strengthBox.setModel(new DefaultComboBoxModel(sizes));
-                    strengthBox.setEnabled(true);
-                }*/
-            }
+        algoBox.addActionListener(e -> {
+            JComboBox<?> cb = (JComboBox<?>) e.getSource();
+            String alg = (String) cb.getSelectedItem();
+            if ("DSA".equals(alg)) {
+                strengthBox.setSelectedItem("1024");
+                strengthBox.setEnabled(false);
+            } else
+                strengthBox.setEnabled(true);
+            /*if (alg.equals("ECDSA")) {
+                curveBox.setEnabled(true);
+                strengthBox.setModel(new DefaultComboBoxModel(curvesizes));
+                strengthBox.setSelectedItem(curvesizes[curveBox.getSelectedIndex()]);
+                strengthBox.setEnabled(false);
+            } else {
+                curveBox.setEnabled(false);
+                strengthBox.setModel(new DefaultComboBoxModel(sizes));
+                strengthBox.setEnabled(true);
+            }*/
         });
 
@@ -836,8 +820,7 @@
 
         PGPSignatureSubpacketVector subPck = null;
-        PGPSignatureSubpacketGenerator spGen = null;
         Date expire = cal.getDate();
         if (expire != null && expire.after(now)) {
-            spGen = new PGPSignatureSubpacketGenerator();
+            final PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
             spGen.setKeyExpirationTime(true, (expire.getTime()-now.getTime())/1000);
             subPck = spGen.generate();
