aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java21
-rw-r--r--src/net/java/sip/communicator/impl/version/VersionImpl.java19
-rw-r--r--src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultImagePackImpl.java4
-rw-r--r--src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSettingsPackImpl.java4
-rw-r--r--src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSoundPackImpl.java4
-rw-r--r--src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java16
-rw-r--r--src/net/java/sip/communicator/service/version/Version.java2
-rw-r--r--test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java45
-rw-r--r--test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java75
-rw-r--r--test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java14
10 files changed, 88 insertions, 116 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
index 59d7c53..a75dc0b 100644
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
@@ -38,7 +38,7 @@ public class OperationSetPersistentPresenceYahooImpl
private String currentStatusMessage = "";
/**
- * The presence status that we were last notified of etnering.
+ * The presence status that we were last notified of entering.
* The initial one is OFFLINE
*/
private PresenceStatus currentStatus = YahooStatusEnum.OFFLINE;
@@ -47,7 +47,7 @@ public class OperationSetPersistentPresenceYahooImpl
* Sometimes status changes are received before the contact list is inited
* here we store such events so we can show them correctly
*/
- private Hashtable earlyStatusChange = new Hashtable();
+// private Hashtable earlyStatusChange = new Hashtable();
/**
* The array list we use when returning from the getSupportedStatusSet()
@@ -676,14 +676,11 @@ public class OperationSetPersistentPresenceYahooImpl
{
YahooGroup[] groups = parentProvider.getYahooSession().getGroups();
- for (int i = 0; i < groups.length; i++)
+ for (YahooGroup item : groups)
{
- YahooGroup item = groups[i];
- Iterator iter = item.getMembers().iterator();
- while(iter.hasNext())
+ Iterable<YahooUser> members = item.getMembers();
+ for (YahooUser user : members)
{
- YahooUser user = (YahooUser)iter.next();
-
ContactYahooImpl sourceContact =
ssContactList.findContactById(user.getId());
@@ -755,14 +752,12 @@ public class OperationSetPersistentPresenceYahooImpl
//offline. The protocol does not implement top level buddies
//nor subgroups for top level groups so a simple nested loop
//would be enough.
- Iterator groupsIter =
+ Iterator<ContactGroup> groupsIter =
getServerStoredContactListRoot().subgroups();
while(groupsIter.hasNext())
{
- ContactGroupYahooImpl group
- = (ContactGroupYahooImpl)groupsIter.next();
-
- Iterator contactsIter = group.contacts();
+ ContactGroup group = groupsIter.next();
+ Iterator<Contact> contactsIter = group.contacts();
while(contactsIter.hasNext())
{
diff --git a/src/net/java/sip/communicator/impl/version/VersionImpl.java b/src/net/java/sip/communicator/impl/version/VersionImpl.java
index 6a87dfc..e0f1026 100644
--- a/src/net/java/sip/communicator/impl/version/VersionImpl.java
+++ b/src/net/java/sip/communicator/impl/version/VersionImpl.java
@@ -189,25 +189,6 @@ public class VersionImpl
* represents a version that is earlier, same, or more recent than the one
* referenced by the <tt>version</tt> parameter.
*/
- public int compareTo(Object version)
- {
- return compareTo((Version)version);
- }
-
-
- /**
- * Compares another <tt>Version</tt> object to this one and returns a
- * negative, zero or a positive integer if this version instance represents
- * respectively an earlier, same, or later version as the one indicated
- * by the <tt>version</tt> parameter.
- *
- * @param version the <tt>Version</tt> instance that we'd like to compare
- * to this one.
- *
- * @return a negative integer, zero, or a positive integer as this object
- * represents a version that is earlier, same, or more recent than the one
- * referenced by the <tt>version</tt> parameter.
- */
public int compareTo(Version version)
{
//our versioning system is built to produce lexicographically ordered
diff --git a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultImagePackImpl.java b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultImagePackImpl.java
index cf47f92..4dea998 100644
--- a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultImagePackImpl.java
+++ b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultImagePackImpl.java
@@ -76,11 +76,11 @@ public class DefaultImagePackImpl
private void initResources( ResourceBundle resourceBundle,
Map<String, String> resources)
{
- Enumeration colorKeys = resourceBundle.getKeys();
+ Enumeration<String> colorKeys = resourceBundle.getKeys();
while (colorKeys.hasMoreElements())
{
- String key = (String) colorKeys.nextElement();
+ String key = colorKeys.nextElement();
String value = resourceBundle.getString(key);
resources.put(key, value);
diff --git a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSettingsPackImpl.java b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSettingsPackImpl.java
index 6b4ecf9..ae3e4ce 100644
--- a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSettingsPackImpl.java
+++ b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSettingsPackImpl.java
@@ -76,11 +76,11 @@ public class DefaultSettingsPackImpl
private void initResources( ResourceBundle resourceBundle,
Map<String, String> resources)
{
- Enumeration colorKeys = resourceBundle.getKeys();
+ Enumeration<String> colorKeys = resourceBundle.getKeys();
while (colorKeys.hasMoreElements())
{
- String key = (String) colorKeys.nextElement();
+ String key = colorKeys.nextElement();
String value = resourceBundle.getString(key);
resources.put(key, value);
diff --git a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSoundPackImpl.java b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSoundPackImpl.java
index 3c558f6..48b56e6 100644
--- a/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSoundPackImpl.java
+++ b/src/net/java/sip/communicator/plugin/defaultresourcepack/DefaultSoundPackImpl.java
@@ -76,11 +76,11 @@ public class DefaultSoundPackImpl
private void initResources( ResourceBundle resourceBundle,
Map<String, String> resources)
{
- Enumeration colorKeys = resourceBundle.getKeys();
+ Enumeration<String> colorKeys = resourceBundle.getKeys();
while (colorKeys.hasMoreElements())
{
- String key = (String) colorKeys.nextElement();
+ String key = colorKeys.nextElement();
String value = resourceBundle.getString(key);
resources.put(key, value);
diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java
index 3ec96e6..f8c0292 100644
--- a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java
+++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardPanel.java
@@ -10,9 +10,9 @@ import java.awt.event.*;
import java.awt.geom.*;
import java.awt.print.*;
import java.util.List;
-import java.util.concurrent.*;
import javax.swing.*;
+import javax.swing.plaf.*;
import net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.*;
import net.java.sip.communicator.util.swing.*;
@@ -29,7 +29,7 @@ public class WhiteboardPanel
/**
* Shapes to display
*/
- private List displayList = new CopyOnWriteArrayList();
+ private final List<WhiteboardShape> displayList;
/**
* Default grid space
@@ -46,7 +46,7 @@ public class WhiteboardPanel
/**
* Parent WhiteboardFrame
*/
- private WhiteboardFrame wf;
+ private final WhiteboardFrame wf;
/**
* WhiteboardPanel constructor.
@@ -54,9 +54,8 @@ public class WhiteboardPanel
* @param displayList Shapes to display
* @param wf WhiteboardFrame
*/
- public WhiteboardPanel(List displayList, WhiteboardFrame wf)
+ public WhiteboardPanel(List<WhiteboardShape> displayList, WhiteboardFrame wf)
{
- super();
this.wf = wf;
this.displayList = displayList;
affineTrans = new AffineTransform();
@@ -109,12 +108,9 @@ public class WhiteboardPanel
}
}
}
- WhiteboardShape s;
- for (int i = 0; i < displayList.size(); i++)
- {
- s = (WhiteboardShape) displayList.get(i);
+
+ for (WhiteboardShape s : displayList)
s.paint(g, affineTrans);
- }
}
finally
{
diff --git a/src/net/java/sip/communicator/service/version/Version.java b/src/net/java/sip/communicator/service/version/Version.java
index dee5735..13869be 100644
--- a/src/net/java/sip/communicator/service/version/Version.java
+++ b/src/net/java/sip/communicator/service/version/Version.java
@@ -12,7 +12,7 @@ package net.java.sip.communicator.service.version;
*
* @author Emil Ivov
*/
-public interface Version extends Comparable
+public interface Version extends Comparable<Version>
{
/**
* Returns the version major of the current SIP Communicator version. In an
diff --git a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java
index 641a859..a66a178 100644
--- a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java
+++ b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java
@@ -331,7 +331,7 @@ public class TestMetaHistoryService
/**
* This matches all written messages, they are minimum 5
*/
- Collection rs = metaHistoryService.findByKeyword(
+ Collection<Object> rs = metaHistoryService.findByKeyword(
new String[]{MessageHistoryService.class.getName()},
testMetaContact, "test");
@@ -503,11 +503,11 @@ public class TestMetaHistoryService
* This must match also many calls, as tests are run many times
* but the minimum is 3
*/
- Collection rs = metaHistoryService.findByEndDate(
+ Collection<Object> rs = metaHistoryService.findByEndDate(
new String[]{CallHistoryService.class.getName()},
null,
controlDate2);
- Iterator resultIter = getCalls(rs).iterator();
+ Iterator<?> resultIter = getCalls(rs).iterator();
assertTrue("Calls too few - findByEndDate", rs.size() >= 3);
@@ -779,7 +779,7 @@ public class TestMetaHistoryService
public void metaTests()
{
- Collection rs = metaHistoryService.findByStartDate(
+ Collection<Object> rs = metaHistoryService.findByStartDate(
new String[]{
MessageHistoryService.class.getName(),
FileHistoryService.class.getName(),
@@ -918,46 +918,43 @@ public class TestMetaHistoryService
metaClService.purgeLocallyStoredContactListCopy();
}
- private List<String> getMessages(Collection rs)
+ private List<String> getMessages(Collection<Object> rs)
{
List<String> result = new Vector<String>();
- Iterator iter = rs.iterator();
- while (iter.hasNext())
+
+ for (Object item : rs)
{
- Object item = iter.next();
if(item instanceof MessageDeliveredEvent)
- result.add(((MessageDeliveredEvent)item).getSourceMessage().getContent());
+ result.add(
+ ((MessageDeliveredEvent)item)
+ .getSourceMessage().getContent());
else if(item instanceof MessageReceivedEvent)
- result.add(((MessageReceivedEvent)item).getSourceMessage().getContent());
+ result.add(
+ ((MessageReceivedEvent)item)
+ .getSourceMessage().getContent());
}
return result;
}
- private List<CallRecord> getCalls(Collection rs)
+ private List<CallRecord> getCalls(Collection<Object> rs)
{
List<CallRecord> result = new Vector<CallRecord>();
- Iterator iter = rs.iterator();
- while (iter.hasNext())
- {
- Object item = iter.next();
- if(item instanceof CallRecord)
+
+ for (Object item : rs)
+ if (item instanceof CallRecord)
result.add((CallRecord) item);
- }
return result;
}
- private Collection<FileRecord> getFileRecords(Collection rs)
+ private Collection<FileRecord> getFileRecords(Collection<Object> rs)
{
List<FileRecord> result = new Vector<FileRecord>();
- Iterator iter = rs.iterator();
- while (iter.hasNext())
- {
- Object item = iter.next();
- if(item instanceof FileRecord)
+
+ for (Object item : rs)
+ if (item instanceof FileRecord)
result.add((FileRecord) item);
- }
return result;
}
diff --git a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java
index e23ffaf..342b479 100644
--- a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java
+++ b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java
@@ -8,17 +8,16 @@ package net.java.sip.communicator.slick.msghistory;
import java.util.*;
-import org.osgi.framework.*;
import junit.framework.*;
import net.java.sip.communicator.impl.protocol.mock.*;
import net.java.sip.communicator.service.contactlist.*;
-import net.java.sip.communicator.service.history.*;
-import net.java.sip.communicator.service.history.records.*;
import net.java.sip.communicator.service.msghistory.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
+import org.osgi.framework.*;
+
/**
* Tests message history.
* First installs the MoxkProtocolProvider to be able to send some messages
@@ -241,7 +240,8 @@ public class TestMsgHistoryService
/**
* This matches all written messages, they are minimum 5
*/
- Collection rs = msgHistoryService.findByKeyword(testMetaContact, "test");
+ Collection<EventObject> rs
+ = msgHistoryService.findByKeyword(testMetaContact, "test");
assertTrue("Nothing found findByKeyword ", !rs.isEmpty());
@@ -254,7 +254,9 @@ public class TestMsgHistoryService
*/
rs = msgHistoryService.findByKeyword(testMetaContact, "Test", false);
- assertTrue("Nothing found findByKeyword caseINsensitive search", !rs.isEmpty());
+ assertTrue(
+ "Nothing found findByKeyword caseINsensitive search",
+ !rs.isEmpty());
msgs = getMessages(rs);
@@ -262,7 +264,9 @@ public class TestMsgHistoryService
rs = msgHistoryService.findByKeyword(testMetaContact, "Test", true);
- assertFalse("Something found by findByKeyword casesensitive search", !rs.isEmpty());
+ assertFalse(
+ "Something found by findByKeyword casesensitive search",
+ !rs.isEmpty());
/**
* This must match also many messages, as tests are run many times
@@ -466,7 +470,8 @@ public class TestMsgHistoryService
/**
* This matches all written messages, they are minimum 5
*/
- Collection rs = msgHistoryService.findByKeyword(room, "test");
+ Collection<EventObject> rs
+ = msgHistoryService.findByKeyword(room, "test");
assertTrue("Nothing found findByKeyword ", !rs.isEmpty());
@@ -620,30 +625,31 @@ public class TestMsgHistoryService
metaClService.purgeLocallyStoredContactListCopy();
}
- private List<String> getMessages(Collection rs)
+ private List<String> getMessages(Collection<EventObject> rs)
{
List<String> result = new Vector<String>();
- Iterator iter = rs.iterator();
- while (iter.hasNext())
+
+ for (EventObject item : rs)
{
- Object item = iter.next();
if(item instanceof MessageDeliveredEvent)
- result.add(((MessageDeliveredEvent)item).getSourceMessage().getContent());
- else
- if(item instanceof MessageReceivedEvent)
- result.add(((MessageReceivedEvent)item).getSourceMessage().getContent());
+ result.add(
+ ((MessageDeliveredEvent)item)
+ .getSourceMessage().getContent());
+ else if(item instanceof MessageReceivedEvent)
+ result.add(
+ ((MessageReceivedEvent)item)
+ .getSourceMessage().getContent());
}
return result;
}
- private List<String> getChatMessages(Collection rs)
+ private List<String> getChatMessages(Collection<EventObject> rs)
{
List<String> result = new Vector<String>();
- Iterator iter = rs.iterator();
- while (iter.hasNext())
+
+ for (EventObject item : rs)
{
- Object item = iter.next();
if(item instanceof ChatRoomMessageDeliveredEvent)
result.add(((ChatRoomMessageDeliveredEvent)item).
getMessage().getContent());
@@ -656,20 +662,19 @@ public class TestMsgHistoryService
return result;
}
-
- private void dumpResult(QueryResultSet rs)
- {
- while (rs.hasNext())
- {
- HistoryRecord hr = (HistoryRecord)rs.next();
- logger.info("----------------------");
-
- for (int i = 0; i < hr.getPropertyNames().length; i++)
- {
- logger.info(hr.getPropertyNames()[i] + " => " + hr.getPropertyValues()[i]);
- }
-
- logger.info("----------------------");
- }
- }
+// private void dumpResult(QueryResultSet rs)
+// {
+// while (rs.hasNext())
+// {
+// HistoryRecord hr = (HistoryRecord)rs.next();
+// logger.info("----------------------");
+//
+// for (int i = 0; i < hr.getPropertyNames().length; i++)
+// {
+// logger.info(hr.getPropertyNames()[i] + " => " + hr.getPropertyValues()[i]);
+// }
+//
+// logger.info("----------------------");
+// }
+// }
}
diff --git a/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java b/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java
index 8ca6985..4ab0214 100644
--- a/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java
+++ b/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java
@@ -92,15 +92,16 @@ public class TestNetworkAddressManagerService extends TestCase {
private static boolean isLocalInterfaceAddress(InetAddress address)
{
try {
- Enumeration intfs = NetworkInterface.getNetworkInterfaces();
+ Enumeration<NetworkInterface> intfs
+ = NetworkInterface.getNetworkInterfaces();
while (intfs.hasMoreElements())
{
- NetworkInterface intf = (NetworkInterface) intfs.nextElement();
- Enumeration addrs = intf.getInetAddresses();
+ NetworkInterface intf = intfs.nextElement();
+ Enumeration<InetAddress> addrs = intf.getInetAddresses();
while (addrs.hasMoreElements())
{
try {
- InetAddress addr = (InetAddress) addrs.nextElement();
+ InetAddress addr = addrs.nextElement();
if(addr.equals(address))
return true;
} catch (Exception e)
@@ -610,6 +611,7 @@ public class TestNetworkAddressManagerService extends TestCase {
return null;
}
+
private void initProperties()
{
try
@@ -622,8 +624,4 @@ public class TestNetworkAddressManagerService extends TestCase {
}
catch(Exception ex){}
}
-
-
-
-
}