File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java | |||
Method name: void save()
|
Method name: void load()
|
|||
Number of AST nodes: 6 | Number of AST nodes: 5 | |||
1 | if ((cachefile != null) && cache.propertyNames().hasMoreElements()) {↵ | 1 | if ((cachefile != null) && cachefile.isFile() && cachefile.canRead()) {↵ | |
2 | try {↵ | 2 | try {↵ | |
3 | BufferedOutputStream bos = new BufferedOutputStream(↵ | 3 | BufferedInputStream bis = new BufferedInputStream(↵ | |
4 | new FileOutputStream(cachefile));↵ | 4 | new FileInputStream(cachefile));↵ | |
5 | cache.store(bos, null);↵ | 5 | cache.↵ | |
6 | bos.flush();↵ | 6 | load(bis);↵ | |
7 | bos.close();↵ | 7 | bis.close();↵ | |
8 | } catch (Exception e) {↵ | 8 | } catch (Exception e) {↵ | |
9 | e.printStackTrace();↵ | 9 | e.printStackTrace();↵ | |
10 | }↵ | 10 | }↵ | |
11 | } | 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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 21 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | try | 2 | try | ||||||||||||||||||||||
| 3 | BufferedInputStream bis = new BufferedInputStream(new FileInputStream(cachefile)); | |||||||||||||||||||||||
5 | BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(cachefile)); | | |||||||||||||||||||||||
6 | cache.store(bos, null); |
| 4 | cache.load(bis); | |||||||||||||||||||||
7 | bos.flush(); |
| | ||||||||||||||||||||||
8 | bos.close(); |
| 5 | bis.close(); |
Row | Violation |
---|---|
1 | Expression cache.store(bos,null) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression cache.load(bis) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
3 | Expression cache.store(bos,null) is a void method call, and thus it cannot be parameterized |
4 | Expression cache.load(bis) is a void method call, and thus it cannot be parameterized |
5 | Expression cache.store(bos,null) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
6 | Expression cache.load(bis) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
7 | Expression cache.store(bos,null) is a void method call, and thus it cannot be parameterized |
8 | Expression cache.load(bis) is a void method call, and thus it cannot be parameterized |
9 | Unmatched statement bos.flush(); 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 |
10 | Type java.io.BufferedOutputStream of variable bos does not match with type java.io.BufferedInputStream of variable bis |