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

AbstractBuildExecution#reportError should work will any kind of Build Step

      AbstractBuildExecution#reportError should work will any kind of Build Step.

      Right now, reportError supposes that all the build steps are Publishers, but according with the code it should work with any kind of BuildStep.

              private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) {
                  final String publisher = ((Publisher) bs).getDescriptor().getDisplayName();
      
                  if (e instanceof AbortException) {
                      LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, publisher});
                      listener.error("Publisher '" + publisher + "' failed: ");
                      listener.error(e.getMessage());
                  } else {
                      String msg = "Publisher '" + publisher + "' aborted due to exception: ";
                      e.printStackTrace(listener.error(msg));
                      LOGGER.log(WARNING, msg, e);
                  }
      
                  if (phase) {
                      setResult(Result.FAILURE);
                  }
              }
      

          [JENKINS-30730] AbstractBuildExecution#reportError should work will any kind of Build Step

          Jesse Glick added a comment -

          This seems to be a regression in the LTS, preventing proper error diagnosis (even AbortException for user mistakes—not necessarily just plugin bugs), so I am proposing it for backport.

          Jesse Glick added a comment - This seems to be a regression in the LTS, preventing proper error diagnosis (even AbortException for user mistakes—not necessarily just plugin bugs), so I am proposing it for backport.

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/AbstractBuild.java
          test/src/test/java/hudson/model/AbstractBuildTest2.java
          http://jenkins-ci.org/commit/jenkins/725b6afeac4ac5b8821c095f3b093cd0daa3a526
          Log:
          [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher.

          This pull request integrates https://github.com/jenkinsci/jenkins/pulls/1851, which is a reworked version of https://github.com/jenkinsci/jenkins/pull/1846 from @fbelzunc (no original codelines left)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/AbstractBuild.java test/src/test/java/hudson/model/AbstractBuildTest2.java http://jenkins-ci.org/commit/jenkins/725b6afeac4ac5b8821c095f3b093cd0daa3a526 Log: [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher. This pull request integrates https://github.com/jenkinsci/jenkins/pulls/1851 , which is a reworked version of https://github.com/jenkinsci/jenkins/pull/1846 from @fbelzunc (no original codelines left)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: changelog.html http://jenkins-ci.org/commit/jenkins/6a65371e5beb74d113557eaed5c51c33b8130984 Log: Noting JENKINS-30730 from #1851 Compare: https://github.com/jenkinsci/jenkins/compare/0a36f743f1fd...6a65371e5beb

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4327
          [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher. (Revision 725b6afeac4ac5b8821c095f3b093cd0daa3a526)
          Noting JENKINS-30730 from #1851 (Revision 6a65371e5beb74d113557eaed5c51c33b8130984)

          Result = SUCCESS
          o.v.nenashev : 725b6afeac4ac5b8821c095f3b093cd0daa3a526
          Files :

          • test/src/test/java/hudson/model/AbstractBuildTest2.java
          • core/src/main/java/hudson/model/AbstractBuild.java

          o.v.nenashev : 6a65371e5beb74d113557eaed5c51c33b8130984
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #4327 [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher. (Revision 725b6afeac4ac5b8821c095f3b093cd0daa3a526) Noting JENKINS-30730 from #1851 (Revision 6a65371e5beb74d113557eaed5c51c33b8130984) Result = SUCCESS o.v.nenashev : 725b6afeac4ac5b8821c095f3b093cd0daa3a526 Files : test/src/test/java/hudson/model/AbstractBuildTest2.java core/src/main/java/hudson/model/AbstractBuild.java o.v.nenashev : 6a65371e5beb74d113557eaed5c51c33b8130984 Files : changelog.html

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/AbstractBuild.java
          test/src/test/java/hudson/model/AbstractBuildTest2.java
          http://jenkins-ci.org/commit/jenkins/3af6c6b815e7599e6f1bc59555ee6db9fdb36392
          Log:
          [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher.

          This pull request integrates https://github.com/jenkinsci/jenkins/pulls/1851, which is a reworked version of https://github.com/jenkinsci/jenkins/pull/1846 from @fbelzunc (no original codelines left)

          (cherry picked from commit 725b6afeac4ac5b8821c095f3b093cd0daa3a526)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/AbstractBuild.java test/src/test/java/hudson/model/AbstractBuildTest2.java http://jenkins-ci.org/commit/jenkins/3af6c6b815e7599e6f1bc59555ee6db9fdb36392 Log: [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher. This pull request integrates https://github.com/jenkinsci/jenkins/pulls/1851 , which is a reworked version of https://github.com/jenkinsci/jenkins/pull/1846 from @fbelzunc (no original codelines left) (cherry picked from commit 725b6afeac4ac5b8821c095f3b093cd0daa3a526)

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4358
          [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher. (Revision 3af6c6b815e7599e6f1bc59555ee6db9fdb36392)

          Result = UNSTABLE
          ogondza : 3af6c6b815e7599e6f1bc59555ee6db9fdb36392
          Files :

          • test/src/test/java/hudson/model/AbstractBuildTest2.java
          • core/src/main/java/hudson/model/AbstractBuild.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4358 [FIXED JENKINS-30730] Prevent ClassCastException in Abstractbuild::reportError() if the build step is not Publisher. (Revision 3af6c6b815e7599e6f1bc59555ee6db9fdb36392) Result = UNSTABLE ogondza : 3af6c6b815e7599e6f1bc59555ee6db9fdb36392 Files : test/src/test/java/hudson/model/AbstractBuildTest2.java core/src/main/java/hudson/model/AbstractBuild.java

            fbelzunc Félix Belzunce Arcos
            fbelzunc Félix Belzunce Arcos
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: