Browse Source

Merge from 1.5 Branch

PR: 11675


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273284 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
b522a2e89c
1 changed files with 9 additions and 8 deletions
  1. +9
    -8
      src/main/org/apache/tools/ant/taskdefs/Checksum.java

+ 9
- 8
src/main/org/apache/tools/ant/taskdefs/Checksum.java View File

@@ -180,7 +180,7 @@ public class Checksum extends MatchingTask implements Condition {
} }


/** /**
* Whether or not to overwrite existing file irrespective of
* Whether or not to overwrite existing file irrespective of
* whether it is newer than * whether it is newer than
* the source file. Defaults to false. * the source file. Defaults to false.
*/ */
@@ -254,12 +254,12 @@ public class Checksum extends MatchingTask implements Condition {


if (file != null) { if (file != null) {
if (filesets.size() > 0) { if (filesets.size() > 0) {
throw new BuildException("Multiple files cannot be used "
throw new BuildException("Multiple files cannot be used "
+ "when Property is specified"); + "when Property is specified");
} }
} else { } else {
if (filesets.size() > 1) { if (filesets.size() > 1) {
throw new BuildException("Multiple files cannot be used "
throw new BuildException("Multiple files cannot be used "
+ "when Property is specified"); + "when Property is specified");
} }
} }
@@ -275,7 +275,7 @@ public class Checksum extends MatchingTask implements Condition {
} }


if (isCondition && forceOverwrite) { if (isCondition && forceOverwrite) {
throw new BuildException("ForceOverwrite cannot be used when "
throw new BuildException("ForceOverwrite cannot be used when "
+ "conditions are being used."); + "conditions are being used.");
} }


@@ -310,7 +310,7 @@ public class Checksum extends MatchingTask implements Condition {


try { try {
addToIncludeFileMap(file); addToIncludeFileMap(file);
int sizeofFileSet = filesets.size(); int sizeofFileSet = filesets.size();
for (int i = 0; i < sizeofFileSet; i++) { for (int i = 0; i < sizeofFileSet; i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
@@ -337,7 +337,7 @@ public class Checksum extends MatchingTask implements Condition {
if (file != null) { if (file != null) {
if (file.exists()) { if (file.exists()) {
if (property == null) { if (property == null) {
File dest
File dest
= new File(file.getParent(), file.getName() + fileext); = new File(file.getParent(), file.getName() + fileext);
if (forceOverwrite || isCondition || if (forceOverwrite || isCondition ||
(file.lastModified() > dest.lastModified())) { (file.lastModified() > dest.lastModified())) {
@@ -398,7 +398,8 @@ public class Checksum extends MatchingTask implements Condition {
if (destination instanceof java.lang.String) { if (destination instanceof java.lang.String) {
String prop = (String) destination; String prop = (String) destination;
if (isCondition) { if (isCondition) {
checksumMatches = checksum.equals(property);
checksumMatches = checksumMatches &&
checksum.equals(property);
} else { } else {
getProject().setNewProperty(prop, checksum); getProject().setNewProperty(prop, checksum);
} }
@@ -414,7 +415,7 @@ public class Checksum extends MatchingTask implements Condition {
fis = null; fis = null;
br.close(); br.close();
isr.close(); isr.close();
checksumMatches =
checksumMatches = checksumMatches &&
checksum.equals(suppliedChecksum); checksum.equals(suppliedChecksum);
} else { } else {
checksumMatches = false; checksumMatches = false;


Loading…
Cancel
Save