summaryrefslogtreecommitdiffstats
path: root/theme-compiler
diff options
context:
space:
mode:
authordenisanisimov <denis@vaadin.com>2014-01-29 11:05:04 +0200
committerdenisanisimov <denis@vaadin.com>2014-02-04 14:23:48 +0200
commita52b0ba902781e5daeffa4f9bc2e48f35eea2c35 (patch)
tree5276d4892d872b775c3429d798ab9703b3acc43b /theme-compiler
parent1583ba7c2a5ca0f4eff55aa5e6d2072e3583cceb (diff)
downloadvaadin-framework-a52b0ba902781e5daeffa4f9bc2e48f35eea2c35.tar.gz
vaadin-framework-a52b0ba902781e5daeffa4f9bc2e48f35eea2c35.zip
Use Logger instead of System.out and System.err (#10328).
Change-Id: Icf53bdb80caf7a6989b90cf5ce83dd328d3e73dd
Diffstat (limited to 'theme-compiler')
-rw-r--r--theme-compiler/build.xml3
-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
17 files changed, 185 insertions, 57 deletions
diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml
index 03d0531a68..324934bd10 100644
--- a/theme-compiler/build.xml
+++ b/theme-compiler/build.xml
@@ -20,8 +20,7 @@
</path>
<path id="classpath.test.custom" />
- <!--<property name="classes.exclude" value="com/vaadin/buildhelpers/**"
- /> -->
+ <property name="classes.exclude" value="**/*.properties"/>
<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