jeevatkm / digitalocean-api-java

DigitalOcean API Client in Java
https://www.digitalocean.com/community/projects/api-client-in-java
MIT License
177 stars 68 forks source link

The getAllVolumeSnapshots() returns always null #125

Open NeXT405 opened 2 years ago

NeXT405 commented 2 years ago

V2.17 Release

The getAllVolumeSnapshots() request returns always null because of an JsonSyntaxException DigitalOceanClient:1614

com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "000b9bcf-****-****-****-0a58ac14d111"

com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: For input string: "000b9bcf-****-****-****-0a58ac14d111"
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:245)
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:235)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
    at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
    at com.google.gson.Gson.fromJson(Gson.java:887)
    at com.google.gson.Gson.fromJson(Gson.java:852)
    at com.google.gson.Gson.fromJson(Gson.java:801)
    at com.google.gson.Gson.fromJson(Gson.java:773)
    at com.myjeeva.digitalocean.impl.DigitalOceanClient.perform(DigitalOceanClient.java:1614)
    at com.myjeeva.digitalocean.impl.DigitalOceanClient.getAllVolumeSnapshots(DigitalOceanClient.java:1287)
    at ch.ionesoft.digitalocean.DeleteSnapshots.main(DeleteSnapshots.java:25)
Caused by: java.lang.NumberFormatException: For input string: "000b9bcf-265c-11ed-859b-0a58ac14d111"
    at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
    at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
    at java.base/java.lang.Double.parseDouble(Double.java:651)
    at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1193)
    at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:243)
    ... 15 more

The response from the api looks good to me:

    "snapshots": [
        {
            "id": "000b9bcf-****-****-****-0a58ac14d111",
            "name": "snapshot-a2e3f2f0-********",
            "regions": [
                "fra1"
            ],
            "created_at": "2022-08-27T23:00:09Z",
            "resource_id": "b369c3c8-****-****-****-0a58ac14d078",
            "resource_type": "volume",
            "min_disk_size": 10,
            "size_gigabytes": 0.5198,
            "tags": [
                "k8s:3cb4adcb-****-****-****-d109da17b4d8"
            ]
        },

Feel free to ask for more information if needed.

Kind regards Marcel