cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Making sure Swagger2Feature setLicense(null) still works
Date Wed, 30 Aug 2017 14:37:14 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 193c5c409 -> d0370a3d0


Making sure Swagger2Feature setLicense(null) still works


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

Branch: refs/heads/3.1.x-fixes
Commit: d0370a3d0ab3d082587c01659d4c81364c865ce0
Parents: 193c5c4
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Aug 30 15:28:33 2017 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Aug 30 15:36:51 2017 +0100

----------------------------------------------------------------------
 .../jaxrs/swagger/AbstractSwaggerFeature.java   |  2 ++
 .../cxf/jaxrs/swagger/Swagger2Feature.java      | 28 ++++++++++----------
 2 files changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d0370a3d/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
----------------------------------------------------------------------
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
index fc299ee..e3e86c4 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/AbstractSwaggerFeature.java
@@ -40,6 +40,7 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature {
         SWAGGER_JAXRS_AVAILABLE = isSwaggerJaxRsAvailable();
     }
 
+    protected boolean licenseWasSet;
     private boolean scan = true;
     private boolean runAsFilter;
     private boolean activateOnlyIfJaxrsSupported;
@@ -149,6 +150,7 @@ public abstract class AbstractSwaggerFeature extends AbstractFeature {
         return license;
     }
     public void setLicense(String license) {
+        this.licenseWasSet = true;
         this.license = license;
     }
     public String getLicenseUrl() {

http://git-wip-us.apache.org/repos/asf/cxf/blob/d0370a3d/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
----------------------------------------------------------------------
diff --git a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
index b5e12bf..dfbbf11 100644
--- a/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
+++ b/rt/rs/description-swagger/src/main/java/org/apache/cxf/jaxrs/swagger/Swagger2Feature.java
@@ -310,24 +310,24 @@ public class Swagger2Feature extends AbstractSwaggerFeature {
         
         // license
         String theLicense = getLicense();
-        if (theLicense == null && props != null) {
-            theLicense = props.getProperty(LICENSE_PROPERTY);
-        }
-        if (theLicense == null) {
-            theLicense = DEFAULT_LICENSE_VALUE;
-        } else if (theLicense.isEmpty()) {
-            theLicense = null;
+        if (theLicense == null && !licenseWasSet) {
+            if (props != null) {
+                theLicense = props.getProperty(LICENSE_PROPERTY);
+                if (theLicense.isEmpty()) {
+                    theLicense = null;
+                }
+            } else {
+                theLicense = DEFAULT_LICENSE_VALUE;
+            }
         }
         beanConfig.setLicense(theLicense);
         
         // license url
-        String theLicenseUrl = null;
-        if (!DEFAULT_LICENSE_VALUE.equals(theLicense)) {
-            theLicenseUrl = getLicenseUrl();
-            if (theLicenseUrl == null && props != null) {
-                theLicenseUrl = props.getProperty(LICENSE_URL_PROPERTY);
-            }
-        } else {
+        String theLicenseUrl = getLicenseUrl();
+        if (theLicenseUrl == null && props != null) {
+            theLicenseUrl = props.getProperty(LICENSE_URL_PROPERTY);
+        }
+        if (theLicenseUrl == null && DEFAULT_LICENSE_VALUE.equals(theLicense)) {
             theLicenseUrl = DEFAULT_LICENSE_URL;
         }
         beanConfig.setLicenseUrl(theLicenseUrl);


Mime
View raw message