You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2002/03/05 16:45:28 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.java
conor 02/03/05 07:45:28
Modified: src/main/org/apache/tools/ant Main.java
Log:
Cleanup of Main.java
Revision Changes Path
1.58 +59 -39 jakarta-ant/src/main/org/apache/tools/ant/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Main.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -w -u -r1.57 -r1.58
--- Main.java 24 Feb 2002 08:55:28 -0000 1.57
+++ Main.java 5 Mar 2002 15:45:28 -0000 1.58
@@ -167,7 +167,8 @@
}
if (additionalUserProperties != null) {
- for (Enumeration e = additionalUserProperties.keys(); e.hasMoreElements(); ) {
+ for (Enumeration e = additionalUserProperties.keys();
+ e.hasMoreElements(); ) {
String key = (String) e.nextElement();
String property = additionalUserProperties.getProperty(key);
m.definedProps.put(key, property);
@@ -245,8 +246,9 @@
System.setOut(out);
System.setErr(out);
} catch (IOException ioe) {
- String msg = "Cannot write on the specified log file. " +
- "Make sure the path exists and you have write permissions.";
+ String msg = "Cannot write on the specified log file. "
+ + "Make sure the path exists and you have write "
+ + "permissions.";
System.out.println(msg);
return;
} catch (ArrayIndexOutOfBoundsException aioobe) {
@@ -255,7 +257,8 @@
System.out.println(msg);
return;
}
- } else if (arg.equals("-buildfile") || arg.equals("-file") || arg.equals("-f")) {
+ } else if (arg.equals("-buildfile") || arg.equals("-file")
+ || arg.equals("-f")) {
try {
buildFile = new File(args[i+1]);
i++;
@@ -301,7 +304,8 @@
definedProps.put(name, value);
} else if (arg.equals("-logger")) {
if (loggerClassname != null) {
- System.out.println("Only one logger class may be specified.");
+ System.out.println("Only one logger class may "
+ + " be specified.");
return;
}
try {
@@ -375,7 +379,8 @@
for (int propertyFileIndex=0;
propertyFileIndex < propertyFiles.size();
propertyFileIndex++) {
- String filename = (String) propertyFiles.elementAt(propertyFileIndex);
+ String filename
+ = (String) propertyFiles.elementAt(propertyFileIndex);
Properties props = new Properties();
FileInputStream fis = null;
try {
@@ -444,7 +449,8 @@
*
* @exception BuildException if no build file is found
*/
- private File findBuildFile(String start, String suffix) throws BuildException {
+ private File findBuildFile(String start, String suffix)
+ throws BuildException {
if (msgOutputLevel >= Project.MSG_INFO) {
System.out.println("Searching for " + suffix + " ...");
}
@@ -534,12 +540,14 @@
project.setUserProperty(arg, value);
}
- project.setUserProperty("ant.file" , buildFile.getAbsolutePath() );
+ project.setUserProperty("ant.file",
+ buildFile.getAbsolutePath() );
// first use the ProjectHelper to create the project object
// from the given build file.
- String noParserMessage =
- "No JAXP compliant XML parser found. Please visit http://xml.apache.org for a suitable parser";
+ String noParserMessage = "No JAXP compliant XML parser found. "
+ + "Please visit http://xml.apache.org "
+ + "for a suitable parser";
try {
Class.forName("javax.xml.parsers.SAXParserFactory");
ProjectHelper.configureProject(project, buildFile);
@@ -610,17 +618,21 @@
project.addBuildListener(listener);
}
catch(Throwable exc) {
- throw new BuildException("Unable to instantiate listener " + className, exc);
+ throw new BuildException("Unable to instantiate listener "
+ + className, exc);
}
}
}
// XXX: (Jon Skeet) Any reason for writing a message and then using a bare
// RuntimeException rather than just using a BuildException here? Is it
- // in case the message could end up being written to no loggers (as the loggers
- // could have failed to be created due to this failure)?
+ // in case the message could end up being written to no loggers (as the
+ // loggers could have failed to be created due to this failure)?
/**
- * Creates the default build logger for sending build events to the ant log.
+ * Creates the default build logger for sending build events to the ant
+ * log.
+ *
+ * @return the logger instance for this build.
*/
private BuildLogger createLogger() {
BuildLogger logger = null;
@@ -629,13 +641,14 @@
logger = (BuildLogger)(Class.forName(loggerClassname).newInstance());
}
catch (ClassCastException e) {
- System.err.println("The specified logger class " + loggerClassname +
- " does not implement the BuildLogger interface");
+ System.err.println("The specified logger class "
+ + loggerClassname
+ + " does not implement the BuildLogger interface");
throw new RuntimeException();
}
catch (Exception e) {
- System.err.println("Unable to instantiate specified logger class " +
- loggerClassname + " : " + e.getClass().getName());
+ System.err.println("Unable to instantiate specified logger "
+ + "class " + loggerClassname + " : " + e.getClass().getName());
throw new RuntimeException();
}
}
@@ -788,7 +801,8 @@
}
String defaultTarget = project.getDefaultTarget();
- if (defaultTarget != null && !"".equals(defaultTarget)) { // shouldn't need to check but...
+ if (defaultTarget != null && !"".equals(defaultTarget)) {
+ // shouldn't need to check but...
System.out.println( "Default target: " + defaultTarget );
}
}
@@ -816,8 +830,14 @@
/**
* Writes a formatted list of target names to <code>System.out</code>
* with an optional description
+ *
+ * @param names the names to be printed.
+ * @param descriptions the associated target descriptions.
+ * @param heading the heading for the print.
+ * @param maxlen the maximum length of the names of the targets.
*/
- private static void printTargets(Vector names, Vector descriptions, String heading, int maxlen) {
+ private static void printTargets(Vector names, Vector descriptions,
+ String heading, int maxlen) {
// now, start printing the targets and their descriptions
String lSep = System.getProperty("line.separator");
// got a bit annoyed that I couldn't find a pad function
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>