Skip to content

Commit 7ac4926

Browse files
committed
ShadowMenu: load icon resources more robustly
The Types.load method may not use the correct class loader.
1 parent ee1e7c1 commit 7ac4926

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/scijava/menu/ShadowMenu.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,17 @@ public URL getIconURL() {
230230
if (isLeaf()) iconPath = DEFAULT_ICON_PATH;
231231
else return null;
232232
}
233-
final String className = moduleInfo.getDelegateClassName();
234233
try {
235-
final Class<?> c = Types.load(className, false);
234+
final Class<?> c = moduleInfo.loadDelegateClass();
236235
final URL iconURL = c.getResource(iconPath);
237236
if (iconURL == null) {
238237
if (log != null) log.error("Could not load icon: " + iconPath);
239238
}
240239
return iconURL;
241240
}
242241
catch (final IllegalArgumentException exc) {
243-
final String message = "Could not load icon for class: " + className;
242+
final String message = "Could not load icon for class: " +
243+
moduleInfo.getDelegateClassName();
244244
if (log.isDebug()) log.debug(message, exc);
245245
else log.error(message);
246246
return null;

0 commit comments

Comments
 (0)