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 2017/10/04 09:42:14 UTC

[cxf] branch 3.1.x-fixes updated: [CXF-7512] Checking the bundle resource if no maven location is set

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

sergeyb pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
     new b78fd7a  [CXF-7512] Checking the bundle resource if no maven location is set
b78fd7a is described below

commit b78fd7ac253493ecf5ea431ac6956a57a57fe28b
Author: Sergey Beryozkin <sb...@gmail.com>
AuthorDate: Wed Oct 4 10:38:49 2017 +0100

    [CXF-7512] Checking the bundle resource if no maven location is set
---
 .../org/apache/cxf/jaxrs/swagger/OsgiSwaggerUiResolver.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/OsgiSwaggerUiResolver.java b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/OsgiSwaggerUiResolver.java
index 5a2e397..2052d5c 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/OsgiSwaggerUiResolver.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/OsgiSwaggerUiResolver.java
@@ -47,6 +47,7 @@ public class OsgiSwaggerUiResolver extends SwaggerUiResolver {
             String[] locations = swaggerUiMavenGroupAndArtifact == null ? DEFAULT_LOCATIONS
                 : new String[]{"mvn:" + swaggerUiMavenGroupAndArtifact + "/",
                                "wrap:mvn:" + swaggerUiMavenGroupAndArtifact + "/"};
+            
             for (Bundle b : bundle.getBundleContext().getBundles()) {
                 String location = b.getLocation();
 
@@ -62,6 +63,12 @@ public class OsgiSwaggerUiResolver extends SwaggerUiResolver {
                         return getSwaggerUiRoot(b, swaggerUiVersion);
                     }
                 }
+                if (swaggerUiMavenGroupAndArtifact == null) {
+                    String rootCandidate = getSwaggerUiRoot(b, swaggerUiVersion);
+                    if (rootCandidate != null) {
+                        return rootCandidate;
+                    }
+                }
             }
         } catch (Throwable ex) {
             // ignore
@@ -70,6 +77,9 @@ public class OsgiSwaggerUiResolver extends SwaggerUiResolver {
     }
 
     private String getSwaggerUiRoot(Bundle b, String swaggerUiVersion) {
+        if (swaggerUiVersion == null) { 
+            swaggerUiVersion = "";
+        }
         URL entry = b.getEntry(SwaggerUiResolver.UI_RESOURCES_ROOT_START + swaggerUiVersion);
         if (entry != null) {
             return entry.toString() + "/";

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].