Fixes warnings, mostly ones related to raw-type uses.

cusax-fix
Lyubomir Marinov 16 years ago
parent 144a0baee3
commit a6c3303f88

@ -38,7 +38,7 @@ public class OperationSetPersistentPresenceYahooImpl
private String currentStatusMessage = ""; 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 * The initial one is OFFLINE
*/ */
private PresenceStatus currentStatus = YahooStatusEnum.OFFLINE; private PresenceStatus currentStatus = YahooStatusEnum.OFFLINE;
@ -47,7 +47,7 @@ public class OperationSetPersistentPresenceYahooImpl
* Sometimes status changes are received before the contact list is inited * Sometimes status changes are received before the contact list is inited
* here we store such events so we can show them correctly * 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() * The array list we use when returning from the getSupportedStatusSet()
@ -676,14 +676,11 @@ private void initContactStatuses()
{ {
YahooGroup[] groups = parentProvider.getYahooSession().getGroups(); YahooGroup[] groups = parentProvider.getYahooSession().getGroups();
for (int i = 0; i < groups.length; i++) for (YahooGroup item : groups)
{ {
YahooGroup item = groups[i]; Iterable<YahooUser> members = item.getMembers();
Iterator iter = item.getMembers().iterator(); for (YahooUser user : members)
while(iter.hasNext())
{ {
YahooUser user = (YahooUser)iter.next();
ContactYahooImpl sourceContact = ContactYahooImpl sourceContact =
ssContactList.findContactById(user.getId()); ssContactList.findContactById(user.getId());
@ -755,14 +752,12 @@ else if(evt.getNewState() == RegistrationState.UNREGISTERED
//offline. The protocol does not implement top level buddies //offline. The protocol does not implement top level buddies
//nor subgroups for top level groups so a simple nested loop //nor subgroups for top level groups so a simple nested loop
//would be enough. //would be enough.
Iterator groupsIter = Iterator<ContactGroup> groupsIter =
getServerStoredContactListRoot().subgroups(); getServerStoredContactListRoot().subgroups();
while(groupsIter.hasNext()) while(groupsIter.hasNext())
{ {
ContactGroupYahooImpl group ContactGroup group = groupsIter.next();
= (ContactGroupYahooImpl)groupsIter.next(); Iterator<Contact> contactsIter = group.contacts();
Iterator contactsIter = group.contacts();
while(contactsIter.hasNext()) while(contactsIter.hasNext())
{ {

@ -176,25 +176,6 @@ public String getPreReleaseID()
return PRE_RELEASE_ID; return PRE_RELEASE_ID;
} }
/**
* 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(Object version)
{
return compareTo((Version)version);
}
/** /**
* Compares another <tt>Version</tt> object to this one and returns a * Compares another <tt>Version</tt> object to this one and returns a
* negative, zero or a positive integer if this version instance represents * negative, zero or a positive integer if this version instance represents

@ -76,11 +76,11 @@ public String getDescription()
private void initResources( ResourceBundle resourceBundle, private void initResources( ResourceBundle resourceBundle,
Map<String, String> resources) Map<String, String> resources)
{ {
Enumeration colorKeys = resourceBundle.getKeys(); Enumeration<String> colorKeys = resourceBundle.getKeys();
while (colorKeys.hasMoreElements()) while (colorKeys.hasMoreElements())
{ {
String key = (String) colorKeys.nextElement(); String key = colorKeys.nextElement();
String value = resourceBundle.getString(key); String value = resourceBundle.getString(key);
resources.put(key, value); resources.put(key, value);

@ -76,11 +76,11 @@ public String getDescription()
private void initResources( ResourceBundle resourceBundle, private void initResources( ResourceBundle resourceBundle,
Map<String, String> resources) Map<String, String> resources)
{ {
Enumeration colorKeys = resourceBundle.getKeys(); Enumeration<String> colorKeys = resourceBundle.getKeys();
while (colorKeys.hasMoreElements()) while (colorKeys.hasMoreElements())
{ {
String key = (String) colorKeys.nextElement(); String key = colorKeys.nextElement();
String value = resourceBundle.getString(key); String value = resourceBundle.getString(key);
resources.put(key, value); resources.put(key, value);

@ -76,11 +76,11 @@ public String getDescription()
private void initResources( ResourceBundle resourceBundle, private void initResources( ResourceBundle resourceBundle,
Map<String, String> resources) Map<String, String> resources)
{ {
Enumeration colorKeys = resourceBundle.getKeys(); Enumeration<String> colorKeys = resourceBundle.getKeys();
while (colorKeys.hasMoreElements()) while (colorKeys.hasMoreElements())
{ {
String key = (String) colorKeys.nextElement(); String key = colorKeys.nextElement();
String value = resourceBundle.getString(key); String value = resourceBundle.getString(key);
resources.put(key, value); resources.put(key, value);

@ -10,9 +10,9 @@
import java.awt.geom.*; import java.awt.geom.*;
import java.awt.print.*; import java.awt.print.*;
import java.util.List; import java.util.List;
import java.util.concurrent.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.*;
import net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.*; import net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.*;
import net.java.sip.communicator.util.swing.*; import net.java.sip.communicator.util.swing.*;
@ -29,7 +29,7 @@ public class WhiteboardPanel
/** /**
* Shapes to display * Shapes to display
*/ */
private List displayList = new CopyOnWriteArrayList(); private final List<WhiteboardShape> displayList;
/** /**
* Default grid space * Default grid space
@ -46,7 +46,7 @@ public class WhiteboardPanel
/** /**
* Parent WhiteboardFrame * Parent WhiteboardFrame
*/ */
private WhiteboardFrame wf; private final WhiteboardFrame wf;
/** /**
* WhiteboardPanel constructor. * WhiteboardPanel constructor.
@ -54,9 +54,8 @@ public class WhiteboardPanel
* @param displayList Shapes to display * @param displayList Shapes to display
* @param wf WhiteboardFrame * @param wf WhiteboardFrame
*/ */
public WhiteboardPanel(List displayList, WhiteboardFrame wf) public WhiteboardPanel(List<WhiteboardShape> displayList, WhiteboardFrame wf)
{ {
super();
this.wf = wf; this.wf = wf;
this.displayList = displayList; this.displayList = displayList;
affineTrans = new AffineTransform(); affineTrans = new AffineTransform();
@ -109,12 +108,9 @@ public void paintComponent(Graphics g)
} }
} }
} }
WhiteboardShape s;
for (int i = 0; i < displayList.size(); i++) for (WhiteboardShape s : displayList)
{
s = (WhiteboardShape) displayList.get(i);
s.paint(g, affineTrans); s.paint(g, affineTrans);
}
} }
finally finally
{ {

@ -12,7 +12,7 @@
* *
* @author Emil Ivov * @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 * Returns the version major of the current SIP Communicator version. In an

@ -331,7 +331,7 @@ public void messageTests()
/** /**
* This matches all written messages, they are minimum 5 * This matches all written messages, they are minimum 5
*/ */
Collection rs = metaHistoryService.findByKeyword( Collection<Object> rs = metaHistoryService.findByKeyword(
new String[]{MessageHistoryService.class.getName()}, new String[]{MessageHistoryService.class.getName()},
testMetaContact, "test"); testMetaContact, "test");
@ -503,11 +503,11 @@ public void callTests()
* This must match also many calls, as tests are run many times * This must match also many calls, as tests are run many times
* but the minimum is 3 * but the minimum is 3
*/ */
Collection rs = metaHistoryService.findByEndDate( Collection<Object> rs = metaHistoryService.findByEndDate(
new String[]{CallHistoryService.class.getName()}, new String[]{CallHistoryService.class.getName()},
null, null,
controlDate2); controlDate2);
Iterator resultIter = getCalls(rs).iterator(); Iterator<?> resultIter = getCalls(rs).iterator();
assertTrue("Calls too few - findByEndDate", rs.size() >= 3); assertTrue("Calls too few - findByEndDate", rs.size() >= 3);
@ -779,7 +779,7 @@ public void fileTests()
public void metaTests() public void metaTests()
{ {
Collection rs = metaHistoryService.findByStartDate( Collection<Object> rs = metaHistoryService.findByStartDate(
new String[]{ new String[]{
MessageHistoryService.class.getName(), MessageHistoryService.class.getName(),
FileHistoryService.class.getName(), FileHistoryService.class.getName(),
@ -918,46 +918,43 @@ public void testPurgeLocalContactListCopy()
metaClService.purgeLocallyStoredContactListCopy(); metaClService.purgeLocallyStoredContactListCopy();
} }
private List<String> getMessages(Collection rs) private List<String> getMessages(Collection<Object> rs)
{ {
List<String> result = new Vector<String>(); 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) if(item instanceof MessageDeliveredEvent)
result.add(((MessageDeliveredEvent)item).getSourceMessage().getContent()); result.add(
((MessageDeliveredEvent)item)
.getSourceMessage().getContent());
else if(item instanceof MessageReceivedEvent) else if(item instanceof MessageReceivedEvent)
result.add(((MessageReceivedEvent)item).getSourceMessage().getContent()); result.add(
((MessageReceivedEvent)item)
.getSourceMessage().getContent());
} }
return result; return result;
} }
private List<CallRecord> getCalls(Collection rs) private List<CallRecord> getCalls(Collection<Object> rs)
{ {
List<CallRecord> result = new Vector<CallRecord>(); List<CallRecord> result = new Vector<CallRecord>();
Iterator iter = rs.iterator();
while (iter.hasNext()) for (Object item : rs)
{ if (item instanceof CallRecord)
Object item = iter.next();
if(item instanceof CallRecord)
result.add((CallRecord) item); result.add((CallRecord) item);
}
return result; return result;
} }
private Collection<FileRecord> getFileRecords(Collection rs) private Collection<FileRecord> getFileRecords(Collection<Object> rs)
{ {
List<FileRecord> result = new Vector<FileRecord>(); List<FileRecord> result = new Vector<FileRecord>();
Iterator iter = rs.iterator();
while (iter.hasNext()) for (Object item : rs)
{ if (item instanceof FileRecord)
Object item = iter.next();
if(item instanceof FileRecord)
result.add((FileRecord) item); result.add((FileRecord) item);
}
return result; return result;
} }

@ -8,17 +8,16 @@
import java.util.*; import java.util.*;
import org.osgi.framework.*;
import junit.framework.*; import junit.framework.*;
import net.java.sip.communicator.impl.protocol.mock.*; import net.java.sip.communicator.impl.protocol.mock.*;
import net.java.sip.communicator.service.contactlist.*; 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.msghistory.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/** /**
* Tests message history. * Tests message history.
* First installs the MoxkProtocolProvider to be able to send some messages * First installs the MoxkProtocolProvider to be able to send some messages
@ -241,7 +240,8 @@ public void readRecords()
/** /**
* This matches all written messages, they are minimum 5 * 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()); assertTrue("Nothing found findByKeyword ", !rs.isEmpty());
@ -254,7 +254,9 @@ public void readRecords()
*/ */
rs = msgHistoryService.findByKeyword(testMetaContact, "Test", false); 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); msgs = getMessages(rs);
@ -262,7 +264,9 @@ public void readRecords()
rs = msgHistoryService.findByKeyword(testMetaContact, "Test", true); 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 * This must match also many messages, as tests are run many times
@ -466,7 +470,8 @@ public void readRecordsFromMultiChat()
/** /**
* This matches all written messages, they are minimum 5 * 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()); assertTrue("Nothing found findByKeyword ", !rs.isEmpty());
@ -620,30 +625,31 @@ public void testPurgeLocalContactListCopy()
metaClService.purgeLocallyStoredContactListCopy(); metaClService.purgeLocallyStoredContactListCopy();
} }
private List<String> getMessages(Collection rs) private List<String> getMessages(Collection<EventObject> rs)
{ {
List<String> result = new Vector<String>(); 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) if(item instanceof MessageDeliveredEvent)
result.add(((MessageDeliveredEvent)item).getSourceMessage().getContent()); result.add(
else ((MessageDeliveredEvent)item)
if(item instanceof MessageReceivedEvent) .getSourceMessage().getContent());
result.add(((MessageReceivedEvent)item).getSourceMessage().getContent()); else if(item instanceof MessageReceivedEvent)
result.add(
((MessageReceivedEvent)item)
.getSourceMessage().getContent());
} }
return result; return result;
} }
private List<String> getChatMessages(Collection rs) private List<String> getChatMessages(Collection<EventObject> rs)
{ {
List<String> result = new Vector<String>(); 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) if(item instanceof ChatRoomMessageDeliveredEvent)
result.add(((ChatRoomMessageDeliveredEvent)item). result.add(((ChatRoomMessageDeliveredEvent)item).
getMessage().getContent()); getMessage().getContent());
@ -656,20 +662,19 @@ private List<String> getChatMessages(Collection rs)
return result; return result;
} }
// private void dumpResult(QueryResultSet rs)
private void dumpResult(QueryResultSet rs) // {
{ // while (rs.hasNext())
while (rs.hasNext()) // {
{ // HistoryRecord hr = (HistoryRecord)rs.next();
HistoryRecord hr = (HistoryRecord)rs.next(); // logger.info("----------------------");
logger.info("----------------------"); //
// for (int i = 0; i < hr.getPropertyNames().length; i++)
for (int i = 0; i < hr.getPropertyNames().length; i++) // {
{ // logger.info(hr.getPropertyNames()[i] + " => " + hr.getPropertyValues()[i]);
logger.info(hr.getPropertyNames()[i] + " => " + hr.getPropertyValues()[i]); // }
} //
// logger.info("----------------------");
logger.info("----------------------"); // }
} // }
}
} }

@ -92,15 +92,16 @@ protected void tearDown()
private static boolean isLocalInterfaceAddress(InetAddress address) private static boolean isLocalInterfaceAddress(InetAddress address)
{ {
try { try {
Enumeration intfs = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> intfs
= NetworkInterface.getNetworkInterfaces();
while (intfs.hasMoreElements()) while (intfs.hasMoreElements())
{ {
NetworkInterface intf = (NetworkInterface) intfs.nextElement(); NetworkInterface intf = intfs.nextElement();
Enumeration addrs = intf.getInetAddresses(); Enumeration<InetAddress> addrs = intf.getInetAddresses();
while (addrs.hasMoreElements()) while (addrs.hasMoreElements())
{ {
try { try {
InetAddress addr = (InetAddress) addrs.nextElement(); InetAddress addr = addrs.nextElement();
if(addr.equals(address)) if(addr.equals(address))
return true; return true;
} catch (Exception e) } catch (Exception e)
@ -610,6 +611,7 @@ private InetAddress getStunAddress()
return null; return null;
} }
private void initProperties() private void initProperties()
{ {
try try
@ -622,8 +624,4 @@ private void initProperties()
} }
catch(Exception ex){} catch(Exception ex){}
} }
} }

Loading…
Cancel
Save