public class RepositoryAdminException
extends Exception
{
+
+ /**
+ * can return the field name of bean with issue
+ * can be <code>null</code>
+ * @since 1.4-M3
+ */
+ private String fieldName;
+
public RepositoryAdminException( String s )
{
super( s );
}
+ public RepositoryAdminException( String s, String fieldName )
+ {
+ this( s );
+ this.fieldName = fieldName;
+ }
+
public RepositoryAdminException( String message, Throwable cause )
{
super( message, cause );
}
+
+ public RepositoryAdminException( String message, Throwable cause, String fieldName )
+ {
+ super( message, cause );
+ this.fieldName = fieldName;
+ }
+
+ public String getFieldName()
+ {
+ return fieldName;
+ }
+
+ public void setFieldName( String fieldName )
+ {
+ this.fieldName = fieldName;
+ }
}
if ( !validator.validate( cronExpression ) )
{
- throw new RepositoryAdminException( "Invalid cron expression." );
+ throw new RepositoryAdminException( "Invalid cron expression.", "cronExpression" );
}
}
else
{
throw new RepositoryAdminException(
"Invalid repository location. Directory must only contain alphanumeric characters, equals(=), question-marks(?), "
- + "exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-)." );
+ + "exclamation-points(!), ampersands(&), forward-slashes(/), back-slashes(\\), underscores(_), dots(.), colons(:), tildes(~), and dashes(-).",
+ "location" );
}
}
private String errorKey;
+ /**
+ * can return the field name of bean with issue
+ * can be <code>null</code>
+ *
+ * @since 1.4-M3
+ */
+ private String fieldName;
+
public ArchivaRestServiceException( String message )
{
super( message );
}
+ public ArchivaRestServiceException( String message, String fieldName )
+ {
+ this( message );
+ this.fieldName = fieldName;
+ }
+
public ArchivaRestServiceException( String s, int httpErrorCode )
{
super( s );
this.httpErrorCode = httpErrorCode;
}
+ public ArchivaRestServiceException( String s, int httpErrorCode, String fieldName )
+ {
+ this( s, httpErrorCode );
+ this.fieldName = fieldName;
+ }
+
public int getHttpErrorCode()
{
return httpErrorCode;
{
this.errorKey = errorKey;
}
+
+ public String getFieldName()
+ {
+ return fieldName;
+ }
+
+ public void setFieldName( String fieldName )
+ {
+ this.fieldName = fieldName;
+ }
}
private String errorMessage;
+ /**
+ * can return the field name of bean with issue
+ * can be <code>null</code>
+ *
+ * @since 1.4-M3
+ */
+ private String fieldName;
+
public ArchivaRestError()
{
// no op
{
errorKey = e.getErrorKey();
errorMessage = e.getMessage();
+ fieldName = e.getFieldName();
}
public String getErrorKey()
{
this.errorMessage = errorMessage;
}
+
+ public String getFieldName()
+ {
+ return fieldName;
+ }
+
+ public void setFieldName( String fieldName )
+ {
+ this.fieldName = fieldName;
+ }
}
catch ( RepositoryAdminException e )
{
log.error( e.getMessage(), e );
- throw new ArchivaRestServiceException( e.getMessage() );
+ throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() );
}
}
}
catch ( RepositoryAdminException e )
{
- throw new ArchivaRestServiceException( e.getMessage() );
+ throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() );
}
}
}
catch ( RepositoryAdminException e )
{
- throw new ArchivaRestServiceException( e.getMessage() );
+ throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() );
}
}