public ActionValidationException( String msg, String componentName ) { super( msg ); setActionClass( componentName ); }
@Test public void shouldNotAddStacktraceWhenShowStacktraceIsFalse() throws Exception { MessageFormatter mf = new MessageFormatter() { @Override String getTemplate( StringBuffer messageBuffer ) { try { return IOUtils.toString( this.getClass() .getResourceAsStream( "viewActionErrorTestTemplate.html" ), "UTF-8" ); } catch ( IOException e ) { return null; } } }; StringBuffer messageBuffer = new StringBuffer(); mf.formatExceptionMessage( MessageFormatter.HTML_MIME_TYPE, new ActionValidationException( "Test Error" ), messageBuffer, false ); // details controls are hidden // stacktrace is not added assertEquals( "<div id=\"controls\" hidden>" + "<a href=\"#\" id=\"details-show\" class=\"showLink\" onclick=\"showHide('details');return false;\">View " + "Details</a>" + "<a href=\"#\" id=\"details-hide\" class=\"hideLink\" onclick=\"showHide('details');return false;\">Hide " + "Details</a>" + "</div>" + "<div id=\"details\" class=\"details\"><span class=\"label\">%STACK_TRACE_LABEL%</span><pre " + "class=\"stackTrace\">%STACK_TRACE%<pre></div>", messageBuffer.toString() ); }
mf.formatExceptionMessage( MessageFormatter.HTML_MIME_TYPE, new ActionValidationException( "Test Error" ), messageBuffer, true );
throw new ActionValidationException( Messages.getInstance().getErrorString( "ActionDelegate.ERROR_0001_MIMETYPE_NOT_DECLARED" ) ); //$NON-NLS-1$ throw new ActionValidationException( Messages.getInstance().getErrorString( "ActionDelegate.ERROR_0003_OUTPUT_STREAM_NOT_AVAILABLE_1", //$NON-NLS-1$ curActionOutput.getPublicName() ) );
public ActionValidationException( String msg, Throwable cause, String componentName ) { super( msg, cause ); setActionClass( componentName ); }
"RuntimeContext.ERROR_0011_NO_VALID_ACTIONS" ), 0 ); //$NON-NLS-1$ status = IRuntimeContext.RUNTIME_STATUS_FAILURE; throw new ActionValidationException( Messages.getInstance().getErrorString( "RuntimeContext.ERROR_0011_NO_VALID_ACTIONS" ), //$NON-NLS-1$ session.getName(), instanceId, getActionSequence().getSequenceName(), null );
throw new ActionValidationException( Messages.getInstance().getErrorString( "RuntimeContext.ERROR_0009_COULD_NOT_CREATE_COMPONENT", actionDef.getComponentName().trim() ), ex, //$NON-NLS-1$ session.getName(), instanceId, getActionSequence().getSequenceName(), actionDefinition.getDescription(), throw new ActionValidationException( Messages.getInstance().getErrorString( "RuntimeContext.ERROR_0035_ACTION_VALIDATION_FAILED" ), t, //$NON-NLS-1$ session.getName(), instanceId, getActionSequence().getSequenceName(), component.getActionDefinition() ); throw new ActionValidationException( Messages.getInstance().getErrorString( "RuntimeContext.ERROR_0035_ACTION_VALIDATION_FAILED" ), //$NON-NLS-1$ session.getName(), instanceId, getActionSequence().getSequenceName(), component.getActionDefinition() );