heysion / wave-protocol

Automatically exported from code.google.com/p/wave-protocol
0 stars 0 forks source link

Cannot write quoted text in Web Client #234

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The web client cannot handle quotes "". All text that is entered after a quote 
" is not persisted.

What steps will reproduce the problem?
1. Login to Web client, create a new wave and write some text with quote, for 
example: Foo like "bar".
2. Reload the wave.

What is the expected output? What do you see instead?
Expected: The wave is loaded and the blip contains: Foo like "bar"
Actual the blip contains only: Foo like
All chars after " are dropped.

Please use labels and text to provide additional information.
The following exception is printed in the console:

Session[qAJzuWVlZj6V2anZRjf9]: sendMessage: [DATA]: 
{"version":1,"sequenceNumber":3,"messageType":"ProtocolWaveletUpdate","messageJs
on":"{\"1\":\"vegalabz.com/w+sc5vHvsRw0A/~/conv+root\",\"2\":[],\"3\":{\"1\":57,
\"2\":\"uxadwcwubR6w4d0wTuVr/vk+rtI\u003d\"},\"7\":\"ch15\"}"}
     [java] Session[qAJzuWVlZj6V2anZRjf9]: sendMessage: [DATA]: {"version":1,"sequenceNumber":47,"messageType":"ProtocolWaveletUpdate","messageJson":"{\"1\":\"vegalabz.com/w+sc5vHvsRw0A/~/conv+root\",\"2\":[],\"3\":{\"1\":57,\"2\":\"uxadwcwubR6w4d0wTuVr/vk+rtI\u003d\"},\"7\":\"ch17\"}"}
     [java] Session[qAJzuWVlZj6V2anZRjf9]: onMessage: {"version":1, "sequenceNumber":61, "messageType":"ProtocolSubmitRequest", "messageJson":"{\"1\":\"vegalabz.com/w+sc5vHvsRw0A/~/conv+root\",\"2\":{\"1\":{\"1\":57,\"2\":\"uxadwcwubR6w4d0wTuVr/vk+rtI=\"},\"2\":\"vega2@vegalabz.com\",\"3\":[{\"3\":{\"1\":\"b+sc5vHvsRw0C\",\"2\":{\"1\":[{\"5\":13},{\"2\":\"\"\"},{\"5\":1}]}}}]},\"3\":\"ch17\"}"}
     [java] org.codehaus.jackson.JsonParseException: Unexpected character ('"' (code 34)): was expecting comma to separate OBJECT entries
     [java]  at [Source: java.io.ByteArrayInputStream@3a440a93; line: 1, column: 183]
     [java]     at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:943)
     [java]     at org.codehaus.jackson.impl.JsonParserBase._reportError(JsonParserBase.java:632)
     [java]     at org.codehaus.jackson.impl.JsonParserBase._reportUnexpectedChar(JsonParserBase.java:565)
     [java]     at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:133) 

Original issue reported on code.google.com by vega113 on 4 Mar 2011 at 2:53

GoogleCodeExporter commented 8 years ago

Original comment by ano...@google.com on 6 Mar 2011 at 9:32

GoogleCodeExporter commented 8 years ago
The bug is in protostuff.

The generated JSON stringify methods do not properly escape string components.  
In ProtocolDocumentOperation.Component.stringify:

  ...
  if(_2 != null)
    buf.push("\"2\":\"" + _2 + "\"");
  ...

Here, field _2 is a characters component, and its string is copied verbatim 
into the JSON string.  JSON control characters ({},"') are not escaped.

If someone wants to take this on, then that's great, but I'd rather spend 
resources on switching to PST instead of protostuff.  Most of switching to PST 
is not about code, but about the ant-build-fu, especially figuring out WIAB's 
classpaths. (I spent a few hours a few weeks ago trying to hook it up, but was 
not fully successful).

Original comment by hearn...@google.com on 7 Mar 2011 at 4:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
When the serialization issue will be fixed, the code with work around to 
manually escape double quotes in WaveletOperationSerializer should be removed.

Original comment by vega113 on 16 Mar 2011 at 11:03

GoogleCodeExporter commented 8 years ago
someone who knows the details, should file a new bug to fix the
temporary solution with a proper one? what is the solution, is it to
change from protostuff to pst, or something else?

���� 16 ������� 2011 4:04 �.�., � �������
<wave-protocol@googlecode.com> ������:

Original comment by danila...@google.com on 16 Mar 2011 at 6:38

GoogleCodeExporter commented 8 years ago
I'm working on hooking up PST, which should address this bug properly.

I've updated the WIAB code, that was not so hard, but trying to unwrangle how 
WIAB's build.xml files work is taking me quite some time.  Part of the problem 
is that the core structure of it traces back to the fedone build.xml.

I'm planning to be finished today though.

Original comment by hearn...@google.com on 16 Mar 2011 at 9:52

GoogleCodeExporter commented 8 years ago
OK, awesome, nice work.

���� 16 ������� 2011 2:53 �.�., � �������
<wave-protocol@googlecode.com> ������:

Original comment by danila...@google.com on 16 Mar 2011 at 9:59

GoogleCodeExporter commented 8 years ago
@danilatos
I experience similar exceptions in the Google Wave server. I am just curious - 
are they caused by similar issue or there's no connection?
Here is the exception:

wave/robot/jsonrpc
com.google.gson.JsonParseException: Failed parsing JSON source: 
java.io.StringReader@140243b to Json
    at com.google.gson.JsonParser.parse(JsonParser.java:57)
    at com.google.gson.Gson.fromJson(Gson.java:443)
    at com.google.gson.Gson.fromJson(Gson.java:396)
    at com.google.gson.Gson.fromJson(Gson.java:372)
    at com.google.wave.api.WaveService.makeRpc(WaveService.java:726)
    at com.google.wave.api.WaveService.submit(WaveService.java:422)
    at com.google.wave.api.AbstractRobot.submit(AbstractRobot.java:162)
    at com.vegalabz.robot.TestRobot.onWaveletSelfAdded(TestRobot.java:49)
    at com.google.wave.api.AbstractRobot.processEvents(AbstractRobot.java:640)
    at com.google.wave.api.AbstractRobot.processRpc(AbstractRobot.java:589)
    at com.google.wave.api.AbstractRobot.doPost(AbstractRobot.java:317)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:216)
    at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:141)
    at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:93)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:63)
    at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
    at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:97)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    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:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:238)
    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.headerComplete(HttpConnection.java:923)
    at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
    at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:261)
    at com.google.apphosting.base.RuntimePb$EvaluationRuntime$2.handleRequest(RuntimePb.java:8440)
    at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:454)
    at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:572)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:448)
    at com.google.tracing.TraceContext.runInContext(TraceContext.java:688)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:326)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:318)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:446)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:636)
Caused by: com.google.gson.TokenMgrError: Lexical error at line 1, column 1.  
Encountered: "<" (60), after : ""
    at com.google.gson.JsonParserJavaccTokenManager.getNextToken(JsonParserJavaccTokenManager.java:1168)
    at com.google.gson.JsonParserJavacc.jj_ntk(JsonParserJavacc.java:635)
    at com.google.gson.JsonParserJavacc.parse(JsonParserJavacc.java:10)
    at com.google.gson.JsonParser.parse(JsonParser.java:54)
    ... 50 more

Original comment by vega113 on 19 Mar 2011 at 10:44

GoogleCodeExporter commented 8 years ago
The quoting issue is now fixed.  Some unicode characters work fine too, both in 
wave content and in snippets, but Cyrillic characters only appear to be work in 
wave content - the snippet shows them as '?'.  I believe that issue is being 
tracked in a separate bug?

I'm not sure what the Google Wave status is for the Robot API.  I wouldn't be 
surprised if it had the same quoting issue that protostuff had, but it 
shouldn't stop this issue from being closed.

Original comment by hearn...@google.com on 31 Mar 2011 at 12:41

GoogleCodeExporter commented 8 years ago
Any progress on the issue posted by vega113 above. I'm experiencing the same 
problem when calling fetchwavelet.

Original comment by hiriza...@gmail.com on 4 Apr 2011 at 4:16