aboutsummaryrefslogtreecommitdiffstats
path: root/client-compiler/src
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan@vaadin.com>2014-12-15 15:07:15 +0200
committerVaadin Code Review <review@vaadin.com>2014-12-17 11:28:06 +0000
commit272711e6f7eed94d933380599cb434a5cfe38f00 (patch)
treef377c7c748809285bafd4bdf76855e68321bce48 /client-compiler/src
parent9b8022feaacf6ef11b509697ad8ccdd01b0262f5 (diff)
downloadvaadin-framework-272711e6f7eed94d933380599cb434a5cfe38f00.tar.gz
vaadin-framework-272711e6f7eed94d933380599cb434a5cfe38f00.zip
Fix the license checker after elemental.json #15383
The elemental.json update changed how null values and string representations of numbers were parsed, which caused a lot of tests for CvalChecker to fail. Unfortunately the tests were never run in an automated fashion, which means that they were never discovered until we stumbled upon it due to the issue reported in #15383 Change-Id: If2cb9fa96effea7ce55a4ffe6d1666ca7521e1fb
Diffstat (limited to 'client-compiler/src')
-rw-r--r--client-compiler/src/com/vaadin/tools/CvalChecker.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/client-compiler/src/com/vaadin/tools/CvalChecker.java b/client-compiler/src/com/vaadin/tools/CvalChecker.java
index b3345c7658..645667be94 100644
--- a/client-compiler/src/com/vaadin/tools/CvalChecker.java
+++ b/client-compiler/src/com/vaadin/tools/CvalChecker.java
@@ -35,16 +35,17 @@ import java.util.prefs.Preferences;
import org.apache.commons.io.IOUtils;
import elemental.json.JsonException;
+import elemental.json.JsonNull;
import elemental.json.JsonObject;
import elemental.json.impl.JsonUtil;
/**
* This class is able to validate the vaadin CVAL license.
- *
+ *
* It reads the developer license file and asks the server to validate the
* licenseKey. If the license is invalid it throws an exception with the
* information about the problem and the server response.
- *
+ *
* @since 7.3
*/
public final class CvalChecker {
@@ -80,6 +81,10 @@ public final class CvalChecker {
private static <T> T get(JsonObject o, String k, Class<T> clz) {
Object ret = null;
try {
+ if (o == null || o.get(k) == null
+ || o.get(k) instanceof JsonNull) {
+ return null;
+ }
if (clz == String.class) {
ret = o.getString(k);
} else if (clz == JsonObject.class) {
@@ -299,7 +304,7 @@ public final class CvalChecker {
/**
* Given a product name returns the name of the file with the license key.
- *
+ *
* Traditionally we have delivered license keys with a name like
* 'vaadin.touchkit.developer.license' but our database product name is
* 'vaadin-touchkit' so we have to replace '-' by '.' to maintain
@@ -340,7 +345,7 @@ public final class CvalChecker {
/**
* Validate whether there is a valid license key for a product.
- *
+ *
* @param productName
* for example vaadin-touchkit
* @param productVersion