Index: trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- trunk/src/org/openstreetmap/josm/Main.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/Main.java	(revision 5889)
@@ -455,5 +455,7 @@
         // listen to change events of the very first layer
         //
-        firstLayer.addPropertyChangeListener(LayerListDialog.getInstance().getModel());
+        if (firstLayer != null) {
+            firstLayer.addPropertyChangeListener(LayerListDialog.getInstance().getModel());
+        }
     }
 
Index: trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java	(revision 5889)
@@ -47,5 +47,4 @@
 import org.openstreetmap.josm.tools.Shortcut;
 
-
 /**
  * Join Areas (i.e. closed ways and multipolygons)
@@ -55,5 +54,4 @@
     private LinkedList<Command> cmds = new LinkedList<Command>();
     private int cmdsCount = 0;
-
 
     /**
@@ -799,5 +797,5 @@
 
             //if odd number of crossings, invert orientation
-            if (intersectionCount % 2 == 1) {
+            if (intersectionCount % 2 != 0) {
                 curWayInsideToTheRight = !curWayInsideToTheRight;
             }
Index: trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 5889)
@@ -81,17 +81,15 @@
     }
 
-    private static LinkedList<SearchSetting> searchHistory = null;
-
+    private static final LinkedList<SearchSetting> searchHistory = new LinkedList<SearchSetting>();
+    static {
+        for (String s: Main.pref.getCollection("search.history", Collections.<String>emptyList())) {
+            SearchSetting ss = SearchSetting.readFromString(s);
+            if (ss != null) {
+                searchHistory.add(ss);
+            }
+        }
+    }
+    
     public static Collection<SearchSetting> getSearchHistory() {
-        if (searchHistory == null) {
-            searchHistory = new LinkedList<SearchSetting>();
-            for (String s: Main.pref.getCollection("search.history", Collections.<String>emptyList())) {
-                SearchSetting ss = SearchSetting.readFromString(s);
-                if (ss != null) {
-                    searchHistory.add(ss);
-                }
-            }
-        }
-
         return searchHistory;
     }
Index: trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/data/AutosaveTask.java	(revision 5889)
@@ -295,6 +295,8 @@
                         try {
                             String jvmId = reader.readLine();
-                            String pid = jvmId.split("@")[0];
-                            skipFile = jvmPerfDataFileExists(pid);
+                            if (jvmId != null) {
+                                String pid = jvmId.split("@")[0];
+                                skipFile = jvmPerfDataFileExists(pid);
+                            }
                         } catch (Throwable t) {
                             System.err.println(t.getClass()+":"+t.getMessage());
Index: trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java	(revision 5889)
@@ -366,6 +366,8 @@
 
     public static double parseDouble(Map<String, String> parameters, String parameterName) throws ProjectionConfigurationException {
+        if (!parameters.containsKey(parameterName))
+            throw new IllegalArgumentException(tr("Unknown parameter ''{0}''", parameterName));
         String doubleStr = parameters.get(parameterName);
-        if (doubleStr == null && parameters.containsKey(parameterName))
+        if (doubleStr == null)
             throw new ProjectionConfigurationException(
                     tr("Expected number argument for parameter ''{0}''", parameterName));
Index: trunk/src/org/openstreetmap/josm/data/projection/Projections.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/projection/Projections.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/data/projection/Projections.java	(revision 5889)
@@ -165,5 +165,5 @@
         if (proj != null) return proj;
         ProjectionChoice pc = allProjectionChoicesByCode.get(code);
-        if (pc != null) {
+        if (pc == null) {
             Pair<String, String> pair = inits.get(code);
             if (pair == null) return null;
@@ -183,4 +183,3 @@
         return Collections.unmodifiableCollection(allCodes);
     }
-
 }
Index: trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/GettingStarted.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/gui/GettingStarted.java	(revision 5889)
@@ -31,5 +31,5 @@
 import org.openstreetmap.josm.tools.WikiReader;
 
-public class GettingStarted extends JPanel {
+public final class GettingStarted extends JPanel {
     private String content = "";
     private static final String STYLE = "<style type=\"text/css\">\n"
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java	(revision 5889)
@@ -1155,15 +1155,7 @@
                 return null;
 
-            for (int i = 0; i< 4; i++) {
+            for (int style : new int[]{DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, DateFormat.FULL}) {
                 try {
-                    DateFormat df = null;
-                    switch(i) {
-                    case 0: df = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()); break;
-                    case 1: df = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.getDefault()); break;
-                    case 2: df = DateFormat.getTimeInstance(DateFormat.LONG, Locale.getDefault()); break;
-                    case 3: df = DateFormat.getTimeInstance(DateFormat.FULL,Locale.getDefault()); break;
-                    }
-                    Date d = df.parse(getComponent().getText());
-                    return d;
+                    return DateFormat.getTimeInstance(style, Locale.getDefault()).parse(getComponent().getText());
                 } catch(ParseException e) {
                     continue;
Index: trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 5889)
@@ -118,5 +118,4 @@
     protected boolean autoDownloadEnabled = true;
     protected boolean settingsChanged;
-    protected ImageryInfo info;
     public WmsCache cache;
     private AttributionSupport attribution = new AttributionSupport();
@@ -159,5 +158,4 @@
         setBackgroundLayer(true); /* set global background variable */
         initializeImages();
-        this.info = new ImageryInfo(info);
 
         attribution.initialize(this.info);
Index: trunk/src/org/openstreetmap/josm/gui/preferences/imagery/WMSLayerTree.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/imagery/WMSLayerTree.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/imagery/WMSLayerTree.java	(revision 5889)
@@ -1,2 +1,3 @@
+// License: GPL. For details, see LICENSE file.
 package org.openstreetmap.josm.gui.preferences.imagery;
 
@@ -4,7 +5,7 @@
 
 import java.awt.Component;
-import java.io.Serializable;
 import java.util.LinkedList;
 import java.util.List;
+
 import javax.swing.JOptionPane;
 import javax.swing.JTree;
@@ -16,7 +17,8 @@
 import javax.swing.tree.MutableTreeNode;
 import javax.swing.tree.TreePath;
+
 import org.openstreetmap.josm.io.imagery.WMSImagery;
 
-public class WMSLayerTree implements Serializable {
+public class WMSLayerTree {
     private final MutableTreeNode treeRootNode = new DefaultMutableTreeNode();
     private final DefaultTreeModel treeData = new DefaultTreeModel(treeRootNode);
@@ -37,8 +39,10 @@
     }
 
+    /**
+     * Constructs a new {@code WMSLayerTree}.
+     */
     public WMSLayerTree() {
         layerTree.setCellRenderer(new LayerTreeCellRenderer());
         layerTree.addTreeSelectionListener(new WMSTreeSelectionListener());
-
     }
 
Index: trunk/src/org/openstreetmap/josm/io/InvalidXmlCharacterFilter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/InvalidXmlCharacterFilter.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/io/InvalidXmlCharacterFilter.java	(revision 5889)
@@ -41,5 +41,5 @@
     @Override
     public int read() throws IOException {
-        return filter((byte)read());
+        return filter((byte)super.read());
     }
 
Index: trunk/src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java	(revision 5889)
@@ -50,8 +50,8 @@
                 public void run() {
                     CredentialDialog dialog = null;
-                    switch(requestorType) {
-                    case SERVER: dialog = CredentialDialog.getOsmApiCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText()); break;
-                    case PROXY: dialog = CredentialDialog.getHttpProxyCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText()); break;
-                    }
+                    if (requestorType.equals(RequestorType.PROXY))
+                        dialog = CredentialDialog.getHttpProxyCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText());
+                    else 
+                        dialog = CredentialDialog.getOsmApiCredentialDialog(username, password, host, getSaveUsernameAndPasswordCheckboxText());
                     dialog.setVisible(true);
                     response.setCanceled(dialog.isCanceled());
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java	(revision 5889)
@@ -135,10 +135,13 @@
         Writer out = null;
         try {
-            OutputStream raw = new BufferedOutputStream(
-                    request.getOutputStream());
+            OutputStream raw = new BufferedOutputStream(request.getOutputStream());
             out = new OutputStreamWriter(raw);
             BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), "ASCII"));
             
             String get = in.readLine();
+            if (get == null) {
+                sendError(out);
+                return;
+            }
             System.out.println("RemoteControl received: " + get);
 
Index: trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java	(revision 5888)
+++ trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java	(revision 5889)
@@ -77,5 +77,4 @@
                 int urlIdx = query.indexOf("&url=");
                 if (urlIdx != -1) {
-                    /*String url =*/ query.substring(urlIdx + 1);
                     args.put("url", decodeParam(query.substring(urlIdx + 5)));
                     query = query.substring(0, urlIdx);
