chiuki / gce2retrofit

Google Cloud Endpoint (GCE) to Retrofit
Apache License 2.0
100 stars 14 forks source link

NullPointerException when generating retrofit classes #2

Closed thib-rdr closed 9 years ago

thib-rdr commented 9 years ago

Hi,

The generation crashes and burn on objects with no propreties (in my case its an ENUM).

"CONTENT_TYPE": {
      "id": "CONTENT_TYPE",
      "type": "string",
      "enum": [
        "IMAGE",
        "VIDEO"
      ],
      "enumDescriptions": [
        "",
        ""
      ]
    },

Here is the exception :

Caused by: java.lang.NullPointerException
    at com.sqisland.gce2retrofit.Generator.generateModel(Generator.java:167)
    at com.sqisland.gce2retrofit.Generator.generate(Generator.java:106)
    at com.sqisland.gce2retrofit.Generator$generate.call(Unknown Source)
    at com.sqisland.gce2retrofit.GradleTask.execute(GradleTask.groovy:48)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:236)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:223)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 67 more

Thanks ! :)

chiuki commented 9 years ago

Can you post the endpoint (in resources) that uses the CONTENT_TYPE enum? I want to make sure I generate the interface for it properly as well. Thanks!

thib-rdr commented 9 years ago

Hey, sorry i did not understand what you really need. Here is the discovery file : http://0bin.net/paste/OnikWPwMdjYjYj6i#x4OU-k080iSB+HYbvKvX6xAkANQDAyoHlCMqk024COu

Let me know if you need anything else...

chiuki commented 9 years ago

Thanks for the discovery file. Yes, that's what I need.

I have pushed a new SNAPSHOT to Sonatype Nexus with a fix. Please try with ./gradlew --refresh-dependencies and let me know if it works.