if (header.getFileName() != null) { text = header.getFileName(); } else { text = contentType + "/" + contentSubtype; } // Get Tooltip for Icon StringBuffer tooltip = new StringBuffer(); tooltip.append("<html><body>"); if (header.getFileName() != null) { tooltip.append(header.getFileName()); tooltip.append(" - "); } tooltip.append("<i>"); if (header.getContentDescription() != null) { tooltip.append(header.getContentDescription()); } else { tooltip.append(contentType); tooltip.append("/"); tooltip.append(contentSubtype); } tooltip.append("</i></body></html>"); ImageIcon image = null; image = new AttachmentImageIconLoader().getImageIcon(type.getType(), type.getSubtype());
if (header.getFileName() != null) { text = header.getFileName(); } else { text = contentType + "/" + contentSubtype; } // Get Tooltip for Icon StringBuffer tooltip = new StringBuffer(); tooltip.append("<html><body>"); if (header.getFileName() != null) { tooltip.append(header.getFileName()); tooltip.append(" - "); } tooltip.append("<i>"); if (header.getContentDescription() != null) { tooltip.append(header.getContentDescription()); } else { tooltip.append(contentType); tooltip.append("/"); tooltip.append(contentSubtype); } tooltip.append("</i></body></html>"); ImageIcon icon = null; icon = new AttachmentImageIconLoader().getImageIcon(type.getType(), type.getSubtype());
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/viewer/HeaderViewer.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/viewer/AttachmentsViewer.java
Method name: JButton createAttachmentItem(StreamableMimePart) Method name: boolean setMimePartTree(MimeTree)
Number of AST nodes: 17 Number of AST nodes: 17
1
if (header.getFileName() != null) {
1
if (header.getFileName() != null) {
2
			text = header.getFileName();
2
				text = header.getFileName();
3
		} else {
3
			} else {
4
			text = contentType + "/" + contentSubtype;
4
				text = contentType + "/" + contentSubtype;
5
		}
5
			}
6
		// Get Tooltip for Icon
6
			// Get Tooltip for Icon
7
		StringBuffer tooltip = new StringBuffer();
7
			StringBuffer tooltip = new StringBuffer();
8
		tooltip.append("<html><body>");
8
			tooltip.append("<html><body>");
9
		if (header.getFileName() != null) {
9
			if (header.getFileName() != null) {
10
			tooltip.append(header.getFileName());
10
				tooltip.append(header.getFileName());
11
			tooltip.append(" - ");
11
				tooltip.append(" - ");
12
		}
12
			}
13
		tooltip.append("<i>");
13
			tooltip.append("<i>");
14
		if (header.getContentDescription() != null) {
14
			if (header.getContentDescription() != null) {
15
			tooltip.append(header.getContentDescription());
15
				tooltip.append(header.getContentDescription());
16
		} else {
16
			} else {
17
			tooltip.append(contentType);
17
				tooltip.append(contentType);
18
			tooltip.append("/");
18
				tooltip.append("/");
19
			tooltip.append(contentSubtype);
19
				tooltip.append(contentSubtype);
20
		}
20
			}
21
		tooltip.append("</i></body></html>");
21
			tooltip.append("</i></body></html>");
22
		ImageIcon image = null;
22
			ImageIcon icon = null;
23
		image = new AttachmentImageIconLoader().getImageIcon(type.getType(),
23
			icon = new AttachmentImageIconLoader().getImageIcon(type.getType(),
24
				type.getSubtype());
24
					type.getSubtype());
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.8
Clones locationClones are in different classes having the same super class
Number of node comparisons83
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)10.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (header.getFileName() != null)
    14
    if (header.getFileName() != null)
    7
    text = header.getFileName();
    15
    text = header.getFileName();
    else
            
    8
    text = contentType + "/" + contentSubtype;
                                                                                          
                                                                                            
    16
    text = contentType + "/" + contentSubtype;
    Preondition Violations
    Unmatched statement text=contentType + "/" + contentSubtype; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    text = contentType + "/" + contentSubtype;
    9
    StringBuffer tooltip = new StringBuffer();
    17
    StringBuffer tooltip = new StringBuffer();
    10
    tooltip.append("<html><body>");
    18
    tooltip.append("<html><body>");
    11
    if (header.getFileName() != null)
    19
    if (header.getFileName() != null)
    12
    tooltip.append(header.getFileName());
    20
    tooltip.append(header.getFileName());
    13
    tooltip.append(" - ");
    21
    tooltip.append(" - ");
    14
    tooltip.append("<i>");
    22
    tooltip.append("<i>");
    15
    if (header.getContentDescription() != null)
    23
    if (header.getContentDescription() != null)
    16
    tooltip.append(header.getContentDescription());
    24
    tooltip.append(header.getContentDescription());
    else
    else
    17
    tooltip.append(contentType);
    25
    tooltip.append(contentType);
    18
    tooltip.append("/");
    26
    tooltip.append("/");
    19
    tooltip.append(contentSubtype);
    27
    tooltip.append(contentSubtype);
    20
    tooltip.append("</i></body></html>");
    28
    tooltip.append("</i></body></html>");
    21
    ImageIcon image = null;
    21
    ImageIcon image = null;
    29
    ImageIcon icon = null;
    Differences
    Expression1Expression2Difference
    imageiconVARIABLE_NAME_MISMATCH
    29
    ImageIcon icon = null;
    22
    image = new AttachmentImageIconLoader().getImageIcon(type.getType(), type.getSubtype());
    22
    image = new AttachmentImageIconLoader().getImageIcon(type.getType(), type.getSubtype());
    30
    icon = new AttachmentImageIconLoader().getImageIcon(type.getType(), type.getSubtype());
    Differences
    Expression1Expression2Difference
    imageiconVARIABLE_NAME_MISMATCH
    org.columba.mail.gui.message.viewer.HeaderViewer.AttachmentImageIconLoaderorg.columba.mail.gui.message.viewer.AttachmentsViewer.AttachmentImageIconLoaderVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.columba.mail.gui.message.viewer.HeaderViewer.AttachmentImageIconLoader does not match with type org.columba.mail.gui.message.viewer.AttachmentsViewer.AttachmentImageIconLoader
    • Make classes org.columba.mail.gui.message.viewer.HeaderViewer.AttachmentImageIconLoader and org.columba.mail.gui.message.viewer.AttachmentsViewer.AttachmentImageIconLoader extend a common superclass
    30
    icon = new AttachmentImageIconLoader().getImageIcon(type.getType(), type.getSubtype());
    Precondition Violations (4)
    Row Violation
    1Unmatched statement text=contentType + "/" + contentSubtype; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type org.columba.mail.gui.message.viewer.HeaderViewer.AttachmentImageIconLoader does not match with type org.columba.mail.gui.message.viewer.AttachmentsViewer.AttachmentImageIconLoader
    3Clone fragment #1 returns variables image, text, tooltip , while Clone fragment #2 returns variables text, tooltip, icon
    4The refactoring of the clones is infeasible, because classes org.columba.mail.gui.message.viewer.HeaderViewer and org.columba.mail.gui.message.viewer.AttachmentsViewer do not have a common superclass