@Override protected void handleException(InvalidCommandLineException e) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); printHelp(ps); ps.flush(); MojoFailureException mojoFailureException = new MojoFailureException( null, e.getMessage(), baos.toString()); mojoFailureException.initCause(e); throw mojoFailureException; }
/** * Main Mojo execution hook. Sub-class should use {@link #doExecute} instead. */ public void execute() throws MojoExecutionException, MojoFailureException { try { doExecute(); } catch (Exception e) { // // NOTE: Wrap to avoid truncating the stacktrace // if (e instanceof MojoExecutionException) { throw new MojoExecutionException(e.getMessage(), e); } else if (e instanceof MojoFailureException) { MojoFailureException x = new MojoFailureException(e.getMessage()); x.initCause(e); throw x; } else { throw new MojoExecutionException(e.getMessage(), e); } } }
/** * Main Mojo execution hook. Sub-class should use {@link #doExecute} instead. */ public synchronized void execute() throws MojoExecutionException, MojoFailureException { try { doExecute(); } catch (Exception e) { // // NOTE: Wrap to avoid truncating the stacktrace // if (e instanceof MojoExecutionException) { throw new MojoExecutionException(e.getMessage(), e); } else if (e instanceof MojoFailureException) { MojoFailureException x = new MojoFailureException(e.getMessage()); x.initCause(e); throw x; } else { throw new MojoExecutionException(e.getMessage(), e); } } }
@Override protected void handleException(ADLException e) throws Exception { MojoFailureException mojoFailureException = new MojoFailureException(e .getError().toString()); mojoFailureException.initCause(e); throw mojoFailureException; }
private void set( Interpreter interpreter, String name, Object value ) throws MojoFailureException { try { interpreter.set( name, value ); } catch ( EvalError ee ) { MojoFailureException mfe = new MojoFailureException( "cannot define Beanshell global variable '" + name + "': " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } } }
private void set( Interpreter interpreter, String name, Object value ) throws MojoFailureException { try { interpreter.set( name, value ); } catch ( EvalError ee ) { MojoFailureException mfe = new MojoFailureException( "cannot define Beanshell global variable '" + name + "': " + ee.getMessage() ); mfe.initCause( ee ); throw mfe; } } }
x.initCause(e); throw x;
throw ex; } catch (Exception ex) { throw (MojoFailureException) new MojoFailureException(ex.getMessage()).initCause(ex);
throw (MojoFailureException) new MojoFailureException( ex.getMessage() ).initCause( ex );
throw (MojoFailureException) new MojoFailureException( ex.getMessage() ).initCause( ex );