in.skip(message.getStart());
File tempFile = File.createTempFile("mbox_message", ".tmp");
tempFile.deleteOnExit();
FileOutputStream out = new FileOutputStream(tempFile);
StreamUtils.streamCopy(in, out, (int) message.getLength());
in.close();
out.close();
return new FileSource(tempFile);
in.skip(message.getStart());
File tempFile = File.createTempFile("mbox_message", ".tmp");
tempFile.deleteOnExit();
FileOutputStream out = new FileOutputStream(tempFile);
StreamUtils.streamCopy(in, out, (int) message.getLength());
in.close();
out.close();
return new FileInputStream(tempFile);
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/mbox/MboxDataStorage.java
|
|
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/mbox/MboxDataStorage.java
|
Method name: Source getMessageSource(Object)
|
|
Method name: InputStream getMessageStream(Object)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | in.skip(message.getStart());↵ | | 1 | in.skip(message.getStart());↵
|
|
2 | File tempFile = File.createTempFile("mbox_message", ".tmp");↵ | | 2 | File tempFile = File.createTempFile("mbox_message", ".tmp");↵
|
3 | tempFile.deleteOnExit();↵ | | 3 | tempFile.deleteOnExit();↵
|
|
4 | FileOutputStream out = new FileOutputStream(tempFile);↵ | | 4 | FileOutputStream out = new FileOutputStream(tempFile);↵
|
|
5 | StreamUtils.streamCopy(in, out, (int) message.getLength());↵ | | 5 | StreamUtils.streamCopy(in, out, (int) message.getLength());↵
|
|
6 | in.close();↵ | | 6 | in.close();↵
|
7 | out.close();↵ | | 7 | out.close();↵
|
|
8 | return new FileSource(tempFile); | | 8 | return new FileInputStream(tempFile);
|
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 28 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | in.skip(message.getStart()); | | 3 | in.skip(message.getStart()); |
6 | File tempFile = File.createTempFile("mbox_message", ".tmp"); | | 4 | File tempFile = File.createTempFile("mbox_message", ".tmp"); |
7 | tempFile.deleteOnExit(); | | 5 | tempFile.deleteOnExit(); |
8 | FileOutputStream out = new FileOutputStream(tempFile); | | 6 | FileOutputStream out = new FileOutputStream(tempFile); |
9 | StreamUtils.streamCopy(in, out, (int)message.getLength()); | | 7 | StreamUtils.streamCopy(in, out, (int)message.getLength()); |
10 | in.close(); | | 8 | in.close(); |
11 | out.close(); | | 9 | out.close(); |
| | | 10 | return new FileInputStream(tempFile); |
12 | return new FileSource(tempFile); | | | |
Precondition Violations (0)
Row |
Violation |