On Monday, January 13, 2014 8:38:49 PM UTC+1, Jens wrote:
It does look like there is a real difference between Java's trim() and the
following JavaScript:
1. var r1 = this.replace(/^(\s*)/, '');
2. var r2 = r1.replace(/\s*$/, '');
A JavaScript whitespace character can be:
-
Thanks a lot Thomas.
I've submitted this issue
here: https://code.google.com/p/google-web-toolkit/issues/detail?id=8534
On Tuesday, January 14, 2014 4:06:28 AM UTC-5, Thomas Broyer wrote:
Maybe worth a bug entry.
+1
The emulation should read:
var r1 = this.replace(/^[\0- ]*/, '');
Thank you Jens.
It does look like there is a real difference between Java's trim() and the
following JavaScript:
1. var r1 = this.replace(/^(\s*)/, '');
2. var r2 = r1.replace(/\s*$/, '');
A JavaScript whitespace character can be:
- A space character
- A tab character
- A
On 01/13/2014 11:53 AM, Michael Prentice wrote:
Thank you Jens.
It does look like there is a real difference between Java's trim() and
the following JavaScript:
1. var r1 = this.replace(/^(\s*)/, '');
2. var r2 = r1.replace(/\s*$/, '');
A JavaScript whitespace character can be:
* A
It does look like there is a real difference between Java's trim() and the
following JavaScript:
1. var r1 = this.replace(/^(\s*)/, '');
2. var r2 = r1.replace(/\s*$/, '');
A JavaScript whitespace character can be:
- A space character
- A tab character
- A carriage
Yeah, I had thought about that, but unfortunately our DTOs are
auto-generated from the backend and contain null filled pre-sized char
arrays. I changed the generator to give us String getProperty() and
setProperty(String) method for each char Array. Changing those to do trim()
wouldn't work
OK, we ran into a strange issue today. This is using GWT 2.5.1 with Chrome
32.0.1700.68
beta-m (and latest stable). Production mode is hosted by Jetty.
*The following code works fine in DevMode but fails in Production (same
browser):*
ListSchGetInfoForDoorsReq_DoorDto tempDocksModel = new
I guess that I should explain what 'fails' means.
We're looking to add items to the list when both the TrailerID and TripID
fields are empty.
The failure is that, the trim() checks in Java, trim the 'whitespace' which
in this case are null characters in the String. So the comparison is
GWT does not use the JS trim() method because of browser compatibility.
See bottom of file:
https://gwt.googlesource.com/gwt/+/master/user/super/com/google/gwt/emul/java/lang/String.java
Maybe this implementation is not compatible with the contents of your
String. In Java everything below