Index: applications/editors/josm/plugins/geochat/.checkstyle
===================================================================
--- applications/editors/josm/plugins/geochat/.checkstyle	(revision 32544)
+++ applications/editors/josm/plugins/geochat/.checkstyle	(revision 32544)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+  <local-check-config name="JOSM" location="/JOSM/tools/checkstyle/josm_checks.xml" type="project" description="">
+    <additional-data name="protect-config-file" value="false"/>
+  </local-check-config>
+  <fileset name="all" enabled="true" check-config-name="JOSM" local="true">
+    <file-match-pattern match-pattern="." include-pattern="true"/>
+  </fileset>
+  <filter name="DerivedFiles" enabled="true"/>
+  <filter name="FilesFromPackage" enabled="true">
+    <filter-data value="data"/>
+    <filter-data value="images"/>
+    <filter-data value="styles"/>
+    <filter-data value="resources"/>
+    <filter-data value="scripts"/>
+  </filter>
+</fileset-config>
Index: applications/editors/josm/plugins/geochat/.project
===================================================================
--- applications/editors/josm/plugins/geochat/.project	(revision 32543)
+++ applications/editors/josm/plugins/geochat/.project	(revision 32544)
@@ -16,7 +16,13 @@
 			</arguments>
 		</buildCommand>
+		<buildCommand>
+			<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
 	</buildSpec>
 	<natures>
 		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
 	</natures>
 </projectDescription>
Index: applications/editors/josm/plugins/geochat/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- applications/editors/josm/plugins/geochat/.settings/org.eclipse.jdt.ui.prefs	(revision 32544)
+++ applications/editors/josm/plugins/geochat/.settings/org.eclipse.jdt.ui.prefs	(revision 32544)
@@ -0,0 +1,60 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
Index: applications/editors/josm/plugins/geochat/LICENSE
===================================================================
--- applications/editors/josm/plugins/geochat/LICENSE	(revision 32544)
+++ applications/editors/josm/plugins/geochat/LICENSE	(revision 32544)
@@ -0,0 +1,13 @@
+            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+                    Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. You just DO WHAT THE FUCK YOU WANT TO.
Index: applications/editors/josm/plugins/geochat/build.xml
===================================================================
--- applications/editors/josm/plugins/geochat/build.xml	(revision 32543)
+++ applications/editors/josm/plugins/geochat/build.xml	(revision 32544)
@@ -5,5 +5,5 @@
     <property name="commit.message" value="[josm_geochat] copypaste from keyboard, font size advanced parameters"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="7001"/>
+    <property name="plugin.main.version" value="10420"/>
 
     <property name="plugin.author" value="Ilya Zverev"/>
Index: applications/editors/josm/plugins/geochat/src/geochat/ChatMessage.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/ChatMessage.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/ChatMessage.java	(revision 32544)
@@ -1,11 +1,12 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
 
 import java.util.Date;
+
 import org.openstreetmap.josm.data.coor.LatLon;
 
 /**
  * One message.
- * 
+ *
  * @author zverik
  */
@@ -20,5 +21,5 @@
     private boolean incoming;
 
-    public ChatMessage( long id, LatLon pos, String author, boolean incoming, String message, Date time ) {
+    public ChatMessage(long id, LatLon pos, String author, boolean incoming, String message, Date time) {
         this.id = id;
         this.author = author;
@@ -31,12 +32,12 @@
     }
 
-    public void setRecipient( String recipient ) {
+    public void setRecipient(String recipient) {
         this.recipient = recipient;
     }
 
-    public void setPrivate( boolean priv ) {
+    public void setPrivate(boolean priv) {
         this.priv = priv;
     }
-    
+
     public String getAuthor() {
         return author;
@@ -61,5 +62,5 @@
         return message;
     }
-    
+
     public boolean isPrivate() {
         return priv;
@@ -96,4 +97,5 @@
     }
 
+    @Override
     public int compareTo(ChatMessage o) {
         long otherId = o.id;
Index: applications/editors/josm/plugins/geochat/src/geochat/ChatPaneManager.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/ChatPaneManager.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/ChatPaneManager.java	(revision 32544)
@@ -1,16 +1,28 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Font;
-import java.util.*;
-import javax.swing.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JLabel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextPane;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
-import javax.swing.text.*;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.StyleConstants;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.util.GuiHelper;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 /**
@@ -26,5 +38,5 @@
     private boolean collapsed;
 
-    public ChatPaneManager( GeoChatPanel panel, JTabbedPane tabs ) {
+    ChatPaneManager(GeoChatPanel panel, JTabbedPane tabs) {
         this.panel = panel;
         this.tabs = tabs;
@@ -33,5 +45,6 @@
         createChatPane(null);
         tabs.addChangeListener(new ChangeListener() {
-            public void stateChanged( ChangeEvent e ) {
+            @Override
+            public void stateChanged(ChangeEvent e) {
                 updateActiveTabStatus();
             }
@@ -39,10 +52,10 @@
     }
 
-    public void setCollapsed( boolean collapsed ) {
+    public void setCollapsed(boolean collapsed) {
         this.collapsed = collapsed;
         updateActiveTabStatus();
     }
 
-    public boolean hasUser( String user ) {
+    public boolean hasUser(String user) {
         return chatPanes.containsKey(user == null ? PUBLIC_PANE : user);
     }
@@ -54,6 +67,6 @@
     public int getNotifyLevel() {
         int alarm = 0;
-        for( ChatPane entry : chatPanes.values() ) {
-            if( entry.notify > alarm )
+        for (ChatPane entry : chatPanes.values()) {
+            if (entry.notify > alarm)
                 alarm = entry.notify;
         }
@@ -62,16 +75,16 @@
 
     public void updateActiveTabStatus() {
-        if( tabs.getSelectedIndex() >= 0 )
-            ((ChatTabTitleComponent)tabs.getTabComponentAt(tabs.getSelectedIndex())).updateAlarm();
-    }
-
-    public void notify( String user, int alarmLevel ) {
-        if( alarmLevel <= 0 || !hasUser(user) )
+        if (tabs.getSelectedIndex() >= 0)
+            ((ChatTabTitleComponent) tabs.getTabComponentAt(tabs.getSelectedIndex())).updateAlarm();
+    }
+
+    public void notify(String user, int alarmLevel) {
+        if (alarmLevel <= 0 || !hasUser(user))
             return;
         ChatPane entry = chatPanes.get(user == null ? PUBLIC_PANE : user);
         entry.notify = alarmLevel;
         int idx = tabs.indexOfComponent(entry.component);
-        if( idx >= 0 )
-            ((ChatTabTitleComponent)tabs.getTabComponentAt(idx)).updateAlarm();
+        if (idx >= 0)
+            ((ChatTabTitleComponent) tabs.getTabComponentAt(idx)).updateAlarm();
     }
 
@@ -81,26 +94,27 @@
     private static Color COLOR_ATTENTION = new Color(0, 0, 192);
 
-    private void addLineToChatPane( String userName, String line, final int messageType ) {
-        if( line.length() == 0 )
+    private void addLineToChatPane(String userName, String line, final int messageType) {
+        if (line.length() == 0)
             return;
-        if( !chatPanes.containsKey(userName) )
+        if (!chatPanes.containsKey(userName))
             createChatPane(userName);
         final String nline = line.startsWith("\n") ? line : "\n" + line;
         final JTextPane thepane = chatPanes.get(userName).pane;
         GuiHelper.runInEDT(new Runnable() {
+            @Override
             public void run() {
                 Document doc = thepane.getDocument();
                 try {
                     SimpleAttributeSet attrs = null;
-                    if( messageType != MESSAGE_TYPE_DEFAULT ) {
+                    if (messageType != MESSAGE_TYPE_DEFAULT) {
                         attrs = new SimpleAttributeSet();
-                        if( messageType == MESSAGE_TYPE_INFORMATION )
+                        if (messageType == MESSAGE_TYPE_INFORMATION)
                             StyleConstants.setItalic(attrs, true);
-                        else if( messageType == MESSAGE_TYPE_ATTENTION )
+                        else if (messageType == MESSAGE_TYPE_ATTENTION)
                             StyleConstants.setForeground(attrs, COLOR_ATTENTION);
                     }
                     doc.insertString(doc.getLength(), nline, attrs);
-                } catch( BadLocationException ex ) {
-                    // whatever
+                } catch (BadLocationException ex) {
+                    Main.warn(ex);
                 }
                 thepane.setCaretPosition(doc.getLength());
@@ -109,13 +123,13 @@
     }
 
-    public void addLineToChatPane( String userName, String line ) {
+    public void addLineToChatPane(String userName, String line) {
         addLineToChatPane(userName, line, MESSAGE_TYPE_DEFAULT);
     }
 
-    public void addLineToPublic( String line ) {
+    public void addLineToPublic(String line) {
         addLineToChatPane(PUBLIC_PANE, line);
     }
 
-    public void addLineToPublic( String line, int messageType ) {
+    public void addLineToPublic(String line, int messageType) {
         addLineToChatPane(PUBLIC_PANE, line, messageType);
     }
@@ -125,6 +139,6 @@
     }
 
-    public void clearChatPane( String userName) {
-        if( userName == null || userName.equals(PUBLIC_PANE) )
+    public void clearChatPane(String userName) {
+        if (userName == null || userName.equals(PUBLIC_PANE))
             clearPublicChatPane();
         else
@@ -136,14 +150,14 @@
     }
 
-    public ChatPane createChatPane( String userName ) {
+    public ChatPane createChatPane(String userName) {
         JTextPane chatPane = new JTextPane();
         chatPane.setEditable(false);
         Font font = chatPane.getFont();
         float size = Main.pref.getInteger("geochat.fontsize", -1);
-        if( size < 6 )
+        if (size < 6)
             size += font.getSize2D();
         chatPane.setFont(font.deriveFont(size));
-//        DefaultCaret caret = (DefaultCaret)chatPane.getCaret(); // does not work
-//        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
+        //        DefaultCaret caret = (DefaultCaret)chatPane.getCaret(); // does not work
+        //        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
         JScrollPane scrollPane = new JScrollPane(chatPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
         chatPane.addMouseListener(new GeoChatPopupAdapter(panel));
@@ -169,9 +183,10 @@
     public String getActiveChatPane() {
         Component c = tabs.getSelectedComponent();
-        if( c == null )
+        if (c == null)
             return null;
-        for( String user : chatPanes.keySet() )
-            if( c.equals(chatPanes.get(user).component) )
+        for (String user : chatPanes.keySet()) {
+            if (c.equals(chatPanes.get(user).component))
                 return user;
+        }
         return null;
     }
@@ -182,6 +197,6 @@
     }
 
-    public void closeChatPane( String user ) {
-        if( user == null || user.equals(PUBLIC_PANE) || !chatPanes.containsKey(user) )
+    public void closeChatPane(String user) {
+        if (user == null || user.equals(PUBLIC_PANE) || !chatPanes.containsKey(user))
             return;
         tabs.remove(chatPanes.get(user).component);
@@ -191,5 +206,5 @@
     public void closeSelectedPrivatePane() {
         String pane = getRecipient();
-        if( pane != null )
+        if (pane != null)
             closeChatPane(pane);
     }
@@ -197,12 +212,13 @@
     public void closePrivateChatPanes() {
         List<String> entries = new ArrayList<>(chatPanes.keySet());
-        for( String user : entries )
-            if( !user.equals(PUBLIC_PANE) )
+        for (String user : entries) {
+            if (!user.equals(PUBLIC_PANE))
                 closeChatPane(user);
-    }
-    
+        }
+    }
+
     public boolean hasSelectedText() {
         String user = getActiveChatPane();
-        if( user != null ) {
+        if (user != null) {
             JTextPane pane = chatPanes.get(user).pane;
             return pane.getSelectedText() != null;
@@ -213,13 +229,12 @@
     public void copySelectedText() {
         String user = getActiveChatPane();
-        if( user != null )
+        if (user != null)
             chatPanes.get(user).pane.copy();
     }
-    
 
     private class ChatTabTitleComponent extends JLabel {
         private ChatPane entry;
 
-        public ChatTabTitleComponent( ChatPane entry ) {
+        ChatTabTitleComponent(ChatPane entry) {
             super(entry.isPublic ? tr("Public") : entry.userName);
             this.entry = entry;
@@ -230,10 +245,10 @@
 
         public void updateAlarm() {
-            if( normalFont == null ) {
+            if (normalFont == null) {
                 // prepare cached fonts
                 normalFont = getFont().deriveFont(Font.PLAIN);
                 boldFont = getFont().deriveFont(Font.BOLD);
             }
-            if( entry.notify > 0 && !collapsed && tabs.getSelectedIndex() == tabs.indexOfComponent(entry.component) )
+            if (entry.notify > 0 && !collapsed && tabs.getSelectedIndex() == tabs.indexOfComponent(entry.component))
                 entry.notify = 0;
             setFont(entry.notify > 0 ? boldFont : normalFont);
Index: applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java	(revision 32544)
@@ -1,3 +1,3 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
 
@@ -27,11 +27,11 @@
 /**
  * This class holds all the chat data and periodically polls the server.
- * 
+ *
  * @author zverik
  */
-class ChatServerConnection {
+final class ChatServerConnection {
     public static final String TOKEN_PREFIX = "=";
     private static final String TOKEN_PATTERN = "^[a-zA-Z0-9]{10}$";
-    
+
     private int userId;
     private String userName;
@@ -47,16 +47,16 @@
         new Thread(requestThread).start();
     }
-    
+
     public static ChatServerConnection getInstance() {
-        if( instance == null )
+        if (instance == null)
             instance = new ChatServerConnection();
         return instance;
     }
 
-    public void addListener( ChatServerConnectionListener listener ) {
+    public void addListener(ChatServerConnectionListener listener) {
         listeners.add(listener);
     }
 
-    public void removeListener( ChatServerConnectionListener listener ) {
+    public void removeListener(ChatServerConnectionListener listener) {
         listeners.remove(listener);
     }
@@ -85,16 +85,17 @@
      * Does not autologin, if userName is null, obviously.
      */
-    public void autoLogin( final String userName ) {
+    public void autoLogin(final String userName) {
         final int uid = Main.pref.getInteger("geochat.lastuid", 0);
-        if( uid <= 0 ) {
-            if( userName != null && userName.length() > 1 )
+        if (uid <= 0) {
+            if (userName != null && userName.length() > 1)
                 login(userName);
         } else {
             String query = "whoami&uid=" + uid;
             JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-                public void processJson( JsonObject json ) {
-                    if( json != null && json.get("name") != null )
+                @Override
+                public void processJson(JsonObject json) {
+                    if (json != null && json.get("name") != null)
                         login(uid, json.getString("name"));
-                    else if( userName != null && userName.length() > 1 )
+                    else if (userName != null && userName.length() > 1)
                         login(userName);
                 }
@@ -107,16 +108,20 @@
      * If two seconds have passed, stops the waiting. Doesn't wait if userName is empty.
      */
-    public void autoLoginWithDelay( final String userName ) {
-        if( userName == null || userName.length() == 0 ) {
+    public void autoLoginWithDelay(final String userName) {
+        if (userName == null || userName.length() == 0) {
             checkLogin();
             return;
         }
         new Thread(new Runnable() {
+            @Override
             public void run() {
                 try {
                     int cnt = 10;
-                    while( getPosition() == null && cnt-- > 0 )
+                    while (getPosition() == null && cnt-- > 0) {
                         Thread.sleep(200);
-                } catch( InterruptedException e ) {}
+                    }
+                } catch (InterruptedException e) {
+                    Main.warn(e);
+                }
                 autoLogin(userName);
             }
@@ -124,14 +129,14 @@
     }
 
-    public void login( final String userName ) {
-        if( userName == null )
+    public void login(final String userName) {
+        if (userName == null)
             throw new IllegalArgumentException("userName is null");
         LatLon pos = getPosition();
-        if( pos == null ) {
+        if (pos == null) {
             fireLoginFailed("Zoom level is too low");
             return;
         }
         String token = userName.startsWith(TOKEN_PREFIX) ? userName.substring(TOKEN_PREFIX.length()) : null;
-        if( token != null && !token.matches(TOKEN_PATTERN) ) {
+        if (token != null && !token.matches(TOKEN_PATTERN)) {
             fireLoginFailed("Incorrect token format");
             return;
@@ -141,13 +146,14 @@
             String nameAttr = token != null ? "&token=" + token : "&name=" + URLEncoder.encode(userName, "UTF-8");
             String query = "register&lat=" + pos.latToString(CoordinateFormat.DECIMAL_DEGREES)
-                    + "&lon=" + pos.lonToString(CoordinateFormat.DECIMAL_DEGREES)
-                    + nameAttr;
+            + "&lon=" + pos.lonToString(CoordinateFormat.DECIMAL_DEGREES)
+            + nameAttr;
             JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-                public void processJson( JsonObject json ) {
-                    if( json == null )
+                @Override
+                public void processJson(JsonObject json) {
+                    if (json == null)
                         fireLoginFailed(tr("Could not get server response, check logs"));
-                    else if( json.get("error") != null )
+                    else if (json.get("error") != null)
                         fireLoginFailed(tr("Failed to login as {0}:", userName) + "\n" + json.getString("error"));
-                    else if( json.get("uid") == null)
+                    else if (json.get("uid") == null)
                         fireLoginFailed(tr("The server did not return user ID"));
                     else {
@@ -157,15 +163,16 @@
                 }
             });
-        } catch( UnsupportedEncodingException e ) {
-            // wut
-        }
-    }
-
-    private void login( int userId, String userName ) {
+        } catch (UnsupportedEncodingException e) {
+            Main.error(e);
+        }
+    }
+
+    private void login(int userId, String userName) {
         this.userId = userId;
         this.userName = userName;
         Main.pref.putInteger("geochat.lastuid", userId);
-        for( ChatServerConnectionListener listener : listeners )
+        for (ChatServerConnectionListener listener : listeners) {
             listener.loggedIn(userName);
+        }
     }
 
@@ -174,11 +181,13 @@
         ChatServerConnection.this.userName = null;
         Main.pref.put("geochat.lastuid", null);
-        for( ChatServerConnectionListener listener : listeners )
+        for (ChatServerConnectionListener listener : listeners) {
             listener.notLoggedIn(null);
-    }
-
-    private void fireLoginFailed( String reason ) {
-        for( ChatServerConnectionListener listener : listeners )
+        }
+    }
+
+    private void fireLoginFailed(String reason) {
+        for (ChatServerConnectionListener listener : listeners) {
             listener.notLoggedIn(reason);
+        }
     }
 
@@ -187,10 +196,11 @@
      */
     public void logout() {
-        if( !isLoggedIn() )
+        if (!isLoggedIn())
             return;
         String query = "logout&uid=" + userId;
         JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-            public void processJson( JsonObject json ) {
-                if( json != null && json.get("message") != null) {
+            @Override
+            public void processJson(JsonObject json) {
+                if (json != null && json.get("message") != null) {
                     logoutIntl();
                 }
@@ -204,11 +214,12 @@
      */
     public void bruteLogout() throws IOException {
-        if( isLoggedIn() )
+        if (isLoggedIn())
             JsonQueryUtil.query("logout&uid=" + userId);
     }
 
-    private void fireMessageFailed( String reason ) {
-        for( ChatServerConnectionListener listener : listeners )
+    private void fireMessageFailed(String reason) {
+        for (ChatServerConnectionListener listener : listeners) {
             listener.messageSendFailed(reason);
+        }
     }
 
@@ -218,5 +229,5 @@
      * @see #postMessage(java.lang.String, java.lang.String)
      */
-    public void postMessage( String message ) {
+    public void postMessage(String message) {
         postMessage(message, null);
     }
@@ -228,11 +239,11 @@
      * @param targetUser null if sending to everyone, name of user otherwise.
      */
-    public void postMessage( String message, String targetUser ) {
-        if( !isLoggedIn() ) {
+    public void postMessage(String message, String targetUser) {
+        if (!isLoggedIn()) {
             fireMessageFailed("Not logged in");
             return;
         }
         LatLon pos = getPosition();
-        if( pos == null ) {
+        if (pos == null) {
             fireMessageFailed("Zoom level is too low");
             return;
@@ -240,29 +251,30 @@
         try {
             String query = "post&lat=" + pos.latToString(CoordinateFormat.DECIMAL_DEGREES)
-                    + "&lon=" + pos.lonToString(CoordinateFormat.DECIMAL_DEGREES)
-                    + "&uid=" + userId
-                    + "&message=" + URLEncoder.encode(message, "UTF8");
-            if( targetUser != null && targetUser.length() > 0)
-                    query += "&to=" + URLEncoder.encode(targetUser, "UTF8");
+            + "&lon=" + pos.lonToString(CoordinateFormat.DECIMAL_DEGREES)
+            + "&uid=" + userId
+            + "&message=" + URLEncoder.encode(message, "UTF8");
+            if (targetUser != null && targetUser.length() > 0)
+                query += "&to=" + URLEncoder.encode(targetUser, "UTF8");
             JsonQueryUtil.queryAsync(query, new JsonQueryCallback() {
-                public void processJson( JsonObject json ) {
-                    if( json == null )
+                @Override
+                public void processJson(JsonObject json) {
+                    if (json == null)
                         fireMessageFailed(tr("Could not get server response, check logs"));
-                    else if( json.get("error") != null )
+                    else if (json.get("error") != null)
                         fireMessageFailed(json.getString("error"));
                 }
             });
-        } catch( UnsupportedEncodingException e ) {
-            // wut
-        }
-    }
-    
+        } catch (UnsupportedEncodingException e) {
+            Main.error(e);
+        }
+    }
+
     /**
      * Returns current coordinates or null if there is no map, or zoom is too low.
      */
     private static LatLon getPosition() {
-        if( Main.map == null || Main.map.mapView == null )
+        if (Main.map == null || Main.map.mapView == null)
             return null;
-        if( getCurrentZoom() < 10 )
+        if (getCurrentZoom() < 10)
             return null;
         Projection proj = Main.getProjection();
@@ -271,5 +283,5 @@
 
     // Following three methods were snatched from TMSLayer
-    private static double latToTileY( double lat, int zoom ) {
+    private static double latToTileY(double lat, int zoom) {
         double l = lat / 180 * Math.PI;
         double pf = Math.log(Math.tan(l) + (1 / Math.cos(l)));
@@ -277,10 +289,10 @@
     }
 
-    private static double lonToTileX( double lon, int zoom ) {
+    private static double lonToTileX(double lon, int zoom) {
         return Math.pow(2.0, zoom - 3) * (lon + 180.0) / 45.0;
     }
 
     public static int getCurrentZoom() {
-        if( Main.map == null || Main.map.mapView == null ) {
+        if (Main.map == null || Main.map.mapView == null) {
             return 1;
         }
@@ -295,10 +307,10 @@
         int screenPixels = mv.getWidth() * mv.getHeight();
         double tilePixels = Math.abs((y2 - y1) * (x2 - x1) * 256 * 256);
-        if( screenPixels == 0 || tilePixels == 0 ) {
+        if (screenPixels == 0 || tilePixels == 0) {
             return 1;
         }
         double factor = screenPixels / tilePixels;
         double result = Math.log(factor) / Math.log(2) / 2 + 1;
-        int intResult = (int)Math.floor(result);
+        int intResult = (int) Math.floor(result);
         return intResult;
     }
@@ -312,12 +324,13 @@
         private boolean stopping = false;
 
+        @Override
         public void run() {
-//            lastId = Main.pref.getLong("geochat.lastid", 0);
+            //            lastId = Main.pref.getLong("geochat.lastid", 0);
             int interval = Main.pref.getInteger("geochat.interval", 2);
-            while( !stopping ) {
+            while (!stopping) {
                 process();
                 try {
                     Thread.sleep(interval * 1000);
-                } catch( InterruptedException e ) {
+                } catch (InterruptedException e) {
                     stopping = true;
                 }
@@ -330,5 +343,5 @@
 
         public void process() {
-            if( !isLoggedIn() ) {
+            if (!isLoggedIn()) {
                 fireStatusChanged(false);
                 return;
@@ -336,16 +349,16 @@
 
             LatLon pos = getPosition();
-            if( pos == null ) {
+            if (pos == null) {
                 fireStatusChanged(false);
                 return;
             }
             fireStatusChanged(true);
-            
+
             final boolean needReset;
             final boolean needFullReset = lastUserId != userId;
-            if( needFullReset || (lastPosition != null && pos.greatCircleDistance(lastPosition) > MAX_JUMP) ) {
+            if (needFullReset || (lastPosition != null && pos.greatCircleDistance(lastPosition) > MAX_JUMP)) {
                 // reset messages
                 lastId = 0;
-//                Main.pref.put("geochat.lastid", null);
+                //                Main.pref.put("geochat.lastid", null);
                 needReset = true;
             } else
@@ -353,53 +366,58 @@
             lastUserId = userId;
             lastPosition = pos;
-            
+
             String query = "get&lat=" + pos.latToString(CoordinateFormat.DECIMAL_DEGREES)
-                    + "&lon=" + pos.lonToString(CoordinateFormat.DECIMAL_DEGREES)
-                    + "&uid=" + userId + "&last=" + lastId;
+            + "&lon=" + pos.lonToString(CoordinateFormat.DECIMAL_DEGREES)
+            + "&uid=" + userId + "&last=" + lastId;
             JsonObject json;
             try {
                 json = JsonQueryUtil.query(query);
-            } catch( IOException ex ) {
+            } catch (IOException ex) {
                 json = null; // ?
             }
-            if( json == null ) {
+            if (json == null) {
                 // do nothing?
-//              fireLoginFailed(tr("Could not get server response, check logs"));
-//              logoutIntl(); // todo: uncomment?
-            } else if( json.get("error") != null) {
+                //              fireLoginFailed(tr("Could not get server response, check logs"));
+                //              logoutIntl(); // todo: uncomment?
+            } else if (json.get("error") != null) {
                 fireLoginFailed(tr("Failed to get messages as {0}:", userName) + "\n" + json.getString("error"));
                 logoutIntl();
             } else {
-                if( json.get("users") != null) {
+                if (json.get("users") != null) {
                     Map<String, LatLon> users = parseUsers(json.getJsonArray("users"));
-                    for( ChatServerConnectionListener listener : listeners )
+                    for (ChatServerConnectionListener listener : listeners) {
                         listener.updateUsers(users);
-                }
-                if( json.get("messages") != null) {
+                    }
+                }
+                if (json.get("messages") != null) {
                     List<ChatMessage> messages = parseMessages(json.getJsonArray("messages"), false);
-                    for( ChatMessage m : messages )
-                        if( m.getId() > lastId )
+                    for (ChatMessage m : messages) {
+                        if (m.getId() > lastId)
                             lastId = m.getId();
-                    for( ChatServerConnectionListener listener : listeners )
+                    }
+                    for (ChatServerConnectionListener listener : listeners) {
                         listener.receivedMessages(needReset, messages);
-                }
-                if( json.get("private") != null) {
+                    }
+                }
+                if (json.get("private") != null) {
                     List<ChatMessage> messages = parseMessages(json.getJsonArray("private"), true);
-                    for( ChatMessage m : messages )
-                        if( m.getId() > lastId )
+                    for (ChatMessage m : messages) {
+                        if (m.getId() > lastId)
                             lastId = m.getId();
-                    for( ChatServerConnectionListener listener : listeners )
+                    }
+                    for (ChatServerConnectionListener listener : listeners) {
                         listener.receivedPrivateMessages(needFullReset, messages);
-                }
-            }
-//                    if( lastId > 0 && Main.pref.getBoolean("geochat.store.lastid", true) )
-//                        Main.pref.putLong("geochat.lastid", lastId);
-        }
-
-        private List<ChatMessage> parseMessages( JsonArray messages, boolean priv ) {
+                    }
+                }
+            }
+            //                    if (lastId > 0 && Main.pref.getBoolean("geochat.store.lastid", true) )
+            //                        Main.pref.putLong("geochat.lastid", lastId);
+        }
+
+        private List<ChatMessage> parseMessages(JsonArray messages, boolean priv) {
             List<ChatMessage> result = new ArrayList<>();
-            for( int i = 0; i < messages.size(); i++ ) {
+            for (int i = 0; i < messages.size(); i++) {
                 try {
-                	JsonObject msg = messages.getJsonObject(i);
+                    JsonObject msg = messages.getJsonObject(i);
                     long id = Long.parseLong(msg.getString("id"));
                     double lat = Double.parseDouble(msg.getString("lat"));
@@ -412,9 +430,9 @@
                             incoming, message, new Date(timeStamp * 1000));
                     cm.setPrivate(priv);
-                    if( msg.get("recipient") != null && !incoming )
+                    if (msg.get("recipient") != null && !incoming)
                         cm.setRecipient(msg.getString("recipient"));
                     result.add(cm);
-                } catch( JsonException e ) {
-                    // do nothing, just skip this message
+                } catch (JsonException e) {
+                    Main.trace(e);
                 }
             }
@@ -422,15 +440,15 @@
         }
 
-        private Map<String, LatLon> parseUsers( JsonArray users ) {
+        private Map<String, LatLon> parseUsers(JsonArray users) {
             Map<String, LatLon> result = new HashMap<>();
-            for( int i = 0; i < users.size(); i++ ) {
+            for (int i = 0; i < users.size(); i++) {
                 try {
-                	JsonObject user = users.getJsonObject(i);
+                    JsonObject user = users.getJsonObject(i);
                     String name = user.getString("user");
                     double lat = Double.parseDouble(user.getString("lat"));
                     double lon = Double.parseDouble(user.getString("lon"));
                     result.put(name, new LatLon(lat, lon));
-                } catch( JsonException e ) {
-                    // do nothing, just skip this user
+                } catch (JsonException e) {
+                    Main.trace(e);
                 }
             }
@@ -438,10 +456,11 @@
         }
 
-        private void fireStatusChanged( boolean newStatus ) {
-            if( newStatus == lastStatus )
+        private void fireStatusChanged(boolean newStatus) {
+            if (newStatus == lastStatus)
                 return;
             lastStatus = newStatus;
-            for( ChatServerConnectionListener listener : listeners )
+            for (ChatServerConnectionListener listener : listeners) {
                 listener.statusChanged(newStatus);
+            }
         }
     }
Index: applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnectionListener.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnectionListener.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnectionListener.java	(revision 32544)
@@ -1,6 +1,8 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
 
-import java.util.*;
+import java.util.List;
+import java.util.Map;
+
 import org.openstreetmap.josm.data.coor.LatLon;
 
@@ -15,11 +17,11 @@
      * @param userName Name of the logged in user.
      */
-    void loggedIn( String userName );
-    
+    void loggedIn(String userName);
+
     /**
      * User tried to log in, but failed.
      * @param reason Why. <tt>null</tt> if it is intended logout.
      */
-    void notLoggedIn( String reason );
+    void notLoggedIn(String reason);
 
     /**
@@ -27,5 +29,5 @@
      * @param reason Why.
      */
-    void messageSendFailed( String reason );
+    void messageSendFailed(String reason);
 
     /**
@@ -33,5 +35,5 @@
      * @param active Is the chat active.
      */
-    void statusChanged( boolean active );
+    void statusChanged(boolean active);
 
     /**
@@ -39,5 +41,5 @@
      * @param users a hash of user names and coordinates.
      */
-    void updateUsers( Map<String, LatLon> users );
+    void updateUsers(Map<String, LatLon> users);
 
     /**
@@ -46,5 +48,5 @@
      * @param messages new messages array.
      */
-    void receivedMessages( boolean replace, List<ChatMessage> messages );
+    void receivedMessages(boolean replace, List<ChatMessage> messages);
 
     /**
@@ -55,4 +57,4 @@
      * @param messages list of new private messages.
      */
-    void receivedPrivateMessages( boolean replace, List<ChatMessage> messages );
+    void receivedPrivateMessages(boolean replace, List<ChatMessage> messages);
 }
Index: applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java	(revision 32544)
@@ -1,22 +1,47 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
 
-import java.awt.*;
-import java.awt.event.*;
+import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
+
+import java.awt.AlphaComposite;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Point;
+import java.awt.RenderingHints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
-import java.util.*;
 import java.util.List;
-import javax.swing.*;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.gui.*;
+import org.openstreetmap.josm.gui.JosmUserIdentityManager;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.Notification;
 import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
 import org.openstreetmap.josm.gui.layer.MapViewPaintable;
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.tools.GBC;
-import static org.openstreetmap.josm.tools.I18n.tr;
-import static org.openstreetmap.josm.tools.I18n.trn;
 
 /**
@@ -36,5 +61,5 @@
     ChatPaneManager chatPanes;
     boolean userLayerActive;
-    
+
     public GeoChatPanel() {
         super(tr("GeoChat"), "geochat", tr("Open GeoChat panel"), null, 200, true);
@@ -48,14 +73,14 @@
         input = new JPanelTextField() {
             @Override
-            protected void processEnter( String text ) {
+            protected void processEnter(String text) {
                 connection.postMessage(text, chatPanes.getRecipient());
             }
 
             @Override
-            protected String autoComplete( String word, boolean atStart ) {
+            protected String autoComplete(String word, boolean atStart) {
                 return autoCompleteUser(word, atStart);
             }
         };
-        
+
         String defaultUserName = constructUserName();
         loginPanel = createLoginPanel(defaultUserName);
@@ -76,9 +101,9 @@
     private String constructUserName() {
         String userName = Main.pref.get("geochat.username", null); // so the default is null
-        if( userName == null )
+        if (userName == null)
             userName = JosmUserIdentityManager.getInstance().getUserName();
-        if( userName == null )
+        if (userName == null)
             userName = "";
-        if( userName.contains("@") )
+        if (userName.contains("@"))
             userName = userName.substring(0, userName.indexOf('@'));
         userName = userName.replace(' ', '_');
@@ -86,8 +111,8 @@
     }
 
-    private JPanel createLoginPanel( String defaultUserName ) {
+    private JPanel createLoginPanel(String defaultUserName) {
         final JTextField nameField = new JPanelTextField() {
             @Override
-            protected void processEnter( String text ) {
+            protected void processEnter(String text) {
                 connection.login(text);
             }
@@ -98,5 +123,5 @@
         loginButton.addActionListener(new ActionListener() {
             @Override
-            public void actionPerformed( ActionEvent e ) {
+            public void actionPerformed(ActionEvent e) {
                 connection.login(nameField.getText());
             }
@@ -107,5 +132,5 @@
         autoLoginBox.addActionListener(new ActionListener() {
             @Override
-            public void actionPerformed( ActionEvent e ) {
+            public void actionPerformed(ActionEvent e) {
                 Main.pref.put("geochat.autologin", autoLoginBox.isSelected());
             }
@@ -126,9 +151,9 @@
     public void destroy() {
         try {
-            if( Main.pref.getBoolean("geochat.logout.on.close", true) ) {
+            if (Main.pref.getBoolean("geochat.logout.on.close", true)) {
                 connection.removeListener(this);
                 connection.bruteLogout();
             }
-        } catch( IOException e ) {
+        } catch (IOException e) {
             Main.warn("Failed to logout from geochat server: " + e.getMessage());
         }
@@ -136,17 +161,18 @@
     }
 
-    private String autoCompleteUser( String word, boolean atStart ) {
+    private String autoCompleteUser(String word, boolean atStart) {
         String result = null;
         boolean singleUser = true;
-        for( String user : users.keySet() ) {
-            if( user.startsWith(word) ) {
-                if( result == null )
+        for (String user : users.keySet()) {
+            if (user.startsWith(word)) {
+                if (result == null)
                     result = user;
                 else {
                     singleUser = false;
                     int i = word.length();
-                    while( i < result.length() && i < user.length() && result.charAt(i) == user.charAt(i) )
+                    while (i < result.length() && i < user.length() && result.charAt(i) == user.charAt(i)) {
                         i++;
-                    if( i < result.length() )
+                    }
+                    if (i < result.length())
                         result = result.substring(0, i);
                 }
@@ -161,6 +187,6 @@
      */
     @Override
-    public void paint( Graphics2D g, MapView mv, Bounds bbox ) {
-        Graphics2D g2d = (Graphics2D)g.create();
+    public void paint(Graphics2D g, MapView mv, Bounds bbox) {
+        Graphics2D g2d = (Graphics2D) g.create();
         g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         Composite ac04 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.4f);
@@ -171,5 +197,5 @@
         FontMetrics fm = g2d.getFontMetrics();
 
-        for( String user : users.keySet() ) {
+        for (String user : users.keySet()) {
             int stringWidth = fm.stringWidth(user);
             int radius = stringWidth / 2 + 10;
@@ -193,9 +219,9 @@
     protected void updateTitleAlarm() {
         int alarmLevel = connection.isLoggedIn() ? chatPanes.getNotifyLevel() : 0;
-        if( !isDialogInCollapsedView() && alarmLevel > 1 )
+        if (!isDialogInCollapsedView() && alarmLevel > 1)
             alarmLevel = 1;
 
         String comment;
-        if( connection.isLoggedIn() ) {
+        if (connection.isLoggedIn()) {
             comment = trn("{0} user", "{0} users", users.size() + 1, users.size() + 1);
         } else {
@@ -204,5 +230,5 @@
 
         String title = tr("GeoChat");
-        if( comment != null )
+        if (comment != null)
             title = title + " (" + comment + ")";
         final String alarm = (alarmLevel <= 0 ? "" : alarmLevel == 1 ? "* " : "!!! ") + title;
@@ -219,5 +245,5 @@
      */
     @Override
-    protected void setIsCollapsed( boolean val ) {
+    protected void setIsCollapsed(boolean val) {
         super.setIsCollapsed(val);
         chatPanes.setCollapsed(val);
@@ -228,7 +254,7 @@
 
     @Override
-    public void loggedIn( String userName ) {
+    public void loggedIn(String userName) {
         Main.pref.put("geochat.username", userName);
-        if( gcPanel.getComponentCount() == 1 ) {
+        if (gcPanel.getComponentCount() == 1) {
             GuiHelper.runInEDTAndWait(new Runnable() {
                 @Override
@@ -244,6 +270,6 @@
 
     @Override
-    public void notLoggedIn( final String reason ) {
-        if( reason != null ) {
+    public void notLoggedIn(final String reason) {
+        if (reason != null) {
             GuiHelper.runInEDT(new Runnable() {
                 @Override
@@ -254,5 +280,5 @@
         } else {
             // regular logout
-            if( gcPanel.getComponentCount() > 1 ) {
+            if (gcPanel.getComponentCount() > 1) {
                 gcPanel.removeAll();
                 gcPanel.add(loginPanel, BorderLayout.CENTER);
@@ -263,5 +289,5 @@
 
     @Override
-    public void messageSendFailed( final String reason ) {
+    public void messageSendFailed(final String reason) {
         GuiHelper.runInEDT(new Runnable() {
             @Override
@@ -273,5 +299,5 @@
 
     @Override
-    public void statusChanged( boolean active ) {
+    public void statusChanged(boolean active) {
         // only the public tab, because private chats don't rely on coordinates
         tabs.setComponentAt(0, active ? chatPanes.getPublicChatComponent() : noData);
@@ -280,16 +306,16 @@
 
     @Override
-    public void updateUsers( Map<String, LatLon> newUsers ) {
-        for( String uname : this.users.keySet() ) {
-            if( !newUsers.containsKey(uname) )
+    public void updateUsers(Map<String, LatLon> newUsers) {
+        for (String uname : this.users.keySet()) {
+            if (!newUsers.containsKey(uname))
                 chatPanes.addLineToPublic(tr("User {0} has left", uname), ChatPaneManager.MESSAGE_TYPE_INFORMATION);
         }
-        for( String uname : newUsers.keySet() ) {
-            if( !this.users.containsKey(uname) )
+        for (String uname : newUsers.keySet()) {
+            if (!this.users.containsKey(uname))
                 chatPanes.addLineToPublic(tr("User {0} is mapping nearby", uname), ChatPaneManager.MESSAGE_TYPE_INFORMATION);
         }
         this.users = newUsers;
         updateTitleAlarm();
-        if( userLayerActive && Main.map.mapView != null )
+        if (userLayerActive && Main.map.mapView != null)
             Main.map.mapView.repaint();
     }
@@ -297,5 +323,5 @@
     private final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
 
-    private void formatMessage( StringBuilder sb, ChatMessage msg ) {
+    private void formatMessage(StringBuilder sb, ChatMessage msg) {
         sb.append("\n");
         sb.append('[').append(TIME_FORMAT.format(msg.getTime())).append("] ");
@@ -304,16 +330,16 @@
 
     @Override
-    public void receivedMessages( boolean replace, List<ChatMessage> messages ) {
-        if( replace )
+    public void receivedMessages(boolean replace, List<ChatMessage> messages) {
+        if (replace)
             chatPanes.clearPublicChatPane();
-        if( !messages.isEmpty() ) {
+        if (!messages.isEmpty()) {
             int alarm = 0;
             StringBuilder sb = new StringBuilder();
-            for( ChatMessage msg : messages ) {
+            for (ChatMessage msg : messages) {
                 boolean important = msg.isIncoming() && containsName(msg.getMessage());
-                if( msg.isIncoming() && alarm < 2 ) {
+                if (msg.isIncoming() && alarm < 2) {
                     alarm = important ? 2 : 1;
                 }
-                if( important ) {
+                if (important) {
                     // add buffer, then add current line with italic, then clear buffer
                     chatPanes.addLineToPublic(sb.toString());
@@ -326,16 +352,16 @@
             }
             chatPanes.addLineToPublic(sb.toString());
-            if( alarm > 0 )
+            if (alarm > 0)
                 chatPanes.notify(null, alarm);
         }
-        if( replace )
+        if (replace)
             showNearbyUsers();
     }
 
     private void showNearbyUsers() {
-        if( !users.isEmpty() ) {
+        if (!users.isEmpty()) {
             StringBuilder sb = new StringBuilder(tr("Users mapping nearby:"));
             boolean first = true;
-            for( String user : users.keySet() ) {
+            for (String user : users.keySet()) {
                 sb.append(first ? " " : ", ");
                 sb.append(user);
@@ -345,11 +371,11 @@
     }
 
-    private boolean containsName( String message ) {
+    private boolean containsName(String message) {
         String userName = connection.getUserName();
         int length = userName.length();
         int i = message.indexOf(userName);
-        while( i >= 0 ) {
-            if( (i == 0 || !Character.isJavaIdentifierPart(message.charAt(i - 1)))
-                    && (i + length >= message.length() || !Character.isJavaIdentifierPart(message.charAt(i + length))) )
+        while (i >= 0) {
+            if ((i == 0 || !Character.isJavaIdentifierPart(message.charAt(i - 1)))
+                    && (i + length >= message.length() || !Character.isJavaIdentifierPart(message.charAt(i + length))))
                 return true;
             i = message.indexOf(userName, i + 1);
@@ -359,12 +385,12 @@
 
     @Override
-    public void receivedPrivateMessages( boolean replace, List<ChatMessage> messages ) {
-        if( replace )
+    public void receivedPrivateMessages(boolean replace, List<ChatMessage> messages) {
+        if (replace)
             chatPanes.closePrivateChatPanes();
-        for( ChatMessage msg : messages ) {
+        for (ChatMessage msg : messages) {
             StringBuilder sb = new StringBuilder();
             formatMessage(sb, msg);
             chatPanes.addLineToChatPane(msg.isIncoming() ? msg.getAuthor() : msg.getRecipient(), sb.toString());
-            if( msg.isIncoming() )
+            if (msg.isIncoming())
                 chatPanes.notify(msg.getAuthor(), 2);
         }
Index: applications/editors/josm/plugins/geochat/src/geochat/GeoChatPlugin.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/GeoChatPlugin.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/GeoChatPlugin.java	(revision 32544)
@@ -1,3 +1,3 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
 
@@ -8,15 +8,15 @@
 /**
  * Create chat panel.
- * 
+ *
  * @author zverik
  */
 public class GeoChatPlugin extends Plugin {
-    public GeoChatPlugin( PluginInformation info ) {
+    public GeoChatPlugin(PluginInformation info) {
         super(info);
     }
-    
+
     @Override
-    public void mapFrameInitialized( MapFrame oldFrame, MapFrame newFrame ) {
-        if( oldFrame == null && newFrame != null ) {
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
+        if (oldFrame == null && newFrame != null) {
             newFrame.addToggleDialog(new GeoChatPanel());
         }
Index: applications/editors/josm/plugins/geochat/src/geochat/GeoChatPopupAdapter.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/GeoChatPopupAdapter.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/GeoChatPopupAdapter.java	(revision 32544)
@@ -1,11 +1,17 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.event.ActionEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
-import javax.swing.*;
+
+import javax.swing.AbstractAction;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JPopupMenu;
+
 import org.openstreetmap.josm.Main;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 /**
@@ -16,20 +22,20 @@
     private GeoChatPanel panel;
 
-    public GeoChatPopupAdapter( GeoChatPanel panel ) {
+    GeoChatPopupAdapter(GeoChatPanel panel) {
         this.panel = panel;
     }
 
     @Override
-    public void mousePressed( MouseEvent e ) {
+    public void mousePressed(MouseEvent e) {
         check(e);
     }
 
     @Override
-    public void mouseReleased( MouseEvent e ) {
+    public void mouseReleased(MouseEvent e) {
         check(e);
     }
 
-    private void check( MouseEvent e ) {
-        if( e.isPopupTrigger() ) {
+    private void check(MouseEvent e) {
+        if (e.isPopupTrigger()) {
             createPopupMenu().show(e.getComponent(), e.getX(), e.getY());
         }
@@ -38,18 +44,17 @@
     private JPopupMenu createPopupMenu() {
         JMenu userMenu = new JMenu(tr("Private chat"));
-        for( String user : panel.users.keySet() ) {
-            if( !panel.chatPanes.hasUser(user) )
+        for (String user : panel.users.keySet()) {
+            if (!panel.chatPanes.hasUser(user))
                 userMenu.add(new PrivateChatAction(user));
         }
 
         JPopupMenu menu = new JPopupMenu();
-        if( panel.chatPanes.hasSelectedText() )
+        if (panel.chatPanes.hasSelectedText())
             menu.add(new CopyTextAction());
         menu.add(new JCheckBoxMenuItem(new ToggleUserLayerAction()));
-        if( userMenu.getItemCount() > 0 )
+        if (userMenu.getItemCount() > 0)
             menu.add(userMenu);
-        if( panel.chatPanes.getRecipient() != null )
+        if (panel.chatPanes.getRecipient() != null)
             menu.add(new CloseTabAction());
-//        menu.add(new ClearPaneAction());
         menu.add(new LogoutAction());
         return menu;
@@ -59,11 +64,12 @@
         private String userName;
 
-        public PrivateChatAction( String userName ) {
+        PrivateChatAction(String userName) {
             super(userName);
             this.userName = userName;
         }
 
-        public void actionPerformed( ActionEvent e ) {
-            if( !panel.chatPanes.hasUser(userName) ) {
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            if (!panel.chatPanes.hasUser(userName)) {
                 panel.chatPanes.createChatPane(userName);
             }
@@ -72,10 +78,10 @@
 
     private class CloseTabAction extends AbstractAction {
-        public CloseTabAction() {
+        CloseTabAction() {
             super(tr("Close tab"));
-//            putValue(SMALL_ICON, ImageProvider.get("help"));
         }
 
-        public void actionPerformed( ActionEvent e ) {
+        @Override
+        public void actionPerformed(ActionEvent e) {
             panel.chatPanes.closeSelectedPrivatePane();
         }
@@ -83,10 +89,11 @@
 
     private class LogoutAction extends AbstractAction {
-        public LogoutAction() {
+        LogoutAction() {
             super(tr("Logout"));
-//            putValue(SMALL_ICON, ImageProvider.get("help"));
+            //            putValue(SMALL_ICON, ImageProvider.get("help"));
         }
 
-        public void actionPerformed( ActionEvent e ) {
+        @Override
+        public void actionPerformed(ActionEvent e) {
             panel.logout();
         }
@@ -94,10 +101,10 @@
 
     private class ClearPaneAction extends AbstractAction {
-        public ClearPaneAction() {
+        ClearPaneAction() {
             super(tr("Clear log"));
-//            putValue(SMALL_ICON, ImageProvider.get("help"));
         }
 
-        public void actionPerformed( ActionEvent e ) {
+        @Override
+        public void actionPerformed(ActionEvent e) {
             panel.chatPanes.clearActiveChatPane();
         }
@@ -105,15 +112,15 @@
 
     private class ToggleUserLayerAction extends AbstractAction {
-        public ToggleUserLayerAction() {
+        ToggleUserLayerAction() {
             super(tr("Show users on map"));
-//            putValue(SMALL_ICON, ImageProvider.get("help"));
             putValue(SELECTED_KEY, Boolean.valueOf(panel.userLayerActive));
         }
 
-        public void actionPerformed( ActionEvent e ) {
-            if( Main.map == null || Main.map.mapView == null )
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            if (Main.map == null || Main.map.mapView == null)
                 return;
             boolean wasAdded = Main.map.mapView.addTemporaryLayer(panel);
-            if( !wasAdded )
+            if (!wasAdded)
                 Main.map.mapView.removeTemporaryLayer(panel);
             panel.userLayerActive = wasAdded;
@@ -124,10 +131,10 @@
 
     private class CopyTextAction extends AbstractAction {
-        public CopyTextAction() {
+        CopyTextAction() {
             super(tr("Copy"));
-//            putValue(SMALL_ICON, ImageProvider.get("help"));
         }
 
-        public void actionPerformed( ActionEvent e ) {
+        @Override
+        public void actionPerformed(ActionEvent e) {
             panel.chatPanes.copySelectedText();
         }
Index: applications/editors/josm/plugins/geochat/src/geochat/JPanelTextField.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/JPanelTextField.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/JPanelTextField.java	(revision 32544)
@@ -1,4 +1,6 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.KeyboardFocusManager;
@@ -6,9 +8,14 @@
 import java.awt.event.KeyEvent;
 import java.util.HashSet;
-import javax.swing.*;
+
+import javax.swing.JComponent;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
 import javax.swing.text.DefaultEditorKit;
+
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 /**
@@ -19,5 +26,5 @@
  */
 public class JPanelTextField extends JTextField {
-    
+
     public JPanelTextField() {
         setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, new HashSet<KeyStroke>());
@@ -36,5 +43,5 @@
     }
 
-    private JMenuItem createMenuItem( String action, String label ) {
+    private JMenuItem createMenuItem(String action, String label) {
         JMenuItem item = new JMenuItem(getActionMap().get(action));
         item.setText(label);
@@ -44,32 +51,34 @@
     // list of "standard" OS keys for JTextFiels = cursor moving, selection, copy/paste
     private final KeyStroke[] standardKeys;
-    private static final int MODIFIERS_MASK = InputEvent.META_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK;
+    private static final int MODIFIERS_MASK =
+            InputEvent.META_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK;
 
     @Override
-    protected void processKeyEvent( KeyEvent e ) {
-        if( e.getID() == KeyEvent.KEY_PRESSED ) {
+    protected void processKeyEvent(KeyEvent e) {
+        if (e.getID() == KeyEvent.KEY_PRESSED) {
             int code = e.getKeyCode();
-            if( code == KeyEvent.VK_ENTER ) {
+            if (code == KeyEvent.VK_ENTER) {
                 String text = getText();
-                if( text.length() > 0 ) {
+                if (text.length() > 0) {
                     processEnter(text);
                     setText("");
                 }
-            } else if( code == KeyEvent.VK_TAB ) {
+            } else if (code == KeyEvent.VK_TAB) {
                 String text = getText();
                 int caret = getCaretPosition();
                 int start = caret - 1;
-                while( start >= 0 && Character.isJavaIdentifierPart(text.charAt(start)) )
+                while (start >= 0 && Character.isJavaIdentifierPart(text.charAt(start))) {
                     start--;
+                }
                 start++;
-                if( start < caret ) {
+                if (start < caret) {
                     String word = text.substring(start, caret);
                     String complete = word == null ? null : autoComplete(word, start == 0);
-                    if( complete != null && !complete.equals(word) ) {
+                    if (complete != null && !complete.equals(word)) {
                         StringBuilder sb = new StringBuilder();
-                        if( start > 0 )
+                        if (start > 0)
                             sb.append(text.substring(0, start));
                         sb.append(complete);
-                        if( caret < text.length() )
+                        if (caret < text.length())
                             sb.append(text.substring(caret));
                         setText(sb.toString());
@@ -77,13 +86,13 @@
                     }
                 }
-            } else if( code == KeyEvent.VK_ESCAPE ) {
-                if( Main.map != null && Main.map.mapView != null )
+            } else if (code == KeyEvent.VK_ESCAPE) {
+                if (Main.map != null && Main.map.mapView != null)
                     Main.map.mapView.requestFocus();
-            } 
+            }
 
             boolean keyIsStandard = false;
             for (KeyStroke ks: standardKeys) {
-                if (code == ks.getKeyCode() && 
-                       (e.getModifiersEx() & MODIFIERS_MASK) == (ks.getModifiers() & MODIFIERS_MASK)) {
+                if (code == ks.getKeyCode() &&
+                        (e.getModifiersEx() & MODIFIERS_MASK) == (ks.getModifiers() & MODIFIERS_MASK)) {
                     keyIsStandard = true;
                     break;
@@ -91,5 +100,5 @@
             }
             // Do not pass other events to JOSM
-            if( !keyIsStandard ) {
+            if (!keyIsStandard) {
                 e.consume();
             }
@@ -100,8 +109,8 @@
     /**
      * Process VK_ENTER. Override this to submit the text.
-     * 
+     *
      * @param text Contents of the text field.
      */
-    protected void processEnter( String text ) { }
+    protected void processEnter(String text) { }
 
     /**
@@ -110,5 +119,5 @@
      * @return The whole word.
      */
-    protected String autoComplete( String word, boolean atStart ) {
+    protected String autoComplete(String word, boolean atStart) {
         return word;
     }
Index: applications/editors/josm/plugins/geochat/src/geochat/JsonQueryCallback.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/JsonQueryCallback.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/JsonQueryCallback.java	(revision 32544)
@@ -1,3 +1,3 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
 
@@ -17,4 +17,4 @@
      * @param json JSON parsed response or null if the query was unsuccessful.
      */
-    void processJson( JsonObject json );
+    void processJson(JsonObject json);
 }
Index: applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
===================================================================
--- applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java	(revision 32543)
+++ applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java	(revision 32544)
@@ -1,3 +1,3 @@
-// License: WTFPL
+// License: WTFPL. For details, see LICENSE file.
 package geochat;
 
@@ -20,5 +20,5 @@
  * @author zverik
  */
-public class JsonQueryUtil implements Runnable {
+public final class JsonQueryUtil implements Runnable {
 
     /**
@@ -28,25 +28,24 @@
      * @throws IOException There was a problem connecting to the server or parsing JSON.
      */
-    public static JsonObject query( String query ) throws IOException {
+    public static JsonObject query(String query) throws IOException {
         try {
             String serverURL = Main.pref.get("geochat.server", "http://zverik.dev.openstreetmap.org/osmochat.php?action=");
             URL url = new URL(serverURL + query);
-//            System.out.println("GeoChat URL = " + url.toString());
-            HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
             connection.connect();
-            if( connection.getResponseCode() != 200 ) {
+            if (connection.getResponseCode() != 200) {
                 throw new IOException("HTTP Response code " + connection.getResponseCode() + " (" + connection.getResponseMessage() + ")");
             }
             InputStream inp = connection.getInputStream();
-            if( inp == null )
+            if (inp == null)
                 throw new IOException("Empty response");
             try {
                 return Json.createReader(inp).readObject();
-            } catch( JsonException e ) {
+            } catch (JsonException e) {
                 throw new IOException("Failed to parse JSON: " + e.getMessage());
             } finally {
                 connection.disconnect();
             }
-        } catch( MalformedURLException ex ) {
+        } catch (MalformedURLException ex) {
             throw new IOException("Malformed URL: " + ex.getMessage());
         }
@@ -60,5 +59,5 @@
     private JsonQueryUtil() {}
 
-    private JsonQueryUtil( String query, JsonQueryCallback callback ) {
+    private JsonQueryUtil(String query, JsonQueryCallback callback) {
         this.query = query;
         this.callback = callback;
@@ -70,23 +69,25 @@
      * @param callback Callback listener to process the JSON response.
      */
-    public static void queryAsync( String query, JsonQueryCallback callback ) {
+    public static void queryAsync(String query, JsonQueryCallback callback) {
         Main.worker.submit(new JsonQueryUtil(query, callback));
     }
 
     private void doRealRun() {
-    	JsonObject obj;
+        JsonObject obj;
         try {
             obj = query(query);
-        } catch( IOException e ) {
+        } catch (IOException e) {
             Main.warn(e.getClass().getName() + " while connecting to a chat server: " + e.getMessage());
             obj = null;
         }
-        if( callback != null )
+        if (callback != null)
             callback.processJson(obj);
     }
 
+    @Override
     public void run() {
-        if( EventQueue.isDispatchThread() ) {
+        if (EventQueue.isDispatchThread()) {
             new Thread(new Runnable() {
+                @Override
                 public void run() {
                     doRealRun();
