if ((str.startsWith("From ") == false) || (str.length() == 0)) { strbuf.append(str + "\n"); } else { // line contains "@" (evolution mbox style) or // -> import message in Columba if (str.indexOf("@") != -1) { if (strbuf.length() != 0) { // found new message saveMessage(strbuf.toString(), worker, getDestinationFolder()); count++; sucess = true; } strbuf = new StringBuffer(); } else { strbuf.append(str + "\n"); } }
while ((str = in.readLine()) != null) { // if user cancelled task exit immediately if (worker.cancelled() == true) { return; } // if line doesn't start with "From ???@???" or line length is 0 // -> save everything in StringBuffer if ((str.startsWith("From ???@???") == false) || (str.length() == 0)) { strbuf.append(str + "\n"); } else { if (strbuf.length() != 0) { // found new message saveMessage(strbuf.toString(), worker, getDestinationFolder()); count++; sucess = true; } strbuf = new StringBuffer(); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/mailboximport/EvolutionImporter.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/mailboximport/PegasusMailImporter.java
Method name: void importMailboxFile(File, IWorkerStatusController, IMailbox) Method name: void importMailboxFile(File, IWorkerStatusController, IMailbox)
Number of AST nodes: 9 Number of AST nodes: 10
1
if ((str.startsWith("From ") == false) || (str.length
1
while ((str = in.readLine()) != null) {
2
            // if user cancelled task exit immediately
2
() == 0)) {
3
            if (worker.cancelled() == true) {
3
                strbuf.append(str + "\n");
4
                return;
4
            } else {
5
            }
5
 
6
               // line contains "@" (evolution mbox style) or
6
            // if line 
7
                //  -> import message in Columba
7
doesn't start with "From ???@???" or line length is 0
8
            //  -> save everything in StringBuffer
9
            if ((str.startsWith("From ???@???") == false) ||
8
                if (str.indexOf("@") != -1) {
10
                    (str.length() == 0)) {
9
    
11
                strbuf.append(str + "\n");
12
            } else {
10
                if (strbuf.length() != 0) {
13
                if (strbuf.length() != 0) {
11
                        // found new message
14
                    // found new message
12
                        saveMessage(strbuf.toString(), worker,
15
                    saveMessage(strbuf.toString(), worker,
13
                            getDestinationFolder());
16
                        getDestinationFolder());
14
                        count++;
17
                    count++;
15
                        sucess = true;
18
                    sucess = true;
16
                    }
19
                
17
    
20
}
18
                strbuf = new StringBuffer();
21
                strbuf = new StringBuffer();
19
                } else {
22
            
20
                    strbuf.append(str + "\n");
21
                }
22
    
23
}
23
        }
24
        }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)72.5
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    12
    if (strbuf.length() != 0)
    11
    if (strbuf.length() != 0)
    13
    saveMessage(strbuf.toString(), worker, getDestinationFolder());
    12
    saveMessage(strbuf.toString(), worker, getDestinationFolder());
    14
    count++;
    13
    count++;
    15
    sucess = true;
    14
    sucess = true;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables sucess, count , while Clone fragment #2 returns variables sucess, count