Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-Alpha2
-
Fix Version/s: 2.0-Alpha3, 2.0.0
-
Component/s: Framework
-
Labels:None
-
Environment:jsf2.0, htmlunit
Description
[junit] Testcase: testValueChangeActionListener took 1.71 sec
[junit] Caused an ERROR
[junit] For input string: "1271182360311736000 "
[junit] java.lang.NumberFormatException: For input string: "1271182360311736000 "
[junit] at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
[junit] at java.lang.Long.parseLong(Long.java:412)
[junit] at java.lang.Long.valueOf(Long.java:518)
[junit] at com.sun.faces.composite.ValueChangeListenerSetPropertyActionListener01TestCase.testValueChangeActionListener(ValueChangeListenerSetPropertyActionListener01TestCase.java:114)
the trailing space on the string is the problem (can't parse into an integer)...this only occurs with autoid on. When it is off, the trailing space is no longer there.
NOTE:_ this test is testing composite components with EE6 Dependencies, but even when run with EE5, I get the same results.
<p>System.currentTimeMillis():<span id="form:_t14">1271284659672881000</span>
;</p>
is the markup but it is displayed with a trailing blank:-
System.currentTimeMillis():1271284659672881000 ;
Looks like this when autoid is turned off:-
<p>System.currentTimeMillis():1271287050934045000;</p>
addition of span (with newline after close tag for span) causes the trailing space to be added and it doesn't pass the parsing into a Long value.
original view page:-
<p>System.currentTimeMillis():<h:outputText
value="#{valueChangeSetPropertyActionListenerBean.nanoTime}" />;</p>
The more critical problem here may be that autoid is affecting layout due to extra whitespace. This test will likely fail anyway due to the extra span tag inserted, but autoid should not affect layout.
Issue Links
- blocks
-
ICE-4950 Configure existing JSF 2.0 test cases to run with ICEfaces 2.0
- Closed
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
For the testValueChangeActionListener, it turns out that autoid is wrapping outputText values in span tags and then our DOM serialization is automatically adding a newline after the tag. For example, from the test case in question:
autoid=false
<p>Property set by setPropertyActionListener:; </p>
<p>System.currentTimeMillis():1272316473117574000;</p>
autoid = true
<p>Property set by setPropertyActionListener:<span id="form:_t12"></span>
; </p>
<p>System.currentTimeMillis():<span id="form:_t14">1272316584276957000</span>
;</p>
By commenting out the addition of the newline in the DOMUtils.printNode method, the test passes. At this point, I've removed the addition of the newline altogether as it generally causes more problems than it solves. Page source viewed in the browsers currently looks okay as far as I can tell.
This looks like our script injection being added multiple times to the component tree.
Judy notes that this is the same error (duplicate ID) as the failures in the faces messages/validation test.
page can be tested manually by deployed the sys-test application to the server and then using the following url:-
http://localhost:8080/jsf-systest/faces/state/dynamicAdditionDeletion.xhtml
Although the test passes when the autoid is turned off, the server log exception is still there. (duplicate id). THe test is just looking for an NPE, so not sure why it is passing with autoid turned off. Problem still exists whether autoid is on or off.
Second test (DynamicStateTestCase) is supposed to throw a NPE on the third time the button is pressed, however, the server log shows a duplicate Id exception as many times as you care to press the button:-
[#|2010-04-15T10:11:16.469-0600|SEVERE|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=24;_ThreadName=Thread-1;|java.lang.IllegalStateException: Component ID form:j_idform has already been found in the view.
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:719)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:703)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:703)
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:129)
at javax.faces.application.StateManager.getViewState(StateManager.java:525)
at org.icefaces.event.BridgeSetup.processEvent(BridgeSetup.java:68)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:102)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2040)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2016)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:298)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:242)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:104)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at com.sun.faces.scripting.GroovySupportFilter.doFilter(GroovySupportFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:329)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:637)
#] |
[#|2010-04-15T10:11:16.490-0600|INFO|glassfishv3.0|org.icefaces.event.BridgeSetup|_ThreadID=24;_ThreadName=Thread-1;|processEvent() for viewId=/state/dynamicAdditionDeletion.xhtml|#]
Tree looks like:-
+id: render
type: javax.faces.component.html.HtmlCommandButton@ace10d9
+id: viewPanel
type: javax.faces.component.html.HtmlPanelGroup@5eb41c19
+id: j_id10
type: javax.faces.component.html.HtmlCommandButton@2dfa5885
+id: j_idform
type: javax.faces.component.UIOutput@ec99b58
+id: j_idform_captureEnterKey
type: javax.faces.component.UIOutput@55f5b5fd
+id: j_idform
type: javax.faces.component.UIOutput@767f2121
+id: j_idform_captureEnterKey
type: javax.faces.component.UIOutput@14583a4e
+id: j_idt8
type:
</html>
note the duplicate id's that are j_idform for UIOutput (2 different instances).
this is from the suite of tests that are testing state. Must determine if this is because of the change in the actual id or something else.
[junit] Testcase: testDeleteAddSameAction took 0.17 sec
[junit] Caused an ERROR
[junit] TypeError: Cannot call method "getElementsByTagName" of null (http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623#1824)
[junit] ======= EXCEPTION START ========
[junit] EcmaError: lineNumber=[1824] column=[0] lineSource=[null] name=[TypeError] sourceName=http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623 message=TypeError: Cannot call method "getElementsByTagName" of null (http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623#1824)
[junit] com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "getElementsByTagName" of null (http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623#1824)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:513)
[junit] at org.mozilla.javascript.Context.call(Context.java:515)
[junit] at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:444)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:961)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:152)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:165)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:576)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:916)
[junit] at org.mozilla.javascript.Context.call(Context.java:515)
[junit] at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:921)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:896)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:103)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmitInput.java:78)
[junit] at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:148)
[junit] at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:107)
[junit] at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:76)
[junit] at com.sun.faces.systest.state.DynamicStateTestCase.testDeleteAddSameAction(DynamicStateTestCase.java:154)
[junit] Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "getElementsByTagName" of null (http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623#1824)
[junit] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
[junit] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
[junit] at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
[junit] at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
[junit] at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3698)
[junit] at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2221)
[junit] at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
[junit] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
[junit] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
[junit] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:472)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:142)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:413)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:352)
[junit] at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
[junit] at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:476)
[junit] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
[junit] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
[junit] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[junit] at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
[junit] at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:192)
[junit] at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
[junit] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:472)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:437)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:507)
[junit] Enclosed exception:
[junit] org.mozilla.javascript.EcmaError: TypeError: Cannot call method "getElementsByTagName" of null (http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623#1824)
[junit] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
[junit] at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
[junit] at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
[junit] at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
[junit] at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3698)
[junit] at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2221)
[junit] at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
[junit] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:1824)
[junit] at script.apply(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:8)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:367)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:246)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:123)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:366)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:1678)
[junit] at script.sendError(http://localhost:8080/jsf-systest/faces/javax.faces.resource/jsf.js?ln=javax.faces&stage=Development:1388)
[junit] at script.onComplete(http://localhost:8080/jsf-systest/faces/javax.faces.resource/jsf.js?ln=javax.faces&stage=Development:1217)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/jsf.js?ln=javax.faces&stage=Development:1195)
[junit] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
[junit] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:472)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:142)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:413)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:352)
[junit] at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
[junit] at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:476)
[junit] at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/jsf.js?ln=javax.faces&stage=Development:1317)
[junit] at script.request(http://localhost:8080/jsf-systest/faces/javax.faces.resource/jsf.js?ln=javax.faces&stage=Development:1814)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:1619)
[junit] at script(http://localhost:8080/jsf-systest/faces/javax.faces.resource/bridge.js?a1545533623:1729)
[junit] at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
[junit] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[junit] at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
[junit] at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:192)
[junit] at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
[junit] at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:472)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:437)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:507)
[junit] at org.mozilla.javascript.Context.call(Context.java:515)
[junit] at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
[junit] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:444)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:961)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:152)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:165)
[junit] at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:576)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:916)
[junit] at org.mozilla.javascript.Context.call(Context.java:515)
[junit] at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:921)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:896)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:103)
[junit] at com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmitInput.java:78)
[junit] at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:148)
[junit] at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:107)
[junit] at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:76)
[junit] at com.sun.faces.systest.state.DynamicStateTestCase.testDeleteAddSameAction(DynamicStateTestCase.java:154)
[junit] == CALLING JAVASCRIPT ==
[junit]
[junit] function ()
[junit]
[junit] ======= EXCEPTION END ========
[junit]
[junit] Testcase: testDynamicAdditionTransietSubTree took 0.022 sec
[junit] Test com.sun.faces.systest.state.DynamicStateTestCase FAILED
Removed addition of newline character after tags. Resolving as fixed.