Index: /trunk/.settings/edu.umd.cs.findbugs.core.prefs
===================================================================
--- /trunk/.settings/edu.umd.cs.findbugs.core.prefs	(revision 10222)
+++ /trunk/.settings/edu.umd.cs.findbugs.core.prefs	(revision 10223)
@@ -1,4 +1,4 @@
 #FindBugs User Preferences
-#Sun May 15 18:27:24 CEST 2016
+#Mon May 16 03:41:36 CEST 2016
 cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
 detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
@@ -83,5 +83,5 @@
 detectorInefficientIndexOf=InefficientIndexOf|true
 detectorInefficientInitializationInsideLoop=InefficientInitializationInsideLoop|true
-detectorInefficientMemberAccess=InefficientMemberAccess|true
+detectorInefficientMemberAccess=InefficientMemberAccess|false
 detectorInefficientToArray=InefficientToArray|true
 detectorInfiniteLoop=InfiniteLoop|true
Index: /trunk/build.xml
===================================================================
--- /trunk/build.xml	(revision 10222)
+++ /trunk/build.xml	(revision 10223)
@@ -676,5 +676,5 @@
                 excludeFilter="tools/findbugs/josm-filter.xml"
                 effort="max"
-        	    reportLevel="low"
+                reportLevel="low"
                 >
             <sourcePath path="${base.dir}/src" />
Index: /trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 10223)
@@ -1203,5 +1203,5 @@
             structPrototype = klass.getConstructor().newInstance();
         } catch (ReflectiveOperationException ex) {
-            throw new RuntimeException(ex);
+            throw new IllegalArgumentException(ex);
         }
 
@@ -1211,21 +1211,19 @@
                 continue;
             }
-            f.setAccessible(true);
+            Utils.setObjectsAccessible(f);
             try {
                 Object fieldValue = f.get(struct);
                 Object defaultFieldValue = f.get(structPrototype);
-                if (fieldValue != null) {
-                    if (f.getAnnotation(writeExplicitly.class) != null || !Objects.equals(fieldValue, defaultFieldValue)) {
-                        String key = f.getName().replace('_', '-');
-                        if (fieldValue instanceof Map) {
-                            hash.put(key, mapToJson((Map) fieldValue));
-                        } else if (fieldValue instanceof MultiMap) {
-                            hash.put(key, multiMapToJson((MultiMap) fieldValue));
-                        } else {
-                            hash.put(key, fieldValue.toString());
-                        }
+                if (fieldValue != null && (f.getAnnotation(writeExplicitly.class) != null || !Objects.equals(fieldValue, defaultFieldValue))) {
+                    String key = f.getName().replace('_', '-');
+                    if (fieldValue instanceof Map) {
+                        hash.put(key, mapToJson((Map<?, ?>) fieldValue));
+                    } else if (fieldValue instanceof MultiMap) {
+                        hash.put(key, multiMapToJson((MultiMap<?, ?>) fieldValue));
+                    } else {
+                        hash.put(key, fieldValue.toString());
                     }
                 }
-            } catch (IllegalArgumentException | IllegalAccessException ex) {
+            } catch (IllegalAccessException ex) {
                 throw new RuntimeException(ex);
             }
@@ -1261,11 +1259,9 @@
             } catch (NoSuchFieldException ex) {
                 continue;
-            } catch (SecurityException ex) {
-                throw new RuntimeException(ex);
             }
             if (f.getAnnotation(pref.class) == null) {
                 continue;
             }
-            f.setAccessible(true);
+            Utils.setObjectsAccessible(f);
             if (f.getType() == Boolean.class || f.getType() == boolean.class) {
                 value = Boolean.valueOf(key_value.getValue());
@@ -1326,5 +1322,5 @@
             try {
                 Field field = Toolkit.class.getDeclaredField("resources");
-                field.setAccessible(true);
+                Utils.setObjectsAccessible(field);
                 field.set(null, ResourceBundle.getBundle("sun.awt.resources.awt"));
             } catch (ReflectiveOperationException e) {
Index: /trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java	(revision 10223)
@@ -25,5 +25,4 @@
  */
 public abstract class PleaseWaitRunnable implements Runnable, CancelListener {
-    private boolean canceled;
     private boolean ignoreException;
     private final String title;
@@ -150,7 +149,4 @@
     @Override
     public final void run() {
-        if (canceled)
-            return; // since realRun isn't executed, do not call to finish
-
         if (EventQueue.isDispatchThread()) {
             new Thread(new Runnable() {
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java	(revision 10223)
@@ -91,7 +91,6 @@
         if (provider != null) {
             try {
-                // TODO
-                Field f =  provider.getClass().getDeclaredField("connection");
-                f.setAccessible(true);
+                Field f = provider.getClass().getDeclaredField("connection");
+                Utils.setObjectsAccessible(f);
                 HttpURLConnection con = (HttpURLConnection) f.get(provider);
                 if (con != null) {
Index: /trunk/src/org/openstreetmap/josm/gui/widgets/JosmImageView.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/widgets/JosmImageView.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/gui/widgets/JosmImageView.java	(revision 10223)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Utils;
 
 /**
@@ -47,8 +48,5 @@
         widthField = ImageView.class.getDeclaredField("width");
         heightField = ImageView.class.getDeclaredField("height");
-        imageField.setAccessible(true);
-        stateField.setAccessible(true);
-        widthField.setAccessible(true);
-        heightField.setAccessible(true);
+        Utils.setObjectsAccessible(imageField, stateField, widthField, heightField);
     }
 
@@ -102,5 +100,5 @@
             // And update the size params
             Method updateImageSize = ImageView.class.getDeclaredMethod("updateImageSize");
-            updateImageSize.setAccessible(true);
+            Utils.setObjectsAccessible(updateImageSize);
             updateImageSize.invoke(this);
         } finally {
@@ -130,5 +128,5 @@
             } else {
                 Method loadImage = ImageView.class.getDeclaredMethod("loadImage");
-                loadImage.setAccessible(true);
+                Utils.setObjectsAccessible(loadImage);
                 loadImage.invoke(this);
             }
Index: /trunk/src/org/openstreetmap/josm/io/Compression.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/Compression.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/io/Compression.java	(revision 10223)
@@ -96,7 +96,12 @@
      * @throws IOException if any I/O error occurs
      */
-    @SuppressWarnings("resource")
     public static InputStream getUncompressedFileInputStream(File file) throws IOException {
-        return byExtension(file.getName()).getUncompressedInputStream(new FileInputStream(file));
+        FileInputStream in = new FileInputStream(file);
+        try {
+            return byExtension(file.getName()).getUncompressedInputStream(in);
+        } catch (IOException e) {
+            Utils.close(in);
+            throw e;
+        }
     }
 
@@ -129,7 +134,12 @@
      * @throws IOException if any I/O error occurs
      */
-    @SuppressWarnings("resource")
     public static OutputStream getCompressedFileOutputStream(File file) throws IOException {
-        return byExtension(file.getName()).getCompressedOutputStream(new FileOutputStream(file));
+        FileOutputStream out = new FileOutputStream(file);
+        try {
+            return byExtension(file.getName()).getCompressedOutputStream(out);
+        } catch (IOException e) {
+            Utils.close(out);
+            throw e;
+        }
     }
 }
Index: /trunk/src/org/openstreetmap/josm/io/OsmReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 10223)
@@ -11,4 +11,5 @@
 import java.util.Collection;
 import java.util.List;
+import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -355,5 +356,5 @@
         }
         // Read changeset info if neither upload-changeset nor id are set, or if they are both set to the same value
-        if (id == uploadChangesetId || (id != null && id.equals(uploadChangesetId))) {
+        if (Objects.equals(id, uploadChangesetId)) {
             uploadChangeset = new Changeset(id != null ? id.intValue() : 0);
             while (true) {
Index: /trunk/src/org/openstreetmap/josm/tools/Diff.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Diff.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/tools/Diff.java	(revision 10223)
@@ -386,12 +386,8 @@
     }
 
-    private boolean inhibit;
-
     /**
      * Adjust inserts/deletes of blank lines to join changes as much as possible.
      */
     private void shift_boundaries() {
-        if (inhibit)
-            return;
         filevec[0].shift_boundaries(filevec[1]);
         filevec[1].shift_boundaries(filevec[0]);
Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 10222)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 10223)
@@ -26,4 +26,5 @@
 import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
+import java.lang.reflect.AccessibleObject;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -34,6 +35,8 @@
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
+import java.security.AccessController;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
+import java.security.PrivilegedAction;
 import java.text.Bidi;
 import java.text.MessageFormat;
@@ -1537,3 +1540,22 @@
     }
 
+    /**
+     * Sets {@code AccessibleObject}(s) accessible.
+     * @param objects objects
+     * @see AccessibleObject#setAccessible
+     * @since 10223
+     */
+    public static void setObjectsAccessible(final AccessibleObject ... objects) {
+        if (objects != null && objects.length > 0) {
+            AccessController.doPrivileged(new PrivilegedAction<Object>() {
+                @Override
+                public Object run() {
+                    for (AccessibleObject o : objects) {
+                        o.setAccessible(true);
+                    }
+                    return null;
+                }
+            });
+        }
+    }
 }
