net.sf.json.JSONException: JSON does not allow non-finite numbers.

Jenkins JIRA | Stefan Drissen | 7 months ago
  1. 0

    [JIRA] [mstest-plugin] (JENKINS-34777) mstest-plugin durations can overflow testresult plug-in

    Google Groups | 7 months ago | stefan....@gmail.com (JIRA)
    net.sf.json.JSONException: JSON does not allow non-finite numbers.
  2. 0

    Note: all of the below has not been verified, currently waiting for a free node to test the simple test case. Too many digits are used as duration. src/main/resources/hudson/plugins/mstest/mstest-to-junit.xsl is taking the entire duration from the trx and putting it in the JUnit time: {noformat} <xsl:variable name="duration_seconds" select="substring($duration, 7)"/> <xsl:variable name="duration_minutes" select="substring($duration, 4, 2 )"/> <xsl:variable name="duration_hours" select="substring($duration, 1, 2)"/>{noformat} However, the totalTimeTaken is 'only' a float and net.sf.json.JSONUtils.testValidity throws a "JSON does not allow non-finite numbers" when the value is too large for a float. Since a float can only have 6-8 digits the duration above fails. So either: # use a double instead of a float # adjust the xsl to keep the time down: {noformat} <xsl:variable name="duration_seconds" select="substring($duration, 7, 4)"/> <xsl:variable name="duration_minutes" select="substring($duration, 4, 2 )"/> <xsl:variable name="duration_hours" select="substring($duration, 1, 2)"/>{noformat} When starting the test results analyzer, Jenkins sytem log contains: {noformat}May 12, 2016 9:52:02 PM WARNING org.kohsuke.stapler.HttpResponseRenderer$Default handleJavaScriptProxyMethodCall call to /$stapler/bound/37513732-3136-4970-86bb-052ba76502ab/getTreeResult failed net.sf.json.JSONException: JSON does not allow non-finite numbers. at net.sf.json.util.JSONUtils.testValidity(JSONUtils.java:629) at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:245) at net.sf.json.JSONObject._processValue(JSONObject.java:2599) at net.sf.json.JSONObject.processValue(JSONObject.java:2665) at net.sf.json.JSONObject.element(JSONObject.java:1738) at net.sf.json.JSONObject.element(JSONObject.java:1716) at net.sf.json.JSONObject.put(JSONObject.java:2328) at org.jenkinsci.plugins.testresultsanalyzer.result.data.ResultData.getJsonObject(ResultData.java:171) at org.jenkinsci.plugins.testresultsanalyzer.result.info.Info.getBuildJson(Info.java:41) at org.jenkinsci.plugins.testresultsanalyzer.result.info.Info.getJsonObject(Info.java:57) at org.jenkinsci.plugins.testresultsanalyzer.result.info.ResultInfo.getJsonObject(ResultInfo.java:31) at org.jenkinsci.plugins.testresultsanalyzer.JsTreeUtil.getJsTree(JsTreeUtil.java:21) at org.jenkinsci.plugins.testresultsanalyzer.TestResultsAnalyzerAction.getTreeResult(TestResultsAnalyzerAction.java:177){noformat} Example testsuites.xml file: {noformat}<?xml version="1.0" encoding="UTF-8"?> <testsuites> <testsuite name="MSTestSuite" tests="1" time="0" failures="4" errors="0" skipped="0"> <testcase name="overflow" time="95.1412296" classname="overflow"/> </testsuite> </testsuites>{noformat}

    Jenkins JIRA | 7 months ago | Stefan Drissen
    net.sf.json.JSONException: JSON does not allow non-finite numbers.
  3. 0

    Note: all of the below has not been verified, currently waiting for a free node to test the simple test case. Too many digits are used as duration. src/main/resources/hudson/plugins/mstest/mstest-to-junit.xsl is taking the entire duration from the trx and putting it in the JUnit time: {noformat} <xsl:variable name="duration_seconds" select="substring($duration, 7)"/> <xsl:variable name="duration_minutes" select="substring($duration, 4, 2 )"/> <xsl:variable name="duration_hours" select="substring($duration, 1, 2)"/>{noformat} However, the totalTimeTaken is 'only' a float and net.sf.json.JSONUtils.testValidity throws a "JSON does not allow non-finite numbers" when the value is too large for a float. Since a float can only have 6-8 digits the duration above fails. So either: # use a double instead of a float # adjust the xsl to keep the time down: {noformat} <xsl:variable name="duration_seconds" select="substring($duration, 7, 4)"/> <xsl:variable name="duration_minutes" select="substring($duration, 4, 2 )"/> <xsl:variable name="duration_hours" select="substring($duration, 1, 2)"/>{noformat} When starting the test results analyzer, Jenkins sytem log contains: {noformat}May 12, 2016 9:52:02 PM WARNING org.kohsuke.stapler.HttpResponseRenderer$Default handleJavaScriptProxyMethodCall call to /$stapler/bound/37513732-3136-4970-86bb-052ba76502ab/getTreeResult failed net.sf.json.JSONException: JSON does not allow non-finite numbers. at net.sf.json.util.JSONUtils.testValidity(JSONUtils.java:629) at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:245) at net.sf.json.JSONObject._processValue(JSONObject.java:2599) at net.sf.json.JSONObject.processValue(JSONObject.java:2665) at net.sf.json.JSONObject.element(JSONObject.java:1738) at net.sf.json.JSONObject.element(JSONObject.java:1716) at net.sf.json.JSONObject.put(JSONObject.java:2328) at org.jenkinsci.plugins.testresultsanalyzer.result.data.ResultData.getJsonObject(ResultData.java:171) at org.jenkinsci.plugins.testresultsanalyzer.result.info.Info.getBuildJson(Info.java:41) at org.jenkinsci.plugins.testresultsanalyzer.result.info.Info.getJsonObject(Info.java:57) at org.jenkinsci.plugins.testresultsanalyzer.result.info.ResultInfo.getJsonObject(ResultInfo.java:31) at org.jenkinsci.plugins.testresultsanalyzer.JsTreeUtil.getJsTree(JsTreeUtil.java:21) at org.jenkinsci.plugins.testresultsanalyzer.TestResultsAnalyzerAction.getTreeResult(TestResultsAnalyzerAction.java:177){noformat} Example testsuites.xml file: {noformat}<?xml version="1.0" encoding="UTF-8"?> <testsuites> <testsuite name="MSTestSuite" tests="1" time="0" failures="4" errors="0" skipped="0"> <testcase name="overflow" time="95.1412296" classname="overflow"/> </testsuite> </testsuites>{noformat}

    Jenkins JIRA | 7 months ago | Stefan Drissen
    net.sf.json.JSONException: JSON does not allow non-finite numbers.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Servlet communicate with Hibernate

    Stack Overflow | 4 years ago | F3RN1
    net.sf.json.JSONException: There is a cycle in the hierarchy!

    3 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. net.sf.json.JSONException

      JSON does not allow non-finite numbers.

      at net.sf.json.util.JSONUtils.testValidity()
    2. json-lib
      JSONObject.put
      1. net.sf.json.util.JSONUtils.testValidity(JSONUtils.java:629)
      2. net.sf.json.AbstractJSON._processValue(AbstractJSON.java:245)
      3. net.sf.json.JSONObject._processValue(JSONObject.java:2599)
      4. net.sf.json.JSONObject.processValue(JSONObject.java:2665)
      5. net.sf.json.JSONObject.element(JSONObject.java:1738)
      6. net.sf.json.JSONObject.element(JSONObject.java:1716)
      7. net.sf.json.JSONObject.put(JSONObject.java:2328)
      7 frames
    3. org.jenkinsci.plugins
      JsTreeUtil.getJsTree
      1. org.jenkinsci.plugins.testresultsanalyzer.result.data.ResultData.getJsonObject(ResultData.java:171)
      2. org.jenkinsci.plugins.testresultsanalyzer.result.info.Info.getBuildJson(Info.java:41)
      3. org.jenkinsci.plugins.testresultsanalyzer.result.info.Info.getJsonObject(Info.java:57)
      4. org.jenkinsci.plugins.testresultsanalyzer.result.info.ResultInfo.getJsonObject(ResultInfo.java:31)
      5. org.jenkinsci.plugins.testresultsanalyzer.JsTreeUtil.getJsTree(JsTreeUtil.java:21)
      5 frames