diff --git a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java index 318be30eb..be9ed5238 100644 --- a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java +++ b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java @@ -7,7 +7,6 @@ package net.java.sip.communicator.impl.argdelegation; import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.version.*; import net.java.sip.communicator.util.launchutils.*; import org.osgi.framework.*; diff --git a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java index ad89d1b11..0424d6d8a 100644 --- a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java +++ b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java @@ -12,11 +12,9 @@ import net.java.sip.communicator.service.argdelegation.*; import net.java.sip.communicator.service.gui.*; -import net.java.sip.communicator.service.version.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.launchutils.*; - /** * Implements the UriDelegationPeer interface from our argument handler * utility. We use this handler to relay arguments to URI handlers that have @@ -33,7 +31,7 @@ public class ArgDelegationPeerImpl /** * The list of uriHandlers that we are currently aware of. */ - private Map uriHandlers + private final Map uriHandlers = new Hashtable(); /** diff --git a/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierActivator.java b/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierActivator.java index ecd624f91..53ced1f48 100644 --- a/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierActivator.java +++ b/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierActivator.java @@ -42,7 +42,7 @@ public class AudioNotifierActivator implements BundleActivator public void start(BundleContext bundleContext) throws Exception { try { - this.bundleContext = bundleContext; + AudioNotifierActivator.bundleContext = bundleContext; //Create the audio notifier service audioNotifier = new AudioNotifierServiceImpl(); diff --git a/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierServiceImpl.java b/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierServiceImpl.java index 4ea554202..da9e63017 100644 --- a/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierServiceImpl.java +++ b/src/net/java/sip/communicator/impl/audionotifier/AudioNotifierServiceImpl.java @@ -10,7 +10,6 @@ import java.util.*; import net.java.sip.communicator.service.audionotifier.*; -import net.java.sip.communicator.util.*; /** * The implementation of the AudioNotifierService. @@ -20,9 +19,8 @@ public class AudioNotifierServiceImpl implements AudioNotifierService { - private Logger logger = Logger.getLogger(AudioNotifierServiceImpl.class); - - private static Map audioClips = new HashMap(); + private static final Map audioClips = + new HashMap(); private boolean isMute; @@ -34,13 +32,13 @@ public class AudioNotifierServiceImpl */ public SCAudioClip createAudio(String uri) { - SCAudioClip audioClip; + SCAudioClipImpl audioClip; synchronized (audioClips) { if(audioClips.containsKey(uri)) { - audioClip = (SCAudioClip) audioClips.get(uri); + audioClip = audioClips.get(uri); } else { @@ -90,23 +88,15 @@ public void setMute(boolean isMute) { this.isMute = isMute; - Iterator audios = audioClips.entrySet().iterator(); - - while (audios.hasNext()) + for (SCAudioClipImpl audioClip : audioClips.values()) { - SCAudioClipImpl audioClip - = (SCAudioClipImpl) ((Map.Entry) audios.next()).getValue(); - if (isMute) { audioClip.internalStop(); } - else + else if (audioClip.isLooping()) { - if(audioClip.isLooping()) - { - audioClip.playInLoop(audioClip.getLoopInterval()); - } + audioClip.playInLoop(audioClip.getLoopInterval()); } } } diff --git a/src/net/java/sip/communicator/impl/audionotifier/SCAudioClipImpl.java b/src/net/java/sip/communicator/impl/audionotifier/SCAudioClipImpl.java index a5b85cb3b..bada5d656 100644 --- a/src/net/java/sip/communicator/impl/audionotifier/SCAudioClipImpl.java +++ b/src/net/java/sip/communicator/impl/audionotifier/SCAudioClipImpl.java @@ -26,7 +26,7 @@ public class SCAudioClipImpl implements SCAudioClip { private static Constructor acConstructor = null; - private Timer playAudioTimer = new Timer(1000, null); + private Timer playAudioTimer = new Timer(1000, null); private AudioClip audioClip; diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java index 648f5f980..75733059b 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java @@ -37,8 +37,8 @@ public class CallHistoryServiceImpl /** * The logger for this class. */ - private static Logger logger = Logger - .getLogger(CallHistoryServiceImpl.class); + private static final Logger logger = + Logger.getLogger(CallHistoryServiceImpl.class); private static String[] STRUCTURE_NAMES = new String[] { "callStart", "callEnd", "dir", "callParticipantIDs", @@ -58,12 +58,14 @@ public class CallHistoryServiceImpl private Object syncRoot_HistoryService = new Object(); - private Hashtable progressListeners = new Hashtable(); + private final Map progressListeners = + new Hashtable(); - private Vector currentCallRecords = new Vector(); + private final List currentCallRecords = + new Vector(); - private HistoryCallChangeListener historyCallChangeListener - = new HistoryCallChangeListener(); + private final CallChangeListener historyCallChangeListener = + new HistoryCallChangeListener(); public HistoryService getHistoryService() { @@ -80,7 +82,7 @@ public HistoryService getHistoryService() * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByStartDate(MetaContact contact, Date startDate) + public Collection findByStartDate(MetaContact contact, Date startDate) throws RuntimeException { throw new UnsupportedOperationException("Not implemented yet!"); @@ -93,9 +95,10 @@ public Collection findByStartDate(MetaContact contact, Date startDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByStartDate(Date startDate) + public Collection findByStartDate(Date startDate) { - TreeSet result = new TreeSet(new CallRecordComparator()); + TreeSet result = + new TreeSet(new CallRecordComparator()); try { // the default ones @@ -128,7 +131,7 @@ public Collection findByStartDate(Date startDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByEndDate(MetaContact contact, Date endDate) + public Collection findByEndDate(MetaContact contact, Date endDate) throws RuntimeException { throw new UnsupportedOperationException("Not implemented yet!"); @@ -141,9 +144,9 @@ public Collection findByEndDate(MetaContact contact, Date endDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByEndDate(Date endDate) throws RuntimeException + public Collection findByEndDate(Date endDate) throws RuntimeException { - TreeSet result = new TreeSet(new CallRecordComparator()); + TreeSet result = new TreeSet(new CallRecordComparator()); try { // the default ones @@ -176,7 +179,7 @@ public Collection findByEndDate(Date endDate) throws RuntimeException * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByPeriod(MetaContact contact, Date startDate, Date endDate) + public Collection findByPeriod(MetaContact contact, Date startDate, Date endDate) throws RuntimeException { throw new UnsupportedOperationException("Not implemented yet!"); @@ -190,10 +193,10 @@ public Collection findByPeriod(MetaContact contact, Date startDate, Date endDate * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByPeriod(Date startDate, Date endDate) throws + public Collection findByPeriod(Date startDate, Date endDate) throws RuntimeException { - TreeSet result = new TreeSet(new CallRecordComparator()); + TreeSet result = new TreeSet(new CallRecordComparator()); try { // the default ones @@ -226,7 +229,7 @@ public Collection findByPeriod(Date startDate, Date endDate) throws * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findLast(MetaContact contact, int count) + public Collection findLast(MetaContact contact, int count) throws RuntimeException { throw new UnsupportedOperationException("Not implemented yet!"); @@ -239,9 +242,9 @@ public Collection findLast(MetaContact contact, int count) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findLast(int count) throws RuntimeException + public Collection findLast(int count) throws RuntimeException { - TreeSet result = new TreeSet(new CallRecordComparator()); + TreeSet result = new TreeSet(new CallRecordComparator()); try { // the default ones @@ -267,10 +270,10 @@ public Collection findLast(int count) throws RuntimeException * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByParticipant(String address) + public Collection findByParticipant(String address) throws RuntimeException { - TreeSet result = new TreeSet(new CallRecordComparator()); + TreeSet result = new TreeSet(new CallRecordComparator()); try { // the default ones @@ -335,14 +338,14 @@ private History getHistory(Contact localContact, Contact remoteContact) * @param hr HistoryRecord * @return Object CallRecord */ - private Object convertHistoryRecordToCallRecord(HistoryRecord hr) + private CallRecord convertHistoryRecordToCallRecord(HistoryRecord hr) { CallRecordImpl result = new CallRecordImpl(); - LinkedList callParticipantIDs = null; - LinkedList callParticipantStart = null; - LinkedList callParticipantEnd = null; - LinkedList callParticipantStates = null; + List callParticipantIDs = null; + List callParticipantStart = null; + List callParticipantEnd = null; + List callParticipantStates = null; // History structure // 0 - callStart @@ -373,18 +376,17 @@ else if(propName.equals(STRUCTURE_NAMES[6])) callParticipantStates = getStates(value); } - for (int i = 0; i < callParticipantIDs.size(); i++) + final int callParticipantCount = callParticipantIDs.size(); + for (int i = 0; i < callParticipantCount; i++) { - - CallParticipantRecordImpl cpr = new CallParticipantRecordImpl( - (String)callParticipantIDs.get(i), - new Date(Long.parseLong((String)callParticipantStart.get(i))), - new Date(Long.parseLong((String)callParticipantEnd.get(i))) - ); + CallParticipantRecordImpl cpr = + new CallParticipantRecordImpl(callParticipantIDs.get(i), + new Date(Long.parseLong(callParticipantStart.get(i))), + new Date(Long.parseLong(callParticipantEnd.get(i)))); // if there is no record about the states (backward compability) - if(callParticipantStates != null) - cpr.setState((CallParticipantState)callParticipantStates.get(i)); + if (callParticipantStates != null) + cpr.setState(callParticipantStates.get(i)); result.getParticipantRecords().add(cpr); } @@ -398,9 +400,9 @@ else if(propName.equals(STRUCTURE_NAMES[6])) * @param str String * @return LinkedList */ - private LinkedList getCSVs(String str) + private List getCSVs(String str) { - LinkedList result = new LinkedList(); + List result = new LinkedList(); StringTokenizer toks = new StringTokenizer(str, DELIM); while(toks.hasMoreTokens()) { @@ -411,20 +413,19 @@ private LinkedList getCSVs(String str) /** * Get the delimited strings and converts them to CallParticipantState + * * @param str String delimited string states * @return LinkedList the converted values list */ - private LinkedList getStates(String str) + private List getStates(String str) { - LinkedList result = new LinkedList(); - - LinkedList stateStrs = getCSVs(str); + List result = + new LinkedList(); + Collection stateStrs = getCSVs(str); - Iterator iter = stateStrs.iterator(); - while (iter.hasNext()) + for (String item : stateStrs) { - String item = (String) iter.next(); - result.addLast(convertStateStringToState(item)); + result.add(convertStateStringToState(item)); } return result; @@ -564,10 +565,10 @@ private void writeCall(CallRecord callRecord, Contact source, StringBuffer callParticipantEndTime = new StringBuffer(); StringBuffer callParticipantStates = new StringBuffer(); - Iterator iter = callRecord.getParticipantRecords().iterator(); - while (iter.hasNext()) + for (CallParticipantRecord item : callRecord + .getParticipantRecords()) { - if(callParticipantIDs.length() > 0) + if (callParticipantIDs.length() > 0) { callParticipantIDs.append(DELIM); callParticipantStartTime.append(DELIM); @@ -575,10 +576,11 @@ private void writeCall(CallRecord callRecord, Contact source, callParticipantStates.append(DELIM); } - CallParticipantRecord item = (CallParticipantRecord) iter.next(); callParticipantIDs.append(item.getParticipantAddress()); - callParticipantStartTime.append(String.valueOf(item.getStartTime().getTime())); - callParticipantEndTime.append(String.valueOf(item.getEndTime().getTime())); + callParticipantStartTime.append(String.valueOf(item + .getStartTime().getTime())); + callParticipantEndTime.append(String.valueOf(item.getEndTime() + .getTime())); callParticipantStates.append(item.getState().getStateString()); } @@ -718,10 +720,10 @@ private void handleProviderRemoved(ProtocolProviderService provider) public void addSearchProgressListener(CallHistorySearchProgressListener listener) { - synchronized(progressListeners){ - HistorySearchProgressListener wrapperListener = - new SearchProgressWrapper(listener); - progressListeners.put(listener, wrapperListener); + synchronized (progressListeners) + { + progressListeners + .put(listener, new SearchProgressWrapper(listener)); } } @@ -739,22 +741,19 @@ public void removeSearchProgressListener( } /** - * Add the registered CallHistorySearchProgressListeners - * to the given HistoryReader - * + * Add the registered CallHistorySearchProgressListeners to the given + * HistoryReader + * * @param reader HistoryReader * @param countContacts number of contacts will search */ - private void addHistorySearchProgressListeners( - HistoryReader reader, int countContacts) + private void addHistorySearchProgressListeners(HistoryReader reader, + int countContacts) { - synchronized(progressListeners) + synchronized (progressListeners) { - Iterator iter = progressListeners.values().iterator(); - while (iter.hasNext()) + for (SearchProgressWrapper l : progressListeners.values()) { - SearchProgressWrapper l = - (SearchProgressWrapper) iter.next(); l.contactCount = countContacts; reader.addSearchProgressListener(l); } @@ -762,20 +761,17 @@ private void addHistorySearchProgressListeners( } /** - * Removes the registered CallHistorySearchProgressListeners - * from the given HistoryReader - * + * Removes the registered CallHistorySearchProgressListeners from the given + * HistoryReader + * * @param reader HistoryReader */ private void removeHistorySearchProgressListeners(HistoryReader reader) { - synchronized(progressListeners) + synchronized (progressListeners) { - Iterator iter = progressListeners.values().iterator(); - while (iter.hasNext()) + for (SearchProgressWrapper l : progressListeners.values()) { - SearchProgressWrapper l = - (SearchProgressWrapper) iter.next(); l.clear(); reader.removeSearchProgressListener(l); } @@ -784,16 +780,18 @@ private void removeHistorySearchProgressListeners(HistoryReader reader) /** * Gets all the history readers for the contacts in the given MetaContact + * * @param contact MetaContact * @return Hashtable */ - private Hashtable getHistoryReaders(MetaContact contact) + private Map getHistoryReaders(MetaContact contact) { - Hashtable readers = new Hashtable(); - Iterator iter = contact.getContacts(); + Map readers = + new Hashtable(); + Iterator iter = contact.getContacts(); while (iter.hasNext()) { - Contact item = (Contact) iter.next(); + Contact item = iter.next(); try { @@ -929,17 +927,15 @@ private void handleParticipantRemoved(CallParticipant callParticipant, /** * Finding a CallRecord for the given call + * * @param call Call * @return CallRecord */ private CallRecordImpl findCallRecord(Call call) { - Iterator iter = currentCallRecords.iterator(); - - while (iter.hasNext()) + for (CallRecordImpl item : currentCallRecords) { - CallRecordImpl item = (CallRecordImpl) iter.next(); - if(item.getSourceCall().equals(call)) + if (item.getSourceCall().equals(call)) return item; } @@ -985,11 +981,10 @@ private void handleNewCall(Call sourceCall, String direction) currentCallRecords.add(newRecord); // if has already perticipants Dispatch them - Iterator iter = sourceCall.getCallParticipants(); + Iterator iter = sourceCall.getCallParticipants(); while (iter.hasNext()) { - CallParticipant item = (CallParticipant) iter.next(); - handleParticipantAdded(item); + handleParticipantAdded(iter.next()); } } @@ -1060,16 +1055,15 @@ void clear() } /** - * Used to compare CallRecords - * and to be ordered in TreeSet according their timestamp + * Used to compare CallRecords and to be ordered in TreeSet according their + * timestamp */ private class CallRecordComparator - implements Comparator + implements Comparator { - public int compare(Object o1, Object o2) + public int compare(CallRecord o1, CallRecord o2) { - return ((CallRecord)o2).getStartTime(). - compareTo(((CallRecord)o1).getStartTime()); + return o2.getStartTime().compareTo(o1.getStartTime()); } } diff --git a/src/net/java/sip/communicator/impl/callhistory/CallParticipantRecordImpl.java b/src/net/java/sip/communicator/impl/callhistory/CallParticipantRecordImpl.java index 9deb95882..02864b744 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallParticipantRecordImpl.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallParticipantRecordImpl.java @@ -1,3 +1,9 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ package net.java.sip.communicator.impl.callhistory; import java.util.*; diff --git a/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java b/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java index 8723fdf26..675889178 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallRecordImpl.java @@ -1,3 +1,9 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ package net.java.sip.communicator.impl.callhistory; import java.util.*; @@ -54,12 +60,12 @@ public void setEndTime(Date endTime) { this.endTime = endTime; - Iterator iter = participantRecords.iterator(); - while (iter.hasNext()) + for (CallParticipantRecord item : participantRecords) { - CallParticipantRecordImpl item = (CallParticipantRecordImpl) iter.next(); - if(item.getEndTime() == null) - item.setEndTime(endTime); + CallParticipantRecordImpl itemImpl = + (CallParticipantRecordImpl) item; + if (item.getEndTime() == null) + itemImpl.setEndTime(endTime); } } diff --git a/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java b/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java index 358fc94c0..818366e98 100644 --- a/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java +++ b/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java @@ -25,24 +25,24 @@ public class ChangeEventDispatcher /** * All property change listeners registered so far. */ - private Vector propertyChangeListeners; + private List propertyChangeListeners; /** * All listeners registered for vetoable change events. */ - private Vector vetoableChangeListeners; + private List vetoableChangeListeners; /** * Hashtable for managing property change listeners registered for specific * properties. Maps property names to PropertyChangeSupport objects. */ - private Hashtable propertyChangeChildren; + private Map propertyChangeChildren; /** * Hashtable for managing vetoable change listeners registered for specific * properties. Maps property names to PropertyChangeSupport objects. */ - private Hashtable vetoableChangeChildren; + private Map vetoableChangeChildren; /** * The object to be provided as the "source" for any generated events. @@ -74,10 +74,10 @@ public synchronized void addPropertyChangeListener( { if (propertyChangeListeners == null) { - propertyChangeListeners = new Vector(); + propertyChangeListeners = new Vector(); } - propertyChangeListeners.addElement(listener); + propertyChangeListeners.add(listener); } /** @@ -95,7 +95,8 @@ public synchronized void addPropertyChangeListener( { if (propertyChangeChildren == null) { - propertyChangeChildren = new Hashtable(); + propertyChangeChildren = + new Hashtable(); } ChangeEventDispatcher child = (ChangeEventDispatcher) propertyChangeChildren.get( propertyName); @@ -117,12 +118,10 @@ public synchronized void addPropertyChangeListener( public synchronized void removePropertyChangeListener( PropertyChangeListener listener) { - - if (propertyChangeListeners == null) + if (propertyChangeListeners != null) { - return; + propertyChangeListeners.remove(listener); } - propertyChangeListeners.removeElement(listener); } /** @@ -139,8 +138,7 @@ public synchronized void removePropertyChangeListener( { return; } - ChangeEventDispatcher child = (ChangeEventDispatcher) - propertyChangeChildren.get( propertyName ); + ChangeEventDispatcher child = propertyChangeChildren.get(propertyName); if (child == null) { @@ -160,10 +158,10 @@ public synchronized void addVetoableChangeListener( { if (vetoableChangeListeners == null) { - vetoableChangeListeners = new Vector(); + vetoableChangeListeners = new Vector(); } - vetoableChangeListeners.addElement(listener); + vetoableChangeListeners.add(listener); } /** @@ -176,12 +174,10 @@ public synchronized void addVetoableChangeListener( public synchronized void removeVetoableChangeListener( VetoableChangeListener listener) { - - if (vetoableChangeListeners == null) + if (vetoableChangeListeners != null) { - return; + vetoableChangeListeners.remove(listener); } - vetoableChangeListeners.removeElement(listener); } /** @@ -199,10 +195,9 @@ public synchronized void addVetoableChangeListener( { if (vetoableChangeChildren == null) { - vetoableChangeChildren = new Hashtable(); + vetoableChangeChildren = new Hashtable(); } - ChangeEventDispatcher child = (ChangeEventDispatcher) vetoableChangeChildren.get( - propertyName); + ChangeEventDispatcher child = vetoableChangeChildren.get(propertyName); if (child == null) { child = new ChangeEventDispatcher(source); @@ -225,8 +220,7 @@ public synchronized void removeVetoableChangeListener( { return; } - ChangeEventDispatcher child = (ChangeEventDispatcher) - vetoableChangeChildren.get( propertyName ); + ChangeEventDispatcher child = vetoableChangeChildren.get( propertyName ); if (child == null) { @@ -287,27 +281,29 @@ public void fireVetoableChange(PropertyChangeEvent evt) throws return; } - Vector targets = null; + VetoableChangeListener[] targets = null; ChangeEventDispatcher child = null; synchronized (this) { if (vetoableChangeListeners != null) { - targets = (Vector) vetoableChangeListeners.clone(); + targets = + vetoableChangeListeners + .toArray(new VetoableChangeListener[vetoableChangeListeners + .size()]); } if (vetoableChangeChildren != null && propertyName != null) { - child = (ChangeEventDispatcher)vetoableChangeChildren.get(propertyName); + child = vetoableChangeChildren.get(propertyName); } } if (vetoableChangeListeners != null) { - for (int i = 0; i < targets.size(); i++) + for (int i = 0; i < targets.length; i++) { - VetoableChangeListener target = - (VetoableChangeListener) targets.elementAt(i); - //don't catch the exception - let it bounce to the caller. + VetoableChangeListener target = targets[i]; + // don't catch the exception - let it bounce to the caller. target.vetoableChange(evt); } } @@ -357,19 +353,16 @@ public void firePropertyChange(PropertyChangeEvent evt) if (propertyChangeListeners != null) { - Iterator iterator = propertyChangeListeners.iterator(); - while (iterator.hasNext()) + for (PropertyChangeListener target : propertyChangeListeners) { - PropertyChangeListener target = - (PropertyChangeListener) iterator.next(); target.propertyChange(evt); } } if (propertyChangeChildren != null && propertyName != null) { - ChangeEventDispatcher child = null; - child = (ChangeEventDispatcher) propertyChangeChildren.get(propertyName); + ChangeEventDispatcher child = + propertyChangeChildren.get(propertyName); if (child != null) { child.firePropertyChange(evt); @@ -393,8 +386,8 @@ public synchronized boolean hasPropertyChangeListeners(String propertyName) } if (propertyChangeChildren != null) { - ChangeEventDispatcher child = (ChangeEventDispatcher) propertyChangeChildren.get( - propertyName); + ChangeEventDispatcher child = + propertyChangeChildren.get(propertyName); if (child != null && child.propertyChangeListeners != null) { return!child.propertyChangeListeners.isEmpty(); @@ -419,7 +412,7 @@ public synchronized boolean hasVetoableChangeListeners(String propertyName) } if (vetoableChangeChildren != null) { - ChangeEventDispatcher child = (ChangeEventDispatcher) + ChangeEventDispatcher child = vetoableChangeChildren.get(propertyName); if (child != null && child.vetoableChangeListeners != null) diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java index e08bd69e4..574571254 100644 --- a/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java +++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java @@ -6,12 +6,14 @@ */ package net.java.sip.communicator.impl.configuration; +import java.util.*; + import org.osgi.framework.*; + import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.util.*; /** - * * @author Emil Ivov */ public class ConfigurationActivator @@ -22,7 +24,7 @@ public class ConfigurationActivator */ public static BundleContext bundleContext; - private Logger logger = Logger.getLogger(ConfigurationServiceImpl.class); + private final Logger logger = Logger.getLogger(ConfigurationServiceImpl.class); private ConfigurationServiceImpl impl = new ConfigurationServiceImpl(); /** @@ -36,12 +38,12 @@ public void start(BundleContext bundleContext) throws Exception { logger.debug("Service Impl: " + getClass().getName() + " [ STARTED ]"); - this.bundleContext = bundleContext; + ConfigurationActivator.bundleContext = bundleContext; impl.start(); bundleContext.registerService(ConfigurationService.class.getName(), impl, - new java.util.Hashtable()); + new Hashtable()); logger.debug("Service Impl: " + getClass().getName() + " [REGISTERED]"); } diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java index 4993d3d87..07f31c44c 100644 --- a/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationServiceImpl.java @@ -11,9 +11,6 @@ import javax.xml.parsers.*; -import org.osgi.framework.*; -import org.w3c.dom.*; -import org.xml.sax.*; import net.java.sip.communicator.impl.configuration.xml.*; import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.configuration.event.*; @@ -21,6 +18,10 @@ import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.xml.*; +import org.osgi.framework.*; +import org.w3c.dom.*; +import org.xml.sax.*; + /** * A straight forward implementation of the ConfigurationService using an xml * file for storing properties. Currently only String properties are @@ -34,7 +35,7 @@ public class ConfigurationServiceImpl implements ConfigurationService { - private Logger logger = Logger.getLogger(ConfigurationServiceImpl.class); + private final Logger logger = Logger.getLogger(ConfigurationServiceImpl.class); /** * The XML Document containing the configuration file this service loaded. @@ -71,13 +72,13 @@ public class ConfigurationServiceImpl /** * Our event dispatcher. */ - private ChangeEventDispatcher changeEventDispatcher = + private final ChangeEventDispatcher changeEventDispatcher = new ChangeEventDispatcher(this); /** * The list of properties currently registered in the configuration service. */ - private Map properties = new Hashtable(); + private Map properties = new Hashtable(); /** * Contains the properties that were initially loaded from the configuration @@ -86,8 +87,9 @@ public class ConfigurationServiceImpl * that we could determine which properties are new and do not have a * corresponding node in the XMLDocument object. */ - private Map fileExtractedProperties = new Hashtable(); - + private Map fileExtractedProperties = + new Hashtable(); + /** * Indicates whether the service is started or stopped. */ @@ -215,16 +217,12 @@ public void setProperty(String propertyName, Object property, public void removeProperty(String propertyName) throws PropertyVetoException { - List childPropertyNames = + List childPropertyNames = getPropertyNamesByPrefix(propertyName, false); - - Iterator propsIter = childPropertyNames.iterator(); //remove all properties - while (propsIter.hasNext()) + for (String pName : childPropertyNames) { - String pName = (String) propsIter.next(); - removeProperty(pName); } @@ -306,14 +304,12 @@ public Object getProperty(String propertyName) * @return a java.util.Listcontaining all property name String-s * matching the specified conditions. */ - public List getPropertyNamesByPrefix(String prefix, boolean exactPrefixMatch) + public List getPropertyNamesByPrefix(String prefix, boolean exactPrefixMatch) { - LinkedList resultKeySet = new LinkedList(); - Iterator keys = properties.keySet().iterator(); + List resultKeySet = new LinkedList(); - while(keys.hasNext()) + for (String key : properties.keySet()) { - String key = (String)keys.next(); int ix = key.lastIndexOf('.'); if(ix == -1) @@ -472,7 +468,7 @@ void start() public void reloadConfiguration() throws IOException, XMLException { - properties = new Hashtable(); + properties = new Hashtable(); this.configurationFile = null; fileExtractedProperties = @@ -490,7 +486,7 @@ public void reloadConfiguration() * @throws IOException if the specified file does not exist * @throws XMLException if there is a problem with the file syntax. */ - Map loadConfiguration(File file) + Map loadConfiguration(File file) throws IOException, XMLException { // restore the file if needed @@ -508,7 +504,7 @@ Map loadConfiguration(File file) DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); - Map properties = new Hashtable(); + Map properties = new Hashtable(); //if the file is empyt (or contains only sth insignificant) //ifnore it and create a new document. @@ -545,7 +541,7 @@ Map loadConfiguration(File file) //it is not highly probable that this might happen - so lets just //log it. logger.error("Error finding configuration for default parsers", ex); - return new Hashtable(); + return new Hashtable(); } } @@ -614,12 +610,11 @@ private void storeConfiguration(File file) //create in the document the properties that were added by other //bundles after the initial property load. - Map newlyAddedProperties = cloneProperties(); + Map newlyAddedProperties = cloneProperties(); //remove those that were originally there; - Iterator propNames = fileExtractedProperties.keySet().iterator(); - while (propNames.hasNext()) - newlyAddedProperties.remove(propNames.next()); + for (String propName : fileExtractedProperties.keySet()) + newlyAddedProperties.remove(propName); this.processNewProperties(propertiesDocument, newlyAddedProperties); @@ -653,7 +648,7 @@ private void storeConfiguration(File file) */ private void loadNode(Node node, StringBuffer propertyNameBuff, - Map properties) + Map properties) { Node currentNode = null; NodeList children = node.getChildNodes(); @@ -696,7 +691,6 @@ private void loadNode(Node node, //load child nodes loadNode(currentNode, newPropBuff, properties); - } } } @@ -716,7 +710,7 @@ private void loadNode(Node node, */ private void updateNode(Node node, StringBuffer propertyNameBuff, - Map properties) + Map properties) { Node currentNode = null; NodeList children = node.getChildNodes(); @@ -955,22 +949,21 @@ File createConfigurationFile() } /** - * Creates new entries in the xml doc for every element in the + * Creates new entries in the XML doc for every element in the * newProperties table. - * + * * @param doc the XML Document where the new entries should be - * created + * created * @param newProperties the table containing the properties that are to be - * in troduced in the document. + * introduced in the document. */ private void processNewProperties(Document doc, - Map newProperties) + Map newProperties) { - Iterator propNames = newProperties.keySet().iterator(); - while(propNames.hasNext()) + for (Map.Entry entry : newProperties.entrySet()) { - String key = (String)propNames.next(); - Object value = newProperties.get(key); + String key = entry.getKey(); + Object value = entry.getValue(); boolean isSystem = value instanceof PropertyReference; value = isSystem ?((PropertyReference)value).getValue() @@ -1114,21 +1107,21 @@ public Object getValue() * Returns a copy of the Map containing all configuration properties * @return a Map clone of the current configuration property set. */ - private Map cloneProperties() + private Map cloneProperties() { - //at the time I'm writing this method we're implementing the - //configuration service through the use of a hashtable. this may very - //well change one day so let's not be presumptuous - if(properties instanceof Hashtable) - return (Map)((Hashtable)properties).clone(); - if(properties instanceof HashMap) - return (Map)((HashMap)properties).clone(); - if(properties instanceof TreeMap) - return (Map)((TreeMap)properties).clone(); - - //well you can't say that I didn't try!!! - - return new Hashtable(properties); + // at the time I'm writing this method we're implementing the + // configuration service through the use of a hashtable. this may very + // well change one day so let's not be presumptuous + if (properties instanceof Hashtable) + return (Map) ((Hashtable) properties).clone(); + if (properties instanceof HashMap) + return (Map) ((HashMap) properties).clone(); + if (properties instanceof TreeMap) + return (Map) ((TreeMap) properties).clone(); + + // well you can't say that I didn't try!!! + + return new Hashtable(properties); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java index c2c67b2ae..eb275ea92 100644 --- a/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java +++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountRegWizardContainerImpl.java @@ -198,15 +198,13 @@ public void saveAccountWizard(ProtocolProviderService protocolProvider, { String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService.getPropertyNamesByPrefix(prefix, true); + List accounts = + configService.getPropertyNamesByPrefix(prefix, true); boolean savedAccount = false; - Iterator accountsIter = accounts.iterator(); - while (accountsIter.hasNext()) + for (String accountRootPropName : accounts) { - String accountRootPropName = (String) accountsIter.next(); - String accountUID = configService.getString(accountRootPropName); if (accountUID.equals(protocolProvider.getAccountID() diff --git a/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java b/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java index 9f3dd772c..24e45fc3a 100644 --- a/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java +++ b/src/net/java/sip/communicator/impl/gui/main/account/AccountsConfigurationForm.java @@ -16,7 +16,6 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.i18n.*; -import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.protocol.*; diff --git a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomList.java b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomList.java index 6874936c5..50a89a5de 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomList.java +++ b/src/net/java/sip/communicator/impl/gui/main/chatroomslist/ChatRoomList.java @@ -92,32 +92,22 @@ public void addChatProvider(ProtocolProviderService pps) String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService - .getPropertyNamesByPrefix(prefix, true); - - Iterator accountsIter = accounts.iterator(); - - while(accountsIter.hasNext()) { - String accountRootPropName - = (String) accountsIter.next(); + List accounts = + configService.getPropertyNamesByPrefix(prefix, true); + for (String accountRootPropName : accounts) { String accountUID = configService.getString(accountRootPropName); if(accountUID.equals(pps .getAccountID().getAccountUniqueID())) { - List chatRooms = configService + List chatRooms = configService .getPropertyNamesByPrefix( accountRootPropName + ".chatRooms", true); - Iterator chatRoomsIter = chatRooms.iterator(); - - while(chatRoomsIter.hasNext()) + for (String chatRoomPropName : chatRooms) { - String chatRoomPropName - = (String) chatRoomsIter.next(); - String chatRoomID = configService.getString(chatRoomPropName); diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java index f1249de50..eccce7d45 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/GlobalStatusSelectorBox.java @@ -737,14 +737,10 @@ public String getLastStatusString(ProtocolProviderService protocolProvider) String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService.getPropertyNamesByPrefix(prefix, true); + List accounts = configService.getPropertyNamesByPrefix(prefix, true); - Iterator accountsIter = accounts.iterator(); - - while (accountsIter.hasNext()) + for (String accountRootPropName : accounts) { - String accountRootPropName = (String) accountsIter.next(); - String accountUID = configService.getString(accountRootPropName); if (accountUID.equals(protocolProvider.getAccountID() diff --git a/src/net/java/sip/communicator/impl/gui/main/presence/StatusSelectorMenu.java b/src/net/java/sip/communicator/impl/gui/main/presence/StatusSelectorMenu.java index f2879c108..67df7a09d 100644 --- a/src/net/java/sip/communicator/impl/gui/main/presence/StatusSelectorMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/presence/StatusSelectorMenu.java @@ -80,16 +80,12 @@ protected void saveStatusInformation( String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService + List accounts = configService .getPropertyNamesByPrefix(prefix, true); boolean savedAccount = false; - Iterator accountsIter = accounts.iterator(); - - while(accountsIter.hasNext()) { - String accountRootPropName - = (String) accountsIter.next(); + for (String accountRootPropName : accounts) { String accountUID = configService.getString(accountRootPropName); diff --git a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java index 457677e82..4c876c8ac 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ConfigurationManager.java @@ -618,35 +618,25 @@ public static void saveChatRoom( ProtocolProviderService protocolProvider, { String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService + List accounts = configService .getPropertyNamesByPrefix(prefix, true); - Iterator accountsIter = accounts.iterator(); - - while(accountsIter.hasNext()) + for (String accountRootPropName : accounts) { - String accountRootPropName - = (String) accountsIter.next(); - String accountUID = configService.getString(accountRootPropName); if(accountUID.equals(protocolProvider .getAccountID().getAccountUniqueID())) { - List chatRooms = configService + List chatRooms = configService .getPropertyNamesByPrefix( accountRootPropName + ".chatRooms", true); - Iterator chatRoomsIter = chatRooms.iterator(); - boolean isExistingChatRoom = false; - while(chatRoomsIter.hasNext()) + for (String chatRoomPropName : chatRooms) { - String chatRoomPropName - = (String) chatRoomsIter.next(); - String chatRoomID = configService.getString(chatRoomPropName); @@ -698,33 +688,23 @@ public static void updateChatRoomStatus( { String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService + List accounts = configService .getPropertyNamesByPrefix(prefix, true); - Iterator accountsIter = accounts.iterator(); - - while(accountsIter.hasNext()) + for (String accountRootPropName : accounts) { - String accountRootPropName - = (String) accountsIter.next(); - String accountUID = configService.getString(accountRootPropName); if(accountUID.equals(protocolProvider .getAccountID().getAccountUniqueID())) { - List chatRooms = configService + List chatRooms = configService .getPropertyNamesByPrefix( accountRootPropName + ".chatRooms", true); - Iterator chatRoomsIter = chatRooms.iterator(); - - while(chatRoomsIter.hasNext()) + for (String chatRoomPropName : chatRooms) { - String chatRoomPropName - = (String) chatRoomsIter.next(); - String chatRoomID = configService.getString(chatRoomPropName); @@ -755,33 +735,23 @@ public static String getChatRoomStatus( { String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService + List accounts = configService .getPropertyNamesByPrefix(prefix, true); - Iterator accountsIter = accounts.iterator(); - - while(accountsIter.hasNext()) + for (String accountRootPropName : accounts) { - String accountRootPropName - = (String) accountsIter.next(); - String accountUID = configService.getString(accountRootPropName); if(accountUID.equals(protocolProvider .getAccountID().getAccountUniqueID())) { - List chatRooms = configService + List chatRooms = configService .getPropertyNamesByPrefix( accountRootPropName + ".chatRooms", true); - Iterator chatRoomsIter = chatRooms.iterator(); - - while(chatRoomsIter.hasNext()) + for (String chatRoomPropName : chatRooms) { - String chatRoomPropName - = (String) chatRoomsIter.next(); - String chatRoomID = configService.getString(chatRoomPropName); @@ -802,17 +772,12 @@ public static void storeContactListGroupStatus( String groupID, { String prefix = "net.java.sip.communicator.impl.gui.contactlist.groups"; - List groups = configService + List groups = configService .getPropertyNamesByPrefix(prefix, true); - Iterator groupsIter = groups.iterator(); - boolean isExistingGroup = false; - while(groupsIter.hasNext()) + for (String groupRootPropName : groups) { - String groupRootPropName - = (String) groupsIter.next(); - String storedID = configService.getString(groupRootPropName); @@ -847,16 +812,10 @@ public static boolean getContactListGroupStatus(String groupID) { String prefix = "net.java.sip.communicator.impl.gui.contactlist.groups"; - List groups = configService + List groups = configService .getPropertyNamesByPrefix(prefix, true); - - Iterator groupsIter = groups.iterator(); - - while(groupsIter.hasNext()) + for (String groupRootPropName : groups) { - String groupRootPropName - = (String) groupsIter.next(); - String storedID = configService.getString(groupRootPropName); diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java index b7e2b60cb..d968cf7b8 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java @@ -22,17 +22,18 @@ public class NotificationServiceImpl implements NotificationService { - private Logger logger = Logger.getLogger(NotificationServiceImpl.class); - + private final Logger logger = + Logger.getLogger(NotificationServiceImpl.class); + private static String NOTIFICATIONS_PREFIX = "net.java.sip.communicator.impl.notifications"; /** * A set of all registered event notifications. */ - private Hashtable notificationsTable = new Hashtable(); - - + private final Hashtable notificationsTable = + new Hashtable(); + /** * A set of all registered event notifications. */ @@ -453,16 +454,11 @@ private void saveNotification( String eventType, String eventTypeNodeName = null; String actionTypeNodeName = null; - List eventTypes = configService + List eventTypes = configService .getPropertyNamesByPrefix(NOTIFICATIONS_PREFIX, true); - - Iterator eventTypesIter = eventTypes.iterator(); - - while(eventTypesIter.hasNext()) + + for (String eventTypeRootPropName : eventTypes) { - String eventTypeRootPropName - = (String) eventTypesIter.next(); - String eType = configService.getString(eventTypeRootPropName); @@ -494,16 +490,11 @@ private void saveNotification( String eventType, // Go through contained actions. String actionPrefix = eventTypeNodeName + ".actions"; - List actionTypes = configService + List actionTypes = configService .getPropertyNamesByPrefix(actionPrefix, true); - - Iterator actionTypesIter = actionTypes.iterator(); - - while(actionTypesIter.hasNext()) + + for (String actionTypeRootPropName : actionTypes) { - String actionTypeRootPropName - = (String) actionTypesIter.next(); - String aType = configService.getString(actionTypeRootPropName); @@ -601,33 +592,23 @@ else if(actionHandler instanceof CommandNotificationHandler) */ private void loadNotifications() { - List eventTypes = configService + List eventTypes = configService .getPropertyNamesByPrefix(NOTIFICATIONS_PREFIX, true); - - Iterator eventTypesIter = eventTypes.iterator(); - - while(eventTypesIter.hasNext()) + + for (String eventTypeRootPropName : eventTypes) { - String eventTypeRootPropName - = (String) eventTypesIter.next(); - boolean isEventActive = isEnabled(eventTypeRootPropName + ".active"); String eventType = configService.getString(eventTypeRootPropName); - List actions = configService + List actions = configService .getPropertyNamesByPrefix( eventTypeRootPropName + ".actions", true); - - Iterator actionsIter = actions.iterator(); - while(actionsIter.hasNext()) + for (String actionPropName : actions) { - String actionPropName - = (String) actionsIter.next(); - String actionType = configService.getString(actionPropName); @@ -722,7 +703,7 @@ private boolean isEnabled(String configProperty) public void setActive(String eventType, boolean isActive) { EventNotification eventNotification - = (EventNotification) notificationsTable.get(eventType); + = notificationsTable.get(eventType); if(eventNotification == null) return; @@ -841,33 +822,23 @@ else if (eventType.equals( private boolean isDefault(String eventType, String actionType) { - List eventTypes = configService + List eventTypes = configService .getPropertyNamesByPrefix(NOTIFICATIONS_PREFIX, true); - - Iterator eventTypesIter = eventTypes.iterator(); - - while(eventTypesIter.hasNext()) + + for (String eventTypeRootPropName : eventTypes) { - String eventTypeRootPropName - = (String) eventTypesIter.next(); - String eType = configService.getString(eventTypeRootPropName); if(!eType.equals(eventType)) continue; - List actions = configService + List actions = configService .getPropertyNamesByPrefix( eventTypeRootPropName + ".actions", true); - - Iterator actionsIter = actions.iterator(); - while(actionsIter.hasNext()) + for (String actionPropName : actions) { - String actionPropName - = (String) actionsIter.next(); - String aType = configService.getString(actionPropName); diff --git a/src/net/java/sip/communicator/service/callhistory/CallHistoryService.java b/src/net/java/sip/communicator/service/callhistory/CallHistoryService.java index a093e3245..8c1566162 100644 --- a/src/net/java/sip/communicator/service/callhistory/CallHistoryService.java +++ b/src/net/java/sip/communicator/service/callhistory/CallHistoryService.java @@ -8,8 +8,8 @@ import java.util.*; -import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.callhistory.event.*; +import net.java.sip.communicator.service.contactlist.*; /** * The Call History Service stores info about calls made from various protocols @@ -29,7 +29,7 @@ public interface CallHistoryService * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByStartDate(MetaContact contact, Date startDate) + public Collection findByStartDate(MetaContact contact, Date startDate) throws RuntimeException; /** @@ -42,7 +42,7 @@ public Collection findByStartDate(MetaContact contact, Date startDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByEndDate(MetaContact contact, Date endDate) + public Collection findByEndDate(MetaContact contact, Date endDate) throws RuntimeException; /** @@ -56,7 +56,7 @@ public Collection findByEndDate(MetaContact contact, Date endDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByPeriod(MetaContact contact, Date startDate, Date endDate) + public Collection findByPeriod(MetaContact contact, Date startDate, Date endDate) throws RuntimeException; @@ -67,7 +67,7 @@ public Collection findByPeriod(MetaContact contact, Date startDate, Date endDate * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByStartDate(Date startDate) + public Collection findByStartDate(Date startDate) throws RuntimeException; /** @@ -77,7 +77,7 @@ public Collection findByStartDate(Date startDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByEndDate(Date endDate) + public Collection findByEndDate(Date endDate) throws RuntimeException; /** @@ -88,7 +88,7 @@ public Collection findByEndDate(Date endDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByPeriod(Date startDate, Date endDate) + public Collection findByPeriod(Date startDate, Date endDate) throws RuntimeException; /** @@ -101,7 +101,7 @@ public Collection findByPeriod(Date startDate, Date endDate) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findLast(MetaContact contact, int count) + public Collection findLast(MetaContact contact, int count) throws RuntimeException; /** @@ -112,7 +112,7 @@ public Collection findLast(MetaContact contact, int count) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findLast(int count) + public Collection findLast(int count) throws RuntimeException; /** @@ -121,7 +121,7 @@ public Collection findLast(int count) * @return Collection of CallRecords with CallParticipantRecord * @throws RuntimeException */ - public Collection findByParticipant(String address) + public Collection findByParticipant(String address) throws RuntimeException; /** diff --git a/src/net/java/sip/communicator/service/callhistory/CallRecord.java b/src/net/java/sip/communicator/service/callhistory/CallRecord.java index 4232fceac..f9aafa6d7 100644 --- a/src/net/java/sip/communicator/service/callhistory/CallRecord.java +++ b/src/net/java/sip/communicator/service/callhistory/CallRecord.java @@ -18,7 +18,10 @@ public class CallRecord public final static String IN = "in"; protected String direction = null; - protected Vector participantRecords = new Vector(); + + protected final List participantRecords = + new Vector(); + protected Date startTime = null; protected Date endTime = null; @@ -47,15 +50,14 @@ public CallRecord( /** * Finds a Participant with the supplied address + * * @param address String * @return CallParticipantRecord */ public CallParticipantRecord findParticipantRecord(String address) { - Iterator iter = participantRecords.iterator(); - while (iter.hasNext()) + for (CallParticipantRecord item : participantRecords) { - CallParticipantRecord item = (CallParticipantRecord) iter.next(); if (item.getParticipantAddress().equals(address)) return item; } @@ -86,7 +88,7 @@ public Date getEndTime() * Return Vector of CallParticipantRecords * @return Vector */ - public Vector getParticipantRecords() + public List getParticipantRecords() { return participantRecords; } diff --git a/src/net/java/sip/communicator/service/configuration/ConfigurationService.java b/src/net/java/sip/communicator/service/configuration/ConfigurationService.java index bbdedc069..6b6f5ad80 100644 --- a/src/net/java/sip/communicator/service/configuration/ConfigurationService.java +++ b/src/net/java/sip/communicator/service/configuration/ConfigurationService.java @@ -131,7 +131,7 @@ public void removeProperty(String propertyName) * @return a java.util.Listcontaining all property name String-s * matching the specified conditions. */ - public List getPropertyNamesByPrefix(String prefix, + public List getPropertyNamesByPrefix(String prefix, boolean exactPrefixMatch); /** diff --git a/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java b/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java index 447b1ac59..d30bb9a28 100644 --- a/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java +++ b/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java @@ -245,7 +245,7 @@ public void testGetPropertyNamesByPrefix() throws PropertyVetoException , new Object()); //try an exact match first - List propertyNames + List propertyNames = configurationService.getPropertyNamesByPrefix(prefix, true); assertTrue("Returned list did not contain all property names. "