if (needQPEncoding(body)) { bodyPart.getHeader().setContentTransferEncoding("quoted-printable"); // check if the charset is US-ASCII then there is something wrong // -> switch to UTF-8 and write to log-file if( charsetName.equalsIgnoreCase("us-ascii")){ charsetName = "UTF-8"; LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8"); } }
if (needQPEncoding(body)) { bodyPart.getHeader().setContentTransferEncoding("quoted-printable"); // check if the charset is US-ASCII then there is something wrong // -> switch to UTF-8 and write to log-file if( charsetName.equalsIgnoreCase("us-ascii")){ charsetName = "UTF-8"; LOG.info("Charset was US-ASCII but text has 8-bit chars -> switched to UTF-8"); } }
Clone fragments detected by clone detection tool
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: 5 Number of AST nodes: 5
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
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons13
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 1
    Mapped Statements
    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");
    Precondition Violations (0)
    Row Violation