From 2a12d09ac5844daf1c64a31df8fc956ccd07df0a Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Wed, 25 Oct 2017 11:40:38 +0300 Subject: [PATCH] Fix Java 9 issues (#109) Avoid forbidden import Bump GWT version --- pom.xml | 2 +- .../maven/wscdn/ClassPathExplorer.java | 144 +++++++++--------- 2 files changed, 71 insertions(+), 75 deletions(-) diff --git a/pom.xml b/pom.xml index 8e13ba08..cdf55115 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ ${project.version} - 2.8.0 + 2.8.2 ${vaadin.version} ${gwt.version} diff --git a/src/main/java/com/vaadin/integration/maven/wscdn/ClassPathExplorer.java b/src/main/java/com/vaadin/integration/maven/wscdn/ClassPathExplorer.java index ea1860e8..8c6f8e70 100644 --- a/src/main/java/com/vaadin/integration/maven/wscdn/ClassPathExplorer.java +++ b/src/main/java/com/vaadin/integration/maven/wscdn/ClassPathExplorer.java @@ -38,8 +38,6 @@ import com.vaadin.integration.maven.wscdn.CvalChecker.UnreachableCvalServerException; -import sun.net.www.protocol.file.FileURLConnection; - /** * Utility class to collect widgetset related information from classpath. * Utility will seek all directories from classpaths, and jar files having @@ -238,86 +236,84 @@ private static void searchForWidgetSetsAndAddonStyles( // and files in jar URLConnection openConnection = location.openConnection(); - if (openConnection instanceof JarURLConnection || openConnection instanceof FileURLConnection) { - - JarFile jarFile; - if (openConnection instanceof JarURLConnection) { - JarURLConnection conn = (JarURLConnection) openConnection; - jarFile = conn.getJarFile(); - } else { - jarFile = new JarFile(location.getFile()); - } - Manifest manifest = jarFile.getManifest(); - if (manifest == null) { - // No manifest so this is not a Vaadin Add-on - return; - } + JarFile jarFile; + if (openConnection instanceof JarURLConnection) { + JarURLConnection conn = (JarURLConnection) openConnection; + jarFile = conn.getJarFile(); + } else { + jarFile = new JarFile(location.getFile()); + } - // Check for widgetset attribute - String value = manifest.getMainAttributes().getValue( - "Vaadin-Widgetsets"); - if (value != null) { - String[] widgetsetNames = value.split(","); - for (int i = 0; i < widgetsetNames.length; i++) { - String widgetsetname = widgetsetNames[i].trim(); - if (!widgetsetname.equals("")) { - widgetsets.put(widgetsetname, location); - } + Manifest manifest = jarFile.getManifest(); + if (manifest == null) { + // No manifest so this is not a Vaadin Add-on + return; + } + + // Check for widgetset attribute + String value = manifest.getMainAttributes().getValue( + "Vaadin-Widgetsets"); + if (value != null) { + String[] widgetsetNames = value.split(","); + for (int i = 0; i < widgetsetNames.length; i++) { + String widgetsetname = widgetsetNames[i].trim(); + if (!widgetsetname.equals("")) { + widgetsets.put(widgetsetname, location); } + } - Attributes attribs = manifest.getMainAttributes(); - String license = attribs.getValue(VAADIN_ADDON_LICENSE); - String name = attribs.getValue(VAADIN_ADDON_NAME); - String vers = attribs.getValue(VAADIN_ADDON_VERSION) == null ? "" - : attribs.getValue(VAADIN_ADDON_VERSION); - String title = attribs.getValue(VAADIN_ADDON_TITLE) == null ? name - : attribs.getValue(VAADIN_ADDON_TITLE); - - String awidgetsets = attribs - .getValue(VAADIN_ADDON_WIDGETSET) == null ? name - : attribs.getValue( - VAADIN_ADDON_WIDGETSET); - - if (name != null && license != null) { - if (VAADIN_AGPL.equals(license)) { - // For agpl version, we don't care - } else if (VAADIN_CVAL.equals(license)) { - // We only check cval licensed products - CvalInfo info; - - try { - info = cvalChecker.validateProduct(name, - vers, - title); - printValidLicense(info, title, vers); - } catch (UnreachableCvalServerException e) { - info = new CvalInfo(); - final Product product = new Product(); - product.setName(name); - info.setProduct(product); - printServerUnreachable(title, vers); - } -// for (String w : awidgetsets.split("[, ]+")) { -// ret.add(new CValUiInfo(title, String -// .valueOf(computeMajorVersion(vers)), -// w, -// info.getType())); -// } + Attributes attribs = manifest.getMainAttributes(); + String license = attribs.getValue(VAADIN_ADDON_LICENSE); + String name = attribs.getValue(VAADIN_ADDON_NAME); + String vers = attribs.getValue(VAADIN_ADDON_VERSION) == null ? "" + : attribs.getValue(VAADIN_ADDON_VERSION); + String title = attribs.getValue(VAADIN_ADDON_TITLE) == null ? name + : attribs.getValue(VAADIN_ADDON_TITLE); + + String awidgetsets = attribs + .getValue(VAADIN_ADDON_WIDGETSET) == null ? name + : attribs.getValue( + VAADIN_ADDON_WIDGETSET); + + if (name != null && license != null) { + if (VAADIN_AGPL.equals(license)) { + // For agpl version, we don't care + } else if (VAADIN_CVAL.equals(license)) { + // We only check cval licensed products + CvalInfo info; + + try { + info = cvalChecker.validateProduct(name, + vers, + title); + printValidLicense(info, title, vers); + } catch (UnreachableCvalServerException e) { + info = new CvalInfo(); + final Product product = new Product(); + product.setName(name); + info.setProduct(product); + printServerUnreachable(title, vers); } +// for (String w : awidgetsets.split("[, ]+")) { +// ret.add(new CValUiInfo(title, String +// .valueOf(computeMajorVersion(vers)), +// w, +// info.getType())); +// } } } + } - // Check for theme attribute - value = manifest.getMainAttributes().getValue( - "Vaadin-Stylesheets"); - if (value != null) { - String[] stylesheets = value.split(","); - for (int i = 0; i < stylesheets.length; i++) { - String stylesheet = stylesheets[i].trim(); - if (!stylesheet.equals("")) { - addonStyles.put(stylesheet, location); - } + // Check for theme attribute + value = manifest.getMainAttributes().getValue( + "Vaadin-Stylesheets"); + if (value != null) { + String[] stylesheets = value.split(","); + for (int i = 0; i < stylesheets.length; i++) { + String stylesheet = stylesheets[i].trim(); + if (!stylesheet.equals("")) { + addonStyles.put(stylesheet, location); } } }