File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/composer/MessageComposer.java | File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/composer/MessageComposer.java | |||
Method name: StreamableMimePart composeHtmlMimePart(boolean)
|
Method name: StreamableMimePart composeTextMimePart(boolean)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | if (needQPEncoding(body)) {↵ | 1 | if (needQPEncoding(body)) {↵ | |
2 | bodyPart.getHeader().setContentTransferEncoding("quoted-printable");↵ | 2 | bodyPart.getHeader().setContentTransferEncoding("quoted-printable");↵ | |
3 | ↵ | |||
3 | // check if the charset is US-ASCII then there is something wrong↵ | 4 | // check if the charset is US-ASCII then there is something wrong↵ | |
4 | // -> switch to UTF-8 and write to log-file↵ | 5 | // -> switch to UTF-8 and write to log-file↵ | |
5 | if( charsetName.equalsIgnoreCase("us-ascii")){↵ | 6 | if( charsetName.equalsIgnoreCase("us-ascii")){↵ | |
6 | charsetName = "UTF-8";↵ | 7 | charsetName = "UTF-8";↵ | |
7 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8");↵ | 8 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8");↵ | |
8 | }↵ | 9 | }↵ | |
9 | }↵ | 10 | }↵ | |
11 | ↵ | |||
12 | // write charset to header↵ | |||
10 | bodyPart.getHeader().putContentParameter("charset", charsetName);↵ | 13 | bodyPart.getHeader().putContentParameter("charset", charsetName);↵ | |
14 | ↵ | |||
11 | // to allow empty messages↵ | 15 | // to allow empty messages↵ | |
12 | if (body.length() == 0) {↵ | 16 | if (body.length() == 0) {↵ | |
13 | body = " ";↵ | 17 | body = " ";↵ | |
14 | }↵ | 18 | }↵ | |
15 | bodyPart.setBody(new CharSequenceSource(body));↵ | 19 | bodyPart.setBody(new CharSequenceSource(body));↵ | |
16 | return bodyPart; | 20 |
| |
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) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 26 |
Number of mapped statements | 10 |
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) | 1.5 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
36 | if (needQPEncoding(body)) | 13 | if (needQPEncoding(body)) | |
37 | bodyPart.getHeader().setContentTransferEncoding("quoted-printable"); | 14 | bodyPart.getHeader().setContentTransferEncoding("quoted-printable"); | |
38 | if (charsetName.equalsIgnoreCase("us-ascii")) | 15 | if (charsetName.equalsIgnoreCase("us-ascii")) | |
39 | charsetName = "UTF-8"; | 16 | charsetName = "UTF-8"; | |
40 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8"); | 17 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8"); | |
41 | bodyPart.getHeader().putContentParameter("charset", charsetName); | 18 | bodyPart.getHeader().putContentParameter("charset", charsetName); | |
42 | if (body.length() == 0) | 19 | if (body.length() == 0) | |
43 | body = " "; | 20 | body = " "; | |
44 | bodyPart.setBody(new CharSequenceSource(body)); | 21 | bodyPart.setBody(new CharSequenceSource(body)); | |
45 | return bodyPart; | 22 | return bodyPart; |
Row | Violation |
---|