for (int j = 0; j < columnNames.length; j++) { String v = (String) header.get(columnNames[j]); if ( v==null) v = ""; out.writeString(v); }
for (int i = 0; i < rows.length; i++) { TreePath treePath = getTree().getPathForRow(rows[i]); if (treePath == null) { continue; } nodes[i] = (MessageNode) treePath.getLastPathComponent(); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/headercache/DefaultHeaderBinding.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/table/TableView.java
Method name: void objectToEntry(Object, TupleOutput) Method name: MessageNode[] getSelectedNodes()
Number of AST nodes: 5 Number of AST nodes: 5
1
for (int j = 0; j < columnNames.length; j++) {
1
for (int i = 0; i < rows.length; i++) {
2
			String v = (String) header.get(columnNames[j]);
2
			TreePath treePath = getTree().getPathForRow(rows[i]);
3
			if ( v==null) v = "";
3
			if (treePath == null) 
4
			out.writeString(v
4
{
5
				continue;
6
			}
5
);
7
			nodes[i] = (MessageNode) treePath.getLastPathComponent();
6
		}
8
		}
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.3
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    26
    for (int j = 0; j < columnNames.length; j++)
    26
    for (int j = 0; j < columnNames.length; j++)
    5
    for (int i = 0; i < rows.length; i++)
    Differences
    Expression1Expression2Difference
    jiVARIABLE_NAME_MISMATCH
    jiVARIABLE_NAME_MISMATCH
    columnNamesrowsVARIABLE_NAME_MISMATCH
    java.lang.String[]int[]VARIABLE_TYPE_MISMATCH
    jiVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable columnNames.length does not match with type int of variable rows.length
    • Make classes java.lang.String[] and int[] extend a common superclass
    5
    for (int i = 0; i < rows.length; i++)
                                                                                                                
    6
    TreePath treePath = getTree().getPathForRow(rows[i]);
    Preondition Violations
    Unmatched statement TreePath treePath=getTree().getPathForRow(rows[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    TreePath treePath = getTree().getPathForRow(rows[i]);
    27
    String v = (String)header.get(columnNames[j]);
    27
    String v = (String)header.get(columnNames[j]);
    Preondition Violations
    Unmatched statement String v=(String)header.get(columnNames[j]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    28
    if (v == null)
    28
    if (v == null)
    7
    if (treePath == null)
    Differences
    Expression1Expression2Difference
    vtreePathVARIABLE_NAME_MISMATCH
    java.lang.Stringjavax.swing.tree.TreePathVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable v does not match with type javax.swing.tree.TreePath of variable treePath
    • Make classes java.lang.String and javax.swing.tree.TreePath extend a common superclass
    7
    if (treePath == null)
                            
    8
    continue;
    Preondition Violations
    Unmatched continue;
    8
    continue;
    29
    v = "";
    29
    v = "";
    Preondition Violations
    Unmatched statement v=""; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                      
                                                                                                                      
    9
    nodes[i] = (MessageNode)treePath.getLastPathComponent();
    Preondition Violations
    Unmatched statement nodes[i]=(MessageNode)treePath.getLastPathComponent(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    nodes[i] = (MessageNode)treePath.getLastPathComponent();
    30
    out.writeString(v);
                                                  
    Precondition Violations (8)
    Row Violation
    1Type int of variable columnNames.length does not match with type int of variable rows.length
    2Unmatched statement TreePath treePath=getTree().getPathForRow(rows[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement String v=(String)header.get(columnNames[j]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable v does not match with type javax.swing.tree.TreePath of variable treePath
    5Unmatched continue;
    6Unmatched statement v=""; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement nodes[i]=(MessageNode)treePath.getLastPathComponent(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8The refactoring of the clones is infeasible, because classes org.columba.mail.folder.headercache.DefaultHeaderBinding and org.columba.mail.gui.table.TableView do not have a common superclass