MboxMessage message = (MboxMessage) messages.get(uid);
FileInputStream in = new FileInputStream(mboxFile);
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();
MboxMessage message = (MboxMessage) messages.get(uid);
FileInputStream in = new FileInputStream(mboxFile);
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();
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: InputStream getMessageStream(Object)
|
|
Method name: Source getMessageSource(Object)
|
Number of AST nodes: 9
|
|
Number of AST nodes: 9
|
|
1 | MboxMessage message = (MboxMessage) messages.get(uid);↵ | | 1 | MboxMessage message = (MboxMessage) messages.get(uid);↵
|
| | | 2 | ↵
|
| | | 3 | ↵
|
2 | FileInputStream in = new FileInputStream(mboxFile);↵ | | 4 | FileInputStream in = new FileInputStream(mboxFile);↵
|
3 | in.skip(message.getStart());↵ | | 5 | in.skip(message.getStart());↵
|
|
4 | File tempFile = File.createTempFile("mbox_message", ".tmp");↵ | | 6 | File tempFile = File.createTempFile("mbox_message", ".tmp");↵
|
5 | tempFile.deleteOnExit();↵ | | 7 | tempFile.deleteOnExit();↵
|
|
6 | FileOutputStream out = new FileOutputStream(tempFile);↵ | | 8 | FileOutputStream out = new FileOutputStream(tempFile);↵
|
|
7 | StreamUtils.streamCopy(in, out, (int) message.getLength());↵ | | 9 | StreamUtils.streamCopy(in, out, (int) message.getLength());↵
|
|
8 | in.close();↵ | | 10 | in.close();↵
|
9 | out.close(); | | 11 | out.close();
|
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 | 27 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 9 |
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) | 0.0 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | MboxMessage message = (MboxMessage)messages.get(uid); | | 3 | MboxMessage message = (MboxMessage)messages.get(uid); |
2 | FileInputStream in = new FileInputStream(mboxFile); | | 4 | FileInputStream in = new FileInputStream(mboxFile); |
3 | in.skip(message.getStart()); | | 5 | in.skip(message.getStart()); |
4 | File tempFile = File.createTempFile("mbox_message", ".tmp"); | | 6 | File tempFile = File.createTempFile("mbox_message", ".tmp"); |
5 | tempFile.deleteOnExit(); | | 7 | tempFile.deleteOnExit(); |
6 | FileOutputStream out = new FileOutputStream(tempFile); | | 8 | FileOutputStream out = new FileOutputStream(tempFile); |
7 | StreamUtils.streamCopy(in, out, (int)message.getLength()); | | 9 | StreamUtils.streamCopy(in, out, (int)message.getLength()); |
8 | in.close(); | | 10 | in.close(); |
9 | out.close(); | | 11 | out.close(); |
Precondition Violations (0)
Row |
Violation |