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 composeTextMimePart(boolean)
|
Method name: StreamableMimePart composeHtmlMimePart(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 | ↵ | |||
4 | // check if the charset is US-ASCII then there is something wrong↵ | 3 | // check if the charset is US-ASCII then there is something wrong↵ | |
5 | // -> switch to UTF-8 and write to log-file↵ | 4 | // -> switch to UTF-8 and write to log-file↵ | |
6 | if( charsetName.equalsIgnoreCase("us-ascii")){↵ | 5 | if( charsetName.equalsIgnoreCase("us-ascii")){↵ | |
7 | charsetName = "UTF-8";↵ | 6 | charsetName = "UTF-8";↵ | |
8 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8");↵ | 7 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8");↵ | |
9 | }↵ | 8 | }↵ | |
10 | }↵ | 9 | }↵ | |
11 | ↵ | |||
12 | // write charset to header↵ | |||
13 | bodyPart.getHeader().putContentParameter("charset", charsetName);↵ | 10 | bodyPart.getHeader().putContentParameter("charset", charsetName);↵ | |
14 | ↵ | |||
15 | // to allow empty messages↵ | 11 | // to allow empty messages↵ | |
16 | if (body.length() == 0) {↵ | 12 | if (body.length() == 0) {↵ | |
17 | body = " ";↵ | 13 | body = " ";↵ | |
18 | }↵ | 14 | }↵ | |
19 | bodyPart.setBody(new CharSequenceSource(body));↵ | 15 | bodyPart.setBody(new CharSequenceSource(body));↵ | |
20 | return bodyPart; | 16 |
| |
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.2 |
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.3 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
13 | if (needQPEncoding(body)) | 36 | if (needQPEncoding(body)) | |
14 | bodyPart.getHeader().setContentTransferEncoding("quoted-printable"); | 37 | bodyPart.getHeader().setContentTransferEncoding("quoted-printable"); | |
15 | if (charsetName.equalsIgnoreCase("us-ascii")) | 38 | if (charsetName.equalsIgnoreCase("us-ascii")) | |
16 | charsetName = "UTF-8"; | 39 | charsetName = "UTF-8"; | |
17 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8"); | 40 | LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8"); | |
18 | bodyPart.getHeader().putContentParameter("charset", charsetName); | 41 | bodyPart.getHeader().putContentParameter("charset", charsetName); | |
19 | if (body.length() == 0) | 42 | if (body.length() == 0) | |
20 | body = " "; | 43 | body = " "; | |
21 | bodyPart.setBody(new CharSequenceSource(body)); | 44 | bodyPart.setBody(new CharSequenceSource(body)); | |
22 | return bodyPart; | 45 | return bodyPart; |
Row | Violation |
---|