Hi All, I'm encountering a null pointer exception in the org.apache.cocoon.components.source.URLSource file when I run a stress test of my Cocoon 2 system:
java.lang.NullPointerException at org.apache.cocoon.components.source.URLSource.getInfos(URLSource.java:95) at org.apache.cocoon.components.source.URLSource.getLastModified(URLSource.java :110) at org.apache.cocoon.Cocoon.modifiedSince(Cocoon.java:376) at org.apache.cocoon.servlet.CocoonServlet.getCocoon(CocoonServlet.java:919) at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:582) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) <snip> The code that throws the exception is: (from Cocoon 2.0 source, but identical in CVS snapshot 04/Feb/2002 (apart from some boolean optimizations)) /** * Get the last modification date and content length of the source. * Any exceptions are ignored. */ private void getInfos() { if (this.gotInfos == false) { if (this.isFile == true) { File file = new File(systemId.substring(FILE.length())); this.lastModificationDate = file.lastModified(); this.contentLength = file.length(); } else { try { if (this.connection == null) { this.connection = this.url.openConnection(); String userInfo = this.getUserInfo(); if (this.url.getProtocol().startsWith("http") == true && userInfo != null) { this.connection.setRequestProperty("Authorization","Basic "+this.encodeBASE64(userInfo)); } } this.lastModificationDate = this.connection.getLastModified(); Line 95 -----> this.contentLength = this.connection.getContentLength(); <------ NPE THROWN HERE } catch (IOException ignore) { this.lastModificationDate = 0; this.contentLength = -1; } } this.gotInfos = true; } } The exception results in the Tomcat Internal Server Error 500 page being shown and occurs about once in every 200 HTTP requests made by the stress testing tool (Paessler Webserver Stress Tool 5.2 Enterprise Edition). Looking at the code makes me think this might be a threading/synchronization bug as IMHO 'this.connection' is null and should have thrown the NPE on the previous line. I'll do my best to trace the problem's origin but I'm out of the country for 3 weeks as of tomorrow. Environment: SuSE 7.2, JDK 1.3.1_02, Cocoon 2.0 final, Tomcat 4.0.1, mod_webapp, Apache 1.3.22 Stress testing tool is run from a remote client that hits the same 4 XSP pages in random order simulating 5 concurrent users. Best Regards, Chris Newland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]