iamrvpatel / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Maps Engine API library throws IllegalArgumentException when creating a GeoJsonGeometryCollection #867

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client? 1.18.0-rc

Java environment? OpenJDK 1.7.0

Describe the problem.

I'm having an issue when running code against the generated mapsengine library, 
rev5 from Maven, 1.18.0-rc.  I've attached the Jar I used, which was downloaded 
from here: 
http://search.maven.org/#artifactdetails%7Ccom.google.apis%7Cgoogle-api-services
-mapsengine%7Cv1-rev5-1.18.0-rc%7Cjar

This code:

import com.google.api.services.mapsengine.model.GeoJsonGeometryCollection;

class Repro {
 public static void main(String[] args) {
  GeoJsonGeometryCollection geoms = new GeoJsonGeometryCollection();
 }
}

fails like so:

$ java -cp 
google-api-services-mapsengine-v1-rev5-1.18.0-rc.jar:google-http-client-1.18.0-r
c.jar:. Repro

Exception in thread "main" java.lang.ExceptionInInitializerError
      at Repro.main(Repro.java:6)
Caused by: java.lang.IllegalArgumentException: unable to create new instance of 
class com.google.api.services.mapsengine.model.GeoJsonGeometry because it is 
abstract and because it has no accessible default constructor
      at com.google.api.client.util.Types.handleExceptionForNewInstance(Types.java:165)
      at com.google.api.client.util.Types.newInstance(Types.java:120)
      at com.google.api.client.util.Data.nullOf(Data.java:134)
      at com.google.api.services.mapsengine.model.GeoJsonGeometryCollection.<clinit>(GeoJsonGeometryCollection.java:52)
      ... 1 more
Caused by: java.lang.InstantiationException: 
com.google.api.services.mapsengine.model.GeoJsonGeometry
      at java.lang.Class.newInstance(Class.java:355)
      at com.google.api.client.util.Types.newInstance(Types.java:116)
      ... 3 more

The other geometry classes seem fine so far, it's just instantiating a 
GeoJsonGeometryCollection that breaks. 

Original issue reported on code.google.com by m...@google.com on 9 Apr 2014 at 12:38

GoogleCodeExporter commented 9 years ago
This is fixed in the latest revision:

http://search.maven.org/#artifactdetails%7Ccom.google.apis%7Cgoogle-api-services
-mapsengine%7Cv1-rev44-1.19.0%7Cjar

Original comment by wonder...@google.com on 19 Sep 2014 at 1:02