File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/KeySubst.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/MapperTest.java | |||
Method name: void main(String[])
|
Method name: void testEmptyElementIfIsReference()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | try {↵ | 1 | try {↵ | |
2 | Hashtable hash = new Hashtable();↵ | 2 | ↵ | |
3 | hash.put("VERSION", "1.0.3");↵ | |||
4 | hash.put("b", "ffff");↵ | |||
5 | System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",↵ | |||
6 | hash));↵ | |||
7 | } catch (Exception e) {↵ | |||
8 | e.printStackTrac↵ | 3 | Mapper.MapperType mt = new Mapper.MapperType();↵ | |
4 | mt.setValue("glob");↵ | |||
5 | m.setType(mt);↵ | |||
6 | fail("Can set type in Mapper that is a reference.");↵ | |||
7 | } catch (BuildException be) {↵ | |||
8 | assertEquals("You must not specify more than one attribute when using refid",↵ | |||
9 | e();↵ | 9 | be.getMessage());↵ | |
10 | } | 10 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 25 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 9.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | try |
| 16 | try | |||||||||||||||||||||||||||||
2 | Hashtable hash = new Hashtable(); | | |||||||||||||||||||||||||||||||
3 | hash.put("VERSION", "1.0.3"); | | |||||||||||||||||||||||||||||||
4 | hash.put("b", "ffff"); | | |||||||||||||||||||||||||||||||
| 17 | Mapper.MapperType mt = new Mapper.MapperType(); | |||||||||||||||||||||||||||||||
|
| 18 | mt.setValue("glob"); | ||||||||||||||||||||||||||||||
| 19 | m.setType(mt); | |||||||||||||||||||||||||||||||
5 | System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $", hash)); |
| 20 | fail("Can set type in Mapper that is a reference."); |
Row | Violation |
---|---|
1 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
2 | Expression assertEquals("You must not specify more than one attribute when using refid",be.getMessage()) is a void method call, and thus it cannot be parameterized |
3 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
4 | Expression assertEquals("You must not specify more than one attribute when using refid",be.getMessage()) is a void method call, and thus it cannot be parameterized |
5 | Unmatched statement mt.setValue("glob"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
6 | Expression System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",hash)) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
7 | Expression System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",hash)) is a void method call, and thus it cannot be parameterized |
8 | Expression fail("Can set type in Mapper that is a reference.") is a void method call, and thus it cannot be parameterized |
9 | Expression KeySubst.replace("$f ${VERSION} f ${b} jj $",hash) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
10 | Expression System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",hash)) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
11 | Expression System.out.println(KeySubst.replace("$f ${VERSION} f ${b} jj $",hash)) is a void method call, and thus it cannot be parameterized |
12 | Expression fail("Can set type in Mapper that is a reference.") is a void method call, and thus it cannot be parameterized |