diff --git a/src/main/java/javax0/license3j/RevocableLicense.java b/src/main/java/javax0/license3j/RevocableLicense.java
index a64e5d1..d452659 100644
--- a/src/main/java/javax0/license3j/RevocableLicense.java
+++ b/src/main/java/javax0/license3j/RevocableLicense.java
@@ -15,8 +15,8 @@
public class RevocableLicense {
final private static String REVOCATION_URL = "revocationUrl";
- HttpHandler httpHandler = new HttpHandler();
private final License license;
+ HttpHandler httpHandler = new HttpHandler();
public RevocableLicense(License license) {
this.license = license;
@@ -36,8 +36,10 @@ public RevocableLicense(License license) {
* @throws MalformedURLException when the revocation url is not well formatted
*/
public URL getRevocationURL() throws MalformedURLException {
- final var revocationURLTemplate = license.get(REVOCATION_URL).getString();
- final String revocationURL;
+ final Feature revocationURLFeature = license.get(REVOCATION_URL);
+ final var revocationURLTemplate = revocationURLFeature == null ?
+ null :
+ revocationURLFeature.getString();
if (revocationURLTemplate != null) {
final var id = Optional.ofNullable(license.getLicenseId()).orElse(license.fingerprint());
if (id != null) {
@@ -50,6 +52,17 @@ public URL getRevocationURL() throws MalformedURLException {
}
}
+ /**
+ * Set the revocation URL. Using this method is discouraged in case the URL
+ * contains the ${licenseId}
place holder. In that case it is
+ * recommended to use the {@link #setRevocationURL(String)} method instead.
+ *
+ * @param url the revocation url
+ */
+ public void setRevocationURL(final URL url) {
+ setRevocationURL(url.toString());
+ }
+
/**
* Set the revocation URL. This method accepts the url as a string that
* makes it possible to use a string that contains the
@@ -62,17 +75,6 @@ public void setRevocationURL(final String url) {
license.add(Feature.Create.stringFeature(REVOCATION_URL, url));
}
- /**
- * Set the revocation URL. Using this method is discouraged in case the URL
- * contains the ${licenseId}
place holder. In that case it is
- * recommended to use the {@link #setRevocationURL(String)} method instead.
- *
- * @param url the revocation url
- */
- public void setRevocationURL(final URL url) {
- setRevocationURL(url.toString());
- }
-
/**
* Check if the license was revoked or not. For more information see the
* documentation of the method {@link #isRevoked(boolean)}. Calling this
diff --git a/src/test/java/javax0/license3j/LicenseTest.java b/src/test/java/javax0/license3j/LicenseTest.java
index cb93c85..d7eace5 100644
--- a/src/test/java/javax0/license3j/LicenseTest.java
+++ b/src/test/java/javax0/license3j/LicenseTest.java
@@ -44,14 +44,14 @@ public void licenseSerializeAndDeserialize() {
Assertions.assertEquals("Peter Verhas", restored.get("owner").getString());
Assertions.assertEquals(now, restored.get("expiry").getDate());
Assertions.assertEquals("expiry:DATE=2018-12-17 12:55:19.295\n" +
- "owner:STRING=Peter Verhas\n" +
- "template:STRING=<>\n" +
- "null\n" +
- "title:STRING=<>\n" +
+ "null\n" +
+ "title=<>\n" +
- "null\n" +
- "title:STRING=<>\n" +
+ "null\n" +
+ "title=<