summaryrefslogtreecommitdiffstats
path: root/client-compiler/src/com/vaadin
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-08-19 09:40:20 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-08-19 09:42:27 +0300
commitc1a873bc9e47b98c58b298aa6935ab0853e6963f (patch)
tree3e8b209c54961473161335159bc98f9316d28a09 /client-compiler/src/com/vaadin
parent2caaea2df9d558f0ce67daa3b0641cb832538506 (diff)
parent4dcace7123b605115efcbb395a320d460eed9c0e (diff)
downloadvaadin-framework-c1a873bc9e47b98c58b298aa6935ab0853e6963f.tar.gz
vaadin-framework-c1a873bc9e47b98c58b298aa6935ab0853e6963f.zip
Merge remote-tracking branch 'origin/master' into grid
Change-Id: Iac6947bc82bfbbb6856a924e7d538d195cfb405e
Diffstat (limited to 'client-compiler/src/com/vaadin')
-rw-r--r--client-compiler/src/com/vaadin/tools/CvalChecker.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/client-compiler/src/com/vaadin/tools/CvalChecker.java b/client-compiler/src/com/vaadin/tools/CvalChecker.java
index 2de7e10faa..e426c5c4e6 100644
--- a/client-compiler/src/com/vaadin/tools/CvalChecker.java
+++ b/client-compiler/src/com/vaadin/tools/CvalChecker.java
@@ -26,6 +26,7 @@ import java.net.URLConnection;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Date;
+import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.prefs.Preferences;
@@ -465,7 +466,8 @@ public final class CvalChecker {
if (url != null) {
try {
- key = IOUtils.toString(url.openStream());
+ key = readKeyFromFile(url,
+ computeMajorVersion(productVersion));
if (key != null && !(key = key.trim()).isEmpty()) {
return key;
}
@@ -480,6 +482,22 @@ public final class CvalChecker {
productTitle, null, null);
}
+ String readKeyFromFile(URL url, int majorVersion) throws IOException {
+ String majorVersionStr = String.valueOf(majorVersion);
+ List<String> lines = IOUtils.readLines(url.openStream());
+ String defaultKey = null;
+ for (String line : lines) {
+ String[] parts = line.split("\\s*=\\s*");
+ if (parts.length < 2) {
+ defaultKey = parts[0].trim();
+ }
+ if (parts[0].equals(majorVersionStr)) {
+ return parts[1].trim();
+ }
+ }
+ return defaultKey;
+ }
+
static String getErrorMessage(String key, Object... pars) {
Locale loc = Locale.getDefault();
ResourceBundle res = ResourceBundle.getBundle(