com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected an int but was BEGIN_OBJECT at line 1 column 26 path $.testResult.fCount

Atlassian JIRA | Pavel Baranchikov | 8 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    While performing integration tests, testrunner failed to deserialize test results: {code} Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 22.148 sec <<< FAILURE! it.com.pbaranchikov.stash.checks.CreateBranchTest Time elapsed: 22.148 sec <<< ERROR! com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected an int but was BEGIN_OBJECT at line 1 column 26 path $.testResult.fCount at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:221) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:217) at com.google.gson.Gson.fromJson(Gson.java:861) at com.google.gson.Gson.fromJson(Gson.java:826) at com.google.gson.Gson.fromJson(Gson.java:775) at com.google.gson.Gson.fromJson(Gson.java:747) at com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.runViaRestCall(AtlassianPluginsTestRunner.java:118) at com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.run(AtlassianPluginsTestRunner.java:75) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Caused by: java.lang.IllegalStateException: Expected an int but was BEGIN_OBJECT at line 1 column 26 path $.testResult.fCount at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1201) at com.google.gson.internal.bind.TypeAdapters$8.read(TypeAdapters.java:263) at com.google.gson.internal.bind.TypeAdapters$8.read(TypeAdapters.java:260) at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:217) ... 20 more {code} I found, that different gson libraries are used in Bitbucket server and in test runner. This may be the cause of the failure. Also, there is an unanswered question in "Atlassian Answers" - https://answers.atlassian.com/questions/38760172/error-running-remote-integration-tests-on-sdk-6.2.4 In order to reproduce, you can just clone https://github.com/pbaranchikov/stash-eol-check and build it, changing property "bitbucket.version" to :4.7.1.

    Atlassian JIRA | 8 months ago | Pavel Baranchikov
    com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected an int but was BEGIN_OBJECT at line 1 column 26 path $.testResult.fCount
  2. 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
  3. 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
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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 $
  6. 0

    Amy Mitchell - Google+

    google.com | 1 year ago
    com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 3.8 at line 1 column 200
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.IllegalStateException

    Expected an int but was BEGIN_OBJECT at line 1 column 26 path $.testResult.fCount

    at com.google.gson.stream.JsonReader.nextInt()
  2. Gson
    Gson.fromJson
    1. com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1201)
    2. com.google.gson.internal.bind.TypeAdapters$8.read(TypeAdapters.java:263)
    3. com.google.gson.internal.bind.TypeAdapters$8.read(TypeAdapters.java:260)
    4. com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
    5. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:117)
    6. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:217)
    7. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:117)
    8. com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:217)
    9. com.google.gson.Gson.fromJson(Gson.java:861)
    10. com.google.gson.Gson.fromJson(Gson.java:826)
    11. com.google.gson.Gson.fromJson(Gson.java:775)
    12. com.google.gson.Gson.fromJson(Gson.java:747)
    12 frames
  3. com.atlassian.plugins
    AtlassianPluginsTestRunner.run
    1. com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.runViaRestCall(AtlassianPluginsTestRunner.java:118)
    2. com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.run(AtlassianPluginsTestRunner.java:75)
    2 frames
  4. JUnit4 Provider
    JUnit4Provider.invoke
    1. org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    2. org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    3. org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    3 frames
  5. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:498)
    4 frames
  6. SureFire
    ForkedBooter.main
    1. org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    2. org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    3. org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    4. org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    5. org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
    5 frames