4 Replies Latest reply: Jan 25, 2011 6:13 AM by Silvestre Losada RSS

    Error javascript testing jsf application

    Silvestre Losada Newbie

      Hi all,

       

      I am trying to test a JSF application, it uses richfaces 3.3.3 and jsfunit 1.3.0 final. When I execute the test I'm getting an exception executing a javascript that is not present in my application. Here you can see the exception.

       

      Caused by: java.lang.IndexOutOfBoundsException: No group 2

          at java.util.regex.Matcher.group(Matcher.java:470)

          at java.util.regex.Matcher.appendReplacement(Matcher.java:737)

          at com.gargoylesoftware.htmlunit.javascript.IEConditionalCompilationScriptPreProcessor.replaceCompilationVariables(IEConditionalCompilationScriptPreProcessor.java:161)

          at com.gargoylesoftware.htmlunit.javascript.IEConditionalCompilationScriptPreProcessor.processConditionalCompilation(IEConditionalCompilationScriptPreProcessor.java:100)

          at com.gargoylesoftware.htmlunit.javascript.IEConditionalCompilationScriptPreProcessor.preProcess(IEConditionalCompilationScriptPreProcessor.java:72)

          at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:170)

          at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1372)

          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$2.doRun(JavaScriptEngine.java:447)

          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)

          ... 97 more

      Enclosed exception:

      java.lang.IndexOutOfBoundsException: No group 2

          at java.util.regex.Matcher.group(Matcher.java:470)

          at java.util.regex.Matcher.appendReplacement(Matcher.java:737)

          at com.gargoylesoftware.htmlunit.javascript.IEConditionalCompilationScriptPreProcessor.replaceCompilationVariables(IEConditionalCompilationScriptPreProcessor.java:161)

          at com.gargoylesoftware.htmlunit.javascript.IEConditionalCompilationScriptPreProcessor.processConditionalCompilation(IEConditionalCompilationScriptPreProcessor.java:100)

          at com.gargoylesoftware.htmlunit.javascript.IEConditionalCompilationScriptPreProcessor.preProcess(IEConditionalCompilationScriptPreProcessor.java:72)

          at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:170)

          at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1372)

          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$2.doRun(JavaScriptEngine.java:447)

          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)

          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)

          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)

          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:456)

          at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1047)

          at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:959)

          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:363)

          at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:225)

          at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:245)

          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:578)

          at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:536)

          at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1136)

          at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1038)

          at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)

          at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)

          at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2999)

          at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1991)

          at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895)

          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)

          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)

          at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:765)

          at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:211)

          at com.gargoylesoftware.htmlunit.html.HTMLParser.parseXHtml(HTMLParser.java:179)

          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createXHtmlPage(DefaultPageCreator.java:237)

          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:117)

          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:429)

          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:307)

          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:369)

          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:354)

          at org.jboss.jsfunit.framework.SimpleInitialRequestStrategy.doInitialRequest(SimpleInitialRequestStrategy.java:48)

          at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)

          at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:81)

          at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:58)

          at com.playence.media.test.JSFunitHelloWorld.setUp(JSFunitHelloWorld.java:28)

          at junit.framework.TestCase.runBare(TestCase.java:125)

          at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)

          at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)

          at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)

          at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)

          at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)

          at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)

          at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)

          at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)

          at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)

          at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)

          at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)

          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)

          at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)

          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)

          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)

          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)

          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)

          at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)

          at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)

          at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)

          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)

          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)

          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)

          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)

          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)

          at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)

          at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)

          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)

          at org.mortbay.jetty.Server.handle(Server.java:285)

          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)

          at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:751)

          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)

          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)

          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)

          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)

          at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)

      == CALLING JAVASCRIPT ==

      // html5shiv MIT @rem remysharp.com/html5-enabling-script

      // iepp v1.6.2 MIT @jon_neal iecss.com/print-protector

      /*@cc_on(function(m,c){var z="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video";function n(d){for(var a=-1;++a<o;)d.createElement(i[a])}function p(d,a){for(var e=-1,b=d.length,j,q=[];++e<b;){j=d[e];if((a=j.media||a)!="screen")q.push(p(j.imports,a),j.cssText)}return q.join("")}var g=c.createElement("div");g.innerHTML="<z>i</z>";if(g.childNodes.length!==1){var i=z.split("|"),o=i.length,s=RegExp("(^|\\s)("+z+")",

      "gi"),t=RegExp("<(/*)("+z+")","gi"),u=RegExp("(^|[^\\n]*?\\s)("+z+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),r=c.createDocumentFragment(),k=c.documentElement;g=k.firstChild;var h=c.createElement("body"),l=c.createElement("style"),f;n(c);n(r);g.insertBefore(l,

      g.firstChild);l.media="print";m.attachEvent("onbeforeprint",function(){var d=-1,a=p(c.styleSheets,"all"),e=[],b;for(f=f||c.body;(b=u.exec(a))!=null;)e.push((b[1]+b[2]+b[3]).replace(s,"$1.iepp_$2")+b[4]);for(l.styleSheet.cssText=e.join("\n");++d<o;){a=c.getElementsByTagName(i[d]);e=a.length;for(b=-1;++b<e;)if(a[b].className.indexOf("iepp_")<0)a[b].className+=" iepp_"+i[d]}r.appendChild(f);k.appendChild(h);h.className=f.className;h.innerHTML=f.innerHTML.replace(t,"<$1font")});m.attachEvent("onafterprint",

      function(){h.innerHTML="";k.removeChild(h);k.appendChild(f);l.styleSheet.cssText=""})}})(this,document);@*/

      ======= EXCEPTION END ========