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);
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 comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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
    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);