cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [cxf] 02/02: [CXF-8041]catch unchecked exceptions for all ResourceResolvers so all ResourceResolvers have chance to run
Date Thu, 23 May 2019 17:46:20 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 513f83ecbadcae805d541ee246bf1ae0e80fda53
Author: Freeman Fang <freeman.fang@gmail.com>
AuthorDate: Thu May 23 13:46:06 2019 -0400

    [CXF-8041]catch unchecked exceptions for all ResourceResolvers so all ResourceResolvers
have chance to run
---
 .../org/apache/cxf/resource/DefaultResourceManager.java   | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java b/core/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java
index 8088b56..d20f95a 100644
--- a/core/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java
+++ b/core/src/main/java/org/apache/cxf/resource/DefaultResourceManager.java
@@ -114,7 +114,20 @@ public class DefaultResourceManager implements ResourceManager {
             if (asStream) {
                 ret = type.cast(rr.getAsStream(name));
             } else {
-                ret = rr.resolve(name, type);
+                try  {
+                    ret = rr.resolve(name, type);
+                } catch (RuntimeException ex) {
+                    //ResourceResolver.resolve method expected to 
+                    //return an instance of the resource or null if the
+                    //resource cannot be resolved. So we just catch 
+                    //Unchecked exceptions during resolving resource and log it.   
+                    //So other ResourceResolver get chance to be used
+                    if (LOG.isLoggable(Level.FINE)) {
+                        LOG.log(Level.FINE, 
+                             "run into exception when using" + rr.getClass().getName(), ex);
+                    }
+
+                }
             }
             if (ret != null) {
                 break;


Mime
View raw message