You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/12/28 00:41:34 UTC
svn commit: r490599 -
/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java
Author: peterreilly
Date: Wed Dec 27 15:41:33 2006
New Revision: 490599
URL: http://svn.apache.org/viewvc?view=rev&rev=490599
Log:
checkstyle: make the execute method a litte smaller
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java?view=diff&rev=490599&r1=490598&r2=490599
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Get.java Wed Dec 27 15:41:33 2006
@@ -97,23 +97,8 @@
*/
public boolean doGet(int logLevel, DownloadProgress progress)
throws IOException {
- if (source == null) {
- throw new BuildException("src attribute is required", getLocation());
- }
+ checkAttributes();
- 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());
- }
//dont do any progress, unless asked
if (progress == null) {
progress = new NullProgress();
@@ -258,6 +243,28 @@
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org