File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/StyleTest.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Zip.java | |||
Method name: String getFileString(String)
|
Method name: void addResources(ResourceCollection, Resource[], ZipOutputStream)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | Reader r = null;↵ | |||
1 | InputStream is = null;↵ | |||
2 | try {↵ | 2 | try {↵ | |
3 | r = new FileReader(getProject().resolveFile(file↵ | 3 | is = resources[i].getInputStream();↵ | |
4 | name));↵ | 4 | zipFile(is, zOut, name,↵ | |
5 | return FileUtils.readFully(r);↵ | 5 | ↵ | |
6 | resources[i].getLastModified(),↵ | |||
7 | null, ArchiveFileSet.DEFAULT_FILE_MODE);↵ | |||
6 | }↵ | 8 | ↵ | |
7 | finally {↵ | 9 | } finally {↵ | |
8 | FileUtils.close(r);↵ | 10 | FileUtils.close(is);↵ | |
9 | } | 11 | } | |
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.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 10 |
Number of mapped statements | 1 |
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) | 0.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Reader r = null; | | ||||||||||||||||
| 21 | InputStream is = null; | ||||||||||||||||
2 | try |
| 22 | try | ||||||||||||||
3 | r = new FileReader(getProject().resolveFile(filename)); | | ||||||||||||||||
4 | return FileUtils.readFully(r); |
| | |||||||||||||||
| 23 | is = resources[i].getInputStream(); | ||||||||||||||||
|
| 24 | zipFile(is, zOut, name, resources[i].getLastModified(), null, ArchiveFileSet.DEFAULT_FILE_MODE); |
Row | Violation |
---|---|
1 | Type java.io.Reader of variable r does not match with type java.io.InputStream of variable is |
2 | Unmatched statement return FileUtils.readFully(r); 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 |
3 | Unmatched return FileUtils.readFully(r); |
4 | Unmatched statement zipFile(is,zOut,name,resources[i].getLastModified(),null,ArchiveFileSet.DEFAULT_FILE_MODE); 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 |