pr: 39320 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@397298 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -212,6 +212,8 @@ Fixed bugs: | |||||
| Other changes: | Other changes: | ||||
| -------------- | -------------- | ||||
| * took in bugzilla report 39320. | |||||
| * Improve compatibility with GNU Classpath and java versions prior to 1.5. Bugzilla 39027. | * Improve compatibility with GNU Classpath and java versions prior to 1.5. Bugzilla 39027. | ||||
| * ${ant.core.lib} may now be used to refer to the library containing the | * ${ant.core.lib} may now be used to refer to the library containing the | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000-2005 The Apache Software Foundation | |||||
| * Copyright 2000-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -608,6 +608,6 @@ public class UnknownElement extends Task { | |||||
| } | } | ||||
| private static boolean equalsString(String a, String b) { | private static boolean equalsString(String a, String b) { | ||||
| return (a == null) ? (a == b) : a.equals(b); | |||||
| return (a == null) ? (b == null) : a.equals(b); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2002,2004-2005 The Apache Software Foundation | |||||
| * Copyright 2002,2004-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -46,7 +46,7 @@ public abstract class BaseFilterReader extends FilterReader { | |||||
| * this placeholder instance to create a chain of real filters. | * this placeholder instance to create a chain of real filters. | ||||
| */ | */ | ||||
| public BaseFilterReader() { | public BaseFilterReader() { | ||||
| super(new StringReader(new String())); | |||||
| super(new StringReader("")); | |||||
| FileUtils.close(this); | FileUtils.close(this); | ||||
| } | } | ||||
| @@ -857,6 +857,10 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||||
| && getIndex() == ((AddAsisRemove) other).getIndex(); | && getIndex() == ((AddAsisRemove) other).getIndex(); | ||||
| } | } | ||||
| public int hashCode() { | |||||
| return getIndex(); | |||||
| } | |||||
| AddAsisRemove resolve() throws IllegalStateException { | AddAsisRemove resolve() throws IllegalStateException { | ||||
| if (this.equals(ASIS)) { | if (this.equals(ASIS)) { | ||||
| return ASIS; | return ASIS; | ||||
| @@ -911,6 +915,10 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina | |||||
| return other instanceof CrLf && getIndex() == ((CrLf) other).getIndex(); | return other instanceof CrLf && getIndex() == ((CrLf) other).getIndex(); | ||||
| } | } | ||||
| public int hashCode() { | |||||
| return getIndex(); | |||||
| } | |||||
| CrLf resolve() { | CrLf resolve() { | ||||
| if (this.equals(ASIS)) { | if (this.equals(ASIS)) { | ||||
| return ASIS; | return ASIS; | ||||
| @@ -539,7 +539,7 @@ public class Copy extends Task { | |||||
| if (nonFileResources.size() > 0) { | if (nonFileResources.size() > 0) { | ||||
| Resource[] nonFiles = | Resource[] nonFiles = | ||||
| (Resource[]) nonFileResources.toArray(new Resource[0]); | |||||
| (Resource[]) nonFileResources.toArray(new Resource[nonFileResources.size()]); | |||||
| // restrict to out-of-date resources | // restrict to out-of-date resources | ||||
| Map map = scan(nonFiles, destDir); | Map map = scan(nonFiles, destDir); | ||||
| try { | try { | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2003-2004 The Apache Software Foundation | |||||
| * Copyright 2003-2004,2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -21,6 +21,7 @@ import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.util.StringUtils; | |||||
| /** | /** | ||||
| * Alters the default excludes for the <strong>entire</strong> build.. | * Alters the default excludes for the <strong>entire</strong> build.. | ||||
| @@ -60,10 +61,13 @@ public class DefaultExcludes extends Task { | |||||
| } | } | ||||
| if (echo) { | if (echo) { | ||||
| StringBuffer message | StringBuffer message | ||||
| = new StringBuffer("Current Default Excludes:\n"); | |||||
| = new StringBuffer("Current Default Excludes:"); | |||||
| message.append(StringUtils.LINE_SEP); | |||||
| 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(" "); | |||||
| message.append(excludes[i]); | |||||
| message.append(StringUtils.LINE_SEP); | |||||
| } | } | ||||
| log(message.toString(), logLevel); | log(message.toString(), logLevel); | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000-2005 The Apache Software Foundation | |||||
| * Copyright 2000-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -47,7 +47,7 @@ import org.apache.tools.ant.taskdefs.condition.ConditionBase; | |||||
| */ | */ | ||||
| public class Exit extends Task { | public class Exit extends Task { | ||||
| private class NestedCondition extends ConditionBase implements Condition { | |||||
| private static class NestedCondition extends ConditionBase implements Condition { | |||||
| public boolean eval() { | public boolean eval() { | ||||
| if (countConditions() != 1) { | if (countConditions() != 1) { | ||||
| throw new BuildException( | throw new BuildException( | ||||
| @@ -200,7 +200,9 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain | |||||
| String name = macroName.toString().toLowerCase(Locale.US); | String name = macroName.toString().toLowerCase(Locale.US); | ||||
| String value = (String) macroMapping.get(name); | String value = (String) macroMapping.get(name); | ||||
| if (value == null) { | if (value == null) { | ||||
| ret.append("@{" + name + "}"); | |||||
| ret.append("@{"); | |||||
| ret.append(name); | |||||
| ret.append("}"); | |||||
| } else { | } else { | ||||
| ret.append(value); | ret.append(value); | ||||
| } | } | ||||
| @@ -508,9 +508,11 @@ public class SQLExec extends JDBCTask { | |||||
| } | } | ||||
| if (!keepformat) { | if (!keepformat) { | ||||
| sql.append(" " + line); | |||||
| sql.append(" "); | |||||
| sql.append(line); | |||||
| } else { | } else { | ||||
| sql.append("\n" + line); | |||||
| sql.append("\n"); | |||||
| sql.append(line); | |||||
| } | } | ||||
| // SQL defines "--" as a comment to EOL | // SQL defines "--" as a comment to EOL | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000-2005 The Apache Software Foundation | |||||
| * Copyright 2000-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -207,8 +207,8 @@ public class UpToDate extends Task implements Condition { | |||||
| if (upToDate) { | if (upToDate) { | ||||
| Resource[] r = sourceResources.listResources(); | Resource[] r = sourceResources.listResources(); | ||||
| upToDate = upToDate && | upToDate = upToDate && | ||||
| (ResourceUtils.selectOutOfDateSources(this, r, getMapper(), | |||||
| getProject()).length | |||||
| (ResourceUtils.selectOutOfDateResources(this, r, getMapper(), | |||||
| getProject(), null).length | |||||
| == 0); | == 0); | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000-2005 The Apache Software Foundation | |||||
| * Copyright 2000-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -150,7 +150,7 @@ public class VerifyJar extends AbstractJarSignerTask { | |||||
| /** | /** | ||||
| * we are not thread safe here. Do not use on multiple threads at the same time. | * we are not thread safe here. Do not use on multiple threads at the same time. | ||||
| */ | */ | ||||
| private class BufferingOutputFilter implements ChainableReader { | |||||
| private static class BufferingOutputFilter implements ChainableReader { | |||||
| private BufferingOutputFilterReader buffer; | private BufferingOutputFilterReader buffer; | ||||
| @@ -173,7 +173,7 @@ public class VerifyJar extends AbstractJarSignerTask { | |||||
| /** | /** | ||||
| * catch the output of the buffer | * catch the output of the buffer | ||||
| */ | */ | ||||
| private class BufferingOutputFilterReader extends Reader { | |||||
| private static class BufferingOutputFilterReader extends Reader { | |||||
| private Reader next; | private Reader next; | ||||
| @@ -415,7 +415,7 @@ public class Zip extends MatchingTask { | |||||
| */ | */ | ||||
| public void executeMain() throws BuildException { | public void executeMain() throws BuildException { | ||||
| if (baseDir == null & resources.size() == 0 | |||||
| if (baseDir == null && resources.size() == 0 | |||||
| && groupfilesets.size() == 0 && "zip".equals(archiveType)) { | && groupfilesets.size() == 0 && "zip".equals(archiveType)) { | ||||
| throw new BuildException("basedir attribute must be set, " | throw new BuildException("basedir attribute must be set, " | ||||
| + "or at least one " | + "or at least one " | ||||
| @@ -408,7 +408,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
| for (int i = 0; i < compileList.length; i++) { | for (int i = 0; i < compileList.length; i++) { | ||||
| String arg = compileList[i].getAbsolutePath(); | String arg = compileList[i].getAbsolutePath(); | ||||
| cmd.createArgument().setValue(arg); | cmd.createArgument().setValue(arg); | ||||
| niceSourceList.append(" " + arg + StringUtils.LINE_SEP); | |||||
| niceSourceList.append(" "); | |||||
| niceSourceList.append(arg); | |||||
| niceSourceList.append(StringUtils.LINE_SEP); | |||||
| } | } | ||||
| attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE); | attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE); | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000-2005 The Apache Software Foundation | |||||
| * Copyright 2000-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -442,7 +442,9 @@ public class Javah extends Task { | |||||
| String[] c = getClasses(); | String[] c = getClasses(); | ||||
| for (int i = 0; i < c.length; i++) { | for (int i = 0; i < c.length; i++) { | ||||
| cmd.createArgument().setValue(c[i]); | cmd.createArgument().setValue(c[i]); | ||||
| niceClassList.append(" " + c[i] + lSep); | |||||
| niceClassList.append(" "); | |||||
| niceClassList.append(c[i]); | |||||
| niceClassList.append(lSep); | |||||
| } | } | ||||
| StringBuffer prefix = new StringBuffer("Class"); | StringBuffer prefix = new StringBuffer("Class"); | ||||
| @@ -412,17 +412,22 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware | |||||
| } | } | ||||
| int line = locator.getLineNumber(); | int line = locator.getLineNumber(); | ||||
| if (line != -1) { | if (line != -1) { | ||||
| msg.append(":" + line); | |||||
| msg.append(":"); | |||||
| msg.append(line); | |||||
| int column = locator.getColumnNumber(); | int column = locator.getColumnNumber(); | ||||
| if (column != -1) { | if (column != -1) { | ||||
| msg.append(":" + column); | |||||
| msg.append(":"); | |||||
| msg.append(column); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| msg.append(": " + type + "! "); | |||||
| msg.append(": "); | |||||
| msg.append(type); | |||||
| msg.append("! "); | |||||
| msg.append(e.getMessage()); | msg.append(e.getMessage()); | ||||
| if (e.getCause() != null) { | if (e.getCause() != null) { | ||||
| msg.append(" Cause: " + e.getCause()); | |||||
| msg.append(" Cause: "); | |||||
| msg.append(e.getCause()); | |||||
| } | } | ||||
| logger.log(msg.toString()); | logger.log(msg.toString()); | ||||
| @@ -266,10 +266,9 @@ public abstract class DotnetCompile | |||||
| //iterate through the ref list & generate an entry for each | //iterate through the ref list & generate an entry for each | ||||
| //or just rely on the fact that the toString operator does this, but | //or just rely on the fact that the toString operator does this, but | ||||
| //noting that the separator is ';' on windows, ':' on unix | //noting that the separator is ';' on windows, ':' on unix | ||||
| String refpath = references.toString(); | |||||
| //bail on no references listed | //bail on no references listed | ||||
| if (refpath.length() == 0) { | |||||
| if (references.length() == 0) { | |||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -277,7 +276,7 @@ public abstract class DotnetCompile | |||||
| if (isWindows) { | if (isWindows) { | ||||
| s.append('\"'); | s.append('\"'); | ||||
| } | } | ||||
| s.append(refpath); | |||||
| s.append(references); | |||||
| if (isWindows) { | if (isWindows) { | ||||
| s.append('\"'); | s.append('\"'); | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2000-2004 The Apache Software Foundation | |||||
| * Copyright 2000-2004,2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -450,7 +450,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool { | |||||
| } catch (SAXException se) { | } catch (SAXException se) { | ||||
| String msg = "SAXException while parsing '" | String msg = "SAXException while parsing '" | ||||
| + descriptorFileName.toString() | |||||
| + descriptorFileName | |||||
| + "'. This probably indicates badly-formed XML." | + "'. This probably indicates badly-formed XML." | ||||
| + " Details: " | + " Details: " | ||||
| + se.getMessage(); | + se.getMessage(); | ||||
| @@ -279,7 +279,8 @@ public final class JarLibManifestTask extends Task { | |||||
| final int size) { | final int size) { | ||||
| final StringBuffer sb = new StringBuffer(); | final StringBuffer sb = new StringBuffer(); | ||||
| for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
| sb.append(listPrefix + i); | |||||
| sb.append(listPrefix); | |||||
| sb.append(i); | |||||
| sb.append(' '); | sb.append(' '); | ||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2001-2005 The Apache Software Foundation | |||||
| * Copyright 2001-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -60,7 +60,9 @@ public abstract class DefaultJspCompilerAdapter | |||||
| while (e.hasMoreElements()) { | while (e.hasMoreElements()) { | ||||
| String arg = (String) e.nextElement(); | String arg = (String) e.nextElement(); | ||||
| cmd.createArgument().setValue(arg); | cmd.createArgument().setValue(arg); | ||||
| niceSourceList.append(" " + arg + lSep); | |||||
| niceSourceList.append(" "); | |||||
| niceSourceList.append(arg); | |||||
| niceSourceList.append(lSep); | |||||
| } | } | ||||
| jspc.log(niceSourceList.toString(), Project.MSG_VERBOSE); | jspc.log(niceSourceList.toString(), Project.MSG_VERBOSE); | ||||
| @@ -1449,7 +1449,7 @@ public class JUnitTask extends Task { | |||||
| * Forked test support | * Forked test support | ||||
| * @since Ant 1.6.2 | * @since Ant 1.6.2 | ||||
| */ | */ | ||||
| private final class ForkedTestConfiguration { | |||||
| private final static class ForkedTestConfiguration { | |||||
| private boolean filterTrace; | private boolean filterTrace; | ||||
| private boolean haltOnError; | private boolean haltOnError; | ||||
| private boolean haltOnFailure; | private boolean haltOnFailure; | ||||
| @@ -606,9 +606,7 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| env = new String[0]; | env = new String[0]; | ||||
| } | } | ||||
| String[] newEnv = new String[env.length + 1]; | String[] newEnv = new String[env.length + 1]; | ||||
| for (int i = 0; i < env.length; i++) { | |||||
| newEnv[i] = env[i]; | |||||
| } | |||||
| System.arraycopy(env, 0, newEnv, 0, env.length); | |||||
| newEnv[env.length] = "SSDIR=" + serverPath; | newEnv[env.length] = "SSDIR=" + serverPath; | ||||
| exe.setEnvironment(newEnv); | exe.setEnvironment(newEnv); | ||||
| @@ -635,9 +633,8 @@ public abstract class MSVSS extends Task implements MSVSSConstants { | |||||
| * @throws ParseException | * @throws ParseException | ||||
| */ | */ | ||||
| private String calcDate(String startDate, int daysToAdd) throws ParseException { | private String calcDate(String startDate, int daysToAdd) throws ParseException { | ||||
| Date currentDate = new Date(); | |||||
| Calendar calendar = new GregorianCalendar(); | Calendar calendar = new GregorianCalendar(); | ||||
| currentDate = dateFormat.parse(startDate); | |||||
| Date currentDate = dateFormat.parse(startDate); | |||||
| calendar.setTime(currentDate); | calendar.setTime(currentDate); | ||||
| calendar.add(Calendar.DATE, daysToAdd); | calendar.add(Calendar.DATE, daysToAdd); | ||||
| return dateFormat.format(calendar.getTime()); | return dateFormat.format(calendar.getTime()); | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2001-2005 The Apache Software Foundation | |||||
| * Copyright 2001-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -263,7 +263,8 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
| for (int i = 0; i < cListSize; i++) { | for (int i = 0; i < cListSize; i++) { | ||||
| String arg = (String) compileList.elementAt(i); | String arg = (String) compileList.elementAt(i); | ||||
| cmd.createArgument().setValue(arg); | cmd.createArgument().setValue(arg); | ||||
| niceSourceList.append(" " + arg); | |||||
| niceSourceList.append(" "); | |||||
| niceSourceList.append(arg); | |||||
| } | } | ||||
| attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE); | attributes.log(niceSourceList.toString(), Project.MSG_VERBOSE); | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Copyright 2005 The Apache Software Foundation | |||||
| * Copyright 2005-2006 The Apache Software Foundation | |||||
| * | * | ||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| * you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
| @@ -38,7 +38,7 @@ import org.apache.tools.ant.types.resources.comparators.ResourceComparator; | |||||
| */ | */ | ||||
| public class Sort extends BaseResourceCollectionWrapper { | public class Sort extends BaseResourceCollectionWrapper { | ||||
| private class MultiComparator implements Comparator { | |||||
| private static class MultiComparator implements Comparator { | |||||
| private Vector v = null; | private Vector v = null; | ||||
| synchronized void add(ResourceComparator c) { | synchronized void add(ResourceComparator c) { | ||||
| if (c == null) { | if (c == null) { | ||||
| @@ -62,7 +62,7 @@ public class Sort extends BaseResourceCollectionWrapper { | |||||
| } | } | ||||
| //sorted bag impl. borrowed from commons-collections TreeBag: | //sorted bag impl. borrowed from commons-collections TreeBag: | ||||
| private class SortedBag extends AbstractCollection { | |||||
| private static class SortedBag extends AbstractCollection { | |||||
| private class MutableInt { | private class MutableInt { | ||||
| int value = 0; | int value = 0; | ||||
| } | } | ||||