Browse Source

Merge branch '1.9.x'

master
Stefan Bodewig 8 years ago
parent
commit
5db9f3401e
10 changed files with 37 additions and 22 deletions
  1. +9
    -7
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  2. +2
    -1
      src/main/org/apache/tools/ant/UnknownElement.java
  3. +4
    -2
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  4. +9
    -3
      src/main/org/apache/tools/ant/taskdefs/MacroInstance.java
  5. +4
    -2
      src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
  6. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
  7. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  8. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java
  9. +1
    -1
      src/main/org/apache/tools/tar/TarEntry.java
  10. +3
    -3
      src/main/org/apache/tools/zip/ZipFile.java

+ 9
- 7
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -407,13 +407,15 @@ public final class IntrospectionHelper {
+ " doesn't support the \"" + attributeName + "\" attribute."; + " doesn't support the \"" + attributeName + "\" attribute.";
throw new UnsupportedAttributeException(msg, attributeName); throw new UnsupportedAttributeException(msg, attributeName);
} }
try {
as.setObject(p, element, value);
} catch (final IllegalAccessException ie) {
// impossible as getMethods should only return public methods
throw new BuildException(ie);
} catch (final InvocationTargetException ite) {
throw extractBuildException(ite);
if (as != null) { // possible if value == null
try {
as.setObject(p, element, value);
} catch (final IllegalAccessException ie) {
// impossible as getMethods should only return public methods
throw new BuildException(ie);
} catch (final InvocationTargetException ite) {
throw extractBuildException(ite);
}
} }
} }




+ 2
- 1
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -646,7 +646,8 @@ public class UnknownElement extends Task {
return false; return false;
} }
for (int i = 0; i < childrenSize; ++i) { for (int i = 0; i < childrenSize; ++i) {
UnknownElement child = (UnknownElement) children.get(i);
// children cannot be null childrenSize would have been 0
UnknownElement child = (UnknownElement) children.get(i); //NOSONAR
if (!child.similar(other.children.get(i))) { if (!child.similar(other.children.get(i))) {
return false; return false;
} }


+ 4
- 2
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -1772,10 +1772,12 @@ public class Javadoc extends Task {
useExternalFile, tmpList, srcListWriter); useExternalFile, tmpList, srcListWriter);


if (useExternalFile) { if (useExternalFile) {
srcListWriter.flush();
srcListWriter.flush(); //NOSONAR
} }
} catch (final IOException e) { } catch (final IOException e) {
tmpList.delete();
if (tmpList != null) {
tmpList.delete();
}
throw new BuildException("Error creating temporary file", throw new BuildException("Error creating temporary file",
e, getLocation()); e, getLocation());
} finally { } finally {


+ 9
- 3
src/main/org/apache/tools/ant/taskdefs/MacroInstance.java View File

@@ -197,9 +197,12 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain
} }
break; break;
case STATE_EXPECT_NAME: case STATE_EXPECT_NAME:
// macroName cannot be null as this state is only
// ever reached from STATE_EXPECT_BRACKET after it
// has been set
if (ch == '}') { if (ch == '}') {
state = STATE_NORMAL; state = STATE_NORMAL;
String name = macroName.toString().toLowerCase(Locale.ENGLISH);
String name = macroName.toString().toLowerCase(Locale.ENGLISH); //NOSONAR
String value = (String) macroMapping.get(name); String value = (String) macroMapping.get(name);
if (value == null) { if (value == null) {
ret.append("@{"); ret.append("@{");
@@ -210,7 +213,7 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain
} }
macroName = null; macroName = null;
} else { } else {
macroName.append(ch);
macroName.append(ch); //NOSONAR
} }
break; break;
default: default:
@@ -224,8 +227,11 @@ public class MacroInstance extends Task implements DynamicAttribute, TaskContain
ret.append('@'); ret.append('@');
break; break;
case STATE_EXPECT_NAME: case STATE_EXPECT_NAME:
// macroName cannot be null as this state is only
// ever reached from STATE_EXPECT_BRACKET after it
// has been set
ret.append("@{"); ret.append("@{");
ret.append(macroName.toString());
ret.append(macroName.toString()); //NOSONAR
break; break;
default: default:
break; break;


+ 4
- 2
src/main/org/apache/tools/ant/taskdefs/XmlProperty.java View File

@@ -384,10 +384,12 @@ public class XmlProperty extends org.apache.tools.ant.Task {
if (containingPath != null && nodeName.equals(PATH)) { if (containingPath != null && nodeName.equals(PATH)) {
// A "path" attribute for a node within a Path object. // A "path" attribute for a node within a Path object.
containingPath.setPath(attributeValue); containingPath.setPath(attributeValue);
} else if (container instanceof Path && nodeName.equals(REF_ID)) {
} else if (containingPath != null
&& container instanceof Path && nodeName.equals(REF_ID)) {
// A "refid" attribute for a node within a Path object. // A "refid" attribute for a node within a Path object.
containingPath.setPath(attributeValue); containingPath.setPath(attributeValue);
} else if (container instanceof Path && nodeName.equals(LOCATION)) {
} else if (containingPath != null && container instanceof Path
&& nodeName.equals(LOCATION)) {
// A "location" attribute for a node within a // A "location" attribute for a node within a
// Path object. // Path object.
containingPath.setLocation(resolveFile(attributeValue)); containingPath.setLocation(resolveFile(attributeValue));


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java View File

@@ -197,7 +197,7 @@ public class Depend extends MatchingTask {
dependencyList = new Vector(); dependencyList = new Vector();
className = line.substring(prependLength); className = line.substring(prependLength);
dependencyMap.put(className, dependencyList); dependencyMap.put(className, dependencyList);
} else {
} else if (dependencyList != null) {
dependencyList.addElement(line); dependencyList.addElement(line);
} }
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -553,7 +553,7 @@ public class JDependTask extends Task {
} }


jdepend.analyze(); jdepend.analyze();
if (pw.checkError()) {
if (pw != null && pw.checkError()) {
throw new IOException("Encountered an error writing JDepend" throw new IOException("Encountered an error writing JDepend"
+ " output"); + " output");
} }


+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java View File

@@ -133,7 +133,9 @@ public class AntSoundPlayer implements LineListener, BuildListener {
} else { } else {
playClip(audioClip, loops); playClip(audioClip, loops);
} }
audioClip.drain();
if (audioClip != null) {
audioClip.drain();
}
} finally { } finally {
FileUtils.close(audioClip); FileUtils.close(audioClip);
} }


+ 1
- 1
src/main/org/apache/tools/tar/TarEntry.java View File

@@ -333,7 +333,7 @@ public class TarEntry implements TarConstants {
* @return True if the entries are equal. * @return True if the entries are equal.
*/ */
public boolean equals(TarEntry it) { public boolean equals(TarEntry it) {
return getName().equals(it.getName());
return it != null && getName().equals(it.getName());
} }


/** /**


+ 3
- 3
src/main/org/apache/tools/zip/ZipFile.java View File

@@ -1038,12 +1038,12 @@ public class ZipFile implements Closeable {
@Override @Override
public boolean equals(final Object other) { public boolean equals(final Object other) {
if (super.equals(other)) { if (super.equals(other)) {
// super.equals would return false if other were not an Entry
// super.equals would return false if other were null or not an Entry
final Entry otherEntry = (Entry) other; final Entry otherEntry = (Entry) other;
return offsetEntry.headerOffset return offsetEntry.headerOffset
== otherEntry.offsetEntry.headerOffset
== otherEntry.offsetEntry.headerOffset //NOSONAR
&& offsetEntry.dataOffset && offsetEntry.dataOffset
== otherEntry.offsetEntry.dataOffset;
== otherEntry.offsetEntry.dataOffset; //NOSONAR
} }
return false; return false;
} }


Loading…
Cancel
Save