summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-12-20 11:31:04 +0200
committerVaadin Code Review <review@vaadin.com>2014-01-21 06:43:46 +0000
commit62ac53a97584317555be83135c6a1d64f3ecbf8f (patch)
tree9913cbbb612e8536daa77ebfca6db7ecb178239f /server/src
parent1d1ccf41991856b2065da335e434f95e5161843d (diff)
downloadvaadin-framework-62ac53a97584317555be83135c6a1d64f3ecbf8f.tar.gz
vaadin-framework-62ac53a97584317555be83135c6a1d64f3ecbf8f.zip
Ensure widgetset compile messages go to stdout (#7516)
Change-Id: Ibd6efa1db419e2dcf1d5f5d97c2a5c988d99a230
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java75
1 files changed, 47 insertions, 28 deletions
diff --git a/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
index cc04e50b3c..3ad76794de 100644
--- a/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
+++ b/server/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
@@ -32,8 +32,6 @@ import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
-import java.util.logging.Level;
-import java.util.logging.Logger;
/**
* Utility class to collect widgetset related information from classpath.
@@ -111,6 +109,15 @@ public class ClassPathExplorer {
*/
private static Map<String, URL> classpathLocations = getClasspathLocations(rawClasspathEntries);
+ private static boolean debug = false;
+
+ static {
+ String debugProperty = System.getProperty("debug");
+ if (debugProperty != null && !debugProperty.equals("")) {
+ debug = true;
+ }
+ }
+
/**
* No instantiation from outside, callable methods are static.
*/
@@ -163,9 +170,8 @@ public class ClassPathExplorer {
sb.append("\n");
}
- final Logger logger = getLogger();
- logger.info(sb.toString());
- logger.info("Search took " + (end - start) + "ms");
+ log(sb.toString());
+ log("Search took " + (end - start) + "ms");
return new LocationInfo(widgetsets, themes);
}
@@ -226,8 +232,7 @@ public class ClassPathExplorer {
} catch (MalformedURLException e) {
// should never happen as based on an existing URL,
// only changing end of file name/path part
- getLogger().log(Level.SEVERE,
- "Error locating the widgetset " + classname, e);
+ error("Error locating the widgetset " + classname, e);
}
}
}
@@ -276,7 +281,7 @@ public class ClassPathExplorer {
}
}
} catch (IOException e) {
- getLogger().log(Level.WARNING, "Error parsing jar file", e);
+ error("Error parsing jar file", e);
}
}
@@ -304,7 +309,7 @@ public class ClassPathExplorer {
classpath = classpath.substring(0, classpath.length() - 1);
}
- getLogger().log(Level.FINE, "Classpath: {0}", classpath);
+ debug("Classpath: " + classpath);
String[] split = classpath.split(pathSep);
for (int i = 0; i < split.length; i++) {
@@ -338,9 +343,8 @@ public class ClassPathExplorer {
include(null, file, locations);
}
long end = System.currentTimeMillis();
- Logger logger = getLogger();
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("getClassPathLocations took " + (end - start) + "ms");
+ if (debug) {
+ debug("getClassPathLocations took " + (end - start) + "ms");
}
return locations;
}
@@ -379,7 +383,8 @@ public class ClassPathExplorer {
url = new URL("jar:" + url.toExternalForm() + "!/");
JarURLConnection conn = (JarURLConnection) url
.openConnection();
- getLogger().fine(url.toString());
+ debug(url.toString());
+
JarFile jarFile = conn.getJarFile();
Manifest manifest = jarFile.getManifest();
if (manifest != null) {
@@ -393,11 +398,13 @@ public class ClassPathExplorer {
}
}
} catch (MalformedURLException e) {
- getLogger().log(Level.FINEST, "Failed to inspect JAR file",
- e);
+ if (debug) {
+ error("Failed to inspect JAR file", e);
+ }
} catch (IOException e) {
- getLogger().log(Level.FINEST, "Failed to inspect JAR file",
- e);
+ if (debug) {
+ error("Failed to inspect JAR file", e);
+ }
}
return false;
@@ -489,14 +496,12 @@ public class ClassPathExplorer {
*/
public static URL getDefaultSourceDirectory() {
- final Logger logger = getLogger();
-
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("classpathLocations values:");
+ if (debug) {
+ debug("classpathLocations values:");
ArrayList<String> locations = new ArrayList<String>(
classpathLocations.keySet());
for (String location : locations) {
- logger.fine(String.valueOf(classpathLocations.get(location)));
+ debug(String.valueOf(classpathLocations.get(location)));
}
}
@@ -510,11 +515,15 @@ public class ClassPathExplorer {
try {
return new URL("file://" + directory.getCanonicalPath());
} catch (MalformedURLException e) {
- logger.log(Level.FINEST, "Ignoring exception", e);
// ignore: continue to the next classpath entry
+ if (debug) {
+ e.printStackTrace();
+ }
} catch (IOException e) {
- logger.log(Level.FINEST, "Ignoring exception", e);
// ignore: continue to the next classpath entry
+ if (debug) {
+ e.printStackTrace();
+ }
}
}
}
@@ -525,14 +534,24 @@ public class ClassPathExplorer {
* Test method for helper tool
*/
public static void main(String[] args) {
- getLogger().info(
- "Searching for available widgetsets and stylesheets...");
+ log("Searching for available widgetsets and stylesheets...");
ClassPathExplorer.getAvailableWidgetSetsAndStylesheets();
}
- private static final Logger getLogger() {
- return Logger.getLogger(ClassPathExplorer.class.getName());
+ private static void log(String message) {
+ System.out.println(message);
+ }
+
+ private static void error(String message, Exception e) {
+ System.err.println(message);
+ e.printStackTrace();
+ }
+
+ private static void debug(String message) {
+ if (debug) {
+ System.out.println(message);
+ }
}
}