File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Zip.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/filters/DynamicFilterTest.java | |||
Method name: void addResources(ResourceCollection, Resource[], ZipOutputStream)
|
Method name: String getFileString(String)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | InputStream is = null;↵ | |||
2 | try {↵ | |||
3 | is = resources[i].getInputStream();↵ | |||
4 | zipFile(is, zOut, name,↵ | |||
5 | resources[i].getLastModified(),↵ | |||
6 | null, ArchiveFileSet.DEFAULT_FILE_MODE↵ | 1 | Reader r = null;↵ | |
2 | try {↵ | |||
3 | r = new FileReader(FILE_UTILS.resolveFile(getProject().getBaseDir(), filename));↵ | |||
7 | );↵ | 4 | return FileUtils.readFully(r);↵ | |
8 | ↵ | 5 | }↵ | |
9 | } finally {↵ | 6 | finally {↵ | |
10 | FileUtils.close(is);↵ | 7 | FileUtils.close(r);↵ | |
11 | } | 8 |
| |
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; | | ||||||||||||||||
22 | try |
| 2 | try | ||||||||||||||
|
| 3 | r = new FileReader(FILE_UTILS.resolveFile(getProject().getBaseDir(), 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.InputStream of variable is does not match with type java.io.Reader of variable r |
2 | Unmatched statement r=new FileReader(FILE_UTILS.resolveFile(getProject().getBaseDir(),filename)); 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 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 |
4 | Unmatched return FileUtils.readFully(r); |
5 | 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 |