diff --git a/core/src/main/java/org/jivesoftware/resource/ConfigurationRes.java b/core/src/main/java/org/jivesoftware/resource/ConfigurationRes.java index 561206d9..61778b85 100644 --- a/core/src/main/java/org/jivesoftware/resource/ConfigurationRes.java +++ b/core/src/main/java/org/jivesoftware/resource/ConfigurationRes.java @@ -15,6 +15,8 @@ */ package org.jivesoftware.resource; +import org.jivesoftware.spark.util.log.Log; + import javax.swing.ImageIcon; import java.io.IOException; @@ -55,9 +57,14 @@ public class ConfigurationRes { } public static ImageIcon getImageIcon(String imageName) { - final String iconURI = getString(imageName); - final URL imageURL = cl.getResource(iconURI); - return new ImageIcon(imageURL); + try { + final String iconURI = getString(imageName); + final URL imageURL = cl.getResource(iconURI); + return new ImageIcon(imageURL); + } catch (Throwable t) { + Log.warning(imageName + " not found.", t); + } + return null; } public static URL getURL(String propertyName) { diff --git a/core/src/main/java/org/jivesoftware/resource/Default.java b/core/src/main/java/org/jivesoftware/resource/Default.java index 370db6e1..2ba04300 100644 --- a/core/src/main/java/org/jivesoftware/resource/Default.java +++ b/core/src/main/java/org/jivesoftware/resource/Default.java @@ -208,8 +208,8 @@ public class Default { cache.put(imageName, icon); return icon; } - catch (Exception ex) { - Log.debug(imageName + " not found."); + catch (Throwable t) { + Log.warning(imageName + " not found.", t); } return null; } diff --git a/core/src/main/java/org/jivesoftware/resource/SoundsRes.java b/core/src/main/java/org/jivesoftware/resource/SoundsRes.java index 3e18832b..3e9adc7c 100644 --- a/core/src/main/java/org/jivesoftware/resource/SoundsRes.java +++ b/core/src/main/java/org/jivesoftware/resource/SoundsRes.java @@ -15,6 +15,8 @@ */ package org.jivesoftware.resource; +import org.jivesoftware.spark.util.log.Log; + import javax.swing.ImageIcon; import java.io.IOException; @@ -52,9 +54,14 @@ public class SoundsRes { } public static ImageIcon getImageIcon(String imageName) { - final String iconURI = getString(imageName); - final URL imageURL = cl.getResource(iconURI); - return new ImageIcon(imageURL); + try { + final String iconURI = getString(imageName); + final URL imageURL = cl.getResource(iconURI); + return new ImageIcon(imageURL); + } catch (Throwable t) { + Log.warning(imageName + " not found.", t); + } + return null; } public static URL getURL(String propertyName) { diff --git a/core/src/main/java/org/jivesoftware/resource/SparkRes.java b/core/src/main/java/org/jivesoftware/resource/SparkRes.java index c2710ee5..a0ce7745 100644 --- a/core/src/main/java/org/jivesoftware/resource/SparkRes.java +++ b/core/src/main/java/org/jivesoftware/resource/SparkRes.java @@ -355,8 +355,8 @@ public class SparkRes { try { final URL imageURL = getURL(imageName); return new ImageIcon(imageURL); - } catch (Exception ex) { - Log.error(imageName + " not found."); + } catch (Throwable t) { + Log.warning(imageName + " not found.", t); } return null; } diff --git a/plugins/fastpath/src/main/java/org/jivesoftware/fastpath/resources/FastpathRes.java b/plugins/fastpath/src/main/java/org/jivesoftware/fastpath/resources/FastpathRes.java index 6b3e6bcf..d4ed8330 100644 --- a/plugins/fastpath/src/main/java/org/jivesoftware/fastpath/resources/FastpathRes.java +++ b/plugins/fastpath/src/main/java/org/jivesoftware/fastpath/resources/FastpathRes.java @@ -16,6 +16,7 @@ package org.jivesoftware.fastpath.resources; import org.jivesoftware.fastpath.FastpathPlugin; +import org.jivesoftware.spark.util.log.Log; import javax.swing.ImageIcon; import javax.swing.JEditorPane; @@ -267,8 +268,8 @@ public class FastpathRes { final URL imageURL = cl.getResource(iconURI); return new ImageIcon(imageURL); } - catch (Exception ex) { - System.out.println(imageName + " not found."); + catch (Throwable t) { + Log.warning(imageName + " not found.", t); } return null; } diff --git a/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/IncomingCallUI.java b/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/IncomingCallUI.java index 5c60c112..0a6aed86 100644 --- a/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/IncomingCallUI.java +++ b/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/IncomingCallUI.java @@ -206,8 +206,9 @@ public class IncomingCallUI extends JPanel { avatarLabel.validate(); avatarLabel.repaint(); } - catch (Exception e) { + catch (Throwable t) { // no issue + Log.warning("Unable to generate image from avatar", t); } } diff --git a/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/JinglePhoneRes.java b/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/JinglePhoneRes.java index 4d2c99f2..d3f2dc14 100644 --- a/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/JinglePhoneRes.java +++ b/plugins/jingle/src/main/java/org/jivesoftware/sparkplugin/JinglePhoneRes.java @@ -20,6 +20,8 @@ import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import java.net.URL; +import org.jivesoftware.spark.util.log.Log; + /** * Use for Phone Res Internationalization. * @@ -48,8 +50,8 @@ public class JinglePhoneRes { final URL imageURL = JinglePhoneRes.cl.getResource(iconURI); return new ImageIcon(imageURL); } - catch (Exception ex) { - System.out.println(imageName + " not found."); + catch (Throwable t) { + Log.warning(imageName + " not found.", t); } return null; } diff --git a/plugins/otr/src/main/java/org/jivesoftware/spark/otrplug/util/OTRResources.java b/plugins/otr/src/main/java/org/jivesoftware/spark/otrplug/util/OTRResources.java index 11a546ca..18028f97 100644 --- a/plugins/otr/src/main/java/org/jivesoftware/spark/otrplug/util/OTRResources.java +++ b/plugins/otr/src/main/java/org/jivesoftware/spark/otrplug/util/OTRResources.java @@ -45,9 +45,14 @@ public class OTRResources { * @return */ public static ImageIcon getIcon(String fileName) { - final ClassLoader cl = OTRResources.class.getClassLoader(); - ImageIcon icon = new ImageIcon(cl.getResource(fileName)); - return icon; + try { + final ClassLoader cl = OTRResources.class.getClassLoader(); + ImageIcon icon = new ImageIcon(cl.getResource(fileName)); + return icon; + } catch (Throwable t) { + Log.warning(fileName + " not found.", t); + } + return null; } /** diff --git a/plugins/reversi/src/main/java/org/jivesoftware/game/reversi/ReversiRes.java b/plugins/reversi/src/main/java/org/jivesoftware/game/reversi/ReversiRes.java index 54cddac9..30c73b2a 100644 --- a/plugins/reversi/src/main/java/org/jivesoftware/game/reversi/ReversiRes.java +++ b/plugins/reversi/src/main/java/org/jivesoftware/game/reversi/ReversiRes.java @@ -1,6 +1,7 @@ package org.jivesoftware.game.reversi; import org.jivesoftware.resource.UTF8Control; +import org.jivesoftware.spark.util.log.Log; import java.net.URL; import java.util.PropertyResourceBundle; @@ -42,9 +43,9 @@ public class ReversiRes { final URL imageURL = ReversiRes.cl.getResource(iconURI); return new ImageIcon(imageURL); } - catch (Exception ex) { - System.out.println(imageName + " not found."); - } + catch (Throwable t) { + Log.warning(imageName + " not found.", t); + } return null; } diff --git a/plugins/sip/src/main/java/org/jivesoftware/spark/plugin/phone/resource/PhoneRes.java b/plugins/sip/src/main/java/org/jivesoftware/spark/plugin/phone/resource/PhoneRes.java index 114f1a69..35fb7660 100644 --- a/plugins/sip/src/main/java/org/jivesoftware/spark/plugin/phone/resource/PhoneRes.java +++ b/plugins/sip/src/main/java/org/jivesoftware/spark/plugin/phone/resource/PhoneRes.java @@ -58,8 +58,8 @@ public class PhoneRes { final URL imageURL = cl.getResource(iconURI); return new ImageIcon(imageURL); } - catch (Exception ex) { - System.out.println(imageName + " not found."); + catch (Throwable t) { + Log.warn(imageName + " not found.", t); } return null; } @@ -79,4 +79,4 @@ public class PhoneRes { } return null; } -} \ No newline at end of file +} diff --git a/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/IncomingCallUI.java b/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/IncomingCallUI.java index a3292395..6438eefe 100644 --- a/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/IncomingCallUI.java +++ b/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/IncomingCallUI.java @@ -220,8 +220,8 @@ public class IncomingCallUI extends JPanel { avatarLabel.validate(); avatarLabel.repaint(); } - catch (Exception e) { - // no issue + catch (Throwable t) { + Log.warning("Unable to generate image from avatar", t); } } diff --git a/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/OutgoingCallUI.java b/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/OutgoingCallUI.java index ca92faaf..0eb8578e 100644 --- a/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/OutgoingCallUI.java +++ b/plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/call/OutgoingCallUI.java @@ -203,8 +203,8 @@ public class OutgoingCallUI extends JPanel { avatarLabel.validate(); avatarLabel.repaint(); } - catch (Exception e) { - // no issue + catch (Throwable t) { + Log.warning("Unable to generate image from avatar", t); } }