summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordenisanisimov <denis@vaadin.com>2014-02-05 09:23:43 +0200
committerVaadin Code Review <review@vaadin.com>2014-02-06 07:53:46 +0000
commitbfe548e6d611760d2a393a7fc1d1cb2873c69e23 (patch)
treef82c14b861d4851373d7d663d6ff3fece428ce86
parentd596adfa5c575cad8d57dd64b916ecbfc9d48d7b (diff)
downloadvaadin-framework-bfe548e6d611760d2a393a7fc1d1cb2873c69e23.tar.gz
vaadin-framework-bfe548e6d611760d2a393a7fc1d1cb2873c69e23.zip
Use Logger instead of System.out and System.err (#10328,#13300).
Change-Id: I6a93e763c212eb39d7da9fdbd38f6a8609799c34
-rw-r--r--common.xml6
-rw-r--r--theme-compiler/build.xml4
-rw-r--r--theme-compiler/src/com/vaadin/sass/CustomConsoleHandler.java52
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java17
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java33
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java36
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java29
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java8
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj6
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/parser/ParserTokenManager.java2
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/selector/SelectorUtil.java13
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/tree/BlockNode.java5
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/tree/ExtendNode.java5
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/tree/MixinNode.java5
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/tree/controldirective/IfElseDefNode.java6
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/util/DeepCopy.java12
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java8
-rw-r--r--theme-compiler/src/logging.properties2
18 files changed, 191 insertions, 58 deletions
diff --git a/common.xml b/common.xml
index a1c086c57a..a49c25c6be 100644
--- a/common.xml
+++ b/common.xml
@@ -139,6 +139,7 @@
<fileset dir="${src}">
<patternset>
<include name="**/*.java" />
+ <include name="**/*.properties" />
</patternset>
</fileset>
<fileset refid="common.files.for.all.jars" />
@@ -184,7 +185,7 @@
<property name="src" location="{$result.dir}/../src" />
<union id="jar.files">
- <fileset dir="${classes}" excludes="${classes.exclude}" erroronmissingdir="false" />
+ <fileset dir="${classes}" excludes="${classes.exclude}" erroronmissingdir="false"/>
<fileset dir="${src}" excludes="${jar.exclude}" erroronmissingdir="false" />
<fileset refid="common.files.for.all.jars" />
<union refid="extra.jar.includes" />
@@ -277,6 +278,9 @@
<classpath refid="classpath.compile.dependencies" />
<classpath refid="classpath.compile.custom" />
</javac>
+ <copy todir="${classes}">
+ <fileset dir="${src}" includes="${extra.classes}"/>
+ </copy>
</target>
<target name="exec-buildhelper" depends="compile">
diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml
index 03d0531a68..aed0f91fbb 100644
--- a/theme-compiler/build.xml
+++ b/theme-compiler/build.xml
@@ -20,8 +20,8 @@
</path>
<path id="classpath.test.custom" />
- <!--<property name="classes.exclude" value="com/vaadin/buildhelpers/**"
- /> -->
+ <property name="classes.exclude" value="**/*.properties"/>
+ <property name="extra.classes" value="${classes.exclude}"/>
<target name="parser">
<!-- Copy javacc-5.0.jar to ${result.dir}/javacc/javacc.jar as the
diff --git a/theme-compiler/src/com/vaadin/sass/CustomConsoleHandler.java b/theme-compiler/src/com/vaadin/sass/CustomConsoleHandler.java
new file mode 100644
index 0000000000..44c9e345db
--- /dev/null
+++ b/theme-compiler/src/com/vaadin/sass/CustomConsoleHandler.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.sass;
+
+import java.io.PrintStream;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+/**
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class CustomConsoleHandler extends ConsoleHandler {
+
+ private ConsoleHandler stdoutHandler;
+
+ public CustomConsoleHandler() {
+ PrintStream err = System.err;
+ /*
+ * ConsoleHandler uses System.err to output all messages. Replace
+ * System.err temporary to construct ConsoleHandler and set it back
+ * after construction.
+ */
+ System.setErr(System.out);
+ stdoutHandler = new ConsoleHandler();
+ System.setErr(err);
+ }
+
+ @Override
+ public void publish(LogRecord record) {
+ if (!Level.SEVERE.equals(record.getLevel())) {
+ stdoutHandler.publish(record);
+ } else {
+ super.publish(record);
+ }
+ }
+}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
index ed6b98f5ac..63f59cdfab 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
@@ -24,11 +24,13 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.logging.LogManager;
import java.util.logging.Logger;
import org.w3c.css.sac.CSSException;
import org.w3c.css.sac.InputSource;
+import com.vaadin.buildhelpers.CompileTheme;
import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
import com.vaadin.sass.internal.handler.SCSSErrorHandler;
@@ -457,4 +459,19 @@ public class ScssStylesheet extends Node {
public void setCharset(String charset) {
this.charset = charset;
}
+
+ static {
+ String logFile = System.getProperty("java.util.logging.config.file");
+ if (logFile == null) {
+ try {
+ LogManager.getLogManager().readConfiguration(
+ CompileTheme.class
+ .getResourceAsStream("/logging.properties"));
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java b/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java
index 99f00e3889..aa6d39fd77 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSDocumentHandlerImpl.java
@@ -20,6 +20,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Stack;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.w3c.css.sac.CSSException;
import org.w3c.css.sac.InputSource;
@@ -98,7 +100,7 @@ public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler {
public ForNode forDirective(String var, String from, String to,
boolean exclusive, String body) {
ForNode node = new ForNode(var, from, to, exclusive, body);
- System.out.println(node);
+ log(node);
return node;
}
@@ -126,7 +128,7 @@ public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler {
@Override
public WhileNode whileDirective(String condition, String body) {
WhileNode node = new WhileNode(condition, body);
- System.out.println(node);
+ log(node);
return node;
}
@@ -138,14 +140,14 @@ public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler {
@Override
public void ignorableAtRule(String atRule) throws CSSException {
- System.out.println("ignorableAtRule(String atRule): " + atRule);
+ log("ignorableAtRule(String atRule): " + atRule);
}
@Override
public void namespaceDeclaration(String prefix, String uri)
throws CSSException {
- System.out.println("namespaceDeclaration(String prefix, String uri): "
- + prefix + ", " + uri);
+ log("namespaceDeclaration(String prefix, String uri): " + prefix + ", "
+ + uri);
}
@Override
@@ -167,14 +169,14 @@ public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler {
@Override
public void startPage(String name, String pseudo_page) throws CSSException {
- System.out.println("startPage(String name, String pseudo_page): "
- + name + ", " + pseudo_page);
+ log("startPage(String name, String pseudo_page): " + name + ", "
+ + pseudo_page);
}
@Override
public void endPage(String name, String pseudo_page) throws CSSException {
- System.out.println("endPage(String name, String pseudo_page): " + name
- + ", " + pseudo_page);
+ log("endPage(String name, String pseudo_page): " + name + ", "
+ + pseudo_page);
}
@Override
@@ -386,4 +388,17 @@ public class SCSSDocumentHandlerImpl implements SCSSDocumentHandler {
public void endIncludeContentBlock() {
nodeStack.pop();
}
+
+ private void log(Object object) {
+ if (object != null) {
+ log(object.toString());
+ } else {
+ log(null);
+ }
+ }
+
+ private void log(String msg) {
+ Logger.getLogger(SCSSDocumentHandlerImpl.class.getName()).log(
+ Level.INFO, msg);
+ }
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java b/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java
index 0d48da34e4..a7c65073ee 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/handler/SCSSErrorHandler.java
@@ -15,7 +15,8 @@
*/
package com.vaadin.sass.internal.handler;
-import java.io.PrintStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.w3c.css.sac.CSSException;
import org.w3c.css.sac.CSSParseException;
@@ -23,38 +24,33 @@ import org.w3c.css.sac.ErrorHandler;
public class SCSSErrorHandler implements ErrorHandler {
- private PrintStream errorStream;
-
- public SCSSErrorHandler(PrintStream errorStream) {
- this.errorStream = errorStream;
- }
-
public SCSSErrorHandler() {
- this(System.out);
}
@Override
public void error(CSSParseException arg0) throws CSSException {
- errorStream.println("Error when parsing file \n" + arg0.getURI()
- + " on line " + arg0.getLineNumber() + ", column "
- + arg0.getColumnNumber());
- errorStream.println(arg0.getMessage() + "\n");
+ log("Error when parsing file \n" + arg0.getURI() + " on line "
+ + arg0.getLineNumber() + ", column " + arg0.getColumnNumber());
+ log(arg0.getMessage() + "\n");
}
@Override
public void fatalError(CSSParseException arg0) throws CSSException {
- errorStream.println("FATAL Error when parsing file \n" + arg0.getURI()
- + " on line " + arg0.getLineNumber() + ", column "
- + arg0.getColumnNumber());
- errorStream.println(arg0.getMessage() + "\n");
+ log("FATAL Error when parsing file \n" + arg0.getURI() + " on line "
+ + arg0.getLineNumber() + ", column " + arg0.getColumnNumber());
+ log(arg0.getMessage() + "\n");
}
@Override
public void warning(CSSParseException arg0) throws CSSException {
- errorStream.println("Warning when parsing file \n" + arg0.getURI()
- + " on line " + arg0.getLineNumber() + ", column "
- + arg0.getColumnNumber());
- errorStream.println(arg0.getMessage() + "\n");
+ log("Warning when parsing file \n" + arg0.getURI() + " on line "
+ + arg0.getLineNumber() + ", column " + arg0.getColumnNumber());
+ log(arg0.getMessage() + "\n");
+ }
+
+ private void log(String msg) {
+ Logger.getLogger(SCSSDocumentHandlerImpl.class.getName()).log(
+ Level.SEVERE, msg);
}
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java b/theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java
index ac244a9582..35589e0a94 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/parser/LocatorImpl.java
@@ -23,8 +23,13 @@
*/
package com.vaadin.sass.internal.parser;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import org.w3c.css.sac.Locator;
+import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
+
/**
* @version $Revision: 1.2 $
* @author Philippe Le Hegaret
@@ -51,14 +56,17 @@ public class LocatorImpl implements Locator {
int line;
int column;
+ @Override
public String getURI() {
return uri;
}
+ @Override
public int getLineNumber() {
return line;
}
+ @Override
public int getColumnNumber() {
return column;
}
@@ -68,7 +76,7 @@ public class LocatorImpl implements Locator {
*/
public LocatorImpl(Parser p) {
if (W3CDebug) {
- System.err.println("LocatorImpl::newLocator(" + p + ");");
+ log("LocatorImpl::newLocator(" + p + ");");
}
uri = p.source.getURI();
line = p.token.beginLine;
@@ -80,8 +88,7 @@ public class LocatorImpl implements Locator {
*/
public LocatorImpl(Parser p, Token tok) {
if (W3CDebug) {
- System.err.println("LocatorImpl::newLocator(" + p + ", " + tok
- + ");");
+ log("LocatorImpl::newLocator(" + p + ", " + tok + ");");
}
uri = p.source.getURI();
line = tok.beginLine;
@@ -93,8 +100,8 @@ public class LocatorImpl implements Locator {
*/
public LocatorImpl(Parser p, int line, int column) {
if (W3CDebug) {
- System.err.println("LocatorImpl::newLocator(" + p + ", " + line
- + ", " + column + ");");
+ log("LocatorImpl::newLocator(" + p + ", " + line + ", " + column
+ + ");");
}
uri = p.source.getURI();
this.line = line;
@@ -106,7 +113,7 @@ public class LocatorImpl implements Locator {
*/
public LocatorImpl reInit(Parser p) {
if (W3CDebug) {
- System.err.println("LocatorImpl::reInit(" + p + ");");
+ log("LocatorImpl::reInit(" + p + ");");
}
uri = p.source.getURI();
line = p.token.beginLine;
@@ -119,7 +126,7 @@ public class LocatorImpl implements Locator {
*/
public LocatorImpl reInit(Parser p, Token tok) {
if (W3CDebug) {
- System.err.println("LocatorImpl::reInit(" + p + ", " + tok + ");");
+ log("LocatorImpl::reInit(" + p + ", " + tok + ");");
}
uri = p.source.getURI();
line = tok.beginLine;
@@ -132,12 +139,16 @@ public class LocatorImpl implements Locator {
*/
public LocatorImpl reInit(Parser p, int line, int column) {
if (W3CDebug) {
- System.err.println("LocatorImpl::reInit(" + p + ", " + line + ", "
- + column + ");");
+ log("LocatorImpl::reInit(" + p + ", " + line + ", " + column + ");");
}
uri = p.source.getURI();
this.line = line;
this.column = column;
return this;
}
+
+ private void log(String msg) {
+ Logger.getLogger(SCSSDocumentHandlerImpl.class.getName()).log(
+ Level.SEVERE, msg);
+ }
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java
index 2615ef322f..79dd65e805 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java
@@ -22,6 +22,8 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.w3c.css.sac.ConditionFactory;
import org.w3c.css.sac.Condition;
@@ -1203,7 +1205,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
} finally {
if (start) {
- documentHandler.endMedia(ml);
+ documentHandler.endMedia(ml);
}
}
}
@@ -4527,7 +4529,7 @@ boolean isPseudoElement = false;
jj_consume_token(DEBUG_SYM);
String content = skipStatementUntilSemiColon();
// TODO should evaluate the content expression, call documentHandler.debugDirective() etc.
- System.out.println(content);
+ Logger.getLogger(Parser.class.getName()).log(Level.INFO, content);
label_138:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -4546,7 +4548,7 @@ boolean isPseudoElement = false;
jj_consume_token(WARN_SYM);
String content = skipStatementUntilSemiColon();
// TODO should evaluate the content expression, call documentHandler.warnDirective() etc.
- System.err.println(content);
+ Logger.getLogger(Parser.class.getName()).log(Level.SEVERE, content);
label_139:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj
index 196e02878a..f4752a502a 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj
+++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj
@@ -40,6 +40,8 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.w3c.css.sac.ConditionFactory;
import org.w3c.css.sac.Condition;
@@ -1937,7 +1939,7 @@ void debugDirective() :
{
String content = skipStatementUntilSemiColon();
// TODO should evaluate the content expression, call documentHandler.debugDirective() etc.
- System.out.println(content);
+ Logger.getLogger(Parser.class.getName()).log(Level.INFO, content);
}
(<S>)*
}
@@ -1949,7 +1951,7 @@ void warnDirective() :
{
String content = skipStatementUntilSemiColon();
// TODO should evaluate the content expression, call documentHandler.warnDirective() etc.
- System.err.println(content);
+ Logger.getLogger(Parser.class.getName()).log(Level.SEVERE, content);
}
(<S>)*
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/ParserTokenManager.java b/theme-compiler/src/com/vaadin/sass/internal/parser/ParserTokenManager.java
index d54ab4fa7e..0db4e4e2f8 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/parser/ParserTokenManager.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/parser/ParserTokenManager.java
@@ -21,6 +21,8 @@ import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.w3c.css.sac.ConditionFactory;
import org.w3c.css.sac.Condition;
import org.w3c.css.sac.SelectorFactory;
diff --git a/theme-compiler/src/com/vaadin/sass/internal/selector/SelectorUtil.java b/theme-compiler/src/com/vaadin/sass/internal/selector/SelectorUtil.java
index 744b560116..c1f26f968e 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/selector/SelectorUtil.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/selector/SelectorUtil.java
@@ -16,6 +16,9 @@
package com.vaadin.sass.internal.selector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import org.w3c.css.sac.CombinatorCondition;
import org.w3c.css.sac.Condition;
import org.w3c.css.sac.ConditionFactory;
@@ -115,7 +118,7 @@ public class SelectorUtil {
} else if (selector.getSelectorType() == CompositeSelector.SCSS_COMPOSITE_SELECTOR) {
return toString((CompositeSelector) selector);
} else {
- System.out.println("SU !Unknown selector type, type: "
+ log("SU !Unknown selector type, type: "
+ selector.getSelectorType() + ", " + selector.toString());
}
return "";
@@ -162,8 +165,8 @@ public class SelectorUtil {
PseudoClassConditionImpl pseudoClassCondition = (PseudoClassConditionImpl) condition;
return ":" + pseudoClassCondition.getValue();
} else {
- System.out.println("CU !condition type not identified, type: "
- + conditionType + ", " + condition.toString());
+ log("CU !condition type not identified, type: " + conditionType
+ + ", " + condition.toString());
return "";
}
}
@@ -330,4 +333,8 @@ public class SelectorUtil {
throw new Exception("Invalid selector type");
}
}
+
+ private static void log(String msg) {
+ Logger.getLogger(SelectorUtil.class.getName()).log(Level.INFO, msg);
+ }
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/tree/BlockNode.java b/theme-compiler/src/com/vaadin/sass/internal/tree/BlockNode.java
index 6ce67a3abd..8db522ea1a 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/tree/BlockNode.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/tree/BlockNode.java
@@ -17,6 +17,8 @@
package com.vaadin.sass.internal.tree;
import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.vaadin.sass.internal.ScssStylesheet;
import com.vaadin.sass.internal.visitor.BlockNodeHandler;
@@ -109,7 +111,8 @@ public class BlockNode extends Node implements IVariableNode {
BlockNodeHandler.traverse(this);
replaceVariables(ScssStylesheet.getVariables());
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(BlockNode.class.getName()).log(Level.SEVERE, null,
+ e);
}
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/tree/ExtendNode.java b/theme-compiler/src/com/vaadin/sass/internal/tree/ExtendNode.java
index 417849d13b..dcabd2ff01 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/tree/ExtendNode.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/tree/ExtendNode.java
@@ -17,6 +17,8 @@
package com.vaadin.sass.internal.tree;
import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.vaadin.sass.internal.visitor.ExtendNodeHandler;
@@ -54,7 +56,8 @@ public class ExtendNode extends Node implements IVariableNode {
ExtendNodeHandler.traverse(this);
getParentNode().removeChild(this);
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(ExtendNode.class.getName()).log(Level.SEVERE,
+ null, e);
}
}
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/tree/MixinNode.java b/theme-compiler/src/com/vaadin/sass/internal/tree/MixinNode.java
index e702bc8577..c5ffb6d73d 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/tree/MixinNode.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/tree/MixinNode.java
@@ -19,6 +19,8 @@ package com.vaadin.sass.internal.tree;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import com.vaadin.sass.internal.ScssStylesheet;
import com.vaadin.sass.internal.parser.LexicalUnitImpl;
@@ -119,7 +121,8 @@ public class MixinNode extends Node implements IVariableNode {
ScssStylesheet.closeVariableScope(variableScope);
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(MixinNode.class.getName()).log(Level.SEVERE, null,
+ e);
}
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/tree/controldirective/IfElseDefNode.java b/theme-compiler/src/com/vaadin/sass/internal/tree/controldirective/IfElseDefNode.java
index 735d83a898..8449a9d891 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/tree/controldirective/IfElseDefNode.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/tree/controldirective/IfElseDefNode.java
@@ -15,6 +15,9 @@
*/
package com.vaadin.sass.internal.tree.controldirective;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import com.vaadin.sass.internal.tree.Node;
import com.vaadin.sass.internal.visitor.IfElseNodeHandler;
@@ -40,7 +43,8 @@ public class IfElseDefNode extends Node {
IfElseNodeHandler.traverse(this);
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(IfElseDefNode.class.getName()).log(Level.SEVERE,
+ null, e);
}
}
diff --git a/theme-compiler/src/com/vaadin/sass/internal/util/DeepCopy.java b/theme-compiler/src/com/vaadin/sass/internal/util/DeepCopy.java
index bc30ffdd6c..af66eb9a74 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/util/DeepCopy.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/util/DeepCopy.java
@@ -22,13 +22,15 @@ import java.io.ObjectOutputStream;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* Utility for making deep copies (vs. clone()'s shallow copies) of objects.
* Objects are first serialized and then deserialized. Error checking is fairly
* minimal in this implementation. If an object is encountered that cannot be
* serialized (or that references an object that cannot be serialized) an error
- * is printed to System.err and null is returned. Depending on your specific
+ * is printed to the logger and null is returned. Depending on your specific
* application, it might make more sense to have copy(...) re-throw the
* exception.
*/
@@ -56,9 +58,9 @@ public class DeepCopy {
obj = in.readObject();
in.close();
} catch (IOException e) {
- e.printStackTrace();
+ log(e);
} catch (ClassNotFoundException cnfe) {
- cnfe.printStackTrace();
+ log(cnfe);
}
return obj;
} else {
@@ -80,4 +82,8 @@ public class DeepCopy {
}
return copies;
}
+
+ private static void log(Throwable e) {
+ Logger.getLogger(DeepCopy.class.getName()).log(Level.SEVERE, null, e);
+ }
} \ No newline at end of file
diff --git a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java
index e52767bb5a..daf01a3eab 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java
@@ -19,6 +19,8 @@ package com.vaadin.sass.internal.visitor;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.w3c.css.sac.CSSException;
import org.w3c.css.sac.LexicalUnit;
@@ -78,9 +80,11 @@ public class ImportNodeHandler {
importNode);
node.removeChild(importNode);
} catch (CSSException e) {
- e.printStackTrace();
+ Logger.getLogger(ImportNodeHandler.class.getName())
+ .log(Level.SEVERE, null, e);
} catch (IOException e) {
- e.printStackTrace();
+ Logger.getLogger(ImportNodeHandler.class.getName())
+ .log(Level.SEVERE, null, e);
}
} else {
if (styleSheet != node) {
diff --git a/theme-compiler/src/logging.properties b/theme-compiler/src/logging.properties
new file mode 100644
index 0000000000..b563d4b68e
--- /dev/null
+++ b/theme-compiler/src/logging.properties
@@ -0,0 +1,2 @@
+handlers = com.vaadin.sass.CustomConsoleHandler
+.level = ALL \ No newline at end of file