A user of 1.509.3 with the Metadata plugin formerly installed had some data listed in Discard Old Data screen, as expected:

      hudson.model.FreeStyleBuild
      jobname #123
      CannotResolveClassException: com.sonyericsson.hudson.plugins.metadata.model.MetadataBuildAction

      He clicked Discard and received an error:

      java.lang.NullPointerException
      	at hudson.model.AbstractItem.getRootDir(AbstractItem.java:162)
      	at hudson.model.Items.getConfigFile(Items.java:236)
      	at hudson.model.AbstractItem.getConfigFile(AbstractItem.java:461)
      	at hudson.model.AbstractItem.save(AbstractItem.java:456)
      	at hudson.model.Job.save(Job.java:152)
      	at hudson.model.AbstractProject.save(AbstractProject.java:268)
      	at hudson.diagnosis.OldDataMonitor.doDiscard(OldDataMonitor.java:275)
      

      This means that there is an AbstractProject whose parent is null. Most likely a serialized MetadataBuildAction was persisting a Run which was not identical to the build to which it had been added (this is possible due to lazy-loading), so XStream did not use a backreference but instead tried to serialize the whole build. When deserialized, the orphaned build would have had a bogus parent project.

      The solution in 1.519+ (or 1.509.3/4) is simple: use the new RunAction2. There is no alternative available for older versions of Jenkins.

          [JENKINS-20950] NPE during Discard Old Data

          Jesse Glick created issue -
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-17125 [ JENKINS-17125 ]

          Jesse Glick added a comment -

          Similar to the core bug JENKINS-17125.

          Jesse Glick added a comment - Similar to the core bug JENKINS-17125 .
          Jesse Glick made changes -
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Also happens with textfinder plugin on LTS 1.509.3.
          Manage Old Data gives list of entries of with:
          Type: hudson.model.FreeStyleProject
          Error: MissingFieldException: No field 'completeBuild' found in class 'hudson.model.Result', MissingFieldException: No field 'completeBuild' found in class 'hudson.model.Result', CannotResolveClassException: hudson.plugins.textfinder.TextFinderPublisher

          Trying to discard will generate NPE:
          Caused by: java.lang.NullPointerException
          at hudson.model.AbstractItem.getRootDir(AbstractItem.java:162)
          at hudson.model.Items.getConfigFile(Items.java:236)
          at hudson.model.AbstractItem.getConfigFile(AbstractItem.java:461)
          at hudson.model.AbstractItem.save(AbstractItem.java:456)
          at hudson.model.Job.save(Job.java:152)
          at hudson.model.AbstractProject.save(AbstractProject.java:268)
          at hudson.diagnosis.OldDataMonitor.doDiscard(OldDataMonitor.java:275)

          Sagi Sinai-Glazer added a comment - Also happens with textfinder plugin on LTS 1.509.3. Manage Old Data gives list of entries of with: Type: hudson.model.FreeStyleProject Error: MissingFieldException: No field 'completeBuild' found in class 'hudson.model.Result', MissingFieldException: No field 'completeBuild' found in class 'hudson.model.Result', CannotResolveClassException: hudson.plugins.textfinder.TextFinderPublisher Trying to discard will generate NPE: Caused by: java.lang.NullPointerException at hudson.model.AbstractItem.getRootDir(AbstractItem.java:162) at hudson.model.Items.getConfigFile(Items.java:236) at hudson.model.AbstractItem.getConfigFile(AbstractItem.java:461) at hudson.model.AbstractItem.save(AbstractItem.java:456) at hudson.model.Job.save(Job.java:152) at hudson.model.AbstractProject.save(AbstractProject.java:268) at hudson.diagnosis.OldDataMonitor.doDiscard(OldDataMonitor.java:275)

          Seems like it might be a duplicate of https://issues.jenkins-ci.org/browse/JENKINS-18809

          Sagi Sinai-Glazer added a comment - Seems like it might be a duplicate of https://issues.jenkins-ci.org/browse/JENKINS-18809

          Jesse Glick added a comment -

          @esinsag no, keep JENKINS-18809 for the Claim plugin please, and if you have some issue with the Text Finder plugin file it separately and link.

          Jesse Glick added a comment - @esinsag no, keep JENKINS-18809 for the Claim plugin please, and if you have some issue with the Text Finder plugin file it separately and link.
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-18809 [ JENKINS-18809 ]

          Code changed in jenkins
          User: Jesse Glick
          Path:
          pom.xml
          src/main/java/com/sonyericsson/hudson/plugins/metadata/cli/CliUtils.java
          src/main/java/com/sonyericsson/hudson/plugins/metadata/contributors/BuildContributorsController.java
          src/main/java/com/sonyericsson/hudson/plugins/metadata/model/MetadataBuildAction.java
          http://jenkins-ci.org/commit/metadata-plugin/0dc90f1ab6b3942b971d76d3732c45dfb0c9fa0a
          Log:
          [FIXED JENKINS-20950] Do not try to persist the build which holds this action.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/com/sonyericsson/hudson/plugins/metadata/cli/CliUtils.java src/main/java/com/sonyericsson/hudson/plugins/metadata/contributors/BuildContributorsController.java src/main/java/com/sonyericsson/hudson/plugins/metadata/model/MetadataBuildAction.java http://jenkins-ci.org/commit/metadata-plugin/0dc90f1ab6b3942b971d76d3732c45dfb0c9fa0a Log: [FIXED JENKINS-20950] Do not try to persist the build which holds this action.

            rsandell rsandell
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: