Skip to content

The getAvailableSizes cause JsonSyntaxException #122

@imarsv

Description

@imarsv

V2.17 Release

The getAvailableSizes cause JsonSyntaxException

com.myjeeva.digitalocean.impl.DigitalOceanClient: Error occurred while parsing response
com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected a long but was 0.5 at line 1 column 87 path $.sizes[0].transfer
	at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:320)
	at com.google.gson.internal.bind.TypeAdapters$11.read(TypeAdapters.java:310)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:130)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:221)
	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:130)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:221)
	at com.google.gson.Gson.fromJson(Gson.java:991)
	at com.google.gson.Gson.fromJson(Gson.java:956)
	at com.google.gson.Gson.fromJson(Gson.java:905)
	at com.google.gson.Gson.fromJson(Gson.java:876)
	at com.myjeeva.digitalocean.impl.DigitalOceanClient.perform(DigitalOceanClient.java:1614)
	at com.myjeeva.digitalocean.impl.DigitalOceanClient.getAvailableSizes(DigitalOceanClient.java:798)

Original Json example

{
  "sizes": [
    {
      "slug": "s-1vcpu-512mb-10gb",
      "memory": 512,
      "vcpus": 1,
      "disk": 10,
      "transfer": 0.5,
      "price_monthly": 4,
      "price_hourly": 0.00595,
      "regions": [
        "ams3",
        "fra1",
        "nyc1",
        "sfo3",
        "sgp1"
      ],
      "available": true,
      "description": "Basic"
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions