[MRM-430] fix error display

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@562505 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2007-08-03 15:32:38 +00:00
parent a84578e55b
commit 83dfd74838
8 changed files with 40 additions and 14 deletions

View File

@ -585,10 +585,12 @@ public class ConfigureProxyConnectorAction
catch ( RegistryException e ) catch ( RegistryException e )
{ {
addActionError( "Unable to save configuration: " + e.getMessage() ); addActionError( "Unable to save configuration: " + e.getMessage() );
return INPUT;
} }
catch ( IndeterminateConfigurationException e ) catch ( IndeterminateConfigurationException e )
{ {
addActionError( e.getMessage() ); addActionError( e.getMessage() );
return INPUT;
} }
return SUCCESS; return SUCCESS;

View File

@ -216,10 +216,12 @@ public class ConfigureNetworkProxyAction
catch ( RegistryException e ) catch ( RegistryException e )
{ {
addActionError( "Unable to save configuration: " + e.getMessage() ); addActionError( "Unable to save configuration: " + e.getMessage() );
return INPUT;
} }
catch ( IndeterminateConfigurationException e ) catch ( IndeterminateConfigurationException e )
{ {
addActionError( e.getMessage() ); addActionError( e.getMessage() );
return INPUT;
} }
return SUCCESS; return SUCCESS;

View File

@ -113,6 +113,7 @@ public class ConfigureRepositoryAction
return ERROR; return ERROR;
} }
String result = SUCCESS;
if ( StringUtils.equals( mode, "delete-entry" ) || StringUtils.equals( mode, "delete-contents" ) ) if ( StringUtils.equals( mode, "delete-entry" ) || StringUtils.equals( mode, "delete-contents" ) )
{ {
AdminRepositoryConfiguration existingRepository = getRepository(); AdminRepositoryConfiguration existingRepository = getRepository();
@ -127,33 +128,40 @@ public class ConfigureRepositoryAction
try try
{ {
removeRepository( getRepoid() ); removeRepository( getRepoid() );
removeRepositoryRoles( existingRepository ); result = saveConfiguration();
saveConfiguration();
if ( StringUtils.equals( mode, "delete-contents" ) ) if ( result.equals( SUCCESS ) )
{ {
removeContents( existingRepository ); removeRepositoryRoles( existingRepository );
if ( StringUtils.equals( mode, "delete-contents" ) )
{
removeContents( existingRepository );
}
} }
} }
catch ( IOException e ) catch ( IOException e )
{ {
addActionError( "Unable to delete repository: " + e.getMessage() ); addActionError( "Unable to delete repository: " + e.getMessage() );
result = INPUT;
} }
catch ( RoleManagerException e ) catch ( RoleManagerException e )
{ {
addActionError( "Unable to delete repository: " + e.getMessage() ); addActionError( "Unable to delete repository: " + e.getMessage() );
result = INPUT;
} }
catch ( InvalidConfigurationException e ) catch ( InvalidConfigurationException e )
{ {
addActionError( "Unable to delete repository: " + e.getMessage() ); addActionError( "Unable to delete repository: " + e.getMessage() );
result = INPUT;
} }
catch ( RegistryException e ) catch ( RegistryException e )
{ {
addActionError( "Unable to delete repository: " + e.getMessage() ); addActionError( "Unable to delete repository: " + e.getMessage() );
result = INPUT;
} }
} }
return SUCCESS; return result;
} }
public String edit() public String edit()
@ -236,29 +244,34 @@ public class ConfigureRepositoryAction
removeRepository( repoId ); removeRepository( repoId );
} }
String result;
try try
{ {
addRepository( getRepository() ); addRepository( getRepository() );
saveConfiguration(); result = saveConfiguration();
} }
catch ( IOException e ) catch ( IOException e )
{ {
addActionError( "I/O Exception: " + e.getMessage() ); addActionError( "I/O Exception: " + e.getMessage() );
result = INPUT;
} }
catch ( RoleManagerException e ) catch ( RoleManagerException e )
{ {
addActionError( "Role Manager Exception: " + e.getMessage() ); addActionError( "Role Manager Exception: " + e.getMessage() );
result = INPUT;
} }
catch ( InvalidConfigurationException e ) catch ( InvalidConfigurationException e )
{ {
addActionError( "Invalid Configuration Exception: " + e.getMessage() ); addActionError( "Invalid Configuration Exception: " + e.getMessage() );
result = INPUT;
} }
catch ( RegistryException e ) catch ( RegistryException e )
{ {
addActionError( "Configuration Registry Exception: " + e.getMessage() ); addActionError( "Configuration Registry Exception: " + e.getMessage() );
result = INPUT;
} }
return SUCCESS; return result;
} }
private boolean validateFields( String mode ) private boolean validateFields( String mode )
@ -412,6 +425,7 @@ public class ConfigureRepositoryAction
catch ( IndeterminateConfigurationException e ) catch ( IndeterminateConfigurationException e )
{ {
addActionError( e.getMessage() ); addActionError( e.getMessage() );
return INPUT;
} }
return SUCCESS; return SUCCESS;

View File

@ -258,7 +258,7 @@
<action name="saveRepository" class="configureRepositoryAction" method="save"> <action name="saveRepository" class="configureRepositoryAction" method="save">
<result name="success" type="redirect-action">repositories</result> <result name="success" type="redirect-action">repositories</result>
<result name="input">/WEB-INF/jsp/admin/addRepository.jsp</result> <result name="input">/WEB-INF/jsp/admin/editRepository.jsp</result>
<result name="error">/WEB-INF/jsp/admin/editRepository.jsp</result> <result name="error">/WEB-INF/jsp/admin/editRepository.jsp</result>
<interceptor-ref name="configuredPrepareParamsStack"/> <interceptor-ref name="configuredPrepareParamsStack"/>
</action> </action>

View File

@ -29,6 +29,8 @@
<h1>Admin: Delete Network Proxy</h1> <h1>Admin: Delete Network Proxy</h1>
<ww:actionerror/>
<div id="contentArea"> <div id="contentArea">
<h2>Delete Network Proxy</h2> <h2>Delete Network Proxy</h2>
@ -36,9 +38,9 @@
<blockquote> <blockquote>
<strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong> <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
</blockquote> </blockquote>
<p> <p>
Are you sure you want to delete network proxy <code>${proxyid}</code> ? Are you sure you want to delete network proxy <code>${proxyid}</code> ?
</p> </p>
<ww:form method="post" action="deleteNetworkProxy!delete" namespace="/admin" validate="true"> <ww:form method="post" action="deleteNetworkProxy!delete" namespace="/admin" validate="true">

View File

@ -29,6 +29,8 @@
<h1>Admin: Delete Proxy Connector</h1> <h1>Admin: Delete Proxy Connector</h1>
<ww:actionerror/>
<div id="contentArea"> <div id="contentArea">
<h2>Delete Proxy Connector</h2> <h2>Delete Proxy Connector</h2>
@ -36,14 +38,14 @@
<blockquote> <blockquote>
<strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong> <strong><span class="statusFailed">WARNING:</span> This operation can not be undone.</strong>
</blockquote> </blockquote>
<p> <p>
Are you sure you want to delete proxy connector <code>[ ${source} , ${target} ]</code> ? Are you sure you want to delete proxy connector <code>[ ${source} , ${target} ]</code> ?
</p> </p>
<ww:form method="post" action="deleteProxyConnector!delete" namespace="/admin" validate="true"> <ww:form method="post" action="deleteProxyConnector!delete" namespace="/admin" validate="true">
<ww:hidden name="target"/> <ww:hidden name="target"/>
<ww:hidden name="source"/> <ww:hidden name="source"/>
<ww:submit value="Delete"/> <ww:submit value="Delete"/>
</ww:form> </ww:form>
</div> </div>

View File

@ -29,6 +29,8 @@
<h1>Admin: Delete Repository</h1> <h1>Admin: Delete Repository</h1>
<ww:actionerror/>
<div id="contentArea"> <div id="contentArea">
<h2>Delete Repository</h2> <h2>Delete Repository</h2>

View File

@ -29,13 +29,15 @@
<h1>Admin: Edit Repository</h1> <h1>Admin: Edit Repository</h1>
<ww:actionerror/>
<div id="contentArea"> <div id="contentArea">
<h2>Edit Repository</h2> <h2>Edit Repository</h2>
<ww:actionmessage/> <ww:actionmessage/>
<ww:form method="post" action="saveRepository" namespace="/admin" validate="false"> <ww:form method="post" action="saveRepository" namespace="/admin" validate="false">
<ww:hidden name="mode" value="edit"/> <ww:hidden name="mode" value="edit"/>
<ww:hidden name="repository.id"/> <ww:hidden name="repository.id"/>
<%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %> <%@ include file="/WEB-INF/jsp/admin/include/repositoryForm.jspf" %>
<ww:submit value="Update Repository"/> <ww:submit value="Update Repository"/>