[Bug 14] New: HTMLLayoutTest fails if there is no network or if the user is behind a firewall

http://bugzilla.qos.ch/show_bug.cgi?id=14 Summary: HTMLLayoutTest fails if there is no network or if the user is behind a firewall Product: logback-classic Version: unspecified Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P1 Component: Other AssignedTo: logback-dev@qos.ch ReportedBy: noreply.ceki@qos.ch Running ch.qos.logback.classic.html.HTMLLayoutTest yields: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278) at ch.qos.logback.classic.html.HTMLLayoutTest.parseOutput(HTMLLayoutTest.java:142) at ch.qos.logback.classic.html.HTMLLayoutTest.testHeader(HTMLLayoutTest.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122) at org.apache.maven.surefire.Surefire.run(Surefire.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747) Nested exception: java.net.ConnectException: Connection timed out: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) [snip] This occurs if host machine does not have network conneciton or if behind a corporate firewall. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=14 noreply.sebastien@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED ------- Comment #1 from noreply.sebastien@qos.ch 2006-10-16 09:56 ------- My guess is that it fails because of this line, that is added to each html page that the HTMLLayout creates: <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Dom4j must be connecting to the dtd address to check the validity of the html document. This said, I don't think that we should get rid of the dtd declaration... I'm going to try to catch this exception and do something with it. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=14 ------- Comment #2 from noreply.ceki@qos.ch 2006-10-16 10:10 ------- Another solution is to include xhtml1-strict.dtd as part of the logback project. This approach has the advantage of faster response times running the tests. In my experience, this is not hard to do using a SAX parser. (Don't know about DOM4J tough.) -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=14 ------- Comment #3 from noreply.ceki@qos.ch 2006-10-16 10:51 ------- Here is an EntityResolver which should do the trick. import java.io.InputStream; import java.util.HashMap; import java.util.Map; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; public class XHTMLEntityResolver implements EntityResolver { // key: public id, value: relative path to DTD file static Map entityMap = new HashMap(); static { entityMap.put("-//W3C//DTD XHTML 1.0 Transitional//EN", "/dtd/xhtml1-transitional.dtd"); entityMap.put("-//W3C//ENTITIES Latin 1 for XHTML//EN", "/dtd/xhtml-lat1.ent"); entityMap.put("-//W3C//ENTITIES Symbols for XHTML//EN", "/dtd/xhtml-symbol.ent"); entityMap.put("-//W3C//ENTITIES Special for XHTML//EN", "/dtd/xhtml-special.ent"); } public InputSource resolveEntity(String publicId, String systemId) { final String relativePath = (String)entityMap.get(publicId); if (relativePath != null) { Class clazz = getClass(); InputStream in = clazz.getResourceAsStream(relativePath); if (in == null) { return null; } else { return new InputSource(in); } } else { return null; } } } -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=14 noreply.sebastien@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED ------- Comment #4 from noreply.sebastien@qos.ch 2006-10-16 11:57 ------- Corrected dom4j parsing. No connection required anymore. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=14 noreply.sebastien@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED ------- Comment #5 from noreply.sebastien@qos.ch 2006-10-16 11:57 ------- closing bug. -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
participants (1)
-
bugzilla-daemon@pixie.qos.ch