try { // get I/O streams for remote scp OutputStream out = channel.getOutputStream(); InputStream in = channel.getInputStream(); channel.connect(); sendAck(out); startRemoteCpProtocol(in, out, localFile); } finally { if (channel != null) { channel.disconnect(); } }
try { OutputStream out = channel.getOutputStream(); InputStream in = channel.getInputStream(); channel.connect(); waitForAck(in); sendFileToRemote(localFile, in, out); } finally { if (channel != null) { channel.disconnect(); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java
Method name: void execute() Method name: void doSingleTransfer()
Number of AST nodes: 6 Number of AST nodes: 6
1
try {
1
try {
2
            // get I/O streams for remote scp
3
            OutputStream out = channel.getOutputStream();
2
            OutputStream out = channel.getOutputStream();
4
            InputStream in = channel.getInputStream();
3
            InputStream in = channel.getInputStream();
5
            channel.connect();
4
            channel.connect();
6
            sendAck(out);
5
            waitForAck(in);
7
            startRemoteCpProtocol(in, out, localFile);
6
            sendFileToRemote(localFile, in, out);
8
        } finally {
7
        } finally {
9
            if (channel != null) {
8
            if (channel != null) {
10
                channel.disconnect();
9
                channel.disconnect();
11
            }
10
            }
12
        }
11
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    try
    3
    try
    7
    OutputStream out = channel.getOutputStream();
    4
    OutputStream out = channel.getOutputStream();
    8
    InputStream in = channel.getInputStream();
    5
    InputStream in = channel.getInputStream();
    9
    channel.connect();
    6
    channel.connect();
    10
    sendAck(out);
    10
    sendAck(out);
    8
    sendFileToRemote(localFile, in, out);
    Differences
    Expression1Expression2Difference
    sendAcksendFileToRemoteMETHOD_INVOCATION_NAME_MISMATCH
    sendAck(out)sendFileToRemote(localFile,in,out)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression sendAck(out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sendFileToRemote(localFile,in,out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method sendFileToRemote
    Expression sendAck(out) is a void method call, and thus it cannot be parameterized
    Expression sendFileToRemote(localFile,in,out) is a void method call, and thus it cannot be parameterized
    Expression sendAck(out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression sendFileToRemote(localFile,in,out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method sendFileToRemote
    Expression sendAck(out) is a void method call, and thus it cannot be parameterized
    Expression sendFileToRemote(localFile,in,out) is a void method call, and thus it cannot be parameterized
    8
    sendFileToRemote(localFile, in, out);
    11
    startRemoteCpProtocol(in, out, localFile);
    11
    startRemoteCpProtocol(in, out, localFile);
    7
    waitForAck(in);
    Differences
    Expression1Expression2Difference
    startRemoteCpProtocolwaitForAckMETHOD_INVOCATION_NAME_MISMATCH
    startRemoteCpProtocol(in,out,localFile)waitForAck(in)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression startRemoteCpProtocol(in,out,localFile) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method startRemoteCpProtocol
    Expression waitForAck(in) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression startRemoteCpProtocol(in,out,localFile) is a void method call, and thus it cannot be parameterized
    Expression waitForAck(in) is a void method call, and thus it cannot be parameterized
    Expression startRemoteCpProtocol(in,out,localFile) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method startRemoteCpProtocol
    Expression waitForAck(in) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression startRemoteCpProtocol(in,out,localFile) is a void method call, and thus it cannot be parameterized
    Expression waitForAck(in) is a void method call, and thus it cannot be parameterized
    7
    waitForAck(in);
    Precondition Violations (16)
    Row Violation
    1Expression sendAck(out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression sendFileToRemote(localFile,in,out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression sendAck(out) is a void method call, and thus it cannot be parameterized
    4Expression sendFileToRemote(localFile,in,out) is a void method call, and thus it cannot be parameterized
    5Expression sendAck(out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression sendFileToRemote(localFile,in,out) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression sendAck(out) is a void method call, and thus it cannot be parameterized
    8Expression sendFileToRemote(localFile,in,out) is a void method call, and thus it cannot be parameterized
    9Expression startRemoteCpProtocol(in,out,localFile) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression waitForAck(in) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression startRemoteCpProtocol(in,out,localFile) is a void method call, and thus it cannot be parameterized
    12Expression waitForAck(in) is a void method call, and thus it cannot be parameterized
    13Expression startRemoteCpProtocol(in,out,localFile) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression waitForAck(in) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression startRemoteCpProtocol(in,out,localFile) is a void method call, and thus it cannot be parameterized
    16Expression waitForAck(in) is a void method call, and thus it cannot be parameterized