Zn2O / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

String.valueOf conversion causes "Error: Argument 1 has invalid type or is outside allowed range" in web mode #190

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
GWT 1.4.60
Gears API Library 1.0  

Detailed description:
The following example program will throw an exception when run in web mode.

public class Test implements EntryPoint {
    public void onModuleLoad() {
        try {
            Database db = new Database("foo");
            Object o = "select * from sqlite_master";
            db.execute(String.valueOf(o));
        } catch (GearsException e) {
            Window.alert(e.getMessage());
        }
    }
}

The problem is that GWT's JS implementation of the String.valueOf
conversion converts the query argument from a JS String literal to some
sort of emulated String object representation.  When this is passed to
Gears, it doesn't recognize the type and throws an exception.  The same
thing can happen with the values in the query arguments array.

Workaround if you have one:
- It's possible to avoid the problem by avoiding the kind of string
conversions that result in an emulated String object.
- If this is not possible, an emulated String object can be forced back to
a literal by concatenating the empty string.
- GWT 1.5 will inline the conversion in the example program which avoids
the problem.  I don't know if there are other scenarios that would be a
problem for it.

Links to the relevant GWT Developer Forum posts:

Original issue reported on code.google.com by nlwil...@gmail.com on 7 Oct 2008 at 9:10

GoogleCodeExporter commented 9 years ago
We aren't planning any future releases of the gwt-google-apis 1.0 library for 
GWT 1.4.  

The recommended solution is to upgrade to GWT 1.5 and gwt-gears 1.1.

Original comment by galgwt.reviews@gmail.com on 8 Oct 2008 at 1:58

GoogleCodeExporter commented 9 years ago
Updating account names

Original comment by zundel@google.com on 21 Dec 2009 at 2:00