/** * apply any extra arguments of this class * @param command the command to apply the arguments to. */ public void applyExtraArgs(NetCommand command) { String[] args = getExtraArgs(); for (int i = 0; i < args.length; i++) { command.addArgument(args[i]); } }
/** * add the list of files to a command * @param filesToBuild vector of files * @param command the command to append to */ protected void addFilesToCommand(Hashtable filesToBuild, NetCommand command) { int count = filesToBuild.size(); log("compiling " + count + " file" + ((count == 1) ? "" : "s"), Project.MSG_VERBOSE); Enumeration files = filesToBuild.elements(); while (files.hasMoreElements()) { File file = (File) files.nextElement(); command.addArgument(file.toString()); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/dotnet/WsdlToDotnet.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java
Method name: void applyExtraArgs(NetCommand) Method name: void addFilesToCommand(Hashtable, NetCommand)
Number of AST nodes: 2 Number of AST nodes: 3
1
/**
1
/**
2
         * apply any extra arguments of this class
2
     * add the list of files to a command
3
         * @param command the command to apply the arguments to.
3
     * @param filesToBuild vector of files
4
         */
4
     * @param command the command to append to
5
        public void applyExtraArgs(NetCommand command) {
5
     */
6
            String[] args = getExtraArgs();
6
    protected void addFilesToCommand(Hashtable filesToBuild, NetCommand command) {
7
            for (int i = 0; i < args.length; i++) {
7
        int count = filesToBuild.size();
8
               command.addArgument(args[i]);
8
        log("compiling " + count + " file" + ((count == 1) ? "" : "s"),
9
            }
9
                Project.MSG_VERBOSE);
10
        }
10
        Enumeration files = filesToBuild.elements();
11
        while (files.hasMoreElements()) {
12
            File file = (File) files.nextElement();
13
            command.addArgument(file.toString());
14
        }
15
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.400
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < args.length; i++)
    2
    for (int i = 0; i < args.length; i++)
    4
    while (files.hasMoreElements())
    Differences
    Expression1Expression2Difference
    i < args.lengthfiles.hasMoreElements()TYPE_COMPATIBLE_REPLACEMENT
    java.lang.String[]java.util.HashtableVARIABLE_TYPE_MISMATCH
    java.lang.String[]java.util.HashtableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable args does not match with type java.util.Hashtable of variable filesToBuild
    • Make classes java.lang.String[] and java.util.Hashtable extend a common superclass
    Type java.lang.String[] of variable args does not match with type java.util.Hashtable of variable filesToBuild
    • Make classes java.lang.String[] and java.util.Hashtable extend a common superclass
    4
    while (files.hasMoreElements())
                                                                                  
    5
    File file = (File)files.nextElement();
    3
    command.addArgument(args[i]);
    3
    command.addArgument(args[i]);
    6
    command.addArgument(file.toString());
    Differences
    Expression1Expression2Difference
    args[i]file.toString()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression args[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    command.addArgument(file.toString());
    Precondition Violations (3)
    Row Violation
    1Type java.lang.String[] of variable args does not match with type java.util.Hashtable of variable filesToBuild
    2Type java.lang.String[] of variable args does not match with type java.util.Hashtable of variable filesToBuild
    3Expression args[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted