]> source.dussan.org Git - archiva.git/commitdiff
preserve stack trace
authorOlivier Lamy <olamy@apache.org>
Sat, 18 Aug 2012 21:33:10 +0000 (21:33 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 18 Aug 2012 21:33:10 +0000 (21:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1374660 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/ArchivaServletAuthenticator.java
archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/archiva/security/DefaultUserRepositories.java

index 99dc202b900cb92a4054247044ff59e42e8b1435..4bfe578c42a9c3c025ce8dffbefc3a5a49ba4358 100644 (file)
@@ -318,7 +318,7 @@ public class DefaultRepositoriesService
         }
         catch ( UserNotFoundException e )
         {
-            throw new ArchivaRestServiceException( "user " + userName + " not found", null );
+            throw new ArchivaRestServiceException( "user " + userName + " not found", e );
         }
 
         // check karma on source : read
index 01c1087cda29df090e1d7160bbb3a00f55cf2ee4..74e4567bc9d676561939c85799504c68ea6b6d25 100644 (file)
@@ -19,9 +19,6 @@ package org.apache.archiva.security;
  * under the License.
  */
 
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.archiva.redback.authentication.AuthenticationException;
 import org.apache.archiva.redback.authentication.AuthenticationResult;
 import org.apache.archiva.redback.authorization.AuthorizationException;
@@ -38,10 +35,13 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+
 /**
  *
  */
-@Service("servletAuthenticator")
+@Service( "servletAuthenticator" )
 public class ArchivaServletAuthenticator
     implements ServletAuthenticator
 {
@@ -76,8 +76,8 @@ public class ArchivaServletAuthenticator
         {
             if ( authzResult.getException() != null )
             {
-                log.info( "Authorization Denied [ip=" + request.getRemoteAddr() + ",permission=" + permission
-                    + ",repo=" + repositoryId + "] : " + authzResult.getException().getMessage() );
+                log.info( "Authorization Denied [ip=" + request.getRemoteAddr() + ",permission=" + permission + ",repo="
+                              + repositoryId + "] : " + authzResult.getException().getMessage() );
 
                 throw new UnauthorizedException( "Access denied for repository " + repositoryId );
             }
@@ -95,7 +95,8 @@ public class ArchivaServletAuthenticator
             User user = securitySystem.getUserManager().findUser( principal );
             if ( user == null )
             {
-                throw new UnauthorizedException( "The security system had an internal error - please check your system logs" );
+                throw new UnauthorizedException(
+                    "The security system had an internal error - please check your system logs" );
             }
             if ( user.isLocked() )
             {
@@ -109,11 +110,11 @@ public class ArchivaServletAuthenticator
         }
         catch ( UserNotFoundException e )
         {
-            throw new UnauthorizedException( e.getMessage() );
+            throw new UnauthorizedException( e.getMessage(), e );
         }
         catch ( AuthorizationException e )
         {
-            throw new UnauthorizedException( e.getMessage() );
+            throw new UnauthorizedException( e.getMessage(), e );
         }
     }
 
index 2f50d3350297423d3d009e9237694ea89f22ecc6..1d6d3fb96550e7748e77d6375ced7ff07b07e25a 100644 (file)
@@ -23,9 +23,6 @@ import com.google.common.collect.Lists;
 import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
 import org.apache.archiva.redback.authentication.AuthenticationResult;
 import org.apache.archiva.redback.authorization.AuthorizationException;
 import org.apache.archiva.redback.role.RoleManager;
@@ -33,6 +30,9 @@ import org.apache.archiva.redback.role.RoleManagerException;
 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.security.common.ArchivaRoleConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -43,10 +43,8 @@ import java.util.List;
 
 /**
  * DefaultUserRepositories
- *
- *
  */
-@Service( "userRepositories" )
+@Service("userRepositories")
 public class DefaultUserRepositories
     implements UserRepositories
 {
@@ -153,7 +151,7 @@ public class DefaultUserRepositories
         }
         catch ( UserNotFoundException e )
         {
-            throw new PrincipalNotFoundException( "Unable to find principal " + principal + "" );
+            throw new PrincipalNotFoundException( "Unable to find principal " + principal + "", e );
         }
 
         if ( user.isLocked() )