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/MozillaImporter.java | |||
Method name: void importMailboxFile(File, IWorkerStatusController, IMailbox)
|
Method name: void importMailboxFile(File, IWorkerStatusController, IMailbox)
|
|||
Number of AST nodes: 20 | Number of AST nodes: 20 | |||
1 | int count = 0;↵ | 1 | int count = 0;↵ | |
2 | boolean sucess = false;↵ | 2 | boolean sucess = false;↵ | |
3 | StringBuffer strbuf = new StringBuffer();↵ | 3 | StringBuffer strbuf = new StringBuffer();↵ | |
4 | BufferedReader in = new BufferedReader(new FileReader(file));↵ | 4 | BufferedReader in = new BufferedReader(new FileReader(file));↵ | |
5 | String str;↵ | 5 | String str;↵ | |
6 | // parse line by line↵ | 6 | // parse line by line↵ | |
7 | while ((str = in.readLine()) != null) {↵ | 7 | while ((str = in.readLine()) != null) {↵ | |
8 | // if user cancelled task exit immediately↵ | 8 | // if user cancelled task exit immediately↵ | |
9 | if (worker.cancelled() == true) {↵ | 9 | if (worker.cancelled()) {↵ | |
10 | return;↵ | 10 | return;↵ | |
11 | }↵ | 11 | }↵ | |
12 | // if line doesn't start with "From" or line length is 0↵ | 12 | // if line doesn't start with "From" or line length is 0↵ | |
13 | // -> save everything in StringBuffer↵ | 13 | // -> save everything in StringBuffer↵ | |
14 | if ((str.startsWith("From ") == false) || (str.length() == 0)) {↵ | 14 | if (!str.startsWith("From ") || str.length() == 0) {↵ | |
15 | strbuf.append(str + "\n");↵ | 15 | strbuf.append(str + "\n");↵ | |
16 | } else {↵ | 16 | } else {↵ | |
17 | // line contains "@" (evolution mbox style) or↵ | 17 | // line contains "-" (mozilla mbox style)↵ | |
18 | // -> import message in Columba↵ | 18 | // -> import message in Columba↵ | |
19 | if (str.indexOf("@") != -1) {↵ | 19 | if (str.indexOf("-") != -1) {↵ | |
20 | if (strbuf.length() != 0) {↵ | 20 | if (strbuf.length() != 0) {↵ | |
21 | // found new message↵ | 21 | // found new message↵ | |
22 | saveMessage(strbuf.toString(), worker,↵ | 22 | saveMessage(strbuf.toString(), worker,↵ | |
23 | getDestinationFolder());↵ | 23 | getDestinationFolder());↵ | |
24 | count++;↵ | 24 | count++;↵ | |
25 | sucess = true;↵ | 25 | sucess = true;↵ | |
26 | }↵ | 26 | }↵ | |
27 | strbuf = new StringBuffer();↵ | 27 | strbuf = new StringBuffer();↵ | |
28 | } else {↵ | 28 | } else {↵ | |
29 | strbuf.append(str + "\n");↵ | 29 | strbuf.append(str + "\n");↵ | |
30 | }↵ | 30 | }↵ | |
31 | }↵ | 31 | }↵ | |
32 | }↵ | 32 | }↵ | |
33 | // save last message, because while loop aborted before being able to↵ | 33 | // save last message, because while loop aborted before being able to↵ | |
34 | // save message↵ | 34 | // save message↵ | |
35 | if ((sucess == true) && (strbuf.length() > 0)) {↵ | 35 | if (sucess && strbuf.length() > 0) {↵ | |
36 | saveMessage(strbuf.toString(), worker, getDestinationFolder());↵ | 36 | saveMessage(strbuf.toString(), worker, getDestinationFolder());↵ | |
37 | }↵ | 37 | }↵ | |
38 | in.close(); | 38 |
| |
See real code fragment | See real code fragment |
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) | 1.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 49 |
Number of mapped statements | 17 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 84.5 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | int count = 0; | 1 | int count = 0; | ||||||||||||||||||
2 | boolean sucess = false; | 2 | boolean sucess = false; | ||||||||||||||||||
3 | StringBuffer strbuf = new StringBuffer(); | 3 | StringBuffer strbuf = new StringBuffer(); | ||||||||||||||||||
4 | BufferedReader in = new BufferedReader(new FileReader(file)); | 4 | BufferedReader in = new BufferedReader(new FileReader(file)); | ||||||||||||||||||
5 | String str; | 5 | String str; | ||||||||||||||||||
6 | while ((str = in.readLine()) != null) | 6 | while ((str = in.readLine()) != null) | ||||||||||||||||||
| 7 | if (worker.cancelled()) | |||||||||||||||||||
|
| 8 | return; | ||||||||||||||||||
7 | if (worker.cancelled() == true) | | |||||||||||||||||||
8 | return; |
| | ||||||||||||||||||
9 | if ((str.startsWith("From ") == false) || (str.length() == 0)) |
| 9 | if (!str.startsWith("From ") || str.length() == 0) | |||||||||||||||||
10 | strbuf.append(str + "\n"); | 10 | strbuf.append(str + "\n"); | ||||||||||||||||||
else | else | ||||||||||||||||||||
11 | if (str.indexOf("@") != -1) |
| 11 | if (str.indexOf("-") != -1) | |||||||||||||||||
12 | if (strbuf.length() != 0) | 12 | if (strbuf.length() != 0) | ||||||||||||||||||
13 | saveMessage(strbuf.toString(), worker, getDestinationFolder()); | 13 | saveMessage(strbuf.toString(), worker, getDestinationFolder()); | ||||||||||||||||||
14 | count++; | 14 | count++; | ||||||||||||||||||
15 | sucess = true; | 15 | sucess = true; | ||||||||||||||||||
16 | strbuf = new StringBuffer(); | 16 | strbuf = new StringBuffer(); | ||||||||||||||||||
else | else | ||||||||||||||||||||
17 | strbuf.append(str + "\n"); | 17 | strbuf.append(str + "\n"); | ||||||||||||||||||
18 | if ((sucess == true) && (strbuf.length() > 0)) |
| 18 | if (sucess && strbuf.length() > 0) | |||||||||||||||||
19 | saveMessage(strbuf.toString(), worker, getDestinationFolder()); | 19 | saveMessage(strbuf.toString(), worker, getDestinationFolder()); |
Row | Violation |
---|---|
1 | Unmatched return; |
2 | Unmatched return; |
3 | Expression (str.startsWith("From ") == false) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression !str.startsWith("From ") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression (str.length() == 0) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression str.length() == 0 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression (sucess == true) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression sucess cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression (strbuf.length() > 0) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression strbuf.length() > 0 cannot be parameterized, because it has dependencies to/from statements that will be extracted |