Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2011-01-28 10:52:18 +0000
committerIvan Furnadjiev2011-01-28 10:52:18 +0000
commit681dd359a25f5307c368a8e8c88c057e8508ca06 (patch)
treeabaf1ec2da714ce1c208724adcda8a59cfd63a48 /bundles
parent29a21c6befc6db2850d5f5b5675538843fd41033 (diff)
downloadorg.eclipse.rap-681dd359a25f5307c368a8e8c88c057e8508ca06.tar.gz
org.eclipse.rap-681dd359a25f5307c368a8e8c88c057e8508ca06.tar.xz
org.eclipse.rap-681dd359a25f5307c368a8e8c88c057e8508ca06.zip
Fixed - bug 333143: Javascript error if set text with special characters to Text component
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333143
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/rwt/lifecycle/WidgetLCAUtil.java10
-rw-r--r--bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java4
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/util/EncodingUtil.java11
3 files changed, 15 insertions, 10 deletions
diff --git a/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/rwt/lifecycle/WidgetLCAUtil.java b/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/rwt/lifecycle/WidgetLCAUtil.java
index eb30f73837..0c7a39864d 100644
--- a/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/rwt/lifecycle/WidgetLCAUtil.java
+++ b/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/rwt/lifecycle/WidgetLCAUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH.
+ * Copyright (c) 2002, 2011 Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1093,13 +1093,7 @@ public final class WidgetLCAUtil {
buffer.append( ch );
}
}
- // truncate at zeros
- String result = buffer.toString();
- int index = result.indexOf( 0 );
- if( index != -1 ) {
- result = result.substring( 0, index );
- }
- return result;
+ return EncodingUtil.truncateAtZero( buffer.toString() );
}
/**
diff --git a/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java b/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
index e3033bf30d..3821678cb8 100644
--- a/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
+++ b/bundles/org.eclipse.rap.rwt.q07/src/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH.
+ * Copyright (c) 2002, 2011 Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
+ * EclipseSource - ongoing development
******************************************************************************/
package org.eclipse.swt.internal.widgets.textkit;
@@ -116,6 +117,7 @@ final class TextLCAUtil {
if( WidgetLCAUtil.hasChanged( text, PROP_TEXT, newValue, "" ) ) {
String value = WidgetLCAUtil.replaceNewLines( newValue, " " );
value = EncodingUtil.removeNonDisplayableChars( value );
+ value = EncodingUtil.truncateAtZero( value );
writer.set( JS_PROP_VALUE, value );
}
}
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/util/EncodingUtil.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/util/EncodingUtil.java
index 6fb063aa10..3f864de1e8 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/util/EncodingUtil.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/util/EncodingUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2010 Innoopract Informationssysteme GmbH.
+ * Copyright (c) 2002, 2011 Innoopract Informationssysteme GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -197,6 +197,15 @@ public final class EncodingUtil {
return buffer.toString();
}
+ public static String truncateAtZero( final String text ) {
+ String result = text;
+ int index = result.indexOf( 0 );
+ if( index != -1 ) {
+ result = result.substring( 0, index );
+ }
+ return result;
+ }
+
public static boolean isNonDisplayableChar( final char ch ) {
return ch == 0x2028 || ch == 0x2029;
}

Back to the top