Fixes warnings

cusax-fix
Lyubomir Marinov 16 years ago
parent 4907e00a20
commit b917bbc4bd

@ -37,14 +37,11 @@ public class JabberAccountID
* @param accountProperties Map
* @return String
*/
private static String getServiceName(Map accountProperties)
private static String getServiceName(Map<String, String> accountProperties)
{
String serviceName =
(String)accountProperties.get(ProtocolProviderFactory.SERVER_ADDRESS);
String serviceName
= accountProperties.get(ProtocolProviderFactory.SERVER_ADDRESS);
if(serviceName != null)
return serviceName;
else
return "jabber.org";
return (serviceName != null) ? serviceName : "jabber.org";
}
}

@ -372,7 +372,8 @@ public void answerCallPeer(CallPeer peer)
public void shutdown()
{
logger.trace("Ending all active calls. ");
Iterator activeCalls = this.activeCallsRepository.getActiveCalls();
Iterator<CallJabberImpl> activeCalls
= this.activeCallsRepository.getActiveCalls();
// this is fast, but events aren't triggered ...
//jingleManager.disconnectAllSessions();
@ -380,15 +381,13 @@ public void shutdown()
//go through all active calls.
while(activeCalls.hasNext())
{
CallJabberImpl call = (CallJabberImpl) activeCalls.next();
Iterator callPeers = call.getCallPeers();
CallJabberImpl call = activeCalls.next();
Iterator<CallPeer> callPeers = call.getCallPeers();
//go through all call peers and say bye to every one.
while (callPeers.hasNext())
{
CallPeer peer
= (CallPeer) callPeers.next();
CallPeer peer = callPeers.next();
try
{
this.hangupCallPeer(peer);

@ -394,11 +394,11 @@ public void pageBack()
public void loadAccount(ProtocolProviderService protocolProvider)
{
AccountID accountID = protocolProvider.getAccountID();
Map<String, String> accountProperties
= accountID.getAccountProperties();
Map accountProperties = accountID.getAccountProperties();
String password = (String) accountProperties.get(
ProtocolProviderFactory.PASSWORD);
String password
= accountProperties.get(ProtocolProviderFactory.PASSWORD);
this.userIDField.setEnabled(false);
this.userIDField.setText(accountID.getUserID());
@ -409,29 +409,28 @@ public void loadAccount(ProtocolProviderService protocolProvider)
this.rememberPassBox.setSelected(true);
}
String serverAddress = (String) accountProperties
.get(ProtocolProviderFactory.SERVER_ADDRESS);
String serverAddress
= accountProperties.get(ProtocolProviderFactory.SERVER_ADDRESS);
serverField.setText(serverAddress);
String serverPort = (String) accountProperties
.get(ProtocolProviderFactory.SERVER_PORT);
String serverPort
= accountProperties.get(ProtocolProviderFactory.SERVER_PORT);
portField.setText(serverPort);
boolean keepAlive
= Boolean.parseBoolean(
(String) accountProperties.get("SEND_KEEP_ALIVE"));
= Boolean.parseBoolean(accountProperties.get("SEND_KEEP_ALIVE"));
sendKeepAliveBox.setSelected(keepAlive);
String resource = (String) accountProperties.get(
ProtocolProviderFactory.RESOURCE);
String resource
= accountProperties.get(ProtocolProviderFactory.RESOURCE);
resourceField.setText(resource);
String priority = (String) accountProperties.get(
ProtocolProviderFactory.RESOURCE_PRIORITY);
String priority
= accountProperties.get(ProtocolProviderFactory.RESOURCE_PRIORITY);
priorityField.setText(priority);

@ -124,10 +124,11 @@ public InitialAccountRegistrationFrame()
{
MetaContactListService contactList =
SimpleAccountRegistrationActivator.getContactList();
Iterator iter = contactList.getRoot().getSubgroups();
Iterator<MetaContactGroup> iter
= contactList.getRoot().getSubgroups();
while (iter.hasNext())
{
MetaContactGroup gr = (MetaContactGroup) iter.next();
MetaContactGroup gr = iter.next();
if (groupName.equals(gr.getGroupName()))
return;
}

@ -90,7 +90,7 @@ public void testGetContactCount()
*/
public void testGetContacts()
{
Iterator childContacts = metaContact.getContacts();
Iterator<Contact> childContacts = metaContact.getContacts();
assertNotNull("getContacts() returned a null iterator."
, childContacts);
@ -110,8 +110,8 @@ public void testGetContacts()
*/
public void testGetContactsForProvider()
{
Iterator childContacts = metaContact.getContactsForProvider(
fixture.mockProvider);
Iterator<Contact> childContacts
= metaContact.getContactsForProvider(fixture.mockProvider);
assertNotNull("getContactsForProvider() returned a null iterator."
, childContacts);
@ -124,7 +124,6 @@ public void testGetContactsForProvider()
+")did not contain the "
+"right mock contact"
, mockContact, childContacts.next());
}
/**
@ -184,23 +183,22 @@ public void verifyCompareToForAllContactsInGroupAndSubgroups(
MetaContactGroup group)
{
//first check order of contacts in this group
Iterator contacts = group.getChildContacts();
Iterator<MetaContact> contacts = group.getChildContacts();
MetaContact previousContact = null;
int previousContactIsOnlineStatus = 0;
while(contacts.hasNext())
{
MetaContact currentContact = (MetaContact)contacts.next();
MetaContact currentContact = contacts.next();
//calculate the total status for this contact
Iterator protoContacts = currentContact.getContacts();
Iterator<Contact> protoContacts = currentContact.getContacts();
int currentContactIsOnlineStatus = 0;
while(protoContacts.hasNext())
{
if (((Contact)protoContacts.next())
.getPresenceStatus().isOnline())
if (protoContacts.next().getPresenceStatus().isOnline())
{
currentContactIsOnlineStatus = 1;
}
@ -231,12 +229,12 @@ public void verifyCompareToForAllContactsInGroupAndSubgroups(
}
//now go over the subgroups
Iterator subgroups = group.getSubgroups();
Iterator<MetaContactGroup> subgroups = group.getSubgroups();
while(subgroups.hasNext())
{
verifyCompareToForAllContactsInGroupAndSubgroups(
(MetaContactGroup)subgroups.next());
subgroups.next());
}
}
@ -251,7 +249,7 @@ public void testDetails()
String detail_3 = "detail_3";
metaContact.addDetail(name, detail_1);
List ds = metaContact.getDetails(name);
List<String> ds = metaContact.getDetails(name);
assertTrue( "Must contain one detail",
1 == ds.size());
assertTrue("The result details does not contain the desired",

@ -214,11 +214,11 @@ public void testPartialContactListRestauration()
//verify that all contacts in the replacement provider are unresolved
//as otherwise this would mean that the meta contact list has not
//used the createUnresolvedContact() when creating them.
Iterator subgroups = newProtoRoot.subgroups();
Iterator<ContactGroup> subgroups = newProtoRoot.subgroups();
while(subgroups.hasNext())
{
assertUnresolvedContents( (MockContactGroup) subgroups.next() );
assertUnresolvedContents( subgroups.next() );
}
}
@ -273,19 +273,18 @@ public void testCompleteContactListRestauration()
//verify that all contacts in the replacement providers are unresolved
//as otherwise this would mean that the meta contact list has not
//used the createUnresolvedContact() when creating them.
Iterator subgroups = newProtoMockP1Root.subgroups();
Iterator<ContactGroup> subgroups = newProtoMockP1Root.subgroups();
while(subgroups.hasNext())
{
assertUnresolvedContents( (MockContactGroup) subgroups.next() );
assertUnresolvedContents( subgroups.next() );
}
subgroups = newProtoMockP2Root.subgroups();
while(subgroups.hasNext())
{
assertUnresolvedContents( (MockContactGroup) subgroups.next() );
assertUnresolvedContents( subgroups.next() );
}
}
@ -295,26 +294,26 @@ public void testCompleteContactListRestauration()
*
* @param root the contact group where the recursive assertion should begin
*/
private void assertUnresolvedContents(MockContactGroup root)
private void assertUnresolvedContents(ContactGroup root)
{
assertEquals("isResolved for grp:" + root.getGroupName()
, false, root.isResolved());
// verify all contacts
Iterator contacts = root.contacts();
Iterator<Contact> contacts = root.contacts();
while(contacts.hasNext())
{
Contact contact = (Contact)contacts.next();
Contact contact = contacts.next();
assertEquals("isResolved for contact:" + contact.getDisplayName()
, false, contact.isResolved());
}
//recurse all subgroups
Iterator subgroups = root.subgroups();
Iterator<ContactGroup> subgroups = root.subgroups();
while(subgroups.hasNext()){
assertUnresolvedContents((MockContactGroup)subgroups.next());
assertUnresolvedContents(subgroups.next());
}
}

@ -121,7 +121,8 @@ public void testRetrievingServerStoredContactList()
+ "rootGroup.childGroups="+rootGroup.countSubgroups()
+ "Printing rootGroupContents=\n"+rootGroup.toString());
Hashtable expectedContactList = fixture.preInstalledBuddyList;
Hashtable<String, List<String>> expectedContactList
= fixture.preInstalledBuddyList;
logger.debug("============== Expected Contact List ===================");
logger.debug(expectedContactList);
@ -129,13 +130,13 @@ public void testRetrievingServerStoredContactList()
//Go through the contact list retrieved by the persistence presence set
//and remove the name of every contact and group that we find there from
//the expected contct list hashtable.
Iterator groups = rootGroup.subgroups();
Iterator<ContactGroup> groups = rootGroup.subgroups();
while (groups.hasNext() )
{
ContactGroup group = (ContactGroup)groups.next();
ContactGroup group = groups.next();
List expectedContactsInGroup
= (List)expectedContactList.get(group.getGroupName());
List<String> expectedContactsInGroup
= expectedContactList.get(group.getGroupName());
// When sending the offline message
// the sever creates a group NotInContactList,
@ -150,11 +151,11 @@ public void testRetrievingServerStoredContactList()
"the server but was not in the expected contact list."
, expectedContactsInGroup);
Iterator contactsIter = group.contacts();
Iterator<Contact> contactsIter = group.contacts();
while(contactsIter.hasNext())
{
String contactID = ((Contact)contactsIter.next()).
getAddress();
String contactID = contactsIter.next().getAddress();
expectedContactsInGroup.remove(contactID);
}

@ -295,10 +295,8 @@ public void sentMessage(Conversation c, MessageInfo minfo){}
public void sendAutomaticallyFailed(
IcbmService service,
net.kano.joustsim.oscar.oscar.service.icbm.Message message,
Set triedConversations)
Set<Conversation> triedConversations)
{
}
}
}

@ -209,7 +209,7 @@ public void testCreateChatRoom()
public void testGetExistingChatRooms()
throws Exception
{
List existingChatRooms = opSetMultiChat1.getExistingChatRooms();
List<String> existingChatRooms = opSetMultiChat1.getExistingChatRooms();
assertTrue (
"No chat rooms found on the server, even after we "
@ -221,15 +221,9 @@ public void testGetExistingChatRooms()
boolean testRoomFound = false;
Iterator roomsIter = existingChatRooms.iterator();
while(roomsIter.hasNext())
{
String roomName = (String)roomsIter.next();
for (String roomName : existingChatRooms)
if (roomName.equals(fixture.chatRoomName))
testRoomFound = true;
}
assertTrue("The room we created in previous tests "
+fixture.chatRoomName

@ -207,9 +207,9 @@ public void prepareContactList()
}
// put the two accounts online
Iterator iter = opSetPresence1.getSupportedStatusSet();
Iterator<PresenceStatus> iter = opSetPresence1.getSupportedStatusSet();
while (iter.hasNext()) {
PresenceStatus stat = (PresenceStatus) iter.next();
PresenceStatus stat = iter.next();
if (stat.isOnline()) {
opSetPresence1.publishPresenceStatus(
stat, "online for testing purpose");
@ -219,7 +219,7 @@ public void prepareContactList()
iter = opSetPresence2.getSupportedStatusSet();
while (iter.hasNext()) {
PresenceStatus stat = (PresenceStatus) iter.next();
PresenceStatus stat = iter.next();
if (stat.isOnline()) {
opSetPresence2.publishPresenceStatus(
stat, "online for testing purpose");

Loading…
Cancel
Save