BufferedOutputStream bos = null;
try {
bos = new BufferedOutputStream(
new FileOutputStream(new File(dir, linkFileName)));
properties.store(bos, "Symlinks from " + dir);
} catch (IOException ioe) {
throw new BuildException(ioe, getLocation());
} finally {
FileUtils.close(bos);
}
BufferedOutputStream bos = null;
try {
bos = new BufferedOutputStream(new FileOutputStream(propertyfile));
properties.store(bos, comment);
} catch (IOException ioe) {
throw new BuildException(ioe, getLocation());
} finally {
FileUtils.close(bos);
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
|
Method name: void writePropertyFile(Properties, File)
|
|
Method name: void writeFile()
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | BufferedOutputStream bos = null;↵ | | 1 | BufferedOutputStream bos = null;↵
|
2 | try {↵ | | 2 | try {↵
|
3 | bos = new BufferedOutputStream(↵ | | 3 | bos = new BufferedOutputStream(↵
|
4 | new FileOutputStream(new File(dir, linkFileName)));↵ | | 4 | new FileOutputStream(propertyfile));↵
|
5 | properties.store(bos, "Symlinks from " + dir);↵ | | 5 | properties.store(bos, comment);↵
|
6 | } catch (IOException ioe) {↵ | | 6 | } catch (IOException ioe) {↵
|
7 | throw new BuildException(ioe, getLocation());↵ | | 7 | throw new BuildException(ioe, getLocation());↵
|
8 | } finally {↵ | | 8 | } finally {↵
|
9 | FileUtils.close(bos);↵ | | 9 | FileUtils.close(bos);↵
|
10 | } | | 10 | }
|
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 10 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 4 |
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) | 1.2 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | BufferedOutputStream bos = null; | | 1 | BufferedOutputStream bos = null; |
2 | try | | 2 | try |
3 | bos = new BufferedOutputStream(new FileOutputStream(new File(dir, linkFileName))); | | 3 | bos = new BufferedOutputStream(new FileOutputStream(propertyfile)); |
4 | properties.store(bos, "Symlinks from " + dir); | | 4 | properties.store(bos, comment); |
Precondition Violations (0)
Row |
Violation |