Skip to content

Commit 67d9407

Browse files
authored
SAK-44196 fix ArrayIndexOutOfBoundsException when missing a resource key (sakaiproject#8519)
1 parent 8a1f6ed commit 67d9407

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

kernel/kernel-util/src/main/java/org/sakaiproject/util/ResourceLoader.java

+3-12
Original file line numberDiff line numberDiff line change
@@ -517,26 +517,17 @@ public String getString(String key)
517517
}
518518
catch (MissingResourceException e)
519519
{
520-
if (log.isWarnEnabled()) {
521-
log.warn("bundle \'"+baseName +"\' missing key: \'" + key
522-
+ "\' from: " + e.getStackTrace()[3] ); // 3-deep gets us out of ResourceLoader
523-
}
520+
log.warn("bundle \'{}\' missing key: \'{}\' from: ", baseName, key, e);
524521
return "[missing key (mre): " + baseName + " " + key + "]";
525522
}
526523
catch (NullPointerException e)
527524
{
528-
if (log.isWarnEnabled()) {
529-
log.warn("bundle \'"+baseName +"\' null pointer exception: \'" + key
530-
+ "\' from: " + e.getStackTrace()[3] ); // 3-deep gets us out of ResourceLoader
531-
}
525+
log.warn("bundle \'{}\' null pointer exception: \'{}\' from: ", baseName, key, e);
532526
return "[missing key (npe): " + baseName + " " + key + "]";
533527
}
534528
catch (ClassCastException e)
535529
{
536-
if (log.isWarnEnabled()) {
537-
log.warn("bundle \'"+baseName +"\' class cast exception: \'" + key
538-
+ "\' from: " + e.getStackTrace()[3] ); // 3-deep gets us out of ResourceLoader
539-
}
530+
log.warn("bundle \'{}\' class cast exception: \'{}\' from: ", baseName, key, e);
540531
return "[missing key (clc): " + baseName + " " + key + "]";
541532
}
542533
}

0 commit comments

Comments
 (0)