public class Chgrp extends AbstractAccessTask { private boolean haveGroup = false; /** * Chgrp task for setting unix group of a file. */ public Chgrp() { super.setExecutable("chgrp"); } /** * Set the group atribute. * * @param group The new group for the file(s) or directory(ies) */ public void setGroup(String group) { createArg().setValue(group); 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()); } 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(getTaskType() + " doesn\'t support the executable" + " attribute", getLocation());
public class Chown extends AbstractAccessTask { private boolean haveOwner = false; /** * Chown task for setting file and directory permissions. */ public Chown() { super.setExecutable("chown"); } /** * Set the owner atribute. * * @param owner The new owner for the file(s) or directory(ies) */ public void setOwner(String owner) { createArg().setValue(owner); 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()); } 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(getTaskType() + " doesn\'t support the executable" + " attribute", getLocation());
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/unix/Chown.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class Chgrp extends AbstractAccessTask {
1
public class Chown extends AbstractAccessTask {
2
    private boolean haveGroup = false;
2
    private boolean haveOwner = false;
3
    /**
3
    /**
4
     * Chgrp task for setting unix group of a file.
4
     * Chown task for setting file and directory permissions.
5
     */
5
     */
6
    public Chgrp() {
6
    public Chown() {
7
        super.setExecutable("chgrp");
7
        super.setExecutable("chown");
8
    }
8
    }
9
    /**
9
    /**
10
     * Set the group atribute.
10
     * Set the owner atribute.
11
     *
11
     *
12
     * @param group    The new group for the file(s) or directory(ies)
12
     * @param owner    The new owner for the file(s) or directory(ies)
13
     */
13
     */
14
    public void setGroup(String group) {
14
    public void setOwner(String owner) {
15
        createArg().setValue(group);
15
        createArg().setValue(owner);
16
        haveGroup = true;
16
        haveOwner = true;
17
    }
17
    }
18
    /**
18
    /**
19
     * Ensure that all the required arguments and other conditions have
19
     * Ensure that all the required arguments and other conditions have
20
     * been set.
20
     * been set.
21
     */
21
     */
22
    protected void checkConfiguration() {
22
    protected void checkConfiguration() {
23
        if (!haveGroup) {
23
        if (!haveOwner) {
24
            throw new BuildException("Required attribute group not set in "
24
            throw new BuildException("Required attribute owner not set in"
25
                                     + "chgrp", getLocation());
25
                                     + " chown", getLocation());
26
        }
26
        }
27
        super.checkConfiguration();
27
        super.checkConfiguration();
28
    }
28
    }
29
    /**
29
    /**
30
     * We don't want to expose the executable atribute, so overide it.
30
     * We don't want to expose the executable atribute, so overide it.
31
     *
31
     *
32
     * @param e User supplied executable that we won't accept.
32
     * @param e User supplied executable that we won't accept.
33
     */
33
     */
34
    public void setExecutable(String e) {
34
    public void setExecutable(String e) {
35
        throw new BuildException(getTaskType()
35
        throw new BuildException(getTaskType()
36
                                 + " doesn\'t support the executable"
36
                                 + " doesn\'t support the executable"
37
                                 + " attribute", getLocation());
37
                                 + " attribute", getLocation());
38
    
38
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0