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(); return new FileSource(tempFile);
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(); 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: 10 Number of AST nodes: 10
1
MboxMessage message = (MboxMessage) messages.get(uid);
1
MboxMessage message = (MboxMessage) messages.get(uid);
2
		
3
		
4
		FileInputStream in = new FileInputStream(mboxFile);
2
		FileInputStream in = new FileInputStream(mboxFile);
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();
12
		return new FileSource(tempFile);
10
		return new FileInputStream(tempFile);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons32
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    MboxMessage message = (MboxMessage)messages.get(uid);
    1
    MboxMessage message = (MboxMessage)messages.get(uid);
    4
    FileInputStream in = new FileInputStream(mboxFile);
    2
    FileInputStream in = new FileInputStream(mboxFile);
    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);
    Preondition Violations
    Unmatched statement return new FileInputStream(tempFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return new FileInputStream(tempFile);
    10
    return new FileInputStream(tempFile);
    12
    return new FileSource(tempFile);
    12
    return new FileSource(tempFile);
    Preondition Violations
    Unmatched statement return new FileSource(tempFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return new FileSource(tempFile);
                                                                            
    Precondition Violations (4)
    Row Violation
    1Unmatched statement return new FileInputStream(tempFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return new FileInputStream(tempFile);
    3Unmatched statement return new FileSource(tempFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return new FileSource(tempFile);