Browse Source

checkstyle: make the execute method a litte smaller

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@490599 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
e24825b3b8
1 changed files with 23 additions and 16 deletions
  1. +23
    -16
      src/main/org/apache/tools/ant/taskdefs/Get.java

+ 23
- 16
src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -97,23 +97,8 @@ public class Get extends Task {
*/
public boolean doGet(int logLevel, DownloadProgress progress)
throws IOException {
if (source == null) {
throw new BuildException("src attribute is required", getLocation());
}

if (dest == null) {
throw new BuildException("dest attribute is required", getLocation());
}

if (dest.exists() && dest.isDirectory()) {
throw new BuildException("The specified destination is a directory",
getLocation());
}
checkAttributes();

if (dest.exists() && !dest.canWrite()) {
throw new BuildException("Can't write to " + dest.getAbsolutePath(),
getLocation());
}
//dont do any progress, unless asked
if (progress == null) {
progress = new NullProgress();
@@ -258,6 +243,28 @@ public class Get extends Task {
return true;
}

/**
* Check the attributes.
*/
private void checkAttributes() {
if (source == null) {
throw new BuildException("src attribute is required", getLocation());
}

if (dest == null) {
throw new BuildException("dest attribute is required", getLocation());
}

if (dest.exists() && dest.isDirectory()) {
throw new BuildException("The specified destination is a directory",
getLocation());
}

if (dest.exists() && !dest.canWrite()) {
throw new BuildException("Can't write to " + dest.getAbsolutePath(),
getLocation());
}
}

/**
* Set the URL to get.


Loading…
Cancel
Save