You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/02/15 12:48:23 UTC

[tomee] 06/08: Fixed exception handling for no CXF service to pass resteasy test case

This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit ad4b76449d2977088c7e32ccd9704a93da3b14b3
Author: James Meen <ja...@my-managed.net>
AuthorDate: Wed Feb 13 15:24:59 2019 +0000

    Fixed exception handling for no CXF service to pass resteasy test case
---
 .../openejb/server/cxf/rs/CxfRsHttpListener.java   | 34 ++++++++++++----------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
index d05d213..2300c33 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
@@ -333,26 +333,28 @@ public class CxfRsHttpListener implements RsHttpListener {
     }
     
     public boolean isCXFResource(final HttpServletRequest request) {
-        final JAXRSServiceImpl service;
         try {
-            service = (JAXRSServiceImpl)server.getEndpoint().getService();
-        } finally { }
-        if( service == null ) {
-            return false;
-        }
+            JAXRSServiceImpl service = (JAXRSServiceImpl)server.getEndpoint().getService();
 
-        String pathToMatch = HttpUtils.getPathToMatch(request.getServletPath(), pattern, true);
-
-        final List<ClassResourceInfo> resources = service.getClassResourceInfos();
-        for (final ClassResourceInfo info : resources) {
-            if (info.getResourceClass() == null || info.getURITemplate() == null) { // possible?
-                continue;
+            if( service == null ) {
+                return false;
             }
-           
-            final MultivaluedMap<String, String> parameters = new MultivaluedHashMap<>();
-            if (info.getURITemplate().match(pathToMatch, parameters)) {
-                return true;
+
+            String pathToMatch = HttpUtils.getPathToMatch(request.getServletPath(), pattern, true);
+
+            final List<ClassResourceInfo> resources = service.getClassResourceInfos();
+            for (final ClassResourceInfo info : resources) {
+                if (info.getResourceClass() == null || info.getURITemplate() == null) { // possible?
+                    continue;
+                }
+               
+                final MultivaluedMap<String, String> parameters = new MultivaluedHashMap<>();
+                if (info.getURITemplate().match(pathToMatch, parameters)) {
+                    return true;
+                }
             }
+        } catch (final Exception e) {
+            LOGGER.error("No JAX-RS service", e);
         }
         return false;
     }