I've spent the last day or so trying to figure out why GWT was setting
a non-null String to null for no apparent reason.  The code was
essentially as follows:

public void runTest() {
  test( "testing" );
}

public void test( String mystring ) {
  if( "".equals(mystring) ) {
    mystring = null;
  }
  // else if( mystring == null ) { log.debug( "This line makes it
work, even though it evaluates to false" ); }

  log.debug("mystring: " + mystring, null);  // optimised by GWT
compiler to "mystring: null"
  doSomethingElse(mystring);
}

When I uncomment the "log.debug" line everything works as expected,
but without it, GWT seems to assume that "mystring" must always be
null and hard-codes it as such throughout the generated javascript.
eg:

    $log(log_9, 10000, 'mystring: null', null);
   doSomethingElse(null);

The workaround (after spending several hours tracking down the
problem) is to change the java code to:

  if( null != mystring && mystring.length() == 0 ) {
    mystring = null;
  }

Although this works, hopefully the GWT team will be able to get to the
bottom of this issue and fix the problem (I'm using GWT 2.1.0.M1)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to