Addressing review feedback

This commit is contained in:
Guus der Kinderen 2025-10-10 11:01:22 +02:00
parent 0734d54743
commit 05b8e82499
12 changed files with 109 additions and 78 deletions

View File

@ -60,9 +60,14 @@ public class ConfigurationRes {
try {
final String iconURI = getString(imageName);
final URL imageURL = cl.getResource(iconURI);
if (imageURL != null) {
return new ImageIcon(imageURL);
} catch (Throwable t) {
Log.warning(imageName + " not found.", t);
} else {
Log.warning(imageName + " not found.");
}
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}

View File

@ -208,8 +208,8 @@ public class Default {
cache.put(imageName, icon);
return icon;
}
catch (Throwable t) {
Log.warning(imageName + " not found.", t);
catch (Exception e) {
Log.warning(imageName + " not found.", e);
}
return null;
}

View File

@ -57,9 +57,14 @@ public class SoundsRes {
try {
final String iconURI = getString(imageName);
final URL imageURL = cl.getResource(iconURI);
if (imageURL != null) {
return new ImageIcon(imageURL);
} catch (Throwable t) {
Log.warning(imageName + " not found.", t);
} else {
Log.warning(imageName + " not found.");
}
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}

View File

@ -353,10 +353,16 @@ public class SparkRes {
public static ImageIcon getImageIcon(String imageName) {
try {
final URL imageURL = getURL(imageName);
final String iconURI = getString(imageName);
final URL imageURL = cl.getResource(iconURI);
if (imageURL != null) {
return new ImageIcon(imageURL);
} catch (Throwable t) {
Log.warning(imageName + " not found.", t);
} else {
Log.warning(imageName + " not found.");
}
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}

View File

@ -266,10 +266,14 @@ public class FastpathRes {
try {
final String iconURI = getString(imageName);
final URL imageURL = cl.getResource(iconURI);
if (imageURL != null) {
return new ImageIcon(imageURL);
} else {
Log.warning(imageName + " not found.");
}
catch (Throwable t) {
Log.warning(imageName + " not found.", t);
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}

View File

@ -206,9 +206,8 @@ public class IncomingCallUI extends JPanel {
avatarLabel.validate();
avatarLabel.repaint();
}
catch (Throwable t) {
// no issue
Log.warning("Unable to generate image from avatar", t);
catch (Exception e) {
Log.warning("Unable to generate image from avatar", e);
}
}

View File

@ -48,10 +48,14 @@ public class JinglePhoneRes {
try {
final String iconURI = JinglePhoneRes.getString(imageName);
final URL imageURL = JinglePhoneRes.cl.getResource(iconURI);
if (imageURL != null) {
return new ImageIcon(imageURL);
} else {
Log.warning(imageName + " not found.");
}
catch (Throwable t) {
Log.warning(imageName + " not found.", t);
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}
@ -59,6 +63,4 @@ public class JinglePhoneRes {
public static final URL getURL(String propertyName) {
return JinglePhoneRes.cl.getResource(JinglePhoneRes.getString(propertyName));
}
}

View File

@ -47,10 +47,15 @@ public class OTRResources {
public static ImageIcon getIcon(String fileName) {
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);
final URL imageURL = cl.getResource(fileName);
if (imageURL != null) {
return new ImageIcon(imageURL);
} else {
Log.warning(imageName + " not found.");
}
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}

View File

@ -21,8 +21,6 @@ public class ReversiRes {
public static final String REVERSI_YOU="REVERSI_YOU";
public static final String REVERSI_THEM="REVERSI_THEM";
private ReversiRes() {
}
@ -41,10 +39,14 @@ public class ReversiRes {
try {
final String iconURI = ReversiRes.getString(imageName);
final URL imageURL = ReversiRes.cl.getResource(iconURI);
if (imageURL != null) {
return new ImageIcon(imageURL);
} else {
Log.warning(imageName + " not found.");
}
catch (Throwable t) {
Log.warning(imageName + " not found.", t);
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}
@ -52,5 +54,4 @@ public class ReversiRes {
public static URL getURL(String propertyName) {
return ReversiRes.cl.getResource(ReversiRes.getString(propertyName));
}
}

View File

@ -72,10 +72,14 @@ public class PhoneRes {
try {
final String iconURI = getString(imageName);
final URL imageURL = cl.getResource(iconURI);
return new ImageIcon(imageURL).getImage();
if (imageURL != null) {
return new ImageIcon(imageURL);
} else {
Log.warning(imageName + " not found.");
}
catch (Exception ex) {
Log.error(imageName + " not found.");
}
catch (Exception e) {
Log.warning("Unable to load image " + imageName, e);
}
return null;
}

View File

@ -220,8 +220,8 @@ public class IncomingCallUI extends JPanel {
avatarLabel.validate();
avatarLabel.repaint();
}
catch (Throwable t) {
Log.warning("Unable to generate image from avatar", t);
catch (Exception e) {
Log.warning("Unable to generate image from avatar", e);
}
}

View File

@ -203,8 +203,8 @@ public class OutgoingCallUI extends JPanel {
avatarLabel.validate();
avatarLabel.repaint();
}
catch (Throwable t) {
Log.warning("Unable to generate image from avatar", t);
catch (Exception e) {
Log.warning("Unable to generate image from avatar", e);
}
}