提交 73d1db26 编写于 作者: K kohsuke

suppress pointless warning messages about XMLHttpRequest.getResponseHeader()

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14075 71c3de6d-444a-0410-be80-ed276b4c234a
上级 4cfe3967
...@@ -10,6 +10,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage; ...@@ -10,6 +10,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlButton; import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine; import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet; import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet;
import com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest;
import hudson.matrix.MatrixProject; import hudson.matrix.MatrixProject;
import hudson.model.Descriptor; import hudson.model.Descriptor;
import hudson.model.FreeStyleProject; import hudson.model.FreeStyleProject;
...@@ -66,6 +67,8 @@ import java.util.List; ...@@ -66,6 +67,8 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.logging.Filter;
import java.util.logging.LogRecord;
/** /**
* Base class for all Hudson test cases. * Base class for all Hudson test cases.
...@@ -526,6 +529,9 @@ public abstract class HudsonTestCase extends TestCase { ...@@ -526,6 +529,9 @@ public abstract class HudsonTestCase extends TestCase {
} }
} }
// needs to keep reference, or it gets GC-ed.
private static final Logger XML_HTTP_REQUEST_LOGGER = Logger.getLogger(XMLHttpRequest.class.getName());
static { static {
// screen scraping relies on locale being fixed. // screen scraping relies on locale being fixed.
Locale.setDefault(Locale.ENGLISH); Locale.setDefault(Locale.ENGLISH);
...@@ -563,6 +569,13 @@ public abstract class HudsonTestCase extends TestCase { ...@@ -563,6 +569,13 @@ public abstract class HudsonTestCase extends TestCase {
// hudson-behavior.js relies on this to decide whether it's running unit tests. // hudson-behavior.js relies on this to decide whether it's running unit tests.
Functions.isUnitTest = true; Functions.isUnitTest = true;
// prototype.js calls this method all the time, so ignore this warning.
XML_HTTP_REQUEST_LOGGER.setFilter(new Filter() {
public boolean isLoggable(LogRecord record) {
return !record.getMessage().contains("XMLHttpRequest.getResponseHeader() was called before the response was available.");
}
});
} }
private static final Logger LOGGER = Logger.getLogger(HudsonTestCase.class.getName()); private static final Logger LOGGER = Logger.getLogger(HudsonTestCase.class.getName());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册