cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1566780 [2/2] - in /cxf/trunk/rt: frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/ frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/ frontend/jaxrs/src/main/ja...
Date Mon, 10 Feb 2014 22:43:46 GMT
Modified: cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java (original)
+++ cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java Mon Feb 10 22:43:44 2014
@@ -26,8 +26,6 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.NotAcceptableException;
-import javax.ws.rs.NotSupportedException;
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
@@ -38,6 +36,7 @@ import javax.ws.rs.ext.MessageBodyWriter
 import javax.ws.rs.ext.Providers;
 
 import org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.staxutils.StaxUtils;
 
 @Produces({"application/xml", "application/*+xml", "text/xml", "application/json", "application/*+json" })
@@ -67,7 +66,7 @@ public class DOM4JProvider extends Abstr
         MessageBodyReader<org.w3c.dom.Document> reader =
             providers.getMessageBodyReader(DOM_DOC_CLS, DOM_DOC_CLS, anns, mt);
         if (reader == null) {
-            throw new NotSupportedException();
+            throw ExceptionUtils.toNotSupportedException(null, null);
         }
         org.w3c.dom.Document domDoc =
             reader.readFrom(DOM_DOC_CLS, DOM_DOC_CLS, anns, mt, headers, is);
@@ -98,7 +97,7 @@ public class DOM4JProvider extends Abstr
             MessageBodyWriter<org.w3c.dom.Document> writer =
                 providers.getMessageBodyWriter(DOM_DOC_CLS, DOM_DOC_CLS, anns, mt);
             if (writer == null) {
-                throw new NotAcceptableException();
+                throw ExceptionUtils.toNotAcceptableException(null, null);
             }
             writer.writeTo(domDoc, DOM_DOC_CLS, DOM_DOC_CLS, anns, mt, headers, os);
         }
@@ -109,7 +108,7 @@ public class DOM4JProvider extends Abstr
         try {
             return StaxUtils.read(new StringReader(xml));
         } catch (Exception ex) {
-            throw new javax.ws.rs.InternalServerErrorException(ex);
+            throw ExceptionUtils.toInternalServerErrorException(ex, null);
         }
     }
 }

Modified: cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java (original)
+++ cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java Mon Feb 10 22:43:44 2014
@@ -39,9 +39,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
@@ -68,6 +66,7 @@ import org.apache.cxf.jaxrs.ext.Nullable
 import org.apache.cxf.jaxrs.provider.AbstractJAXBProvider;
 import org.apache.cxf.jaxrs.provider.json.utils.JSONUtils;
 import org.apache.cxf.jaxrs.utils.AnnotationUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXBUtils;
@@ -260,12 +259,12 @@ public class JSONProvider<T> extends Abs
         } catch (WebApplicationException e) {
             throw e;
         } catch (Exception e) {
-            throw new BadRequestException(e);
+            throw ExceptionUtils.toBadRequestException(e, null);
         } finally {
             try {
                 StaxUtils.close(reader);
             } catch (XMLStreamException e) {
-                throw new BadRequestException(e);
+                throw ExceptionUtils.toBadRequestException(e, null);
             }
         }
         // unreachable
@@ -340,7 +339,7 @@ public class JSONProvider<T> extends Abs
         }
         
         if (name == null) {
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         
         return "{\"" + name + "\":";
@@ -391,7 +390,7 @@ public class JSONProvider<T> extends Abs
         } catch (XMLStreamException e) {
             handleXMLStreamException(e, false);
         } catch (Exception e) {
-            throw new InternalServerErrorException(e);
+            throw ExceptionUtils.toInternalServerErrorException(e, null);
         } finally {
             StaxUtils.close(writer);
         }

Modified: cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansElementProvider.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansElementProvider.java (original)
+++ cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansElementProvider.java Mon Feb 10 22:43:44 2014
@@ -29,7 +29,6 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -39,6 +38,7 @@ import javax.ws.rs.ext.Provider;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.xmlbeans.XmlObject;
 
 /**
@@ -113,11 +113,11 @@ public class XMLBeansElementProvider ext
             }
 
         } catch (NoSuchMethodException nsme) {
-            throw new InternalServerErrorException(nsme);
+            throw ExceptionUtils.toInternalServerErrorException(nsme, null);
         } catch (InvocationTargetException ite) {
-            throw new InternalServerErrorException(ite);
+            throw ExceptionUtils.toInternalServerErrorException(ite, null);
         } catch (IllegalAccessException iae) {
-            throw new InternalServerErrorException(iae);
+            throw ExceptionUtils.toInternalServerErrorException(iae, null);
         }
 
         return result;

Modified: cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansJSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansJSONProvider.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansJSONProvider.java (original)
+++ cxf/trunk/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansJSONProvider.java Mon Feb 10 22:43:44 2014
@@ -28,9 +28,7 @@ import java.lang.reflect.Type;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -40,6 +38,7 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.xmlbeans.XmlObject;
 import org.codehaus.jettison.mapped.MappedXMLInputFactory;
 import org.codehaus.jettison.mapped.MappedXMLOutputFactory;
@@ -72,7 +71,7 @@ public class XMLBeansJSONProvider extend
             xsr.close();
 
         } catch (XMLStreamException e) {
-            throw new BadRequestException(e);
+            throw ExceptionUtils.toBadRequestException(e, null);
         }
 
         return result;
@@ -101,9 +100,9 @@ public class XMLBeansJSONProvider extend
             xsw.close();
 
         } catch (XMLStreamException e) {
-            throw new InternalServerErrorException(e);
+            throw ExceptionUtils.toInternalServerErrorException(e, null);
         } catch (IOException ioe) {
-            throw new InternalServerErrorException(ioe);
+            throw ExceptionUtils.toInternalServerErrorException(ioe, null);
         }
     }
 }

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java Mon Feb 10 22:43:44 2014
@@ -36,7 +36,6 @@ import java.util.logging.Logger;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 
@@ -47,6 +46,7 @@ import net.oauth.OAuthProblemException;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth.data.AuthorizationInput;
 import org.apache.cxf.rs.security.oauth.data.OAuthAuthorizationData;
 import org.apache.cxf.rs.security.oauth.data.OAuthPermission;
@@ -88,7 +88,7 @@ public class AuthorizationRequestHandler
                 if (decision != null) {
                     // this is a user decision request, the session has expired or been possibly hijacked
                     LOG.warning("Session authenticity token is missing or invalid");
-                    throw new BadRequestException();
+                    throw ExceptionUtils.toBadRequestException(null, null);
                 }
                 // assume it is an initial authorization request
                 addAuthenticityTokenToSession(secData, request);

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java Mon Feb 10 22:43:44 2014
@@ -22,7 +22,6 @@ package org.apache.cxf.rs.security.oauth
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MultivaluedMap;
@@ -32,6 +31,7 @@ import org.w3c.dom.Element;
 
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.jaxrs.provider.FormEncodingProvider;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.FormUtils;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
@@ -63,7 +63,7 @@ public class Saml2BearerAuthHandler exte
         String assertionType = formData.getFirst(Constants.CLIENT_AUTH_ASSERTION_TYPE);
         String decodedAssertionType = assertionType != null ? HttpUtils.urlDecode(assertionType) : null;
         if (decodedAssertionType == null || !Constants.CLIENT_AUTH_SAML2_BEARER.equals(decodedAssertionType)) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
         String assertion = formData.getFirst(Constants.CLIENT_AUTH_ASSERTION_PARAM);
         
@@ -80,7 +80,7 @@ public class Saml2BearerAuthHandler exte
         try {
             FormUtils.restoreForm(provider, form, message);
         } catch (Exception ex) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
     }
     
@@ -88,20 +88,20 @@ public class Saml2BearerAuthHandler exte
         try {
             return FormUtils.readForm(provider, message);
         } catch (Exception ex) {
-            throw new NotAuthorizedException(errorResponse());    
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());    
         }
     }
     
     protected Element readToken(Message message, String assertion) {
         if (assertion == null) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
         try {
             byte[] deflatedToken = Base64UrlUtility.decode(assertion);
             InputStream is = new ByteArrayInputStream(deflatedToken); 
             return readToken(message, is); 
         } catch (Base64Exception ex) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }         
     }
     
@@ -116,12 +116,12 @@ public class Saml2BearerAuthHandler exte
         // Introduce SAMLOAuth2Validator to be reused between auth and grant handlers
         Subject subject = SAMLUtils.getSubject(message, wrapper);
         if (subject.getName() == null) {
-            throw new NotAuthorizedException(errorResponse());  
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());  
         }
         
         if (clientId != null && !clientId.equals(subject.getName())) {
             //TODO:  Attempt to map client_id to subject.getName()
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
         samlOAuthValidator.validate(message, wrapper);
         message.put(OAuthConstants.CLIENT_ID, subject.getName());

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/saml/SamlOAuthValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/saml/SamlOAuthValidator.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/saml/SamlOAuthValidator.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/saml/SamlOAuthValidator.java Mon Feb 10 22:43:44 2014
@@ -21,11 +21,11 @@ package org.apache.cxf.rs.security.oauth
 
 import java.util.List;
 
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 
 import org.apache.cxf.jaxrs.impl.UriInfoImpl;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.apache.wss4j.common.saml.SamlAssertionWrapper;
@@ -72,11 +72,11 @@ public class SamlOAuthValidator {
             String expectedIssuer = OAuthConstants.CLIENT_ID.equals(issuer) 
                 ? wrapper.getSaml2().getSubject().getNameID().getValue() : issuer;
             if (actualIssuer == null || !actualIssuer.equals(expectedIssuer)) {
-                throw new NotAuthorizedException(errorResponse());
+                throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
             }
         }
         if (!validateAuthenticationSubject(message, cs, wrapper.getSaml2().getSubject())) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
     }
     
@@ -97,7 +97,7 @@ public class SamlOAuthValidator {
                 }
             }
         }
-        throw new NotAuthorizedException(errorResponse());
+        throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
     }
     
     private String getAbsoluteTargetAddress(Message m) {
@@ -142,19 +142,19 @@ public class SamlOAuthValidator {
                 && cs.getNotOnOrAfter() != null && !cs.getNotOnOrAfter().isBeforeNow()) {
                 return;
             }
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
           
         // Recipient must match assertion consumer URL
         String recipient = subjectConfData.getRecipient();
         if (recipient == null || !recipient.equals(getAbsoluteTargetAddress(m))) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
           
         // We must have a NotOnOrAfter timestamp
         if (subjectConfData.getNotOnOrAfter() == null
             || subjectConfData.getNotOnOrAfter().isBeforeNow()) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
           
         //TODO: replay cache, same as with SAML SSO case
@@ -162,7 +162,7 @@ public class SamlOAuthValidator {
         // Check address
         if (subjectConfData.getAddress() != null
             && (clientAddress == null || !subjectConfData.getAddress().equals(clientAddress))) {
-            throw new NotAuthorizedException(errorResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, errorResponse());
         }
           
           

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java Mon Feb 10 22:43:44 2014
@@ -24,11 +24,11 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.core.Context;
 
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.jaxrs.ext.MessageContextImpl;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.rs.security.oauth2.common.AccessTokenValidation;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
@@ -95,7 +95,7 @@ public abstract class AbstractAccessToke
     protected AccessTokenValidation getAccessTokenValidation() {
         AccessTokenValidation accessTokenV = null;
         if (dataProvider == null && tokenHandlers.isEmpty()) {
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         
         // Get the scheme and its data, Bearer only is supported by default

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java Mon Feb 10 22:43:44 2014
@@ -20,7 +20,6 @@ package org.apache.cxf.rs.security.oauth
 
 import java.util.logging.Logger;
 
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -29,6 +28,7 @@ import javax.ws.rs.core.Response.Respons
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthError;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthDataProvider;
@@ -102,7 +102,7 @@ public abstract class AbstractOAuthServi
         if (!mc.getSecurityContext().isSecure()) {
             LOG.warning("Unsecure HTTP, Transport Layer Security is recommended");
             if (blockUnsecureRequests) {
-                throw new BadRequestException();    
+                throw ExceptionUtils.toBadRequestException(null, null);    
             }
         }
     }
@@ -126,7 +126,7 @@ public abstract class AbstractOAuthServi
         if (mt != null) {
             rb.type(mt);
         }
-        throw new BadRequestException(rb.entity(entity).build());
+        throw ExceptionUtils.toBadRequestException(null, rb.entity(entity).build());
     }
 
     /**

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractTokenService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractTokenService.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractTokenService.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractTokenService.java Mon Feb 10 22:43:44 2014
@@ -21,13 +21,13 @@ package org.apache.cxf.rs.security.oauth
 
 import java.security.Principal;
 
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.core.SecurityContext;
 
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthError;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
@@ -97,7 +97,7 @@ public class AbstractTokenService extend
         if (clientSecret == null || client.getClientSecret() == null 
             || !client.getClientId().equals(clientId) 
             || !client.getClientSecret().equals(clientSecret)) {
-            throw new NotAuthorizedException(Response.status(401).build());
+            throw ExceptionUtils.toNotAuthorizedException(null, Response.status(401).build());
         }
         return client;
     }
@@ -152,7 +152,8 @@ public class AbstractTokenService extend
     
     protected void reportInvalidClient(OAuthError error) {
         ResponseBuilder rb = Response.status(401);
-        throw new NotAuthorizedException(rb.type(MediaType.APPLICATION_JSON_TYPE).entity(error).build());
+        throw ExceptionUtils.toNotAuthorizedException(null, 
+            rb.type(MediaType.APPLICATION_JSON_TYPE).entity(error).build());
     }
     
     public void setCanSupportPublicClients(boolean support) {

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java Mon Feb 10 22:43:44 2014
@@ -26,10 +26,8 @@ import java.util.Map;
 import java.util.UUID;
 
 import javax.servlet.http.HttpSession;
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
@@ -37,6 +35,7 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
@@ -218,7 +217,7 @@ public abstract class RedirectionBasedGr
         
         // Make sure the session is valid
         if (!compareRequestAndSessionTokens(params.getFirst(OAuthConstants.SESSION_AUTHENTICITY_TOKEN))) {
-            throw new BadRequestException();     
+            throw ExceptionUtils.toBadRequestException(null, null);     
         }
         //TODO: additionally we can check that the Principal that got authenticated
         // in startAuthorization is the same that got authenticated in completeAuthorization
@@ -303,7 +302,7 @@ public abstract class RedirectionBasedGr
         SecurityContext securityContext =  
             (SecurityContext)getMessageContext().get(SecurityContext.class.getName());
         if (securityContext == null || securityContext.getUserPrincipal() == null) {
-            throw new NotAuthorizedException(Response.status(401).build());
+            throw ExceptionUtils.toNotAuthorizedException(null, Response.status(401).build());
         }
         checkTransportSecurity();
         return securityContext;

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/AuthorizationUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/AuthorizationUtils.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/AuthorizationUtils.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/AuthorizationUtils.java Mon Feb 10 22:43:44 2014
@@ -23,13 +23,13 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 
 /**
  * Authorization helpers
@@ -43,13 +43,13 @@ public final class AuthorizationUtils {
         try {
             authDecoded = new String(Base64Utility.decode(data));
         } catch (Exception ex) {
-            throw new NotAuthorizedException(ex);
+            throw ExceptionUtils.toNotAuthorizedException(ex, null);
         }
         String authInfo[] = authDecoded.split(":");
         if (authInfo.length == 2) {
             return authInfo;
         }
-        throw new NotAuthorizedException(Response.status(401).build());
+        throw ExceptionUtils.toNotAuthorizedException(null, Response.status(401).build());
     }
     
     public static String[] getAuthorizationParts(MessageContext mc) {
@@ -93,7 +93,7 @@ public final class AuthorizationUtils {
             rb.header(HttpHeaders.WWW_AUTHENTICATE, sb.toString());
         }
         Response r = rb.build();
-        throw new NotAuthorizedException(r);
+        throw ExceptionUtils.toNotAuthorizedException(null, r);
     }
 
 }

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java (original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java Mon Feb 10 22:43:44 2014
@@ -20,12 +20,12 @@ package org.apache.cxf.rs.security.oauth
 
 import java.util.List;
 
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.common.OAuthContext;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
 
@@ -136,7 +136,7 @@ public final class OAuthContextUtils {
     public static OAuthContext getContext(final MessageContext mc) {
         final OAuthContext oauth = mc.getContent(OAuthContext.class);
         if ((oauth == null) || (oauth.getSubject() == null) || (oauth.getSubject().getLogin() == null)) {
-            throw new NotAuthorizedException(Response.status(401).build());
+            throw ExceptionUtils.toNotAuthorizedException(null, Response.status(401).build());
         }
         return oauth;
     }

Modified: cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java (original)
+++ cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java Mon Feb 10 22:43:44 2014
@@ -30,7 +30,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.annotation.PreDestroy;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Cookie;
@@ -46,6 +45,7 @@ import org.apache.cxf.common.security.Si
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxrs.impl.HttpHeadersImpl;
 import org.apache.cxf.jaxrs.impl.UriInfoImpl;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.saml.SAMLUtils;
 import org.apache.cxf.rs.security.saml.assertion.Subject;
@@ -283,7 +283,7 @@ public abstract class AbstractServicePro
             //TODO: Review the possibility of using this filter
             //for validating SAMLResponse too
             reportError("MISSING_ASSERTION_SERVICE_URL");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         if (!assertionConsumerServiceAddress.startsWith("http")) {
             String httpBasePath = (String)m.get("http.base.path");

Modified: cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/RequestAssertionConsumerService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/RequestAssertionConsumerService.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/RequestAssertionConsumerService.java (original)
+++ cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/RequestAssertionConsumerService.java Mon Feb 10 22:43:44 2014
@@ -32,7 +32,6 @@ import java.util.logging.Logger;
 import java.util.zip.DataFormatException;
 
 import javax.annotation.PreDestroy;
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.FormParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
@@ -53,6 +52,7 @@ import org.apache.cxf.common.util.Base64
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.saml.DeflateEncoderDecoder;
 import org.apache.cxf.rs.security.saml.sso.state.RequestState;
 import org.apache.cxf.rs.security.saml.sso.state.ResponseState;
@@ -199,20 +199,20 @@ public class RequestAssertionConsumerSer
     private RequestState processRelayState(String relayState) {
         if (relayState == null) {
             reportError("MISSING_RELAY_STATE");
-            throw new BadRequestException();
+            throw ExceptionUtils.toBadRequestException(null, null);
         }
         if (relayState.getBytes().length < 0 || relayState.getBytes().length > 80) {
             reportError("INVALID_RELAY_STATE");
-            throw new BadRequestException();
+            throw ExceptionUtils.toBadRequestException(null, null);
         }
         RequestState requestState = getStateProvider().removeRequestState(relayState);
         if (requestState == null) {
             reportError("MISSING_REQUEST_STATE");
-            throw new WebApplicationException(400);
+            throw ExceptionUtils.toBadRequestException(null, null);
         }
         if (isStateExpired(requestState.getCreatedAt(), 0)) {
             reportError("EXPIRED_REQUEST_STATE");
-            throw new BadRequestException();
+            throw ExceptionUtils.toBadRequestException(null, null);
         }
         return requestState;
     }
@@ -223,7 +223,7 @@ public class RequestAssertionConsumerSer
     ) {
         if (StringUtils.isEmpty(samlResponse)) {
             reportError("MISSING_SAML_RESPONSE");
-            throw new BadRequestException();
+            throw ExceptionUtils.toBadRequestException(null, null);
         }
         
         String samlResponseDecoded = samlResponse;
@@ -233,7 +233,7 @@ public class RequestAssertionConsumerSer
             try {
                 samlResponseDecoded = URLDecoder.decode(samlResponse, "UTF-8");
             } catch (UnsupportedEncodingException e) {
-                throw new BadRequestException();
+                throw ExceptionUtils.toBadRequestException(null, null);
             }
         }
         */
@@ -245,15 +245,15 @@ public class RequestAssertionConsumerSer
                     ? new DeflateEncoderDecoder().inflateToken(deflatedToken)
                     : new ByteArrayInputStream(deflatedToken); 
             } catch (Base64Exception ex) {
-                throw new BadRequestException(ex);
+                throw ExceptionUtils.toBadRequestException(ex, null);
             } catch (DataFormatException ex) {
-                throw new BadRequestException(ex);
+                throw ExceptionUtils.toBadRequestException(ex, null);
             }
         } else {
             try {
                 tokenStream = new ByteArrayInputStream(samlResponseDecoded.getBytes("UTF-8"));
             } catch (UnsupportedEncodingException ex) {
-                throw new BadRequestException(ex);
+                throw ExceptionUtils.toBadRequestException(ex, null);
             }
         }
         
@@ -270,10 +270,10 @@ public class RequestAssertionConsumerSer
         try {
             responseObject = OpenSAMLUtil.fromDom(responseDoc.getDocumentElement());
         } catch (WSSecurityException ex) {
-            throw new BadRequestException(ex);
+            throw ExceptionUtils.toBadRequestException(ex, null);
         }
         if (!(responseObject instanceof org.opensaml.saml2.core.Response)) {
-            throw new BadRequestException();
+            throw ExceptionUtils.toBadRequestException(null, null);
         }
         return (org.opensaml.saml2.core.Response)responseObject;
     }
@@ -291,7 +291,7 @@ public class RequestAssertionConsumerSer
         } catch (WSSecurityException ex) {
             LOG.log(Level.FINE, ex.getMessage(), ex);
             reportError("INVALID_SAML_RESPONSE");
-            throw new BadRequestException();
+            throw ExceptionUtils.toBadRequestException(null, null);
         }
     }
     
@@ -321,7 +321,7 @@ public class RequestAssertionConsumerSer
             return ssoResponseValidator.validateSamlResponse(samlResponse, postBinding);
         } catch (WSSecurityException ex) {
             reportError("INVALID_SAML_RESPONSE");
-            throw new BadRequestException(ex);
+            throw ExceptionUtils.toBadRequestException(ex, null);
         }
     }
     
@@ -335,7 +335,7 @@ public class RequestAssertionConsumerSer
         } else {
             reportError("MISSING_TARGET_URI");
         }
-        throw new BadRequestException();
+        throw ExceptionUtils.toBadRequestException(null, null);
     }
     
     private void reportError(String code) {

Modified: cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java (original)
+++ cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java Mon Feb 10 22:43:44 2014
@@ -23,7 +23,6 @@ import java.security.PrivateKey;
 import java.security.cert.X509Certificate;
 
 import javax.security.auth.callback.CallbackHandler;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
@@ -32,6 +31,7 @@ import org.w3c.dom.Element;
 
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.jaxrs.ext.MessageContextImpl;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.saml.DeflateEncoderDecoder;
@@ -84,7 +84,7 @@ public class SamlPostBindingFilter exten
                                .build());
                 
             } catch (Exception ex) {
-                throw new InternalServerErrorException(ex);
+                throw ExceptionUtils.toInternalServerErrorException(ex, null);
             }
         }
     }
@@ -108,17 +108,17 @@ public class SamlPostBindingFilter exten
         Crypto crypto = getSignatureCrypto();
         if (crypto == null) {
             LOG.fine("No crypto instance of properties file configured for signature");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         String signatureUser = getSignatureUsername();
         if (signatureUser == null) {
             LOG.fine("No user configured for signature");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         CallbackHandler callbackHandler = getCallbackHandler();
         if (callbackHandler == null) {
             LOG.fine("No CallbackHandler configured to supply a password for signature");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         
         CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);

Modified: cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java (original)
+++ cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java Mon Feb 10 22:43:44 2014
@@ -25,7 +25,6 @@ import java.security.Signature;
 import java.security.cert.X509Certificate;
 
 import javax.security.auth.callback.CallbackHandler;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
@@ -34,6 +33,7 @@ import javax.ws.rs.core.UriBuilder;
 import org.w3c.dom.Element;
 
 import org.apache.cxf.common.util.Base64Utility;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.saml.DeflateEncoderDecoder;
@@ -76,7 +76,7 @@ public class SamlRedirectBindingFilter e
                                .build());
             } catch (Exception ex) {
                 ex.printStackTrace();
-                throw new InternalServerErrorException(ex);
+                throw ExceptionUtils.toInternalServerErrorException(ex, null);
             }
         }
     }
@@ -105,17 +105,17 @@ public class SamlRedirectBindingFilter e
         Crypto crypto = getSignatureCrypto();
         if (crypto == null) {
             LOG.fine("No crypto instance of properties file configured for signature");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         String signatureUser = getSignatureUsername();
         if (signatureUser == null) {
             LOG.fine("No user configured for signature");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         CallbackHandler callbackHandler = getCallbackHandler();
         if (callbackHandler == null) {
             LOG.fine("No CallbackHandler configured to supply a password for signature");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         
         CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java (original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java Mon Feb 10 22:43:44 2014
@@ -29,7 +29,6 @@ import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Response;
@@ -37,7 +36,9 @@ import javax.ws.rs.core.Response;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.rs.security.common.CryptoLoader;
@@ -218,7 +219,7 @@ public abstract class AbstractSamlInHand
         // to rt/rs/security
         LOG.warning(error);
         Response response = Response.status(401).entity(error).build();
-        throw ex != null ? new NotAuthorizedException(response, ex) : new NotAuthorizedException(response);
+        throw ExceptionUtils.toNotAuthorizedException(null, response);
     }
     
     /**

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java (original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java Mon Feb 10 22:43:44 2014
@@ -23,7 +23,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.logging.Logger;
 
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
 import javax.xml.stream.XMLStreamReader;
 
@@ -32,6 +31,7 @@ import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.staxutils.W3CDOMStreamReader;
@@ -81,7 +81,7 @@ public abstract class AbstractXmlSecInHa
     protected void throwFault(String error, Exception ex) {
         LOG.warning(error);
         Response response = Response.status(400).entity(error).build();
-        throw ex != null ? new BadRequestException(response, ex) : new BadRequestException(response);
+        throw ExceptionUtils.toBadRequestException(null, response);
     }
 
     protected Element getNode(Element parent, String ns, String name, int index) {

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java (original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java Mon Feb 10 22:43:44 2014
@@ -33,7 +33,6 @@ import java.util.logging.Logger;
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -41,6 +40,7 @@ import javax.xml.stream.XMLStreamReader;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.StaxInInterceptor;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
@@ -294,7 +294,7 @@ public class XmlSecInInterceptor impleme
     protected void throwFault(String error, Exception ex) {
         LOG.warning(error);
         Response response = Response.status(400).entity(error).build();
-        throw ex != null ? new BadRequestException(response, ex) : new BadRequestException(response);
+        throw ExceptionUtils.toBadRequestException(null, response);
     }
 
     public Collection<PhaseInterceptor<? extends Message>> getAdditionalInterceptors() {

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java?rev=1566780&r1=1566779&r2=1566780&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java (original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java Mon Feb 10 22:43:44 2014
@@ -31,7 +31,6 @@ import java.util.logging.Logger;
 
 import javax.crypto.KeyGenerator;
 import javax.crypto.SecretKey;
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.core.Response;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -42,6 +41,7 @@ import org.apache.cxf.common.util.String
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
@@ -315,7 +315,7 @@ public class XmlSecOutInterceptor implem
     protected void throwFault(String error, Exception ex) {
         LOG.warning(error);
         Response response = Response.status(400).entity(error).build();
-        throw ex != null ? new BadRequestException(response, ex) : new BadRequestException(response);
+        throw ExceptionUtils.toBadRequestException(null, response);
     }
 
     public Collection<PhaseInterceptor<? extends Message>> getAdditionalInterceptors() {



Mime
View raw message