Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367053

Summary: [UICallBackManager] Writes a space for check isConnectionAlive - leads to exception in UICallBack.js _handleFinished
Product: [RT] RAP Reporter: Stephan Leicht Vogt <stephan.leichtvogt>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 1.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Snippet to reproduce the bug none

Description Stephan Leicht Vogt CLA 2011-12-19 02:51:32 EST
The method isConnectionAlive writes a space " " to the client. This leads to an exception in the UICallBack.js method _handleFinished. Either the writing of a space should be omited or the _handleFinished method should trim the text before the check and proccess message.
Comment 1 Ivan Furnadjiev CLA 2011-12-19 03:30:42 EST
For me it is still interesting why the response from the UICallBack request is empty - no activation, no deactivation, no send UI request. Staphan, could you provide a snippet to reproduce it?
Comment 2 Stephan Leicht Vogt CLA 2011-12-19 04:06:20 EST
Created attachment 208537 [details]
Snippet to reproduce the bug

I could reproduce it with this snippet. I reused an snippet for another bug where I just had to add this line: 
UICallBack.activate(EntryPoint.class.getName() + EntryPoint.this.hashCode());
Comment 3 Ralf Sternberg CLA 2011-12-19 06:06:13 EST
Writing characters to an output stream is the only way to check for a broken connection in Java. The native JSON parser in FF does not have an issue with leading spaces - does the json2.js parser do?
Comment 4 Ivan Furnadjiev CLA 2011-12-20 04:17:48 EST
Fixed by trimming the UICallBack response before processing. I will open another bug 367155 for the empty UICallBack response and will investigate the issue there.
Comment 5 Ivan Furnadjiev CLA 2011-12-20 11:14:30 EST
With the fix for bug 367155 trimming is not needed anymore as we *always* return valid JSON.
Comment 6 Ralf Sternberg CLA 2011-12-21 05:08:21 EST
Turned out that neither the built-in JSON parsers nor the json2.js parser has any issue with leading or trailing whitespace. Marking this bug as INVALID because the reported behavior is intended and there is nothing to fix. The problematic issue was bug 367155.