diff --git a/check.xml b/check.xml index 11cbc7e60..779d3d03a 100755 --- a/check.xml +++ b/check.xml @@ -6,7 +6,8 @@ + headerIgnoreLine="4" + allowProtected="true"> diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java index 260bda9fc..bb6587f2f 100644 --- a/src/main/org/apache/tools/ant/DefaultLogger.java +++ b/src/main/org/apache/tools/ant/DefaultLogger.java @@ -83,7 +83,7 @@ public class DefaultLogger implements BuildLogger { private long startTime = System.currentTimeMillis(); /** Line separator */ - protected final static String lSep = StringUtils.LINE_SEP; + protected static final String lSep = StringUtils.LINE_SEP; /** Whether or not to use emacs-style output */ protected boolean emacsMode = false; @@ -168,8 +168,7 @@ public class DefaultLogger implements BuildLogger { if (error == null) { message.append(StringUtils.LINE_SEP); message.append("BUILD SUCCESSFUL"); - } - else { + } else { message.append(StringUtils.LINE_SEP); message.append("BUILD FAILED"); message.append(StringUtils.LINE_SEP); @@ -177,13 +176,11 @@ public class DefaultLogger implements BuildLogger { if (Project.MSG_VERBOSE <= msgOutputLevel || !(error instanceof BuildException)) { message.append(StringUtils.getStackTrace(error)); - } - else { + } else { if (error instanceof BuildException) { - message.append(error.toString()).append(StringUtils.LINE_SEP); - } - else { - message.append(error.getMessage()).append(StringUtils.LINE_SEP); + message.append(error.toString()).append(lSep); + } else { + message.append(error.getMessage()).append(lSep); } } } @@ -209,7 +206,8 @@ public class DefaultLogger implements BuildLogger { */ public void targetStarted(BuildEvent event) { if (Project.MSG_INFO <= msgOutputLevel) { - String msg = StringUtils.LINE_SEP + event.getTarget().getName() + ":"; + String msg = StringUtils.LINE_SEP + + event.getTarget().getName() + ":"; printMessage(msg, out, event.getPriority()); log(msg); } @@ -256,7 +254,8 @@ public class DefaultLogger implements BuildLogger { if (!emacsMode) { String label = "[" + name + "] "; - for (int i = 0; i < (LEFT_COLUMN_SIZE - label.length()); i++) { + int size = LEFT_COLUMN_SIZE - label.length(); + for (int i = 0; i < size; i++) { message.append(" "); } message.append(label); diff --git a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java index e3651bc9f..3ce0276f5 100644 --- a/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java +++ b/src/main/org/apache/tools/ant/listener/AnsiColorLogger.java @@ -1,55 +1,55 @@ /* - * The Apache Software License, Version 1.1 + * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . */ package org.apache.tools.ant.listener; @@ -135,7 +135,6 @@ import org.apache.tools.ant.Project; * @author Magesh Umasankar */ public final class AnsiColorLogger extends DefaultLogger { - private static final int ATTR_NORMAL = 0; private static final int ATTR_BRIGHT = 1; private static final int ATTR_DIM = 2; @@ -167,14 +166,23 @@ public final class AnsiColorLogger extends DefaultLogger { private static final char SEPARATOR = ';'; private static final String END_COLOR = PREFIX + SUFFIX; - private String errColor = PREFIX + ATTR_DIM + SEPARATOR + FG_RED + SUFFIX; - private String warnColor = PREFIX + ATTR_DIM + SEPARATOR + FG_MAGENTA + SUFFIX; - private String infoColor = PREFIX + ATTR_DIM + SEPARATOR + FG_CYAN + SUFFIX; - private String verboseColor = PREFIX + ATTR_DIM + SEPARATOR + FG_GREEN + SUFFIX; - private String debugColor = PREFIX + ATTR_DIM + SEPARATOR + FG_BLUE + SUFFIX; + private String errColor + = PREFIX + ATTR_DIM + SEPARATOR + FG_RED + SUFFIX; + private String warnColor + = PREFIX + ATTR_DIM + SEPARATOR + FG_MAGENTA + SUFFIX; + private String infoColor + = PREFIX + ATTR_DIM + SEPARATOR + FG_CYAN + SUFFIX; + private String verboseColor + = PREFIX + ATTR_DIM + SEPARATOR + FG_GREEN + SUFFIX; + private String debugColor + = PREFIX + ATTR_DIM + SEPARATOR + FG_BLUE + SUFFIX; private boolean colorsSet = false; + /** + * Set the colors to use from a property file specified by the + * special ant property ant.logger.defaults + */ private final void setColors() { String userColorFile = System.getProperty("ant.logger.defaults"); String systemColorFile = @@ -228,6 +236,9 @@ public final class AnsiColorLogger extends DefaultLogger { } } + /** + * @see DefaultLogger#printMessage + */ protected final void printMessage(final String message, final PrintStream stream, final int priority) { diff --git a/src/main/org/apache/tools/ant/listener/Log4jListener.java b/src/main/org/apache/tools/ant/listener/Log4jListener.java index 03c00e91f..563153103 100644 --- a/src/main/org/apache/tools/ant/listener/Log4jListener.java +++ b/src/main/org/apache/tools/ant/listener/Log4jListener.java @@ -90,7 +90,7 @@ public class Log4jListener implements BuildListener { } /** - * @see BuildListener@buildStarted. + * @see BuildListener#buildStarted */ public void buildStarted(BuildEvent event) { if (initialized) { @@ -100,7 +100,7 @@ public class Log4jListener implements BuildListener { } /** - * @see BuildListener@buildFinished. + * @see BuildListener#buildFinished */ public void buildFinished(BuildEvent event) { if (initialized) { @@ -114,7 +114,7 @@ public class Log4jListener implements BuildListener { } /** - * @see BuildListener@targetStarted. + * @see BuildListener#targetStarted */ public void targetStarted(BuildEvent event) { if (initialized) { @@ -124,7 +124,7 @@ public class Log4jListener implements BuildListener { } /** - * @see BuildListener@targetFinished. + * @see BuildListener#targetFinished */ public void targetFinished(BuildEvent event) { if (initialized) { @@ -140,7 +140,7 @@ public class Log4jListener implements BuildListener { } /** - * @see BuildListener@taskStarted. + * @see BuildListener#taskStarted */ public void taskStarted(BuildEvent event) { if (initialized) { @@ -151,7 +151,7 @@ public class Log4jListener implements BuildListener { } /** - * @see BuildListener@taskFinished. + * @see BuildListener#taskFinished */ public void taskFinished(BuildEvent event) { if (initialized) { @@ -167,7 +167,7 @@ public class Log4jListener implements BuildListener { } /** - * @see BuildListener@messageLogged. + * @see BuildListener#messageLogged */ public void messageLogged(BuildEvent event) { if (initialized) {