preserve stack trace

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1374660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-18 21:33:10 +00:00
parent 62b8b1854d
commit 01c3aee959
3 changed files with 16 additions and 17 deletions

View 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

View 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 );
}
}

View 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() )