Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-914

Detailed message from failed script evaluation shouldn't be propagated

    XMLWordPrintableJSON

Details

    Description

      In class ScriptRunner when exception occur during script evaluate message from cause exception is propagated to generated exception.

      For groovy we have many details in message so if client library logs message from exception it is redundant.

      This datailed is stored in log file from execution. So if somebody also print content of logs, as maven-infoker with streamLogs, we have duplicated messages.

      This details is stored in log file from execution. So if somebody also print content of logs, as maven-invoker-plugin does with streamsLogs options, we have duplicate messages.

       

      Code to change:

      catch ( ScriptEvaluationException e )
      {
          Throwable t = ( e.getCause() != null ) ? e.getCause() : e;
          String msg = ( t.getMessage() != null ) ? t.getMessage() : t.toString();
          if ( LOG.isDebugEnabled() )
          {
              String errorMessage = "Error evaluating " + scriptDescription + " " + scriptFile.getPath() + ", " + t;
              LOG.debug( errorMessage, t );
          }
          if ( logger != null )
          {
              t.printStackTrace( logger.getPrintStream() );
          }
          if ( failOnException )
          {
              throw new RunFailureException( "The " + scriptDescription + " did not succeed. " + msg, stage );
          }
          else
          {
              throw new RunErrorException( "The " + scriptDescription + " did not succeed. " + msg, stage, t );
          }
      } 

      msg variable and her usage should be removed.

       

      This resolve MINVOKER-265

      Attachments

        Issue Links

          Activity

            People

              slachiewicz Sylwester Lachiewicz
              sjaranowski Slawomir Jaranowski
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: