From 238a7494c27f1a426c3fc24908e288ebf761fe75 Mon Sep 17 00:00:00 2001 From: Werner Dittmann Date: Thu, 3 Jun 2010 18:34:43 +0000 Subject: [PATCH] Fix logger usage - sixth bunch. --- .../osdependent/OsDependentActivator.java | 12 +- .../impl/osdependent/jdic/StatusSelector.java | 3 +- .../jdic/SystrayServiceJdicImpl.java | 15 ++- .../GeolocationPacketExtensionProvider.java | 6 +- .../mailnotification/MailboxIQ.java | 3 +- .../mailnotification/MailboxIQProvider.java | 3 +- .../mailnotification/MailboxQueryIQ.java | 3 +- .../NewMailNotificationIQ.java | 3 +- .../NewMailNotificationProvider.java | 3 +- .../thumbnail/ThumbnailElement.java | 18 ++- .../WhiteboardObjectCircleJabberImpl.java | 9 +- .../WhiteboardObjectImageJabberImpl.java | 9 +- .../WhiteboardObjectLineJabberImpl.java | 9 +- .../WhiteboardObjectPacketExtension.java | 12 +- .../WhiteboardObjectPathJabberImpl.java | 9 +- .../WhiteboardObjectPolyLineJabberImpl.java | 9 +- .../WhiteboardObjectPolygonJabberImpl.java | 9 +- .../WhiteboardObjectRectJabberImpl.java | 9 +- .../WhiteboardObjectTextJabberImpl.java | 9 +- .../WhiteboardSessionPacketExtension.java | 12 +- .../jabber/mediamgr/AudioMediaSession.java | 3 +- .../protocol/jabber/mediamgr/MediaUtils.java | 6 +- .../impl/protocol/mock/MockCall.java | 3 +- .../mock/MockOperationSetBasicTelephony.java | 12 +- .../protocol/msn/AdHocChatRoomMsnImpl.java | 6 +- .../impl/protocol/msn/EventManager.java | 6 +- .../IncomingFileTransferRequestMsnImpl.java | 3 +- ...OperationSetAdHocMultiUserChatMsnImpl.java | 3 +- ...rationSetBasicInstantMessagingMsnImpl.java | 12 +- .../msn/OperationSetFileTransferMsnImpl.java | 3 +- ...OperationSetPersistentPresenceMsnImpl.java | 21 ++- ...perationSetTypingNotificationsMsnImpl.java | 3 +- .../msn/ProtocolProviderServiceMsnImpl.java | 6 +- .../msn/ServerStoredContactListMsnImpl.java | 123 ++++++++++++------ .../impl/protocol/rss/ImageRetriever.java | 24 ++-- ...rationSetBasicInstantMessagingRssImpl.java | 12 +- ...OperationSetPersistentPresenceRssImpl.java | 12 +- .../rss/ProtocolProviderServiceRssImpl.java | 6 +- .../impl/protocol/rss/RssActivator.java | 6 +- .../protocol/rss/RssTimerRefreshFeed.java | 3 +- .../impl/protocol/rss/UriHandlerRssImpl.java | 3 +- .../protocol/sip/EventPackageSupport.java | 3 +- .../sip/ProtocolProviderServiceSipImpl.java | 3 +- .../impl/protocol/sip/SipLogger.java | 9 +- .../impl/protocol/sip/dtmf/DTMFInfo.java | 27 ++-- .../impl/protocol/sip/sdp/SdpUtils.java | 42 ++++-- .../sip/security/MessageDigestAlgorithm.java | 3 +- .../sip/security/SipSecurityManager.java | 21 ++- .../impl/protocol/ssh/ContactSSHImpl.java | 3 +- .../protocol/ssh/ContactTimerSSHImpl.java | 6 +- .../ssh/ProtocolProviderServiceSSHImpl.java | 18 ++- .../impl/protocol/ssh/SSHActivator.java | 6 +- .../protocol/ssh/SSHFileTransferDaemon.java | 3 +- .../yahoo/AdHocChatRoomYahooImpl.java | 15 ++- .../impl/protocol/yahoo/ContactYahooImpl.java | 6 +- ...erationSetAdHocMultiUserChatYahooImpl.java | 39 ++++-- ...tionSetBasicInstantMessagingYahooImpl.java | 21 ++- .../OperationSetFileTransferYahooImpl.java | 3 +- ...erationSetPersistentPresenceYahooImpl.java | 21 ++- ...rationSetTypingNotificationsYahooImpl.java | 3 +- .../ServerStoredContactListYahooImpl.java | 93 ++++++++----- .../protocol/zeroconf/BonjourService.java | 57 +++++--- .../impl/protocol/zeroconf/ClientThread.java | 21 ++- ...nSetBasicInstantMessagingZeroconfImpl.java | 3 +- ...tionSetPersistentPresenceZeroconfImpl.java | 3 +- .../ProtocolProviderServiceZeroconfImpl.java | 9 +- .../protocol/zeroconf/ZeroconfActivator.java | 6 +- .../protocol/zeroconf/jmdns/DNSCache.java | 18 +-- .../impl/protocol/zeroconf/jmdns/JmDNS.java | 111 ++++++++++------ 69 files changed, 674 insertions(+), 340 deletions(-) diff --git a/src/net/java/sip/communicator/impl/osdependent/OsDependentActivator.java b/src/net/java/sip/communicator/impl/osdependent/OsDependentActivator.java index 0fae34315..668d6d85f 100644 --- a/src/net/java/sip/communicator/impl/osdependent/OsDependentActivator.java +++ b/src/net/java/sip/communicator/impl/osdependent/OsDependentActivator.java @@ -55,26 +55,30 @@ public void start(BundleContext bc) // Create the notification service implementation SystrayService systrayService = new SystrayServiceJdicImpl(); - logger.info("Systray Service...[ STARTED ]"); + if (logger.isInfoEnabled()) + logger.info("Systray Service...[ STARTED ]"); bundleContext.registerService( SystrayService.class.getName(), systrayService, null); - logger.info("Systray Service ...[REGISTERED]"); + if (logger.isInfoEnabled()) + logger.info("Systray Service ...[REGISTERED]"); // Create the desktop service implementation DesktopService desktopService = new DesktopServiceImpl(); - logger.info("Desktop Service...[ STARTED ]"); + if (logger.isInfoEnabled()) + logger.info("Desktop Service...[ STARTED ]"); bundleContext.registerService( DesktopService.class.getName(), desktopService, null); - logger.info("Desktop Service ...[REGISTERED]"); + if (logger.isInfoEnabled()) + logger.info("Desktop Service ...[REGISTERED]"); logger.logEntry(); } diff --git a/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java b/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java index 309de4dce..0f29a18da 100644 --- a/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java +++ b/src/net/java/sip/communicator/impl/osdependent/jdic/StatusSelector.java @@ -184,7 +184,8 @@ else if (!status.isOnline() public void updateStatus(PresenceStatus presenceStatus) { - logger.trace("Systray update status for provider: " + if (logger.isTraceEnabled()) + logger.trace("Systray update status for provider: " + provider.getAccountID().getAccountAddress() + ". The new status will be: " + presenceStatus.getStatusName()); diff --git a/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java b/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java index 7bef75794..1859035ee 100644 --- a/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java +++ b/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java @@ -314,7 +314,8 @@ public void popupMenuCanceled(PopupMenuEvent e) if (!popupHandlerSet.containsKey(handlerName)) { popupHandlerSet.put(handlerName, handler); - logger.info("added the following popup handler : " + + if (logger.isInfoEnabled()) + logger.info("added the following popup handler : " + handler); if (configuredHandler != null && configuredHandler.equals(handler.getClass().getName())) @@ -573,7 +574,8 @@ public PopupMessageHandler setActivePopupMessageHandler( { newHandler.addPopupMessageListener(popupMessageListener); } - logger.info( + if (logger.isInfoEnabled()) + logger.info( "setting the following popup handler as active : " + newHandler); activePopupHandler = newHandler; @@ -658,7 +660,8 @@ public void serviceChanged(ServiceEvent serviceEvent) if (!popupHandlerSet.containsKey( handler.getClass().getName())) { - logger.info( + if (logger.isInfoEnabled()) + logger.info( "adding the following popup handler : " + handler); popupHandlerSet.put( handler.getClass().getName(), handler); @@ -686,7 +689,8 @@ public void serviceChanged(ServiceEvent serviceEvent) } } else if (serviceEvent.getType() == ServiceEvent.UNREGISTERING) { - logger.info( + if (logger.isInfoEnabled()) + logger.info( "removing the following popup handler : " + handler); popupHandlerSet.remove(handler.getClass().getName()); if (activePopupHandler == handler) @@ -702,7 +706,8 @@ public void serviceChanged(ServiceEvent serviceEvent) } } catch (IllegalStateException e) { - logger.debug(e); + if (logger.isDebugEnabled()) + logger.debug(e); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/geolocation/GeolocationPacketExtensionProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/geolocation/GeolocationPacketExtensionProvider.java index ef9771389..d2cdda5ae 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/geolocation/GeolocationPacketExtensionProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/geolocation/GeolocationPacketExtensionProvider.java @@ -58,7 +58,8 @@ public PacketExtension parseExtension(XmlPullParser parser) GeolocationPacketExtension result = new GeolocationPacketExtension(); - logger.trace("Trying to map XML Geolocation Extension"); + if (logger.isTraceEnabled()) + logger.trace("Trying to map XML Geolocation Extension"); boolean done = false; while (!done) @@ -162,7 +163,8 @@ else if (eventType == XmlPullParser.END_TAG) GeolocationPacketExtensionProvider.ELEMENT_NAME)) { done = true; - logger.trace("Parsing finish"); + if (logger.isTraceEnabled()) + logger.trace("Parsing finish"); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQ.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQ.java index 48b48d880..575fd35b0 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQ.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQ.java @@ -173,7 +173,8 @@ public void setTotalEstimate(boolean totalEstimate) @Override public String getChildElementXML() { - logger.debug("Mailbox.getChildElementXML usage"); + if (logger.isDebugEnabled()) + logger.debug("Mailbox.getChildElementXML usage"); String totalString = totalEstimate ? " total-estimate='1' " : ""; return ""; diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQProvider.java index 527f4b2c5..4429d4d74 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxIQProvider.java @@ -82,7 +82,8 @@ public IQ parseIQ(final XmlPullParser parser) throws Exception if(logger.isTraceEnabled()) { logger.trace("xml parser returned eventType=" + eventType); - logger.trace("parser="+parser.getText()); + if (logger.isTraceEnabled()) + logger.trace("parser="+parser.getText()); } } eventType = parser.next(); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxQueryIQ.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxQueryIQ.java index 7d33a8f37..4b6a15362 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxQueryIQ.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/mailnotification/MailboxQueryIQ.java @@ -49,7 +49,8 @@ public class MailboxQueryIQ extends IQ @Override public String getChildElementXML() { - logger.debug("QueryNotify.getChildElementXML usage"); + if (logger.isDebugEnabled()) + logger.debug("QueryNotify.getChildElementXML usage"); StringBuffer xml = new StringBuffer( " " + remoteIp + ":" + remotePort); // } diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/mediamgr/MediaUtils.java b/src/net/java/sip/communicator/impl/protocol/jabber/mediamgr/MediaUtils.java index e97c85428..c1de4d9ac 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/mediamgr/MediaUtils.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/mediamgr/MediaUtils.java @@ -158,7 +158,8 @@ public static String getPayloadName(int payloadType) return "G729"; default: //throw new IllegalStateException("Unknown payload type"); - logger.debug("unknown payload type : " + payloadType); + if (logger.isDebugEnabled()) + logger.debug("unknown payload type : " + payloadType); return null; } } @@ -209,7 +210,8 @@ public static int getPayloadType(int sdpConstant) return 18; default: //throw new IllegalStateException("Unknown sdp constant"); - logger.debug("unknown sdp constant : " + sdpConstant); + if (logger.isDebugEnabled()) + logger.debug("unknown sdp constant : " + sdpConstant); return -1; } } diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java b/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java index 60c4567d7..9d5566d1c 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockCall.java @@ -70,7 +70,8 @@ public void addCallPeer(MockCallPeer callPeer) this.callPeers.add(callPeer); - logger.info("Will fire peer added"); + if (logger.isInfoEnabled()) + logger.info("Will fire peer added"); fireCallPeerEvent( callPeer, CallPeerEvent.CALL_PEER_ADDED); diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java b/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java index 1079aea4d..7ed0e2978 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockOperationSetBasicTelephony.java @@ -56,7 +56,8 @@ public void answerCallPeer(CallPeer peer) throws = (MockCallPeer)peer; if(peer.getState().equals(CallPeerState.CONNECTED)) { - logger.info("Ignoring user request to answer a CallPeer " + if (logger.isInfoEnabled()) + logger.info("Ignoring user request to answer a CallPeer " + "that is already connected. CP:" + peer); return; } @@ -139,7 +140,8 @@ public void hangupCallPeer(CallPeer peer) throws //do nothing if the call is already ended if (peer.getState().equals(CallPeerState.DISCONNECTED)) { - logger.debug("Ignoring a request to hangup a call peer " + if (logger.isDebugEnabled()) + logger.debug("Ignoring a request to hangup a call peer " +"that is already DISCONNECTED"); return; } @@ -147,7 +149,8 @@ public void hangupCallPeer(CallPeer peer) throws MockCallPeer callPeer = (MockCallPeer)peer; - logger.info("hangupCallPeer"); + if (logger.isInfoEnabled()) + logger.info("hangupCallPeer"); callPeer.setState(CallPeerState.DISCONNECTED, null); } @@ -230,7 +233,8 @@ public void callStateChanged(CallChangeEvent evt) MockCall sourceCall = (MockCall)this.activeCalls .remove(evt.getSourceCall().getCallID()); - logger.trace( "Removing call " + sourceCall + " from the list of " + if (logger.isTraceEnabled()) + logger.trace( "Removing call " + sourceCall + " from the list of " + "active calls because it entered an ENDED state"); fireCallEvent(CallEvent.CALL_ENDED, sourceCall); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java index 93994b71d..2ba47bc2b 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/AdHocChatRoomMsnImpl.java @@ -393,7 +393,8 @@ public boolean isSystem() */ public void sendMessage(Message message) throws OperationFailedException { - logger.info("switchboard="+this.switchboard); + if (logger.isInfoEnabled()) + logger.info("switchboard="+this.switchboard); this.switchboard.sendText(message.getContent()); AdHocChatRoomMessageDeliveredEvent msgDeliveredEvt @@ -433,7 +434,8 @@ private void fireParticipantPresenceEvent( Contact participant, new AdHocChatRoomParticipantPresenceChangeEvent( this, participant, eventID, eventReason); - logger.trace("Will dispatch the following AdHocChatRoom event: " + evt); + if (logger.isTraceEnabled()) + logger.trace("Will dispatch the following AdHocChatRoom event: " + evt); Iterator listeners = null; synchronized (this.participantsPresenceListeners) diff --git a/src/net/java/sip/communicator/impl/protocol/msn/EventManager.java b/src/net/java/sip/communicator/impl/protocol/msn/EventManager.java index ad1f02d52..93edd1be5 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/EventManager.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/EventManager.java @@ -109,7 +109,8 @@ public void removeModificationListener(MsnContactListEventListener listener) */ public void messageSent(Session session, Message message) throws Exception { - logger.trace(msnMessenger.getOwner().getEmail().getEmailAddress() + + if (logger.isTraceEnabled()) + logger.trace(msnMessenger.getOwner().getEmail().getEmailAddress() + " outgoing " + message); } @@ -125,7 +126,8 @@ public void messageReceived(Session session, Message message) MsnIncomingMessage incoming = (MsnIncomingMessage)((WrapperMessage)message) .getMessage(); - logger.trace(msnMessenger.getOwner().getEmail().getEmailAddress() + + if (logger.isTraceEnabled()) + logger.trace(msnMessenger.getOwner().getEmail().getEmailAddress() + " incoming : " + incoming); if(incoming instanceof IncomingACK) diff --git a/src/net/java/sip/communicator/impl/protocol/msn/IncomingFileTransferRequestMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/IncomingFileTransferRequestMsnImpl.java index b57efc8e0..161ee771c 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/IncomingFileTransferRequestMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/IncomingFileTransferRequestMsnImpl.java @@ -166,7 +166,8 @@ public void rejectFile() } catch(IllegalStateException e) { - logger.debug("Error rejecting file",e); + if (logger.isDebugEnabled()) + logger.debug("Error rejecting file",e); return; } } diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetAdHocMultiUserChatMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetAdHocMultiUserChatMsnImpl.java index 275584654..1f73b0e2f 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetAdHocMultiUserChatMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetAdHocMultiUserChatMsnImpl.java @@ -459,7 +459,8 @@ public void instantMessageReceived( MsnSwitchboard switchboard, Message newMessage = createMessage(message.getContent()); - logger.debug("Group chat message received."); + if (logger.isDebugEnabled()) + logger.debug("Group chat message received."); AdHocChatRoomMsnImpl chatRoom = getLocalAdHocChatRoomInstance(switchboard); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java index 2c6466ad1..225c8a6cf 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java @@ -172,7 +172,8 @@ private class RegistrationStateListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); @@ -212,7 +213,8 @@ public void instantMessageReceived(MsnSwitchboard switchboard, if(sourceContact == null) { - logger.debug("received a message from an unknown contact: " + if (logger.isDebugEnabled()) + logger.debug("received a message from an unknown contact: " + contact); //create the volatile contact sourceContact = opSetPersPresence. @@ -250,7 +252,8 @@ public void offlineMessageReceived(String body, if(sourceContact == null) { - logger.debug("received a message from an unknown contact: " + if (logger.isDebugEnabled()) + logger.debug("received a message from an unknown contact: " + contact); //create the volatile contact sourceContact = opSetPersPresence. @@ -319,7 +322,8 @@ public void newEmailNotificationReceived(MsnSwitchboard switchboard, if (sourceContact == null) { - logger.debug("received a new mail from an unknown contact: " + if (logger.isDebugEnabled()) + logger.debug("received a new mail from an unknown contact: " + messageFrom + " <" + messageFromAddr + ">"); //create the volatile contact diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetFileTransferMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetFileTransferMsnImpl.java index d19bc32d9..e95406667 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetFileTransferMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetFileTransferMsnImpl.java @@ -313,7 +313,8 @@ private class RegistrationStateListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java index dc101827d..4a0340381 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetPersistentPresenceMsnImpl.java @@ -416,7 +416,8 @@ public PresenceStatus queryContactStatus(String contactIdentifier) throws ContactMsnImpl contact = ssContactList.findContactById(contactIdentifier); if(contact == null) { - logger.info("Contact not found id :" + contactIdentifier); + if (logger.isInfoEnabled()) + logger.info("Contact not found id :" + contactIdentifier); return null; } else @@ -653,7 +654,8 @@ private class RegistrationStateListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The msn provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The msn provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); @@ -775,7 +777,8 @@ void earlyStatusesDispatch() ContactGroup parent = ssContactList.findContactGroup(sourceContact); - logger.debug("Will Dispatch the contact status event."); + if (logger.isDebugEnabled()) + logger.debug("Will Dispatch the contact status event."); fireContactPresenceStatusChangeEvent(sourceContact, parent, oldStatus, newStatus); } @@ -804,7 +807,8 @@ private class StatusChangedListener */ public void ownerStatusChanged(MsnMessenger messenger) { - logger.trace("Own status changed to " + messenger.getOwner().getStatus()); + if (logger.isTraceEnabled()) + logger.trace("Own status changed to " + messenger.getOwner().getStatus()); PresenceStatus oldStatus = currentStatus; currentStatus = msnStatusToPresenceStatus(messenger.getOwner().getStatus()); @@ -819,7 +823,8 @@ public void ownerStatusChanged(MsnMessenger messenger) public void contactStatusChanged( MsnMessenger messenger, MsnContact contact) { - logger.debug("Received a status update for contact=" + contact); + if (logger.isDebugEnabled()) + logger.debug("Received a status update for contact=" + contact); ContactMsnImpl sourceContact = ssContactList @@ -827,7 +832,8 @@ public void contactStatusChanged( MsnMessenger messenger, if (sourceContact == null) { - logger.debug("No source contact found for msncontact=" + contact); + if (logger.isDebugEnabled()) + logger.debug("No source contact found for msncontact=" + contact); // maybe list is not inited yet will store till init earlyStatusChange.put(contact.getEmail().getEmailAddress(), @@ -852,7 +858,8 @@ public void contactStatusChanged( MsnMessenger messenger, ContactGroup parent = ssContactList.findContactGroup(sourceContact); - logger.debug("Will Dispatch the contact status event."); + if (logger.isDebugEnabled()) + logger.debug("Will Dispatch the contact status event."); fireContactPresenceStatusChangeEvent(sourceContact, parent, oldStatus, newStatus); } diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java index 2a5c912de..2de8c506c 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java @@ -156,7 +156,8 @@ private class ProviderRegListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); if (evt.getNewState() == RegistrationState.REGISTERED) diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java index 589484f64..c46861a78 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java @@ -400,7 +400,8 @@ private class MsnConnectionListener */ public void loginCompleted(MsnMessenger msnMessenger) { - logger.trace("loginCompleted " + msnMessenger.getActualMsnProtocol()); + if (logger.isTraceEnabled()) + logger.trace("loginCompleted " + msnMessenger.getActualMsnProtocol()); fireRegistrationStateChanged( getRegistrationState(), RegistrationState.REGISTERED, @@ -414,7 +415,8 @@ public void loginCompleted(MsnMessenger msnMessenger) */ public void logout(MsnMessenger msnMessenger) { - logger.trace("logout"); + if (logger.isTraceEnabled()) + logger.trace("logout"); // The synchronization is for logoutReceived at least. synchronized (initializationLock) diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ServerStoredContactListMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ServerStoredContactListMsnImpl.java index e2d1a19de..e1544d3d6 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ServerStoredContactListMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ServerStoredContactListMsnImpl.java @@ -163,7 +163,8 @@ private void fireGroupEvent(ContactGroupMsnImpl group, int eventID) { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -174,7 +175,8 @@ private void fireGroupEvent(ContactGroupMsnImpl group, int eventID) , msnProvider , parentOperationSet); - logger.trace("Will dispatch the following grp event: " + evt); + if (logger.isTraceEnabled()) + logger.trace("Will dispatch the following grp event: " + evt); Iterator listeners = null; synchronized (serverStoredGroupListeners) @@ -209,7 +211,8 @@ private void fireContactRemoved( ContactGroup parentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -232,7 +235,8 @@ private void fireContactMoved( ContactGroup oldParentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -367,7 +371,8 @@ public void addContact(String id) public void addContact(final ContactGroupMsnImpl parent, final String id) throws OperationFailedException { - logger.trace("Adding contact " + id + " to parent=" + parent); + if (logger.isTraceEnabled()) + logger.trace("Adding contact " + id + " to parent=" + parent); //if the contact is already in the contact list and is not volatile, //then only broadcast an event @@ -376,7 +381,8 @@ public void addContact(final ContactGroupMsnImpl parent, final String id) if( existingContact != null && existingContact.isPersistent() ) { - logger.debug("Contact " + id + " already exists."); + if (logger.isDebugEnabled()) + logger.debug("Contact " + id + " already exists."); throw new OperationFailedException( "Contact " + id + " already exists.", OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS); @@ -534,13 +540,15 @@ ContactGroupMsnImpl createUnresolvedContactGroup(String groupName) public void createGroup(String groupName) throws OperationFailedException { - logger.trace("Creating group: " + groupName); + if (logger.isTraceEnabled()) + logger.trace("Creating group: " + groupName); ContactGroupMsnImpl existingGroup = findContactGroup(groupName); if( existingGroup != null && existingGroup.isPersistent() ) { - logger.debug("ContactGroup " + groupName + " already exists."); + if (logger.isDebugEnabled()) + logger.debug("ContactGroup " + groupName + " already exists."); throw new OperationFailedException( "ContactGroup " + groupName + " already exists.", OperationFailedException.CONTACT_GROUP_ALREADY_EXISTS); @@ -560,7 +568,8 @@ public void removeGroup(ContactGroupMsnImpl groupToRemove) if(groupToRemove.getSourceGroup().getGroupId().equals("0")) return; - logger.trace("removing group " + groupToRemove); + if (logger.isTraceEnabled()) + logger.trace("removing group " + groupToRemove); MsnContact[] contacts = groupToRemove.getSourceGroup().getContacts(); ModListenerRemoveGroup removedContactsListener = @@ -569,7 +578,8 @@ public void removeGroup(ContactGroupMsnImpl groupToRemove) for (int i = 0; i < contacts.length; i++) { - logger.trace("removing contact from group " + contacts[i]); + if (logger.isTraceEnabled()) + logger.trace("removing contact from group " + contacts[i]); msnProvider.getMessenger().removeFriend(contacts[i].getEmail(), groupToRemove.getSourceGroup().getGroupId()); @@ -590,7 +600,8 @@ public void removeGroup(ContactGroupMsnImpl groupToRemove) */ void removeContact(ContactMsnImpl contactToRemove) { - logger.trace("Removing msn contact " + if (logger.isTraceEnabled()) + logger.trace("Removing msn contact " + contactToRemove.getSourceContact()); Email contactsEmail = contactToRemove.getSourceContact().getEmail(); @@ -634,7 +645,8 @@ public void moveContact(ContactMsnImpl contact, if(oldParent instanceof RootContactGroupMsnImpl) { - logger.trace("Will Move from root " + contact); + if (logger.isTraceEnabled()) + logger.trace("Will Move from root " + contact); msnProvider.getMessenger(). copyFriend( contact.getSourceContact().getEmail(), @@ -675,7 +687,8 @@ public void moveContact(ContactMsnImpl contact, } else { - logger.trace("Will Move from " + if (logger.isTraceEnabled()) + logger.trace("Will Move from " + contact.getParentContactGroup() + " to : " + newParent + " - contact: " + contact); // contactListModListenerImpl.waitForMove(contact.getAddress()); @@ -740,7 +753,8 @@ void fireContactAdded( ContactGroup parentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -789,7 +803,8 @@ void fireContactResolved( ContactGroup parentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -835,7 +850,8 @@ public void contactListSyncCompleted(MsnMessenger messenger) public void contactListInitCompleted(MsnMessenger messenger) { - logger.trace("contactListInitCompleted"); + if (logger.isTraceEnabled()) + logger.trace("contactListInitCompleted"); isInitialized = true; if(logger.isDebugEnabled()) @@ -937,7 +953,8 @@ public void ownerStatusChanged(MsnMessenger messenger) public void contactAddedMe(MsnMessenger messenger, MsnContactPending[] pendingContacts) { - logger.trace("Contact add us "); + if (logger.isTraceEnabled()) + logger.trace("Contact add us "); /** * TODO this method introduced for msn15 currently used. * the old one below no more used. @@ -948,7 +965,8 @@ public void contactAddedMe(MsnMessenger messenger, MsnContact contact) { // try // { - logger.trace("Contact add us " + contact); + if (logger.isTraceEnabled()) + logger.trace("Contact add us " + contact); if(parentOperationSet.getAuthorizationHandler() == null) return; @@ -1034,7 +1052,8 @@ public void contactRemoveCompleted(MsnMessenger messenger, if(contactToRemove == null) { - logger.trace("Contact not found!" + contact); + if (logger.isTraceEnabled()) + logger.trace("Contact not found!" + contact); return; } @@ -1055,7 +1074,8 @@ public void contactRemoveCompleted(MsnMessenger messenger, public void groupAddCompleted(MsnMessenger messenger, MsnGroup group) { - logger.trace("groupAdded " + group); + if (logger.isTraceEnabled()) + logger.trace("groupAdded " + group); ContactGroupMsnImpl newGroup = new ContactGroupMsnImpl(group, new MsnContact[]{}, @@ -1071,7 +1091,8 @@ public void groupRemoveCompleted(MsnMessenger messenger, MsnGroup g) if(group == null) { - logger.trace("Group not found!" + g); + if (logger.isTraceEnabled()) + logger.trace("Group not found!" + g); return; } @@ -1155,7 +1176,8 @@ public void contactRemoveFromGroupCompleted(MsnMessenger messenger, if(g == null) { - logger.trace("Group is null! "); + if (logger.isTraceEnabled()) + logger.trace("Group is null! "); return; } @@ -1164,13 +1186,15 @@ public void contactRemoveFromGroupCompleted(MsnMessenger messenger, if(contactToRemove == null) { - logger.trace("Contact not found " + c); + if (logger.isTraceEnabled()) + logger.trace("Contact not found " + c); return; } if(dstGroup == null) { - logger.trace("Group not found " + g); + if (logger.isTraceEnabled()) + logger.trace("Group not found " + g); return; } @@ -1225,7 +1249,8 @@ public void waitForLastEvent(long waitFor) } catch (InterruptedException ex) { - logger.debug( + if (logger.isDebugEnabled()) + logger.debug( "Interrupted while waiting for a subscription evt", ex); } } @@ -1246,7 +1271,8 @@ public void groupRenamed(MsnGroup group) findContactGroupByMsnId(group.getGroupId()); if(groupToRename == null){ - logger.trace("Group not found!" + group); + if (logger.isTraceEnabled()) + logger.trace("Group not found!" + group); return; } @@ -1323,59 +1349,74 @@ public void printList() { MsnMessenger messenger = msnProvider.getMessenger(); - logger.info("---=Start Printing contact list=---"); + if (logger.isInfoEnabled()) + logger.info("---=Start Printing contact list=---"); MsnContactList list = messenger.getContactList(); - logger.info("Forward list"); + if (logger.isInfoEnabled()) + logger.info("Forward list"); MsnContact[] c = list.getContactsInList(MsnList.FL); for(int i = 0; i < c.length; i++) { - logger.info("c : " + c[i]); + if (logger.isInfoEnabled()) + logger.info("c : " + c[i]); MsnGroup[] groups = c[i].getBelongGroups(); for(int j = 0; j < groups.length; j++) { - logger.info("in group " + groups[j]); + if (logger.isInfoEnabled()) + logger.info("in group " + groups[j]); } } - logger.info("Allow list"); + if (logger.isInfoEnabled()) + logger.info("Allow list"); c = list.getContactsInList(MsnList.AL); for(int i = 0; i < c.length; i++) { - logger.info("c : " + c[i] + " g:" + c[i].getBelongGroups().length); + if (logger.isInfoEnabled()) + logger.info("c : " + c[i] + " g:" + c[i].getBelongGroups().length); } - logger.info("Block list"); + if (logger.isInfoEnabled()) + logger.info("Block list"); c = list.getContactsInList(MsnList.BL); for(int i = 0; i < c.length; i++) { - logger.info("c : " + c[i] + " g:" + c[i].getBelongGroups().length); + if (logger.isInfoEnabled()) + logger.info("c : " + c[i] + " g:" + c[i].getBelongGroups().length); } - logger.info("pending list"); + if (logger.isInfoEnabled()) + logger.info("pending list"); c = list.getContactsInList(MsnList.PL); for(int i = 0; i < c.length; i++) { - logger.info("c : " + c[i] + " g:" + c[i].getBelongGroups().length); + if (logger.isInfoEnabled()) + logger.info("c : " + c[i] + " g:" + c[i].getBelongGroups().length); } - logger.info("Reverse list"); + if (logger.isInfoEnabled()) + logger.info("Reverse list"); c = list.getContactsInList(MsnList.RL); for(int i = 0; i < c.length; i++) { - logger.info("c : " + c[i] + " g:" + + if (logger.isInfoEnabled()) + logger.info("c : " + c[i] + " g:" + c[i].getBelongGroups().length); } - logger.info("Number of groups : " + if (logger.isInfoEnabled()) + logger.info("Number of groups : " + messenger.getContactList().getGroups().length); MsnGroup[] groups = messenger.getContactList().getGroups(); for(int j = 0; j < groups.length; j++) { - logger.info("group " + groups[j]); + if (logger.isInfoEnabled()) + logger.info("group " + groups[j]); } - logger.info("---=End Printing contact list=---"); + if (logger.isInfoEnabled()) + logger.info("---=End Printing contact list=---"); } private class ImageUpdater diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java b/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java index 0139d420b..e0481a6ed 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ImageRetriever.java @@ -151,7 +151,8 @@ private byte[] getAvatar(ContactRssImpl contact) } catch (Exception exc) { - logger.trace("Cannot load image for contact " + this + " : " + if (logger.isTraceEnabled()) + logger.trace("Cannot load image for contact " + this + " : " + exc.getMessage(), exc); return null; @@ -234,7 +235,8 @@ private String findFavIconFromSiteIndex(ContactRssImpl contact) } catch (Exception exc) { - logger.trace("Failed to retrieve link image.", exc); + if (logger.isTraceEnabled()) + logger.trace("Failed to retrieve link image.", exc); } return null; @@ -271,7 +273,8 @@ private byte[] getFavIconFromSiteRoot(ContactRssImpl contact) ICOFile favicon = new ICOFile(location); - logger.trace("Icon has " + favicon.getImageCount() + " pages"); + if (logger.isTraceEnabled()) + logger.trace("Icon has " + favicon.getImageCount() + " pages"); for (int i = 0; i < favicon.getDescriptors().size(); i++) { @@ -305,8 +308,10 @@ private byte[] getFavIconFromSiteRoot(ContactRssImpl contact) ImageIO.write((BufferedImage) selectedIcon, "PNG", output); result = output.toByteArray(); - logger.trace("Result has " + result.length + " bytes"); - logger.trace("Icon is " + maxWidth + " px X " + maxWidth + " px @ " + if (logger.isTraceEnabled()) + logger.trace("Result has " + result.length + " bytes"); + if (logger.isTraceEnabled()) + logger.trace("Icon is " + maxWidth + " px X " + maxWidth + " px @ " + maxColors + " colors"); output.close(); @@ -320,13 +325,15 @@ private byte[] getFavIconFromSiteRoot(ContactRssImpl contact) catch (IOException ioex) { logger.warn("I/O Error on favicon retrieval. " + ioex.getMessage()); - logger.debug("I/O Error on favicon retrieval. " + ioex, ioex); + if (logger.isDebugEnabled()) + logger.debug("I/O Error on favicon retrieval. " + ioex, ioex); } catch (Exception ex) { logger.warn("Unknown error on favicon retrieval. " + ex + ". Error for location: " + location, ex); - logger.debug("", ex); + if (logger.isDebugEnabled()) + logger.debug("", ex); } return null; @@ -341,7 +348,8 @@ private byte[] getFavIconFromSiteRoot(ContactRssImpl contact) */ private byte[] getDefaultRssIcon() { - logger.trace("Loading default icon at " + defaultIconId); + if (logger.isTraceEnabled()) + logger.trace("Loading default icon at " + defaultIconId); return ProtocolIconRssImpl.getImageInBytes(defaultIconId); } 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 9b4bce514..8b9fc037d 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetBasicInstantMessagingRssImpl.java @@ -151,7 +151,8 @@ private void submitRssQuery(ContactRssImpl rssContact, logger.warn("RSS flow no longer exists. Error was: " + ex.getMessage()); - logger.debug(ex); + if (logger.isDebugEnabled()) + logger.debug(ex); return; } catch (OperationFailedException ex) @@ -237,14 +238,16 @@ public void createTimer() if (timer != null ) return; - logger.trace("Creating rss timer and task."); + if (logger.isTraceEnabled()) + logger.trace("Creating rss timer and task."); RssTimerRefreshFeed refresh = new RssTimerRefreshFeed(this); this.timer = new Timer(); this.timer.scheduleAtFixedRate(refresh, INITIAL_RSS_LOAD_DELAY, PERIOD_REFRESH_RSS); - logger.trace("Done."); + if (logger.isTraceEnabled()) + logger.trace("Done."); } /** @@ -466,7 +469,8 @@ public void run() } catch (OperationFailedException exc) { - logger.info("We could not remove a dead contact", exc); + if (logger.isInfoEnabled()) + logger.info("We could not remove a dead contact", exc); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java index 16d179522..5656578cd 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/OperationSetPersistentPresenceRssImpl.java @@ -519,7 +519,8 @@ else if (contactIdentifierURL.startsWith("feed")) if(findContactByID(contactIdentifier) != null) { - logger.debug( + if (logger.isDebugEnabled()) + logger.debug( "contact with same id already exists - " + contactIdentifier); return; } @@ -572,7 +573,8 @@ else if (contactIdentifierURL.startsWith("feed")) //ignore and subscribe the contact so that the exception would //occur while we try to refresh it. This way we would ask the //user whether they want it removed. - logger.debug("failed to create a URL for address " + if (logger.isDebugEnabled()) + logger.debug("failed to create a URL for address " + contactIdentifier + ". Error was: " + ex.getMessage() @@ -749,7 +751,8 @@ else if (contactIdentifierURL.startsWith("feed")) //ignore and subscribe the contact so that the exception would //occur while we try to refresh it. This way we would ask the //user whether they want it removed. - logger.debug("failed to create a URL for address " + if (logger.isDebugEnabled()) + logger.debug("failed to create a URL for address " + rssURL + ". Error was: " + ex.getMessage() @@ -757,7 +760,8 @@ else if (contactIdentifierURL.startsWith("feed")) } catch(OperationFailedException ex) { - logger.debug("failed to create a URL for address " + if (logger.isDebugEnabled()) + logger.debug("failed to create a URL for address " + rssURL + ". Error was: " + ex.getMessage() diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java index 46ffb208f..50e9cc3f0 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java @@ -65,7 +65,8 @@ public class ProtocolProviderServiceRssImpl */ public ProtocolProviderServiceRssImpl() { - logger.trace("Creating a rss provider."); + if (logger.isTraceEnabled()) + logger.trace("Creating a rss provider."); } /** @@ -186,7 +187,8 @@ public void shutdown() { return; } - logger.trace("Killing the Rss Protocol Provider."); + if (logger.isTraceEnabled()) + logger.trace("Killing the Rss Protocol Provider."); if(isRegistered()) { diff --git a/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java b/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java index 04109a060..228aefce7 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/RssActivator.java @@ -88,7 +88,8 @@ public void start(BundleContext context) rssProviderFactory, hashtable); - logger.info("RSS protocol implementation [STARTED]."); + if (logger.isInfoEnabled()) + logger.info("RSS protocol implementation [STARTED]."); uriHandler = new UriHandlerRssImpl(); bundleContext.addServiceListener(uriHandler); @@ -134,7 +135,8 @@ public void stop(BundleContext context) context.removeServiceListener(uriHandler); - logger.info("RSS protocol implementation [STOPPED]."); + if (logger.isInfoEnabled()) + logger.info("RSS protocol implementation [STOPPED]."); } /** diff --git a/src/net/java/sip/communicator/impl/protocol/rss/RssTimerRefreshFeed.java b/src/net/java/sip/communicator/impl/protocol/rss/RssTimerRefreshFeed.java index 0ad6253c7..9860b234f 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/RssTimerRefreshFeed.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/RssTimerRefreshFeed.java @@ -41,7 +41,8 @@ public RssTimerRefreshFeed(OperationSetBasicInstantMessagingRssImpl opSet) */ public void run() { - logger.trace("Starting a periodic rss check."); + if (logger.isTraceEnabled()) + logger.trace("Starting a periodic rss check."); this.opSet.refreshAllRssFeeds(); } } diff --git a/src/net/java/sip/communicator/impl/protocol/rss/UriHandlerRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/UriHandlerRssImpl.java index d85bfcf85..83168ddc8 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/UriHandlerRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/UriHandlerRssImpl.java @@ -135,7 +135,8 @@ public void handleUri(String uri) catch (OperationFailedException exc) { // The operation has been canceled by the user. Bail out. - logger.trace("User canceled handling of uri " + uri); + if (logger.isTraceEnabled()) + logger.trace("User canceled handling of uri " + uri); return; } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/EventPackageSupport.java b/src/net/java/sip/communicator/impl/protocol/sip/EventPackageSupport.java index 92a21b4ce..c945e3a21 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/EventPackageSupport.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/EventPackageSupport.java @@ -334,7 +334,8 @@ static void processAuthenticationChallenge( { try { - logger.debug("Authenticating a message request."); + if (logger.isDebugEnabled()) + logger.debug("Authenticating a message request."); ClientTransaction retryTran = protocolProvider diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index 1e1b5f2a6..d6d942eee 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -679,7 +679,8 @@ public void processTransactionTerminated(TransactionTerminatedEvent } Request request = transaction.getRequest(); - logger.debug("Transaction terminated for req=\n" + request); + if (logger.isDebugEnabled()) + logger.debug("Transaction terminated for req=\n" + request); //find the object that is supposed to take care of responses with the //corresponding method diff --git a/src/net/java/sip/communicator/impl/protocol/sip/SipLogger.java b/src/net/java/sip/communicator/impl/protocol/sip/SipLogger.java index c905dd98d..9511b3e1e 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/SipLogger.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/SipLogger.java @@ -228,7 +228,8 @@ public void logMessage(SIPMessage message, String from, String to, else msgHeader = "JAIN-SIP received a message from=\""; - logger.info( msgHeader + from + "\" to=\"" + to + "\" at=" + time + if (logger.isInfoEnabled()) + logger.info( msgHeader + from + "\" to=\"" + to + "\" at=" + time + ":\n" + message); } @@ -255,7 +256,8 @@ public void logMessage(SIPMessage message, String from, String to, else msgHeader = "JAIN-SIP received a message from=\""; - logger.info(msgHeader + from + "\" to=\"" + to + "\" at " + time + if (logger.isInfoEnabled()) + logger.info(msgHeader + from + "\" to=\"" + to + "\" at " + time + " (status: " + status + "):\n" + message); } @@ -281,7 +283,8 @@ public void logMessage(SIPMessage message, String from, String to, else msgHeader = "JAIN-SIP received a message from=\""; - logger.info(msgHeader + from + "\" to=\"" + to + "\" (status: " + if (logger.isInfoEnabled()) + logger.info(msgHeader + from + "\" to=\"" + to + "\" (status: " + status + "):\n" + message); } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/dtmf/DTMFInfo.java b/src/net/java/sip/communicator/impl/protocol/sip/dtmf/DTMFInfo.java index 35be72176..28cc6b289 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/dtmf/DTMFInfo.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/dtmf/DTMFInfo.java @@ -170,7 +170,8 @@ private void sayInfo(CallPeerSipImpl callPeer, } callPeer.getDialog().sendRequest(clientTransaction); - logger.debug("sent request:\n" + info); + if (logger.isDebugEnabled()) + logger.debug("sent request:\n" + info); } catch (SipException ex) { @@ -193,7 +194,8 @@ public boolean processRequest(RequestEvent requestEvent) { if (requestEvent == null) { - logger.debug("requestEvent null"); + if (logger.isDebugEnabled()) + logger.debug("requestEvent null"); } logger.error("We don't cope with requests" + requestEvent); return false; @@ -211,24 +213,28 @@ public boolean processResponse(ResponseEvent responseEvent) { if (responseEvent == null) { - logger.debug("null responseEvent"); + if (logger.isDebugEnabled()) + logger.debug("null responseEvent"); return false; } Response response = responseEvent.getResponse(); if (response == null) { - logger.debug("null response"); + if (logger.isDebugEnabled()) + logger.debug("null response"); return false; } int code = response.getStatusCode(); - logger.debug("DTMF status code=" + code); + if (logger.isDebugEnabled()) + logger.debug("DTMF status code=" + code); if (code != 200) { logger.error("DTMF Send failed :" + code); } else { - logger.debug("DTMF succeeded"); + if (logger.isDebugEnabled()) + logger.debug("DTMF succeeded"); } return true; } @@ -261,7 +267,8 @@ public boolean processIOException(IOExceptionEvent exceptionEvent) //we do nothing if (exceptionEvent == null) { - logger.debug("ioexception null"); + if (logger.isDebugEnabled()) + logger.debug("ioexception null"); return false; } logger.error("ioexception :" + exceptionEvent); @@ -280,7 +287,8 @@ public boolean processTransactionTerminated( TransactionTerminatedEvent transactionTerminatedEvent) { //we do nothing - logger.info("Transaction Terminated :" + transactionTerminatedEvent); + if (logger.isInfoEnabled()) + logger.info("Transaction Terminated :" + transactionTerminatedEvent); return false; } @@ -296,7 +304,8 @@ public boolean processDialogTerminated( DialogTerminatedEvent dialogTerminatedEvent) { //we do nothing - logger.info("Dialog Terminated :" + dialogTerminatedEvent); + if (logger.isInfoEnabled()) + logger.info("Dialog Terminated :" + dialogTerminatedEvent); return false; } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java b/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java index 059df9990..d5248e28a 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java @@ -213,7 +213,8 @@ public static SessionDescription createSessionUpdateDescription( catch (Exception e) { // can't happen, ignore - logger.info("Something very odd just happened.", e); + if (logger.isInfoEnabled()) + logger.info("Something very odd just happened.", e); } //now, RFC 3264 says all previous m= fields must be present and new ones @@ -264,7 +265,8 @@ public static SessionDescription createSessionUpdateDescription( { // never thrown, unless completeMediaDescList is null and that // can't be since we just created it. - logger.info("A crazy thing just happened.", e); + if (logger.isInfoEnabled()) + logger.info("A crazy thing just happened.", e); } return update; @@ -344,7 +346,8 @@ public static List extractFormats( //this is never thrown by the implementation because it doesn't //do lazy parsing ... and whose idea was it to have an exception //here anyway ?!? - logger.debug("A funny thing just happened ...", exc); + if (logger.isDebugEnabled()) + logger.debug("A funny thing just happened ...", exc); return mediaFmts; } @@ -359,7 +362,8 @@ public static List extractFormats( catch (NumberFormatException e) { //weird payload type. contact is sending rubbish. try to ignore - logger.debug(ptStr + " is not a valid payload type", e); + if (logger.isDebugEnabled()) + logger.debug(ptStr + " is not a valid payload type", e); continue; } @@ -373,7 +377,8 @@ public static List extractFormats( catch (SdpException e) { //there was a problem parsing the rtpmap. try to ignore. - logger.debug( + if (logger.isDebugEnabled()) + logger.debug( rtpmap + " does not seem like a valid rtpmap: attribute", e); } @@ -387,7 +392,8 @@ public static List extractFormats( catch (SdpException exc) { //there was a problem parsing the fmtp: try to ignore. - logger.debug( + if (logger.isDebugEnabled()) + logger.debug( fmtp + " does not seem like a valid fmtp: attribute", exc); } @@ -400,7 +406,8 @@ public static List extractFormats( } catch(SdpException exc) { - logger.debug("Problem parsing advanced attributes", exc); + if (logger.isDebugEnabled()) + logger.debug("Problem parsing advanced attributes", exc); } MediaFormat mediaFormat = null; @@ -413,7 +420,8 @@ public static List extractFormats( //this is never thrown by the implementation because it doesn't //do lazy parsing ... and whose idea was it to have an exception //here anyway ?!? - logger.debug("A funny thing just happened ...", e); + if (logger.isDebugEnabled()) + logger.debug("A funny thing just happened ...", e); continue; } @@ -469,7 +477,8 @@ public static List extractRTPExtensions( //this is never thrown by the implementation because it doesn't //do lazy parsing ... and whose idea was it to have an exception //here anyway ?!? - logger.debug("A funny thing just happened ...", e); + if (logger.isDebugEnabled()) + logger.debug("A funny thing just happened ...", e); continue; } @@ -657,7 +666,8 @@ private static MediaFormat createFormat( } catch(NumberFormatException exc) { - logger.debug( + if (logger.isDebugEnabled()) + logger.debug( nChansStr + " is not a valid number of channels.", exc); } @@ -744,7 +754,8 @@ private static Map parseAdvancedAttributes( catch (SdpParseException e) { //can't happen. jain sip doesn't do lazy parsing - logger.debug("The impossible has just occurred!", e); + if (logger.isDebugEnabled()) + logger.debug("The impossible has just occurred!", e); return null; } int idx = -1; @@ -1178,7 +1189,8 @@ public static MediaDirection getDirection( MediaDescription mediaDesc ) catch (SdpParseException e) { //can't happen (checkout the jain-sdp code if you wish) - logger.debug("The impossible has just occurred!", e); + if (logger.isDebugEnabled()) + logger.debug("The impossible has just occurred!", e); } for (MediaDirection value : MediaDirection.values()) @@ -1206,7 +1218,8 @@ public static URL getCallInfoURL(SessionDescription sessDesc) if (sdpUriField == null) { - logger.trace("Call URI was null."); + if (logger.isTraceEnabled()) + logger.trace("Call URI was null."); return null; } @@ -1480,7 +1493,8 @@ public static MediaType getMediaType(MediaDescription description) catch (SdpException exc) { // impossible to happen for reasons mentioned many times here :) - logger.debug("Invalid media type in m= line: " + description, exc); + if (logger.isDebugEnabled()) + logger.debug("Invalid media type in m= line: " + description, exc); throw new IllegalArgumentException( "Invalid media type in m= line: " + description, exc); } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/security/MessageDigestAlgorithm.java b/src/net/java/sip/communicator/impl/protocol/sip/security/MessageDigestAlgorithm.java index 6961adf07..b65f397b6 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/security/MessageDigestAlgorithm.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/security/MessageDigestAlgorithm.java @@ -58,7 +58,8 @@ static String calculateResponse(String algorithm, String entity_body, String qop_value) { - logger.debug("trying to authenticate using : " + algorithm + ", " + if (logger.isDebugEnabled()) + logger.debug("trying to authenticate using : " + algorithm + ", " + username_value + ", " + realm_value + ", " + (passwd != null && passwd.trim().length() > 0) + ", " + nonce_value + ", " + nc_value + ", " + cnonce_value + ", " + method + ", " diff --git a/src/net/java/sip/communicator/impl/protocol/sip/security/SipSecurityManager.java b/src/net/java/sip/communicator/impl/protocol/sip/security/SipSecurityManager.java index 8663d5bf1..ae8364dda 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/security/SipSecurityManager.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/security/SipSecurityManager.java @@ -154,12 +154,14 @@ public ClientTransaction handleChallenge( { //there's a stored password though so let's try it. ccEntry = createCcEntryWithStoredPassword(storedPassword); - logger.trace("seem to have a stored pass! Try with it."); + if (logger.isTraceEnabled()) + logger.trace("seem to have a stored pass! Try with it."); } else { //obtain new credentials - logger.trace("We don't seem to have a good pass! Get one."); + if (logger.isTraceEnabled()) + logger.trace("We don't seem to have a good pass! Get one."); ccEntry = createCcEntryWithNewCredentials( realm, SecurityAuthority.AUTHENTICATION_REQUIRED); @@ -198,7 +200,8 @@ public ClientTransaction handleChallenge( //we have a cache entry and it has not seen this transaction //lets use it again. //(this "else" is here for readability only) - logger.trace( "We seem to have a pass in the cache. " + if (logger.isTraceEnabled()) + logger.trace( "We seem to have a pass in the cache. " +"Let's try with it."); } } @@ -226,7 +229,8 @@ public ClientTransaction handleChallenge( ccEntry.pushBranchID(retryTran.getBranchId()); cachedCredentials.cacheEntry(realm, ccEntry); - logger.debug("Created authorization header: " + + if (logger.isDebugEnabled()) + logger.debug("Created authorization header: " + authorization.toString()); // get the unique Call-ID @@ -243,7 +247,8 @@ public ClientTransaction handleChallenge( reoriginatedRequest.addHeader(authorization); } - logger.debug("Returning authorization transaction."); + if (logger.isDebugEnabled()) + logger.debug("Returning authorization transaction."); return retryTran; } @@ -340,7 +345,8 @@ public ClientTransaction handleForbiddenResponse( cachedCredentials.cacheEntry(realmsIter.next(), ccEntry); } - logger.debug("Returning authorization transaction."); + if (logger.isDebugEnabled()) + logger.debug("Returning authorization transaction."); return retryTran; } @@ -618,7 +624,8 @@ private void removeBranchID(Request request) { // we are using the host port and transport of an existing Via // header so it would be quite weird to get this exception. - logger.debug("failed to reset a Via header"); + if (logger.isDebugEnabled()) + logger.debug("failed to reset a Via header"); } } diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java index b1c21099f..c965ed020 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ContactSSHImpl.java @@ -353,7 +353,8 @@ public void setPersistentData(String persistentData) int fifthCommaIndex = this.persistentData.indexOf(separator, fourthCommaIndex +1); - logger.debug("Commas: " + firstCommaIndex + " " + secondCommaIndex + " " + if (logger.isDebugEnabled()) + logger.debug("Commas: " + firstCommaIndex + " " + secondCommaIndex + " " + thirdCommaIndex + " " +fourthCommaIndex + " " +fifthCommaIndex); diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java index 236d10f70..33c5c900b 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ContactTimerSSHImpl.java @@ -67,7 +67,8 @@ public void run() persistentPresence.changeContactPresenceStatus( sshContact, SSHStatusEnum.ONLINE); - logger.debug("SSH Host " + sshContact + if (logger.isDebugEnabled()) + logger.debug("SSH Host " + sshContact .getSSHConfigurationForm().getHostName() + ": Online"); } @@ -84,7 +85,8 @@ public void run() persistentPresence.changeContactPresenceStatus( sshContact, SSHStatusEnum.OFFLINE); - logger.debug("SSH Host " + sshContact.getSSHConfigurationForm() + if (logger.isDebugEnabled()) + logger.debug("SSH Host " + sshContact.getSSHConfigurationForm() .getHostName() + ": Offline"); } } diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java index 10b135456..eb90dc27b 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java @@ -105,7 +105,8 @@ public class ProtocolProviderServiceSSHImpl */ public ProtocolProviderServiceSSHImpl() { - logger.trace("Creating a ssh provider."); + if (logger.isTraceEnabled()) + logger.trace("Creating a ssh provider."); try { @@ -363,7 +364,8 @@ public void createSSHSessionAndLogin(ContactSSH sshContact) throws OperationFailedException, InterruptedException { - logger.info("Creating a new SSH Session to " + if (logger.isInfoEnabled()) + logger.info("Creating a new SSH Session to " + sshContact.getHostName()); // creating a new JSch Stack identifier for contact @@ -414,7 +416,8 @@ public void createSSHSessionAndLogin(ContactSSH sshContact) throws { Thread.sleep(1000); count += 1000; - logger.trace("SSH:" + sshContact.getHostName() + if (logger.isTraceEnabled()) + logger.trace("SSH:" + sshContact.getHostName() + ": Sleep zzz .. " ); } @@ -435,7 +438,8 @@ public void createSSHSessionAndLogin(ContactSSH sshContact) throws sshContact.setJSch(jsch); sshContact.setSSHSession(session); - logger.info("A new SSH Session to " + sshContact.getHostName() + if (logger.isInfoEnabled()) + logger.info("A new SSH Session to " + sshContact.getHostName() + " Created"); } @@ -480,7 +484,8 @@ public void showWelcomeMessage(ContactSSH sshContact) //one line output of testCommand sshContact.getLine(); */ - logger.debug("SSH: Welcome message shown"); + if (logger.isDebugEnabled()) + logger.debug("SSH: Welcome message shown"); } /** @@ -571,7 +576,8 @@ public void shutdown() { return; } - logger.trace("Killing the SSH Protocol Provider."); + if (logger.isTraceEnabled()) + logger.trace("Killing the SSH Protocol Provider."); if(isRegistered()) { diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java index f3609233b..cb64b81f8 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHActivator.java @@ -76,7 +76,8 @@ public void start(BundleContext context) sshProviderFactory, hashtable); - logger.info("SSH protocol implementation [STARTED]."); + if (logger.isInfoEnabled()) + logger.info("SSH protocol implementation [STARTED]."); } /** @@ -117,7 +118,8 @@ public void stop(BundleContext context) { this.sshProviderFactory.stop(); sshPpFactoryServReg.unregister(); - logger.info("SSH protocol implementation [STOPPED]."); + if (logger.isInfoEnabled()) + logger.info("SSH protocol implementation [STOPPED]."); } public static ResourceManagementService getResources() diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/SSHFileTransferDaemon.java b/src/net/java/sip/communicator/impl/protocol/ssh/SSHFileTransferDaemon.java index 226c28943..1c5e81f86 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/SSHFileTransferDaemon.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/SSHFileTransferDaemon.java @@ -322,7 +322,8 @@ private void upload() // } command += file.getName() + "\n"; - logger.trace(command); + if (logger.isTraceEnabled()) + logger.trace(command); scpOutputStream.write(command.getBytes()); scpOutputStream.flush(); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java index dd6e0ea64..c7dfbda0a 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java @@ -277,7 +277,8 @@ public void invite(String userAddress, String reason) } catch (IOException ioe) { - logger.debug("Failed to invite the user: " + userAddress + if (logger.isDebugEnabled()) + logger.debug("Failed to invite the user: " + userAddress + " Error: " + ioe); } } @@ -315,7 +316,8 @@ public void join() throws OperationFailedException } catch (Exception e) { - logger.debug("Couldn't join the chat room: " + if (logger.isDebugEnabled()) + logger.debug("Couldn't join the chat room: " + yahooConference.getName() + e); } } @@ -348,7 +350,8 @@ public void leave() } catch (IOException ioe) { - logger.debug("Failed to leave the chat room: " + if (logger.isDebugEnabled()) + logger.debug("Failed to leave the chat room: " + yahooConference.getName() + " Error: " + ioe); } @@ -383,7 +386,8 @@ public void sendMessage(Message message) throws OperationFailedException } catch (Exception e) { - logger.debug("Failed to send a conference message."); + if (logger.isDebugEnabled()) + logger.debug("Failed to send a conference message."); } } @@ -443,7 +447,8 @@ public void fireParticipantPresenceEvent(Contact participant, String eventID, eventID, eventReason); - logger.trace("Will dispatch the following ChatRoom event: " + evt); + if (logger.isTraceEnabled()) + logger.trace("Will dispatch the following ChatRoom event: " + evt); Iterator listeners = null; synchronized (memberListeners) diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java index b263ed6d7..01aa59a47 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java @@ -179,7 +179,8 @@ public byte[] getImage(boolean retrieveIfNecessary) } catch (Exception e) { - logger.info("Error requesting image!", e); + if (logger.isInfoEnabled()) + logger.info("Error requesting image!", e); } if(logger.isDebugEnabled()) @@ -196,7 +197,8 @@ public byte[] getImage(boolean retrieveIfNecessary) protected void setImage(byte[] image) { if(logger.isDebugEnabled()) - logger.info("setting image " + image); + if (logger.isInfoEnabled()) + logger.info("setting image " + image); this.image = image; } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java index dc850f08a..ab3822728 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java @@ -275,7 +275,8 @@ private AdHocChatRoom createAdHocChatRoom( String errorMessage = "Failed to create chat room with name: " + roomName; - logger.debug(errorMessage, e); + if (logger.isDebugEnabled()) + logger.debug(errorMessage, e); throw new OperationFailedException(errorMessage, OperationFailedException.CHAT_ROOM_NOT_JOINED, e); } @@ -377,7 +378,8 @@ public void rejectInvitation(AdHocChatRoomInvitation invitation, } catch (IOException e) { - logger.debug("Failed to reject Invitation: " + e); + if (logger.isDebugEnabled()) + logger.debug("Failed to reject Invitation: " + e); } } @@ -537,7 +539,8 @@ private class YahooMessageListener public void conferenceInviteDeclinedReceived(SessionConferenceEvent ev) { - logger.debug("Group Chat invite declined received. " + if (logger.isDebugEnabled()) + logger.debug("Group Chat invite declined received. " + ev.toString()); try { @@ -548,13 +551,15 @@ public void conferenceInviteDeclinedReceived(SessionConferenceEvent ev) } catch (Exception e) { - logger.debug("Error: " + e); + if (logger.isDebugEnabled()) + logger.debug("Error: " + e); } } public void conferenceInviteReceived(SessionConferenceEvent ev) { - logger.debug("Conference Invite Received: " + ev.toString()); + if (logger.isDebugEnabled()) + logger.debug("Conference Invite Received: " + ev.toString()); try { @@ -572,13 +577,15 @@ public void conferenceInviteReceived(SessionConferenceEvent ev) } catch (Exception e) { - logger.debug("Error: " + e); + if (logger.isDebugEnabled()) + logger.debug("Error: " + e); } } public void conferenceLogoffReceived(SessionConferenceEvent ev) { - logger.debug("Conference Logoff Received: " + ev.toString()); + if (logger.isDebugEnabled()) + logger.debug("Conference Logoff Received: " + ev.toString()); try { @@ -602,7 +609,8 @@ public void conferenceLogoffReceived(SessionConferenceEvent ev) public void conferenceLogonReceived(SessionConferenceEvent ev) { - logger.debug("Conference Logon Received: " + ev.toString()); + if (logger.isDebugEnabled()) + logger.debug("Conference Logon Received: " + ev.toString()); try { @@ -624,18 +632,21 @@ public void conferenceLogonReceived(SessionConferenceEvent ev) } catch (Exception e) { - logger.debug("Failed to add a user to the chat room. " + e); + if (logger.isDebugEnabled()) + logger.debug("Failed to add a user to the chat room. " + e); } } public void conferenceMessageReceived(SessionConferenceEvent ev) { - logger.debug("Conference Message Received: " + ev.toString()); + if (logger.isDebugEnabled()) + logger.debug("Conference Message Received: " + ev.toString()); try { String formattedMessage = ev.getMessage(); - logger.debug("original message received : " + formattedMessage); + if (logger.isDebugEnabled()) + logger.debug("original message received : " + formattedMessage); // if the message is decorated by Yahoo, we try to "decode" it // first. @@ -656,7 +667,8 @@ public void conferenceMessageReceived(SessionConferenceEvent ev) "(", "$1 $2 style=\"font-size: $3px;\">"); - logger.debug("formatted Message : " + formattedMessage); + if (logger.isDebugEnabled()) + logger.debug("formatted Message : " + formattedMessage); // As no indications in the protocol is it html or not. No harm // to set all messages html - doesn't affect the appearance of // the gui @@ -699,7 +711,8 @@ public void conferenceMessageReceived(SessionConferenceEvent ev) public void connectionClosed(SessionEvent ev) { - logger.debug("Connection Closed: " + ev.toString()); + if (logger.isDebugEnabled()) + logger.debug("Connection Closed: " + ev.toString()); } } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java index 0ad8d20ea..dea60b54e 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java @@ -243,7 +243,8 @@ private class RegistrationStateListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); @@ -292,7 +293,8 @@ protected void fireMessageEvent(EventObject evt) if (filtered) { - logger.trace("Message event filtered."); + if (logger.isTraceEnabled()) + logger.trace("Message event filtered."); return; } @@ -379,7 +381,8 @@ public void newMailReceived(SessionNewMailEvent ev) if (sourceContact == null) { - logger.debug("received a new mail from an unknown contact: " + if (logger.isDebugEnabled()) + logger.debug("received a new mail from an unknown contact: " + ev.getFrom() + " <" + ev.getEmailAddress() + ">"); //create the volatile contact @@ -404,14 +407,16 @@ public void newMailReceived(SessionNewMailEvent ev) */ private void handleNewMessage(SessionEvent ev) { - logger.debug("Message received : " + ev); + if (logger.isDebugEnabled()) + logger.debug("Message received : " + ev); // to keep things simple, we can decodeToText() //String formattedMessage = processLinks( // messageDecoder.decodeToText(ev.getMessage())); String formattedMessage = ev.getMessage(); - logger.debug("original message received : " + formattedMessage); + if (logger.isDebugEnabled()) + logger.debug("original message received : " + formattedMessage); // make sure we always decode message formattedMessage = processLinks( @@ -427,7 +432,8 @@ private void handleNewMessage(SessionEvent ev) formattedMessage.replaceAll("(", "$1 $2 style=\"font-size: $3px;\">"); - logger.debug("formatted Message : " + formattedMessage); + if (logger.isDebugEnabled()) + logger.debug("formatted Message : " + formattedMessage); // As no indications in the protocol is it html or not. No harm // to set all messages html - doesn't affect the appearance of the // gui @@ -440,7 +446,8 @@ private void handleNewMessage(SessionEvent ev) if(sourceContact == null) { - logger.debug("received a message from an unknown contact: " + if (logger.isDebugEnabled()) + logger.debug("received a message from an unknown contact: " + ev.getFrom()); //create the volatile contact sourceContact = opSetPersPresence diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java index b3d092e46..abacd100a 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java @@ -434,7 +434,8 @@ private class RegistrationStateListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java index 25655c781..b6d0ac234 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java @@ -434,7 +434,8 @@ public PresenceStatus queryContactStatus(String contactIdentifier) throws ContactYahooImpl contact = ssContactList.findContactById(contactIdentifier); if(contact == null) { - logger.info("Contact not found id :" + contactIdentifier); + if (logger.isInfoEnabled()) + logger.info("Contact not found id :" + contactIdentifier); return null; } else @@ -708,7 +709,8 @@ private class RegistrationStateListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The yahoo provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The yahoo provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); @@ -802,7 +804,8 @@ private void handleContactStatusChange(YahooUser yFriend) equals(yFriend.getId())) { // thats my own status - logger.trace("Own status changed to " + yFriend.getStatus()); + if (logger.isTraceEnabled()) + logger.trace("Own status changed to " + yFriend.getStatus()); PresenceStatus oldStatus = currentStatus; currentStatus = yahooStatusToPresenceStatus(yFriend.getStatus()); @@ -831,7 +834,8 @@ void handleContactStatusChange(ContactYahooImpl sourceContact, YahooUser yFriend // when old and new status are the same do nothing - no change if(oldStatus.equals(newStatus)) { - logger.debug("old(" + oldStatus + ") and new("+ newStatus + ") statuses are the same!"); + if (logger.isDebugEnabled()) + logger.debug("old(" + oldStatus + ") and new("+ newStatus + ") statuses are the same!"); return; } @@ -840,7 +844,8 @@ void handleContactStatusChange(ContactYahooImpl sourceContact, YahooUser yFriend ContactGroup parent = ssContactList.findContactGroup(sourceContact); - logger.debug("Will Dispatch the contact status event."); + if (logger.isDebugEnabled()) + logger.debug("Will Dispatch the contact status event."); fireContactPresenceStatusChangeEvent(sourceContact, parent, oldStatus, newStatus); } @@ -850,7 +855,8 @@ private class StatusChangedListener { public void friendsUpdateReceived(SessionFriendEvent evt) { - logger.debug("Received a status update for contact " + evt); + if (logger.isDebugEnabled()) + logger.debug("Received a status update for contact " + evt); if(evt.getFriend() != null) { @@ -908,7 +914,8 @@ public void authorizationReceived(SessionAuthorizationEvent ev) { if(ev.isAuthorizationRequest()) { - logger.trace("authorizationRequestReceived from " + + if (logger.isTraceEnabled()) + logger.trace("authorizationRequestReceived from " + ev.getFrom()); receivedAuthorizations.add(ev); } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java index accd6272c..fecc19352 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java @@ -123,7 +123,8 @@ private class ProviderRegListener */ public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("The provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("The provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); if (evt.getNewState() == RegistrationState.REGISTERED) diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java index 4c3a81691..d8b7c3389 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java @@ -157,7 +157,8 @@ private void fireGroupEvent(ContactGroupYahooImpl group, int eventID) { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -168,7 +169,8 @@ private void fireGroupEvent(ContactGroupYahooImpl group, int eventID) , yahooProvider , parentOperationSet); - logger.trace("Will dispatch the following grp event: " + evt); + if (logger.isTraceEnabled()) + logger.trace("Will dispatch the following grp event: " + evt); Iterable listeners; synchronized (serverStoredGroupListeners) @@ -206,7 +208,8 @@ private void fireContactRemoved( ContactGroup parentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -229,7 +232,8 @@ private void fireContactMoved( ContactGroup oldParentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -368,7 +372,8 @@ public void addContact(String id) public void addContact(final ContactGroupYahooImpl parent, String id) throws OperationFailedException { - logger.trace("Adding contact " + id + " to parent=" + parent); + if (logger.isTraceEnabled()) + logger.trace("Adding contact " + id + " to parent=" + parent); //if the contact is already in the contact list and is not volatile, //then only broadcast an event @@ -377,7 +382,8 @@ public void addContact(final ContactGroupYahooImpl parent, String id) if( existingContact != null && existingContact.isPersistent() ) { - logger.debug("Contact " + id + " already exists."); + if (logger.isDebugEnabled()) + logger.debug("Contact " + id + " already exists."); throw new OperationFailedException( "Contact " + id + " already exists.", OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS); @@ -409,7 +415,8 @@ public void addContact(final ContactGroupYahooImpl parent, String id) */ ContactYahooImpl createVolatileContact(String id) { - logger.trace("Creating volatile contact " + id); + if (logger.isTraceEnabled()) + logger.trace("Creating volatile contact " + id); ContactYahooImpl newVolatileContact = new ContactYahooImpl(id, this, false, false, true); @@ -456,7 +463,8 @@ ContactYahooImpl createVolatileContact(String id) ContactYahooImpl createUnresolvedContact(ContactGroup parentGroup, String id) { - logger.trace("Creating unresolved contact " + id + if (logger.isTraceEnabled()) + logger.trace("Creating unresolved contact " + id + " to parent=" + parentGroup); ContactYahooImpl newUnresolvedContact = new ContactYahooImpl(id, this, false, false, false); @@ -486,7 +494,8 @@ ContactGroupYahooImpl createUnresolvedContactGroup(String groupName) if( existingGroup != null && existingGroup.isPersistent() ) { - logger.debug("ContactGroup " + groupName + " already exists."); + if (logger.isDebugEnabled()) + logger.debug("ContactGroup " + groupName + " already exists."); throw new IllegalArgumentException( "ContactGroup " + groupName + " already exists."); } @@ -511,13 +520,15 @@ ContactGroupYahooImpl createUnresolvedContactGroup(String groupName) public void createGroup(String groupName) throws OperationFailedException { - logger.trace("Creating group: " + groupName); + if (logger.isTraceEnabled()) + logger.trace("Creating group: " + groupName); ContactGroupYahooImpl existingGroup = findContactGroup(groupName); if( existingGroup != null && existingGroup.isPersistent() ) { - logger.debug("ContactGroup " + groupName + " already exists."); + if (logger.isDebugEnabled()) + logger.debug("ContactGroup " + groupName + " already exists."); throw new OperationFailedException( "ContactGroup " + groupName + " already exists.", OperationFailedException.CONTACT_GROUP_ALREADY_EXISTS); @@ -536,7 +547,8 @@ public void removeGroup(ContactGroupYahooImpl groupToRemove) { // to remove group just remove all the contacts in it - logger.trace("removing group " + groupToRemove); + if (logger.isTraceEnabled()) + logger.trace("removing group " + groupToRemove); // if its not persistent group just remove it if(!groupToRemove.isPersistent() || !groupToRemove.isResolved()) @@ -574,7 +586,8 @@ public void removeGroup(ContactGroupYahooImpl groupToRemove) } catch(IOException ex) { - logger.info("Cannot Remove contact " + item.getId()); + if (logger.isInfoEnabled()) + logger.info("Cannot Remove contact " + item.getId()); } } } @@ -586,7 +599,8 @@ public void removeGroup(ContactGroupYahooImpl groupToRemove) */ void removeContact(ContactYahooImpl contactToRemove) { - logger.trace("Removing yahoo contact " + if (logger.isTraceEnabled()) + logger.trace("Removing yahoo contact " + contactToRemove.getSourceContact()); if(contactToRemove.isVolatile()) @@ -607,7 +621,8 @@ void removeContact(ContactYahooImpl contactToRemove) } catch(IOException ex) { - logger.info("Cannot Remove contact " + contactToRemove); + if (logger.isInfoEnabled()) + logger.info("Cannot Remove contact " + contactToRemove); } } @@ -626,7 +641,8 @@ public void renameGroup(ContactGroupYahooImpl groupToRename, String newName) } catch(IOException ex) { - logger.info("Cannot rename group " + groupToRename); + if (logger.isInfoEnabled()) + logger.info("Cannot rename group " + groupToRename); } fireGroupEvent(groupToRename, @@ -710,7 +726,8 @@ void fireContactAdded( ContactGroup parentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -730,7 +747,8 @@ void fireContactResolved( ContactGroup parentGroup, { //bail out if no one's listening if(parentOperationSet == null){ - logger.debug("No presence op. set available. Bailing out."); + if (logger.isDebugEnabled()) + logger.debug("No presence op. set available. Bailing out."); return; } @@ -746,7 +764,8 @@ void fireContactResolved( ContactGroup parentGroup, @SuppressWarnings("unchecked") //jymsg legacy code private void initList() { - logger.trace("Start init list of " + if (logger.isTraceEnabled()) + logger.trace("Start init list of " + yahooProvider.getAccountID().getUserID()); for (YahooGroup item : yahooSession.getGroups()) @@ -778,7 +797,8 @@ private void initList() /** @todo if something to delete . delete it */ } - logger.trace("Init of group done! : " + group); + if (logger.isTraceEnabled()) + logger.trace("Init of group done! : " + group); } } @@ -893,13 +913,15 @@ public void removeWaitForMove(String id) */ public void friendAddedReceived(SessionFriendEvent ev) { - logger.trace("Receive event for adding a friend : " + ev); + if (logger.isTraceEnabled()) + logger.trace("Receive event for adding a friend : " + ev); ContactGroupYahooImpl group = findContactGroup(ev.getGroup()); if(group == null){ - logger.trace("Group not found!" + ev.getGroup()); + if (logger.isTraceEnabled()) + logger.trace("Group not found!" + ev.getGroup()); return; } @@ -976,7 +998,8 @@ public void friendAddedReceived(SessionFriendEvent ev) } catch(IOException ex) { - logger.info("Cannot Remove(till moving) contact :" + + if (logger.isInfoEnabled()) + logger.info("Cannot Remove(till moving) contact :" + contactToAdd + " from group " + oldParent); } return; @@ -1017,7 +1040,8 @@ public void friendAddedReceived(SessionFriendEvent ev) */ public void friendRemovedReceived(SessionFriendEvent ev) { - logger.trace("Receive event for removing a friend : " + ev); + if (logger.isTraceEnabled()) + logger.trace("Receive event for removing a friend : " + ev); String contactID = ev.getFriend().getId(); @@ -1072,7 +1096,8 @@ public void friendRemovedReceived(SessionFriendEvent ev) */ public void contactRequestReceived(SessionEvent ev) { - logger.info("contactRequestReceived : " + ev); + if (logger.isInfoEnabled()) + logger.info("contactRequestReceived : " + ev); if(handler == null || ev.getFrom() == null) return; @@ -1106,7 +1131,8 @@ public void contactRequestReceived(SessionEvent ev) */ public void contactRejectionReceived(SessionEvent ev) { - logger.info("contactRejectionReceived : " + ev); + if (logger.isInfoEnabled()) + logger.info("contactRejectionReceived : " + ev); if(handler == null) return; @@ -1145,11 +1171,13 @@ public void authorizationReceived(SessionAuthorizationEvent ev) { if(ev.isAuthorizationAccepted()) { - logger.trace("authorizationAccepted from " + ev.getFrom()); + if (logger.isTraceEnabled()) + logger.trace("authorizationAccepted from " + ev.getFrom()); Contact srcContact = findContactById(ev.getFrom()); if(srcContact == null) - logger.trace("No contact found"); + if (logger.isTraceEnabled()) + logger.trace("No contact found"); else handler.processAuthorizationResponse( new AuthorizationResponse( @@ -1159,11 +1187,13 @@ public void authorizationReceived(SessionAuthorizationEvent ev) } else if(ev.isAuthorizationDenied()) { - logger.trace("authorizationDenied from " + ev.getFrom()); + if (logger.isTraceEnabled()) + logger.trace("authorizationDenied from " + ev.getFrom()); Contact srcContact = findContactById(ev.getFrom()); if(srcContact == null) - logger.trace("No contact found"); + if (logger.isTraceEnabled()) + logger.trace("No contact found"); else { handler.processAuthorizationResponse( @@ -1183,7 +1213,8 @@ else if(ev.isAuthorizationDenied()) } else if(ev.isAuthorizationRequest()) { - logger.trace("authorizationRequestReceived from " + if (logger.isTraceEnabled()) + logger.trace("authorizationRequestReceived from " + ev.getFrom()); processAuthorizationRequest(ev); } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java index a5370f447..142b01151 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java @@ -114,7 +114,8 @@ public BonjourService(int port, port = sock.getLocalPort(); - logger.debug("ZEROCONF: ServerSocket bound to port "+port); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: ServerSocket bound to port "+port); props.put("port.p2pj", Integer.toString(port)); this.setDaemon(true); @@ -129,7 +130,8 @@ public BonjourService(int port, */ public void run() { - logger.debug("ZEROCONF: Bonjour Service Thread up and running!"); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Bonjour Service Thread up and running!"); /* Put jmDNS in DEBUD Mode : * Following verbosity levels can be chosen : @@ -180,7 +182,8 @@ else if (contact.getClientThread() == null) } } - logger.debug("ZEROCONF: Going Offline - " + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Going Offline - " +"BonjourService Thread exiting!"); } @@ -189,7 +192,8 @@ else if (contact.getClientThread() == null) */ public void shutdown() { - logger.debug("ZEROCONF: Shutdown!"); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Shutdown!"); dead = true; try @@ -240,7 +244,8 @@ public void changeStatus(PresenceStatus stat) /* [new_status == OFFLINE ?] => clean up everything */ if (stat.equals(ZeroconfStatusEnum.OFFLINE)) { - logger.debug("ZEROCONF: Going OFFLINE"); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Going OFFLINE"); //jmdns.unregisterAllServices(); jmdns.removeServiceListener("_presence._tcp.local.", this); jmdns.close(); @@ -263,7 +268,8 @@ public void changeStatus(PresenceStatus stat) /* [old_status == OFFLINE ?] => register service */ else if (status.equals(ZeroconfStatusEnum.OFFLINE)) { - logger.debug("ZEROCONF: Getting out of OFFLINE state"); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Getting out of OFFLINE state"); props.put("status", stat.getStatusName()); service = new ServiceInfo("_presence._tcp.local.", id, port, 0, 0, props); @@ -287,7 +293,8 @@ else if (status.equals(ZeroconfStatusEnum.OFFLINE)) } else { - logger.debug("ZEROCONF : Changing status"); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF : Changing status"); props.put("status", stat.getStatusName()); @@ -367,7 +374,8 @@ public void serviceAdded(ServiceEvent event) if (name.equals(id)) return; - logger.debug("BONJOUR: "+name + if (logger.isDebugEnabled()) + logger.debug("BONJOUR: "+name +"["+type+"] detected! Trying to get information..."); try { @@ -400,7 +408,8 @@ public void serviceRemoved(ServiceEvent event) opSetPersPresence.changePresenceStatusForContact(contact, ZeroconfStatusEnum.OFFLINE); - logger.debug("BONJOUR: Received announcement that " + if (logger.isDebugEnabled()) + logger.debug("BONJOUR: Received announcement that " +name+" went offline!"); } @@ -419,7 +428,8 @@ public void serviceResolved(ServiceEvent event) String type = event.getType(); ServiceInfo info = event.getInfo(); - logger.debug("BONJOUR: Information about " + if (logger.isDebugEnabled()) + logger.debug("BONJOUR: Information about " +contactID+" discovered"); handleResolvedService(contactID, type, info); @@ -434,7 +444,8 @@ private void handleResolvedService(String contactID, if (info.getAddress().toString().length() > 15) { - logger.debug("ZEROCONF: Temporarily ignoring IPv6 addresses!"); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Temporarily ignoring IPv6 addresses!"); return; } @@ -444,21 +455,25 @@ private void handleResolvedService(String contactID, { if (getContact(contactID, info.getAddress()) != null) { - logger.debug("Contact " + if (logger.isDebugEnabled()) + logger.debug("Contact " +contactID+" already in contact list! Skipping."); return; }; - logger.debug("ZEROCNF: ContactID " + contactID + + if (logger.isDebugEnabled()) + logger.debug("ZEROCNF: ContactID " + contactID + " Address " + info.getAddress()); - logger.debug(" Address=>"+info.getAddress() + if (logger.isDebugEnabled()) + logger.debug(" Address=>"+info.getAddress() +":"+info.getPort()); for (Iterator names = info.getPropertyNames(); names.hasNext();) { String prop = names.next(); - logger.debug(" "+prop+"=>" + if (logger.isDebugEnabled()) + logger.debug(" "+prop+"=>" +info.getPropertyString(prop)); } @@ -477,7 +492,8 @@ private void handleResolvedService(String contactID, return; } - logger.debug("ZEROCONF: Detected client "+name); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Detected client "+name); newFriend = opSetPersPresence.createVolatileContact( @@ -499,7 +515,8 @@ else if (info.getPropertyString("jid") == null) clientType = ContactZeroconfImpl.ICHAT; newFriend.setClientType(clientType); - logger.debug("ZEROCONF: CLIENT TYPE "+clientType); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: CLIENT TYPE "+clientType); ZeroconfStatusEnum status = ZeroconfStatusEnum.statusOf(info.getPropertyString("status")); @@ -524,7 +541,8 @@ public synchronized void updateRecord( JmDNS jmdns, long now, DNSRecord record) { - logger.debug("ZEROCONF/JMDNS: Received record update for "+record); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF/JMDNS: Received record update for "+record); int clazz = record.getClazz(); int type = record.getType(); @@ -552,7 +570,8 @@ public synchronized void updateRecord( JmDNS jmdns, } } - logger.debug("ZEROCONF: "+ name + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: "+ name + " changed status. Requesting fresh data!"); /* Since a record was updated, we can be sure that we can do a blocking diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java index 35da61af9..b8e13c988 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java @@ -199,7 +199,8 @@ private MessageZeroconfImpl parseMessage(String str) String temp = str.substring(str.indexOf("")+6, str.indexOf("")); - logger.debug("ZEROCONF: received message ["+temp+"]"); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: received message ["+temp+"]"); int messageType = MessageZeroconfImpl.MESSAGE; @@ -243,7 +244,8 @@ private int handleMessage(MessageZeroconfImpl msg) /* NORMAL MESSAGE */ case MessageZeroconfImpl.MESSAGE: if (!isStreamOpened()) - logger.debug("ZEROCONF: client on the other side " + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: client on the other side " +"isn't polite (sending messages without " +"saying hello :P"); if (contact == null) @@ -272,7 +274,8 @@ else if (contact.getClientThread() == null) case MessageZeroconfImpl.TYPING: if (!isStreamOpened()) - logger.debug("ZEROCONF: client on the other side " + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: client on the other side " +"isn't polite (sending messages without " +"saying hello :P"); if (contact == null) @@ -423,12 +426,14 @@ private String toXHTML(MessageZeroconfImpl msg) */ public void sendMessage(MessageZeroconfImpl msg) { - logger.debug("ZEROCONF: Sending messag [" + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Sending messag [" +msg.getContent()+"] to " + contact.getDisplayName()); if (!isStreamOpened()) { - logger.debug("ZEROCONF: Stream not opened... " + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Stream not opened... " +"will send the message later"); messagesQueue += toXHTML(msg); } @@ -440,7 +445,8 @@ public void sendMessage(MessageZeroconfImpl msg) */ public void run() { - logger.debug("Bonjour: NEW CONNEXION from " + if (logger.isDebugEnabled()) + logger.debug("Bonjour: NEW CONNEXION from " + sock.getInetAddress().getCanonicalHostName() +" / "+sock.getInetAddress().getHostAddress()); String input; @@ -456,7 +462,8 @@ public void run() msg = parseMessage(input); } - logger.debug("ZEROCONF : OUT OF LOOP !! Closed chat."); + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF : OUT OF LOOP !! Closed chat."); cleanThread(); } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetBasicInstantMessagingZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetBasicInstantMessagingZeroconfImpl.java index a73ed70e3..1205dfd56 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetBasicInstantMessagingZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetBasicInstantMessagingZeroconfImpl.java @@ -100,7 +100,8 @@ private void deliverMessage(Message message, ContactZeroconfImpl to) if (thread == null) { Socket sock; - logger.debug("ZEROCONF: Creating a chat connexion to " + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF: Creating a chat connexion to " +to.getIpAddress()+":"+to.getPort()); sock = new Socket(to.getIpAddress(), to.getPort()); thread = new ClientThread(sock, to.getBonjourService()); diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetPersistentPresenceZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetPersistentPresenceZeroconfImpl.java index 3959ec7de..cc598e445 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetPersistentPresenceZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/OperationSetPersistentPresenceZeroconfImpl.java @@ -712,7 +712,8 @@ private class UnregistrationListener public void registrationStateChanged(RegistrationStateChangeEvent evt) { - logger.debug("ZEROCONF : The Zeroconf provider changed state from: " + if (logger.isDebugEnabled()) + logger.debug("ZEROCONF : The Zeroconf provider changed state from: " + evt.getOldState() + " to: " + evt.getNewState()); diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java index fba8b40bc..f9bebe21f 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java @@ -62,7 +62,8 @@ public class ProtocolProviderServiceZeroconfImpl */ public ProtocolProviderServiceZeroconfImpl() { - logger.trace("Creating a zeroconf provider."); + if (logger.isTraceEnabled()) + logger.trace("Creating a zeroconf provider."); } /** @@ -184,7 +185,8 @@ public void register(SecurityAuthority authority) //ICI : creer le service Zeroconf !! - logger.info("ZEROCONF: Starting the service"); + if (logger.isInfoEnabled()) + logger.info("ZEROCONF: Starting the service"); this.bonjourService = new BonjourService(5298, this); //bonjourService.changeStatus(ZeroconfStatusEnum.ONLINE); @@ -207,7 +209,8 @@ public void shutdown() { return; } - logger.trace("Killing the Zeroconf Protocol Provider."); + if (logger.isTraceEnabled()) + logger.trace("Killing the Zeroconf Protocol Provider."); if(isRegistered()) { diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfActivator.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfActivator.java index 191ca0a54..dcf0655f6 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfActivator.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ZeroconfActivator.java @@ -71,7 +71,8 @@ public void start(BundleContext context) zeroconfProviderFactory, hashtable); - logger.info("Zeroconf protocol implementation [STARTED]."); + if (logger.isInfoEnabled()) + logger.info("Zeroconf protocol implementation [STARTED]."); } /** @@ -112,6 +113,7 @@ public void stop(BundleContext context) zeroconfProviderFactory.stop(); zeroconfPpFactoryServReg.unregister(); - logger.info("Zeroconf protocol implementation [STOPPED]."); + if (logger.isInfoEnabled()) + logger.info("Zeroconf protocol implementation [STOPPED]."); } } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java index f6608f75d..03706b0fa 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/DNSCache.java @@ -4,7 +4,7 @@ package net.java.sip.communicator.impl.protocol.zeroconf.jmdns; import java.util.*; -import java.util.logging.*; +import net.java.sip.communicator.util.*; /** * A table of DNS entries. This is a hash table which @@ -84,9 +84,10 @@ public static class CacheNode public CacheNode(DNSEntry value) { this.value = value; - String SLevel = System.getProperty("jmdns.debug"); - if (SLevel == null) SLevel = "INFO"; - logger.setLevel(Level.parse(SLevel)); +// String SLevel = System.getProperty("jmdns.debug"); +// if (SLevel == null) +// SLevel = "INFO"; +// logger.setLevel(Level.parse(SLevel)); } public CacheNode next() @@ -109,9 +110,9 @@ public DNSCache(final int size) { hashtable = new HashMap(size); - String SLevel = System.getProperty("jmdns.debug"); - if (SLevel == null) SLevel = "INFO"; - logger.setLevel(Level.parse(SLevel)); +// String SLevel = System.getProperty("jmdns.debug"); +// if (SLevel == null) SLevel = "INFO"; +// logger.setLevel(Level.parse(SLevel)); } /** @@ -256,7 +257,8 @@ public synchronized void print() { for (CacheNode n = i.next(); n != null; n = n.next) { - logger.info(n.value.toString()); + if (logger.isInfoEnabled()) + logger.info(n.value.toString()); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java index 30ac500f8..1f19c42bb 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/jmdns/JmDNS.java @@ -166,7 +166,8 @@ public JmDNS() { //String SLevel = System.getProperty("jmdns.debug"); - logger.debug("JmDNS instance created"); + if (logger.isDebugEnabled()) + logger.debug("JmDNS instance created"); try { InetAddress addr = InetAddress.getLocalHost(); @@ -279,7 +280,8 @@ private void openMulticastSocket(HostInfo hostInfo) throws IOException private void closeMulticastSocket() { - logger.debug("closeMulticastSocket()"); + if (logger.isDebugEnabled()) + logger.debug("closeMulticastSocket()"); if (socket != null) { // close socket @@ -642,7 +644,8 @@ public void registerService(ServiceInfo info) throws IOException { logger.error(e.getMessage(), e); } - logger.debug("registerService() JmDNS registered service as " + info); + if (logger.isDebugEnabled()) + logger.debug("registerService() JmDNS registered service as " + info); } /** @@ -686,7 +689,8 @@ public void unregisterService(ServiceInfo info) */ public void unregisterAllServices() { - logger.debug("unregisterAllServices()"); + if (logger.isDebugEnabled()) + logger.debug("unregisterAllServices()"); if (services.size() == 0) { return; @@ -779,7 +783,8 @@ private boolean makeServiceNameUnique(ServiceInfo info) DNSRecord.Service s = (DNSRecord.Service) a; if (s.port != info.port || !s.server.equals(localHost.getName())) { - logger.debug("makeServiceNameUnique() " + + if (logger.isDebugEnabled()) + logger.debug("makeServiceNameUnique() " + "JmDNS.makeServiceNameUnique srv collision:" + a + " s.server=" + s.server + " " + localHost.getName() + " equals:" + @@ -958,11 +963,13 @@ private void handleResponse(DNSIncoming msg) boolean hostConflictDetected = false; boolean serviceConflictDetected = false; - logger.trace("JMDNS/handleResponse received " + + if (logger.isTraceEnabled()) + logger.trace("JMDNS/handleResponse received " + msg.answers.size()+ " messages"); for (DNSRecord rec : msg.answers) { - logger.trace("PRINT: "+ rec); + if (logger.isTraceEnabled()) + logger.trace("PRINT: "+ rec); //cache.add(rec); } @@ -971,13 +978,15 @@ private void handleResponse(DNSIncoming msg) boolean isInformative = false; boolean expired = rec.isExpired(now); - logger.trace("JMDNS received : " + rec + " expired: "+expired); + if (logger.isTraceEnabled()) + logger.trace("JMDNS received : " + rec + " expired: "+expired); // update the cache DNSRecord c = (DNSRecord) cache.get(rec); if (c != null) { - logger.trace("JMDNS has found "+rec+" in cache"); + if (logger.isTraceEnabled()) + logger.trace("JMDNS has found "+rec+" in cache"); if (expired) { isInformative = true; @@ -994,7 +1003,8 @@ private void handleResponse(DNSIncoming msg) // isInformative = true; // c.resetTTL(rec); // rec = c; - logger.trace( + if (logger.isTraceEnabled()) + logger.trace( new Boolean(c.isUnique()).toString() + c.getType()+c.getClazz() + "/" + DNSConstants.TYPE_TXT + " "+DNSConstants.CLASS_IN); @@ -1003,7 +1013,8 @@ private void handleResponse(DNSIncoming msg) && ((rec.getType() & DNSConstants.TYPE_TXT) != 0) && ((rec.getClazz() & DNSConstants.CLASS_IN) != 0))) { - logger.trace("UPDATING CACHE !! "); + if (logger.isTraceEnabled()) + logger.trace("UPDATING CACHE !! "); isInformative = true; cache.remove(c); cache.add(rec); @@ -1020,7 +1031,8 @@ private void handleResponse(DNSIncoming msg) if (!expired) { isInformative = true; - logger.trace("Adding "+rec+" to the cache"); + if (logger.isTraceEnabled()) + logger.trace("Adding "+rec+" to the cache"); cache.add(rec); } } @@ -1165,7 +1177,8 @@ private void send(DNSOutgoing out) throws IOException try { DNSIncoming msg = new DNSIncoming(packet); - logger.trace("send() JmDNS out:" + msg.print(true)); + if (logger.isTraceEnabled()) + logger.trace("send() JmDNS out:" + msg.print(true)); } catch (IOException exc) { @@ -1204,7 +1217,8 @@ public void run() } DNSIncoming msg = new DNSIncoming(packet); - logger.trace("SocketListener.run() JmDNS in:" + + if (logger.isTraceEnabled()) + logger.trace("SocketListener.run() JmDNS in:" + msg.print(true)); synchronized (ioLock) @@ -1263,7 +1277,8 @@ public void run() { return; } - logger.trace("run() JmDNS reaping cache"); + if (logger.isTraceEnabled()) + logger.trace("run() JmDNS reaping cache"); // Remove expired answers from the cache // ------------------------------------- @@ -1444,7 +1459,8 @@ public void run() info.task == this) { info.advanceState(); - logger.debug("run() JmDNS probing " + + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS probing " + info.getQualifiedName() + " state " + info.getState()); @@ -1473,7 +1489,8 @@ public void run() } if (out != null) { - logger.debug("run() JmDNS probing #" + taskState); + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS probing #" + taskState); send(out); } else @@ -1612,7 +1629,8 @@ public void run() if (info.getState() == taskState && info.task == this) { info.advanceState(); - logger.debug("run() JmDNS announcing " + + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS announcing " + info.getQualifiedName() + " state " + info.getState()); @@ -1651,7 +1669,8 @@ public void run() } if (out != null) { - logger.debug("run() JmDNS announcing #" + taskState); + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS announcing #" + taskState); send(out); } else @@ -1783,7 +1802,8 @@ public void run() if (info.getState() == taskState && info.task == this) { info.advanceState(); - logger.debug("run() JmDNS announced " + + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS announced " + info.getQualifiedName() + " state " + info.getState()); if (out == null) @@ -1821,7 +1841,8 @@ public void run() } if (out != null) { - logger.debug("run() JmDNS announced"); + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS announced"); send(out); } else @@ -1881,7 +1902,8 @@ public void start() if (entry instanceof DNSQuestion) { DNSQuestion q = (DNSQuestion) entry; - logger.trace("start() question=" + q); + if (logger.isTraceEnabled()) + logger.trace("start() question=" + q); iAmTheOnlyOne &= (q.type == DNSConstants.TYPE_SRV || q.type == DNSConstants.TYPE_TXT || q.type == DNSConstants.TYPE_A @@ -1905,7 +1927,8 @@ public void start() { delay = 0; } - logger.trace("start() Responder chosen delay=" + delay); + if (logger.isTraceEnabled()) + logger.trace("start() Responder chosen delay=" + delay); timer.schedule(this, delay); } @@ -2138,7 +2161,8 @@ public void run() if (knownAnswer.ttl > DNSConstants.DNS_TTL / 2 && answers.remove(knownAnswer)) { - logger.debug( + if (logger.isDebugEnabled()) + logger.debug( "JmDNS Responder Known Answer Removed"); } } @@ -2147,7 +2171,8 @@ public void run() // responde if we have answers if (answers.size() != 0) { - logger.debug("run() JmDNS responding"); + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS responding"); DNSOutgoing out = null; if (isUnicast) { @@ -2211,7 +2236,8 @@ public void run() { if (count++ < 3) { - logger.debug("run() JmDNS querying type"); + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS querying type"); DNSOutgoing out = new DNSOutgoing(DNSConstants.FLAGS_QR_QUERY); out.addQuestion( @@ -2289,7 +2315,8 @@ public void run() { if (count++ < 3) { - logger.debug("run() JmDNS querying service"); + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS querying service"); long now = System.currentTimeMillis(); DNSOutgoing out = new DNSOutgoing(DNSConstants.FLAGS_QR_QUERY); @@ -2511,7 +2538,8 @@ public void run() { if (++count < 3) { - logger.debug("run() JmDNS canceling service"); + if (logger.isDebugEnabled()) + logger.debug("run() JmDNS canceling service"); // announce the service //long now = System.currentTimeMillis(); DNSOutgoing out = @@ -2581,7 +2609,8 @@ public void run() */ protected void recover() { - logger.debug("recover()"); + if (logger.isDebugEnabled()) + logger.debug("recover()"); // We have an IO error so lets try to recover if anything happens lets close it. // This should cover the case of the IP address changing under our feet if (DNSState.CANCELED != state) @@ -2589,7 +2618,8 @@ protected void recover() synchronized (this) { // Synchronize only if we are not already in process to prevent dead locks // - logger.debug("recover() Cleanning up"); + if (logger.isDebugEnabled()) + logger.debug("recover() Cleanning up"); // Stop JmDNS state = DNSState.CANCELED; // This protects against recursive calls @@ -2604,7 +2634,8 @@ protected void recover() closeMulticastSocket(); // cache.clear(); - logger.debug("recover() All is clean"); + if (logger.isDebugEnabled()) + logger.debug("recover() All is clean"); // // All is clear now start the services // @@ -2652,9 +2683,11 @@ public void close() */ void print() { - logger.info("---- cache ----\n"); + if (logger.isInfoEnabled()) + logger.info("---- cache ----\n"); cache.print(); - logger.info("\n"); + if (logger.isInfoEnabled()) + logger.info("\n"); } /** @@ -2664,7 +2697,8 @@ void print() public void printServices() { - logger.info(toString()); + if (logger.isInfoEnabled()) + logger.info(toString()); } public String toString() @@ -2769,7 +2803,8 @@ public ServiceInfo[] list(String type) */ private void disposeServiceCollectors() { - logger.debug("disposeServiceCollectors()"); + if (logger.isDebugEnabled()) + logger.debug("disposeServiceCollectors()"); synchronized (serviceCollectors) { for (Iterator i = serviceCollectors.values().iterator(); i.hasNext();) @@ -2903,7 +2938,8 @@ public void updateInfos(ServiceInfo info, byte[] old) synchronized (info) { - logger.debug("updateInfos() JmDNS updating " + + if (logger.isDebugEnabled()) + logger.debug("updateInfos() JmDNS updating " + info.getQualifiedName() + " state " + info.getState()); @@ -2950,7 +2986,8 @@ public void updateInfos(ServiceInfo info, byte[] old) DNSConstants.DNS_TTL, info.text), 0); - logger.debug("updateInfos() JmDNS updated infos for "+info); + if (logger.isDebugEnabled()) + logger.debug("updateInfos() JmDNS updated infos for "+info); send(out); Thread.sleep(1000);