<fileset dir="${src}">
<patternset>
<include name="**/*.java" />
+ <include name="**/*.properties" />
</patternset>
</fileset>
<fileset refid="common.files.for.all.jars" />
<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" />
<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">
</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
--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
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;
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();
+ }
+ }
+ }
}
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;
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;
}
@Override
public WhileNode whileDirective(String condition, String body) {
WhileNode node = new WhileNode(condition, body);
- System.out.println(node);
+ log(node);
return node;
}
@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
@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
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);
+ }
}
*/
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;
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);
}
}
*/
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
int line;
int column;
+ @Override
public String getURI() {
return uri;
}
+ @Override
public int getLineNumber() {
return line;
}
+ @Override
public int getColumnNumber() {
return column;
}
*/
public LocatorImpl(Parser p) {
if (W3CDebug) {
- System.err.println("LocatorImpl::newLocator(" + p + ");");
+ log("LocatorImpl::newLocator(" + p + ");");
}
uri = p.source.getURI();
line = p.token.beginLine;
*/
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;
*/
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;
*/
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;
*/
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;
*/
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);
+ }
}
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;
} finally {
if (start) {
- documentHandler.endMedia(ml);
+ documentHandler.endMedia(ml);
}
}
}
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) {
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) {
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;
{
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>)*
}
{
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>)*
}
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;
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;
} 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 "";
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 "";
}
}
throw new Exception("Invalid selector type");
}
}
+
+ private static void log(String msg) {
+ Logger.getLogger(SelectorUtil.class.getName()).log(Level.INFO, msg);
+ }
}
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;
BlockNodeHandler.traverse(this);
replaceVariables(ScssStylesheet.getVariables());
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(BlockNode.class.getName()).log(Level.SEVERE, null,
+ e);
}
}
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;
ExtendNodeHandler.traverse(this);
getParentNode().removeChild(this);
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(ExtendNode.class.getName()).log(Level.SEVERE,
+ null, e);
}
}
}
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;
ScssStylesheet.closeVariableScope(variableScope);
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(MixinNode.class.getName()).log(Level.SEVERE, null,
+ e);
}
}
*/
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;
IfElseNodeHandler.traverse(this);
} catch (Exception e) {
- e.printStackTrace();
+ Logger.getLogger(IfElseDefNode.class.getName()).log(Level.SEVERE,
+ null, e);
}
}
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.
*/
obj = in.readObject();
in.close();
} catch (IOException e) {
- e.printStackTrace();
+ log(e);
} catch (ClassNotFoundException cnfe) {
- cnfe.printStackTrace();
+ log(cnfe);
}
return obj;
} else {
}
return copies;
}
+
+ private static void log(Throwable e) {
+ Logger.getLogger(DeepCopy.class.getName()).log(Level.SEVERE, null, e);
+ }
}
\ No newline at end of file
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;
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) {
--- /dev/null
+handlers = com.vaadin.sass.CustomConsoleHandler
+.level = ALL
\ No newline at end of file