Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form JSON Error #92

Closed
trsvax opened this issue Nov 8, 2011 · 13 comments
Closed

Form JSON Error #92

trsvax opened this issue Nov 8, 2011 · 13 comments

Comments

@trsvax
Copy link
Contributor

trsvax commented Nov 8, 2011

I started getting this on all my form submits this morning.

A JSONArray text must start with '[' at character 0 of

I'm pretty sure it is caused by picking up the latest 3.0.0-SNAPSHOT this morning. If I turn off javascript forms work. If I remove tapestry5-jquery from my pom forms work.

Could this be caused by the Issue 90 fix?

The full stack trace is

[ERROR] ioc.Registry A JSONArray text must start with '[' at character 0 of
[ERROR] ioc.Registry Operations trace:
[ERROR] ioc.Registry [ 1] Triggering event 'action' on Index:form
[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: A JSONArray text must start with '[' at character 0 of
org.apache.tapestry5.ioc.internal.OperationException: A JSONArray text must start with '[' at character 0 of [at classpath:com/trsvax/pages/Index.tml, line 12]
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:121)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:88)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
at org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1114)
at org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:146)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1047)
at org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:81)
at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
at $ComponentEventRequestHandler_125444318011572b.handle(Unknown Source)
at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
at $ComponentEventRequestHandler_125444318011572b.handle(Unknown Source)
at org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75)
at $ComponentEventRequestHandler_125444318011572b.handle(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$40.handle(TapestryModule.java:2454)
at $ComponentEventRequestHandler_125444318011572b.handle(Unknown Source)
at $ComponentEventRequestHandler_1254443180115670.handle(Unknown Source)
at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
at org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
at $ComponentRequestHandler_1254443180115672.handleComponentEvent(Unknown Source)
at $ComponentRequestHandler_1254443180115638.handleComponentEvent(Unknown Source)
at org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)
at $Dispatcher_125444318011563b.dispatch(Unknown Source)
at $Dispatcher_1254443180115634.dispatch(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302)
at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
at $RequestHandler_1254443180115635.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
at $RequestHandler_1254443180115635.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
at $RequestHandler_1254443180115635.service(Unknown Source)
at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
at $RequestHandler_1254443180115635.service(Unknown Source)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
at $RequestHandler_1254443180115635.service(Unknown Source)
at $RequestHandler_1254443180115628.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
at org.got5.tapestry5.jquery.services.AjaxUploadServletRequestFilter.service(AjaxUploadServletRequestFilter.java:26)
at $HttpServletRequestHandler_125444318011562a.service(Unknown Source)
at org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44)
at $HttpServletRequestHandler_125444318011562a.service(Unknown Source)
at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
at $HttpServletRequestHandler_125444318011562a.service(Unknown Source)
at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_1254443180115625.service(Unknown Source)
at $HttpServletRequestHandler_125444318011562a.service(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
at $HttpServletRequestHandler_125444318011562a.service(Unknown Source)
at $HttpServletRequestHandler_1254443180115623.service(Unknown Source)
at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.apache.tapestry5.runtime.ComponentEventException: A JSONArray text must start with '[' at character 0 of [at classpath:com/trsvax/pages/Index.tml, line 12]
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1130)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3200(ComponentPageElementImpl.java:61)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1051)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1048)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
... 65 more
Caused by: java.lang.RuntimeException: A JSONArray text must start with '[' at character 0 of
at org.apache.tapestry5.json.JSONTokener.syntaxError(JSONTokener.java:384)
at org.apache.tapestry5.json.JSONArray.parse(JSONArray.java:126)
at org.apache.tapestry5.json.JSONArray.(JSONArray.java:95)
at org.apache.tapestry5.corelib.components.Form.isFormCancelled(Form.java:590)
at org.apache.tapestry5.corelib.components.Form.advised$onAction_12544431801156a2(Form.java:511)
at org.apache.tapestry5.corelib.components.Form$Invocation_onAction_12544431801156a1.proceedToAdvisedMethod(Unknown Source)
at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
at org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
at org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
at org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
at org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:931)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1106)
... 69 more

@trsvax
Copy link
Contributor Author

trsvax commented Nov 8, 2011

Also if I remove my submit button and just submit the form with the enter key it works. If I put the submit button back and hit enter I get the error. So it appears to be caused by having a submit button when I include the jQuery library.

@EmmanuelDemey
Copy link
Contributor

I think my patch I make yesterday cause this issue.

@ghost ghost assigned EmmanuelDemey Nov 8, 2011
@EmmanuelDemey
Copy link
Contributor

Whiwh Browser do you use ? Can we check the value of the t:submit input of your form ? with a debugging tool. Thanks.

@EmmanuelDemey
Copy link
Contributor

when you clicked on the submit button...

@trsvax
Copy link
Contributor Author

trsvax commented Nov 8, 2011

It breaks in Safari, Firefox and Chrome, but I was using <input type="submit"> if I change to <t:submit /> it works OK.

@trsvax
Copy link
Contributor Author

trsvax commented Nov 8, 2011

I put an id attribute on the input tag so I could get the value and it works then also. The only problem appears to be if I use an input tag with type="submit" and no id attribute.

@trsvax
Copy link
Contributor Author

trsvax commented Nov 8, 2011

I'm guessing this is the problem

$(form).formEventManager("setSubmittingElement", $(this).attr('id'));

Since there is no id this breaks.

EmmanuelDemey added a commit that referenced this issue Nov 8, 2011
@EmmanuelDemey
Copy link
Contributor

Does my patch resolve your issue ?

@trsvax
Copy link
Contributor Author

trsvax commented Nov 8, 2011

I can't test now but I looked at the code and I suspect that it will. I'll try it this evening.

@trsvax
Copy link
Contributor Author

trsvax commented Nov 9, 2011

Did not fix it. I'll take a look in the morning

@EmmanuelDemey
Copy link
Contributor

My patch is for the 3.0.0-SNAPSHOT. Which browser do you use ?

Manu

@trsvax
Copy link
Contributor Author

trsvax commented Nov 9, 2011

This fixed it for me. I'm not really sure what to do if you have multiple submitting elements without ids. I guess that means you don't care what element did the submit.

61e2061

FYI: I'm using Safari on a Mac but it also fails in Firefox and Chrome

@EmmanuelDemey
Copy link
Contributor

I have just merged your last commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants