Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20359

Monitoring URL for JSON content change not working - "The size between old results and new results has to be the same"

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • urltrigger-plugin
    • OS: openSUSE 12.2 (x86_64)

      1. Configure URL for monitoring similar to the following: http://som.where.com/xx/xxxxx/?param1=val1&param2=val2&param3=val3&_param4=-val4&_param5=1&_format=json
      2. Configured to inspect URL content
      3. Configured JSON path as follows: $['_list'][0]['id']
      4. Observing the URLTrigger Log

      Actual behavior:
      ====
      Inspecting the content
      [ERROR] - Polling error...
      [ERROR] - Error message: The size between old results and new results has to be the same.
      ====

      Expected behavior:
      something similar to:
      ====
      Inspecting the content
      Capturing URL context. Waiting next schedule to check a change.

      Polling complete. Took 0.73 sec.
      No changes.
      ====

      Analysis performed:
      Searched for the error text in sources, identified the following block in the following file (isTriggeringBuildForContent method) as a possible source: "src\main\java\org\jenkinsci\plugins\urltrigger\content\JSONContentType.java":
      ====
      if (results.size() != newResults.size())

      { throw new XTriggerException( "The size between old results and new results has to be the same."); }

      ====

      Further code review indicated the issue might be due to the initialization of "results" member, so changed to:
      ====
      private transient Map<String, Object> results = null;
      ====

      rebuilt and verified with the above change - the issue no longer manifesting itself.

          [JENKINS-20359] Monitoring URL for JSON content change not working - "The size between old results and new results has to be the same"

          Code changed in jenkins
          User: Greg Dickie
          Path:
          src/main/java/org/jenkinsci/plugins/urltrigger/content/JSONContentType.java
          src/main/java/org/jenkinsci/plugins/urltrigger/content/XMLContentType.java
          http://jenkins-ci.org/commit/urltrigger-plugin/9f4cae414c28aebdaf6846ca76820adf53781cd8
          Log:
          JENKINS-20359: Initialize results properly to get content inspection to work

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Greg Dickie Path: src/main/java/org/jenkinsci/plugins/urltrigger/content/JSONContentType.java src/main/java/org/jenkinsci/plugins/urltrigger/content/XMLContentType.java http://jenkins-ci.org/commit/urltrigger-plugin/9f4cae414c28aebdaf6846ca76820adf53781cd8 Log: JENKINS-20359 : Initialize results properly to get content inspection to work

          Code changed in jenkins
          User: Greg Dickie
          Path:
          src/main/java/org/jenkinsci/plugins/urltrigger/content/JSONContentType.java
          src/main/java/org/jenkinsci/plugins/urltrigger/content/XMLContentType.java
          http://jenkins-ci.org/commit/urltrigger-plugin/8f415c2c38262d947a63220532132ee0b250ae6a
          Log:
          [FIXED JENKINS-20359]: Initialize results properly to get content inspection to work

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Greg Dickie Path: src/main/java/org/jenkinsci/plugins/urltrigger/content/JSONContentType.java src/main/java/org/jenkinsci/plugins/urltrigger/content/XMLContentType.java http://jenkins-ci.org/commit/urltrigger-plugin/8f415c2c38262d947a63220532132ee0b250ae6a Log: [FIXED JENKINS-20359] : Initialize results properly to get content inspection to work

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/urltrigger/content/JSONContentType.java
          src/main/java/org/jenkinsci/plugins/urltrigger/content/XMLContentType.java
          http://jenkins-ci.org/commit/urltrigger-plugin/6e416e7782ed791aa88745212fc0e7239b28d729
          Log:
          Merge pull request #7 from gregordickie/master

          JENKINS-20359: Initialize results properly to get content inspection to ...

          Compare: https://github.com/jenkinsci/urltrigger-plugin/compare/cfaaaaf16cf0...6e416e7782ed

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/urltrigger/content/JSONContentType.java src/main/java/org/jenkinsci/plugins/urltrigger/content/XMLContentType.java http://jenkins-ci.org/commit/urltrigger-plugin/6e416e7782ed791aa88745212fc0e7239b28d729 Log: Merge pull request #7 from gregordickie/master JENKINS-20359 : Initialize results properly to get content inspection to ... Compare: https://github.com/jenkinsci/urltrigger-plugin/compare/cfaaaaf16cf0...6e416e7782ed

            gbois Gregory Boissinot
            sgerenski Stoimen Gerenski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: