git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274858 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -149,8 +149,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||
| // } else if (source instanceof URL) { | |||
| // } else if (source instanceof InputSource) { | |||
| } else { | |||
| throw new BuildException("Source " + source.getClass().getName() + | |||
| " not supported by this plugin"); | |||
| throw new BuildException("Source " + source.getClass().getName() | |||
| + " not supported by this plugin"); | |||
| } | |||
| FileInputStream inputStream = null; | |||
| @@ -340,8 +340,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||
| public InputSource resolveEntity(String publicId, | |||
| String systemId) { | |||
| context.getProject().log("resolving systemId: " + | |||
| systemId, Project.MSG_VERBOSE); | |||
| context.getProject().log("resolving systemId: " | |||
| + systemId, Project.MSG_VERBOSE); | |||
| if (systemId.startsWith("file:")) { | |||
| String path = fu.fromURI(systemId); | |||
| @@ -356,8 +356,8 @@ public class ProjectHelper2 extends ProjectHelper { | |||
| inputSource.setSystemId(fu.toURI(file.getAbsolutePath())); | |||
| return inputSource; | |||
| } catch (FileNotFoundException fne) { | |||
| context.getProject().log(file.getAbsolutePath() + | |||
| " could not be found", Project.MSG_WARN); | |||
| context.getProject().log(file.getAbsolutePath() | |||
| + " could not be found", Project.MSG_WARN); | |||
| } | |||
| } | |||
| @@ -529,9 +529,9 @@ public class ProjectHelper2 extends ProjectHelper { | |||
| File dupFile = new File(dup); | |||
| if (context.isIgnoringProjectTag() && | |||
| !dupFile.equals(context.getBuildFile())) { | |||
| project.log("Duplicated project name in import. Project " + | |||
| context.getCurrentProjectName() + " defined first in " + | |||
| dup + " and again in " + context.getBuildFile(), | |||
| project.log("Duplicated project name in import. Project " | |||
| + context.getCurrentProjectName() + " defined first in " | |||
| + dup + " and again in " + context.getBuildFile(), | |||
| Project.MSG_WARN); | |||
| } | |||
| } | |||
| @@ -135,7 +135,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| */ | |||
| public void parse(Project project, Object source) throws BuildException { | |||
| if (!(source instanceof File)) { | |||
| throw new BuildException("Only File source supported by " | |||
| throw new BuildException("Only File source supported by " | |||
| + "default plugin"); | |||
| } | |||
| File buildFile = (File) source; | |||
| @@ -490,7 +490,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| if (name.equals("target")) { | |||
| handleTarget(name, attrs); | |||
| } else { | |||
| handleElement(helperImpl, this, helperImpl.implicitTarget, | |||
| handleElement(helperImpl, this, helperImpl.implicitTarget, | |||
| name, attrs); | |||
| } | |||
| } | |||
| @@ -661,7 +661,7 @@ public class ProjectHelperImpl extends ProjectHelper { | |||
| * parser at the end of the element. | |||
| * Must not be <code>null</code>. | |||
| */ | |||
| public DescriptionHandler(ProjectHelperImpl helperImpl, | |||
| public DescriptionHandler(ProjectHelperImpl helperImpl, | |||
| DocumentHandler parentHandler) { | |||
| super(helperImpl, parentHandler); | |||
| } | |||
| @@ -68,7 +68,7 @@ import org.apache.tools.ant.BuildException; | |||
| * @since Ant 1.5 | |||
| */ | |||
| public class DefaultInputHandler implements InputHandler { | |||
| /** | |||
| * Empty no-arg constructor | |||
| */ | |||
| @@ -108,7 +108,7 @@ public class DefaultInputHandler implements InputHandler { | |||
| if (request instanceof MultipleChoiceInputRequest) { | |||
| StringBuffer sb = new StringBuffer(prompt); | |||
| sb.append("("); | |||
| Enumeration enum = | |||
| Enumeration enum = | |||
| ((MultipleChoiceInputRequest) request).getChoices().elements(); | |||
| boolean first = true; | |||
| while (enum.hasMoreElements()) { | |||
| @@ -72,6 +72,6 @@ public interface InputHandler { | |||
| * <p>Postcondition: request.getInput will return a non-null | |||
| * value, request.isInputValid will return true.</p> | |||
| */ | |||
| void handleInput(InputRequest request) | |||
| void handleInput(InputRequest request) | |||
| throws org.apache.tools.ant.BuildException; | |||
| } | |||
| @@ -72,7 +72,7 @@ public class InputRequest { | |||
| if (prompt == null) { | |||
| throw new IllegalArgumentException("prompt must not be null"); | |||
| } | |||
| this.prompt = prompt; | |||
| } | |||
| @@ -89,7 +89,7 @@ public class InputRequest { | |||
| public void setInput(String input) { | |||
| this.input = input; | |||
| } | |||
| /** | |||
| * Is the user input valid? | |||
| */ | |||
| @@ -89,11 +89,11 @@ public class PropertyFileInputHandler implements InputHandler { | |||
| */ | |||
| public void handleInput(InputRequest request) throws BuildException { | |||
| readProps(); | |||
| Object o = props.get(request.getPrompt()); | |||
| if (o == null) { | |||
| throw new BuildException("Unable to find input for \'" | |||
| + request.getPrompt()+"\'"); | |||
| + request.getPrompt() + "\'"); | |||
| } | |||
| request.setInput(o.toString()); | |||
| if (!request.isInputValid()) { | |||
| @@ -114,9 +114,9 @@ public class PropertyFileInputHandler implements InputHandler { | |||
| + " for PropertyFileInputHandler not" | |||
| + " set"); | |||
| } | |||
| props = new Properties(); | |||
| try { | |||
| props.load(new FileInputStream(propsFile)); | |||
| } catch (IOException e) { | |||
| @@ -165,15 +165,15 @@ public final class AnsiColorLogger extends DefaultLogger { | |||
| private static final char SEPARATOR = ';'; | |||
| private static final String END_COLOR = PREFIX + SUFFIX; | |||
| private String errColor | |||
| private String errColor | |||
| = PREFIX + ATTR_DIM + SEPARATOR + FG_RED + SUFFIX; | |||
| private String warnColor | |||
| private String warnColor | |||
| = PREFIX + ATTR_DIM + SEPARATOR + FG_MAGENTA + SUFFIX; | |||
| private String infoColor | |||
| private String infoColor | |||
| = PREFIX + ATTR_DIM + SEPARATOR + FG_CYAN + SUFFIX; | |||
| private String verboseColor | |||
| private String verboseColor | |||
| = PREFIX + ATTR_DIM + SEPARATOR + FG_GREEN + SUFFIX; | |||
| private String debugColor | |||
| private String debugColor | |||
| = PREFIX + ATTR_DIM + SEPARATOR + FG_BLUE + SUFFIX; | |||
| private boolean colorsSet = false; | |||
| @@ -73,7 +73,7 @@ public class Log4jListener implements BuildListener { | |||
| /** Indicates if the listener was initialized. */ | |||
| private boolean initialized = false; | |||
| /** | |||
| /** | |||
| * Construct the listener and make sure there is a valid appender. | |||
| */ | |||
| public Log4jListener() { | |||
| @@ -131,7 +131,7 @@ public class Log4jListener implements BuildListener { | |||
| if (event.getException() == null) { | |||
| cat.info("Target \"" + targetName + "\" finished."); | |||
| } else { | |||
| cat.error("Target \"" + targetName | |||
| cat.error("Target \"" + targetName | |||
| + "\" finished with error.", event.getException()); | |||
| } | |||
| } | |||
| @@ -158,7 +158,7 @@ public class Log4jListener implements BuildListener { | |||
| if (event.getException() == null) { | |||
| cat.info("Task \"" + task.getTaskName() + "\" finished."); | |||
| } else { | |||
| cat.error("Task \"" + task.getTaskName() | |||
| cat.error("Task \"" + task.getTaskName() | |||
| + "\" finished with error.", event.getException()); | |||
| } | |||
| } | |||
| @@ -177,7 +177,7 @@ public class Log4jListener implements BuildListener { | |||
| } | |||
| } | |||
| Category cat | |||
| Category cat | |||
| = Category.getInstance(categoryObject.getClass().getName()); | |||
| switch (event.getPriority()) { | |||
| case Project.MSG_ERR: | |||
| @@ -57,7 +57,11 @@ import java.io.FileInputStream; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.io.PrintStream; | |||
| import java.util.*; | |||
| import java.util.Hashtable; | |||
| import java.util.Vector; | |||
| import java.util.Properties; | |||
| import java.util.Enumeration; | |||
| import java.util.StringTokenizer; | |||
| import org.apache.tools.ant.BuildEvent; | |||
| import org.apache.tools.ant.DefaultLogger; | |||
| @@ -154,20 +158,24 @@ public class MailLogger extends DefaultLogger { | |||
| } | |||
| String mailhost = getValue(properties, "mailhost", "localhost"); | |||
| int port = Integer.parseInt(getValue(properties,"port",String.valueOf(MailMessage.DEFAULT_PORT))); | |||
| int port = Integer.parseInt(getValue(properties, "port", | |||
| String.valueOf(MailMessage.DEFAULT_PORT))); | |||
| String user = getValue(properties, "user", ""); | |||
| String password = getValue(properties, "password", ""); | |||
| boolean ssl = Project.toBoolean(getValue(properties, | |||
| "ssl", "off")); | |||
| String from = getValue(properties, "from", null); | |||
| String replytoList = getValue(properties,"replyto",""); | |||
| String replytoList = getValue(properties, "replyto", ""); | |||
| String toList = getValue(properties, prefix + ".to", null); | |||
| String subject = getValue(properties, prefix + ".subject", | |||
| (success) ? "Build Success" : "Build Failure"); | |||
| if (user.equals("") && password.equals("") && !ssl) { | |||
| sendMail(mailhost, port, from, replytoList, toList, subject, buffer.substring(0)); | |||
| sendMail(mailhost, port, from, replytoList, toList, | |||
| subject, buffer.substring(0)); | |||
| } else { | |||
| sendMimeMail(event.getProject(), mailhost, port, user, password, ssl, from, replytoList, toList, subject, buffer.substring(0)); | |||
| sendMimeMail(event.getProject(), mailhost, port, user, | |||
| password, ssl, from, replytoList, toList, | |||
| subject, buffer.substring(0)); | |||
| } | |||
| } catch (Exception e) { | |||
| System.out.println("MailLogger failed to send e-mail!"); | |||
| @@ -274,7 +282,7 @@ public class MailLogger extends DefaultLogger { | |||
| (Mailer) Class.forName("org.apache.tools.ant.taskdefs.email.MimeMailer") | |||
| .newInstance(); | |||
| } catch (Throwable e) { | |||
| log("Failed to initialise MIME mail: "+e.getMessage()); | |||
| log("Failed to initialise MIME mail: " + e.getMessage()); | |||
| return; | |||
| } | |||
| Vector replyToList = vectorizeEmailAddresses(replyToString); | |||
| @@ -372,12 +372,16 @@ public abstract class AbstractCvsTask extends Task { | |||
| if (outputStream != null) { | |||
| try { | |||
| outputStream.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| //ignore | |||
| } | |||
| } | |||
| if (errorStream != null) { | |||
| try { | |||
| errorStream.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| //ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -117,22 +117,30 @@ public class BUnzip2 extends Unpack { | |||
| if (bis != null) { | |||
| try { | |||
| bis.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| // ignore | |||
| } | |||
| } | |||
| if (fis != null) { | |||
| try { | |||
| fis.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| // ignore | |||
| } | |||
| } | |||
| if (out != null) { | |||
| try { | |||
| out.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| // ignore | |||
| } | |||
| } | |||
| if (zIn != null) { | |||
| try { | |||
| zIn.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -90,7 +90,9 @@ public class BZip2 extends Pack { | |||
| try { | |||
| // close up | |||
| zOut.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| //ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -90,53 +90,53 @@ import org.apache.tools.ant.Task; | |||
| */ | |||
| public class Basename extends Task { | |||
| private File file; | |||
| private String property; | |||
| private String suffix; | |||
| private File file; | |||
| private String property; | |||
| private String suffix; | |||
| /** | |||
| * File or directory to get base name from. | |||
| */ | |||
| public void setFile(File file) { | |||
| this.file = file; | |||
| } | |||
| /** | |||
| * File or directory to get base name from. | |||
| */ | |||
| public void setFile(File file) { | |||
| this.file = file; | |||
| } | |||
| /** | |||
| * Property to set base name to. | |||
| */ | |||
| public void setProperty(String property) { | |||
| this.property = property ; | |||
| } | |||
| /** | |||
| * Property to set base name to. | |||
| */ | |||
| public void setProperty(String property) { | |||
| this.property = property; | |||
| } | |||
| /** | |||
| * Optional suffix to remove from base name. | |||
| */ | |||
| public void setSuffix(String suffix) { | |||
| this.suffix = suffix; | |||
| } | |||
| /** | |||
| * Optional suffix to remove from base name. | |||
| */ | |||
| public void setSuffix(String suffix) { | |||
| this.suffix = suffix; | |||
| } | |||
| // The method executing the task | |||
| public void execute() throws BuildException { | |||
| if (property == null) { | |||
| throw new BuildException("property attribute required", getLocation()); | |||
| } | |||
| if (file == null) { | |||
| throw new BuildException("file attribute required", getLocation()); | |||
| } | |||
| String value = file.getName(); | |||
| if (suffix != null && value.endsWith(suffix)) { | |||
| // if the suffix does not starts with a '.' and the | |||
| // char preceding the suffix is a '.', we assume the user | |||
| // wants to remove the '.' as well (see docs) | |||
| int pos = value.length() - suffix.length(); | |||
| if (pos > 0 && suffix.charAt(0) != '.' | |||
| && value.charAt(pos - 1) == '.') { | |||
| pos--; | |||
| } | |||
| value = value.substring(0, pos); | |||
| } | |||
| getProject().setNewProperty(property, value); | |||
| } | |||
| // The method executing the task | |||
| public void execute() throws BuildException { | |||
| if (property == null) { | |||
| throw new BuildException("property attribute required", getLocation()); | |||
| } | |||
| if (file == null) { | |||
| throw new BuildException("file attribute required", getLocation()); | |||
| } | |||
| String value = file.getName(); | |||
| if (suffix != null && value.endsWith(suffix)) { | |||
| // if the suffix does not starts with a '.' and the | |||
| // char preceding the suffix is a '.', we assume the user | |||
| // wants to remove the '.' as well (see docs) | |||
| int pos = value.length() - suffix.length(); | |||
| if (pos > 0 && suffix.charAt(0) != '.' | |||
| && value.charAt(pos - 1) == '.') { | |||
| pos--; | |||
| } | |||
| value = value.substring(0, pos); | |||
| } | |||
| getProject().setNewProperty(property, value); | |||
| } | |||
| } | |||
| @@ -107,7 +107,7 @@ public class BuildNumber | |||
| */ | |||
| public void execute() | |||
| throws BuildException { | |||
| File savedFile = m_file;// may be altered in validate | |||
| File savedFile = m_file; // may be altered in validate | |||
| validate(); | |||
| @@ -419,7 +419,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
| throw new BuildException("Couldn't read checksum file " + checksumFile, e); | |||
| } | |||
| byte[] digest = decodeHex(checksum.toCharArray()); | |||
| allDigests.put(file,digest ); | |||
| allDigests.put(file, digest); | |||
| } | |||
| } | |||
| } else { | |||
| @@ -478,7 +478,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
| fis = null; | |||
| byte[] fileDigest = messageDigest.digest (); | |||
| if (totalproperty != null) { | |||
| allDigests.put(src,fileDigest); | |||
| allDigests.put(src, fileDigest); | |||
| } | |||
| String checksum = createDigestString(fileDigest); | |||
| //can either be a property name string or a file | |||
| @@ -546,12 +546,16 @@ public class Checksum extends MatchingTask implements Condition { | |||
| if (fis != null) { | |||
| try { | |||
| fis.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| if (fos != null) { | |||
| try { | |||
| fos.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| return checksumMatches; | |||
| @@ -86,7 +86,9 @@ public class ConditionTask extends ConditionBase { | |||
| * | |||
| * @since Ant 1.4 | |||
| */ | |||
| public void setProperty(String p) {property = p;} | |||
| public void setProperty(String p) { | |||
| property = p; | |||
| } | |||
| /** | |||
| * The value for the property to set, if condition evaluates to true. | |||
| @@ -94,7 +96,9 @@ public class ConditionTask extends ConditionBase { | |||
| * | |||
| * @since Ant 1.4 | |||
| */ | |||
| public void setValue(String v) {value = v;} | |||
| public void setValue(String v) { | |||
| value = v; | |||
| } | |||
| /** | |||
| * See whether our nested condition holds and set the property. | |||
| @@ -116,11 +120,11 @@ public class ConditionTask extends ConditionBase { | |||
| Condition c = (Condition) getConditions().nextElement(); | |||
| if (c.eval()) { | |||
| log("Condition true; setting "+property+" to "+value, | |||
| log("Condition true; setting " + property + " to " + value, | |||
| Project.MSG_DEBUG); | |||
| getProject().setNewProperty(property, value); | |||
| } else { | |||
| log("Condition false; not setting "+property, | |||
| log("Condition false; not setting " + property, | |||
| Project.MSG_DEBUG); | |||
| } | |||
| } | |||
| @@ -600,10 +600,9 @@ public class Copy extends Task { | |||
| } | |||
| if (count > 0) { | |||
| log("Copied " + count + | |||
| " empty director" + | |||
| (count == 1 ? "y" : "ies") + | |||
| " to " + destDir.getAbsolutePath()); | |||
| log("Copied " + count + " empty director" | |||
| + (count == 1 ? "y" : "ies") | |||
| + " to " + destDir.getAbsolutePath()); | |||
| } | |||
| } | |||
| } | |||
| @@ -84,10 +84,9 @@ public class DefaultExcludes extends Task { | |||
| */ | |||
| public void execute() throws BuildException { | |||
| if (add.equals("") && remove.equals("") && (echo == false)) { | |||
| throw new BuildException("<defaultexcludes> task must set "+ | |||
| "at least one atribute (echo=\"false\""+ | |||
| " doesn't count since that is the "+ | |||
| "default"); | |||
| throw new BuildException("<defaultexcludes> task must set " | |||
| + "at least one atribute (echo=\"false\"" | |||
| + " doesn't count since that is the default"); | |||
| } | |||
| if (!add.equals("")) { | |||
| DirectoryScanner.addDefaultExclude(add); | |||
| @@ -96,10 +95,10 @@ public class DefaultExcludes extends Task { | |||
| DirectoryScanner.removeDefaultExclude(remove); | |||
| } | |||
| if (echo == true) { | |||
| StringBuffer message = new StringBuffer("Current Default "+ | |||
| "Excludes:\n"); | |||
| StringBuffer message | |||
| = new StringBuffer("Current Default Excludes:\n"); | |||
| String[] excludes = DirectoryScanner.getDefaultExcludes(); | |||
| for (int i=0;i<excludes.length;i++) { | |||
| for (int i = 0; i < excludes.length; i++) { | |||
| message.append(" " + excludes[i] + "\n"); | |||
| } | |||
| log(message.toString(), logLevel); | |||
| @@ -540,7 +540,7 @@ public class Delete extends MatchingTask { | |||
| * wait a little and try again. | |||
| */ | |||
| private boolean delete(File f) { | |||
| if (! f.delete()) { | |||
| if (!f.delete()) { | |||
| try { | |||
| Thread.sleep(10); | |||
| return f.delete(); | |||
| @@ -550,7 +550,7 @@ public class Delete extends MatchingTask { | |||
| } | |||
| return true; | |||
| } | |||
| protected void removeDir(File d) { | |||
| String[] list = d.list(); | |||
| if (list == null) { | |||
| @@ -638,9 +638,9 @@ public class Delete extends MatchingTask { | |||
| } | |||
| if (dirCount > 0) { | |||
| log("Deleted " + dirCount + " director" + | |||
| (dirCount == 1 ? "y" : "ies") + | |||
| " from " + d.getAbsolutePath()); | |||
| log("Deleted " + dirCount + " director" | |||
| + (dirCount == 1 ? "y" : "ies") | |||
| + " from " + d.getAbsolutePath()); | |||
| } | |||
| } | |||
| } | |||
| @@ -283,8 +283,8 @@ public class DependSet extends MatchingTask { | |||
| if (src.lastModified() > oldestTargetTime) { | |||
| upToDate = false; | |||
| log(oldestTarget + " is out of date with respect to " + | |||
| sourceFiles[i], Project.MSG_VERBOSE); | |||
| log(oldestTarget + " is out of date with respect to " | |||
| + sourceFiles[i], Project.MSG_VERBOSE); | |||
| } | |||
| } | |||
| } | |||
| @@ -311,8 +311,8 @@ public class DependSet extends MatchingTask { | |||
| if (src.lastModified() > oldestTargetTime) { | |||
| upToDate = false; | |||
| log(oldestTarget + " is out of date with respect to " + | |||
| sourceFiles[i], Project.MSG_VERBOSE); | |||
| log(oldestTarget + " is out of date with respect to " | |||
| + sourceFiles[i], Project.MSG_VERBOSE); | |||
| } | |||
| } | |||
| } | |||
| @@ -97,7 +97,9 @@ public class Echo extends Task { | |||
| if (out != null) { | |||
| try { | |||
| out.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| //ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -185,7 +185,9 @@ public class Exec extends Task { | |||
| } | |||
| } catch (IOException ioe) { | |||
| throw new BuildException("Error exec: " + command, ioe, getLocation()); | |||
| } catch (InterruptedException ex) {} | |||
| } catch (InterruptedException ex) { | |||
| //ignore | |||
| } | |||
| return err; | |||
| } | |||
| @@ -256,9 +258,13 @@ public class Exec extends Task { | |||
| pumpStream(); | |||
| sleep(SLEEP_TIME); | |||
| } | |||
| } catch (InterruptedException ie) {} | |||
| } catch (InterruptedException ie) { | |||
| //ignore | |||
| } | |||
| din.close(); | |||
| } catch (IOException ioe) {} | |||
| } catch (IOException ioe) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -145,8 +145,8 @@ public class ExecTask extends Task { | |||
| * @ant.attribute ignore="true" | |||
| */ | |||
| public void setCommand(Commandline cmdl) { | |||
| log("The command attribute is deprecated. " + | |||
| "Please use the executable attribute and nested arg elements.", | |||
| log("The command attribute is deprecated. " | |||
| + "Please use the executable attribute and nested arg elements.", | |||
| Project.MSG_WARN); | |||
| this.cmdl = cmdl; | |||
| } | |||
| @@ -578,9 +578,8 @@ public class Execute { | |||
| public Process exec(Project project, String[] cmd, String[] env) | |||
| throws IOException { | |||
| if (project != null) { | |||
| project.log("Execute:CommandLauncher: " + | |||
| Commandline.describeCommand(cmd), | |||
| Project.MSG_DEBUG); | |||
| project.log("Execute:CommandLauncher: " | |||
| + Commandline.describeCommand(cmd), Project.MSG_DEBUG); | |||
| } | |||
| return Runtime.getRuntime().exec(cmd, env); | |||
| } | |||
| @@ -625,9 +624,8 @@ public class Execute { | |||
| newcmd[i] = Commandline.quoteArgument(cmd[i]); | |||
| } | |||
| if (project != null) { | |||
| project.log("Execute:Java11CommandLauncher: " + | |||
| Commandline.describeCommand(newcmd), | |||
| Project.MSG_DEBUG); | |||
| project.log("Execute:Java11CommandLauncher: " | |||
| + Commandline.describeCommand(newcmd), Project.MSG_DEBUG); | |||
| } | |||
| return Runtime.getRuntime().exec(newcmd, env); | |||
| } | |||
| @@ -653,11 +651,10 @@ public class Execute { | |||
| File workingDir) throws IOException { | |||
| try { | |||
| if (project != null) { | |||
| project.log("Execute:Java13CommandLauncher: " + | |||
| Commandline.describeCommand(cmd), | |||
| Project.MSG_DEBUG); | |||
| project.log("Execute:Java13CommandLauncher: " | |||
| + Commandline.describeCommand(cmd), Project.MSG_DEBUG); | |||
| } | |||
| Object[] arguments = { cmd, env, workingDir }; | |||
| Object[] arguments = {cmd, env, workingDir}; | |||
| return (Process) _execWithCWD.invoke(Runtime.getRuntime(), | |||
| arguments); | |||
| } catch (InvocationTargetException exc) { | |||
| @@ -118,7 +118,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||
| this.timeout = timeout; | |||
| } | |||
| public void execute(Project project) throws BuildException{ | |||
| public void execute(Project project) throws BuildException { | |||
| final String classname = javaCommand.getExecutable(); | |||
| AntClassLoader loader = null; | |||
| @@ -127,7 +127,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||
| sysProperties.setSystem(); | |||
| } | |||
| final Class[] param = { Class.forName("[Ljava.lang.String;") }; | |||
| final Class[] param = {Class.forName("[Ljava.lang.String;")}; | |||
| Class target = null; | |||
| if (classpath == null) { | |||
| target = Class.forName(classname); | |||
| @@ -166,7 +166,9 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||
| w.start(); | |||
| try { | |||
| wait(); | |||
| } catch (InterruptedException e) {} | |||
| } catch (InterruptedException e) { | |||
| // ignore | |||
| } | |||
| if (timedOut) { | |||
| project.log("Timeout: sub-process interrupted", | |||
| Project.MSG_WARN); | |||
| @@ -204,7 +206,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { | |||
| * @since Ant 1.5 | |||
| */ | |||
| public void run() { | |||
| final Object[] argument = { javaCommand.getArguments() }; | |||
| final Object[] argument = {javaCommand.getArguments()}; | |||
| try { | |||
| main.invoke(null, argument); | |||
| } catch (InvocationTargetException e) { | |||
| @@ -292,9 +292,9 @@ public class ExecuteOn extends ExecTask { | |||
| if (fs instanceof DirSet) { | |||
| if (!"dir".equals(type)) { | |||
| log("Found a nested dirset but type is " + type + ". " | |||
| + "Temporarily switching to type=\"dir\" on the" + | |||
| " assumption that you really did mean" + | |||
| " <dirset> not <fileset>.", Project.MSG_DEBUG); | |||
| + "Temporarily switching to type=\"dir\" on the" | |||
| + " assumption that you really did mean" | |||
| + " <dirset> not <fileset>.", Project.MSG_DEBUG); | |||
| currentType = "dir"; | |||
| } | |||
| } | |||
| @@ -111,7 +111,7 @@ public class ExecuteWatchdog implements TimeoutObserver { | |||
| * (1.4.x compatibility) | |||
| */ | |||
| public ExecuteWatchdog(int timeout) { | |||
| this((long)timeout); | |||
| this((long) timeout); | |||
| } | |||
| /** | |||
| @@ -127,8 +127,8 @@ public class Expand extends Task { | |||
| if (source != null) { | |||
| if (source.isDirectory()) { | |||
| throw new BuildException("Src must not be a directory." + | |||
| " Use nested filesets instead.", getLocation()); | |||
| throw new BuildException("Src must not be a directory." | |||
| + " Use nested filesets instead.", getLocation()); | |||
| } else { | |||
| expandFile(fileUtils, source, dest); | |||
| } | |||
| @@ -172,7 +172,9 @@ public class Expand extends Task { | |||
| if (zf != null) { | |||
| try { | |||
| zf.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| //ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -247,7 +249,7 @@ public class Expand extends Task { | |||
| Project.MSG_VERBOSE); | |||
| // create intermediary directories - sometimes zip don't add them | |||
| File dirF = fileUtils.getParentFile(f); | |||
| if ( dirF != null) { | |||
| if (dirF != null) { | |||
| dirF.mkdirs(); | |||
| } | |||
| @@ -271,7 +273,9 @@ public class Expand extends Task { | |||
| if (fos != null) { | |||
| try { | |||
| fos.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -363,13 +363,13 @@ public class FixCRLF extends MatchingTask { | |||
| } | |||
| // log options used | |||
| log("options:" + | |||
| " eol=" + | |||
| (eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf") + | |||
| " tab=" + (tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove") + | |||
| " eof=" + (ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove") + | |||
| " tablength=" + tablength + | |||
| " encoding=" + (encoding == null ? "default" : encoding), | |||
| log("options:" | |||
| + " eol=" | |||
| + (eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" : "crlf") | |||
| + " tab=" + (tabs == TABS ? "add" : tabs == ASIS ? "asis" : "remove") | |||
| + " eof=" + (ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" : "remove") | |||
| + " tablength=" + tablength | |||
| + " encoding=" + (encoding == null ? "default" : encoding), | |||
| Project.MSG_VERBOSE); | |||
| DirectoryScanner ds = super.getDirectoryScanner(srcDir); | |||
| @@ -483,10 +483,9 @@ public class FixCRLF extends MatchingTask { | |||
| endOfCharConst(line, terminator); | |||
| while (line.getNext() < line.getLookahead()) { | |||
| if (line.getNextCharInc() == '\t') { | |||
| line.setColumn(line.getColumn() + | |||
| tablength - | |||
| (line.getColumn() | |||
| % tablength)); | |||
| line.setColumn(line.getColumn() | |||
| + tablength | |||
| - (line.getColumn() % tablength)); | |||
| } else { | |||
| line.incColumn(); | |||
| } | |||
| @@ -559,9 +558,8 @@ public class FixCRLF extends MatchingTask { | |||
| if (!fileUtils.contentEquals(destFile, tmpFile)) { | |||
| log(destFile + " is being written", Project.MSG_DEBUG); | |||
| } else { | |||
| log(destFile + | |||
| " is not written, as the contents are identical", | |||
| Project.MSG_DEBUG); | |||
| log(destFile + " is not written, as the contents " | |||
| + "are identical", Project.MSG_DEBUG); | |||
| destIsWrong = false; | |||
| } | |||
| } | |||
| @@ -736,12 +734,11 @@ public class FixCRLF extends MatchingTask { | |||
| nextStop += tablength; | |||
| } | |||
| for (; nextStop - placediff <= linestring.length() | |||
| ; nextStop += tablength) { | |||
| for (; nextStop - placediff <= linestring.length(); | |||
| nextStop += tablength) { | |||
| for (tabCol = nextStop; | |||
| --tabCol - placediff >= place | |||
| && linestring.charAt(tabCol - placediff) == ' ' | |||
| ;) { | |||
| && linestring.charAt(tabCol - placediff) == ' ';) { | |||
| ; // Loop for the side-effects | |||
| } | |||
| // tabCol is column index of the last non-space character | |||
| @@ -796,7 +793,7 @@ public class FixCRLF extends MatchingTask { | |||
| (getReader(srcFile), INBUFLEN); | |||
| nextLine(); | |||
| } catch (IOException e) { | |||
| throw new BuildException(srcFile + ": "+ e.getMessage(), | |||
| throw new BuildException(srcFile + ": " + e.getMessage(), | |||
| e, getLocation()); | |||
| } | |||
| } | |||
| @@ -881,7 +878,7 @@ public class FixCRLF extends MatchingTask { | |||
| } // end of if (eolcount == 0) | |||
| } catch (IOException e) { | |||
| throw new BuildException(srcFile + ": "+ e.getMessage(), | |||
| throw new BuildException(srcFile + ": " + e.getMessage(), | |||
| e, getLocation()); | |||
| } | |||
| } | |||
| @@ -106,17 +106,23 @@ public class GUnzip extends Unpack { | |||
| if (fis != null) { | |||
| try { | |||
| fis.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| //ignore | |||
| } | |||
| } | |||
| if (out != null) { | |||
| try { | |||
| out.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| //ignore | |||
| } | |||
| } | |||
| if (zIn != null) { | |||
| try { | |||
| zIn.close(); | |||
| } catch (IOException ioex) {} | |||
| } catch (IOException ioex) { | |||
| //ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -184,9 +184,8 @@ public class GenerateKey extends Task { | |||
| + "specified once."); | |||
| } | |||
| if (null != dname) { | |||
| throw new BuildException("It is not possible to specify dname " + | |||
| " both " + | |||
| "as attribute and element."); | |||
| throw new BuildException("It is not possible to specify dname " | |||
| + " both as attribute and element."); | |||
| } | |||
| expandedDname = new DistinguishedName(); | |||
| return expandedDname; | |||
| @@ -199,9 +198,8 @@ public class GenerateKey extends Task { | |||
| */ | |||
| public void setDname(final String dname) { | |||
| if (null != expandedDname) { | |||
| throw new BuildException("It is not possible to specify dname " + | |||
| " both " + | |||
| "as attribute and element."); | |||
| throw new BuildException("It is not possible to specify dname " | |||
| + " both as attribute and element."); | |||
| } | |||
| this.dname = dname; | |||
| } | |||
| @@ -178,9 +178,9 @@ public class Get extends Task { | |||
| // test for 401 result (HTTP only) | |||
| if (httpConnection.getResponseCode() | |||
| == HttpURLConnection.HTTP_UNAUTHORIZED) { | |||
| String message="HTTP Authorization failure"; | |||
| String message = "HTTP Authorization failure"; | |||
| if (ignoreErrors) { | |||
| log(message,Project.MSG_WARN); | |||
| log(message, Project.MSG_WARN); | |||
| return; | |||
| } else { | |||
| throw new BuildException(message); | |||
| @@ -196,7 +196,7 @@ public class Get extends Task { | |||
| //course. | |||
| InputStream is = null; | |||
| for (int i = 0; i < 3 ; i++) { | |||
| for (int i = 0; i < 3; i++) { | |||
| try { | |||
| is = connection.getInputStream(); | |||
| break; | |||
| @@ -222,8 +222,8 @@ public class Jar extends Zip { | |||
| */ | |||
| public void setManifest(File manifestFile) { | |||
| if (!manifestFile.exists()) { | |||
| throw new BuildException("Manifest file: " + manifestFile + | |||
| " does not exist.", getLocation()); | |||
| throw new BuildException("Manifest file: " + manifestFile | |||
| + " does not exist.", getLocation()); | |||
| } | |||
| this.manifestFile = manifestFile; | |||
| @@ -328,7 +328,7 @@ public class Jar extends Zip { | |||
| mergeManifestsMain = "merge".equals(config.getValue()); | |||
| if (filesetManifestConfig != null | |||
| && ! filesetManifestConfig.getValue().equals("skip")) { | |||
| && !filesetManifestConfig.getValue().equals("skip")) { | |||
| doubleFilePass = true; | |||
| } | |||
| @@ -348,7 +348,7 @@ public class Jar extends Zip { | |||
| protected void initZipOutputStream(ZipOutputStream zOut) | |||
| throws IOException, BuildException { | |||
| if (! skipWriting) { | |||
| if (!skipWriting) { | |||
| Manifest jarManifest = createManifest(); | |||
| writeManifest(zOut, jarManifest); | |||
| } | |||
| @@ -489,7 +489,7 @@ public class Jar extends Zip { | |||
| long lastModified, File fromArchive, int mode) | |||
| throws IOException { | |||
| if (MANIFEST_NAME.equalsIgnoreCase(vPath)) { | |||
| if (! doubleFilePass || (doubleFilePass && skipWriting)) { | |||
| if (!doubleFilePass || (doubleFilePass && skipWriting)) { | |||
| filesetManifest(fromArchive, is); | |||
| } | |||
| } else if (INDEX_NAME.equalsIgnoreCase(vPath) && index) { | |||
| @@ -683,7 +683,7 @@ public class Jar extends Zip { | |||
| super.cleanUp(); | |||
| // we want to save this info if we are going to make another pass | |||
| if (! doubleFilePass || (doubleFilePass && ! skipWriting)) { | |||
| if (!doubleFilePass || (doubleFilePass && !skipWriting)) { | |||
| manifest = null; | |||
| configuredManifest = savedConfiguredManifest; | |||
| filesetManifest = null; | |||
| @@ -245,9 +245,8 @@ public class Java extends Task { | |||
| * @ant.attribute ignore="true" | |||
| */ | |||
| public void setArgs(String s) { | |||
| log("The args attribute is deprecated. " + | |||
| "Please use nested arg elements.", | |||
| Project.MSG_WARN); | |||
| log("The args attribute is deprecated. " | |||
| + "Please use nested arg elements.", Project.MSG_WARN); | |||
| cmdl.createArgument().setLine(s); | |||
| } | |||
| @@ -290,9 +289,8 @@ public class Java extends Task { | |||
| * Set the command line arguments for the JVM. | |||
| */ | |||
| public void setJvmargs(String s) { | |||
| log("The jvmargs attribute is deprecated. " + | |||
| "Please use nested jvmarg elements.", | |||
| Project.MSG_WARN); | |||
| log("The jvmargs attribute is deprecated. " | |||
| + "Please use nested jvmarg elements.", Project.MSG_WARN); | |||
| cmdl.createVmArgument().setLine(s); | |||
| } | |||
| @@ -861,7 +861,7 @@ public class Javac extends MatchingTask { | |||
| if (listFiles) { | |||
| for (int i = 0; i < compileList.length; i++) { | |||
| String filename = compileList[i].getAbsolutePath(); | |||
| log(filename) ; | |||
| log(filename); | |||
| } | |||
| } | |||
| @@ -1868,7 +1868,7 @@ public class Javadoc extends Task { | |||
| } catch (IOException ioe) { | |||
| throw new BuildException("Couldn't read " | |||
| + " tag file from " | |||
| + tagDefFile.getAbsolutePath(), ioe ); | |||
| + tagDefFile.getAbsolutePath(), ioe); | |||
| } | |||
| } | |||
| } | |||
| @@ -123,14 +123,18 @@ public class Jikes { | |||
| out.println(args[i]); | |||
| } | |||
| out.flush(); | |||
| commandArray = new String[] { command, | |||
| "@" + tmpFile.getAbsolutePath()}; | |||
| commandArray = new String[] {command, | |||
| "@" + tmpFile.getAbsolutePath()}; | |||
| } catch (IOException e) { | |||
| throw new BuildException("Error creating temporary file", | |||
| e); | |||
| } finally { | |||
| if (out != null) { | |||
| try {out.close();} catch (Throwable t) {} | |||
| try { | |||
| out.close(); | |||
| } catch (Throwable t) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| @@ -86,12 +86,14 @@ public class JikesOutputParser implements ExecuteStreamHandler { | |||
| /** | |||
| * Ignore. | |||
| */ | |||
| public void setProcessInputStream(OutputStream os) {} | |||
| public void setProcessInputStream(OutputStream os) { | |||
| } | |||
| /** | |||
| * Ignore. | |||
| */ | |||
| public void setProcessErrorStream(InputStream is) {} | |||
| public void setProcessErrorStream(InputStream is) { | |||
| } | |||
| /** | |||
| * Set the inputstream | |||
| @@ -110,7 +112,8 @@ public class JikesOutputParser implements ExecuteStreamHandler { | |||
| /** | |||
| * Ignore. | |||
| */ | |||
| public void stop() {} | |||
| public void stop() { | |||
| } | |||
| /** | |||
| * Construct a new Parser object | |||
| @@ -119,12 +119,16 @@ public class KeySubst extends Task { | |||
| if (bw != null) { | |||
| try { | |||
| bw.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| if (bw != null) { | |||
| try { | |||
| br.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -168,7 +168,7 @@ public final class LoadProperties extends Task { | |||
| } | |||
| ByteArrayInputStream tis = null; | |||
| if ( encoding == null) { | |||
| if (encoding == null) { | |||
| tis = new ByteArrayInputStream(text.getBytes()); | |||
| } else { | |||
| tis = new ByteArrayInputStream(text.getBytes(encoding)); | |||
| @@ -741,7 +741,7 @@ public class Manifest { | |||
| = new Manifest(new InputStreamReader(in, "UTF-8")); | |||
| Attribute createdBy = new Attribute("Created-By", | |||
| System.getProperty("java.vm.version") + " (" | |||
| + System.getProperty("java.vm.vendor") + ")" ); | |||
| + System.getProperty("java.vm.vendor") + ")"); | |||
| defaultManifest.getMainSection().storeAttribute(createdBy); | |||
| return defaultManifest; | |||
| } catch (UnsupportedEncodingException e) { | |||
| @@ -204,7 +204,9 @@ public class ManifestTask extends Task { | |||
| if (isr != null) { | |||
| try { | |||
| isr.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -162,9 +162,8 @@ public abstract class MatchingTask extends Task implements SelectorContainer { | |||
| * @param itemString the string containing the files to include. | |||
| */ | |||
| public void XsetItems(String itemString) { | |||
| log("The items attribute is deprecated. " + | |||
| "Please use the includes attribute.", | |||
| Project.MSG_WARN); | |||
| log("The items attribute is deprecated. " | |||
| + "Please use the includes attribute.", Project.MSG_WARN); | |||
| if (itemString == null || itemString.equals("*") | |||
| || itemString.equals(".")) { | |||
| createInclude().setName("**"); | |||
| @@ -196,9 +195,8 @@ public abstract class MatchingTask extends Task implements SelectorContainer { | |||
| * @param ignoreString the string containing the files to ignore. | |||
| */ | |||
| public void XsetIgnore(String ignoreString) { | |||
| log("The ignore attribute is deprecated." + | |||
| "Please use the excludes attribute.", | |||
| Project.MSG_WARN); | |||
| log("The ignore attribute is deprecated." | |||
| + "Please use the excludes attribute.", Project.MSG_WARN); | |||
| if (ignoreString != null && ignoreString.length() > 0) { | |||
| StringTokenizer tok = new StringTokenizer(ignoreString, ", ", | |||
| false); | |||
| @@ -107,8 +107,8 @@ public class Move extends Copy { | |||
| File fromDir = (File) e.nextElement(); | |||
| File toDir = (File) completeDirMap.get(fromDir); | |||
| try { | |||
| log("Attempting to rename dir: " + fromDir + | |||
| " to " + toDir, verbosity); | |||
| log("Attempting to rename dir: " + fromDir | |||
| + " to " + toDir, verbosity); | |||
| renameFile(fromDir, toDir, filtering, forceOverwrite); | |||
| } catch (IOException ioe) { | |||
| String msg = "Failed to rename dir " + fromDir | |||
| @@ -119,8 +119,8 @@ public class Move extends Copy { | |||
| } | |||
| } | |||
| if (fileCopyMap.size() > 0) { // files to move | |||
| log("Moving " + fileCopyMap.size() + " files to " + | |||
| destDir.getAbsolutePath()); | |||
| log("Moving " + fileCopyMap.size() + " files to " | |||
| + destDir.getAbsolutePath()); | |||
| Enumeration e = fileCopyMap.keys(); | |||
| while (e.hasMoreElements()) { | |||
| @@ -139,8 +139,8 @@ public class Move extends Copy { | |||
| File d = new File(toFile); | |||
| try { | |||
| log("Attempting to rename: " + fromFile + | |||
| " to " + toFile, verbosity); | |||
| log("Attempting to rename: " + fromFile | |||
| + " to " + toFile, verbosity); | |||
| moved = renameFile(f, d, filtering, forceOverwrite); | |||
| } catch (IOException ioe) { | |||
| String msg = "Failed to rename " + fromFile | |||
| @@ -111,8 +111,8 @@ public abstract class Pack extends Task { | |||
| } | |||
| if (zipFile.isDirectory()) { | |||
| throw new BuildException("zipfile attribute must not " + | |||
| "represent a directory!", getLocation()); | |||
| throw new BuildException("zipfile attribute must not " | |||
| + "represent a directory!", getLocation()); | |||
| } | |||
| if (source == null) { | |||
| @@ -120,8 +120,8 @@ public abstract class Pack extends Task { | |||
| } | |||
| if (source.isDirectory()) { | |||
| throw new BuildException("Src attribute must not " + | |||
| "represent a directory!", getLocation()); | |||
| throw new BuildException("Src attribute must not " | |||
| + "represent a directory!", getLocation()); | |||
| } | |||
| } | |||
| @@ -133,14 +133,14 @@ public abstract class Pack extends Task { | |||
| validate(); | |||
| if (!source.exists()) { | |||
| log("Nothing to do: " + source.getAbsolutePath() + | |||
| " doesn't exist."); | |||
| log("Nothing to do: " + source.getAbsolutePath() | |||
| + " doesn't exist."); | |||
| } else if (zipFile.lastModified() < source.lastModified()) { | |||
| log("Building: " + zipFile.getAbsolutePath()); | |||
| pack(); | |||
| } else { | |||
| log("Nothing to do: " + zipFile.getAbsolutePath() + | |||
| " is up to date."); | |||
| log("Nothing to do: " + zipFile.getAbsolutePath() | |||
| + " is up to date."); | |||
| } | |||
| } | |||
| @@ -214,5 +214,4 @@ public class Patch extends Task { | |||
| throw new BuildException(e, getLocation()); | |||
| } | |||
| } | |||
| }// Patch | |||
| } | |||
| @@ -340,8 +340,8 @@ public class PathConvert extends Task { | |||
| */ | |||
| public void execute() throws BuildException { | |||
| Path savedPath = path; | |||
| String savedPathSep = pathSep;// may be altered in validateSetup | |||
| String savedDirSep = dirSep;// may be altered in validateSetup | |||
| String savedPathSep = pathSep; // may be altered in validateSetup | |||
| String savedDirSep = dirSep; // may be altered in validateSetup | |||
| try { | |||
| // If we are a reference, create a Path from the reference | |||
| @@ -372,7 +372,7 @@ public class PathConvert extends Task { | |||
| } | |||
| } | |||
| validateSetup();// validate our setup | |||
| validateSetup(); // validate our setup | |||
| // Currently, we deal with only two path formats: Unix and Windows | |||
| // And Unix is everything that is not Windows | |||
| @@ -392,7 +392,7 @@ public class PathConvert extends Task { | |||
| for (int i = 0; i < elems.length; i++) { | |||
| String elem = elems[i]; | |||
| elem = mapElement(elem);// Apply the path prefix map | |||
| elem = mapElement(elem); // Apply the path prefix map | |||
| // Now convert the path and file separator characters from the | |||
| // current os to the target os. | |||
| @@ -464,7 +464,7 @@ public class PathConvert extends Task { | |||
| if (newElem != elem) { | |||
| elem = newElem; | |||
| break;// We applied one, so we're done | |||
| break; // We applied one, so we're done | |||
| } | |||
| } | |||
| } | |||
| @@ -505,11 +505,13 @@ public class PathConvert extends Task { | |||
| dsep = targetWindows ? "\\" : "/"; | |||
| } | |||
| if (pathSep != null) {// override with pathsep= | |||
| if (pathSep != null) { | |||
| // override with pathsep= | |||
| psep = pathSep; | |||
| } | |||
| if (dirSep != null) {// override with dirsep= | |||
| if (dirSep != null) { | |||
| // override with dirsep= | |||
| dsep = dirSep; | |||
| } | |||
| @@ -493,7 +493,9 @@ public class Property extends Task { | |||
| if (is != null) { | |||
| try { | |||
| is.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| @@ -184,10 +184,10 @@ public class RecorderEntry implements BuildLogger { | |||
| for (int i = 0; i < size; i++) { | |||
| buf.append(" "); | |||
| }// for | |||
| } | |||
| buf.append(label); | |||
| }// if | |||
| }// if | |||
| } | |||
| } | |||
| buf.append(event.getMessage()); | |||
| log(buf.toString(), event.getPriority()); | |||
| @@ -449,19 +449,23 @@ public class Replace extends MatchingTask { | |||
| temp = null; | |||
| } | |||
| } catch (IOException ioe) { | |||
| throw new BuildException("IOException in " + src + " - " + | |||
| ioe.getClass().getName() + ":" | |||
| + ioe.getMessage(), ioe, getLocation()); | |||
| throw new BuildException("IOException in " + src + " - " | |||
| + ioe.getClass().getName() + ":" | |||
| + ioe.getMessage(), ioe, getLocation()); | |||
| } finally { | |||
| if (reader != null) { | |||
| try { | |||
| reader.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| if (writer != null) { | |||
| try { | |||
| writer.close(); | |||
| } catch (IOException e) {} | |||
| } catch (IOException e) { | |||
| // ignore | |||
| } | |||
| } | |||
| if (temp != null) { | |||
| temp.delete(); | |||
| @@ -511,8 +511,8 @@ public class Rmic extends MatchingTask { | |||
| int fileCount = compileList.size(); | |||
| if (fileCount > 0) { | |||
| log("RMI Compiling " + fileCount + | |||
| " class" + (fileCount > 1 ? "es" : "") + " to " + baseDir, | |||
| log("RMI Compiling " + fileCount | |||
| + " class" + (fileCount > 1 ? "es" : "") + " to " + baseDir, | |||
| Project.MSG_INFO); | |||
| // finally, lets execute the compiler!! | |||
| @@ -591,8 +591,8 @@ public class Rmic extends MatchingTask { | |||
| } | |||
| oldFile.delete(); | |||
| } catch (IOException ioe) { | |||
| String msg = "Failed to copy " + oldFile + " to " + | |||
| newFile + " due to " + ioe.getMessage(); | |||
| String msg = "Failed to copy " + oldFile + " to " | |||
| + newFile + " due to " + ioe.getMessage(); | |||
| throw new BuildException(msg, ioe, getLocation()); | |||
| } | |||
| } | |||
| @@ -637,15 +637,15 @@ public class Rmic extends MatchingTask { | |||
| } | |||
| return isValidRmiRemote(testClass); | |||
| } catch (ClassNotFoundException e) { | |||
| log("Unable to verify class " + classname + | |||
| ". It could not be found.", Project.MSG_WARN); | |||
| log("Unable to verify class " + classname | |||
| + ". It could not be found.", Project.MSG_WARN); | |||
| } catch (NoClassDefFoundError e) { | |||
| log("Unable to verify class " + classname + | |||
| ". It is not defined.", Project.MSG_WARN); | |||
| log("Unable to verify class " + classname | |||
| + ". It is not defined.", Project.MSG_WARN); | |||
| } catch (Throwable t) { | |||
| log("Unable to verify class " + classname + | |||
| ". Loading caused Exception: " + | |||
| t.getMessage(), Project.MSG_WARN); | |||
| log("Unable to verify class " + classname | |||
| + ". Loading caused Exception: " | |||
| + t.getMessage(), Project.MSG_WARN); | |||
| } | |||
| // we only get here if an exception has been thrown | |||
| return false; | |||
| @@ -375,7 +375,7 @@ public class SQLExec extends JDBCTask { | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| // Make a transaction for each file | |||
| for (int j = 0 ; j < srcFiles.length ; j++) { | |||
| for (int j = 0; j < srcFiles.length; j++) { | |||
| Transaction t = createTransaction(); | |||
| t.setSrc(new File(srcDir, srcFiles[j])); | |||
| } | |||
| @@ -424,14 +424,18 @@ public class SQLExec extends JDBCTask { | |||
| if (!isAutocommit() && conn != null && onError.equals("abort")) { | |||
| try { | |||
| conn.rollback(); | |||
| } catch (SQLException ex) {} | |||
| } catch (SQLException ex) { | |||
| // ignore | |||
| } | |||
| } | |||
| throw new BuildException(e, location); | |||
| } catch (SQLException e) { | |||
| if (!isAutocommit() && conn != null && onError.equals("abort")) { | |||
| try { | |||
| conn.rollback(); | |||
| } catch (SQLException ex) {} | |||
| } catch (SQLException ex) { | |||
| // ignore | |||
| } | |||
| } | |||
| throw new BuildException(e, location); | |||
| } finally { | |||
| @@ -442,11 +446,13 @@ public class SQLExec extends JDBCTask { | |||
| if (conn != null) { | |||
| conn.close(); | |||
| } | |||
| } catch (SQLException e) {} | |||
| } catch (SQLException ex) { | |||
| // ignore | |||
| } | |||
| } | |||
| log(goodSql + " of " + totalSql + | |||
| " SQL statements executed successfully"); | |||
| log(goodSql + " of " + totalSql | |||
| + " SQL statements executed successfully"); | |||
| } finally { | |||
| transactions = savedTransaction; | |||
| sqlCommand = savedSqlCommand; | |||
| @@ -394,8 +394,8 @@ public class SignJar extends Task { | |||
| } | |||
| return false; | |||
| } else { | |||
| return jarFile.getEntry(SIG_START + alias.toUpperCase() + | |||
| SIG_END) != null; | |||
| return jarFile.getEntry(SIG_START + alias.toUpperCase() | |||
| + SIG_END) != null; | |||
| } | |||
| } catch (IOException e) { | |||
| return false; | |||
| @@ -326,14 +326,14 @@ public class Sync extends Task { | |||
| /** | |||
| * Subclass Copy in order to access it's file/dir maps. | |||
| */ | |||
| public static class MyCopy | |||
| extends Copy { | |||
| public static class MyCopy extends Copy { | |||
| // List of files that must be copied, irrelevant from the | |||
| // fact that they are newer or not than the destination. | |||
| private Hashtable _dest2src = new Hashtable(); | |||
| public MyCopy() {} | |||
| public MyCopy() { | |||
| } | |||
| protected void buildMap(File fromDir, File toDir, String[] names, | |||
| FileNameMapper mapper, Hashtable map) { | |||
| @@ -392,7 +392,7 @@ public class Tar extends MatchingTask { | |||
| longWarningGiven = true; | |||
| } | |||
| } else if (longFileMode.isFailMode()) { | |||
| throw new BuildException( "Entry: " + vPath | |||
| throw new BuildException("Entry: " + vPath | |||
| + " longer than " + TarConstants.NAMELEN | |||
| + "characters.", getLocation()); | |||
| } | |||
| @@ -236,11 +236,11 @@ public class Touch extends Task { | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| String[] srcDirs = ds.getIncludedDirectories(); | |||
| for (int j = 0; j < srcFiles.length ; j++) { | |||
| for (int j = 0; j < srcFiles.length; j++) { | |||
| touch(new File(fromDir, srcFiles[j])); | |||
| } | |||
| for (int j = 0; j < srcDirs.length ; j++) { | |||
| for (int j = 0; j < srcDirs.length; j++) { | |||
| touch(new File(fromDir, srcDirs[j])); | |||
| } | |||
| } | |||
| @@ -60,4 +60,5 @@ package org.apache.tools.ant.taskdefs; | |||
| * @author Stefan Bodewig | |||
| * @ant.task ignore="true" | |||
| */ | |||
| public class Transform extends ExecuteOn {} | |||
| public class Transform extends ExecuteOn { | |||
| } | |||
| @@ -211,7 +211,7 @@ public class Untar extends Expand { | |||
| return new GZIPInputStream(istream); | |||
| } else { | |||
| if (BZIP2.equals(value)) { | |||
| final char[] magic = new char[] { 'B', 'Z' }; | |||
| final char[] magic = new char[] {'B', 'Z'}; | |||
| for (int i = 0; i < magic.length; i++) { | |||
| if (istream.read() != magic[i]) { | |||
| throw new BuildException( | |||
| @@ -120,11 +120,11 @@ public class WhichResource extends Task { | |||
| * validate | |||
| */ | |||
| private void validate() { | |||
| int setcount=0; | |||
| int setcount = 0; | |||
| if (classname != null) { | |||
| setcount++; | |||
| } | |||
| if (resource!=null) { | |||
| if (resource != null) { | |||
| setcount++; | |||
| } | |||
| @@ -137,7 +137,7 @@ public class WhichResource extends Task { | |||
| throw new BuildException( | |||
| "Only one of classname or resource can be specified"); | |||
| } | |||
| if (property==null) { | |||
| if (property == null) { | |||
| throw new BuildException("No property defined"); | |||
| } | |||
| } | |||
| @@ -148,10 +148,10 @@ public class WhichResource extends Task { | |||
| */ | |||
| public void execute() throws BuildException { | |||
| validate(); | |||
| if (classpath!= null) { | |||
| if (classpath != null) { | |||
| getProject().log("using user supplied classpath: " + classpath, | |||
| Project.MSG_DEBUG); | |||
| classpath=classpath.concatSystemClasspath("ignore"); | |||
| classpath = classpath.concatSystemClasspath("ignore"); | |||
| } else { | |||
| classpath = new Path(getProject()); | |||
| classpath = classpath.concatSystemClasspath("only"); | |||
| @@ -161,23 +161,23 @@ public class WhichResource extends Task { | |||
| loader = new AntClassLoader(getProject().getCoreLoader(), | |||
| getProject(), | |||
| classpath, false); | |||
| String location=null; | |||
| if (classname!=null) { | |||
| String location = null; | |||
| if (classname != null) { | |||
| //convert a class name into a resource | |||
| classname= classname.replace('.', '/'); | |||
| resource="/"+ classname +".class"; | |||
| classname = classname.replace('.', '/'); | |||
| resource = "/" + classname + ".class"; | |||
| } else { | |||
| if (!resource.startsWith("/")) { | |||
| resource="/"+resource; | |||
| resource = "/" + resource; | |||
| } | |||
| } | |||
| log("Searching for "+resource,Project.MSG_VERBOSE); | |||
| log("Searching for " + resource, Project.MSG_VERBOSE); | |||
| URL url; | |||
| url=loader.getResource(resource); | |||
| if (url!=null) { | |||
| url = loader.getResource(resource); | |||
| if (url != null) { | |||
| //set the property | |||
| location = url.toExternalForm(); | |||
| getProject().setNewProperty(property,location); | |||
| getProject().setNewProperty(property, location); | |||
| } | |||
| } | |||
| @@ -638,7 +638,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| * @return the parameter name | |||
| * @exception BuildException if the name is not set. | |||
| */ | |||
| public String getName() throws BuildException{ | |||
| public String getName() throws BuildException { | |||
| if (name == null) { | |||
| throw new BuildException("Name attribute is missing."); | |||
| } | |||
| @@ -651,7 +651,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| * @return the parameter expression | |||
| * @exception BuildException if the expression is not set. | |||
| */ | |||
| public String getExpression() throws BuildException{ | |||
| public String getExpression() throws BuildException { | |||
| if (expression == null) { | |||
| throw new BuildException("Expression attribute is missing."); | |||
| } | |||
| @@ -745,7 +745,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| liaison.addParam(p.getName(), p.getExpression()); | |||
| } | |||
| if (liaison instanceof TraXLiaison) { | |||
| configureTraXLiaison((TraXLiaison)liaison); | |||
| configureTraXLiaison((TraXLiaison) liaison); | |||
| } | |||
| } catch (Exception ex) { | |||
| log("Failed to transform using stylesheet " + stylesheet, Project.MSG_INFO); | |||
| @@ -767,7 +767,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| for (Enumeration attrs = factory.getAttributes(); | |||
| attrs.hasMoreElements();) { | |||
| Factory.Attribute attr = | |||
| (Factory.Attribute)attrs.nextElement(); | |||
| (Factory.Attribute) attrs.nextElement(); | |||
| liaison.setAttribute(attr.getName(), attr.getValue()); | |||
| } | |||
| } | |||
| @@ -781,7 +781,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| // configure output properties | |||
| for (Enumeration props = outputProperties.elements(); | |||
| props.hasMoreElements();) { | |||
| OutputProperty prop = (OutputProperty)props.nextElement(); | |||
| OutputProperty prop = (OutputProperty) props.nextElement(); | |||
| liaison.setOutputProperty(prop.getName(), prop.getValue()); | |||
| } | |||
| } | |||
| @@ -887,7 +887,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| // a value must be of a given type | |||
| // say boolean|integer|string that are mostly used. | |||
| if ("true".equalsIgnoreCase(value) | |||
| || "false".equalsIgnoreCase(value) ) { | |||
| || "false".equalsIgnoreCase(value)) { | |||
| this.value = new Boolean(value); | |||
| } else { | |||
| try { | |||
| @@ -406,9 +406,8 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
| String nodeName = attributeNode.getNodeName(); | |||
| String attributeValue = getAttributeValue(attributeNode); | |||
| Path containingPath = | |||
| (container != null && container instanceof Path | |||
| ? (Path) container : null ); | |||
| Path containingPath = (container != null | |||
| && container instanceof Path ? (Path) container : null); | |||
| /* | |||
| * The main conditional logic -- if the attribute | |||
| @@ -501,7 +500,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
| // when we read them, though (instead of keeping them | |||
| // outside of the project and batch adding them at the end) | |||
| // to allow other properties to reference them. | |||
| value = (String)addedAttributes.get(name) + "," + value; | |||
| value = (String) addedAttributes.get(name) + "," + value; | |||
| getProject().setProperty(name, value); | |||
| } else { | |||
| getProject().setNewProperty(name, value); | |||
| @@ -545,7 +544,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
| * Return whether the provided attribute name is recognized or not. | |||
| */ | |||
| private static boolean isSemanticAttribute (String attributeName) { | |||
| for (int i=0;i<ATTRIBUTES.length;i++) { | |||
| for (int i = 0; i < ATTRIBUTES.length; i++) { | |||
| if (attributeName.equals(ATTRIBUTES[i])) { | |||
| return true; | |||
| } | |||
| @@ -58,7 +58,7 @@ import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.taskdefs.Javac; | |||
| /** | |||
| * The interface that all compiler adapters must adher to. | |||
| * The interface that all compiler adapters must adher to. | |||
| * | |||
| * <p>A compiler adapter is an adapter that interprets the javac's | |||
| * parameters in preperation to be passed off to the compier this | |||
| @@ -67,7 +67,7 @@ import org.apache.tools.ant.taskdefs.Javac; | |||
| * task, the execute command and a parameterless constructor (for | |||
| * reflection).</p> | |||
| * | |||
| * @author Jay Dickon Glanville | |||
| * @author Jay Dickon Glanville | |||
| * <a href="mailto:jayglanville@home.com">jayglanville@home.com</a> | |||
| * @since Ant 1.3 | |||
| */ | |||
| @@ -66,6 +66,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||
| * @since Ant 1.3 | |||
| */ | |||
| public class CompilerAdapterFactory { | |||
| private static final String MODERN_COMPILER = "com.sun.tools.javac.Main"; | |||
| /** This is a singleton -- can't create instances!! */ | |||
| private CompilerAdapterFactory() { | |||
| @@ -95,7 +96,7 @@ public class CompilerAdapterFactory { | |||
| * @throws BuildException if the compiler type could not be resolved into | |||
| * a compiler adapter. | |||
| */ | |||
| public static CompilerAdapter getCompiler(String compilerType, Task task) | |||
| public static CompilerAdapter getCompiler(String compilerType, Task task) | |||
| throws BuildException { | |||
| boolean isClassicCompilerSupported = true; | |||
| //as new versions of java come out, add them to this test | |||
| @@ -108,7 +109,7 @@ public class CompilerAdapterFactory { | |||
| } | |||
| if (compilerType.equalsIgnoreCase("extJavac")) { | |||
| return new JavacExternal(); | |||
| } | |||
| } | |||
| if (compilerType.equalsIgnoreCase("classic") || | |||
| compilerType.equalsIgnoreCase("javac1.1") || | |||
| compilerType.equalsIgnoreCase("javac1.2")) { | |||
| @@ -119,7 +120,7 @@ public class CompilerAdapterFactory { | |||
| + "not support the classic " | |||
| + "compiler; upgrading to modern", | |||
| Project.MSG_WARN); | |||
| compilerType="modern"; | |||
| compilerType = "modern"; | |||
| } | |||
| } | |||
| //on java<=1.3 the modern falls back to classic if it is not found | |||
| @@ -136,10 +137,10 @@ public class CompilerAdapterFactory { | |||
| + "classic compiler", Project.MSG_WARN); | |||
| return new Javac12(); | |||
| } else { | |||
| throw new BuildException("Unable to find a javac " | |||
| throw new BuildException("Unable to find a javac " | |||
| + "compiler;\n" | |||
| + "com.sun.tools.javac.Main " | |||
| + "is not on the " | |||
| + MODERN_COMPILER | |||
| + " is not on the " | |||
| + "classpath.\n" | |||
| + "Perhaps JAVA_HOME does not" | |||
| + " point to the JDK"); | |||
| @@ -167,21 +168,21 @@ public class CompilerAdapterFactory { | |||
| /** | |||
| * query for the Modern compiler existing | |||
| * @return true iff classic os on the classpath | |||
| */ | |||
| */ | |||
| private static boolean doesModernCompilerExist() { | |||
| try { | |||
| Class.forName("com.sun.tools.javac.Main"); | |||
| Class.forName(MODERN_COMPILER); | |||
| return true; | |||
| } catch (ClassNotFoundException cnfe) { | |||
| try { | |||
| CompilerAdapterFactory.class.getClassLoader().loadClass( "com.sun.tools.javac.Main" ); | |||
| CompilerAdapterFactory.class.getClassLoader().loadClass(MODERN_COMPILER); | |||
| return true; | |||
| } catch (ClassNotFoundException cnfe2) { | |||
| } | |||
| } | |||
| return false; | |||
| } | |||
| /** | |||
| * Tries to resolve the given classname into a compiler adapter. | |||
| * Throws a fit if it can't. | |||
| @@ -197,14 +198,14 @@ public class CompilerAdapterFactory { | |||
| Object o = c.newInstance(); | |||
| return (CompilerAdapter) o; | |||
| } catch (ClassNotFoundException cnfe) { | |||
| throw new BuildException("Compiler Adapter '"+className | |||
| throw new BuildException("Compiler Adapter '" + className | |||
| + "' can\'t be found.", cnfe); | |||
| } catch (ClassCastException cce) { | |||
| throw new BuildException(className + " isn\'t the classname of " | |||
| + "a compiler adapter.", cce); | |||
| } catch (Throwable t) { | |||
| // for all other possibilities | |||
| throw new BuildException("Compiler Adapter "+className | |||
| throw new BuildException("Compiler Adapter " + className | |||
| + " caused an interesting exception.", t); | |||
| } | |||
| } | |||
| @@ -74,7 +74,7 @@ import org.apache.tools.ant.util.JavaEnvUtils; | |||
| * Currently, this is a cut-and-paste of the original javac task. | |||
| * | |||
| * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | |||
| * @author Robin Green | |||
| * @author Robin Green | |||
| * <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | |||
| * @author Stefan Bodewig | |||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | |||
| @@ -217,7 +217,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| if (memoryInitialSize != null) { | |||
| if (!attributes.isForkedJavac()) { | |||
| attributes.log("Since fork is false, ignoring " | |||
| + "memoryInitialSize setting.", | |||
| + "memoryInitialSize setting.", | |||
| Project.MSG_WARN); | |||
| } else { | |||
| cmd.createArgument().setValue(memoryParameterPrefix | |||
| @@ -435,7 +435,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| * POSIX seems to define a lower limit of 4k, so use a temporary | |||
| * file if the total length of the command line exceeds this limit. | |||
| */ | |||
| if (Commandline.toString(args).length() > 4096 | |||
| if (Commandline.toString(args).length() > 4096 | |||
| && firstFileName >= 0) { | |||
| PrintWriter out = null; | |||
| try { | |||
| @@ -459,11 +459,15 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| System.arraycopy(args, 0, commandArray, 0, firstFileName); | |||
| commandArray[firstFileName] = "@" + tmpFile; | |||
| } catch (IOException e) { | |||
| throw new BuildException("Error creating temporary file", | |||
| throw new BuildException("Error creating temporary file", | |||
| e, location); | |||
| } finally { | |||
| if (out != null) { | |||
| try {out.close();} catch (Throwable t) {} | |||
| try { | |||
| out.close(); | |||
| } catch (Throwable t) { | |||
| // ignore | |||
| } | |||
| } | |||
| } | |||
| } else { | |||
| @@ -511,9 +515,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| */ | |||
| protected boolean assumeJava11() { | |||
| return "javac1.1".equals(attributes.getCompilerVersion()) || | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) || | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)); | |||
| } | |||
| @@ -523,9 +527,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| */ | |||
| protected boolean assumeJava12() { | |||
| return "javac1.2".equals(attributes.getCompilerVersion()) || | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) || | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)); | |||
| } | |||
| @@ -535,11 +539,11 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| */ | |||
| protected boolean assumeJava13() { | |||
| return "javac1.3".equals(attributes.getCompilerVersion()) || | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| ("classic".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) || | |||
| ("modern".equals(attributes.getCompilerVersion()) | |||
| ("modern".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) || | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| ("extJavac".equals(attributes.getCompilerVersion()) | |||
| && JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)); | |||
| } | |||
| @@ -80,7 +80,7 @@ public class Gcj extends DefaultCompilerAdapter { | |||
| int firstFileName = cmd.size(); | |||
| logAndAddFilesToCompile(cmd); | |||
| return | |||
| return | |||
| executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; | |||
| } | |||
| @@ -118,13 +118,13 @@ public class Gcj extends DefaultCompilerAdapter { | |||
| if (destDir != null) { | |||
| cmd.createArgument().setValue("-d"); | |||
| cmd.createArgument().setFile(destDir); | |||
| if (destDir.mkdirs()) { | |||
| throw new BuildException("Can't make output directories. " | |||
| + "Maybe permission is wrong. "); | |||
| }; | |||
| } | |||
| cmd.createArgument().setValue("-classpath"); | |||
| cmd.createArgument().setPath(classpath); | |||
| @@ -69,7 +69,7 @@ import org.apache.tools.ant.types.Commandline; | |||
| * was refactored. | |||
| * | |||
| * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | |||
| * @author Robin Green | |||
| * @author Robin Green | |||
| * <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | |||
| * @author Stefan Bodewig | |||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | |||
| @@ -92,30 +92,30 @@ public class Javac12 extends DefaultCompilerAdapter { | |||
| // Create an instance of the compiler, redirecting output to | |||
| // the project log | |||
| Class c = Class.forName("sun.tools.javac.Main"); | |||
| Constructor cons = | |||
| c.getConstructor(new Class[] { OutputStream.class, | |||
| String.class }); | |||
| Object compiler = cons.newInstance(new Object[] { logstr, | |||
| "javac" }); | |||
| Constructor cons = | |||
| c.getConstructor(new Class[] {OutputStream.class, | |||
| String.class}); | |||
| Object compiler | |||
| = cons.newInstance(new Object[] {logstr, "javac"}); | |||
| // Call the compile() method | |||
| Method compile = c.getMethod("compile", | |||
| new Class [] { String[].class }); | |||
| Boolean ok = | |||
| (Boolean) compile.invoke(compiler, | |||
| Method compile = c.getMethod("compile", | |||
| new Class [] {String[].class}); | |||
| Boolean ok = | |||
| (Boolean) compile.invoke(compiler, | |||
| new Object[] {cmd.getArguments()}); | |||
| return ok.booleanValue(); | |||
| } catch (ClassNotFoundException ex) { | |||
| throw new BuildException("Cannot use classic compiler, as it is " | |||
| + "not available. A common solution is " | |||
| + "to set the environment variable" | |||
| + " JAVA_HOME to your jdk directory.", | |||
| + " JAVA_HOME to your jdk directory.", | |||
| location); | |||
| } catch (Exception ex) { | |||
| if (ex instanceof BuildException) { | |||
| throw (BuildException) ex; | |||
| } else { | |||
| throw new BuildException("Error starting classic compiler: ", | |||
| throw new BuildException("Error starting classic compiler: ", | |||
| ex, location); | |||
| } | |||
| } finally { | |||
| @@ -66,9 +66,9 @@ import org.apache.tools.ant.types.Commandline; | |||
| * was refactored. | |||
| * | |||
| * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | |||
| * @author Robin Green | |||
| * @author Robin Green | |||
| * <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | |||
| * @author Stefan Bodewig | |||
| * @author Stefan Bodewig | |||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | |||
| * | |||
| * @since Ant 1.3 | |||
| @@ -103,7 +103,7 @@ public class Javac13 extends DefaultCompilerAdapter { | |||
| if (ex instanceof BuildException) { | |||
| throw (BuildException) ex; | |||
| } else { | |||
| throw new BuildException("Error starting modern compiler", | |||
| throw new BuildException("Error starting modern compiler", | |||
| ex, location); | |||
| } | |||
| } | |||
| @@ -78,7 +78,7 @@ public class JavacExternal extends DefaultCompilerAdapter { | |||
| int firstFileName = assumeJava11() ? -1 : cmd.size(); | |||
| logAndAddFilesToCompile(cmd); | |||
| return | |||
| return | |||
| executeExternalCompile(cmd.getCommandline(), firstFileName, | |||
| true) | |||
| == 0; | |||
| @@ -65,9 +65,9 @@ import org.apache.tools.ant.types.Path; | |||
| * was refactored. | |||
| * | |||
| * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | |||
| * @author Robin Green | |||
| * @author Robin Green | |||
| * <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | |||
| * @author Stefan Bodewig | |||
| * @author Stefan Bodewig | |||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | |||
| * @since Ant 1.3 | |||
| */ | |||
| @@ -122,7 +122,7 @@ public class Jikes extends DefaultCompilerAdapter { | |||
| if (jikesPath != null) { | |||
| classpath.append(new Path(project, jikesPath)); | |||
| } | |||
| Commandline cmd = new Commandline(); | |||
| String exec = getJavac().getExecutable(); | |||
| cmd.setExecutable(exec == null ? "jikes" : exec); | |||
| @@ -135,7 +135,7 @@ public class Jikes extends DefaultCompilerAdapter { | |||
| cmd.createArgument().setValue("-d"); | |||
| cmd.createArgument().setFile(destDir); | |||
| } | |||
| cmd.createArgument().setValue("-classpath"); | |||
| cmd.createArgument().setPath(classpath); | |||
| @@ -154,13 +154,13 @@ public class Jikes extends DefaultCompilerAdapter { | |||
| } | |||
| if (depend) { | |||
| cmd.createArgument().setValue("-depend"); | |||
| } | |||
| } | |||
| if (target != null) { | |||
| cmd.createArgument().setValue("-target"); | |||
| cmd.createArgument().setValue(target); | |||
| } | |||
| /** | |||
| * XXX | |||
| * Perhaps we shouldn't use properties for these | |||
| @@ -185,7 +185,7 @@ public class Jikes extends DefaultCompilerAdapter { | |||
| * that don't exist. As this is often the case, these | |||
| * warning can be pretty annoying. | |||
| */ | |||
| String warningsProperty = | |||
| String warningsProperty = | |||
| project.getProperty("build.compiler.warnings"); | |||
| if (warningsProperty != null) { | |||
| attributes.log("!! the build.compiler.warnings property is " | |||
| @@ -196,32 +196,32 @@ public class Jikes extends DefaultCompilerAdapter { | |||
| cmd.createArgument().setValue("-nowarn"); | |||
| } | |||
| } if (attributes.getNowarn()) { | |||
| /* | |||
| /* | |||
| * FIXME later | |||
| * | |||
| * let the magic property win over the attribute for backwards | |||
| * let the magic property win over the attribute for backwards | |||
| * compatibility | |||
| */ | |||
| cmd.createArgument().setValue("-nowarn"); | |||
| } | |||
| /** | |||
| * Jikes can issue pedantic warnings. | |||
| * Jikes can issue pedantic warnings. | |||
| */ | |||
| String pedanticProperty = | |||
| String pedanticProperty = | |||
| project.getProperty("build.compiler.pedantic"); | |||
| if (pedanticProperty != null && Project.toBoolean(pedanticProperty)) { | |||
| cmd.createArgument().setValue("+P"); | |||
| } | |||
| /** | |||
| * Jikes supports something it calls "full dependency | |||
| * checking", see the jikes documentation for differences | |||
| * between -depend and +F. | |||
| */ | |||
| String fullDependProperty = | |||
| String fullDependProperty = | |||
| project.getProperty("build.compiler.fulldepend"); | |||
| if (fullDependProperty != null | |||
| if (fullDependProperty != null | |||
| && Project.toBoolean(fullDependProperty)) { | |||
| cmd.createArgument().setValue("+F"); | |||
| } | |||
| @@ -236,7 +236,7 @@ public class Jikes extends DefaultCompilerAdapter { | |||
| int firstFileName = cmd.size(); | |||
| logAndAddFilesToCompile(cmd); | |||
| return | |||
| return | |||
| executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; | |||
| } | |||
| @@ -65,9 +65,9 @@ import org.apache.tools.ant.types.Path; | |||
| * was refactored. | |||
| * | |||
| * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | |||
| * @author Robin Green | |||
| * @author Robin Green | |||
| * <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | |||
| * @author Stefan Bodewig | |||
| * @author Stefan Bodewig | |||
| * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | |||
| * @since Ant 1.3 | |||
| */ | |||
| @@ -111,7 +111,7 @@ public class Jvc extends DefaultCompilerAdapter { | |||
| cmd.createArgument().setValue("/d"); | |||
| cmd.createArgument().setFile(destDir); | |||
| } | |||
| // Add the Classpath before the "internal" one. | |||
| cmd.createArgument().setValue("/cp:p"); | |||
| cmd.createArgument().setPath(classpath); | |||
| @@ -147,7 +147,7 @@ public class Jvc extends DefaultCompilerAdapter { | |||
| int firstFileName = cmd.size(); | |||
| logAndAddFilesToCompile(cmd); | |||
| return | |||
| return | |||
| executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; | |||
| } | |||
| } | |||
| @@ -65,7 +65,7 @@ import org.apache.tools.ant.types.Path; | |||
| * This is primarily a cut-and-paste from Jikes.java and | |||
| * DefaultCompilerAdapter. | |||
| * | |||
| * @author <a href="mailto:tora@debian.org">Takashi Okamoto</a> | |||
| * @author <a href="mailto:tora@debian.org">Takashi Okamoto</a> | |||
| * @since Ant 1.4 | |||
| */ | |||
| public class Kjc extends DefaultCompilerAdapter { | |||
| @@ -84,22 +84,22 @@ public class Kjc extends DefaultCompilerAdapter { | |||
| // Call the compile() method | |||
| Method compile = c.getMethod("compile", | |||
| new Class [] { String [].class }); | |||
| Boolean ok = | |||
| (Boolean) compile.invoke(null, | |||
| new Class [] {String [].class}); | |||
| Boolean ok = | |||
| (Boolean) compile.invoke(null, | |||
| new Object[] {cmd.getArguments()}); | |||
| return ok.booleanValue(); | |||
| } catch (ClassNotFoundException ex) { | |||
| throw new BuildException("Cannot use kjc compiler, as it is not " | |||
| + "available. A common solution is to " | |||
| + "set the environment variable CLASSPATH " | |||
| + "to your kjc archive (kjc.jar).", | |||
| + "to your kjc archive (kjc.jar).", | |||
| location); | |||
| } catch (Exception ex) { | |||
| if (ex instanceof BuildException) { | |||
| throw (BuildException) ex; | |||
| } else { | |||
| throw new BuildException("Error starting kjc compiler: ", | |||
| throw new BuildException("Error starting kjc compiler: ", | |||
| ex, location); | |||
| } | |||
| } | |||
| @@ -132,31 +132,31 @@ public class Kjc extends DefaultCompilerAdapter { | |||
| if (bootclasspath != null) { | |||
| cp.append(bootclasspath); | |||
| } | |||
| if (extdirs != null) { | |||
| cp.addExtdirs(extdirs); | |||
| } | |||
| cp.append(classpath); | |||
| if (compileSourcepath != null) { | |||
| cp.append(compileSourcepath); | |||
| } else { | |||
| cp.append(src); | |||
| } | |||
| } | |||
| cmd.createArgument().setPath(cp); | |||
| // kjc-1.5A doesn't support -encoding option now. | |||
| // but it will be supported near the feature. | |||
| if (encoding != null) { | |||
| cmd.createArgument().setValue("-encoding"); | |||
| cmd.createArgument().setValue(encoding); | |||
| } | |||
| if (debug) { | |||
| cmd.createArgument().setValue("-g"); | |||
| } | |||
| if (optimize) { | |||
| cmd.createArgument().setValue("-O2"); | |||
| } | |||
| @@ -61,7 +61,7 @@ import org.apache.tools.ant.types.Commandline; | |||
| /** | |||
| * The implementation of the sj compiler. | |||
| * Uses the defaults for DefaultCompilerAdapter | |||
| * | |||
| * | |||
| * @author <a href="mailto:don@bea.com">Don Ferguson</a> | |||
| * @since Ant 1.4 | |||
| */ | |||
| @@ -79,7 +79,7 @@ public class Sj extends DefaultCompilerAdapter { | |||
| int firstFileName = cmd.size() - compileList.length; | |||
| return | |||
| return | |||
| executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; | |||
| } | |||
| @@ -62,7 +62,7 @@ import org.apache.tools.ant.BuildException; | |||
| * | |||
| * <p>Iterates over all conditions and returns false as soon as one | |||
| * evaluates to false.</p> | |||
| * | |||
| * | |||
| * @author Stefan Bodewig | |||
| * @since Ant 1.4 | |||
| * @version $Revision$ | |||
| @@ -89,14 +89,14 @@ public class Contains implements Condition { | |||
| /** | |||
| * Whether to search ignoring case or not. | |||
| * | |||
| * | |||
| * @since 1.1, Ant 1.5 | |||
| */ | |||
| public void setCasesensitive(boolean b) { | |||
| caseSensitive = b; | |||
| } | |||
| /** | |||
| /** | |||
| * @since 1.1, Ant 1.5 | |||
| */ | |||
| public boolean eval() throws BuildException { | |||
| @@ -105,7 +105,7 @@ public class Contains implements Condition { | |||
| + "in contains"); | |||
| } | |||
| return caseSensitive | |||
| return caseSensitive | |||
| ? string.indexOf(subString) > -1 | |||
| : string.toLowerCase().indexOf(subString.toLowerCase()) > -1; | |||
| } | |||
| @@ -105,7 +105,7 @@ public class Equals implements Condition { | |||
| arg1 = arg1.trim(); | |||
| arg2 = arg2.trim(); | |||
| } | |||
| return caseSensitive ? arg1.equals(arg2) : arg1.equalsIgnoreCase(arg2); | |||
| } | |||
| } | |||
| @@ -65,7 +65,7 @@ import org.apache.tools.ant.ProjectComponent; | |||
| /** | |||
| * Condition to wait for a HTTP request to succeed. Its attribute(s) are: | |||
| * url - the URL of the request. | |||
| * errorsBeginAt - number at which errors begin at; default=400. | |||
| * errorsBeginAt - number at which errors begin at; default=400. | |||
| * @author <a href="mailto:denis@network365.com">Denis Hennessy</a> | |||
| * @since Ant 1.5 | |||
| */ | |||
| @@ -76,12 +76,12 @@ public class Http extends ProjectComponent implements Condition { | |||
| spec = url; | |||
| } | |||
| private int errorsBeginAt=400; | |||
| private int errorsBeginAt = 400; | |||
| public void setErrorsBeginAt(int errorsBeginAt) { | |||
| this.errorsBeginAt=errorsBeginAt; | |||
| this.errorsBeginAt = errorsBeginAt; | |||
| } | |||
| public boolean eval() throws BuildException { | |||
| if (spec == null) { | |||
| throw new BuildException("No url specified in http condition"); | |||
| @@ -94,7 +94,7 @@ public class Http extends ProjectComponent implements Condition { | |||
| if (conn instanceof HttpURLConnection) { | |||
| HttpURLConnection http = (HttpURLConnection) conn; | |||
| int code = http.getResponseCode(); | |||
| log("Result code for " + spec + " was " + code, | |||
| log("Result code for " + spec + " was " + code, | |||
| Project.MSG_VERBOSE); | |||
| if (code > 0 && code < errorsBeginAt) { | |||
| return true; | |||
| @@ -64,14 +64,14 @@ import org.apache.tools.ant.ProjectComponent; | |||
| * @since Ant 1.5 | |||
| */ | |||
| public class IsFalse extends ProjectComponent implements Condition { | |||
| /** | |||
| /** | |||
| * what we eval | |||
| */ | |||
| private Boolean value=null; | |||
| */ | |||
| private Boolean value = null; | |||
| /** | |||
| * set the value to be tested; let ant eval it to true/false | |||
| */ | |||
| */ | |||
| public void setValue(boolean value) { | |||
| this.value = new Boolean(value); | |||
| } | |||
| @@ -79,7 +79,7 @@ public class IsFalse extends ProjectComponent implements Condition { | |||
| /** | |||
| * return the inverted value; | |||
| * @throws BuildException if someone forgot to spec a value | |||
| */ | |||
| */ | |||
| public boolean eval() throws BuildException { | |||
| if (value == null) { | |||
| throw new BuildException("Nothing to test for falsehood"); | |||
| @@ -84,7 +84,7 @@ public class IsReference extends ProjectComponent implements Condition { | |||
| throw new BuildException("No reference specified for isreference " | |||
| + "condition"); | |||
| } | |||
| Object o = getProject().getReference(ref.getRefId()); | |||
| if (o == null) { | |||
| @@ -92,11 +92,11 @@ public class IsReference extends ProjectComponent implements Condition { | |||
| } else if (type == null) { | |||
| return true; | |||
| } else { | |||
| Class typeClass = | |||
| Class typeClass = | |||
| (Class) getProject().getDataTypeDefinitions().get(type); | |||
| if (typeClass == null) { | |||
| typeClass = | |||
| typeClass = | |||
| (Class) getProject().getTaskDefinitions().get(type); | |||
| } | |||
| @@ -67,14 +67,16 @@ import org.apache.tools.ant.ProjectComponent; | |||
| public class IsSet extends ProjectComponent implements Condition { | |||
| private String property; | |||
| public void setProperty(String p) {property = p;} | |||
| public void setProperty(String p) { | |||
| property = p; | |||
| } | |||
| public boolean eval() throws BuildException { | |||
| if (property == null) { | |||
| throw new BuildException("No property specified for isset " | |||
| + "condition"); | |||
| } | |||
| return getProject().getProperty(property) != null; | |||
| } | |||
| @@ -64,14 +64,14 @@ import org.apache.tools.ant.ProjectComponent; | |||
| * @since Ant 1.5 | |||
| */ | |||
| public class IsTrue extends ProjectComponent implements Condition { | |||
| /** | |||
| /** | |||
| * what we eval | |||
| */ | |||
| private Boolean value=null; | |||
| */ | |||
| private Boolean value = null; | |||
| /** | |||
| * set the value to be tested; let ant eval it to true/false | |||
| */ | |||
| */ | |||
| public void setValue(boolean value) { | |||
| this.value = new Boolean(value); | |||
| } | |||
| @@ -79,7 +79,7 @@ public class IsTrue extends ProjectComponent implements Condition { | |||
| /** | |||
| * return the value; | |||
| * @throws BuildException if someone forgot to spec a value | |||
| */ | |||
| */ | |||
| public boolean eval() throws BuildException { | |||
| if (value == null) { | |||
| throw new BuildException("Nothing to test for truth"); | |||
| @@ -62,7 +62,7 @@ import org.apache.tools.ant.BuildException; | |||
| * | |||
| * <p>Iterates over all conditions and returns true as soon as one | |||
| * evaluates to true.</p> | |||
| * | |||
| * | |||
| * @author Stefan Bodewig | |||
| * @since Ant 1.4 | |||
| * @version $Revision$ | |||
| @@ -79,7 +79,8 @@ public class Os implements Condition { | |||
| private String version; | |||
| private String arch; | |||
| public Os() {} | |||
| public Os() { | |||
| } | |||
| public Os(String family) { | |||
| setFamily(family); | |||
| @@ -103,7 +104,9 @@ public class Os implements Condition { | |||
| * <li>os/400</li> | |||
| * </ul> | |||
| */ | |||
| public void setFamily(String f) {family = f.toLowerCase(Locale.US);} | |||
| public void setFamily(String f) { | |||
| family = f.toLowerCase(Locale.US); | |||
| } | |||
| /** | |||
| * Sets the desired OS name | |||
| @@ -87,7 +87,7 @@ public class Socket extends ProjectComponent implements Condition { | |||
| if (port == 0) { | |||
| throw new BuildException("No port specified in socket condition"); | |||
| } | |||
| log("Checking for listener at " + server + ":" + port, | |||
| log("Checking for listener at " + server + ":" + port, | |||
| Project.MSG_VERBOSE); | |||
| try { | |||
| new java.net.Socket(server, port); | |||
| @@ -90,7 +90,7 @@ class CVSEntry { | |||
| void setAuthor(final String author) { | |||
| m_author = author; | |||
| } | |||
| String getAuthor() { | |||
| return m_author; | |||
| } | |||
| @@ -104,7 +104,7 @@ class CVSEntry { | |||
| } | |||
| public String toString() { | |||
| return getAuthor() + "\n" + getDate() + "\n" + getFiles() + "\n" | |||
| return getAuthor() + "\n" + getDate() + "\n" + getFiles() + "\n" | |||
| + getComment(); | |||
| } | |||
| } | |||
| @@ -221,7 +221,7 @@ public class ChangeLogTask extends Task { | |||
| * cvs command | |||
| */ | |||
| public void execute() throws BuildException { | |||
| File savedDir = m_dir;// may be altered in validate | |||
| File savedDir = m_dir; // may be altered in validate | |||
| try { | |||
| @@ -251,7 +251,7 @@ public class ChangeLogTask extends Task { | |||
| // We want something of the form: -d ">=YYYY-MM-dd" | |||
| final String dateRange = ">=" + outputDate.format(m_start); | |||
| // Supply '-d' as a separate argument - Bug# 14397 | |||
| // Supply '-d' as a separate argument - Bug# 14397 | |||
| command.createArgument().setValue("-d"); | |||
| command.createArgument().setValue(dateRange); | |||
| } | |||
| @@ -66,10 +66,10 @@ import java.util.TimeZone; | |||
| */ | |||
| class ChangeLogWriter { | |||
| /** output format for dates writtn to xml file */ | |||
| private static final SimpleDateFormat c_outputDate | |||
| private static final SimpleDateFormat c_outputDate | |||
| = new SimpleDateFormat("yyyy-MM-dd"); | |||
| /** output format for times writtn to xml file */ | |||
| private static final SimpleDateFormat c_outputTime | |||
| private static final SimpleDateFormat c_outputTime | |||
| = new SimpleDateFormat("HH:mm"); | |||
| static { | |||
| @@ -107,11 +107,11 @@ class ChangeLogWriter { | |||
| */ | |||
| private void printEntry(final PrintWriter output, final CVSEntry entry) { | |||
| output.println("\t<entry>"); | |||
| output.println("\t\t<date>" + c_outputDate.format(entry.getDate()) | |||
| output.println("\t\t<date>" + c_outputDate.format(entry.getDate()) | |||
| + "</date>"); | |||
| output.println("\t\t<time>" + c_outputTime.format(entry.getDate()) | |||
| output.println("\t\t<time>" + c_outputTime.format(entry.getDate()) | |||
| + "</time>"); | |||
| output.println("\t\t<author><![CDATA[" + entry.getAuthor() | |||
| output.println("\t\t<author><![CDATA[" + entry.getAuthor() | |||
| + "]]></author>"); | |||
| final Enumeration enumeration = entry.getFiles().elements(); | |||
| @@ -121,13 +121,13 @@ class ChangeLogWriter { | |||
| output.println("\t\t<file>"); | |||
| output.println("\t\t\t<name>" + file.getName() + "</name>"); | |||
| output.println("\t\t\t<revision>" + file.getRevision() | |||
| output.println("\t\t\t<revision>" + file.getRevision() | |||
| + "</revision>"); | |||
| final String previousRevision = file.getPreviousRevision(); | |||
| if (previousRevision != null) { | |||
| output.println("\t\t\t<prevrevision>" + previousRevision | |||
| output.println("\t\t\t<prevrevision>" + previousRevision | |||
| + "</prevrevision>"); | |||
| } | |||
| @@ -112,7 +112,7 @@ public class CvsUser { | |||
| /** | |||
| * validate that this objetc is configured. | |||
| * | |||
| * @exception BuildException if the instance has not be correctly | |||
| * @exception BuildException if the instance has not be correctly | |||
| * configured. | |||
| */ | |||
| void validate() throws BuildException { | |||
| @@ -135,15 +135,15 @@ public class EmailTask | |||
| private Vector files = new Vector(); | |||
| private Vector filesets = new Vector(); | |||
| /** Character set for MimeMailer*/ | |||
| private String charset=null; | |||
| private String charset = null; | |||
| /** if set to true, the email will not be actually sent */ | |||
| private boolean debugonly=false; | |||
| private boolean debugonly = false; | |||
| /** a location where to print the email message */ | |||
| private File debugoutput; | |||
| /** User for SMTP auth */ | |||
| private String user=null; | |||
| private String user = null; | |||
| /** Password for SMTP auth */ | |||
| private String password=null; | |||
| private String password = null; | |||
| /** indicate if the user wishes SSL-TLS */ | |||
| private boolean SSL = false; | |||
| @@ -471,15 +471,18 @@ public class EmailTask | |||
| autoFound = true; | |||
| log("Using MIME mail", Project.MSG_VERBOSE); | |||
| } catch (Throwable e) { | |||
| log("Failed to initialise MIME mail: "+e.getMessage(),Project.MSG_WARN); | |||
| log("Failed to initialise MIME mail: " | |||
| + e.getMessage(), Project.MSG_WARN); | |||
| } | |||
| } | |||
| // SMTP auth only allowed with MIME mail | |||
| if (autoFound==false && ((user !=null) || (password != null) ) && (encoding.equals(UU) || encoding.equals(PLAIN))) { | |||
| if (autoFound == false && ((user != null) || (password != null)) | |||
| && (encoding.equals(UU) || encoding.equals(PLAIN))) { | |||
| throw new BuildException("SMTP auth only possible with MIME mail"); | |||
| } | |||
| // SSL only allowed with MIME mail | |||
| if (autoFound==false && (SSL) && (encoding.equals(UU) || encoding.equals(PLAIN))) { | |||
| if (autoFound == false && (SSL) | |||
| && (encoding.equals(UU) || encoding.equals(PLAIN))) { | |||
| throw new BuildException("SSL only possible with MIME mail"); | |||
| } | |||
| @@ -540,7 +543,7 @@ public class EmailTask | |||
| } | |||
| // set the character set if not done already (and required) | |||
| if (charset != null) { | |||
| if (message.getCharset()!=null) { | |||
| if (message.getCharset() != null) { | |||
| throw new BuildException("The charset can only be " | |||
| + "specified in one location"); | |||
| } else { | |||
| @@ -568,7 +571,7 @@ public class EmailTask | |||
| // let the user know what's going to happen | |||
| log("Sending email: " + subject, Project.MSG_INFO); | |||
| log("From " + from, Project.MSG_VERBOSE); | |||
| log("ReplyTo " + replyToList,Project.MSG_VERBOSE); | |||
| log("ReplyTo " + replyToList, Project.MSG_VERBOSE); | |||
| log("To " + toList, Project.MSG_VERBOSE); | |||
| log("Cc " + ccList, Project.MSG_VERBOSE); | |||
| log("Bcc " + bccList, Project.MSG_VERBOSE); | |||
| @@ -75,7 +75,7 @@ public class Message extends ProjectComponent { | |||
| private StringBuffer buffer = new StringBuffer(); | |||
| private String mimeType = "text/plain"; | |||
| private boolean specified = false; | |||
| private String charset=null; | |||
| private String charset = null; | |||
| /** Creates a new empty message */ | |||
| public Message() { | |||
| @@ -153,9 +153,9 @@ public class Message extends ProjectComponent { | |||
| throws IOException { | |||
| // We need character encoding aware printing here. | |||
| // So, using PrintWriter over OutputStreamWriter instead of PrintStream | |||
| PrintWriter out = charset!=null? | |||
| new PrintWriter(new OutputStreamWriter(ps,charset)): | |||
| new PrintWriter(ps); | |||
| PrintWriter out | |||
| = charset != null ? new PrintWriter(new OutputStreamWriter(ps, charset)) | |||
| : new PrintWriter(ps); | |||
| if (messageSource != null) { | |||
| // Read message from a file | |||
| FileReader freader = new FileReader(messageSource); | |||
| @@ -76,7 +76,7 @@ class PlainMailer extends Mailer { | |||
| */ | |||
| public void send() { | |||
| try { | |||
| MailMessage mailMessage = new MailMessage(host,port); | |||
| MailMessage mailMessage = new MailMessage(host, port); | |||
| mailMessage.from(from.toString()); | |||
| @@ -94,7 +94,7 @@ public class CCMCheck extends Continuus { | |||
| * @param v Value to assign to file. | |||
| */ | |||
| public void setFile(File v) { | |||
| log("working file "+v, Project.MSG_VERBOSE); | |||
| log("working file " + v, Project.MSG_VERBOSE); | |||
| this.file = v; | |||
| } | |||
| @@ -163,9 +163,9 @@ public class CCMCheck extends Continuus { | |||
| throw new BuildException("Choose between file and fileset !"); | |||
| } | |||
| if ( getFile() !=null) { | |||
| if (getFile() != null) { | |||
| doit(); | |||
| return ; | |||
| return; | |||
| } | |||
| int sizeofFileSet = filesets.size(); | |||
| @@ -57,10 +57,6 @@ package org.apache.tools.ant.taskdefs.optional.clearcase; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| import org.apache.tools.ant.taskdefs.optional.clearcase.*; | |||
| /** | |||
| * Task to CreateBaseline command to ClearCase. | |||
| @@ -54,7 +54,8 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.clearcase; | |||
| import org.apache.tools.ant.*; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| /** | |||
| @@ -150,7 +151,7 @@ public class CCMklabel extends ClearCase { | |||
| checkOptions(commandLine); | |||
| result = run(commandLine); | |||
| if ( result != 0) { | |||
| if (result != 0) { | |||
| String msg = "Failed executing: " + commandLine.toString(); | |||
| throw new BuildException(msg, location); | |||
| } | |||
| @@ -54,7 +54,8 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.clearcase; | |||
| import org.apache.tools.ant.*; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| /** | |||
| @@ -152,7 +153,7 @@ public class CCMklbtype extends ClearCase { | |||
| checkOptions(commandLine); | |||
| result = run(commandLine); | |||
| if ( result != 0) { | |||
| if (result != 0) { | |||
| String msg = "Failed executing: " + commandLine.toString(); | |||
| throw new BuildException(msg, location); | |||
| } | |||
| @@ -54,7 +54,8 @@ | |||
| package org.apache.tools.ant.taskdefs.optional.clearcase; | |||
| import org.apache.tools.ant.*; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| /** | |||
| @@ -150,7 +151,7 @@ public class CCRmtype extends ClearCase { | |||
| checkOptions(commandLine); | |||
| result = run(commandLine); | |||
| if ( result != 0) { | |||
| if (result != 0) { | |||
| String msg = "Failed executing: " + commandLine.toString(); | |||
| throw new BuildException(msg, location); | |||
| } | |||
| @@ -95,7 +95,7 @@ public class ClassFile { | |||
| DataInputStream classStream = new DataInputStream(stream); | |||
| if (classStream.readInt() != CLASS_MAGIC) { | |||
| throw new ClassFormatError("No Magic Code Found " | |||
| throw new ClassFormatError("No Magic Code Found " | |||
| + "- probably not a Java class file."); | |||
| } | |||
| @@ -112,7 +112,7 @@ public class ClassFile { | |||
| /* int accessFlags = */ classStream.readUnsignedShort(); | |||
| int thisClassIndex = classStream.readUnsignedShort(); | |||
| /* int superClassIndex = */ classStream.readUnsignedShort(); | |||
| ClassCPInfo classInfo | |||
| ClassCPInfo classInfo | |||
| = (ClassCPInfo) constantPool.getEntry(thisClassIndex); | |||
| className = classInfo.getClassName(); | |||
| } | |||
| @@ -130,7 +130,7 @@ public class ClassFile { | |||
| for (int i = 0; i < constantPool.size(); ++i) { | |||
| ConstantPoolEntry entry = constantPool.getEntry(i); | |||
| if (entry != null | |||
| if (entry != null | |||
| && entry.getTag() == ConstantPoolEntry.CONSTANT_CLASS) { | |||
| ClassCPInfo classEntry = (ClassCPInfo) entry; | |||
| @@ -59,7 +59,7 @@ package org.apache.tools.ant.taskdefs.optional.depend; | |||
| * file format and those commonly used in Java programming. | |||
| * | |||
| * @author Conor MacNeill | |||
| * | |||
| * | |||
| */ | |||
| public class ClassFileUtils { | |||
| @@ -425,9 +425,9 @@ public class Depend extends MatchingTask { | |||
| String classFilePath = classURL.getFile(); | |||
| classpathFileObject = new File(classFilePath); | |||
| } | |||
| log("Class " + className + | |||
| " depends on " + classpathFileObject + | |||
| " due to " + dependency, Project.MSG_DEBUG); | |||
| log("Class " + className | |||
| + " depends on " + classpathFileObject | |||
| + " due to " + dependency, Project.MSG_DEBUG); | |||
| } | |||
| } | |||
| classpathFileCache.put(dependency, classpathFileObject); | |||
| @@ -545,8 +545,8 @@ public class Depend extends MatchingTask { | |||
| * Dump the dependency information loaded from the classes to the Ant log | |||
| */ | |||
| private void dumpDependencies() { | |||
| log("Reverse Dependency Dump for " + affectedClassMap.size() + | |||
| " classes:", Project.MSG_DEBUG); | |||
| log("Reverse Dependency Dump for " + affectedClassMap.size() | |||
| + " classes:", Project.MSG_DEBUG); | |||
| Enumeration classEnum = affectedClassMap.keys(); | |||
| while (classEnum.hasMoreElements()) { | |||
| @@ -617,8 +617,8 @@ public class Depend extends MatchingTask { | |||
| File classpathFile = (File) e2.nextElement(); | |||
| if (classpathFile.lastModified() | |||
| > info.absoluteFile.lastModified()) { | |||
| log("Class " + className + | |||
| " is out of date with respect to " + classpathFile, Project.MSG_DEBUG); | |||
| log("Class " + className | |||
| + " is out of date with respect to " + classpathFile, Project.MSG_DEBUG); | |||
| outOfDateClasses.put(className, className); | |||
| break; | |||
| } | |||
| @@ -179,12 +179,12 @@ public class DirectoryIterator implements ClassFileIterator { | |||
| } else { | |||
| // we have a file. create a stream for it | |||
| FileInputStream inFileStream | |||
| FileInputStream inFileStream | |||
| = new FileInputStream(element); | |||
| if (element.getName().endsWith(".class")) { | |||
| // create a data input stream from the jar | |||
| // create a data input stream from the jar | |||
| // input stream | |||
| ClassFile javaClass = new ClassFile(); | |||
| @@ -358,7 +358,7 @@ public class ConstantPool { | |||
| Object element = entries.elementAt(i); | |||
| if (element instanceof NameAndTypeCPInfo) { | |||
| NameAndTypeCPInfo nameAndTypeEntry | |||
| NameAndTypeCPInfo nameAndTypeEntry | |||
| = (NameAndTypeCPInfo) element; | |||
| if (nameAndTypeEntry.getName().equals(name) | |||