提交 70489968 编写于 作者: K kohsuke

[FIXED HUDSON-4592] Generally speaking, security manager restricts too many...

[FIXED HUDSON-4592] Generally speaking, security manager restricts too many things away that you'll unlikely to get Hudson function properly. Hudson has a graceful error check for this in its ServletContextInitializer, but it looks like the filters are initialized before that, and causing the hard failure that you saw.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@22379 71c3de6d-444a-0410-be80-ed276b4c234a
上级 397d4519
......@@ -27,6 +27,7 @@ import hudson.model.Hudson;
import java.io.IOException;
import java.util.logging.Logger;
import static java.util.logging.Level.SEVERE;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
......@@ -98,14 +99,23 @@ public class HudsonFilter implements Filter {
this.filterConfig = filterConfig;
// this is how we make us available to the rest of Hudson.
filterConfig.getServletContext().setAttribute(HudsonFilter.class.getName(),this);
Hudson hudson = Hudson.getInstance();
if (hudson != null) {
// looks like we are initialized after Hudson came into being. initialize it now. See #3069
LOGGER.fine("Security wasn't initialized; Initializing it...");
SecurityRealm securityRealm = hudson.getSecurityRealm();
reset(securityRealm);
LOGGER.fine("securityRealm is " + securityRealm);
LOGGER.fine("Security initialized");
try {
Hudson hudson = Hudson.getInstance();
if (hudson != null) {
// looks like we are initialized after Hudson came into being. initialize it now. See #3069
LOGGER.fine("Security wasn't initialized; Initializing it...");
SecurityRealm securityRealm = hudson.getSecurityRealm();
reset(securityRealm);
LOGGER.fine("securityRealm is " + securityRealm);
LOGGER.fine("Security initialized");
}
} catch (ExceptionInInitializerError e) {
// see HUDSON-4592. In some containers this happens before
// WebAppMain.contextInitialized kicks in, which makes
// the whole thing fail hard before a nicer error check
// in WebAppMain.contextInitialized. So for now,
// just report it here, and let the WebAppMain handle the failure gracefully.
LOGGER.log(SEVERE, "Failed to initialize Hudson",e);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册