Re: [Htmlparser-developer] testThreadSafety error
Brought to you by:
derrickoswald
From: Somik R. <so...@ya...> - 2003-03-31 04:20:30
|
Hi Derrick, Thanks a lot.. I have removed the boolean, and made it totally thread-safe now (I think). Could you try again? Regards, Somik ----- Original Message ----- From: "Derrick Oswald" <Der...@ro...> To: <htm...@li...> Sent: Sunday, March 30, 2003 7:31 PM Subject: [Htmlparser-developer] testThreadSafety error > Somik, > > Running testThreadSafety() can give different errors or no errors at all > depending on the run (typical of race conditions). > The errors might only crop up on SMP systems (I've got a dual CPU). > > When it fails, the actual link appears empty even though the link text > is not (see the debug outputs below): > id = 5 > link = "" > linkText = " Server: sf-web2 \t SourceForge.net: Modify: 711073 - > HTMLTagParser not threadsafe as a static variable in > HTMLTag\t\t\tfunction help_window(helpurl) {\t\tHelpWin = window.open( > \'http://sourceforge.net\' + > helpurl,\'HelpWindow\',\'scrollbars=yes,resizable=yes,toolbar=no,height=400, width=400\');\t}\t// > \t\t\t This is temp javascript for the jump button. If we could actually > have a jump script on the server side that would be ideal \tfunction > jump(targ,selObj,restore){ //v3.0\tif > (selObj.options[selObj.selectedIndex].value) > \t\teval(targ+\".location=\'\"+selObj.options[selObj.selectedIndex].value+\" \'\");\tif > (restore) selObj.selectedIndex=0;\t}\t//" > result = false > > Here's some example JUnit dumps: > **************************************************************************** **************************** > > junit.framework.AssertionFailedError: Thread 55, link 1: > > EXPECTED result has 35 extra characters at the end. They are : > Position : 0 , Code = 104 > Position : 1 , Code = 116 > Position : 2 , Code = 116 > Position : 3 , Code = 112 > <snip> > Position : 33 , Code = 109 > Position : 34 , Code = 108 > Mismatch of strings at char posn 0 > > String Expected upto mismatch = > > String Actual upto mismatch = > > String Expected MISMATCH CHARACTER = h, code = 104 > > **** COMPLETE STRING EXPECTED **** > http://normallink.com/sometext.html > > **** COMPLETE STRING ACTUAL*** > > at > org.htmlparser.tests.ParserTestCase.assertStringEquals(ParserTestCase.java:1 25) > at > org.htmlparser.tests.parserHelperTests.TagParserTest.testThreadSafety(TagPar serTest.java:186) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > > **************************************************************************** **************************** > > junit.framework.AssertionFailedError: Thread 26, link 2: > > EXPECTED result has 116 extra characters at the end. They are : > Position : 0 , Code = 47 > Position : 1 , Code = 99 > Position : 2 , Code = 103 > Position : 3 , Code = 105 > <snip> > Position : 114 , Code = 109 > Position : 115 , Code = 108 > Mismatch of strings at char posn 0 > > String Expected upto mismatch = > > String Actual upto mismatch = > > String Expected MISMATCH CHARACTER = /, code = 47 > > **** COMPLETE STRING EXPECTED **** > > /cgi-bin/view_search?query_text=postdate>20020701&txt_clr=White&bg_clr=Red&u rl=http://localhost/Testing/Report1.html > > > **** COMPLETE STRING ACTUAL*** > > at > org.htmlparser.tests.ParserTestCase.assertStringEquals(ParserTestCase.java:1 25) > at > org.htmlparser.tests.parserHelperTests.TagParserTest.testThreadSafety(TagPar serTest.java:191) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > > Hope this helps, > > Derrick > > Somik Raha wrote: > > > > testThreadSafety > > > > Thanks for reporting this - on my end this one's passing. I had left > > one last variable in TagParser- and I thought it would affect Thread > > safety. So I rigged up that test, but surprisingly it passed every > > time on my end. Can you send me the failure message ? I might need to > > rework TagParser again. > > > > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: > The Definitive IT and Networking Event. Be There! > NetWorld+Interop Las Vegas 2003 -- Register today! > http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en > _______________________________________________ > Htmlparser-developer mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlparser-developer |