branflake2267 / GWT-Maps-V3-Api

GWT Maps V3 Javascript Bindings
Other
144 stars 113 forks source link

Defect in DrawingManager.setDrawingMode when called with null? #201

Open ukuester opened 10 years ago

ukuester commented 10 years ago

Thanks for the great work on the Google Maps V3 GWT bindings! I'm finally migrating some applications of mine to V3 and have encountered an issue.

According to its javadoc, the DrawingManager's setDrawingMode method explicitly allows passing null as a parameter value to disable drawing. However, if you do so, the implementation throws a NPE for obvious reasons. Is it a defect or is there a misconception on my side?

  /**
   * The DrawingManager's drawing mode, which defines the type of overlay to be added on the map. Accepted values are
   * MARKER, POLYGON, POLYLINE, RECTANGLE, CIRCLE, or null. A drawing mode of null means that the user can interact with
   * the map as normal, and clicks do not draw anything.
   * 
   * @param drawingMode
   */
  public final void setDrawingMode(OverlayType drawingMode) {
    setDrawingModeImpl(drawingMode.value());
  }
twistedpair commented 10 years ago

Reported last year #57 and fixed.

See the source

  public final void setDrawingMode(OverlayType drawingMode) {
    String value = (drawingMode != null) ? drawingMode.value() : null;
    setDrawingModeImpl(value);
  }

Please confirm what version you're compiling against as this should already be fixed in the latest versions.

espinaca commented 10 years ago

The error persists, I use 3.10.0-alpha-7

https://github.com/branflake2267/GWT-Maps-V3-Api/blob/master/gwt-maps-api/src/main/java/com/google/gwt/maps/client/drawinglib/DrawingManagerOptions.java#L116