SourApple / gwt-google-apis

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

Geocoder constructor crashes #439

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
gwt-maps 1.1.0

Detailed description:
Geocoder constructor always crashes with the following trace:

07:39:22.953 [ERROR] [asklocal] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): undefined is not a 
function
 stack: TypeError: undefined is not a function
    at CALL_NON_FUNCTION_AS_CONSTRUCTOR (native)
    at [object Object].<anonymous> (unknown source)
    at __gwt_jsInvoke (http://127.0.0.1/asklocal/hosted.html?asklocal:70:35)
    at eval at <anonymous> (http://127.0.0.1/asklocal/hosted.html?asklocal:54:12)
    at HTMLDivElement.<anonymous> (unknown source)
    at unknown source
    at __gwt_jsInvoke (http://127.0.0.1/asklocal/hosted.html?asklocal:70:35)
    at eval at <anonymous> (http://127.0.0.1/asklocal/hosted.html?asklocal:54:12)
    at HTMLDivElement.<anonymous> (unknown source)
 type: called_non_callable
 arguments: undefined
 __gwt_ObjectId: 553
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
    at sun.reflect.GeneratedMethodAccessor267.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
    at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
    at java.lang.Thread.run(Unknown Source)

Workaround if you have one:
None.

Links to the relevant GWT Developer Forum posts:

Original issue reported on code.google.com by vikrant....@gmail.com on 15 Dec 2010 at 4:02

GoogleCodeExporter commented 9 years ago
Please give some more context (source code, Gwt version, gwt-maps version , 
java version, etc).  

Does the Geocoder constructor crash if you run DevMode on the HelloMaps demo?  
Just download the gwt-maps-1.2.0 distribution and cd to samples/HelloMaps and 
run

ant devmode

Original comment by zundel@google.com on 15 Dec 2010 at 4:45

GoogleCodeExporter commented 9 years ago
This is code:

public class AskPopupPanel extends PopupPanel{
    private Geocoder geoCoder;

    public AskPopupPanel(Position t) {
        addMaps(Position t);
    }

    private void addMaps(final Position t) {
        // Open a map centered on Cawker City, KS USA
        Maps.loadMapsApi("", "2.x", true, new Runnable() {
            public void run() {
                UserDetails.setMapsEnabled();
                initializeMaps(t);
            }
        });
    }

    protected void initializeMaps(Position t) {

        LatLng sfcisco = LatLng.newInstance(37.781298, -122.419624);

        if(t != null)
            sfcisco = LatLng.fromUrlValue(t.getLat().toString()+","+t.getLng().toString());
        final MapWidget map = new MapWidget(sfcisco, 2);

        map.setPixelSize(880, 400);
        // Add some controls for the zoom level

        // Add a marker
        map.addOverlay(new Marker(sfcisco));

        // Add some controls for the zoom level
        map.addControl(new SmallMapControl());
        map.setCenter(sfcisco, 15);

        mapcontainer.add(map);
        geoCoder = new Geocoder();  // This is where it is crashing

    }
}

############################################

I have tried with GWT versions 2.0.3 and 2.0.4, 
Gwt-Maps: 1.1.0
Java: 1.3.1_01

The application crashes in dev mode. I haven't tried HelloMaps yet, but I 
followed simple instructions to invoke Geocoder.
Please let me know if I am doing anything wrong in the above code.

Thanks

Original comment by vikrant....@gmail.com on 15 Dec 2010 at 6:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Same problem with me. My code is:
final Geocoder geocoder = new Geocoder();
geocoder.getLatLng(question.getCity(), new LatLngCallback() {
    @Override
    public void onFailure() { //...
        }
        @Override
    public void onSuccess(LatLng point) {
            MapWidget map = new MapWidget(point, 5);
        contentTable.setWidget(1, 0, map);
    }
});

The code crashes, when the Geocoder is instanciated.
Tested it with GWT SDK 2.0.3 and GWT 2.1.1 in Firefox and Chrome. I have also 
tried App Engine 1.3.4 1.4.0. My environment is Ubuntu Linux 10.0.4 with 
java-6-sun-1.6.20. The maps-api version is 1.1.0.

Original comment by manuel.b...@gmail.com on 30 Dec 2010 at 9:33

GoogleCodeExporter commented 9 years ago
I resolved this issue by instantiating geocoder only after Maps have been 
initialized. Try this and let us know if it works for you.

Original comment by vikrant....@gmail.com on 30 Dec 2010 at 9:58

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
yes it worked =)
i did forget to add the maps-script-tag (including api key) in the html's 
header.
thanks a lot!

Original comment by manuel.b...@gmail.com on 31 Dec 2010 at 11:40

GoogleCodeExporter commented 9 years ago

Original comment by zundel@google.com on 28 Oct 2011 at 4:41