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

          Félix Belzunce Arcos created issue -
          Félix Belzunce Arcos made changes -
          Description Original: AbstractBuildExecution#reportError should work will any kind of Build Step.

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


          {code:java}
                  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);
                      }
                  }
          {code}
           
          New: 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.


          {code:java}
                  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);
                      }
                  }
          {code}
           
          Félix Belzunce Arcos made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 1851 (Web Link)" [ 13175 ]
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-26964 [ JENKINS-26964 ]
          Jesse Glick made changes -
          Labels New: diagnostics lts-candidate regression
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Oliver Gondža made changes -
          Labels Original: diagnostics lts-candidate regression New: 1.625.2-fixed diagnostics regression
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 165855 ] New: JNJira + In-Review [ 197830 ]

            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: