From a0c5f9fb3dbd94054aa59861017b1a13c8e77c4e Mon Sep 17 00:00:00 2001 From: Emil Ivov Date: Mon, 30 Mar 2009 00:12:34 +0000 Subject: [PATCH] Fixes Eclipse warnings as a part of issue #637. There's more work on some of these classes but I need to go to bed now :). --- .../impl/history/HistoryImpl.java | 5 +- .../impl/history/HistoryReaderImpl.java | 108 +++++++++--------- .../impl/protocol/msn/ChatRoomMsnImpl.java | 59 +++++----- .../protocol/yahoo/ChatRoomYahooImpl.java | 54 +++++---- .../protocol/zeroconf/jmdns/DNSCache.java | 34 +++--- .../protocol/zeroconf/jmdns/DNSIncoming.java | 92 +++++++-------- .../protocol/zeroconf/jmdns/DNSState.java | 9 +- .../impl/protocol/zeroconf/jmdns/JmDNS.java | 108 ++++++------------ .../plugin/rssaccregwizz/FirstWizardPage.java | 10 +- .../slick/protocol/icq/FullUserInfoCmd.java | 12 +- 10 files changed, 238 insertions(+), 253 deletions(-) diff --git a/src/net/java/sip/communicator/impl/history/HistoryImpl.java b/src/net/java/sip/communicator/impl/history/HistoryImpl.java index 4cd77b9c1..0be13d243 100644 --- a/src/net/java/sip/communicator/impl/history/HistoryImpl.java +++ b/src/net/java/sip/communicator/impl/history/HistoryImpl.java @@ -38,7 +38,8 @@ public class HistoryImpl implements History { private HistoryWriter writer; - private SortedMap historyDocuments = new TreeMap(); + private SortedMap historyDocuments + = new TreeMap(); protected HistoryImpl(HistoryID id, File directory, HistoryRecordStructure historyRecordStructure, @@ -194,7 +195,7 @@ protected void writeFile(String filename, Document doc) } } - protected Iterator getFileList() + protected Iterator getFileList() { return this.historyDocuments.keySet().iterator(); } diff --git a/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java b/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java index 3c618b711..f06e20881 100644 --- a/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java +++ b/src/net/java/sip/communicator/impl/history/HistoryReaderImpl.java @@ -22,7 +22,8 @@ public class HistoryReaderImpl implements HistoryReader { private HistoryImpl historyImpl; - private Vector progressListeners = new Vector(); + private Vector progressListeners + = new Vector(); // regexp used for index of case(in)sensitive impl private static String REGEXP_END = ".*$"; @@ -146,10 +147,11 @@ public synchronized QueryResultSet findByPeriod(Date startDate, Date endDate, public synchronized QueryResultSet findLast(int count) throws RuntimeException { // the files are supposed to be ordered from oldest to newest - Vector filelist = + Vector filelist = filterFilesByDate(this.historyImpl.getFileList(), null, null); - TreeSet result = new TreeSet(new HistoryRecordComparator()); + TreeSet result + = new TreeSet(new HistoryRecordComparator()); int leftCount = count; int currentFile = filelist.size() - 1; @@ -166,14 +168,14 @@ public synchronized QueryResultSet findLast(int count) throws RuntimeException // will get nodes and construct a List of nodes // so we can easyly get sublist of it - List nodes = new ArrayList(); + List nodes = new ArrayList(); NodeList nodesList = doc.getElementsByTagName("record"); for (int i = 0; i < nodesList.getLength(); i++) { nodes.add(nodesList.item(i)); } - List lNodes = null; + List lNodes = null; if (nodes.size() > leftCount) { @@ -186,7 +188,7 @@ public synchronized QueryResultSet findLast(int count) throws RuntimeException leftCount -= nodes.size(); } - Iterator i = lNodes.iterator(); + Iterator i = lNodes.iterator(); while (i.hasNext()) { Node node = (Node) i.next(); @@ -197,7 +199,7 @@ public synchronized QueryResultSet findLast(int count) throws RuntimeException .getNodeValue(); Date timestamp = new Date(Long.parseLong(ts)); - ArrayList nameVals = new ArrayList(); + ArrayList nameVals = new ArrayList(); boolean isRecordOK = true; int len = propertyNodes.getLength(); @@ -312,9 +314,10 @@ public synchronized QueryResultSet findByPeriod(Date startDate, Date endDate, public QueryResultSet findFirstRecordsAfter(Date date, int count) throws RuntimeException { - TreeSet result = new TreeSet(new HistoryRecordComparator()); + TreeSet result + = new TreeSet(new HistoryRecordComparator()); - Vector filelist = + Vector filelist = filterFilesByDate(this.historyImpl.getFileList(), date, null); int leftCount = count; @@ -347,7 +350,7 @@ public QueryResultSet findFirstRecordsAfter(Date date, int count) throws if(!isInPeriod(timestamp, date, null)) continue; - ArrayList nameVals = new ArrayList(); + ArrayList nameVals = new ArrayList(); boolean isRecordOK = true; int len = propertyNodes.getLength(); @@ -406,10 +409,11 @@ public QueryResultSet findLastRecordsBefore(Date date, int count) throws RuntimeException { // the files are supposed to be ordered from oldest to newest - Vector filelist = + Vector filelist = filterFilesByDate(this.historyImpl.getFileList(), null, date); - TreeSet result = new TreeSet(new HistoryRecordComparator()); + TreeSet result + = new TreeSet(new HistoryRecordComparator()); int leftCount = count; int currentFile = filelist.size() - 1; @@ -440,7 +444,7 @@ public QueryResultSet findLastRecordsBefore(Date date, int count) throws if(!isInPeriod(timestamp, null, date)) continue; - ArrayList nameVals = new ArrayList(); + ArrayList nameVals = new ArrayList(); boolean isRecordOK = true; int len = propertyNodes.getLength(); @@ -491,9 +495,10 @@ private QueryResultSet find( Date startDate, Date endDate, String[] keywords, String field, boolean caseSensitive) { - TreeSet result = new TreeSet(new HistoryRecordComparator()); + TreeSet result + = new TreeSet(new HistoryRecordComparator()); - Vector filelist = + Vector filelist = filterFilesByDate(this.historyImpl.getFileList(), startDate, endDate); double currentProgress = HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE; @@ -507,10 +512,10 @@ private QueryResultSet find( fireProgressStateChanged(startDate, endDate, keywords, HistorySearchProgressListener.PROGRESS_MINIMUM_VALUE); - Iterator fileIterator = filelist.iterator(); + Iterator fileIterator = filelist.iterator(); while (fileIterator.hasNext()) { - String filename = (String) fileIterator.next(); + String filename = fileIterator.next(); Document doc = this.historyImpl.getDocumentForFile(filename); @@ -609,7 +614,7 @@ private HistoryRecord filterByKeyword(NodeList propertyNodes, String field, boolean caseSensitive) { - ArrayList nameVals = new ArrayList(); + ArrayList nameVals = new ArrayList(); int len = propertyNodes.getLength(); for (int j = 0; j < len; j++) { @@ -695,13 +700,13 @@ private boolean matchKeyword(String value, String[] keywords, * @param endDate Date * @return Iterator */ - private Vector filterFilesByDate( - Iterator filelist, Date startDate, Date endDate) + private Vector filterFilesByDate( + Iterator filelist, Date startDate, Date endDate) { if(startDate == null && endDate == null) { // no filtering needed then just return the same list - Vector result = new Vector(); + Vector result = new Vector(); while (filelist.hasNext()) { result.add(filelist.next()); @@ -709,7 +714,7 @@ private Vector filterFilesByDate( return result; } // first convert all files to long - TreeSet files = new TreeSet(); + TreeSet files = new TreeSet(); while (filelist.hasNext()) { String filename = (String)filelist.next(); @@ -717,22 +722,22 @@ private Vector filterFilesByDate( files.add( Long.parseLong(filename.substring(0, filename.length() - 4))); } - - TreeSet resultAsLong = new TreeSet(); - + + TreeSet resultAsLong = new TreeSet(); + // Temporary fix of a NoSuchElementException if(files.size() == 0) - { - Vector result = new Vector(); - Iterator iter = resultAsLong.iterator(); - + { + Vector result = new Vector(); + Iterator iter = resultAsLong.iterator(); + while (iter.hasNext()) { Long item = (Long) iter.next(); result.add(item.toString() + ".xml"); } return result; - } + } // if there is no startDate limit only to end date if(startDate == null) @@ -762,7 +767,7 @@ else if(endDate == null) resultAsLong.addAll(files.subSet(startLong, files.last())); resultAsLong.add(files.last()); - + // here we must get and the element before startLong resultAsLong.add(files.subSet(files.first(), startLong).last()); resultAsLong.remove(startLong); @@ -780,7 +785,8 @@ else if(endDate == null) resultAsLong.addAll(files.subSet(startLong, endLong)); // here we must get and the element before startLong - SortedSet theFirstToStart = files.subSet(files.first(), startLong); + SortedSet theFirstToStart + = files.subSet(files.first(), startLong); if(!theFirstToStart.isEmpty()) resultAsLong.add(theFirstToStart.last()); @@ -788,12 +794,12 @@ else if(endDate == null) resultAsLong.remove(endLong); } - Vector result = new Vector(); + Vector result = new Vector(); - Iterator iter = resultAsLong.iterator(); + Iterator iter = resultAsLong.iterator(); while (iter.hasNext()) { - Long item = (Long) iter.next(); + Long item = iter.next(); result.add(item.toString() + ".xml"); } @@ -808,7 +814,8 @@ private void fireProgressStateChanged(Date startDate, Date endDate, synchronized(progressListeners) { - Iterator iter = progressListeners.iterator(); + Iterator iter + = progressListeners.iterator(); while (iter.hasNext()) { HistorySearchProgressListener item = @@ -843,16 +850,16 @@ public void removeSearchProgressListener(HistorySearchProgressListener progressListeners.remove(listener); } } - + /** * Count the number of messages that a search will return * Actually only the last file is parsed and its nodes are counted. - * We accept that the other files are full with max records, - * this way we escape parsing all files which will significantly + * We accept that the other files are full with max records, + * this way we escape parsing all files which will significantly * slow the process and for one search will parse the files twice. - * + * * @return the number of searched messages - * @throws UnsupportedOperationException + * @throws UnsupportedOperationException * Thrown if an exception occurs during the execution of the * query, such as internal IO error. */ @@ -861,7 +868,7 @@ public int countRecords() { int result = 0; String lastFile = null; - Iterator filelistIter = this.historyImpl.getFileList(); + Iterator filelistIter = this.historyImpl.getFileList(); while (filelistIter.hasNext()) { lastFile = (String)filelistIter.next(); @@ -870,7 +877,7 @@ public int countRecords() if(lastFile == null) return result; - + Document doc = this.historyImpl.getDocumentForFile(lastFile); if(doc == null) @@ -879,7 +886,7 @@ public int countRecords() NodeList nodes = doc.getElementsByTagName("record"); result += nodes.getLength(); - + return result; } @@ -888,17 +895,12 @@ public int countRecords() * ant to be ordered in TreeSet */ private static class HistoryRecordComparator - implements Comparator + implements Comparator { - public int compare(Object o1, Object o2) + public int compare(HistoryRecord h1, HistoryRecord h2) { - if(o1 instanceof HistoryRecord && o2 instanceof HistoryRecord) - { - return ((HistoryRecord)o1).getTimestamp(). - compareTo(((HistoryRecord)o2).getTimestamp()); - } - else - return 0; + return h1.getTimestamp(). + compareTo(h2.getTimestamp()); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java index fb1189b1c..7191b7b6a 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ChatRoomMsnImpl.java @@ -39,13 +39,14 @@ public class ChatRoomMsnImpl /** * List of unresolved member names. */ - private ArrayList pendingInvitations = new ArrayList(); + private ArrayList pendingInvitations = new ArrayList(); /** * List of the users that are banned. Note: Not possible inside the MSN * protocol, the list is always empty. */ - private Hashtable banList = new Hashtable(); + private Hashtable banList + = new Hashtable(); /** * The chat rooms name. @@ -63,13 +64,6 @@ public class ChatRoomMsnImpl */ private String chatSubject = null; - /** - * The old chat room subject. - * - * @see chatSubject. - */ - private String oldSubject; - /** * The corresponding switchboard for the chat room. Each chat room has its * own switchboard and if it is closed the user cannot reconnect to it, see @@ -86,52 +80,52 @@ public class ChatRoomMsnImpl * Listeners that will be notified of changes in member status in the room * such as member joined, left or being kicked or dropped. */ - private Vector memberListeners = new Vector(); + private Vector memberListeners + = new Vector(); /** * Listeners that will be notified of changes in member role in the room * such as member being granted admin permissions, or revoked admin * permissions. */ - private Vector memberRoleListeners = new Vector(); + private Vector memberRoleListeners + = new Vector(); /** * Listeners that will be notified of changes in local user role in the room * such as member being granted administrator permissions, or revoked * administrator permissions. */ - private Vector localUserRoleListeners = new Vector(); + private Vector localUserRoleListeners + = new Vector(); /** * Listeners that will be notified every time a new message is received on * this chat room. */ - private Vector messageListeners = new Vector(); + private Vector messageListeners + = new Vector(); /** * Listeners that will be notified every time a chat room property has been * changed. */ - private Vector propertyChangeListeners = new Vector(); + private Vector propertyChangeListeners + = new Vector(); /** * Listeners that will be notified every time a chat room member property * has been changed. */ - private Vector memberPropChangeListeners = new Vector(); + private Vector + memberPropChangeListeners + = new Vector(); /** * A Message buffer, will keep all messages until the msn chatroom is ready. */ public Vector messageBuffer = new Vector(); - private String invitationMessage = ""; - - /** - * Default Invitation message. - */ - private final String DEFAULT_INVITATION = "Please join my chat room!"; - /** * Creates an instance of ChatRoomMsnImpl, by specifying the name * of the chat room and the protocol provider. @@ -438,9 +432,9 @@ public Message createMessage(String messageText) /** * Returns the list of banned users. */ - public Iterator getBanList() throws OperationFailedException + public Iterator getBanList() throws OperationFailedException { - return banList.values().iterator(); + return new LinkedList(banList.values()).iterator(); } /** @@ -479,9 +473,9 @@ public String getIdentifier() * @return a List of Contact corresponding to all room * members. */ - public List getMembers() + public List getMembers() { - return new LinkedList(members.values()); + return new LinkedList(members.values()); } /** @@ -725,7 +719,8 @@ public void leave() switchboard = null; } - Iterator membersIter = members.values().iterator(); + Iterator membersIter + = members.values().iterator(); while (membersIter.hasNext()) { @@ -806,10 +801,11 @@ public ChatRoomMemberMsnImpl getChatRoomMember(String id) */ public void fireMessageEvent(EventObject evt) { - Iterator listeners = null; + Iterator listeners = null; synchronized (messageListeners) { - listeners = new ArrayList(messageListeners).iterator(); + listeners = new ArrayList( + messageListeners).iterator(); } if (!listeners.hasNext()) @@ -896,10 +892,11 @@ private void fireMemberPresenceEvent( ChatRoomMember member, logger.trace("Will dispatch the following ChatRoom event: " + evt); - Iterator listeners = null; + Iterator listeners = null; synchronized (memberListeners) { - listeners = new ArrayList(memberListeners).iterator(); + listeners = new ArrayList( + memberListeners).iterator(); } while (listeners.hasNext()) diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java index 335ce6908..2fa29664b 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ChatRoomYahooImpl.java @@ -30,39 +30,46 @@ public class ChatRoomYahooImpl implements ChatRoom * Listeners that will be notified of changes in member status in the room * such as member joined, left or being kicked or dropped. */ - private Vector memberListeners = new Vector(); + private Vector memberListeners + = new Vector(); /** * Listeners that will be notified of changes in member role in the room * such as member being granted admin permissions, or revoked admin * permissions. */ - private Vector memberRoleListeners = new Vector(); + private Vector memberRoleListeners + = new Vector(); /** * Listeners that will be notified of changes in local user role in the room * such as member being granted admin permissions, or revoked admin * permissions. */ - private Vector localUserRoleListeners = new Vector(); + private Vector localUserRoleListeners + = new Vector(); /** * Listeners that will be notified every time a new message is received on * this chat room. */ - private Vector messageListeners = new Vector(); + private Vector messageListeners + = new Vector(); /** * Listeners that will be notified every time a chat room property has been * changed. */ - private Vector propertyChangeListeners = new Vector(); + private Vector propertyChangeListeners + = new Vector(); /** * Listeners that will be notified every time a chat room member property * has been changed. */ - private Vector memberPropChangeListeners = new Vector(); + private Vector + memberPropChangeListeners + = new Vector(); /** * The protocol provider that created us @@ -77,12 +84,14 @@ public class ChatRoomYahooImpl implements ChatRoom /** * The list of members of this chat room. */ - private Hashtable members = new Hashtable(); + private Hashtable members + = new Hashtable(); /** * The list of members of this chat room. */ - private Hashtable banList = new Hashtable(); + private Hashtable banList + = new Hashtable(); /** * The nickname of this chat room local user participant. @@ -305,12 +314,12 @@ public List getMembers() public void updateMemberList() { - Vector memberList = yahooConference.getMembers(); - Iterator it = memberList.iterator(); + Vector memberList = yahooConference.getMembers(); + Iterator it = memberList.iterator(); while (it.hasNext()) { - YahooUser user = (YahooUser) it.next(); + YahooUser user = it.next(); ChatRoomMemberYahooImpl member = new ChatRoomMemberYahooImpl(this, user.getId(), user.getId(), ChatRoomMemberRole.MEMBER); @@ -377,9 +386,9 @@ public void banParticipant(ChatRoomMember chatRoomMember, String reason) * Returns the list of banned users, since it is not possible to */ - public Iterator getBanList() throws OperationFailedException + public Iterator getBanList() throws OperationFailedException { - return banList.values().iterator(); + return new LinkedList(banList.values()).iterator(); } /** @@ -643,11 +652,14 @@ public void leave() { provider.getYahooSession().leaveConference(yahooConference); - Iterator membersSet = members.entrySet().iterator(); + Iterator< Map.Entry> membersSet + = members.entrySet().iterator(); while (membersSet.hasNext()) { - Map.Entry memberEntry = (Map.Entry) membersSet.next(); + Map.Entry memberEntry + = (Map.Entry) membersSet + .next(); ChatRoomMember member = (ChatRoomMember) memberEntry.getValue(); @@ -773,7 +785,7 @@ public void setUserNickname(String nickname) */ public ChatRoomMemberYahooImpl getChatRoomMember(String userAddress) { - Iterator it = members.values().iterator(); + Iterator it = members.values().iterator(); while (it.hasNext()) { @@ -797,10 +809,11 @@ public ChatRoomMemberYahooImpl getChatRoomMember(String userAddress) */ public void fireMessageEvent(EventObject evt) { - Iterator listeners = null; + Iterator listeners = null; synchronized (messageListeners) { - listeners = new ArrayList(messageListeners).iterator(); + listeners = new ArrayList( + messageListeners).iterator(); } while (listeners.hasNext()) @@ -842,10 +855,11 @@ public void fireMemberPresenceEvent(ChatRoomMember member, String eventID, logger.trace("Will dispatch the following ChatRoom event: " + evt); - Iterator listeners = null; + Iterator listeners = null; synchronized (memberListeners) { - listeners = new ArrayList(memberListeners).iterator(); + listeners = new ArrayList( + memberListeners).iterator(); } while (listeners.hasNext()) diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java index 2e24064b2..65a9a48d1 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java @@ -18,11 +18,11 @@ * when iterating over entries in the cache. Here's how to iterate over * all entries in the cache: *
- * for (Iterator i=dnscache.iterator(); i.hasNext(); ) 
+ * for (Iterator i=dnscache.iterator(); i.hasNext(); )
  * {
- *    for ( DNSCache.CacheNode n = (DNSCache.CacheNode) i.next(); 
- *          n != null; 
- *          n.next()) 
+ *    for ( DNSCache.CacheNode n = (DNSCache.CacheNode) i.next();
+ *          n != null;
+ *          n.next())
  *    {
  *       DNSEntry entry = n.getValue();
  *       ...do something with entry...
@@ -32,9 +32,9 @@
  * 

* And here's how to iterate over all entries having a given name: *

- * for (    DNSCache.CacheNode n = (DNSCache.CacheNode) dnscache.find(name); 
- *          n != null; 
- *          n.next()) 
+ * for (    DNSCache.CacheNode n = (DNSCache.CacheNode) dnscache.find(name);
+ *          n != null;
+ *          n.next())
  * {
  *     DNSEntry entry = n.getValue();
  *     ...do something with entry...
@@ -55,9 +55,9 @@ class DNSCache
     // Since DNSCache is not a public class, it does not seem worth the effort
     // to clean its API up that much.
 
-    // [PJYF Oct 15 2004] This should implements Collections 
+    // [PJYF Oct 15 2004] This should implements Collections
     // that would be amuch cleaner implementation
-    
+
     /**
      * The number of DNSEntry's in the cache.
      */
@@ -86,7 +86,7 @@ public CacheNode(DNSEntry value)
             this.value = value;
             String SLevel = System.getProperty("jmdns.debug");
             if (SLevel == null) SLevel = "INFO";
-            this.logger.setLevel(Level.parse(SLevel)); 
+            this.logger.setLevel(Level.parse(SLevel));
         }
 
         public CacheNode next()
@@ -108,10 +108,10 @@ public DNSEntry getValue()
     public DNSCache(final int size)
     {
         hashtable = new HashMap(size);
-        
+
         String SLevel = System.getProperty("jmdns.debug");
         if (SLevel == null) SLevel = "INFO";
-        logger.setLevel(Level.parse(SLevel)); 
+        logger.setLevel(Level.parse(SLevel));
     }
 
     /**
@@ -145,7 +145,7 @@ public synchronized void add(final DNSEntry entry)
     }
 
     /**
-     * Remove a specific entry from the table. 
+     * Remove a specific entry from the table.
      * @param entry removed from table.
      * @return Returns true if the entry was found.
      */
@@ -205,9 +205,9 @@ public synchronized DNSEntry get(DNSEntry entry)
 
     /**
      * Get a matching DNS entry from the table.
-     * @param name 
-     * @param type 
-     * @param clazz 
+     * @param name
+     * @param type
+     * @param clazz
      * @return Return the entry if found, null otherwise.
      */
     public synchronized DNSEntry get(String name, int type, int clazz)
@@ -230,7 +230,7 @@ public synchronized DNSEntry get(String name, int type, int clazz)
      * code snippets in the header of the class.
      * @return Returns iterator with instances of DNSCache.CacheNode.
      */
-    public Iterator iterator()
+    public Iterator iterator()
     {
         return Collections.unmodifiableCollection(hashtable.values()).iterator();
     }
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSIncoming.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSIncoming.java
index f5d8a5698..499e79eef 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSIncoming.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSIncoming.java
@@ -3,14 +3,10 @@
 //Original license LGPL
 package net.java.sip.communicator.impl.protocol.zeroconf.jmdns;
 
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.logging.*;
 
 /**
  * Parse an incoming DNS message into its components.
@@ -26,7 +22,7 @@ final class DNSIncoming
     // we get undesired results. To fix this, we have to migrate to
     // the Collections API of Java 1.2. i.e we replace Vector by List.
     // final static Vector EMPTY = new Vector();
-    
+
     private DatagramPacket packet;
     private int off;
     private int len;
@@ -40,8 +36,8 @@ final class DNSIncoming
     private int numAdditionals;
     private long receivedTime;
 
-    List questions;
-    List answers;
+    List questions;
+    List answers;
 
     /**
      * Parse a message from a datagram packet.
@@ -50,14 +46,14 @@ final class DNSIncoming
     {
         String SLevel = System.getProperty("jmdns.debug");
         if (SLevel == null) SLevel = "INFO";
-        logger.setLevel(Level.parse(SLevel)); 
-        
+        logger.setLevel(Level.parse(SLevel));
+
         this.packet = packet;
         this.data = packet.getData();
         this.len = packet.getLength();
         this.off = packet.getOffset();
-        this.questions = Collections.EMPTY_LIST;
-        this.answers = Collections.EMPTY_LIST;
+        this.questions = new LinkedList();
+        this.answers = new LinkedList();
         this.receivedTime = System.currentTimeMillis();
 
         try
@@ -72,16 +68,17 @@ final class DNSIncoming
             // parse questions
             if (numQuestions > 0)
             {
-                questions = 
-                    Collections.synchronizedList(new ArrayList(numQuestions));
+                questions =
+                    Collections.synchronizedList(
+                                    new ArrayList(numQuestions));
                 for (int i = 0; i < numQuestions; i++)
                 {
-                    DNSQuestion question = 
+                    DNSQuestion question =
                         new DNSQuestion(
-                            readName(), 
-                            readUnsignedShort(), 
+                            readName(),
+                            readUnsignedShort(),
                             readUnsignedShort());
-                    
+
                     questions.add(question);
                 }
             }
@@ -91,7 +88,8 @@ final class DNSIncoming
             if (n > 0)
             {
                 //System.out.println("JMDNS received "+n+" answers!");
-                answers = Collections.synchronizedList(new ArrayList(n));
+                answers = Collections.synchronizedList(
+                                new ArrayList(n));
                 for (int i = 0; i < n; i++)
                 {
                     String domain = readName();
@@ -120,13 +118,13 @@ final class DNSIncoming
                             break;
                         case DNSConstants.TYPE_SRV:
                             //System.out.println("JMDNS: One is a SRV field!!");
-                            rec = new DNSRecord.Service(    domain, 
-                                                            type, 
-                                                            clazz, 
+                            rec = new DNSRecord.Service(    domain,
+                                                            type,
+                                                            clazz,
                                                             ttl,
-                                                            readUnsignedShort(), 
-                                                            readUnsignedShort(), 
-                                                            readUnsignedShort(), 
+                                                            readUnsignedShort(),
+                                                            readUnsignedShort(),
+                                                            readUnsignedShort(),
                                                             readName());
                             break;
                         case DNSConstants.TYPE_HINFO:
@@ -157,8 +155,8 @@ final class DNSIncoming
                             }
                             else
                             {
-                                if (answers.size() < numAnswers + 
-                                                     numAuthorities + 
+                                if (answers.size() < numAnswers +
+                                                     numAuthorities +
                                                      numAdditionals)
                                 {
                                     numAdditionals--;
@@ -172,7 +170,7 @@ final class DNSIncoming
         }
         catch (IOException e)
         {
-            logger.log(Level.WARNING, 
+            logger.log(Level.WARNING,
                 "DNSIncoming() dump " + print(true) + "\n exception ", e);
             throw e;
         }
@@ -183,7 +181,7 @@ final class DNSIncoming
      */
     boolean isQuery()
     {
-        return (flags & DNSConstants.FLAGS_QR_MASK) == 
+        return (flags & DNSConstants.FLAGS_QR_MASK) ==
                 DNSConstants.FLAGS_QR_QUERY;
     }
 
@@ -200,7 +198,7 @@ boolean isTruncated()
      */
     boolean isResponse()
     {
-        return (flags & DNSConstants.FLAGS_QR_MASK) == 
+        return (flags & DNSConstants.FLAGS_QR_MASK) ==
                 DNSConstants.FLAGS_QR_RESPONSE;
     }
 
@@ -254,8 +252,8 @@ private void readUTF(StringBuffer buf, int off, int len) throws IOException
                     break;
                 case 14:
                     // 1110 xxxx  10xx xxxx  10xx xxxx
-                    ch =    ((ch & 0x0f) << 12) | 
-                            ((get(off++) & 0x3F) << 6) | 
+                    ch =    ((ch & 0x0f) << 12) |
+                            ((get(off++) & 0x3F) << 6) |
                             (get(off++) & 0x3F);
                     break;
                 default:
@@ -319,12 +317,15 @@ String print(boolean dump)
     {
         StringBuffer buf = new StringBuffer();
         buf.append(toString() + "\n");
-        for (Iterator iterator = questions.iterator(); iterator.hasNext();)
+        for (Iterator iterator = questions.iterator();
+                iterator.hasNext();)
         {
             buf.append("    ques:" + iterator.next() + "\n");
         }
         int count = 0;
-        for (Iterator iterator = answers.iterator(); iterator.hasNext(); count++)
+        for (Iterator iterator = answers.iterator();
+                iterator.hasNext();
+                count++)
         {
             if (count < numAnswers)
             {
@@ -458,30 +459,31 @@ void append(DNSIncoming that)
         {
             if (that.numQuestions > 0) {
                 if (Collections.EMPTY_LIST.equals(this.questions))
-                    this.questions = 
+                    this.questions =
                         Collections.synchronizedList(
-                            new ArrayList(that.numQuestions));
+                            new ArrayList(that.numQuestions));
 
                 this.questions.addAll(that.questions);
                 this.numQuestions += that.numQuestions;
             }
-            
+
             if (Collections.EMPTY_LIST.equals(answers))
             {
-                answers = Collections.synchronizedList(new ArrayList());
+                answers = Collections.synchronizedList(
+                                    new ArrayList());
             }
 
             if (that.numAnswers > 0)
             {
-                this.answers.addAll(this.numAnswers, 
+                this.answers.addAll(this.numAnswers,
                                     that.answers.subList(0, that.numAnswers));
                 this.numAnswers += that.numAnswers;
             }
             if (that.numAuthorities > 0)
             {
-                this.answers.addAll(this.numAnswers + this.numAuthorities, 
+                this.answers.addAll(this.numAnswers + this.numAuthorities,
                                     that.answers.subList(
-                                        that.numAnswers, 
+                                        that.numAnswers,
                                         that.numAnswers + that.numAuthorities));
                 this.numAuthorities += that.numAuthorities;
             }
@@ -489,7 +491,7 @@ void append(DNSIncoming that)
             {
                 this.answers.addAll(
                     that.answers.subList(
-                        that.numAnswers + that.numAuthorities, 
+                        that.numAnswers + that.numAuthorities,
                         that.numAnswers + that.numAuthorities + that.numAdditionals));
                 this.numAdditionals += that.numAdditionals;
             }
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java
index 9a119b41a..08068eb88 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSState.java
@@ -13,7 +13,7 @@
  * @version 1.0  May 23, 2004  Created.
  */
 public class DNSState 
-    implements Comparable
+    implements Comparable
 {
     private static Logger logger = 
         Logger.getLogger(DNSState.class.toString());
@@ -33,7 +33,8 @@ public class DNSState
      * The sequence is consistent with the ordinal of a state.
      * This is used for advancing through states.
      */
-    private final static ArrayList sequence = new ArrayList();
+    private final static ArrayList sequence 
+        = new ArrayList();
 
     private DNSState(String name)
     {
@@ -116,8 +117,8 @@ public boolean isAnnounced()
      * PROBING_1 < PROBING_2 < PROBING_3 < ANNOUNCING_1 <
      * ANNOUNCING_2 < RESPONDING < ANNOUNCED < CANCELED.
      */
-    public int compareTo(Object o)
+    public int compareTo(DNSState state)
     {
-        return ordinal - ((DNSState) o).ordinal;
+        return ordinal - state.ordinal;
     }
 }
\ No newline at end of file
diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java
index 35380b19d..7b9c86f83 100644
--- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java
+++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java
@@ -49,13 +49,13 @@ public class JmDNS
      * Must by a synchronized collection, because it is updated from
      * concurrent threads.
      */
-    private List listeners;
+    private List listeners;
     /**
      * Holds instances of ServiceListener's.
      * Keys are Strings holding a fully qualified service type.
      * Values are LinkedList's of ServiceListener's.
      */
-    private Map serviceListeners;
+    private Map> serviceListeners;
     /**
      * Holds instances of ServiceTypeListener's.
      */
@@ -554,10 +554,10 @@ public void addServiceListener(String type, ServiceListener listener)
     {
         String lotype = type.toLowerCase();
         removeServiceListener(lotype, listener);
-        List list = null;
+        List list = null;
         synchronized (this)
         {
-            list = (List) serviceListeners.get(lotype);
+            list = serviceListeners.get(lotype);
             if (list == null)
             {
                 list = Collections.synchronizedList(new LinkedList());
@@ -599,7 +599,7 @@ public void addServiceListener(String type, ServiceListener listener)
     public void removeServiceListener(String type, ServiceListener listener)
     {
         type = type.toLowerCase();
-        List list = (List) serviceListeners.get(type);
+        List list = serviceListeners.get(type);
         if (list != null)
         {
             synchronized (this)
@@ -762,49 +762,6 @@ public void registerServiceType(String type)
         }
     }
 
-    /**
-     * Generate a possibly unique name for a host using the information we
-     * have in the cache.
-     *
-     * @return returns true, if the name of the host had to be changed.
-     */
-    private boolean makeHostNameUnique(DNSRecord.Address host)
-    {
-        String originalName = host.getName();
-        long now = System.currentTimeMillis();
-
-        boolean collision;
-        do
-        {
-            collision = false;
-
-            // Check for collision in cache
-            for (DNSCache.CacheNode j = cache.find(
-                                host.getName().toLowerCase());
-                j != null;
-                j = j.next())
-            {
-                DNSRecord a = (DNSRecord) j.getValue();
-                if (false)
-                {
-                    host.name = incrementName(host.getName());
-                    collision = true;
-                    break;
-                }
-            }
-        }
-        while (collision);
-
-        if (originalName.equals(host.getName()))
-        {
-            return false;
-        }
-        else
-        {
-            return true;
-        }
-    }
-
     /**
      * Generate a possibly unique name for a service using the information we
      * have in the cache.
@@ -936,15 +893,16 @@ void updateRecord(long now, DNSRecord rec)
     {
         // We do not want to block the entire DNS
         // while we are updating the record for each listener (service info)
-        List listenerList = null;
+        List listenerList = null;
         synchronized (this)
         {
-            listenerList = new ArrayList(listeners);
+            listenerList = new ArrayList(listeners);
         }
 
         //System.out.println("OUT OF MUTEX!!!!!");
 
-        for (Iterator iterator = listenerList.iterator(); iterator.hasNext();)
+        for (Iterator iterator = listenerList.iterator();
+                iterator.hasNext();)
         {
             DNSListener listener = (DNSListener) iterator.next();
             listener.updateRecord(this, now, rec);
@@ -1329,12 +1287,13 @@ public void run()
                 // -------------------------------------
                 // To prevent race conditions, we defensively copy all cache
                 // entries into a list.
-                List list = new ArrayList();
+                List list = new ArrayList();
                 synchronized (cache)
                 {
-                    for (Iterator i = cache.iterator(); i.hasNext();)
+                    for (Iterator i = cache.iterator();
+                            i.hasNext();)
                     {
-                        for (DNSCache.CacheNode n = (DNSCache.CacheNode) i.next();
+                        for (DNSCache.CacheNode n = i.next();
                             n != null;
                             n = n.next())
                         {
@@ -1344,9 +1303,9 @@ public void run()
                 }
                 // Now, we remove them.
                 long now = System.currentTimeMillis();
-                for (Iterator i = list.iterator(); i.hasNext();)
+                for (Iterator i = list.iterator(); i.hasNext();)
                 {
-                    DNSRecord c = (DNSRecord) i.next();
+                    DNSRecord c = (DNSRecord)i.next();
                     if (c.isExpired(now))
                     {
                         updateRecord(now, c);
@@ -1439,9 +1398,10 @@ public boolean cancel()
             // Remove associations from services to this
             synchronized (JmDNS.this)
             {
-                for (Iterator i = services.values().iterator(); i.hasNext();)
+                for (Iterator i = services.values().iterator();
+                            i.hasNext();)
                 {
-                    ServiceInfo info = (ServiceInfo) i.next();
+                    ServiceInfo info = i.next();
                     if (info.task == this)
                     {
                         info.task = null;
@@ -1614,9 +1574,10 @@ public boolean cancel()
             // Remove associations from services to this
             synchronized (JmDNS.this)
             {
-                for (Iterator i = services.values().iterator(); i.hasNext();)
+                for (Iterator i = services.values().iterator();
+                        i.hasNext();)
                 {
-                    ServiceInfo info = (ServiceInfo) i.next();
+                    ServiceInfo info = i.next();
                     if (info.task == this)
                     {
                         info.task = null;
@@ -1784,9 +1745,10 @@ public boolean cancel()
             // Remove associations from services to this
             synchronized (JmDNS.this)
             {
-                for (Iterator i = services.values().iterator(); i.hasNext();)
+                for (Iterator i = services.values().iterator();
+                        i.hasNext();)
                 {
-                    ServiceInfo info = (ServiceInfo) i.next();
+                    ServiceInfo info = i.next();
                     if (info.task == this)
                     {
                         info.task = null;
@@ -1977,21 +1939,19 @@ public void run()
 
                 // We use these sets to prevent duplicate records
                 // FIXME - This should be moved into DNSOutgoing
-                HashSet questions = new HashSet();
-                HashSet answers = new HashSet();
+                HashSet questions = new HashSet();
+                HashSet answers = new HashSet();
 
 
                 if (state == DNSState.ANNOUNCED)
                 {
                     try
                     {
-                        long now = System.currentTimeMillis();
-                        long expirationTime = now + 1; //=now+DNSConstants.KNOWN_ANSWER_TTL;
                         boolean isUnicast = (port != DNSConstants.MDNS_PORT);
 
 
                         // Answer questions
-                        for (Iterator iterator = in.questions.iterator();
+                        for (Iterator iterator = in.questions.iterator();
                             iterator.hasNext();)
                         {
                             DNSEntry entry = (DNSEntry) iterator.next();
@@ -2120,7 +2080,7 @@ public void run()
                                         }
                                         if (q.name.equalsIgnoreCase("_services._mdns._udp.local."))
                                         {
-                                            for (Iterator serviceTypeIterator = serviceTypes.values().iterator();
+                                            for (Iterator serviceTypeIterator = serviceTypes.values().iterator();
                                                 serviceTypeIterator.hasNext();)
                                             {
                                                 answers.add(
@@ -2214,18 +2174,20 @@ public void run()
                             if (isUnicast)
                             {
                                 out = new DNSOutgoing(
-                                    DNSConstants.FLAGS_QR_RESPONSE | DNSConstants.FLAGS_AA,
+                                    DNSConstants.FLAGS_QR_RESPONSE
+                                    | DNSConstants.FLAGS_AA,
                                     false);
                             }
 
-                            for (Iterator i = questions.iterator(); i.hasNext();)
+                            for (Iterator i = questions.iterator();
+                                    i.hasNext();)
                             {
                                 out.addQuestion((DNSQuestion) i.next());
                             }
-                            for (Iterator i = answers.iterator(); i.hasNext();)
+                            for (Iterator i = answers.iterator();
+                                    i.hasNext();)
                             {
-                                out = addAnswer(in, addr, port, out,
-                                    (DNSRecord) i.next());
+                                out = addAnswer(in, addr, port, out, i.next());
                             }
                             send(out);
                         }
diff --git a/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java
index 4ec3135f3..859dfbafa 100644
--- a/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java
+++ b/src/net/java/sip/communicator/plugin/rssaccregwizz/FirstWizardPage.java
@@ -28,6 +28,11 @@ public class FirstWizardPage
     implements  WizardPage,
                 DocumentListener
 {
+    /**
+     * An Eclipse generated UID.
+     */
+    private static final long serialVersionUID = -4099426006855229937L;
+
     public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
 
     private JPanel labelsPanel = new TransparentPanel();
@@ -268,11 +273,12 @@ private boolean isExistingAccount(String userID)
         ProtocolProviderFactory factory
             = RssAccRegWizzActivator.getRssProtocolProviderFactory();
 
-        ArrayList registeredAccounts = factory.getRegisteredAccounts();
+        ArrayList registeredAccounts 
+            = factory.getRegisteredAccounts();
 
         for (int i = 0; i < registeredAccounts.size(); i++)
         {
-            AccountID accountID = (AccountID) registeredAccounts.get(i);
+            AccountID accountID = registeredAccounts.get(i);
 
             if (userID.equalsIgnoreCase(accountID.getUserID()))
             {
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java
index b4ad17616..051f0b49e 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java
+++ b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java
@@ -223,15 +223,15 @@ private void readBasicUserInfo(ByteBlock block, int requestID)
 //        infoData.add(new ServerStoredDetails.NicknameDetail(bscInfo[0]));
 //        infoData.add(new ServerStoredDetails.FirstNameDetail(bscInfo[1]));
 
-		if(bscInfo[2] != null)
-			infoData.put(LAST_NAME, bscInfo[2]);
+        if(bscInfo[2] != null)
+            infoData.put(LAST_NAME, bscInfo[2]);
 
 //        infoData.add(new ServerStoredDetails.EmailAddressDetail(bscInfo[3]));
 //        infoData.add(new ServerStoredDetails.CityDetail(bscInfo[4]));
 //        infoData.add(new ServerStoredDetails.ProvinceDetail(bscInfo[5]));
 
         if(bscInfo[6] != null)
-			infoData.put(PHONE_NUMBER, bscInfo[6]);
+            infoData.put(PHONE_NUMBER, bscInfo[6]);
 
 //        infoData.add(new ServerStoredDetails.FaxDetail(bscInfo[7]));
 //        infoData.add(new ServerStoredDetails.AddressDetail(bscInfo[8]));
@@ -290,7 +290,7 @@ private void readMoreUserInfo(ByteBlock block, int requestID)
 //            infoData.add(new ServerStoredDetails.BirthDateDetail(birthDate));
 //        }
 //
-        ArrayList langs = new ArrayList();
+        ArrayList langs = new ArrayList();
         short speakingLanguage1 = getUByte(block, offset);
         offset += 1;
         if(speakingLanguage1 != 0 && speakingLanguage1 != 255)
@@ -762,7 +762,7 @@ protected static SnacCommand getFullInfoRequestCommand(String senderUIN, String
     private static class CommandFactory
         implements SnacCmdFactory
     {
-        static final List SUPPORTED_TYPES =
+        static final List SUPPORTED_TYPES =
         DefensiveTools.asUnmodifiableList(new CmdType[]
                                           {new CmdType(21, 3)});
 
@@ -773,7 +773,7 @@ public SnacCommand genSnacCommand(SnacPacket packet)
             return new FullUserInfoCmd(packet);
         }
 
-        public List getSupportedTypes()
+        public List getSupportedTypes()
         {
             return SUPPORTED_TYPES;
         }