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

Bug 337987

Summary: Javascript error if multi text contains the unicode character 2028
Product: [RT] RAP Reporter: Istvan Ballok <Istvan.Ballok>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ruediger.herrmann
Version: 1.4   
Target Milestone: 1.4 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch none

Description Istvan Ballok CLA 2011-02-23 10:42:31 EST
related bugs are #304364 and #337974

To reproduce the problem:
- open the controls demo, text tab, and set the value
  of a MULTI Text using the widgets on the right hand side to a string 
  that contains the unicode codepoint: 2028
    (tip: on windows, by setting a registry key 
	(http://en.wikipedia.org/wiki/Unicode_input#Hex_input), 
	you can easily input this character by pressing ALT + "+" + 2028)

Note: this semantic line separator character is often found 
      on websites, e.g. in the impressum. 
	  After copying this text to a RAP application, 
	  where it is processed and later displayed in a text,
	  this error happens.

The reason for this problem is that the resolution of bug: #304364 
did not fix this issue in the multi text.

Proposed solution:
In MultiTextLCA#renderChanges, use TextLCAUtil.writeText( text )
to set a text, just as it is done in the other text LCAs.
TextLCAUtil.writeText, besides setting the text also transforms
the string appropriately.

Note: 
I think the reason for this bug was the fact, that this MultiTextLCA
did not delegate to the TextLCAUtil. Hence, when that code was fixed,
it was easily forgotten.
Comment 1 Istvan Ballok CLA 2011-02-23 10:53:56 EST
Created attachment 189608 [details]
patch

resolution: use the TextLCAUtil.writeText() method in all 3 Text LCAs.
            that method performs the necessary string transformations.

note: to preserve the behaviour of replacing new line characters with a
      space, a boolean replaceNewLines parameter was added to
      TextLCAUtil.writeText, and the 3 calls were adjusted appropriately
Comment 2 Ivan Furnadjiev CLA 2011-02-28 04:54:30 EST
Istvan, thanks for the patch. Applied patch to CVS HEAD. Now all three types of Text widget (SINGLE, MULTI and PASSWORD) use TextLCAUtil#write Text. JUnit tests added.