Browse Source

checkstyle fixes

PR: 21319
Submitted by: Patrick G. Heck (gus dot heck at olin dot edu)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274753 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 22 years ago
parent
commit
9d09e6bde0
3 changed files with 45 additions and 16 deletions
  1. +21
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java
  2. +12
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java
  3. +12
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java

+ 21
- 4
src/main/org/apache/tools/ant/taskdefs/optional/unix/AbstractAccessTask.java View File

@@ -73,12 +73,14 @@ import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.FileSet;

/**
* @author Patrick G. Heck <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a>
* @author Patrick G. Heck
* <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a>
* @since Ant 1.6
*
* @ant.task category="filesystem"
*/
public abstract class AbstractAccessTask

public abstract class AbstractAccessTask
extends org.apache.tools.ant.taskdefs.ExecuteOn {

/**
@@ -89,6 +91,9 @@ public abstract class AbstractAccessTask
super.setSkipEmptyFilesets(true);
}

/**
* Set the file which should have its access attributes modified.
*/
public void setFile(File src) {
FileSet fs = new FileSet();
fs.setFile(src);
@@ -96,16 +101,22 @@ public abstract class AbstractAccessTask
}

/**
* Prevent the user from specifying a different command.
*
* @ant.attribute ignore="true"
* @param cmdl A user supplied command line that we won't accept.
*/
public void setCommand(Commandline cmdl) {
throw new BuildException(taskType +
" doesn\'t support the command attribute",
throw new BuildException(taskType
+ " doesn\'t support the command attribute",
getLocation());
}

/**
* Prevent the skipping of empty filesets
*
* @ant.attribute ignore="true"
* @param skip A user supplied boolean we won't accept.
*/
public void setSkipEmptyFilesets(boolean skip) {
throw new BuildException(taskType + " doesn\'t support the "
@@ -114,13 +125,19 @@ public abstract class AbstractAccessTask
}

/**
* Prevent the use of the addsourcefile atribute.
*
* @ant.attribute ignore="true"
* @param b A user supplied boolean we won't accept.
*/
public void setAddsourcefile(boolean b) {
throw new BuildException(getTaskType()
+ " doesn\'t support the addsourcefile attribute", getLocation());
}

/**
* Automatically approve Unix OS's.
*/
protected boolean isValidOs() {
return Os.isFamily("unix") && super.isValidOs();
}


+ 12
- 6
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java View File

@@ -70,7 +70,7 @@ import org.apache.tools.ant.BuildException;
/**
* Chgrp equivalent for unix-like environments.
*
* @author Patrick G. Heck
* @author Patrick G. Heck
* <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a>
*
* @since Ant 1.6
@@ -98,20 +98,26 @@ public class Chgrp extends AbstractAccessTask {
haveGroup = true;
}

/**
* Ensure that all the required arguments and other conditions have
* been set.
*/
protected void checkConfiguration() {
if (!haveGroup) {
throw new BuildException("Required attribute group not set in "+
"chgrp", getLocation());
throw new BuildException("Required attribute group not set in "
+ "chgrp", getLocation());
}
super.checkConfiguration();
}

/**
* We don't want to expose the executable atribute, so overide it.
*
* @param e User supplied executable that we won't accept.
*/
public void setExecutable(String e) {
throw new BuildException(taskType +
" doesn\'t support the executable attribute",
getLocation());
throw new BuildException(taskType
+ " doesn\'t support the executable"
+ " attribute", getLocation());
}
}

+ 12
- 6
src/main/org/apache/tools/ant/taskdefs/optional/unix/Chown.java View File

@@ -70,7 +70,7 @@ import org.apache.tools.ant.BuildException;
/**
* Chown equivalent for unix-like environments.
*
* @author Patrick G. Heck
* @author Patrick G. Heck
* <a href="mailto:gus.heck@olin.edu">gus.heck@olin.edu</a>
*
* @since Ant 1.6
@@ -98,20 +98,26 @@ public class Chown extends AbstractAccessTask {
haveOwner = true;
}

/**
* Ensure that all the required arguments and other conditions have
* been set.
*/
protected void checkConfiguration() {
if (!haveOwner) {
throw new BuildException("Required attribute owner not set in" +
" chown", getLocation());
throw new BuildException("Required attribute owner not set in"
+ " chown", getLocation());
}
super.checkConfiguration();
}

/**
* We don't want to expose the executable atribute, so overide it.
*
* @param e User supplied executable that we won't accept.
*/
public void setExecutable(String e) {
throw new BuildException(taskType +
" doesn\'t support the executable attribute",
getLocation());
throw new BuildException(taskType
+ " doesn\'t support the executable"
+ " attribute", getLocation());
}
}

Loading…
Cancel
Save