DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24842>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24842

java.lang.NullPointerException in first test -- thread synchronization prob?





------- Additional Comments From [EMAIL PROTECTED]  2004-01-28 16:00 -------
Hmm, think I've got a fix for this. This is ugly code, but it seems to get me
going. Based on the information provided by Luiz, I tried adding the following
code in AbstractWebTestCaller.doGetResults():

BEFORE line 208 was:
  WebTestResult result =
(WebTestResult)webImplicitObjects.getServletContext().getAttribute("ServletTestRedirector_TestResults");

REPLACED WITH this:
   WebTestResult result = null;
   while (result == null) {
       System.out.println("FIX: Going to get result ...");
       result =
(WebTestResult)webImplicitObjects.getServletContext().getAttribute("ServletTestRedirector_TestResults");
       System.out.println("FIX: Result was " + result);
       if (result == null) {
           System.out.println("FIX: Will sleep a bit .. zzzz ..");
           try { Thread.sleep(1000); } catch (InterruptedException e) { /* who
cares */ }
       }
   }

And my server log says this when I run the tests:

FIX: Going to get result ...
FIX: Result was null
FIX: Will sleep a bit .. zzzz ..
FIX: Going to get result ...
FIX: Result was Test ok

and the next test run on the same testcase says:

FIX: Going to get result ...
FIX: Result was Test ok

Hope the second test on the testcase gets the correct result then. As I
understand it, getting there "too quick" might make it get the result of the
last test. That is, if there is a race condition.

Maybe the "ServletTestRedirector_TestResults" attribute should be removed from
ServletContext after use!?

A real quick-in-and-quick-out fix :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to