cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-7234] Using a class resource loader if no javadocloader has been set up
Date Fri, 27 Jan 2017 17:07:35 GMT
Repository: cxf
Updated Branches:
  refs/heads/master ca2c686ae -> bc73cc529


[CXF-7234] Using a class resource loader if no javadocloader has been set up


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/bc73cc52
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/bc73cc52
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/bc73cc52

Branch: refs/heads/master
Commit: bc73cc529292ea7282736caf75f01a30dd6afb1f
Parents: ca2c686
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Fri Jan 27 17:05:32 2017 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Fri Jan 27 17:07:02 2017 +0000

----------------------------------------------------------------------
 .../cxf/jaxrs/model/doc/JavaDocProvider.java    | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/bc73cc52/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java
index 5e702fe..8c1b914 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/doc/JavaDocProvider.java
@@ -47,12 +47,13 @@ public class JavaDocProvider implements DocumentationProvider {
     private final ConcurrentHashMap<String, ClassDocs> docs = new ConcurrentHashMap<>();
     private double javaDocsBuiltByVersion = JAVA_VERSION;
     
+    public JavaDocProvider() {
+    }
+    
     public JavaDocProvider(URL... javaDocUrls) {
-        if (javaDocUrls == null) {
-            throw new IllegalArgumentException("URL are null");
+        if (javaDocUrls != null) {
+            javaDocLoader = new URLClassLoader(javaDocUrls);
         }
-        
-        javaDocLoader = new URLClassLoader(javaDocUrls);
     }
     
     public JavaDocProvider(String path) throws Exception {
@@ -64,15 +65,13 @@ public class JavaDocProvider implements DocumentationProvider {
     }
     
     public JavaDocProvider(Bus bus, String... paths) throws Exception {
-        if (paths == null) {
-            throw new IllegalArgumentException("paths are null");
-        }
-
-        URL[] javaDocUrls = new URL[paths.length];
-        for (int i = 0; i < paths.length; i++) {
-            javaDocUrls[i] = ResourceUtils.getResourceURL(paths[i], bus);
+        if (paths != null) {
+            URL[] javaDocUrls = new URL[paths.length];
+            for (int i = 0; i < paths.length; i++) {
+                javaDocUrls[i] = ResourceUtils.getResourceURL(paths[i], bus);
+            }
+            javaDocLoader = new URLClassLoader(javaDocUrls);
         }
-        javaDocLoader = new URLClassLoader(javaDocUrls);
     }
     
     private static double getVersion() {
@@ -165,7 +164,8 @@ public class JavaDocProvider implements DocumentationProvider {
         String resource = annotatedClass.getName().replace(".", "/") + ".html";
         ClassDocs classDocs = docs.get(resource);
         if (classDocs == null) {
-            InputStream resourceStream = javaDocLoader.getResourceAsStream(resource);
+            ClassLoader loader = javaDocLoader != null ? javaDocLoader : annotatedClass.getClassLoader();
 
+            InputStream resourceStream = loader.getResourceAsStream(resource);
             if (resourceStream != null) {
                 String doc = IOUtils.readStringFromStream(resourceStream);
                 


Mime
View raw message