You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/02/11 12:07:01 UTC

svn commit: r1567045 [1/2] - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/ rt/fron...

Author: sergeyb
Date: Tue Feb 11 11:07:00 2014
New Revision: 1567045

URL: http://svn.apache.org/r1567045
Log:
Merged revisions 1566780 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1566780 | sergeyb | 2014-02-10 22:43:44 +0000 (Mon, 10 Feb 2014) | 1 line
  
  [CXF-5556] Initial updates to get 2.0 exception API not interfering with 1.1 API
........

Added:
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java
      - copied, changed from r1566780, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java
      - copied, changed from r1566780, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java
Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/Attachment.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
    cxf/branches/2.7.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPullServer.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisElementProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AbstractAtomProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansElementProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/xmlbeans/XMLBeansJSONProvider.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/saml/SamlOAuthValidator.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractAccessTokenValidator.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AbstractOAuthService.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/AccessTokenService.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/AuthorizationUtils.java
    cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/utils/OAuthContextUtils.java
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/RequestAssertionConsumerService.java
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java
    cxf/branches/2.7.x-fixes/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java
    cxf/branches/2.7.x-fixes/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java
    cxf/branches/2.7.x-fixes/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecInHandler.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1566780

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java Tue Feb 11 11:07:00 2014
@@ -29,8 +29,6 @@ import java.util.List;
 import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
-import javax.ws.rs.InternalServerErrorException;
-import javax.ws.rs.NotFoundException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.container.AsyncResponse;
 import javax.ws.rs.core.Application;
@@ -59,6 +57,7 @@ import org.apache.cxf.jaxrs.model.Parame
 import org.apache.cxf.jaxrs.model.ProviderInfo;
 import org.apache.cxf.jaxrs.model.URITemplate;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Exchange;
@@ -100,7 +99,7 @@ public class JAXRSInvoker extends Abstra
             Object serviceObject = getActualServiceObject(exchange, rootInstance);
             
             return invoke(exchange, request, serviceObject);
-        } catch (InternalServerErrorException ex) {
+        } catch (WebApplicationException ex) {
             responseList = checkExchangeForResponse(exchange);
             if (responseList != null) {
                 return responseList; 
@@ -242,7 +241,7 @@ public class JAXRSInvoker extends Abstra
                                                                BUNDLE,
                                                                subResourcePath);
                     LOG.severe(errorM.toString());
-                    throw new NotFoundException();
+                    throw ExceptionUtils.toNotFoundException(null, null);
                 }
 
                 OperationResourceInfo subOri = JAXRSUtils.findTargetMethod(subCri,
@@ -327,7 +326,7 @@ public class JAXRSInvoker extends Abstra
                 criRoot.clearThreadLocalProxies();
             }
             inMessage.getExchange().put(Message.PROPOGATE_EXCEPTION, 
-                                        JAXRSUtils.propogateException(inMessage));
+                                        ExceptionUtils.propogateException(inMessage));
             throw ex;
         }
         return new MessageContentsList(excResponse);
@@ -405,7 +404,7 @@ public class JAXRSInvoker extends Abstra
                                                        BUNDLE,
                                                        subResourcePath);
             LOG.info(errorM.toString());
-            throw new NotFoundException();
+            throw ExceptionUtils.toNotFoundException(null, null);
         }
 
         return result;

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java Tue Feb 11 11:07:00 2014
@@ -77,6 +77,7 @@ import org.apache.cxf.jaxrs.impl.UriBuil
 import org.apache.cxf.jaxrs.model.ParameterType;
 import org.apache.cxf.jaxrs.model.URITemplate;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
+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.JAXRSUtils;
@@ -455,7 +456,7 @@ public abstract class AbstractClient imp
     }
     
     protected WebApplicationException convertToWebApplicationException(Response r) {
-        Class<?> exceptionClass = JAXRSUtils.getWebApplicationExceptionClass(r, 
+        Class<?> exceptionClass = ExceptionUtils.getWebApplicationExceptionClass(r, 
                                        WebApplicationException.class);
         try {
             Constructor<?> ctr = exceptionClass.getConstructor(Response.class);

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/Attachment.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/Attachment.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/Attachment.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/multipart/Attachment.java Tue Feb 11 11:07:00 2014
@@ -27,7 +27,6 @@ import java.util.List;
 
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
@@ -36,6 +35,7 @@ import javax.ws.rs.ext.Providers;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.Transferable;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 
 /**
@@ -137,7 +137,7 @@ public class Attachment implements Trans
                     return mbr.readFrom(cls, cls, new Annotation[]{}, getContentType(), 
                                         headers, getDataHandler().getInputStream());
                 } catch (Exception ex) {
-                    throw new InternalServerErrorException(ex);
+                    ExceptionUtils.toInternalServerErrorException(ex, null);
                 }
             }
         }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java Tue Feb 11 11:07:00 2014
@@ -28,9 +28,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.ws.rs.HttpMethod;
-import javax.ws.rs.InternalServerErrorException;
-import javax.ws.rs.NotAcceptableException;
-import javax.ws.rs.NotFoundException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -54,6 +51,7 @@ import org.apache.cxf.jaxrs.model.Operat
 import org.apache.cxf.jaxrs.model.ProviderInfo;
 import org.apache.cxf.jaxrs.model.URITemplate;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
+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.JAXRSUtils;
@@ -160,7 +158,7 @@ public class JAXRSInInterceptor extends 
         try {
             acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes, JAXRSUtils.MEDIA_TYPE_Q_PARAM);
         } catch (IllegalArgumentException ex) {
-            throw new NotAcceptableException();
+            throw ExceptionUtils.toNotAcceptableException(null, null);
         }
         message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);
 
@@ -183,7 +181,7 @@ public class JAXRSInInterceptor extends 
             LOG.warning(errorMsg.toString());
             Response resp = JAXRSUtils.createResponse(null, message, errorMsg.toString(), 
                     Response.Status.NOT_FOUND.getStatusCode(), false);
-            throw new NotFoundException(resp);
+            throw ExceptionUtils.toNotFoundException(null, resp);
         }
 
         message.getExchange().put(JAXRSUtils.ROOT_RESOURCE_CLASS, resource);
@@ -264,8 +262,9 @@ public class JAXRSInInterceptor extends 
         if (excResponse == null) {
             ProviderFactory.getInstance(message).clearThreadLocalProxies();
             message.getExchange().put(Message.PROPOGATE_EXCEPTION, 
-                                      JAXRSUtils.propogateException(message));
-            throw ex instanceof RuntimeException ? (RuntimeException)ex : new InternalServerErrorException(ex);
+                                      ExceptionUtils.propogateException(message));
+            throw ex instanceof RuntimeException ? (RuntimeException)ex 
+                : ExceptionUtils.toInternalServerErrorException(ex, null);
         }
         message.getExchange().put(Response.class, excResponse);
     }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/lifecycle/PerRequestResourceProvider.java Tue Feb 11 11:07:00 2014
@@ -23,9 +23,10 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
@@ -73,25 +74,29 @@ public class PerRequestResourceProvider 
             return instance;
         } catch (InstantiationException ex) {
             String msg = "Resource class " + c.getDeclaringClass().getName() + " can not be instantiated";
-            throw new InternalServerErrorException(Response.serverError().entity(msg).build());
+            throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
         } catch (IllegalAccessException ex) {
             String msg = "Resource class " + c.getDeclaringClass().getName() + " can not be instantiated"
                 + " due to IllegalAccessException";
-            throw new InternalServerErrorException(Response.serverError().entity(msg).build());
+            throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
         } catch (InvocationTargetException ex) {
             Response r = JAXRSUtils.convertFaultToResponse(ex.getCause(), m);
             if (r != null) {
                 m.getExchange().put(Response.class, r);
-                throw new InternalServerErrorException();
+                throw new WebApplicationException();
             }
             String msg = "Resource class "
                 + c.getDeclaringClass().getName() + " can not be instantiated"
                 + " due to InvocationTargetException";
-            throw new InternalServerErrorException(Response.serverError().entity(msg).build());
+            throw ExceptionUtils.toInternalServerErrorException(null, serverError(msg));
         }
         
     }
 
+    private Response serverError(String msg) {
+        return Response.serverError().entity(msg).build();
+    }
+    
     /**
      * {@inheritDoc}
      */

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java Tue Feb 11 11:07:00 2014
@@ -47,8 +47,6 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -104,6 +102,7 @@ import org.apache.cxf.jaxrs.model.Resour
 import org.apache.cxf.jaxrs.model.URITemplate;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.jaxrs.utils.AnnotationUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
@@ -287,7 +286,7 @@ public class WadlGenerator implements Re
         try {
             return StaxUtils.read(new StringReader(entity));
         } catch (Exception ex) {
-            throw new InternalServerErrorException(ex);
+            throw ExceptionUtils.toInternalServerErrorException(ex, null);
         }
     }
 
@@ -911,7 +910,7 @@ public class WadlGenerator implements Re
 
                     }
                 } catch (Exception ex) {
-                    throw new InternalServerErrorException(ex);
+                    throw ExceptionUtils.toInternalServerErrorException(ex, null);
                 }
             }
         }
@@ -955,7 +954,7 @@ public class WadlGenerator implements Re
                         .build();
                 }
             } catch (Exception ex) {
-                throw new BadRequestException();
+                throw ExceptionUtils.toBadRequestException(ex, null);
             }
 
         }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Tue Feb 11 11:07:00 2014
@@ -38,8 +38,6 @@ import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.logging.Logger;
 
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -72,6 +70,7 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
@@ -233,7 +232,7 @@ public abstract class AbstractJAXBProvid
     protected void reportEmptyContentLength() {
         String message = new org.apache.cxf.common.i18n.Message("EMPTY_BODY", BUNDLE).toString();
         LOG.warning(message);
-        throw new BadRequestException();
+        throw ExceptionUtils.toBadRequestException(null, null);
     }
     
     protected <X> X getStreamHandlerFromCurrentMessage(Class<X> staxCls) {
@@ -685,7 +684,9 @@ public abstract class AbstractJAXBProvid
             ? Response.Status.BAD_REQUEST : Response.Status.INTERNAL_SERVER_ERROR; 
         Response r = Response.status(status)
             .type(MediaType.TEXT_PLAIN).entity(message).build();
-        throw read ? new BadRequestException(r, t) : new InternalServerErrorException(r, t);
+        WebApplicationException ex = read ? ExceptionUtils.toBadRequestException(t, r) 
+            : ExceptionUtils.toInternalServerErrorException(t, r);
+        throw ex;
     }
     
     protected void handleJAXBException(JAXBException e, boolean read) {
@@ -789,7 +790,7 @@ public abstract class AbstractJAXBProvid
                         ? Integer.valueOf(innerElementCountStr) : -1;
                     return new DocumentDepthProperties(totalElementCount, elementLevel, innerElementCount);
                 } catch (Exception ex) {
-                    throw new InternalServerErrorException(ex);
+                    throw ExceptionUtils.toInternalServerErrorException(ex, null);
                 }
             }
         }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyReader.java Tue Feb 11 11:07:00 2014
@@ -26,13 +26,14 @@ import java.lang.reflect.Type;
 import java.util.Collections;
 import java.util.List;
 
-import javax.ws.rs.NotAcceptableException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.Provider;
 
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
+
 @Provider
 public class CachingMessageBodyReader<T> extends AbstractCachingMessageProvider<T>
     implements MessageBodyReader<T> {
@@ -84,7 +85,7 @@ public class CachingMessageBodyReader<T>
             org.apache.cxf.common.i18n.Message message = 
                 new org.apache.cxf.common.i18n.Message("NO_MSG_READER", BUNDLE, type);
             LOG.severe(message.toString());
-            throw new NotAcceptableException();
+            throw ExceptionUtils.toNotAcceptableException(null, null);
         }
         return r;
     }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/CachingMessageBodyWriter.java Tue Feb 11 11:07:00 2014
@@ -26,13 +26,14 @@ import java.lang.reflect.Type;
 import java.util.Collections;
 import java.util.List;
 
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
+
 @Provider
 public class CachingMessageBodyWriter<T> extends AbstractCachingMessageProvider<T>
     implements MessageBodyWriter<T> {
@@ -87,7 +88,7 @@ public class CachingMessageBodyWriter<T>
             org.apache.cxf.common.i18n.Message message = 
                 new org.apache.cxf.common.i18n.Message("NO_MSG_WRITER", BUNDLE, type);
             LOG.severe(message.toString());
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         return w;
     }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingProvider.java Tue Feb 11 11:07:00 2014
@@ -24,9 +24,7 @@ import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
-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;
@@ -39,6 +37,7 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.staxutils.StaxUtils;
 
 @Provider
@@ -73,7 +72,7 @@ public class DataBindingProvider<T> impl
             Object o = dataReader.read(null, reader, clazz);
             return o == null ? null : clazz.cast(o);
         } catch (Exception ex) {
-            throw new BadRequestException(ex);
+            throw ExceptionUtils.toBadRequestException(ex, null);
         } finally {
             StaxUtils.close(reader);
         }
@@ -103,7 +102,7 @@ public class DataBindingProvider<T> impl
             writer = createWriter(clazz, genericType, os);
             writeToWriter(writer, o);
         } catch (Exception ex) {
-            throw new InternalServerErrorException(ex);
+            throw ExceptionUtils.toInternalServerErrorException(ex, null);
         } finally {
             StaxUtils.close(writer);
         }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java Tue Feb 11 11:07:00 2014
@@ -25,7 +25,6 @@ import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
-import javax.ws.rs.BadRequestException;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Encoded;
 import javax.ws.rs.Produces;
@@ -43,6 +42,7 @@ import org.apache.cxf.jaxrs.ext.multipar
 import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.utils.AnnotationUtils;
+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.multipart.AttachmentUtils;
@@ -123,7 +123,7 @@ public class FormEncodingProvider<T> imp
         } catch (WebApplicationException e) {
             throw e;
         } catch (Exception e) {
-            throw new BadRequestException(e);
+            throw ExceptionUtils.toBadRequestException(e, null);
         }
     }
 

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java Tue Feb 11 11:07:00 2014
@@ -34,9 +34,7 @@ import java.util.Iterator;
 import java.util.List;
 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.WebApplicationException;
 import javax.ws.rs.core.Context;
@@ -65,6 +63,7 @@ import org.apache.cxf.jaxrs.ext.xml.XMLI
 import org.apache.cxf.jaxrs.ext.xml.XMLSource;
 import org.apache.cxf.jaxrs.ext.xml.XSISchemaLocation;
 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;
@@ -202,7 +201,7 @@ public class JAXBElementProvider<T> exte
             throw e;
         } catch (Exception e) {
             LOG.warning(getStackTrace(e));
-            throw new BadRequestException(e);        
+            throw ExceptionUtils.toBadRequestException(e, null);        
         } finally {
             StaxUtils.close(reader);
         }
@@ -234,8 +233,8 @@ public class JAXBElementProvider<T> exte
                 try {
                     reader = factory.createXMLStreamReader(is);
                 } catch (XMLStreamException e) {
-                    throw new InternalServerErrorException(
-                        new RuntimeException("Can not create XMLStreamReader", e));
+                    throw ExceptionUtils.toInternalServerErrorException(
+                        new RuntimeException("Can not create XMLStreamReader", e), null);
                 }
             }
         }
@@ -263,7 +262,7 @@ public class JAXBElementProvider<T> exte
                 Reader reader = getStreamHandlerFromCurrentMessage(Reader.class);
                 if (reader == null) {
                     LOG.severe("No InputStream, Reader, or XMLStreamReader is available");
-                    throw new InternalServerErrorException();
+                    throw ExceptionUtils.toInternalServerErrorException(null, null);
                 }
                 xmlReader = StaxUtils.createXMLStreamReader(reader);
             } else {
@@ -299,7 +298,7 @@ public class JAXBElementProvider<T> exte
             throw e;
         } catch (Exception e) {
             e.printStackTrace();
-            throw new InternalServerErrorException(e);        
+            throw ExceptionUtils.toInternalServerErrorException(e, null);        
         }
     }
 
@@ -546,8 +545,8 @@ public class JAXBElementProvider<T> exte
                     try {
                         writer = factory.createXMLStreamWriter(os);
                     } catch (XMLStreamException e) {
-                        throw new InternalServerErrorException(
-                            new RuntimeException("Cant' create XMLStreamWriter", e));
+                        throw ExceptionUtils.toInternalServerErrorException(
+                            new RuntimeException("Cant' create XMLStreamWriter", e), null);
                     }
                 }
             }
@@ -568,7 +567,7 @@ public class JAXBElementProvider<T> exte
             Writer writer = getStreamHandlerFromCurrentMessage(Writer.class);
             if (writer == null) {
                 LOG.severe("No OutputStream, Writer, or XMLStreamWriter is available");
-                throw new InternalServerErrorException();
+                throw ExceptionUtils.toInternalServerErrorException(null, null);
             }
             ms.marshal(obj, writer);
             writer.flush();

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java Tue Feb 11 11:07:00 2014
@@ -39,9 +39,7 @@ import java.util.logging.Logger;
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
 import javax.mail.internet.MimeUtility;
-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;
@@ -66,6 +64,7 @@ import org.apache.cxf.jaxrs.ext.multipar
 import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.utils.AnnotationUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils;
@@ -187,7 +186,7 @@ public class MultipartProvider extends A
             return defaultValue;
         }
         
-        throw new BadRequestException();
+        throw ExceptionUtils.toBadRequestException(null, null);
         
     }
     
@@ -405,7 +404,7 @@ public class MultipartProvider extends A
                                                    BUNDLE,
                                                    cls);
             LOG.severe(message.toString());
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         
         return new MessageBodyWriterDataHandler<T>(r, obj, cls, genericType, anns, mt);
@@ -470,7 +469,7 @@ public class MultipartProvider extends A
                 writer.writeTo(obj, cls, genericType, anns, contentType, 
                                new MetadataMap<String, Object>(), os);
             } catch (IOException ex) {
-                throw new InternalServerErrorException(ex);
+                throw ExceptionUtils.toInternalServerErrorException(ex, null); 
             }
         }
         

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/RequestDispatcherProvider.java Tue Feb 11 11:07:00 2014
@@ -34,7 +34,6 @@ import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
@@ -47,6 +46,7 @@ import javax.ws.rs.ext.Provider;
 import org.apache.cxf.common.i18n.BundleUtils;
 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.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.PhaseInterceptorChain;
@@ -194,7 +194,7 @@ public class RequestDispatcherProvider e
         } catch (Throwable ex) {
             mc.put(AbstractHTTPDestination.REQUEST_REDIRECTED, Boolean.FALSE);
             ex.printStackTrace();
-            throw new InternalServerErrorException(ex);
+            throw ExceptionUtils.toInternalServerErrorException(ex, null); 
         }
     }
 
@@ -270,7 +270,7 @@ public class RequestDispatcherProvider e
                     new org.apache.cxf.common.i18n.Message("RESOURCE_DISPATCH_NOT_FOUND", 
                                                            BUNDLE, servletContextPath).toString();
                 LOG.severe(message);
-                throw new InternalServerErrorException();
+                throw ExceptionUtils.toInternalServerErrorException(null, null);
             }
         }
         return sc; 
@@ -285,7 +285,7 @@ public class RequestDispatcherProvider e
                 new org.apache.cxf.common.i18n.Message("RESOURCE_PATH_NOT_FOUND", 
                                                        BUNDLE, path).toString();
             LOG.severe(message);
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         return rd;
     }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java Tue Feb 11 11:07:00 2014
@@ -26,7 +26,6 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
 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;
@@ -48,6 +47,7 @@ import org.w3c.dom.Document;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.jaxrs.ext.xml.XMLSource;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.staxutils.DepthExceededStaxException;
 import org.apache.cxf.staxutils.StaxSource;
@@ -166,7 +166,7 @@ public class SourceProvider<T> extends A
         try {
             StaxUtils.copy(reader, writer);
         } catch (XMLStreamException e) {
-            throw new InternalServerErrorException(e);
+            throw ExceptionUtils.toInternalServerErrorException(e, null); 
         } finally {
             try {
                 reader.close();

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java Tue Feb 11 11:07:00 2014
@@ -27,7 +27,6 @@ import java.util.List;
 import java.util.Map;
 
 import javax.ws.rs.Consumes;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -35,6 +34,7 @@ import javax.ws.rs.ext.MessageBodyReader
 import javax.ws.rs.ext.Provider;
 
 import org.apache.cxf.jaxrs.ext.xml.XMLSource;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 
 @Provider
 @Consumes({"text/xml", "application/xml", "application/*+xml" })
@@ -89,7 +89,7 @@ public class XPathProvider<T> implements
             : classExpressions.get(cls.getName());
         if (expression == null) {
             // must not happen if isReadable() returned true
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         XMLSource source = new XMLSource(is);
         if (forceDOM) {

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java Tue Feb 11 11:07:00 2014
@@ -32,9 +32,7 @@ import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-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;
@@ -65,6 +63,7 @@ import org.xml.sax.XMLFilter;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.staxutils.StaxSource;
@@ -186,7 +185,7 @@ public class XSLTJaxbProvider<T> extends
             return unmarshaller.unmarshal(source);
         } catch (TransformerConfigurationException ex) {
             LOG.warning("Transformation exception : " + ex.getMessage());
-            throw new InternalServerErrorException(ex);
+            throw ExceptionUtils.toInternalServerErrorException(ex, null); 
         }
     }
     
@@ -220,7 +219,7 @@ public class XSLTJaxbProvider<T> extends
             writer.close();
             return unmarshalFromInputStream(unmarshaller, out.getInputStream(), mt);
         } catch (Exception ex) {
-            throw new BadRequestException(ex);
+            throw ExceptionUtils.toBadRequestException(ex, null);
         }
     }
     
@@ -343,7 +342,7 @@ public class XSLTJaxbProvider<T> extends
                 return null;
             } else {
                 LOG.severe("No template is available");
-                throw new InternalServerErrorException();
+                throw ExceptionUtils.toInternalServerErrorException(null, null);
             }
         }
         

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthenticationFilter.java Tue Feb 11 11:07:00 2014
@@ -28,7 +28,6 @@ import javax.security.auth.callback.Call
 import javax.security.auth.login.Configuration;
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
-import javax.ws.rs.NotAuthorizedException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
@@ -42,6 +41,7 @@ import org.apache.cxf.common.util.String
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.jaxrs.ext.RequestHandler;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.security.SecurityContext;
@@ -73,12 +73,12 @@ public class KerberosAuthenticationFilte
             .getRequestHeader(HttpHeaders.AUTHORIZATION);
         if (authHeaders.size() != 1) {
             LOG.fine("No Authorization header is available");
-            throw new NotAuthorizedException(getFaultResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, getFaultResponse());
         }
         String[] authPair = StringUtils.split(authHeaders.get(0), " ");
         if (authPair.length != 2 || !NEGOTIATE_SCHEME.equalsIgnoreCase(authPair[0])) {
             LOG.fine("Negotiate Authorization scheme is expected");
-            throw new NotAuthorizedException(getFaultResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, getFaultResponse());
         }
                 
         byte[] serviceTicket = getServiceTicket(authPair[1]);
@@ -92,7 +92,7 @@ public class KerberosAuthenticationFilte
             
             GSSName srcName = gssContext.getSrcName();
             if (srcName == null) {
-                throw new NotAuthorizedException(getFaultResponse());
+                throw ExceptionUtils.toNotAuthorizedException(null, getFaultResponse());
             }
             
             String complexUserName = srcName.toString();
@@ -114,13 +114,13 @@ public class KerberosAuthenticationFilte
             
         } catch (LoginException e) {
             LOG.fine("Unsuccessful JAAS login for the service principal: " + e.getMessage());
-            throw new NotAuthorizedException(getFaultResponse(), e);
+            throw ExceptionUtils.toNotAuthorizedException(e, getFaultResponse());
         } catch (GSSException e) {
             LOG.fine("GSS API exception: " + e.getMessage());
-            throw new NotAuthorizedException(getFaultResponse(), e);
+            throw ExceptionUtils.toNotAuthorizedException(e, getFaultResponse());
         } catch (PrivilegedActionException e) {
             LOG.fine("PrivilegedActionException: " + e.getMessage());
-            throw new NotAuthorizedException(getFaultResponse(), e);
+            throw ExceptionUtils.toNotAuthorizedException(e, getFaultResponse());
         }
         
         return null;
@@ -163,7 +163,7 @@ public class KerberosAuthenticationFilte
         try {
             return Base64Utility.decode(encodedServiceTicket);
         } catch (Base64Exception ex) {
-            throw new NotAuthorizedException(getFaultResponse());
+            throw ExceptionUtils.toNotAuthorizedException(null, getFaultResponse());
         }
     }
     

Copied: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java (from r1566780, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java?p2=cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java&r1=1566780&r2=1567045&rev=1567045&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ExceptionUtils.java Tue Feb 11 11:07:00 2014
@@ -23,7 +23,7 @@ import javax.ws.rs.WebApplicationExcepti
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ExceptionMapper;
 
-import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
+import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 
@@ -67,7 +67,7 @@ public final class ExceptionUtils {
             if (webEx.getResponse().hasEntity() 
                 && webEx.getCause() == null) {
                 Object prop = inMessage.getContextualProperty(SUPPORT_WAE_SPEC_OPTIMIZATION);
-                if (prop == null || MessageUtils.isTrue(prop)) {
+                if (MessageUtils.isTrue(prop)) {
                     response = webEx.getResponse();
                 }
             }
@@ -75,7 +75,7 @@ public final class ExceptionUtils {
         
         if (response == null) {
             ExceptionMapper<T>  mapper =
-                ServerProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
+                ProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
             if (mapper != null) {
                 try {
                     response = mapper.toResponse(ex);

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java Tue Feb 11 11:07:00 2014
@@ -31,8 +31,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -106,7 +104,7 @@ public final class FormUtils {
             IOUtils.copy(is, bos, 1024);
             return new String(bos.toByteArray(), encoding);
         } catch (Exception ex) {
-            throw new InternalServerErrorException(ex);
+            throw ExceptionUtils.toInternalServerErrorException(ex, null);
         }
     }
     
@@ -203,7 +201,7 @@ public final class FormUtils {
             String contentId = a.getContentId();
             String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"", "").replace("'", "");
             if (StringUtils.isEmpty(name)) { 
-                throw new BadRequestException();
+                throw ExceptionUtils.toBadRequestException(null, null);
             }
             if (CONTENT_DISPOSITION_FILES_PARAM.equals(name)) {
                 // this is a reserved name in Content-Disposition for parts containing files
@@ -216,9 +214,9 @@ public final class FormUtils {
             } catch (IllegalArgumentException ex) {
                 LOG.warning("Illegal URL-encoded characters, make sure that no "
                     + "@FormParam and @Multipart annotations are mixed up");
-                throw new InternalServerErrorException();
+                throw ExceptionUtils.toInternalServerErrorException(ex, null);
             } catch (IOException ex) {
-                throw new BadRequestException();
+                throw ExceptionUtils.toBadRequestException(null, null);
             }
         }
     }
@@ -238,7 +236,7 @@ public final class FormUtils {
                 throw new WebApplicationException(413);
             }
         } catch (NumberFormatException ex) {
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(ex, null);
         }
     }
 }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Tue Feb 11 11:07:00 2014
@@ -51,10 +51,6 @@ import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.logging.Logger;
 
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.ClientErrorException;
-import javax.ws.rs.InternalServerErrorException;
-import javax.ws.rs.NotFoundException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.GenericEntity;
@@ -311,7 +307,7 @@ public final class InjectionUtils {
             Response r = JAXRSUtils.convertFaultToResponse(ex.getCause(), inMessage);
             if (r != null) {
                 inMessage.getExchange().put(Response.class, r);
-                throw new InternalServerErrorException();
+                throw new WebApplicationException();
             }
             reportServerError("METHOD_ACCESS_FAILURE", method.getName());
         } catch (Exception ex) {
@@ -372,9 +368,9 @@ public final class InjectionUtils {
                 //
                 if (pType == ParameterType.PATH || pType == ParameterType.QUERY
                     || pType == ParameterType.MATRIX) {
-                    throw new NotFoundException(nfe);
+                    throw ExceptionUtils.toNotFoundException(nfe, null);
                 }
-                throw new BadRequestException(nfe);
+                throw ExceptionUtils.toBadRequestException(nfe, null);
             }
         }
         
@@ -404,7 +400,8 @@ public final class InjectionUtils {
                 LOG.severe(new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE", 
                                                                    BUNDLE, 
                                                                    pClass.getName()).toString());
-                throw new ClientErrorException(HttpUtils.getParameterFailureStatus(pType), ex);
+                Response r = JAXRSUtils.toResponse(HttpUtils.getParameterFailureStatus(pType));
+                throw ExceptionUtils.toHttpException(ex, r);
             }
         }
         if (result == null) {
@@ -481,7 +478,7 @@ public final class InjectionUtils {
         Response r = Response.status(Response.Status.INTERNAL_SERVER_ERROR)
                          .type(MediaType.TEXT_PLAIN_TYPE)
                          .entity(errorMessage.toString()).build();
-        throw new InternalServerErrorException(r);
+        throw ExceptionUtils.toInternalServerErrorException(null, r);
     }
     
     private static <T> T evaluateFactoryMethod(String value,
@@ -1242,7 +1239,8 @@ public final class InjectionUtils {
             } catch (IllegalAccessException ex) {
                 String msg = "Method " + method.getName() + " can not be invoked"
                     + " due to IllegalAccessException";
-                throw new InternalServerErrorException(Response.serverError().entity(msg).build());
+                throw ExceptionUtils.toInternalServerErrorException(ex, 
+                                                                    Response.serverError().entity(msg).build());
             } 
         }
     }

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Tue Feb 11 11:07:00 2014
@@ -31,7 +31,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
@@ -48,20 +47,9 @@ import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.HttpMethod;
-import javax.ws.rs.InternalServerErrorException;
-import javax.ws.rs.NotAcceptableException;
-import javax.ws.rs.NotAllowedException;
-import javax.ws.rs.NotAuthorizedException;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.NotSupportedException;
 import javax.ws.rs.Produces;
-import javax.ws.rs.RedirectionException;
-import javax.ws.rs.ServerErrorException;
-import javax.ws.rs.ServiceUnavailableException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.container.AsyncResponse;
 import javax.ws.rs.container.ContainerRequestContext;
@@ -82,7 +70,6 @@ import javax.ws.rs.core.Response.Respons
 import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.ContextResolver;
-import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Providers;
@@ -165,21 +152,8 @@ public final class JAXRSUtils {
     private static final Logger LOG = LogUtils.getL7dLogger(JAXRSUtils.class);
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JAXRSUtils.class);
     private static final String PATH_SEGMENT_SEP = "/";
-    private static final String PROPAGATE_EXCEPTION = "org.apache.cxf.propagate.exception";
     private static final String REPORT_FAULT_MESSAGE_PROPERTY = "org.apache.cxf.jaxrs.report-fault-message";
-    private static final String  SUPPORT_WAE_SPEC_OPTIMIZATION = "support.wae.spec.optimization";
-    private static final Map<Integer, Class<?>> EXCEPTIONS_MAP;
-    static {
-        EXCEPTIONS_MAP = new HashMap<Integer, Class<?>>();
-        EXCEPTIONS_MAP.put(400, BadRequestException.class);
-        EXCEPTIONS_MAP.put(401, NotAuthorizedException.class);
-        EXCEPTIONS_MAP.put(404, NotFoundException.class);
-        EXCEPTIONS_MAP.put(405, NotAllowedException.class);
-        EXCEPTIONS_MAP.put(406, NotAcceptableException.class);
-        EXCEPTIONS_MAP.put(415, NotSupportedException.class);
-        EXCEPTIONS_MAP.put(500, InternalServerErrorException.class);
-        EXCEPTIONS_MAP.put(503, ServiceUnavailableException.class);
-    }
+    private static final String NO_CONTENT_EXCEPTION = "javax.ws.rs.core.NoContentException";
     
     private JAXRSUtils() {        
     }
@@ -389,7 +363,7 @@ public final class JAXRSUtils {
         try {
             requestType = getMethod ? MediaType.WILDCARD_TYPE : toMediaType(requestContentType);
         } catch (IllegalArgumentException ex) {
-            throw new NotSupportedException(ex);
+            throw ExceptionUtils.toNotSupportedException(ex, null);
         }
         
         SortedMap<OperationResourceInfo, MultivaluedMap<String, String>> candidateList = 
@@ -500,7 +474,7 @@ public final class JAXRSUtils {
         }
         Response response = 
             createResponse(resource, message, errorMsg.toString(), status, methodMatched == 0);
-        throw new ClientErrorException(response);
+        throw ExceptionUtils.toHttpException(null, response);
         
     }    
 
@@ -918,7 +892,7 @@ public final class JAXRSUtils {
                                                                BUNDLE, 
                                                                mt.toString());
                     LOG.warning(errorMsg.toString());
-                    throw new NotSupportedException();
+                    throw ExceptionUtils.toNotSupportedException(null, null);
                 }
             }
         }
@@ -997,13 +971,13 @@ public final class JAXRSUtils {
             // is available indicates that the one created at start up has been 
             // lost and hence it is 500
             LOG.warning("Bean parameter info is not available");
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         Object instance;
         try {
             instance = ClassLoaderUtils.loadClass(clazz.getName(), JAXRSUtils.class).newInstance();
         } catch (Throwable t) {
-            throw new InternalServerErrorException(t);
+            throw ExceptionUtils.toInternalServerErrorException(t, null); 
         }
         JAXRSUtils.injectParameters(ori, bmi, instance, m);
         
@@ -1236,7 +1210,11 @@ public final class JAXRSUtils {
                                                      type,
                                                      m);    
                 } catch (IOException e) {
-                    throw e;
+                    if (e.getClass().getName().equals(NO_CONTENT_EXCEPTION)) {
+                        throw ExceptionUtils.toBadRequestException(e, null);    
+                    } else {
+                        throw e;
+                    }
                 } catch (WebApplicationException ex) {
                     throw ex;
                 } catch (Exception ex) {
@@ -1533,53 +1511,9 @@ public final class JAXRSUtils {
         return types;
     }
     
-    public static Class<?> getWebApplicationExceptionClass(Response exResponse,
-                                                           Class<?> defaultExceptionType) {
-        int status = exResponse.getStatus();
-        Class<?> cls = EXCEPTIONS_MAP.get(status);
-        if (cls == null) {
-            int family = status / 100;
-            if (family == 3) {
-                cls = RedirectionException.class;
-            } else if (family == 4) {
-                cls = ClientErrorException.class;
-            } else if (family == 5) {
-                cls = ServerErrorException.class;
-            }
-        }
-        return cls == null ? defaultExceptionType : cls;
-    }
-    
+
     public static <T extends Throwable> Response convertFaultToResponse(T ex, Message currentMessage) {
-        if (ex == null || currentMessage == null) {
-            return null;
-        }
-        Message inMessage = currentMessage.getExchange().getInMessage();
-        Response response = null;
-        if (ex.getClass() == WebApplicationException.class) {
-            WebApplicationException webEx = (WebApplicationException)ex;
-            if (webEx.getResponse().hasEntity() 
-                && webEx.getCause() == null
-                && MessageUtils.isTrue(inMessage.getContextualProperty(SUPPORT_WAE_SPEC_OPTIMIZATION))) {
-                response = webEx.getResponse();
-                
-            }
-        }
-        if (response == null) {
-            ExceptionMapper<T>  mapper =
-                ProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage);
-            if (mapper != null) {
-                try {
-                    response = mapper.toResponse(ex);
-                } catch (Exception mapperEx) {
-                    inMessage.getExchange().put(JAXRSUtils.EXCEPTION_FROM_MAPPER, "true");
-                    mapperEx.printStackTrace();
-                    return Response.serverError().build();
-                }
-            }
-        }
-        setMessageContentType(currentMessage, response);
-        return response;
+        return ExceptionUtils.convertFaultToResponse(ex, currentMessage);
     }
     
     public static void setMessageContentType(Message message, Response response) {
@@ -1597,21 +1531,6 @@ public final class JAXRSUtils {
         
     }
     
-    public static boolean propogateException(Message m) {
-        
-        Object value = m.getContextualProperty(PROPAGATE_EXCEPTION);
-        
-        if (value == null) {
-            return true;
-        }
-
-        if (Boolean.TRUE.equals(value) || "true".equalsIgnoreCase(value.toString())) {
-            return true;
-        }
-        
-        return false;
-    }
-    
     public static QName getClassQName(Class<?> type) {
         String nsURI = PackageUtils.getNamespace(PackageUtils.getPackageName(type));
         if (nsURI.endsWith("/")) {
@@ -1635,7 +1554,7 @@ public final class JAXRSUtils {
                     InjectionUtils.injectContexts(filter.getProvider(), filter, m);
                     filter.getProvider().filter(context);
                 } catch (IOException ex) {
-                    throw new InternalServerErrorException(ex);
+                    throw ExceptionUtils.toInternalServerErrorException(ex, null); 
                 }
                 Response response = m.getExchange().get(Response.class);
                 if (response != null) {

Copied: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java (from r1566780, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java?p2=cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java&r1=1566780&r2=1567045&rev=1567045&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/SpecExceptions.java Tue Feb 11 11:07:00 2014
@@ -24,7 +24,6 @@ import java.util.Map;
 
 import javax.ws.rs.BadRequestException;
 import javax.ws.rs.ClientErrorException;
-import javax.ws.rs.ForbiddenException;
 import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.NotAcceptableException;
 import javax.ws.rs.NotAllowedException;
@@ -45,7 +44,6 @@ public final class SpecExceptions {
         EXCEPTIONS_MAP = new HashMap<Integer, Class<?>>();
         EXCEPTIONS_MAP.put(400, BadRequestException.class);
         EXCEPTIONS_MAP.put(401, NotAuthorizedException.class);
-        EXCEPTIONS_MAP.put(403, ForbiddenException.class);
         EXCEPTIONS_MAP.put(404, NotFoundException.class);
         EXCEPTIONS_MAP.put(405, NotAllowedException.class);
         EXCEPTIONS_MAP.put(406, NotAcceptableException.class);

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java Tue Feb 11 11:07:00 2014
@@ -27,8 +27,6 @@ import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.NotSupportedException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
@@ -41,6 +39,7 @@ import org.apache.cxf.jaxrs.ext.multipar
 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
 import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.FormUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.phase.PhaseInterceptorChain;
@@ -141,8 +140,8 @@ public final class AttachmentUtils {
                                                            id.value(),
                                                            mt.toString());
                 LOG.warning(errorMsg.toString());
-                throw new BadRequestException(
-                          new MultipartReadException(id.value(), id.type(), errorMsg.toString()));
+                throw ExceptionUtils.toBadRequestException(
+                          new MultipartReadException(id.value(), id.type(), errorMsg.toString()), null);
             } else {
                 return null;
             }
@@ -230,7 +229,7 @@ public final class AttachmentUtils {
     
     private static void checkMediaTypes(MediaType mt1, String mt2) {
         if (!mt1.isCompatible(JAXRSUtils.toMediaType(mt2))) {                                            
-            throw new NotSupportedException();
+            throw ExceptionUtils.toNotSupportedException(null, null);
         }
     }
 }

Modified: cxf/branches/2.7.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPullServer.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPullServer.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPullServer.java (original)
+++ cxf/branches/2.7.x-fixes/rt/management-web/src/main/java/org/apache/cxf/management/web/logging/atom/AtomPullServer.java Tue Feb 11 11:07:00 2014
@@ -31,7 +31,6 @@ import java.util.WeakHashMap;
 import java.util.logging.Handler;
 
 import javax.ws.rs.GET;
-import javax.ws.rs.NotFoundException;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
@@ -48,6 +47,7 @@ import org.apache.cxf.jaxrs.ext.search.P
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
 import org.apache.cxf.jaxrs.ext.search.SearchConditionVisitor;
 import org.apache.cxf.jaxrs.ext.search.SearchContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.management.web.logging.LogLevel;
 import org.apache.cxf.management.web.logging.LogRecord;
 import org.apache.cxf.management.web.logging.ReadWriteLogStorage;
@@ -228,7 +228,7 @@ public class AtomPullServer extends Abst
             list.add(records.get(index));
         }
         if (list.size() != 1) { 
-            throw new NotFoundException();
+            throw ExceptionUtils.toNotFoundException(null, null);
         }
         return list;
     }

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisElementProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisElementProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisElementProvider.java Tue Feb 11 11:07:00 2014
@@ -27,9 +27,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
-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;
@@ -42,6 +40,7 @@ import org.apache.cxf.aegis.AegisContext
 import org.apache.cxf.aegis.AegisReader;
 import org.apache.cxf.aegis.AegisWriter;
 import org.apache.cxf.aegis.type.AegisType;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.staxutils.StaxUtils;
 
 @Provider
@@ -70,7 +69,7 @@ public class AegisElementProvider<T> ext
             xmlStreamReader = createStreamReader(typeToRead, is);
             return type.cast(aegisReader.read(xmlStreamReader, typeToRead));
         } catch (Exception e) {
-            throw new BadRequestException(e);
+            throw ExceptionUtils.toBadRequestException(e, null);
         } finally {
             StaxUtils.close(xmlStreamReader);
         }
@@ -115,7 +114,7 @@ public class AegisElementProvider<T> ext
             xmlStreamWriter.writeEndDocument();
             xmlStreamWriter.close();
         } catch (Exception e) {
-            throw new InternalServerErrorException(e);
+            throw ExceptionUtils.toInternalServerErrorException(e, null);
         }
     }
     

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/aegis/AegisJSONProvider.java Tue Feb 11 11:07:00 2014
@@ -29,7 +29,6 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 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;
@@ -45,6 +44,7 @@ import org.apache.cxf.aegis.AegisWriter;
 import org.apache.cxf.aegis.type.AegisType;
 import org.apache.cxf.jaxrs.provider.json.utils.JSONUtils;
 import org.apache.cxf.jaxrs.provider.json.utils.PrefixCollectingXMLStreamWriter;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.staxutils.W3CDOMStreamWriter;
 import org.codehaus.jettison.mapped.Configuration;
@@ -121,7 +121,7 @@ public final class AegisJSONProvider<T> 
             xmlStreamWriter.flush();
             xmlStreamWriter.close();
         } catch (Exception e) {
-            throw new InternalServerErrorException(e);
+            throw ExceptionUtils.toInternalServerErrorException(e, null);
         }
     }
 

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AbstractAtomProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AbstractAtomProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AbstractAtomProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AbstractAtomProvider.java Tue Feb 11 11:07:00 2014
@@ -26,7 +26,6 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.logging.Logger;
 
-import javax.ws.rs.NotSupportedException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
@@ -39,6 +38,7 @@ import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserOptions;
 import org.apache.abdera.writer.Writer;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 
 public abstract class AbstractAtomProvider<T extends Element> 
     implements MessageBodyWriter<T>, MessageBodyReader<T> {
@@ -58,7 +58,7 @@ public abstract class AbstractAtomProvid
         if (MediaType.APPLICATION_JSON_TYPE.isCompatible(mt)) {
             Writer w = createWriter("json");
             if (w == null) {
-                throw new NotSupportedException();
+                throw ExceptionUtils.toNotSupportedException(null, null);
             }
             element.writeTo(w, os);   
         } else if (formattedOutput) {

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProvider.java Tue Feb 11 11:07:00 2014
@@ -35,11 +35,8 @@ import java.util.Map;
 import java.util.UUID;
 import java.util.logging.Logger;
 
-import javax.ws.rs.ClientErrorException;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.InternalServerErrorException;
 import javax.ws.rs.Produces;
-import javax.ws.rs.ServerErrorException;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
@@ -63,6 +60,7 @@ import org.apache.cxf.common.logging.Log
 import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.jaxrs.provider.AbstractConfigurableProvider;
 import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 
 @Produces({"application/atom+xml", "application/atom+xml;type=feed", "application/atom+xml;type=entry" })
@@ -174,7 +172,7 @@ public class AtomPojoProvider extends Ab
                 atomElement = createEntryFromObject(factory, o, cls);
             }
         } catch (Exception ex) {
-            throw new InternalServerErrorException(ex);
+            throw ExceptionUtils.toInternalServerErrorException(ex, null);
         }
         
         try {
@@ -551,11 +549,7 @@ public class AtomPojoProvider extends Ab
     private void reportError(String message, Exception ex, int status) {
         LOG.warning(message);
         Response response = Response.status(status).type("text/plain").entity(message).build();
-        if (ex == null) {
-            throw status < 500 ? new ClientErrorException(response) : new ServerErrorException(response);
-        } else {
-            throw status < 500 ? new ClientErrorException(response, ex) : new ServerErrorException(response, ex);
-        }
+        throw ExceptionUtils.toHttpException(ex, response);
     }
     private void reportError(String message, Exception ex) {
         reportError(message, ex, 500);

Modified: cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/dom4j/DOM4JProvider.java Tue Feb 11 11:07:00 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/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java?rev=1567045&r1=1567044&r2=1567045&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java Tue Feb 11 11:07:00 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;
@@ -259,7 +258,7 @@ public class JSONProvider<T> extends Abs
         } catch (WebApplicationException e) {
             throw e;
         } catch (Exception e) {
-            throw new BadRequestException(e);
+            throw ExceptionUtils.toBadRequestException(e, null);
         } finally {
             StaxUtils.close(reader);
         }
@@ -335,7 +334,7 @@ public class JSONProvider<T> extends Abs
         }
         
         if (name == null) {
-            throw new InternalServerErrorException();
+            throw ExceptionUtils.toInternalServerErrorException(null, null);
         }
         
         return "{\"" + name + "\":";
@@ -386,7 +385,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);
         }