conor 02/04/08 23:18:35
Modified: src/main/org/apache/tools/ant/listener Log4jListener.java
MailLogger.java
Log:
checkstyle
Revision Changes Path
1.8 +33 -4
jakarta-ant/src/main/org/apache/tools/ant/listener/Log4jListener.java
Index: Log4jListener.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/listener/Log4jListener.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- Log4jListener.java 19 Mar 2002 07:02:11 -0000 1.7
+++ Log4jListener.java 9 Apr 2002 06:18:35 -0000 1.8
@@ -69,10 +69,15 @@
* @author Conor MacNeill
*/
public class Log4jListener implements BuildListener {
- final static String LOG4J_CONFIG_PROPERTY = "log4j.configuration";
+ /** Log4j Configuration file */
+ private static final String LOG4J_CONFIG_PROPERTY =
"log4j.configuration";
+ /** Indicates if the listener was initialized. */
private boolean initialized = false;
+ /**
+ * Construct the listener and make sure there is a valid appender.
+ */
public Log4jListener() {
initialized = false;
Category cat = Category.getInstance("org.apache.tools.ant");
@@ -84,6 +89,9 @@
}
}
+ /**
+ * @see [EMAIL PROTECTED]
+ */
public void buildStarted(BuildEvent event) {
if (initialized) {
Category cat = Category.getInstance(Project.class.getName());
@@ -91,6 +99,9 @@
}
}
+ /**
+ * @see [EMAIL PROTECTED]
+ */
public void buildFinished(BuildEvent event) {
if (initialized) {
Category cat = Category.getInstance(Project.class.getName());
@@ -102,6 +113,9 @@
}
}
+ /**
+ * @see [EMAIL PROTECTED]
+ */
public void targetStarted(BuildEvent event) {
if (initialized) {
Category cat = Category.getInstance(Target.class.getName());
@@ -109,6 +123,9 @@
}
}
+ /**
+ * @see [EMAIL PROTECTED]
+ */
public void targetFinished(BuildEvent event) {
if (initialized) {
String targetName = event.getTarget().getName();
@@ -116,11 +133,15 @@
if (event.getException() == null) {
cat.info("Target \"" + targetName + "\" finished.");
} else {
- cat.error("Target \"" + targetName + "\" finished with
error.", event.getException());
+ cat.error("Target \"" + targetName
+ + "\" finished with error.", event.getException());
}
}
}
+ /**
+ * @see [EMAIL PROTECTED]
+ */
public void taskStarted(BuildEvent event) {
if (initialized) {
Task task = event.getTask();
@@ -129,6 +150,9 @@
}
}
+ /**
+ * @see [EMAIL PROTECTED]
+ */
public void taskFinished(BuildEvent event) {
if (initialized) {
Task task = event.getTask();
@@ -136,11 +160,15 @@
if (event.getException() == null) {
cat.info("Task \"" + task.getTaskName() + "\" finished.");
} else {
- cat.error("Task \"" + task.getTaskName() + "\" finished with
error.", event.getException());
+ cat.error("Task \"" + task.getTaskName()
+ + "\" finished with error.", event.getException());
}
}
}
+ /**
+ * @see [EMAIL PROTECTED]
+ */
public void messageLogged(BuildEvent event) {
if (initialized) {
Object categoryObject = event.getTask();
@@ -151,7 +179,8 @@
}
}
- Category cat =
Category.getInstance(categoryObject.getClass().getName());
+ Category cat
+ = Category.getInstance(categoryObject.getClass().getName());
switch (event.getPriority()) {
case Project.MSG_ERR:
cat.error(event.getMessage());
1.8 +59 -59
jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java
Index: MailLogger.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/listener/MailLogger.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- MailLogger.java 25 Feb 2002 15:33:20 -0000 1.7
+++ MailLogger.java 9 Apr 2002 06:18:35 -0000 1.8
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2002-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -97,13 +97,13 @@
[EMAIL PROTECTED] Erik Hatcher <a href="mailto:[EMAIL
PROTECTED]">[EMAIL PROTECTED]</a>
*/
public class MailLogger extends DefaultLogger {
-
+ /** Buffer in which the message is constructed prior to sending */
private StringBuffer buffer = new StringBuffer();
/**
* Sends an e-mail with the log results.
*
- * @param event
+ * @param event the build finished event
*/
public void buildFinished(BuildEvent event) {
super.buildFinished(event);
@@ -132,8 +132,8 @@
}
}
- for (Enumeration enum = fileProperties.keys();
enum.hasMoreElements();) {
- String key = (String) enum.nextElement();
+ for (Enumeration e = fileProperties.keys(); e.hasMoreElements();) {
+ String key = (String) e.nextElement();
properties.put(key, fileProperties.getProperty(key));
}
@@ -166,7 +166,7 @@
/**
* Receives and buffers log messages.
*
- * @param message
+ * @param message the message being logger
*/
protected void log(String message) {
buffer.append(message).append(StringUtils.LINE_SEP);
@@ -179,14 +179,14 @@
* @param properties Properties to obtain value from
* @param name suffix of property name. "MailLogger." will be
* prepended internally.
- * @param defaultValue value returned if not present in the
properties. Set
- * to null to make required.
+ * @param defaultValue value returned if not present in the
properties.
+ * Set to null to make required.
* @return The value of the property, or default value.
* @exception Exception thrown if no default value is specified and the
* property is not present in properties.
*/
- private String getValue(Hashtable properties, String name, String
defaultValue)
- throws Exception {
+ private String getValue(Hashtable properties, String name,
+ String defaultValue) throws Exception {
String propertyName = "MailLogger." + name;
String value = (String) properties.get(propertyName);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>