Index: trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 5790)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java	(revision 5791)
@@ -304,5 +304,11 @@
                     if (i instanceof TaggingPreset.KeyedItem) {
                         TaggingPreset.KeyedItem ky = (TaggingPreset.KeyedItem) i;
-                        presetsValueData.putAll(ky.key, ky.getValues());
+                        if (ky.key != null && ky.getValues() != null) {
+                            try {
+                                presetsValueData.putAll(ky.key, ky.getValues());
+                            } catch (NullPointerException e) {
+                                System.err.println(p+": Unable to initialize "+ky);
+                            }
+                        }
                     }
                 }
Index: trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java	(revision 5790)
+++ trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java	(revision 5791)
@@ -32,10 +32,10 @@
     private boolean canceled;
     private Exception lastException;
-    private List<PrimitiveId> ids;
+    private final List<PrimitiveId> ids;
 
     private Set<PrimitiveId> missingPrimitives;
 
-    private OsmDataLayer layer;
-    private boolean fullRelation;
+    private final OsmDataLayer layer;
+    private final boolean fullRelation;
     private MultiFetchServerObjectReader multiObjectReader;
     private OsmServerObjectReader objectReader;
@@ -45,5 +45,5 @@
      *
      * @param layer the layer in which primitives are updated. Must not be null.
-     * @param toUpdate a collection of primitives to update from the server. Set to
+     * @param ids a collection of primitives to update from the server. Set to
      * the empty collection if null.
      * @param fullRelation true if a full download is required, i.e.,
@@ -51,5 +51,5 @@
      * @throws IllegalArgumentException thrown if layer is null.
      */
-    public DownloadPrimitivesTask(OsmDataLayer layer, List<PrimitiveId>  ids, boolean fullRelation) throws IllegalArgumentException {
+    public DownloadPrimitivesTask(OsmDataLayer layer, List<PrimitiveId> ids, boolean fullRelation) throws IllegalArgumentException {
         super(tr("Download objects"), false /* don't ignore exception */);
         ensureParameterNotNull(layer, "layer");
Index: trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 5790)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java	(revision 5791)
@@ -261,5 +261,11 @@
             }
         }
-
+        
+        @Override
+        public String toString() {
+            return "KeyedItem [key=" + key + ", text=" + text
+                    + ", text_context=" + text_context + ", match=" + match
+                    + "]";
+        }
     }
 
@@ -669,5 +675,5 @@
 
         protected JComponent component;
-        protected Map<String, PresetListEntry> lhm = new LinkedHashMap<String, PresetListEntry>();
+        protected final Map<String, PresetListEntry> lhm = new LinkedHashMap<String, PresetListEntry>();
         private boolean initialized = false;
         protected Usage usage;
Index: trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java	(revision 5790)
+++ trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java	(revision 5791)
@@ -151,8 +151,11 @@
                 if (item instanceof TaggingPreset.KeyedItem) {
                     TaggingPreset.KeyedItem ki = (TaggingPreset.KeyedItem) item;
-                    if (ki.key == null) {
-                        continue;
+                    if (ki.key != null && ki.getValues() != null) {
+                        try {
+                            presetTagCache.putAll(ki.key, ki.getValues());
+                        } catch (NullPointerException e) {
+                            System.err.println(p+": Unable to cache "+ki);
+                        }
                     }
-                    presetTagCache.putAll(ki.key, ki.getValues());
                 } else if (item instanceof TaggingPreset.Roles) {
                     TaggingPreset.Roles r = (TaggingPreset.Roles) item;
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 5790)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 5791)
@@ -591,5 +591,6 @@
         while (leadingWhite && start < end) {
             char c = str.charAt(start);
-            if (leadingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c))) {
+            leadingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c));
+            if (leadingWhite) {
                 start++;
             }
@@ -598,5 +599,6 @@
         while (trailingWhite && end > start+1) {
             char c = str.charAt(end-1);
-            if (trailingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c))) {
+            trailingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c));
+            if (trailingWhite) {
                 end--;
             }
