From ff2dec3ca08e4c0c92d2b3fd2ecb930194cc9daa Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Thu, 18 May 2006 12:54:18 +0000 Subject: [PATCH] Exceptions logged properly. --- .../impl/gui/main/CommunicatorMain.java | 25 +++++++------ .../communicator/impl/gui/main/MainFrame.java | 37 ++++++++----------- .../impl/gui/utils/Constants.java | 6 ++- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java b/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java index e578f6a76..996be0f71 100755 --- a/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java +++ b/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java @@ -12,6 +12,7 @@ import javax.swing.JOptionPane; import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.metal.MetalTheme; @@ -19,6 +20,7 @@ import net.java.sip.communicator.impl.gui.lookandfeel.SIPCommLookAndFeel; import net.java.sip.communicator.impl.gui.main.configforms.ConfigurationFrame; import net.java.sip.communicator.impl.gui.utils.ImageLoader; +import net.java.sip.communicator.util.Logger; /** * Starts the GUI application using the SkinLookAndFeel of l2fprod. @@ -29,6 +31,8 @@ public class CommunicatorMain { private MainFrame mainFrame; + private Logger logger = Logger.getLogger(CommunicatorMain.class.getName()); + public CommunicatorMain() { this.setDefaultThemePack(); @@ -46,19 +50,18 @@ public CommunicatorMain() { public void setDefaultThemePack() { - try { - SIPCommLookAndFeel lf = new SIPCommLookAndFeel(); - SIPCommLookAndFeel.setCurrentTheme(new SIPCommDefaultTheme()); - - // we need to set the UIDefaults class loader so that it may access - // resources packed inside OSGI bundles - UIManager.put("ClassLoader", getClass() - .getClassLoader()); + SIPCommLookAndFeel lf = new SIPCommLookAndFeel(); + SIPCommLookAndFeel.setCurrentTheme(new SIPCommDefaultTheme()); + // we need to set the UIDefaults class loader so that it may access + // resources packed inside OSGI bundles + UIManager.put("ClassLoader", getClass() + .getClassLoader()); + try{ UIManager.setLookAndFeel(lf); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } + catch(UnsupportedLookAndFeelException e){ + logger.error("The provided Look & Feel is not supported.", e); } } diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java index b31b55e2d..a68bdcb28 100755 --- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java @@ -39,6 +39,7 @@ import net.java.sip.communicator.service.protocol.event.ProviderPresenceStatusChangeEvent; import net.java.sip.communicator.service.protocol.event.ProviderPresenceStatusListener; import net.java.sip.communicator.service.protocol.icqconstants.IcqStatusEnum; +import net.java.sip.communicator.util.Logger; /** * The main application frame. @@ -47,6 +48,8 @@ */ public class MainFrame extends JFrame { + private Logger logger = Logger.getLogger(MainFrame.class.getName()); + private JPanel contactListPanel = new JPanel(new BorderLayout()); private JPanel menusPanel = new JPanel(new BorderLayout()); @@ -212,29 +215,21 @@ public void setConfigFrame(ConfigurationFrame configFrame) { try { presence .publishPresenceStatus(IcqStatusEnum.ONLINE, ""); - - this.getStatusPanel().stopConnecting( - protocolProvider.getProtocolName()); - - this.statusPanel.setSelectedStatus - (protocolProvider.getProtocolName(), - Constants.ONLINE_STATUS); - - //request the focus int the contact list panel, which - //permits to search in the contact list - this.tabbedPane.getContactListPanel() - .getContactList().requestFocus(); - - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } catch (OperationFailedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.error("Publish presence status failed.", e); } + + this.getStatusPanel().stopConnecting( + protocolProvider.getProtocolName()); + + this.statusPanel.setSelectedStatus + (protocolProvider.getProtocolName(), + Constants.ONLINE_STATUS); + + //request the focus int the contact list panel, which + //permits to search in the contact list + this.tabbedPane.getContactListPanel() + .getContactList().requestFocus(); } else if(key.equals(OperationSetBasicInstantMessaging.class.getName()) || key.equals(OperationSetPresence.class.getName())){ diff --git a/src/net/java/sip/communicator/impl/gui/utils/Constants.java b/src/net/java/sip/communicator/impl/gui/utils/Constants.java index 72a401eb3..c1a9f1fc2 100755 --- a/src/net/java/sip/communicator/impl/gui/utils/Constants.java +++ b/src/net/java/sip/communicator/impl/gui/utils/Constants.java @@ -23,8 +23,10 @@ import javax.swing.text.html.StyleSheet; +import net.java.sip.communicator.impl.gui.main.CommunicatorMain; import net.java.sip.communicator.service.protocol.PresenceStatus; import net.java.sip.communicator.service.protocol.icqconstants.IcqStatusEnum; +import net.java.sip.communicator.util.Logger; /** * All look and feel related constants are stored here. @@ -34,6 +36,7 @@ public class Constants { + private static Logger logger = Logger.getLogger(CommunicatorMain.class.getName()); /* * =================================================================== * ------------------------ SIZE CONSTANTS --------------------------- @@ -350,8 +353,7 @@ public static void loadStyle(StyleSheet style){ style.loadRules(r, null); r.close(); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.error("Failed to load css style.", e); } }