cxf git commit: Making sure Swagger2Feature setLicense(null) still works

2017-08-30 Thread sergeyb
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 
Authored: Wed Aug 30 15:28:33 2017 +0100
Committer: Sergey Beryozkin 
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);



cxf git commit: Making sure Swagger2Feature setLicense(null) still works

2017-08-30 Thread sergeyb
Repository: cxf
Updated Branches:
  refs/heads/master 76145af39 -> df0c72713


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/df0c7271
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/df0c7271
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/df0c7271

Branch: refs/heads/master
Commit: df0c727132630165ff2c58d93c1f0cfc7eb68a4c
Parents: 76145af
Author: Sergey Beryozkin 
Authored: Wed Aug 30 15:28:33 2017 +0100
Committer: Sergey Beryozkin 
Committed: Wed Aug 30 15:28:33 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/df0c7271/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 e1da558..a2f9a4c 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
@@ -37,6 +37,7 @@ public abstract class AbstractSwaggerFeature extends 
AbstractFeature {
 SWAGGER_JAXRS_AVAILABLE = isSwaggerJaxRsAvailable();
 }
 
+protected boolean licenseWasSet;
 private boolean runAsFilter;
 private boolean activateOnlyIfJaxrsSupported;
 private String resourcePackage;
@@ -144,6 +145,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/df0c7271/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 d27551b..eab36a6 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
@@ -285,24 +285,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);