Surround lookup with try/catch and add logging
package jenkins;
import hudson.ExtensionList;
+import org.apache.log4j.Logger;
import org.kohsuke.MetaInfServices;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
@@ -34,6 +35,9 @@ import java.net.URL;
@Restricted(NoExternalUse.class)
@MetaInfServices
public final class MetaLocaleDrivenResourceProvider extends LocaleDrivenResourceProvider {
+
+ private static final Logger LOGGER = Logger.getLogger(MetaLocaleDrivenResourceProvider.class.getName());
+
@Override
public URL lookup(String s) {
/*
@@ -43,10 +47,14 @@ public final class MetaLocaleDrivenResourceProvider extends LocaleDrivenResource
* This saves having to think of one more stupid class name. The downside is the lack of "implements ExtensionPoint".
*/
for (LocaleDrivenResourceProvider provider : ExtensionList.lookup(LocaleDrivenResourceProvider.class)) {
+ try {
URL url = provider.lookup(s);
if (url != null) {
return url;
}
+ } catch (Exception e) {
+ LOGGER.warn("Failed to lookup URL for '" + s + "' from '" + provider.toString(), e);
+ }
}
return null;
}
