com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 3.3382 at line 1 column 39

Atlassian JIRA | Sultan Maiyaki [Atlassian] | 2 years ago
  1. 0

    When we have a test result to be parsed by mocha and this results have duration that are non-integer, the build will fail with the error below: {code} com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 3.3382 at line 1 column 39 at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:232) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:222) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) at com.google.gson.Gson.fromJson(Gson.java:790) at com.google.gson.Gson.fromJson(Gson.java:729) at com.atlassian.bamboo.plugins.nodejs.tasks.mocha.parser.MochaReportCollector.collect(MochaReportCollector.java:36) at com.atlassian.bamboo.build.test.TestCollationServiceImpl$1$1.run(TestCollationServiceImpl.java:139) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NumberFormatException: Expected an int but was 3.3382 at line 1 column 39 at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1192) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:230) ... 17 more {code} Most test results are in milliseconds and this makes parsing impossible

    Atlassian JIRA | 2 years ago | Sultan Maiyaki [Atlassian]
    com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 3.3382 at line 1 column 39
  2. 0

    When we have a test result to be parsed by mocha and this results have duration that are non-integer, the build will fail with the error below: {code} com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 3.3382 at line 1 column 39 at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:232) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:222) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81) at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) at com.google.gson.Gson.fromJson(Gson.java:790) at com.google.gson.Gson.fromJson(Gson.java:729) at com.atlassian.bamboo.plugins.nodejs.tasks.mocha.parser.MochaReportCollector.collect(MochaReportCollector.java:36) at com.atlassian.bamboo.build.test.TestCollationServiceImpl$1$1.run(TestCollationServiceImpl.java:139) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NumberFormatException: Expected an int but was 3.3382 at line 1 column 39 at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1192) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:230) ... 17 more {code} Most test results are in milliseconds and this makes parsing impossible

    Atlassian JIRA | 2 years ago | Sultan Maiyaki [Atlassian]
    com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 3.3382 at line 1 column 39
  3. 0

    Editing Config

    GitHub | 6 years ago | lmk-chris
    com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: invalid number or unquoted string near ?{ "colorMember": "G
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Retrofit - removing some invalid characters from response body before parsing it as json

    Stack Overflow | 2 years ago | pomber
    retrofit.RetrofitError: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1
  6. 0

    Async task's messages exchange with Java Servlet

    Stack Overflow | 2 years ago
    com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 692 path $

  1. Emrah Küçük 9 times, last 4 weeks ago
  2. linxiaolong 4 times, last 4 weeks ago
  3. Indri Yunita 4 times, last 2 months ago
  4. nasimk 4 times, last 2 weeks ago
  5. Alexandru Popa 96 times, last 2 months ago
16 more registered users
53 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.NumberFormatException

    Expected an int but was 3.3382 at line 1 column 39

    at com.google.gson.stream.JsonReader.nextInt()
  2. Gson
    Gson.fromJson
    1. com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1192)
    2. com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:230)
    3. com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:222)
    4. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
    5. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)
    6. com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
    7. com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81)
    8. com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
    9. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93)
    10. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172)
    11. com.google.gson.Gson.fromJson(Gson.java:790)
    12. com.google.gson.Gson.fromJson(Gson.java:729)
    12 frames
  3. com.atlassian.bamboo
    TestCollationServiceImpl$1$1.run
    1. com.atlassian.bamboo.plugins.nodejs.tasks.mocha.parser.MochaReportCollector.collect(MochaReportCollector.java:36)
    2. com.atlassian.bamboo.build.test.TestCollationServiceImpl$1$1.run(TestCollationServiceImpl.java:139)
    2 frames
  4. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:262)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    5. java.lang.Thread.run(Thread.java:745)
    5 frames