Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333143 - Javascript error if set text with special characters to Text component
Summary: Javascript error if set text with special characters to Text component
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.3   Edit
Hardware: PC All
: P2 normal (vote)
Target Milestone: 1.4 M5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-23 06:11 EST by Yury CLA
Modified: 2011-01-28 05:54 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yury CLA 2010-12-23 06:11:40 EST
Build Identifier: RAP 1.3

This bug is close related with https://bugs.eclipse.org/bugs/show_bug.cgi?id=304364.
It is hard to provide steps to reproduce, but the cause of this bug is pretty clear:
i think we should truncate(or replace) zeros while set text to Text component
in JSWriter also:

  private static String escapeString( final String input ) {
    String result = EncodingUtil.escapeDoubleQuoted( input );
    result = EncodingUtil.replaceNewLines( result );

    int index = result.indexOf( 0 );
    if( index != -1 ) {
      result = result.substring( 0, index );
    }
    return result;
  }

As it is made for Labels in WidgetLCAUtil:

  public static String escapeText( final String text, final boolean mnemonics )
  {
    ...
    // truncate at zeros
    String result = buffer.toString();
    int index = result.indexOf( 0 );
    if( index != -1 ) {
      result = result.substring( 0, index );
    }
    return result;
  }

Reproducible: Always
Comment 1 Ivan Furnadjiev CLA 2011-01-28 05:54:33 EST
I did some tests in different browsers - FF, Safari, Chrome and Opera automatically truncate the text at zero, IE crashed with "undetermined string constant" error. Text is truncated at zero in TextLCAUtil as suggested. Changes are in CVS HEAD.