From c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Wed, 2 Sep 2009 10:40:06 +0000 Subject: [PATCH] Commits the second patch of Sebastien Vincent in the dev mailing list thread "Fix lot of warnings in the code" which fixes multiple compiler warnings. --- .../customcontrols/SIPCommSmartComboBox.java | 14 +- .../notification/NotificationServiceImpl.java | 34 +-- .../impl/protocol/icq/ChatRoomIcqImpl.java | 102 ++++----- .../impl/protocol/icq/InfoRetreiver.java | 4 +- ...tionSetServerStoredContactInfoIcqImpl.java | 2 +- .../impl/protocol/icq/VolatileGroup.java | 14 +- .../irc/OperationSetMultiUserChatIrcImpl.java | 16 +- .../VolatileContactGroupJabberImpl.java | 13 +- .../jabber/WhiteboardSessionJabberImpl.java | 86 ++++---- .../WhiteboardObjectPathJabberImpl.java | 32 +-- .../WhiteboardObjectPolyLineJabberImpl.java | 30 +-- .../WhiteboardObjectPolygonJabberImpl.java | 32 +-- .../protocol/rss/ContactGroupRssImpl.java | 21 +- ...rationSetBasicInstantMessagingRssImpl.java | 10 +- .../plugin/callhistoryform/CallListModel.java | 32 +-- .../NotificationConfigurationPanel.java | 52 ++--- .../whiteboard/WhiteboardActivator.java | 17 +- .../whiteboard/WhiteboardSessionManager.java | 17 +- .../whiteboard/gui/WhiteboardFrame.java | 44 ++-- .../WhiteboardShapeCircle.java | 20 +- .../WhiteboardShapeImage.java | 13 +- .../whiteboardshapes/WhiteboardShapeLine.java | 6 +- .../whiteboardshapes/WhiteboardShapePath.java | 63 +++--- .../WhiteboardShapePolyLine.java | 44 ++-- .../WhiteboardShapePolygon.java | 38 ++-- .../whiteboardshapes/WhiteboardShapeRect.java | 22 +- .../whiteboardshapes/WhiteboardShapeText.java | 6 +- .../notification/NotificationService.java | 3 +- .../service/protocol/WhiteboardSession.java | 7 +- .../WhiteboardObjectPath.java | 9 +- .../WhiteboardObjectPolyLine.java | 11 +- .../WhiteboardObjectPolygon.java | 9 +- .../callhistory/TestCallHistoryService.java | 16 +- .../metahistory/TestMetaHistoryService.java | 4 +- .../slick/protocol/icq/FullUserInfoCmd.java | 3 +- .../slick/protocol/icq/IcqTesterAgent.java | 203 +++++++----------- .../icq/TestOperationSetServerStoredInfo.java | 58 ++--- 37 files changed, 476 insertions(+), 631 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java index 8fe9b0e02..1a8d84c31 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java @@ -32,7 +32,7 @@ public class SIPCommSmartComboBox */ public SIPCommSmartComboBox() { - setModel(new FilterableComboBoxModel(new ArrayList())); + setModel(new FilterableComboBoxModel()); setEditor(new CallComboEditor()); setEditable(true); setFocusable(true); @@ -46,16 +46,16 @@ public static class FilterableComboBoxModel extends AbstractListModel implements MutableComboBoxModel { - - private List items; + private final List items; private Filter filter; - private List filteredItems; + private final List filteredItems; private Object selectedItem; - public FilterableComboBoxModel(List items) + public FilterableComboBoxModel() { - this.items = new ArrayList(items); - filteredItems = new ArrayList(items.size()); + this.items = new ArrayList(); + this.filteredItems = new ArrayList(this.items.size()); + updateFilteredItems(); } diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java index 7ffdb7bfa..7621940a4 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java @@ -288,24 +288,21 @@ public Iterator getRegisteredEvents() * an event with the specified name has occurred, or null if no actions * have been defined for eventType. */ - public Map getEventNotifications(String eventType) + public Map getEventNotifications(String eventType) { EventNotification notification = notificationsTable.get(eventType); if(notification == null) return null; - // TODO: cleanup mixed usage of different classes/objects in hashtable - // Cleanup together with NotificationService and NotificationConfigurationPanel - Hashtable actions = new Hashtable(); + Hashtable actions = new Hashtable(); for (Object value : notification.getActions().values()) { Action action = (Action) value; NotificationActionHandler handler = action.getActionHandler(); - actions.put(action.getActionType(), (handler == null) ? "" - : handler); + actions.put(action.getActionType(), handler); } return actions; @@ -1059,41 +1056,28 @@ else if (actionType.equals(NotificationService.ACTION_COMMAND)) */ public void restoreDefaults() { - Set eventTypes = - ((Hashtable) notificationsTable.clone()) - .keySet(); - - for (String eventType : eventTypes) + for (String eventType : new Vector(notificationsTable.keySet())) { EventNotification notification = notificationsTable.get(eventType); - Vector actionsToRemove = new Vector(notification.getActions().keySet()); - Iterator actionIter = actionsToRemove.iterator(); - while (actionIter.hasNext()) - { - String actionType = actionIter.next(); - + for (String actionType + : new Vector(notification.getActions().keySet())) removeEventNotificationAction(eventType, actionType); - } removeEventNotification(eventType); } - for (Map.Entry entry : defaultNotificationsTable.entrySet()) + for (Map.Entry entry + : defaultNotificationsTable.entrySet()) { String eventType = entry.getKey(); EventNotification notification = entry.getValue(); - Iterator actionIter = notification.getActions().keySet().iterator(); - while (actionIter.hasNext()) - { - String actionType = actionIter.next(); - + for (String actionType : notification.getActions().keySet()) registerNotificationForEvent( eventType, actionType, notification.getAction(actionType).getActionHandler()); - } } } } diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java index 3e85a4185..94d82339f 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ChatRoomIcqImpl.java @@ -20,7 +20,6 @@ * * @author Rupert Burchardi */ -@SuppressWarnings("unchecked") public class ChatRoomIcqImpl implements ChatRoom { private static final Logger logger = Logger @@ -30,45 +29,52 @@ public class ChatRoomIcqImpl 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 final List 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 final List 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 final List 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 final List 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 final List memberPropChangeListeners + = new Vector(); /** * Chat room invitation from the icq provider, needed for joining a * chat room. */ private ChatInvitation chatInvitation = null; + /** * Chat room session from the icq provider, we get this after joining a * chat room. @@ -79,7 +85,7 @@ public class ChatRoomIcqImpl implements ChatRoom /** * The list of members of this chat room. */ - private Hashtable members = new Hashtable(); + private Hashtable members = new Hashtable(); /** * The operation set that created us. @@ -90,12 +96,11 @@ public class ChatRoomIcqImpl implements ChatRoom * The protocol provider that created us */ private ProtocolProviderServiceIcqImpl provider = null; - /** * List with invitations. */ - private Hashtable inviteUserList = new Hashtable(); + private Hashtable inviteUserList = new Hashtable(); /** * Invitation message text. @@ -175,10 +180,10 @@ public ChatRoomIcqImpl(String roomName, ChatRoomSession chatRoomSession, */ public void addLocalUserRoleListener(ChatRoomLocalUserRoleListener listener) { - synchronized (propertyChangeListeners) + synchronized (localUserRoleListeners) { - if (!propertyChangeListeners.contains(listener)) - propertyChangeListeners.add(listener); + if (!localUserRoleListeners.contains(listener)) + localUserRoleListeners.add(listener); } } @@ -218,7 +223,7 @@ public void addMemberPropertyChangeListener( /** * Adds a listener that will be notified of changes of a member role in the - * room such as being granded operator. + * room such as being granted operator. * * @param listener a member role listener. */ @@ -310,17 +315,18 @@ public Message createMessage(byte[] content, String contentType, */ public Message createMessage(String messageText) { - Message msg = new MessageIcqImpl(messageText, - OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE, - OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING, null); - - return msg; + return + new MessageIcqImpl( + messageText, + OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE, + OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING, + null); } /** * Returns the list of banned users. */ - public Iterator getBanList() throws OperationFailedException + public Iterator getBanList() throws OperationFailedException { throw new OperationFailedException( "This operation cannot be performed in the ICQ network.", @@ -363,9 +369,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()); } /** @@ -522,7 +528,7 @@ public void join(byte[] password) throws OperationFailedException public void joinAs(String nickname, byte[] password) throws OperationFailedException { - + // TODO Auto-generated method stub } /** @@ -592,18 +598,11 @@ public void leave() chatRoomSession = null; } - Iterator membersSet = members.entrySet().iterator(); - - while (membersSet.hasNext()) - { - Map.Entry memberEntry = (Map.Entry) membersSet.next(); - - ChatRoomMember member = (ChatRoomMember) memberEntry.getValue(); - - fireMemberPresenceEvent(member, - ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, - "Local user has left the chat room."); - } + for (ChatRoomMember member : members.values()) + fireMemberPresenceEvent( + member, + ChatRoomMemberPresenceChangeEvent.MEMBER_LEFT, + "Local user has left the chat room."); // Delete the list of members members.clear(); @@ -777,17 +776,14 @@ public void setUserNickname(String nickname) */ public void fireMessageEvent(EventObject evt) { - Iterator listeners = null; + Iterable listeners; synchronized (messageListeners) { - listeners = new ArrayList(messageListeners).iterator(); + listeners = new ArrayList(messageListeners); } - while (listeners.hasNext()) + for (ChatRoomMessageListener listener : listeners) { - ChatRoomMessageListener listener - = (ChatRoomMessageListener) listeners.next(); - if (evt instanceof ChatRoomMessageDeliveredEvent) { listener.messageDelivered((ChatRoomMessageDeliveredEvent) evt); @@ -824,19 +820,15 @@ private void fireMemberPresenceEvent(ChatRoomMember member, String eventID, logger.trace("Will dispatch the following ChatRoom event: " + evt); - Iterator listeners = null; + Iterable listeners; synchronized (memberListeners) { - listeners = new ArrayList(memberListeners).iterator(); + listeners + = new ArrayList(memberListeners); } - while (listeners.hasNext()) - { - ChatRoomMemberPresenceListener listener - = (ChatRoomMemberPresenceListener) listeners.next(); - + for (ChatRoomMemberPresenceListener listener : listeners) listener.memberPresenceChanged(evt); - } } /** @@ -844,14 +836,13 @@ private void fireMemberPresenceEvent(ChatRoomMember member, String eventID, * users that leave or join the chat room. * */ - - private class ChatRoomSessionListenerImpl implements - ChatRoomSessionListener + private class ChatRoomSessionListenerImpl + implements ChatRoomSessionListener { /** * The chat room this listener is for. */ - private ChatRoomIcqImpl chatRoom = null; + private final ChatRoomIcqImpl chatRoom; /** * Constructor for this listener, needed to set the chatRoom. @@ -987,11 +978,8 @@ public void handleUsersLeft(ChatRoomSession chatRoomSession, private void updateMemberList( Set chatRoomUserSet, boolean removeMember) { - Iterator it = chatRoomUserSet.iterator(); - - while (it.hasNext()) + for (ChatRoomUser user : chatRoomUserSet) { - ChatRoomUser user = (ChatRoomUser) it.next(); String uid = user.getScreenname().getFormatted(); //we want to add a member and he/she is not in our member list diff --git a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java index 46994dca9..da5b19a85 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/InfoRetreiver.java @@ -151,7 +151,7 @@ protected List getContactDetails(String uin) */ private class UserInfoResponseRetriever extends SnacRequestAdapter { - int requestID; + private final int requestID; List result = null; UserInfoResponseRetriever(int requestID) @@ -588,6 +588,6 @@ private void readInterestsUserInfo(MetaInterestsInfoCmd cmd) */ private void readAffilationsUserInfo(MetaAffiliationsInfoCmd cmd) { -// Vector infoData = getInfoForRequest(cmd.getId()); +// Vector infoData = getInfoForRequest(cmd.getId()); } } diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java index b1770317c..38d7c8855 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetServerStoredContactInfoIcqImpl.java @@ -126,4 +126,4 @@ private void assertConnected() throws IllegalStateException "The icq provider must be signed on the ICQ service before " +"being able to communicate."); } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java b/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java index 9b2ea0e0d..a8df0832f 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/VolatileGroup.java @@ -17,9 +17,12 @@ class VolatileGroup implements MutableGroup { - private String groupName = new String("NotInContactList"); + private final String groupName; - VolatileGroup(){} + VolatileGroup() + { + this("NotInContactList"); + } VolatileGroup(String groupName) { @@ -38,12 +41,11 @@ public String getName() public void addGroupListener(GroupListener listener){} - public List getBuddiesCopy(){return null;} + public List getBuddiesCopy(){return null;} public void removeGroupListener(GroupListener listener){} - public void copyBuddies(List buddies){} - public void deleteBuddies(List ingroup){} + public void deleteBuddies(List ingroup){} public void addBuddy(String screenname){} - public void copyBuddies(Collection buddies){} + public void copyBuddies(Collection buddies){} public void deleteBuddy(Buddy buddy){} public void rename(String newName){} } diff --git a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java index 490861fda..baba58e21 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/OperationSetMultiUserChatIrcImpl.java @@ -10,7 +10,6 @@ import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; -import net.java.sip.communicator.util.*; /** * Allows creating, configuring, joining and administering of individual @@ -24,9 +23,6 @@ public class OperationSetMultiUserChatIrcImpl extends AbstractOperationSetMultiUserChat { - private static final Logger logger - = Logger.getLogger(OperationSetMultiUserChatIrcImpl.class); - /** * A call back to the IRC provider that created us. */ @@ -90,18 +86,18 @@ public List getExistingChatRooms() throws OperationFailedException * @return a List of the rooms where the user has joined using a * given connection. */ - public List getCurrentlyJoinedChatRooms() + public List getCurrentlyJoinedChatRooms() { synchronized(chatRoomCache) { - List joinedRooms - = new LinkedList(this.chatRoomCache.values()); + List joinedRooms + = new LinkedList(this.chatRoomCache.values()); - Iterator joinedRoomsIter = joinedRooms.iterator(); + Iterator joinedRoomsIter = joinedRooms.iterator(); while (joinedRoomsIter.hasNext()) { - if ( !( (ChatRoom) joinedRoomsIter.next()).isJoined()) + if (!joinedRoomsIter.next().isJoined()) joinedRoomsIter.remove(); } @@ -118,7 +114,7 @@ public List getCurrentlyJoinedChatRooms() * @return a list of the chat rooms that chatRoomMember has joined * and is currently active in. */ - public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) + public List getCurrentlyJoinedChatRooms(ChatRoomMember chatRoomMember) { //TODO: Implement "who is" for the IRC stack. return null; diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java index 3795e2f17..53128177d 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/VolatileContactGroupJabberImpl.java @@ -8,6 +8,10 @@ import java.util.*; +import net.java.sip.communicator.service.protocol.*; + +import org.jivesoftware.smack.*; + /** * The Jabber implementation of the Volatile ContactGroup interface. * @@ -19,7 +23,7 @@ public class VolatileContactGroupJabberImpl /** * This contact group name */ - private String contactGroupName = null; + private final String contactGroupName; /** * Creates an Jabber group using the specified group name @@ -31,7 +35,8 @@ public class VolatileContactGroupJabberImpl String groupName, ServerStoredContactListJabberImpl ssclCallback) { - super(null, new Vector().iterator(), ssclCallback, false); + super(null, new Vector().iterator(), ssclCallback, false); + this.contactGroupName = groupName; } @@ -55,10 +60,10 @@ public String toString() buff.append(getGroupName()); buff.append(", childContacts="+countContacts()+":["); - Iterator contacts = contacts(); + Iterator contacts = contacts(); while (contacts.hasNext()) { - ContactJabberImpl contact = (ContactJabberImpl) contacts.next(); + Contact contact = contacts.next(); buff.append(contact.toString()); if(contacts.hasNext()) buff.append(", "); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java index bbc2d2046..2698b2992 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/WhiteboardSessionJabberImpl.java @@ -37,12 +37,14 @@ public class WhiteboardSessionJabberImpl /** * A list of listeners registered for message events. */ - private Vector messageListeners = new Vector(); + private Vector messageListeners + = new Vector(); /** * A list containing all WhiteboardParticipants of this session. */ - private Hashtable wbParticipants = new Hashtable(); + private Hashtable wbParticipants + = new Hashtable(); /** * The state that this white-board is currently in. @@ -64,13 +66,14 @@ public class WhiteboardSessionJabberImpl * A list of all listeners currently registered for * WhiteboardChangeEvents */ - private Vector whiteboardListeners = new Vector(); + private Vector whiteboardListeners + = new Vector(); /** * Stores all white board objects contained in this session. */ - private final Vector whiteboardObjects - = new Vector(); + private final Vector whiteboardObjects + = new Vector(); /** * The OperationSet charged with the whiteboarding. @@ -107,9 +110,11 @@ public WhiteboardSessionJabberImpl( * @return an Iterator over all participants currently involved in the * white-board. */ - public Iterator getWhiteboardParticipants() + public Iterator getWhiteboardParticipants() { - return new LinkedList(wbParticipants.values()).iterator(); + return + new LinkedList(wbParticipants.values()) + .iterator(); } /** @@ -279,10 +284,9 @@ public WhiteboardSession getWhiteboardSession() */ public void participantStateChanged(WhiteboardParticipantChangeEvent evt) { - if (((WhiteboardParticipantState) evt.getNewValue()) - == WhiteboardParticipantState.DISCONNECTED - || ((WhiteboardParticipantState) evt.getNewValue()) - == WhiteboardParticipantState.FAILED) + Object newValue = evt.getNewValue(); + if ((newValue== WhiteboardParticipantState.DISCONNECTED) + || (newValue == WhiteboardParticipantState.FAILED)) { removeWhiteboardParticipant((WhiteboardParticipantJabberImpl) evt .getSourceWhiteboardParticipant()); @@ -564,13 +568,13 @@ public void moveWhiteboardObject(WhiteboardObject obj) public void deleteWhiteboardObject(WhiteboardObject obj) throws OperationFailedException { - Iterator participants = getWhiteboardParticipants(); + Iterator participants + = getWhiteboardParticipants(); if (!participants.hasNext()) return; WhiteboardParticipantJabberImpl participant = (WhiteboardParticipantJabberImpl) participants.next(); - Contact contact = participant.getContact(); try @@ -601,7 +605,7 @@ public void deleteWhiteboardObject(WhiteboardObject obj) int i = 0; while (i < whiteboardObjects.size()) { - WhiteboardObjectJabberImpl wbObj = whiteboardObjects.get(i); + WhiteboardObjectJabberImpl wbObj = (WhiteboardObjectJabberImpl)whiteboardObjects.get(i); if (wbObj.getID().equals(obj.getID())) whiteboardObjects.remove(i); else @@ -629,14 +633,14 @@ public void deleteWhiteboardObject(WhiteboardObject obj) public void sendWhiteboardObject(WhiteboardObject message) throws OperationFailedException { - Iterator participants = getWhiteboardParticipants(); + Iterator participants + = getWhiteboardParticipants(); if (!participants.hasNext()) return; WhiteboardParticipantJabberImpl participant = (WhiteboardParticipantJabberImpl) participants.next(); - Contact contact = participant.getContact(); try @@ -786,7 +790,6 @@ public ProtocolProviderService getProtocolProvider() public void fireWhiteboardParticipantEvent( WhiteboardParticipant sourceWhiteboardParticipant, int eventID) { - WhiteboardParticipantEvent cpEvent = new WhiteboardParticipantEvent(this, sourceWhiteboardParticipant, eventID); @@ -795,17 +798,15 @@ public void fireWhiteboardParticipantEvent( + whiteboardListeners.size() + " listeners. event is: " + cpEvent.toString()); - Iterator listeners = null; + Iterable listeners; synchronized (whiteboardListeners) { - listeners = new ArrayList(whiteboardListeners).iterator(); + listeners + = new ArrayList(whiteboardListeners); } - while (listeners.hasNext()) + for (WhiteboardChangeListener listener : listeners) { - WhiteboardChangeListener listener = - (WhiteboardChangeListener) listeners.next(); - if (eventID == WhiteboardParticipantEvent .WHITEBOARD_PARTICIPANT_ADDED) @@ -818,7 +819,6 @@ else if (eventID { listener.whiteboardParticipantRemoved(cpEvent); } - } } @@ -844,17 +844,15 @@ public void fireWhiteboardChangeEvent(String type, Object oldValue, + whiteboardListeners.size() + " listeners. event is: " + ccEvent.toString()); - Iterator listeners = null; + Iterable listeners; synchronized (whiteboardListeners) { - listeners = new ArrayList(whiteboardListeners).iterator(); + listeners + = new ArrayList(whiteboardListeners); } - while (listeners.hasNext()) + for (WhiteboardChangeListener listener : listeners) { - WhiteboardChangeListener listener = - (WhiteboardChangeListener) listeners.next(); - if (type.equals(WhiteboardChangeEvent.WHITEBOARD_STATE_CHANGE)) listener.whiteboardStateChanged(ccEvent); } @@ -865,7 +863,7 @@ public void fireWhiteboardChangeEvent(String type, Object oldValue, * @return an Vector of WhiteboardObjects associated * with this whiteboard. */ - public Vector getWhiteboardObjects() + public Vector getWhiteboardObjects() { return whiteboardObjects; } @@ -903,17 +901,15 @@ public void fireMessageEvent(EventObject evt) + messageListeners.size() + " listeners. event is: " + evt.toString()); - Iterator listeners = null; + Iterable listeners; synchronized (messageListeners) { - listeners = new ArrayList(messageListeners).iterator(); + listeners + = new ArrayList(messageListeners); } - while (listeners.hasNext()) + for (WhiteboardObjectListener listener : listeners) { - WhiteboardObjectListener listener = - (WhiteboardObjectListener) listeners.next(); - if (evt instanceof WhiteboardObjectDeliveredEvent) { listener.whiteboardObjectDelivered( @@ -940,7 +936,7 @@ else if (evt instanceof WhiteboardObjectDeletedEvent) int i = 0; while (i < whiteboardObjects.size()) { - WhiteboardObjectJabberImpl wbObj = whiteboardObjects.get(i); + WhiteboardObjectJabberImpl wbObj = (WhiteboardObjectJabberImpl)whiteboardObjects.get(i); if (wbObj.getID().equals(wbObjID)) whiteboardObjects.remove(i); else @@ -975,7 +971,7 @@ private WhiteboardObject updateWhiteboardObjects(WhiteboardObject ws) int i = 0; while (i < whiteboardObjects.size()) { - WhiteboardObjectJabberImpl wbObjTmp = whiteboardObjects.get(i); + WhiteboardObjectJabberImpl wbObjTmp = (WhiteboardObjectJabberImpl)whiteboardObjects.get(i); if (wbObjTmp.getID().equals(ws.getID())) { wbObj = wbObjTmp; @@ -1259,17 +1255,9 @@ public boolean isParticipantContained(String participantName) private WhiteboardParticipant findWhiteboardParticipantFromContactAddress( String contactAddress) { - Enumeration participants = wbParticipants.elements(); - - while(participants.hasMoreElements()) - { - WhiteboardParticipant participant - = (WhiteboardParticipant) participants.nextElement(); - + for (WhiteboardParticipant participant : wbParticipants.values()) if (participant.getContactAddress().equals(contactAddress)) return participant; - } - return null; } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java index a943a40d4..f715378cc 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPathJabberImpl.java @@ -4,20 +4,21 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; -import net.java.sip.communicator.util.*; -import java.awt.Color; +import java.awt.*; import java.io.*; -import java.util.LinkedList; +import java.util.*; import java.util.List; import java.util.regex.*; + import javax.xml.parsers.*; -import org.w3c.dom.*; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; +import net.java.sip.communicator.util.*; + +import org.w3c.dom.*; /** * WhiteboardObjectPathJabberImpl @@ -38,7 +39,8 @@ public class WhiteboardObjectPathJabberImpl /** * List of WhiteboardPoint */ - private LinkedList listPoints = new LinkedList (); + private List listPoints + = new LinkedList(); /** * Default WhiteboardObjectPathJabberImpl constructor. @@ -101,9 +103,9 @@ public WhiteboardObjectPathJabberImpl (String xml) * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points) + public void setPoints (List points) { - this.listPoints = new LinkedList (points); + this.listPoints = new LinkedList(points); } /** @@ -112,7 +114,7 @@ public void setPoints (List points) * * @return the list of WhiteboardPoints composing this object. */ - public List getPoints () + public List getPoints () { return this.listPoints; } @@ -125,9 +127,9 @@ public List getPoints () * of WhiteboardPoint. * @return a LinkedList (WhiteboardPoint) of the String points parameter */ - private List getPathPoints (String points) + private List getPathPoints (String points) { - List list = new LinkedList (); + List list = new LinkedList(); if (points == null) { return list; @@ -149,7 +151,7 @@ private List getPathPoints (String points) } /** - * Returns the XML reppresentation of the PacketExtension. + * Returns the XML representation of the PacketExtension. * * @return the packet extension as XML. * @todo Implement this org.jivesoftware.smack.packet.PacketExtension @@ -169,7 +171,7 @@ public String toXML () int size = listPoints.size (); for (int i = 0; i < size; i++) { - WhiteboardPoint point = (WhiteboardPoint) listPoints.get (i); + WhiteboardPoint point = listPoints.get (i); sb.append ((i == 0) ? "M" : "L"); sb.append (point.getX ()); sb.append (" "); @@ -179,4 +181,4 @@ public String toXML () s = s.replaceAll ("#p", sb.toString ()); return s; } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java index d29feae98..cba8dae51 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolyLineJabberImpl.java @@ -4,17 +4,20 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard; -import net.java.sip.communicator.util.*; -import java.awt.Color; +import java.awt.*; import java.io.*; import java.util.*; +import java.util.List; + import javax.xml.parsers.*; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; -import org.w3c.dom.*; + +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; +import net.java.sip.communicator.util.*; + +import org.w3c.dom.*; /** * WhiteboardObjectPolyLineJabberImpl @@ -35,7 +38,8 @@ public class WhiteboardObjectPolyLineJabberImpl /** * list of WhiteboardPoint */ - private LinkedList listPoints = new LinkedList (); + private List listPoints + = new LinkedList(); /** * Default WhiteboardObjectPolyLineJabberImpl constructor. @@ -99,9 +103,9 @@ public WhiteboardObjectPolyLineJabberImpl (String xml) * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points) + public void setPoints (List points) { - this.listPoints = new LinkedList (points); + this.listPoints = new LinkedList(points); } /** @@ -110,7 +114,7 @@ public void setPoints (List points) * * @return the list of WhiteboardPoints composing this object. */ - public List getPoints () + public List getPoints () { return this.listPoints; } @@ -124,9 +128,9 @@ public List getPoints () * * @return a List of the String points parameter */ - private List getPolyPoints (String points) + private List getPolyPoints (String points) { - List list = new LinkedList (); + List list = new LinkedList(); if (points == null) { return list; @@ -167,7 +171,7 @@ public String toXML () for (int i = 0; i < listPoints.size (); i++) { - WhiteboardPoint point = (WhiteboardPoint) listPoints.get (i); + WhiteboardPoint point = listPoints.get (i); sb.append (point.getX ()); sb.append (","); sb.append (point.getY ()); @@ -176,4 +180,4 @@ public String toXML () s = s.replaceAll ("#p", sb.toString ()); return s; } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java index 0f94550e9..7ea722da0 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/whiteboard/WhiteboardObjectPolygonJabberImpl.java @@ -4,17 +4,20 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.impl.protocol.jabber.extensions.whiteboard; -import net.java.sip.communicator.util.*; -import java.awt.Color; +import java.awt.*; import java.io.*; import java.util.*; +import java.util.List; + import javax.xml.parsers.*; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; -import org.w3c.dom.*; + +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; +import net.java.sip.communicator.util.*; + +import org.w3c.dom.*; /** * WhiteboardObjectPolygonJabberImpl @@ -35,7 +38,8 @@ public class WhiteboardObjectPolygonJabberImpl /** * list of WhiteboardPoint */ - private LinkedList listPoints = new LinkedList (); + private List listPoints + = new LinkedList(); /** * True is filled, false is unfilled. @@ -110,9 +114,9 @@ public WhiteboardObjectPolygonJabberImpl (String xml) * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points) + public void setPoints (List points) { - this.listPoints = new LinkedList (points); + this.listPoints = new LinkedList(points); } /** @@ -121,7 +125,7 @@ public void setPoints (List points) * * @return the list of WhiteboardPoints composing this object. */ - public List getPoints () + public List getPoints () { return this.listPoints; } @@ -134,9 +138,9 @@ public List getPoints () * List of WhiteboardPoint. * @return a List of the String points parameter */ - private List getPolyPoints (String points) + private List getPolyPoints (String points) { - List list = new LinkedList (); + List list = new LinkedList(); if (points == null) { return list; @@ -204,7 +208,7 @@ public int getBackgroundColor () } /** - * Returns the XML reppresentation of the PacketExtension. + * Returns the XML representation of the PacketExtension. * * @return the packet extension as XML. * @todo Implement this org.jivesoftware.smack.packet.PacketExtension @@ -223,7 +227,7 @@ public String toXML () for (int i = 0; i < listPoints.size (); i++) { - WhiteboardPoint point = (WhiteboardPoint) listPoints.get (i); + WhiteboardPoint point = listPoints.get (i); sb.append (point.getX ()); sb.append (","); sb.append (point.getY ()); @@ -232,4 +236,4 @@ public String toXML () s = s.replaceAll ("#p", sb.toString ()); return s; } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java index 51021f035..ecf6015a8 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ContactGroupRssImpl.java @@ -413,34 +413,21 @@ public String toString() return buff.append("]").toString(); } - public Vector getRssURLList(Vector rssURLList){ - //private Vector rssURLList; - //StringBuffer buff = new StringBuffer(getGroupName()); - //buff.append(".subGroups=" + countSubgroups() + ":\n"); - + public void getRssURLList(List rssURLList) + { Iterator subGroups = subgroups(); while (subGroups.hasNext()) { ContactGroupRssImpl group = (ContactGroupRssImpl)subGroups.next(); - //buff.append( - group.getRssURLList(rssURLList); - // if (subGroups.hasNext()) - // buff.append("\n"); + group.getRssURLList(rssURLList); } - //buff.append("\nChildContacts="+countContacts()+":["); - Iterator contacts = contacts(); while (contacts.hasNext()) { ContactRssImpl contact = (ContactRssImpl) contacts.next(); - //buff.append(contact.getDisplayName()); - rssURLList.addElement(contact); - //if(contacts.hasNext()) - // buff.append(", "); + rssURLList.add(contact); } - //return buff.append("]").toString(); - return rssURLList; } /** diff --git a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java index 2585fc335..9b4bce514 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java @@ -203,13 +203,11 @@ else if(userRequestedUpdate) */ public void refreshAllRssFeeds() { - Vector rssContactList = new Vector(); - rssContactList = opSetPersPresence.getContactListRoot(). - getRssURLList(rssContactList); - Iterator rssContact = rssContactList.iterator(); - while(rssContact.hasNext()) + Vector rssContactList = new Vector(); + opSetPersPresence.getContactListRoot().getRssURLList(rssContactList); + + for (ContactRssImpl contact : rssContactList) { - ContactRssImpl contact = (ContactRssImpl)rssContact.next(); try { submitRssQuery(contact, false); diff --git a/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java b/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java index de522cab7..bb775b8bb 100644 --- a/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java +++ b/src/net/java/sip/communicator/plugin/callhistoryform/CallListModel.java @@ -17,9 +17,9 @@ */ public class CallListModel extends AbstractListModel { - private LinkedList callList = new LinkedList(); + private final LinkedList callList = new LinkedList(); - private Hashtable closedDates = new Hashtable(); + private final Map closedDates = new Hashtable(); /** * Closes the given date by hiding all containing calls. @@ -31,7 +31,7 @@ public void closeDate(Object date) int startIndex = this.indexOf(date); int endIndex = startIndex; int currentSize = getSize(); - Collection c = new ArrayList(); + Collection c = new ArrayList(); for(int i = startIndex + 1; i < currentSize; i ++) { Object o = this.getElementAt(i); @@ -57,19 +57,22 @@ public void openDate(Object date) { int startIndex = this.indexOf(date); int endIndex = startIndex; - Hashtable closedDatesCopy = (Hashtable)closedDates.clone(); - - if(closedDatesCopy.containsValue(date)) { - Iterator dates = closedDatesCopy.entrySet().iterator(); + + if (closedDates.containsValue(date)) + { + Iterator> dates + = closedDates.entrySet().iterator(); - while(dates.hasNext()) { - Map.Entry entry = (Map.Entry)dates.next(); + while (dates.hasNext()) + { + Map.Entry entry = dates.next(); Object callRecord = entry.getKey(); Object callDate = entry.getValue(); - if(callDate.equals(date)) { + if (callDate.equals(date)) + { endIndex++; - closedDates.remove(callRecord); + dates.remove(); this.addElement(endIndex, callRecord); } } @@ -84,10 +87,7 @@ public void openDate(Object date) * @return True if the date is closed, false - otherwise. */ public boolean isDateClosed(Object date) { - if (this.closedDates.containsValue(date)) - return true; - else - return false; + return this.closedDates.containsValue(date); } public int getSize() @@ -128,7 +128,7 @@ public void removeElement(Object item) } } - public void removeAll(Collection c) + public void removeAll(Collection c) { synchronized (callList) { callList.removeAll(c); diff --git a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java index a094cb63a..87c97af8e 100644 --- a/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/notificationconfiguration/NotificationConfigurationPanel.java @@ -613,7 +613,7 @@ else if(e.getSource() == apply) { notificationService.registerNotificationForEvent( tmpNTE.getEvent(), - notificationService.ACTION_SOUND, + NotificationService.ACTION_SOUND, tmpNTE.getSoundFile(), ""); logger.debug("Adding Sound"); @@ -622,7 +622,7 @@ else if(e.getSource() == apply) { notificationService.removeEventNotificationAction( tmpNTE.getEvent(), - notificationService.ACTION_SOUND); + NotificationService.ACTION_SOUND); logger.debug("Deleting Sound"); } @@ -630,7 +630,7 @@ else if(e.getSource() == apply) { notificationService.registerNotificationForEvent( tmpNTE.getEvent(), - notificationService.ACTION_COMMAND, + NotificationService.ACTION_COMMAND, tmpNTE.getProgramFile(), ""); logger.debug("Program"); @@ -639,7 +639,7 @@ else if(e.getSource() == apply) { notificationService.removeEventNotificationAction( tmpNTE.getEvent(), - notificationService.ACTION_COMMAND); + NotificationService.ACTION_COMMAND); logger.debug("Deleting Program"); } @@ -647,7 +647,7 @@ else if(e.getSource() == apply) { notificationService.registerNotificationForEvent( tmpNTE.getEvent(), - notificationService.ACTION_POPUP_MESSAGE, + NotificationService.ACTION_POPUP_MESSAGE, "", ""); logger.debug("Popup"); @@ -656,7 +656,7 @@ else if(e.getSource() == apply) { notificationService.removeEventNotificationAction( tmpNTE.getEvent(), - notificationService.ACTION_POPUP_MESSAGE); + NotificationService.ACTION_POPUP_MESSAGE); logger.debug("Deleting Popup"); } tmpNTE.setModify(false); @@ -804,7 +804,7 @@ public void actionAdded(NotificationActionTypeEvent event) tmpNTE.setPopup(isActionEnabled); } else if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgram(isActionEnabled); @@ -843,7 +843,7 @@ else if(event.getSourceActionType() } else if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgram(isActionEnabled); tmpNTE.setProgramFile(((CommandNotificationHandler)event @@ -877,7 +877,7 @@ else if(event.getSourceActionType() tmpNTE.setPopup(isActionEnabled); } else if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgram(isActionEnabled); tmpNTE.setProgramFile(((CommandNotificationHandler)event @@ -954,7 +954,7 @@ public void actionChanged(NotificationActionTypeEvent event) if(tmpNTE.getEvent().equals(eventName)) { if(event.getSourceActionType() - .equals(notificationService.ACTION_COMMAND)) + .equals(NotificationService.ACTION_COMMAND)) { tmpNTE.setProgramFile(((CommandNotificationHandler)event .getActionHandler()).getDescriptor()); @@ -1060,8 +1060,6 @@ public void buildingVector() Iterator it = notificationService.getRegisteredEvents(); NotificationsTableEntry tmpNTE = null; String event = null; - Map actionsMap = null; - dataVector.removeAllElements(); while(it.hasNext()) @@ -1078,34 +1076,24 @@ public void buildingVector() event, false); - actionsMap = notificationService.getEventNotifications(event); + Map actionsMap + = notificationService.getEventNotifications(event); if(actionsMap != null) { - Set entry = actionsMap.entrySet(); - Iterator itEntry = entry.iterator(); - - while(itEntry.hasNext()) + for (Map.Entry mEntry + : actionsMap.entrySet()) { - Map.Entry mEntry = (Map.Entry) itEntry.next(); - String actionType = (String) mEntry.getKey(); - - NotificationActionHandler handler = null; - - boolean isActionEnabled = false; - - if(mEntry.getValue() instanceof NotificationActionHandler) - { - handler = (NotificationActionHandler)mEntry.getValue(); - isActionEnabled = handler.isEnabled(); - } + String actionType = mEntry.getKey(); + NotificationActionHandler handler = mEntry.getValue(); + boolean isActionEnabled = (handler == null) ? false : handler.isEnabled(); if(actionType - .equals(notificationService.ACTION_POPUP_MESSAGE)) + .equals(NotificationService.ACTION_POPUP_MESSAGE)) { tmpNTE.setPopup(isActionEnabled); } else if(actionType - .equals(notificationService.ACTION_SOUND) && + .equals(NotificationService.ACTION_SOUND) && handler != null) { tmpNTE.setSound(isActionEnabled); @@ -1113,7 +1101,7 @@ else if(actionType ((SoundNotificationHandler) handler).getDescriptor()); } else if(actionType - .equals(notificationService.ACTION_COMMAND) && + .equals(NotificationService.ACTION_COMMAND) && handler != null) { tmpNTE.setProgram(isActionEnabled); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java index 0079077ee..87bd8c5b6 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardActivator.java @@ -82,9 +82,10 @@ public static UIService getUiService() * @return all OperationSetWhiteboardings obtained from the bundle * context */ - public static List getWhiteboardOperationSets() + public static List getWhiteboardOperationSets() { - List whiteboardOpSets = new ArrayList(); + List whiteboardOpSets + = new ArrayList(); ServiceReference[] serRefs = null; try @@ -102,15 +103,15 @@ public static List getWhiteboardOperationSets() if (serRefs == null) return null; - for (int i = 0; i < serRefs.length; i++) + for (ServiceReference serRef : serRefs) { ProtocolProviderService protocolProvider - = (ProtocolProviderService) bundleContext - .getService(serRefs[i]); + = (ProtocolProviderService) bundleContext.getService(serRef); - OperationSet opSet - = protocolProvider.getOperationSet( - OperationSetWhiteboarding.class); + OperationSetWhiteboarding opSet + = (OperationSetWhiteboarding) + protocolProvider + .getOperationSet(OperationSetWhiteboarding.class); if(opSet != null) whiteboardOpSets.add(opSet); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java index 775f3b745..b63554233 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/WhiteboardSessionManager.java @@ -8,6 +8,7 @@ import java.awt.*; import java.util.*; +import java.util.List; import net.java.sip.communicator.plugin.whiteboard.gui.*; import net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes.*; @@ -38,18 +39,14 @@ public class WhiteboardSessionManager public WhiteboardSessionManager() { - if (WhiteboardActivator - .getWhiteboardOperationSets() == null) - return; + List whiteboardOpSets + = WhiteboardActivator.getWhiteboardOperationSets(); - Iterator opSets = WhiteboardActivator - .getWhiteboardOperationSets().iterator(); + if (whiteboardOpSets == null) + return; - while (opSets.hasNext()) + for (OperationSetWhiteboarding whiteboardOpSet : whiteboardOpSets) { - OperationSetWhiteboarding whiteboardOpSet - = (OperationSetWhiteboarding) opSets.next(); - whiteboardOpSet.addInvitationListener(new InvitationListener()); whiteboardOpSet.addPresenceListener(new PresenceListener()); } @@ -130,7 +127,7 @@ public WhiteboardObject sendWhiteboardObject ( WhiteboardSession wbSession, WhiteboardShape ws) throws OperationFailedException { - Vector supportedWBO = new Vector ( + Vector supportedWBO = new Vector( Arrays.asList (wbSession.getSupportedWhiteboardObjects ())); if(ws instanceof WhiteboardObjectPath) diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java index 6ac01b881..cc29ff630 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/WhiteboardFrame.java @@ -156,11 +156,6 @@ public class WhiteboardFrame */ private WhiteboardShape selectedShape = null; - /** - * The current selected point (null if nothing is seleted) - */ - private Point2D selectedPoint = null; - /** * The current preselected shape (null if nothing is preseleted) A shape is * preselected when the mouse move on. @@ -220,12 +215,12 @@ public class WhiteboardFrame /** * List of WhiteboardShape */ - private List displayList = new CopyOnWriteArrayList(); + private List displayList = new CopyOnWriteArrayList(); /** * Aarray of WhiteboardPoint */ - private List pathList = new ArrayList(); + private List pathList = new ArrayList(); /** * WhiteboardPanel where the shapes are drawn @@ -462,8 +457,7 @@ public void mousePressed(MouseEvent e) deselect(); for (int i = displayList.size() - 1; i >= 0; i--) { - WhiteboardShape shape = - (WhiteboardShape) displayList.get(i); + WhiteboardShape shape = displayList.get(i); if (shape.contains(s2w.transform(e.getPoint(), null))) { @@ -482,8 +476,7 @@ else if (currentTool == MODIF) deselect(); for (int i = displayList.size() - 1; i >= 0; i--) { - WhiteboardShape shape = - (WhiteboardShape) displayList.get(i); + WhiteboardShape shape = displayList.get(i); WhiteboardPoint point = shape.getSelectionPoint( s2w.transform(e.getPoint(), null)); @@ -661,7 +654,7 @@ public void mouseMoved(MouseEvent e) WhiteboardShape shape; for (int i = 0; i < displayList.size(); i++) { - shape = (WhiteboardShape) displayList.get(i); + shape = displayList.get(i); if (shape.contains(s2w.transform(e.getPoint(), null))) { @@ -811,7 +804,6 @@ private void initComponents() newMenuItem = new JMenuItem(); openMenuItem = new JMenuItem(); saveMenuItem = new JMenuItem(); - sendMenuItem = new JMenuItem(); printMenuItem = new JMenuItem(); exitMenuItem = new JMenuItem(); editMenu = new JMenu(); @@ -831,7 +823,7 @@ private void initComponents() if (session != null) { - Iterator participants = session.getWhiteboardParticipants(); + Iterator participants = session.getWhiteboardParticipants(); while (participants.hasNext()) { @@ -1531,8 +1523,6 @@ private void colorChooserButtonActionPerformed( private javax.swing.JToggleButton selectionButton; - private javax.swing.JMenuItem sendMenuItem; - private javax.swing.JToggleButton textButton; private JPanel toolBar; @@ -2215,7 +2205,7 @@ private void deselect() WhiteboardShape shape; for (int i = 0; i < displayList.size(); i++) { - shape = (WhiteboardShape) displayList.get(i); + shape = displayList.get(i); shape.setSelected(false); shape.setModifyPoint(null); } @@ -2287,7 +2277,7 @@ public void receiveWhiteboardObject(WhiteboardObject wbo) WhiteboardShape ws = createWhiteboardShape(wbo); for (int i = 0; i < displayList.size(); i++) { - WhiteboardShape wbs = (WhiteboardShape) displayList.get(i); + WhiteboardShape wbs = displayList.get(i); if (wbs.getID().equals(wbo.getID())) { displayList.set(i, ws); @@ -2310,7 +2300,7 @@ public void receiveDeleteWhiteboardObject(String id) int i = 0; while (i < displayList.size()) { - WhiteboardShape wbs = (WhiteboardShape) displayList.get(i); + WhiteboardShape wbs = displayList.get(i); if (id.equals(wbs.getID())) displayList.remove(i); else @@ -2339,7 +2329,7 @@ private WhiteboardShape createWhiteboardShape(WhiteboardObject wbo) WhiteboardObjectPath path = (WhiteboardObjectPath) wbo; logger.debug("[log] : WB_PATH"); Color c = Color.getColor("", color); - List points = path.getPoints(); + List points = path.getPoints(); wShape = new WhiteboardShapePath(id, t, c, points); } else if (wbo instanceof WhiteboardObjectPolyLine) @@ -2347,7 +2337,7 @@ else if (wbo instanceof WhiteboardObjectPolyLine) WhiteboardObjectPolyLine pLine = (WhiteboardObjectPolyLine) wbo; logger.debug("[log] : WB_POLYLINE"); Color c = Color.getColor("", color); - List points = pLine.getPoints(); + List points = pLine.getPoints(); wShape = new WhiteboardShapePolyLine(id, t, c, points, false); } @@ -2356,7 +2346,7 @@ else if (wbo instanceof WhiteboardObjectPolygon) WhiteboardObjectPolygon polygon = (WhiteboardObjectPolygon) wbo; logger.debug("[log] : WB_POLYGON"); Color c = Color.getColor("", color); - List points = polygon.getPoints(); + List points = polygon.getPoints(); boolean fill = polygon.isFill(); wShape = new WhiteboardShapePolygon(id, t, c, points, fill); @@ -2401,11 +2391,8 @@ else if (wbo instanceof WhiteboardObjectText) logger.debug("[log] : WB_TEXT"); Color c = Color.getColor("", color); WhiteboardPoint p = text.getWhiteboardPoint(); - int size; - String txt, fontFamily; - size = text.getFontSize(); - txt = text.getText(); - fontFamily = text.getFontName(); + int size = text.getFontSize(); + String txt = text.getText(); wShape = new WhiteboardShapeText(id, c, p, size, txt); } @@ -2413,7 +2400,6 @@ else if (wbo instanceof WhiteboardObjectImage) { WhiteboardObjectImage img = (WhiteboardObjectImage) wbo; logger.debug("[log] : WB_IMAGE"); - Color c = Color.getColor("", color); double height, width; WhiteboardPoint p = img.getWhiteboardPoint(); width = img.getWidth(); @@ -2433,7 +2419,7 @@ public void deleteSelected() int i = 0; while (i < displayList.size()) { - s = (WhiteboardShape) displayList.get(i); + s = displayList.get(i); if (s.isSelected()) { this.sendDeleteShape(s); diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java index 71c826b9f..6eccc8118 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeCircle.java @@ -4,17 +4,14 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes; import java.awt.*; -import java.awt.geom.AffineTransform; -import java.awt.geom.Ellipse2D; -import java.awt.geom.Point2D; +import java.awt.geom.*; import java.util.*; import java.util.List; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; /** @@ -49,7 +46,7 @@ public class WhiteboardShapeCircle /** * Stores all selection points for this shape. */ - private ArrayList selectionPoints = new ArrayList(); + private ArrayList selectionPoints = new ArrayList(); /** * WhiteboardShapeCircle constructor @@ -207,14 +204,9 @@ public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); - for (int i = 0; i < selectionPoints.size(); i ++) - { - WhiteboardPoint point = (WhiteboardPoint) selectionPoints.get(i); - + for (WhiteboardPoint point : selectionPoints) if (point.distance(givenPoint) < 10) return point; - } - return null; } /** @@ -222,7 +214,7 @@ public WhiteboardPoint getSelectionPoint (Point2D p) * * @return list of selected points */ - public List getSelectionPoints () + public List getSelectionPoints () { return selectionPoints; } @@ -398,4 +390,4 @@ private void recalculateSelectionPoints() new WhiteboardPoint ( whiteboardPoint.getX(), whiteboardPoint.getY() + radius)); } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java index 066086492..242aa28fe 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeImage.java @@ -55,7 +55,7 @@ public class WhiteboardShapeImage /** * Stores all selection points for this shape. */ - private ArrayList selectionPoints = new ArrayList(); + private ArrayList selectionPoints = new ArrayList(); /** * WhiteboardShapImage constructor @@ -117,7 +117,7 @@ public void paintShape (Graphics2D g, AffineTransform t) * * @return list of selected points */ - public List getSelectionPoints () + public List getSelectionPoints () { return selectionPoints; } @@ -262,14 +262,9 @@ public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); - for (int i = 0; i < selectionPoints.size(); i ++) - { - WhiteboardPoint point = (WhiteboardPoint) selectionPoints.get(i); - + for (WhiteboardPoint point : selectionPoints) if (point.distance(givenPoint) < 18) return point; - } - return null; } @@ -343,4 +338,4 @@ private void recalculateSelectionPoints() new WhiteboardPoint ( whiteboardPoint.getX() + width, whiteboardPoint.getY() + height)); } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java index 0dadb57eb..0801c5b95 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeLine.java @@ -131,9 +131,9 @@ public boolean contains (Point2D p) * * @return list of selected points */ - public List getSelectionPoints () + public List getSelectionPoints () { - ArrayList selectionPoints = new ArrayList(); + ArrayList selectionPoints = new ArrayList(); selectionPoints.add (startPoint); selectionPoints.add (endPoint); @@ -246,4 +246,4 @@ public void setWhiteboardPointEnd (WhiteboardPoint whiteboardPointEnd) { this.endPoint = whiteboardPointEnd; } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java index 9d58a8787..74f3c2b56 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePath.java @@ -4,15 +4,14 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.plugin.whiteboard.gui.whiteboardshapes; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Graphics2D; +import java.awt.*; import java.awt.geom.*; import java.util.*; -import net.java.sip.communicator.service.protocol.WhiteboardPoint; +import java.util.List; + +import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.whiteboardobjects.*; /** @@ -28,7 +27,7 @@ public class WhiteboardShapePath /** * List of WhiteboardPoint */ - private ArrayList points; + private ArrayList points; /** * WhiteboardShapePath constructor. @@ -39,12 +38,12 @@ public class WhiteboardShapePath * @param c WhiteboardShapePath's color (or rather it's border) * @param points list of WhiteboardPoint. */ - public WhiteboardShapePath (String id, int t, Color c, List points) + public WhiteboardShapePath (String id, int t, Color c, List points) { super (id); this.setThickness (t); setColor (c.getRGB ()); - this.points = new ArrayList (points); + this.points = new ArrayList(points); } /** @@ -57,17 +56,15 @@ public WhiteboardShapePath (String id, int t, Color c, List points) * @param v2w 2D affine transform */ public WhiteboardShapePath (String id, int t, Color c, - List points, AffineTransform v2w) + List points, AffineTransform v2w) { super (id); this.setThickness (t); setColor (c.getRGB ()); - this.points = new ArrayList (); - WhiteboardPoint p = null; - for (int i = 0; i < points.size ();i++) + this.points = new ArrayList(); + for (WhiteboardPoint p : points) { - p = (WhiteboardPoint) points.get (i); Point2D w = v2w.transform ( new Point2D.Double (p.getX (), p.getY ()), null); this.points.add (new WhiteboardPoint (w.getX (), w.getY ())); @@ -80,7 +77,7 @@ public WhiteboardShapePath (String id, int t, Color c, * * @return the list of WhiteboardPoints composing this object. */ - public List getPoints () + public List getPoints () { return points; } @@ -90,15 +87,12 @@ public List getPoints () * * @return list of selected points */ - public List getSelectionPoints () + public List getSelectionPoints () { - List list = new ArrayList (); - WhiteboardPoint p ; - for(int i =0; i< points.size (); i++) - { - p = (WhiteboardPoint) points.get (i); + List list = new ArrayList(); + + for(WhiteboardPoint p : points) list.add (new WhiteboardPoint (p.getX (), p.getY ())); - } return list; } @@ -116,7 +110,7 @@ public void paintShape (Graphics2D g, AffineTransform t) int size = points.size (); for (int i = 0; i < size; i++) { - WhiteboardPoint point = (WhiteboardPoint) points.get (i); + WhiteboardPoint point = points.get (i); Point2D p0 = t.transform ( new Point2D.Double (startX, startY), null); Point2D p1 = t.transform ( @@ -151,7 +145,7 @@ public boolean contains (Point2D p) int size = points.size (); for (int i = 0; i < size; i++) { - WhiteboardPoint point = (WhiteboardPoint) points.get (i); + WhiteboardPoint point = points.get (i); if (i > 0) { @@ -177,9 +171,9 @@ public boolean contains (Point2D p) * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points) + public void setPoints (List points) { - this.points = new ArrayList (points); + this.points = new ArrayList(points); } /** @@ -193,7 +187,7 @@ public void translate (double deltaX, double deltaY) WhiteboardPoint point; for (int i = 0; i< points.size ();i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); points.set (i, new WhiteboardPoint ( point.getX () + deltaX, point.getY () + deltaY)); @@ -216,7 +210,7 @@ public void translateSelectedPoint (double deltaX, double deltaY) for (int i = 0; i < points.size (); i++) { - point = (WhiteboardPoint) points.get (i); + point = points.get (i); if(getModifyPoint().equals(point)) { @@ -239,17 +233,10 @@ public void translateSelectedPoint (double deltaX, double deltaY) */ public WhiteboardPoint getSelectionPoint (Point2D p) { - WhiteboardPoint point; - for (int i = 0; i < points.size (); i++) - { - point = (WhiteboardPoint) points.get (i); - - if((new Point2D.Double ( - point.getX (), point.getY ())).distance (p) < 18) - { + for (WhiteboardPoint point : points) + if((new Point2D.Double (point.getX (), point.getY ())).distance (p) + < 18) return point; - } - } return null; } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java index f8e215693..d43fd6262 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapePolyLine.java @@ -31,7 +31,7 @@ public class WhiteboardShapePolyLine /** * list of WhiteboardPoint */ - private List points; + private List points; /** * True is filled, false is unfilled. */ @@ -50,7 +50,7 @@ public class WhiteboardShapePolyLine public WhiteboardShapePolyLine (String id, int thickness, Color color, - List points, + List points, boolean fill) { super (id); @@ -72,18 +72,18 @@ public WhiteboardShapePolyLine (String id, public WhiteboardShapePolyLine (String id, int thickness, Color color, - List m_points, + List m_points, boolean fill, AffineTransform at) { super (id); - ArrayList pointsList = new ArrayList (); + ArrayList pointsList = new ArrayList(); WhiteboardPoint p; for (int i = 0; i points, boolean fill) { this.setThickness (thickness); this.setColor (color); // need to clone because passed by reference - this.points = new ArrayList (points); + this.points = new ArrayList(points); this.fill = fill; } @@ -160,13 +160,13 @@ public void paintShape (Graphics2D g, AffineTransform t) * * @return list of selected WhiteboardPoints */ - public List getSelectionPoints () + public List getSelectionPoints () { - List list = new ArrayList (); - WhiteboardPoint p ; + List list = new ArrayList(); + WhiteboardPoint p; for(int i =0; i< points.size (); i++) { - p = (WhiteboardPoint) points.get (i); + p = points.get (i); list.add (new WhiteboardPoint (p.getX (), p.getY ())); } return list; @@ -196,14 +196,14 @@ private GeneralPath createPoly (AffineTransform w2v) GeneralPath.WIND_EVEN_ODD, points.size ()); if(points.size ()<=0) return polyline; - WhiteboardPoint start = (WhiteboardPoint) points.get (0); + WhiteboardPoint start = points.get (0); Point2D w = new Point2D.Double (start.getX (), start.getY ()); Point2D v = w2v.transform (w, null); polyline.moveTo ((int) v.getX (), (int) v.getY ()); WhiteboardPoint p; for (int i =0; iWhiteboardPoints composing this object. */ - public List getPoints () + public List getPoints () { return points; } @@ -255,9 +255,9 @@ public List getPoints () * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points) + public void setPoints (List points) { - this.points = new ArrayList (points); + this.points = new ArrayList (points); } /** @@ -271,7 +271,7 @@ public void translate (double deltaX, double deltaY) WhiteboardPoint point ; for (int i =0; i points; /** * True is filled, false is unfilled. */ @@ -55,7 +55,7 @@ public class WhiteboardShapePolygon public WhiteboardShapePolygon ( String id, int thickness, Color color, - List points, + List points, boolean fill) { super (id); @@ -77,17 +77,17 @@ public WhiteboardShapePolygon ( String id, public WhiteboardShapePolygon ( String id, int t, Color c, - List m_points, + List m_points, boolean fill, AffineTransform at) { super (id); - ArrayList pointsList = new ArrayList (); + ArrayList pointsList = new ArrayList(); WhiteboardPoint p; for (int i = 0; i < m_points.size (); i++) { - p = (WhiteboardPoint) m_points.get (i); + p = m_points.get (i); Point2D w = at.transform ( new Point2D.Double (p.getX (), p.getY ()), null); pointsList.add (new WhiteboardPoint (w.getX (), w.getY ())); @@ -107,13 +107,13 @@ public WhiteboardShapePolygon ( String id, */ private void initShape (int thickness, Color color, - List points, + List points, boolean fill) { this.setThickness (thickness); setColor (color); this.backgroundColor = color; - this.points = new ArrayList (points); + this.points = new ArrayList(points); this.fill = fill; } @@ -163,7 +163,7 @@ public void paintShape (Graphics2D g, AffineTransform t) * * @return list of selected WhiteboardPoints */ - public List getSelectionPoints () + public List getSelectionPoints () { return points; } @@ -193,7 +193,7 @@ private GeneralPath createPoly (AffineTransform w2v) if(points.size ()<=0) return polygon; - WhiteboardPoint start = (WhiteboardPoint) points.get (0); + WhiteboardPoint start = points.get (0); Point2D w = new Point2D.Double (start.getX (), start.getY ()); Point2D v = w2v.transform (w, null); polygon.moveTo ((int) v.getX (), (int) v.getY ()); @@ -201,7 +201,7 @@ private GeneralPath createPoly (AffineTransform w2v) WhiteboardPoint p; for (int i =0; iWhiteboardPoints composing this object. */ - public List getPoints () + public List getPoints () { return points; } @@ -256,9 +256,9 @@ public List getPoints () * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points) + public void setPoints (List points) { - this.points = new ArrayList (points); + this.points = new ArrayList(points); } /** @@ -272,7 +272,7 @@ public void translate (double deltaX, double deltaY) WhiteboardPoint point ; for (int i =0; i selectionPoints + = new ArrayList(); /** * WhiteboardShapeRect constructor. @@ -234,7 +233,7 @@ public void paintShape (Graphics2D g, AffineTransform t) * * @return list of selected points */ - public List getSelectionPoints () + public List getSelectionPoints () { return selectionPoints; } @@ -340,14 +339,9 @@ public WhiteboardPoint getSelectionPoint (Point2D p) { WhiteboardPoint givenPoint = new WhiteboardPoint(p.getX(), p.getY()); - for (int i = 0; i < selectionPoints.size(); i ++) - { - WhiteboardPoint point = (WhiteboardPoint) selectionPoints.get(i); - + for (WhiteboardPoint point : selectionPoints) if (point.distance(givenPoint) < 18) return point; - } - return null; } @@ -440,4 +434,4 @@ private void recalculateSelectionPoints() new WhiteboardPoint ( point.getX() + width, point.getY() + height)); } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java index cbe90e09e..ce17fdaf3 100644 --- a/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java +++ b/src/net/java/sip/communicator/plugin/whiteboard/gui/whiteboardshapes/WhiteboardShapeText.java @@ -153,9 +153,9 @@ public void paintShape (Graphics2D g, AffineTransform t) * * @return list of selected points */ - public List getSelectionPoints () + public List getSelectionPoints () { - List list = new ArrayList (); + List list = new ArrayList(); list.add (point); return list; @@ -319,4 +319,4 @@ public void setFontName (String fontName) { this.fontName = fontName; } -} \ No newline at end of file +} diff --git a/src/net/java/sip/communicator/service/notification/NotificationService.java b/src/net/java/sip/communicator/service/notification/NotificationService.java index d547716f1..20c67392f 100644 --- a/src/net/java/sip/communicator/service/notification/NotificationService.java +++ b/src/net/java/sip/communicator/service/notification/NotificationService.java @@ -280,7 +280,8 @@ public void removeEventNotificationAction( String eventType, * an event with the specified name has occurred, or null if no actions * have been defined for eventType. */ - public Map getEventNotifications(String eventType); + public Map getEventNotifications( + String eventType); /** * Returns the NotificationActionHandler corresponding to the given diff --git a/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java b/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java index 62a8dba2d..3e5781e8a 100644 --- a/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java +++ b/src/net/java/sip/communicator/service/protocol/WhiteboardSession.java @@ -9,8 +9,7 @@ import java.util.*; import net.java.sip.communicator.service.protocol.event.*; - -import net.java.sip.communicator.service.protocol.whiteboardobjects.WhiteboardObject; +import net.java.sip.communicator.service.protocol.whiteboardobjects.*; /** * A represenation of a WhiteboardSession. @@ -34,7 +33,7 @@ public interface WhiteboardSession * @return an Iterator over all participants currently involved in the * whiteboard. */ - public Iterator getWhiteboardParticipants (); + public Iterator getWhiteboardParticipants (); /** * Returns the number of participants currently associated @@ -224,7 +223,7 @@ public abstract void removeWhiteboardParticipant ( * @return an Vector of WhiteboardObjects associated * with this whiteboard. */ - public Vector getWhiteboardObjects (); + public Vector getWhiteboardObjects (); /** * Sets the state of this whiteboard diff --git a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java index 8adeeb559..bf307635a 100644 --- a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java +++ b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPath.java @@ -4,11 +4,12 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.service.protocol.whiteboardobjects; import java.util.List; +import net.java.sip.communicator.service.protocol.*; + /** * Used to access the content of instant whiteboard objects that are sent or * received via the WhiteboardOperationSet. @@ -28,7 +29,7 @@ public interface WhiteboardObjectPath extends WhiteboardObject * * @return the list of WhiteboardPoints composing this object. */ - public List getPoints(); + public List getPoints(); /** * Sets the list of WhiteboardPoint instances that this @@ -37,5 +38,5 @@ public interface WhiteboardObjectPath extends WhiteboardObject * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints(List points); -} \ No newline at end of file + public void setPoints(List points); +} diff --git a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java index 525970501..172da6b0e 100644 --- a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java +++ b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolyLine.java @@ -4,10 +4,11 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.service.protocol.whiteboardobjects; -import java.util.List; +import java.util.*; + +import net.java.sip.communicator.service.protocol.*; /** * Used to access the content of instant whiteboard objects that are sent or @@ -28,7 +29,7 @@ public interface WhiteboardObjectPolyLine extends WhiteboardObject * * @return the list of WhiteboardPoints composing this object. */ - public List getPoints (); + public List getPoints (); /** * Sets the list of WhiteboardPoint instances that this @@ -37,5 +38,5 @@ public interface WhiteboardObjectPolyLine extends WhiteboardObject * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points); -} \ No newline at end of file + public void setPoints (List points); +} diff --git a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java index 69523efa6..70e1df9e5 100644 --- a/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java +++ b/src/net/java/sip/communicator/service/protocol/whiteboardobjects/WhiteboardObjectPolygon.java @@ -4,11 +4,12 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package net.java.sip.communicator.service.protocol.whiteboardobjects; import java.util.List; +import net.java.sip.communicator.service.protocol.*; + /** * Used to access the content of instant whiteboard objects that are sent or * received via the WhiteboardOperationSet. @@ -43,7 +44,7 @@ public interface WhiteboardObjectPolygon extends WhiteboardObject * * @return the list of WhiteboardPoints composing this object. */ - public List getPoints (); + public List getPoints (); /** * Sets the list of WhiteboardPoint instances that this @@ -52,7 +53,7 @@ public interface WhiteboardObjectPolygon extends WhiteboardObject * @param points the list of WhiteboardPoint instances that this * WhiteboardObject is composed of. */ - public void setPoints (List points); + public void setPoints (List points); /** * Specifies the background color for this object. The color parameter @@ -72,4 +73,4 @@ public interface WhiteboardObjectPolygon extends WhiteboardObject * @return the RGB value of the background color of this object. */ public int getBackgroundColor (); -} \ No newline at end of file +} diff --git a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java index db0121227..3db3d3ba7 100644 --- a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java +++ b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java @@ -165,7 +165,7 @@ private void generateCall(String participant) iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } @@ -212,14 +212,14 @@ public void readRecords() assertEquals("Calls must be 2", rs.size(), 2); - CallRecord rec = (CallRecord)resultIter.next(); + CallRecord rec = resultIter.next(); CallPeerRecord participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -234,7 +234,7 @@ public void readRecords() assertEquals("Calls must be 1", rs.size(), 1); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -249,21 +249,21 @@ public void readRecords() assertEquals("Calls must be 3", rs.size(), 3); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(3))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -304,7 +304,7 @@ public void checkRecordCompleteness() iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } diff --git a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java index f2d5e30a1..641a8595c 100644 --- a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java +++ b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java @@ -300,7 +300,7 @@ private void generateCall(String participant) iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } @@ -704,7 +704,7 @@ public void fileTests() it = rs.iterator(); assertTrue("Filetransfers not found", - ((FileRecord)it.next()).getFile().getName(). + it.next().getFile().getName(). equals(files[2].getName())); rs = getFileRecords( 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 22e3871d1..c00ad3b81 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java @@ -166,8 +166,7 @@ public void writeData(OutputStream out) private Hashtable getInfoForRequest(int requestID) { Hashtable res - = (Hashtable) - retreivedInfo.get(new Integer(requestID)); + = retreivedInfo.get(new Integer(requestID)); if (res == null) { diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java index 605df8632..f7fcfe5c3 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java @@ -24,13 +24,10 @@ import net.kano.joscar.tlv.*; import net.kano.joustsim.*; import net.kano.joustsim.oscar.*; -import net.kano.joustsim.oscar.State; import net.kano.joustsim.oscar.oscar.service.bos.*; import net.kano.joustsim.oscar.oscar.service.buddy.*; import net.kano.joustsim.oscar.oscar.service.icbm.*; -import net.kano.joustsim.oscar.oscar.service.info.*; import net.kano.joustsim.oscar.oscar.service.ssi.*; -import net.kano.joustsim.trust.*; /** * An utility that we use to test AIM/ICQ implementations of the @@ -656,18 +653,16 @@ private static class BosEventNotifier implements MainBosServiceListener public Object extraInfoLock = new Object(); public Object infoLock = new Object(); - public List lastExtraInfos = null; public FullUserInfo lastUserInfo = null; /** * Saves the extraInfos list and calls a notifyAll on the extraInfoLock * @param extraInfos the list of extraInfos that the AIM server sent */ - public void handleYourExtraInfo(List extraInfos) + public void handleYourExtraInfo(List extraInfos) { logger.debug("Bosiat.extrainfo=" + extraInfos); synchronized(extraInfoLock){ - lastExtraInfos = extraInfos; extraInfoLock.notifyAll(); } } @@ -697,7 +692,7 @@ private class LayoutEventCollector { public Vector addedGroups = new Vector(); public Vector addedBuddies = new Vector(); - public Vector removedBuddies = new Vector(); + public Vector removedBuddies = new Vector(); /** * The method would wait until at least one new buddy is collected by @@ -807,22 +802,28 @@ public void buddyAdded(BuddyList list, } //we don't use this one so far. - public void groupsReordered(BuddyList list, List oldOrder, List newOrder) + public void groupsReordered( + BuddyList list, + List oldOrder, + List newOrder) { logger.debug("groupsReordered"); } //we don't use this one so far. - public void groupRemoved(BuddyList list, - List oldItems, List newItems, Group group) + public void groupRemoved( + BuddyList list, + List oldItems, + List newItems, + Group group) { logger.debug("removedGroup="+group.getName()); } // we don't use this one so far. public void buddyRemoved(BuddyList list, Group group, - List oldItems, - List newItems, + List oldItems, + List newItems, Buddy buddy) { logger.debug("removed buddy=" + buddy); @@ -830,8 +831,8 @@ public void buddyRemoved(BuddyList list, Group group, //we don't use this one public void buddiesReordered(BuddyList list, Group group, - List oldBuddies, - List newBuddies) + List oldBuddies, + List newBuddies) { logger.debug("buddiesReordered in group " + group.getName()); } @@ -844,7 +845,7 @@ public void gotBuddyStatus(BuddyService service, Screenname buddy, { System.out.println("BuddyListener.gotBuddyStatus " + buddy.toString() +" and status is : " + info.getIcqStatus()); - List eInfoBlocks = info.getExtraInfoBlocks(); + List eInfoBlocks = info.getExtraInfoBlocks(); if (eInfoBlocks != null) { System.out.println("printing extra info blocks (" @@ -907,71 +908,36 @@ public void receivedStatusUpdate(BuddyInfoManager manager, } - private class ServiceListener implements OpenedServiceListener - { - - public void closedServices(AimConnection conn, Collection services) - { - - } - - public void openedServices(AimConnection conn, Collection services) - { - conn.getBuddyInfoManager().addGlobalBuddyInfoListener(new GlobalBuddyListener()); - conn.getBuddyService().addBuddyListener(new BuddyListener()); - } - - } - - private static class InfoRespListener implements InfoResponseListener{ - - public void handleAwayMessage(InfoService service, Screenname buddy, - String awayMessage) - { - System.out.println("InfoResponseListener.handleAwayMessage " + awayMessage); - } - - public void handleCertificateInfo(InfoService service, - Screenname buddy, - BuddyCertificateInfo certInfo) - { - System.out.println("InfoResponseListener.handleCertificateInfo " + certInfo); - } - - public void handleDirectoryInfo(InfoService service, - Screenname buddy, DirInfo dirInfo) - { - System.out.println("InfoResponseListener.handleDirectoryInfo " + dirInfo); - } - - public void handleUserProfile(InfoService service, Screenname buddy, - String userInfo) - { - System.out.println("InfoResponseListener.handleUserProfile " + userInfo); - } - - public void handleInvalidCertificates(InfoService service, - Screenname buddy, - CertificateInfo origCertInfo, - Throwable ex) - { - System.out.println("InfoResponseListener.handleInvalidCertificates " + origCertInfo); - } - - } +// private class ServiceListener +// implements OpenedServiceListener +// { +// public void closedServices(AimConnection conn, Collection services) +// { +// } +// +// public void openedServices(AimConnection conn, Collection services) +// { +// conn.getBuddyInfoManager() +// .addGlobalBuddyInfoListener(new GlobalBuddyListener()); +// conn.getBuddyService().addBuddyListener(new BuddyListener()); +// } +// } private class RetroListener implements BuddyListLayoutListener, GroupListener { - public void groupsReordered(BuddyList list, List oldOrder, - List newOrder) + public void groupsReordered(BuddyList list, + List oldOrder, + List newOrder) { System.out.println(" RetroListener.groupReordered"); } - public void groupAdded(BuddyList list, List oldItems, - List newItems, - Group group, List buddies) + public void groupAdded(BuddyList list, + List oldItems, + List newItems, + Group group, + List buddies) { System.out.println("RetroListener.groupAdded"); System.out.println(" group.name is="+group.getName()); @@ -989,36 +955,42 @@ public void groupAdded(BuddyList list, List oldItems, group.addGroupListener(this); } - public void groupRemoved(BuddyList list, List oldItems, - List newItems, - Group group) + public void groupRemoved(BuddyList list, + List oldItems, + List newItems, + Group group) { System.out.println(" RetroListener.groupRemoved"); } - public void buddyAdded(BuddyList list, Group group, List oldItems, - List newItems, - Buddy buddy) + public void buddyAdded(BuddyList list, + Group group, + List oldItems, + List newItems, + Buddy buddy) { System.out.println(" RetroListener.buddyAdded="+buddy); } - public void buddyRemoved(BuddyList list, Group group, - List oldItems, - List newItems, - Buddy buddy) + public void buddyRemoved(BuddyList list, + Group group, + List oldItems, + List newItems, + Buddy buddy) { System.out.println(" RetroListener.buddyRemoved"+buddy); } - public void buddiesReordered(BuddyList list, Group group, - List oldBuddies, - List newBuddies) + public void buddiesReordered(BuddyList list, + Group group, + List oldBuddies, + List newBuddies) { System.out.println(" RetroListener.buddiesReordered"); } - public void groupNameChanged(Group group, String oldName, + public void groupNameChanged(Group group, + String oldName, String newName) { System.out.println( @@ -1028,23 +1000,22 @@ public void groupNameChanged(Group group, String oldName, + newName + " group is="+group.getName()); System.out.println("GroupContains="+group.getBuddiesCopy()); - } - } ////////////////////////// ugly unused testing code ////////////////////////// private RetroListener rl = new RetroListener(); public static void main(String[] args) throws Throwable { -java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level.FINEST); + java.util.logging.Logger.getLogger("net.kano") + .setLevel(java.util.logging.Level.FINEST); + IcqTesterAgent icqtests = new IcqTesterAgent("319305099"); if (!icqtests.register("6pC0mmtt")) { System.out.println("registration failed"); ; return; } - MainBosService bos = icqtests.conn.getBosService(); Thread.sleep(1000); icqtests.conn.getSsiService() .getBuddyList().addRetroactiveLayoutListener(icqtests.rl); @@ -1056,19 +1027,13 @@ public static void main(String[] args) throws Throwable MutableBuddyList list = icqtests.conn.getSsiService().getBuddyList(); - MutableGroup dupeGroup = null; MutableGroup grpGroup = null; Buddy buddyToMove = null; - List groups = list.getGroups(); - Iterator groupsIter = groups.iterator(); - while(groupsIter.hasNext()) + for (Group group : list.getGroups()) { - MutableGroup group = (MutableGroup)groupsIter.next(); - if (group.getName().equals("dupe")) - dupeGroup = group; if (group.getName().equals("grp")) - grpGroup = group; + grpGroup = (MutableGroup) group; List buddies = group.getBuddiesCopy(); System.out.println("Printing buddies for group " + group.getName()); Thread.sleep(1000); @@ -1091,10 +1056,8 @@ public static void main(String[] args) throws Throwable //find the buddy again. Buddy movedBuddy = null; - groupsIter = list.getGroups().iterator(); - while(groupsIter.hasNext()) + for (Group group : list.getGroups()) { - MutableGroup group = (MutableGroup)groupsIter.next(); List buddies = group.getBuddiesCopy(); for (Buddy buddy : buddies) { @@ -1105,28 +1068,6 @@ public static void main(String[] args) throws Throwable if (buddyToMove == movedBuddy) System.out.println("hahaha"); - - } - - private class TestSnacCmd extends SnacCommand - { - /** The SNAC family code for the location family. */ - public static final int FAMILY_ICQ = 0x0015; - - protected TestSnacCmd(int command) { - super(FAMILY_ICQ, command); - } - - /** - * Writes this command's SNAC data block to the given stream. The SNAC data - * block is the data after the first ten bytes of a SNAC packet. - * - * @param out the stream to which to write the SNAC data - * @throws IOException if an I/O error occurs - */ - public void writeData(OutputStream out) throws IOException - { - } } public void deleteBuddy(String screenname) @@ -1331,7 +1272,7 @@ public class AuthCmdFactory extends ServerSsiCmdFactory implements SnacResponseListener { - List SUPPORTED_TYPES = null; + List SUPPORTED_TYPES = null; public String responseReasonStr = null; public String requestReasonStr = null; @@ -1342,15 +1283,15 @@ public class AuthCmdFactory public AuthCmdFactory() { - List types = super.getSupportedTypes(); - ArrayList tempTypes = new ArrayList(types); + List types = super.getSupportedTypes(); + ArrayList tempTypes = new ArrayList(types); tempTypes.add(new CmdType(SsiCommand.FAMILY_SSI, 0x001b)); // 1b auth request reply tempTypes.add(new CmdType(SsiCommand.FAMILY_SSI, 0x0019)); // 19 auth request this.SUPPORTED_TYPES = DefensiveTools.getUnmodifiable(tempTypes); } - public List getSupportedTypes() + public List getSupportedTypes() {return SUPPORTED_TYPES;} public SnacCommand genSnacCommand(SnacPacket packet) @@ -1402,9 +1343,9 @@ public void handleResponse(SnacResponseEvent e) (SsiDataModResponse) e.getSnacCommand(); int[] results = dataModResponse.getResults(); - List items = ( (ItemsCmd) e.getRequest().getCommand()). + List items = ( (ItemsCmd) e.getRequest().getCommand()). getItems(); - items = new LinkedList(items); + items = new LinkedList(items); for (int i = 0; i < results.length; i++) { @@ -1415,11 +1356,11 @@ public void handleResponse(SnacResponseEvent e) isErrorAddingReceived = true; // authorisation required for user - SsiItem buddyItem = (SsiItem) items.get(i); + SsiItem buddyItem = items.get(i); String uinToAskForAuth = buddyItem.getName(); - Vector buddiesToBeAdded = new Vector(); + Vector buddiesToBeAdded = new Vector(); BuddyAwaitingAuth newBuddy = new BuddyAwaitingAuth( buddyItem); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java index d65f58867..225df3e15 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java @@ -10,6 +10,7 @@ import junit.framework.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.*; import net.java.sip.communicator.util.*; /** @@ -192,14 +193,15 @@ public void testReadInfo() = opSetPresence.findContactByID(fixture.testerAgent.getIcqUIN()); // Get the last name info - Iterator iter = + Iterator iter = opSetServerStoredContactInfo. getDetails(testerAgentContact, ServerStoredDetails.LastNameDetail.class); while (iter.hasNext()) { - ServerStoredDetails.LastNameDetail item = (ServerStoredDetails.LastNameDetail) iter.next(); + ServerStoredDetails.LastNameDetail item + = (ServerStoredDetails.LastNameDetail) iter.next(); assertEquals("The LastName we set is not set or not read properly" , item.getName() @@ -227,10 +229,11 @@ public void testReadInfo() opSetServerStoredContactInfo. getDetails(testerAgentContact, ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList spokenLanguagesServer = new ArrayList(); + List spokenLanguagesServer = new ArrayList(); while (iter.hasNext()) { - ServerStoredDetails.SpokenLanguageDetail item = (ServerStoredDetails.SpokenLanguageDetail)iter.next(); + ServerStoredDetails.SpokenLanguageDetail item + = (ServerStoredDetails.SpokenLanguageDetail)iter.next(); spokenLanguagesServer.add(item.getLocale()); } @@ -254,7 +257,8 @@ public void testReadInfo() ServerStoredDetails.CountryDetail.class); while (iter.hasNext()) { - ServerStoredDetails.CountryDetail item = (ServerStoredDetails.CountryDetail) iter.next(); + ServerStoredDetails.CountryDetail item + = (ServerStoredDetails.CountryDetail) iter.next(); logger.info("read item value: " + item.getLocale().getDisplayCountry()); @@ -282,7 +286,7 @@ public void testWriteInfo() ServerStoredDetails.CountryDetail homeCountryDetail = null; // Get Last name info detail - Iterator iter = + Iterator iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.LastNameDetail.class); if (iter.hasNext()) @@ -485,7 +489,7 @@ public void testWriteInfo() logger.trace("Proceeding to Testing values!"); // make the tests here - Hashtable userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID); + Hashtable userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID); assertEquals("The LastName we set is not set or not read properly" , newLastName @@ -495,13 +499,17 @@ public void testWriteInfo() , newPhoneNumber , userInfo.get(FullUserInfoCmd.PHONE_NUMBER)); - ArrayList languageCodes = (ArrayList)userInfo.get(FullUserInfoCmd.SPEAK_LANG); - ArrayList languages = new ArrayList(); + List languageCodes + = (ArrayList) userInfo.get(FullUserInfoCmd.SPEAK_LANG); + ArrayList languages = new ArrayList(); // convert language codes to locales in the list - iter = languageCodes.iterator(); - while (iter.hasNext()) + Iterator languageCodeIter = languageCodes.iterator(); + while (languageCodeIter.hasNext()) { - languages.add(spokenLanguages[((Integer)iter.next()).intValue()]); + languages + .add( + spokenLanguages[ + ((Integer) languageCodeIter.next()).intValue()]); } // assertEquals("The number of spoken languages dowsn't match", // newLanguages.length, @@ -525,15 +533,14 @@ public void testWriteInfo() */ public void errorHandling() { - Iterator iter = + Iterator iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList initialLanguages = new ArrayList(); + ArrayList initialLanguages + = new ArrayList(); while (iter.hasNext()) - { initialLanguages.add(iter.next()); - } assertEquals("There must be 3 language details!", 3, initialLanguages.size()); @@ -607,23 +614,22 @@ public void removingItems() try { - Iterator iter = + Iterator iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList initialLanguages = new ArrayList(); + List initialLanguages + = new ArrayList(); while (iter.hasNext()) - { initialLanguages.add(iter.next()); - } // now remove those languages iter = initialLanguages.iterator(); while (iter.hasNext()) { - assertTrue("Error removing language!", - opSetServerStoredAccountInfo.removeDetail( - (ServerStoredDetails.SpokenLanguageDetail)iter.next())); + assertTrue( + "Error removing language!", + opSetServerStoredAccountInfo.removeDetail(iter.next())); synchronized (lock) { try{ @@ -648,14 +654,12 @@ public void removingItems() opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList languages = new ArrayList(); + List languages = new ArrayList(); while (iter.hasNext()) - { languages.add(iter.next()); - } logger.trace("languages " + languages.size()); - // there must be no languages after the last retreive + // there must be no languages after the last retrieve assertEquals("There must be no language details!", 0, languages.size()); } catch (OperationFailedException ex)