提交 94f0976f 编写于 作者: S StefanSpieker 提交者: Oleg Nenashev

Spotbugs findings (catch runtime ex. and known null) (#4380)

* refactor exception to actually put the failing string inside instead of null

* do not catch RuntimeExceptions
上级 84f6eb07
......@@ -980,8 +980,10 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas
if (category==null)
return Messages.UpdateCenter_PluginCategory_misc();
try {
return (String)Messages.class.getMethod(
return (String) Messages.class.getMethod(
"UpdateCenter_PluginCategory_" + category.replace('-', '_')).invoke(null);
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
return Messages.UpdateCenter_PluginCategory_unrecognized(category);
}
......
......@@ -106,11 +106,12 @@ public final class CronTabList {
line = line.trim();
if(lineNumber == 1 && line.startsWith("TZ=")) {
timezone = getValidTimezone(line.replace("TZ=",""));
final String timezoneString = line.replace("TZ=", "");
timezone = getValidTimezone(timezoneString);
if(timezone != null) {
LOGGER.log(Level.CONFIG, "CRON with timezone {0}", timezone);
} else {
throw new ANTLRException("Invalid or unsupported timezone '" + timezone + "'");
throw new ANTLRException("Invalid or unsupported timezone '" + timezoneString + "'");
}
continue;
}
......
......@@ -133,7 +133,9 @@ public class DoubleLaunchChecker {
String contextPath="";
try {
Method m = ServletContext.class.getMethod("getContextPath");
contextPath=" contextPath=\""+m.invoke(h.servletContext)+"\"";
contextPath = " contextPath=\"" + m.invoke(h.servletContext) + "\"";
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
// maybe running with Servlet 2.4
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册