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