]> source.dussan.org Git - archiva.git/commitdiff
preserve stack trace
authorOlivier Lamy <olamy@apache.org>
Mon, 14 May 2012 15:08:37 +0000 (15:08 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 14 May 2012 15:08:37 +0000 (15:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1338243 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaRestServiceException.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSystemStatusService.java

index 895ac14a0df7ccd193aecda180e0b2ad8e8fac3c..e2a426ff53e2ec30a45158ede12f3676fce158b1 100644 (file)
@@ -39,26 +39,26 @@ public class ArchivaRestServiceException
     private String fieldName;
 
 
-    public ArchivaRestServiceException( String message )
+    public ArchivaRestServiceException( String message, Throwable t )
     {
-        super( message );
+        super( message, t );
     }
 
-    public ArchivaRestServiceException( String message, String fieldName )
+    public ArchivaRestServiceException( String message, String fieldName, Throwable t )
     {
-        this( message );
+        this( message, t );
         this.fieldName = fieldName;
     }
 
-    public ArchivaRestServiceException( String s, int httpErrorCode )
+    public ArchivaRestServiceException( String s, int httpErrorCode, Throwable t )
     {
-        super( s );
+        super( s, t );
         this.httpErrorCode = httpErrorCode;
     }
 
-    public ArchivaRestServiceException( String s, int httpErrorCode, String fieldName )
+    public ArchivaRestServiceException( String s, int httpErrorCode, String fieldName, Throwable t )
     {
-        this( s, httpErrorCode );
+        this( s, httpErrorCode, t );
         this.fieldName = fieldName;
     }
 
index 42105afe07d91b02046411ff34275ed4145b9e57..abb4915b7fc07a6053e7ca8613c2978dcd683dca 100644 (file)
@@ -72,7 +72,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -93,7 +93,7 @@ public class DefaultArchivaAdministrationService
         {
             throw new ArchivaRestServiceException(
                 "artifact path reference '" + legacyArtifactPath.getPath() + "' does not match the initial path: '"
-                    + path + "'", Response.Status.BAD_REQUEST.getStatusCode() );
+                    + path + "'", Response.Status.BAD_REQUEST.getStatusCode(), null );
         }
 
         try
@@ -103,7 +103,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -117,7 +117,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -132,7 +132,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -146,7 +146,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -159,7 +159,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -172,7 +172,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -186,7 +186,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -200,7 +200,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -213,7 +213,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -227,7 +227,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -241,7 +241,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -254,7 +254,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -268,7 +268,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -286,7 +286,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -299,7 +299,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -312,7 +312,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -325,7 +325,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -338,7 +338,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -352,7 +352,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -365,7 +365,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -378,7 +378,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -391,7 +391,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -409,7 +409,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -427,7 +427,7 @@ public class DefaultArchivaAdministrationService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 }
index fae29e386eefc480c8664a097f0241b52a66fbf6..aa78a671edf8555a15ca6d577adca32e254aa358 100644 (file)
@@ -115,7 +115,7 @@ public class DefaultBrowseService
         catch ( MetadataResolutionException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         finally
         {
@@ -167,7 +167,7 @@ public class DefaultBrowseService
         catch ( MetadataResolutionException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         finally
         {
@@ -200,7 +200,7 @@ public class DefaultBrowseService
         catch ( MetadataResolutionException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
 
     }
@@ -397,7 +397,7 @@ public class DefaultBrowseService
         catch ( MetadataResolutionException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         finally
         {
@@ -423,7 +423,7 @@ public class DefaultBrowseService
         catch ( DependencyTreeBuilderException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         return treeEntries;
     }
@@ -438,7 +438,7 @@ public class DefaultBrowseService
         catch ( ArchivaSecurityException e )
         {
             throw new ArchivaRestServiceException( "repositories.read.observable.error",
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
     }
 
@@ -462,7 +462,7 @@ public class DefaultBrowseService
         catch ( MetadataResolutionException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         finally
         {
@@ -550,7 +550,7 @@ public class DefaultBrowseService
         {
             log.error( e.getMessage(), e );
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         finally
         {
@@ -598,7 +598,7 @@ public class DefaultBrowseService
         {
             log.error( e.getMessage(), e );
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         finally
         {
@@ -634,19 +634,19 @@ public class DefaultBrowseService
         {
             log.error( e.getMessage(), e );
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         catch ( RepositoryNotFoundException e )
         {
             log.error( e.getMessage(), e );
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         catch ( RepositoryException e )
         {
             log.error( e.getMessage(), e );
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         return Collections.emptyList();
     }
@@ -789,19 +789,13 @@ public class DefaultBrowseService
             if ( !selectedRepos.contains( repositoryId ) )
             {
                 throw new ArchivaRestServiceException( "browse.root.groups.repositoy.denied",
-                                                       Response.Status.FORBIDDEN.getStatusCode() );
+                                                       Response.Status.FORBIDDEN.getStatusCode(), null );
             }
             selectedRepos = Collections.singletonList( repositoryId );
         }
         return selectedRepos;
     }
 
-    private List<String> getSortedList( Set<String> set )
-    {
-        List<String> list = new ArrayList<String>( set );
-        Collections.sort( list );
-        return list;
-    }
 
     private String collapseNamespaces( RepositorySession repositorySession, MetadataResolver metadataResolver,
                                        Collection<String> repoIds, String n )
index 31a777491bb07347e80b8f0d058d5e1caa482c70..424c1f5d64d7780c3075c1ee4976b7b0664826f0 100644 (file)
@@ -18,13 +18,13 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
+import org.apache.archiva.redback.components.scheduler.CronExpressionValidator;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.services.UtilServices;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.CommonServices;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.archiva.redback.components.scheduler.CronExpressionValidator;
-import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
-import org.apache.archiva.redback.rest.api.services.UtilServices;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -168,11 +168,11 @@ public class DefaultCommonServices
         catch ( IOException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         catch ( RedbackServiceException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage(), e.getHttpErrorCode() );
+            throw new ArchivaRestServiceException( e.getMessage(), e.getHttpErrorCode(), e );
         }
     }
 
@@ -188,7 +188,7 @@ public class DefaultCommonServices
         catch ( IOException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
         finally
         {
index b25c5848a5fe8dcb1e1abea10f820c441bfb5213..518311d633f7b4cc3ff5fa07204e6e63d5698bc2 100644 (file)
@@ -72,7 +72,7 @@ public class DefaultManagedRepositoriesService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -102,7 +102,7 @@ public class DefaultManagedRepositoriesService
         catch ( RepositoryAdminException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() );
+            throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e );
         }
     }
 
@@ -119,11 +119,11 @@ public class DefaultManagedRepositoriesService
             {
                 return getManagedRepository( managedRepository.getId() );
             }
-            throw new ArchivaRestServiceException( "fail to created managed Repository" );
+            throw new ArchivaRestServiceException( "fail to created managed Repository", null );
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() );
+            throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e );
         }
     }
 
@@ -141,7 +141,7 @@ public class DefaultManagedRepositoriesService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() );
+            throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e );
         }
     }
 
index 0bae3dcd58c3c6195cae2cf380a463e48945c777..a39e1b35a2f74ff92d926d6bb67c4174e36043bd 100644 (file)
@@ -50,7 +50,7 @@ public class DefaultNetworkProxyService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -63,7 +63,7 @@ public class DefaultNetworkProxyService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -80,7 +80,7 @@ public class DefaultNetworkProxyService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -97,7 +97,7 @@ public class DefaultNetworkProxyService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -111,7 +111,7 @@ public class DefaultNetworkProxyService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
index 2573c7aa72a87d0c2d20e6911738d9e939579f7c..aa1a7bdea6fd442678dc088beff3a8ed3d9945e2 100644 (file)
@@ -62,7 +62,7 @@ public class DefaultProxyConnectorService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -75,7 +75,7 @@ public class DefaultProxyConnectorService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -92,7 +92,7 @@ public class DefaultProxyConnectorService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -109,7 +109,7 @@ public class DefaultProxyConnectorService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -121,7 +121,7 @@ public class DefaultProxyConnectorService
         {
             throw new ArchivaRestServiceException(
                 "proxyConnector with sourceRepoId:" + sourceRepoId + " and targetRepoId:" + targetRepoId
-                    + " not exists" );
+                    + " not exists", null );
         }
         return deleteProxyConnector( proxyConnector );
     }
@@ -139,7 +139,7 @@ public class DefaultProxyConnectorService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
index f3781787d3b4c7cb357666fe50019a5a81c7d506..9d00972aa59ca20c92e3b588a26739ed681ef2e4 100644 (file)
@@ -53,7 +53,7 @@ public class DefaultRemoteRepositoriesService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
index d39bc78ce080f045bb6f862b2e0629daa6bddf41..e1d6bc6138564b730af179ccc04195d8d548e6dc 100644 (file)
@@ -40,6 +40,12 @@ import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.model.ArchivaRepositoryMetadata;
 import org.apache.archiva.model.ArtifactReference;
 import org.apache.archiva.model.VersionedReference;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authorization.AuthorizationException;
+import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
+import org.apache.archiva.redback.system.DefaultSecuritySession;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
 import org.apache.archiva.redback.users.User;
 import org.apache.archiva.redback.users.UserNotFoundException;
 import org.apache.archiva.repository.ContentNotFoundException;
@@ -72,12 +78,6 @@ import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.index.context.IndexingContext;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.authorization.AuthorizationException;
-import org.apache.archiva.redback.system.DefaultSecuritySession;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -219,7 +219,7 @@ public class DefaultRepositoriesService
         catch ( Exception e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -233,7 +233,7 @@ public class DefaultRepositoriesService
         catch ( DownloadRemoteIndexException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
         return Boolean.TRUE;
     }
@@ -245,17 +245,17 @@ public class DefaultRepositoriesService
         String userName = getAuditInformation().getUser().getUsername();
         if ( StringUtils.isBlank( userName ) )
         {
-            throw new ArchivaRestServiceException( "copyArtifact call: userName not found" );
+            throw new ArchivaRestServiceException( "copyArtifact call: userName not found", null );
         }
 
         if ( StringUtils.isBlank( artifactTransferRequest.getRepositoryId() ) )
         {
-            throw new ArchivaRestServiceException( "copyArtifact call: sourceRepositoryId cannot be null" );
+            throw new ArchivaRestServiceException( "copyArtifact call: sourceRepositoryId cannot be null", null );
         }
 
         if ( StringUtils.isBlank( artifactTransferRequest.getTargetRepositoryId() ) )
         {
-            throw new ArchivaRestServiceException( "copyArtifact call: targetRepositoryId cannot be null" );
+            throw new ArchivaRestServiceException( "copyArtifact call: targetRepositoryId cannot be null", null );
         }
 
         ManagedRepository source = null;
@@ -265,13 +265,13 @@ public class DefaultRepositoriesService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
 
         if ( source == null )
         {
             throw new ArchivaRestServiceException(
-                "cannot find repository with id " + artifactTransferRequest.getRepositoryId() );
+                "cannot find repository with id " + artifactTransferRequest.getRepositoryId(), null );
         }
 
         ManagedRepository target = null;
@@ -281,33 +281,33 @@ public class DefaultRepositoriesService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
 
         if ( target == null )
         {
             throw new ArchivaRestServiceException(
-                "cannot find repository with id " + artifactTransferRequest.getTargetRepositoryId() );
+                "cannot find repository with id " + artifactTransferRequest.getTargetRepositoryId(), null );
         }
 
         if ( StringUtils.isBlank( artifactTransferRequest.getGroupId() ) )
         {
-            throw new ArchivaRestServiceException( "groupId is mandatory" );
+            throw new ArchivaRestServiceException( "groupId is mandatory", null );
         }
 
         if ( StringUtils.isBlank( artifactTransferRequest.getArtifactId() ) )
         {
-            throw new ArchivaRestServiceException( "artifactId is mandatory" );
+            throw new ArchivaRestServiceException( "artifactId is mandatory", null );
         }
 
         if ( StringUtils.isBlank( artifactTransferRequest.getVersion() ) )
         {
-            throw new ArchivaRestServiceException( "version is mandatory" );
+            throw new ArchivaRestServiceException( "version is mandatory", null );
         }
 
         if ( VersionUtil.isSnapshot( artifactTransferRequest.getVersion() ) )
         {
-            throw new ArchivaRestServiceException( "copy of SNAPSHOT not supported" );
+            throw new ArchivaRestServiceException( "copy of SNAPSHOT not supported", null );
         }
 
         // end check parameters
@@ -319,7 +319,7 @@ public class DefaultRepositoriesService
         }
         catch ( UserNotFoundException e )
         {
-            throw new ArchivaRestServiceException( "user " + userName + " not found" );
+            throw new ArchivaRestServiceException( "user " + userName + " not found", null );
         }
 
         // check karma on source : read
@@ -333,13 +333,13 @@ public class DefaultRepositoriesService
             if ( !authz )
             {
                 throw new ArchivaRestServiceException(
-                    "not authorized to access repo:" + artifactTransferRequest.getRepositoryId() );
+                    "not authorized to access repo:" + artifactTransferRequest.getRepositoryId(), null );
             }
         }
         catch ( AuthorizationException e )
         {
             log.error( "error reading permission: " + e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
 
         // check karma on target: write
@@ -351,13 +351,13 @@ public class DefaultRepositoriesService
             if ( !authz )
             {
                 throw new ArchivaRestServiceException(
-                    "not authorized to write to repo:" + artifactTransferRequest.getTargetRepositoryId() );
+                    "not authorized to write to repo:" + artifactTransferRequest.getTargetRepositoryId(), null );
             }
         }
         catch ( AuthorizationException e )
         {
             log.error( "error reading permission: " + e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
 
         // sounds good we can continue !
@@ -381,7 +381,8 @@ public class DefaultRepositoriesService
             if ( StringUtils.isEmpty( artifactSourcePath ) )
             {
                 log.error( "cannot find artifact " + artifactTransferRequest.toString() );
-                throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString() );
+                throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString(),
+                                                       null );
             }
 
             File artifactFile = new File( source.getLocation(), artifactSourcePath );
@@ -389,7 +390,8 @@ public class DefaultRepositoriesService
             if ( !artifactFile.exists() )
             {
                 log.error( "cannot find artifact " + artifactTransferRequest.toString() );
-                throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString() );
+                throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString(),
+                                                       null );
             }
 
             ManagedRepositoryContent targetRepository =
@@ -426,7 +428,7 @@ public class DefaultRepositoriesService
             {
                 throw new ArchivaRestServiceException(
                     "artifact already exists in target repo: " + artifactTransferRequest.getTargetRepositoryId()
-                        + " and redeployment blocked" );
+                        + " and redeployment blocked", null );
             }
             else
             {
@@ -472,17 +474,17 @@ public class DefaultRepositoriesService
         catch ( RepositoryException e )
         {
             log.error( "RepositoryException: " + e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
         catch ( RepositoryAdminException e )
         {
             log.error( "RepositoryAdminException: " + e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
         catch ( IOException e )
         {
             log.error( "IOException: " + e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
         return true;
     }
@@ -627,27 +629,27 @@ public class DefaultRepositoriesService
 
         if ( StringUtils.isEmpty( repositoryId ) )
         {
-            throw new ArchivaRestServiceException( "repositoryId cannot be null", 400 );
+            throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
         }
 
         if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
         {
-            throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403 );
+            throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
         }
 
         if ( artifact == null )
         {
-            throw new ArchivaRestServiceException( "artifact cannot be null", 400 );
+            throw new ArchivaRestServiceException( "artifact cannot be null", 400, null );
         }
 
         if ( StringUtils.isEmpty( artifact.getGroupId() ) )
         {
-            throw new ArchivaRestServiceException( "artifact.groupId cannot be null", 400 );
+            throw new ArchivaRestServiceException( "artifact.groupId cannot be null", 400, null );
         }
 
         if ( StringUtils.isEmpty( artifact.getArtifactId() ) )
         {
-            throw new ArchivaRestServiceException( "artifact.artifactId cannot be null", 400 );
+            throw new ArchivaRestServiceException( "artifact.artifactId cannot be null", 400, null );
         }
 
         // TODO more control on artifact fields
@@ -674,7 +676,7 @@ public class DefaultRepositoriesService
                 if ( StringUtils.isBlank( artifact.getPackaging() ) )
                 {
                     throw new ArchivaRestServiceException( "You must configure a type/packaging when using classifier",
-                                                           400 );
+                                                           400, null );
                 }
                 ArtifactReference artifactReference = new ArtifactReference();
                 artifactReference.setArtifactId( artifact.getArtifactId() );
@@ -740,27 +742,27 @@ public class DefaultRepositoriesService
 
         catch ( ContentNotFoundException e )
         {
-            throw new ArchivaRestServiceException( "Artifact does not exist: " + e.getMessage(), 400 );
+            throw new ArchivaRestServiceException( "Artifact does not exist: " + e.getMessage(), 400, e );
         }
         catch ( RepositoryNotFoundException e )
         {
-            throw new ArchivaRestServiceException( "Target repository cannot be found: " + e.getMessage(), 400 );
+            throw new ArchivaRestServiceException( "Target repository cannot be found: " + e.getMessage(), 400, e );
         }
         catch ( RepositoryException e )
         {
-            throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500 );
+            throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500, e );
         }
         catch ( MetadataResolutionException e )
         {
-            throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500 );
+            throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500, e );
         }
         catch ( MetadataRepositoryException e )
         {
-            throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500 );
+            throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500, e );
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( "RepositoryAdmin exception: " + e.getMessage(), 500 );
+            throw new ArchivaRestServiceException( "RepositoryAdmin exception: " + e.getMessage(), 500, e );
         }
         finally
 
@@ -784,7 +786,7 @@ public class DefaultRepositoriesService
         catch ( ArchivaSecurityException e )
         {
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
     }
 
@@ -799,12 +801,12 @@ public class DefaultRepositoriesService
         catch ( RepositoryScannerException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500 );
+            throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500, e );
         }
         catch ( RepositoryAdminException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500 );
+            throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500, e );
         }
     }
 
index f4f7f492253c5d57045341039e5e874edb36f555..3549d63bca59bf6e822c2c9d6004cd0895130fa3 100644 (file)
@@ -58,7 +58,7 @@ public class DefaultRepositoryGroupService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -86,7 +86,7 @@ public class DefaultRepositoryGroupService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -101,7 +101,7 @@ public class DefaultRepositoryGroupService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -114,7 +114,7 @@ public class DefaultRepositoryGroupService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -127,7 +127,7 @@ public class DefaultRepositoryGroupService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -141,7 +141,7 @@ public class DefaultRepositoryGroupService
         }
         catch ( RepositoryAdminException e )
         {
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 }
index 6cfb749e73088e7b18a23727843f074b2933faeb..863e76c1212fe1a8d908a9749a5d44fd4d9ece5c 100644 (file)
@@ -74,7 +74,7 @@ public class DefaultSearchService
         catch ( RepositorySearchException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -102,7 +102,7 @@ public class DefaultSearchService
         catch ( RepositorySearchException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -127,7 +127,7 @@ public class DefaultSearchService
         catch ( RepositorySearchException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -155,7 +155,7 @@ public class DefaultSearchService
         catch ( RepositorySearchException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
     }
 
@@ -175,7 +175,7 @@ public class DefaultSearchService
         catch ( RepositorySearchException e )
         {
             log.error( e.getMessage(), e );
-            throw new ArchivaRestServiceException( e.getMessage() );
+            throw new ArchivaRestServiceException( e.getMessage(), e );
         }
 
     }
index d9e6676aa861eaa1fc557c4129a31c8a822537bc..e4f78b1113794f8171079a0e62a5f75b8b0f1086 100644 (file)
@@ -19,6 +19,9 @@ package org.apache.archiva.rest.services;
  */
 
 import org.apache.archiva.redback.components.cache.Cache;
+import org.apache.archiva.redback.components.cache.CacheStatistics;
+import org.apache.archiva.redback.components.taskqueue.TaskQueue;
+import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
 import org.apache.archiva.repository.scanner.RepositoryScanner;
 import org.apache.archiva.repository.scanner.RepositoryScannerInstance;
 import org.apache.archiva.rest.api.model.CacheEntry;
@@ -28,9 +31,6 @@ import org.apache.archiva.rest.api.model.RepositoryScannerStatistics;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.SystemStatusService;
 import org.apache.archiva.rest.services.utils.ConsumerScanningStatisticsComparator;
-import org.apache.archiva.redback.components.cache.CacheStatistics;
-import org.apache.archiva.redback.components.taskqueue.TaskQueue;
-import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
 
@@ -114,7 +114,7 @@ public class DefaultSystemStatusService
         {
             log.error( e.getMessage(), e );
             throw new ArchivaRestServiceException( e.getMessage(),
-                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() );
+                                                   Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
         }
     }
 
@@ -142,7 +142,7 @@ public class DefaultSystemStatusService
         if ( cache == null )
         {
             throw new ArchivaRestServiceException( "no cache for key: " + cacheKey,
-                                                   Response.Status.BAD_REQUEST.getStatusCode() );
+                                                   Response.Status.BAD_REQUEST.getStatusCode(), null );
         }
 
         cache.clear();