113-1-2

try { executeTarget(target); } catch (org.apache.tools.ant.BuildException ex) { buildException = ex; if ((null != contains) && (ex.getMessage().indexOf(contains) == -1)) { fail("Should throw BuildException because '" + cause + "' with message containing '" + contains + "' (actual message '" + ex.getMessage() + "' instead)"); } return; } fail("Should throw BuildException because: " + cause);
try { executeTarget(target); } catch (org.apache.tools.ant.BuildException ex) { buildException = ex; if ((null != msg) && (!ex.getMessage().equals(msg))) { fail("Should throw BuildException because '" + cause + "' with message '" + msg + "' (actual message '" + ex.getMessage() + "' instead)"); } return; } fail("Should throw BuildException because: " + cause);

Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/BuildFileTest.java |  | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/BuildFileTest.java
Method name: `void expectBuildExceptionContaining(String, String, String)` |  | Method name: `void expectSpecificBuildException(String, String, String)`
Number of AST nodes: 3 |  | Number of AST nodes: 3

1

    try {↵

1

    try {↵

2

                executeTarget(target);↵

2

                executeTarget(target);↵

3

            } catch (org.apache.tools.ant.BuildException ex) {↵

3

            } catch (org.apache.tools.ant.BuildException ex) {↵

4

                buildException = ex;↵

4

                buildException = ex;↵

5

                if ((null != contains) && (ex.getMessage().indexOf(contains) == -1)) {↵

5

                if ((null != msg) && (!ex.getMessage().equals(msg))) {↵

6

                    fail("Should throw BuildException because '" + cause + "' with message containing '" + contains↵

6

                    fail("Should throw BuildException because '" + cause↵

7

                            + "' with message '" + msg↵

7

     + "' (actual message '" + ex.getMessage() + "' instead)");↵

8

                            + "' (actual message '" + ex.getMessage() + "' instead)");↵

8

                }↵

9

                }↵

9

                return;↵

10

                return;↵

10

            }↵

11

            }↵

11

            fail("Should throw BuildException because: " + cause);

12

            fail("Should throw BuildException because: " + cause);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7
Clones location | Clones are declared in the same class
Number of node comparisons | 5

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 3
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 0.8
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       try

   1 | try
   1 | try

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   contains | msg | VARIABLE_NAME_MISMATCH
   ex.getMessage().indexOf(contains) == -1 | !ex.getMessage().equals(msg) | TYPE_COMPATIBLE_REPLACEMENT
   "' with message containing '" | "' with message '" | LITERAL_VALUE_MISMATCH
   contains | msg | VARIABLE_NAME_MISMATCH

   1

       try

   2

       executeTarget(target);

   2

       executeTarget(target);

   3

       fail("Should throw BuildException because: " + cause);

   3

       fail("Should throw BuildException because: " + cause);

   Precondition Violations (0)
   Row | Violation
   --- | ---