IStructureValue value = context.getValue(); if ( value == null ) return; StringBuffer buf = new StringBuffer(); buf.append(value.getName()); DefaultMutableTreeNode root = new DefaultMutableTreeNode(buf.toString()); createTree(root, value); treeModel = new DefaultTreeModel(root);
StringBuffer result = new StringBuffer(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String nextLine = reader.readLine(); while (nextLine != null) { result.append(nextLine); result.append("\r\n"); nextLine = reader.readLine(); } return result.toString();
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/context/ContextDebugProvider.java File path: /columba-1.4-src/mail/src/test/java/org/columba/mail/folder/FolderTstHelper.java
Method name: void search(ISemanticContext, int, int) Method name: String getStringFromInputStream(InputStream)
Number of AST nodes: 8 Number of AST nodes: 8
1
IStructureValue value = context.getValue();
1
Str
2
		if ( value == null ) return;
3
		
4
		StringBuffer buf = new StringBuffer();
5
		buf.append(value.getName());
6
		DefaultMutableTreeNode root = new DefaultMutableTreeNode(buf.toString());
7
		createTree(root, value);
8
		treeModel = new DefaultTreeModel(root
2
ingBuffer result = new StringBuffer();
3
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
4
        String nextLine = reader.readLine();
5
        while (nextLine != null) {
6
            result.append(nextLine);
7
            result.append("\r\n");
8
            nextLine = reader.readLine();
9
        }
9
);
10
        return result.toString();
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.0
Clones locationClones are in different classes
Number of node comparisons23
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment7
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    IStructureValue value = context.getValue();
                                                                                            
                                                                                                                                                  
    2
    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
    2
    if (value == null)
                                            
    3
    return;
    3
    return;
    Preondition Violations
    Unmatched return;
                        
    4
    StringBuffer buf = new StringBuffer();
    4
    StringBuffer buf = new StringBuffer();
    1
    StringBuffer result = new StringBuffer();
    Differences
    Expression1Expression2Difference
    bufresultVARIABLE_NAME_MISMATCH
    1
    StringBuffer result = new StringBuffer();
                                                                              
    3
    String nextLine = reader.readLine();
    Preondition Violations
    Unmatched statement String nextLine=reader.readLine(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    String nextLine = reader.readLine();
                                                        
    4
    while (nextLine != null)
                                                          
    5
    result.append(nextLine);
    Preondition Violations
    Unmatched statement result.append(nextLine); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    result.append(nextLine);
                                                      
    6
    result.append("\r\n");
    Preondition Violations
    Unmatched statement result.append("\r\n"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    result.append("\r\n");
                                                                
    7
    nextLine = reader.readLine();
    Preondition Violations
    Unmatched statement nextLine=reader.readLine(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    nextLine = reader.readLine();
    5
    buf.append(value.getName());
    5
    buf.append(value.getName());
    Preondition Violations
    Unmatched statement buf.append(value.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    6
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(buf.toString());
    6
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(buf.toString());
    Preondition Violations
    Unmatched statement DefaultMutableTreeNode root=new DefaultMutableTreeNode(buf.toString()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                        
    7
    createTree(root, value);
    7
    createTree(root, value);
    Preondition Violations
    Unmatched statement createTree(root,value); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                        
                                                            
    8
    return result.toString();
    Preondition Violations
    Unmatched statement return result.toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return result.toString();
    8
    return result.toString();
    8
    treeModel = new DefaultTreeModel(root);
    8
    treeModel = new DefaultTreeModel(root);
    Preondition Violations
    Unmatched statement treeModel=new DefaultTreeModel(root); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                    
    Precondition Violations (11)
    Row Violation
    1Unmatched return;
    2Unmatched statement String nextLine=reader.readLine(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement result.append(nextLine); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement result.append("\r\n"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement nextLine=reader.readLine(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement buf.append(value.getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement DefaultMutableTreeNode root=new DefaultMutableTreeNode(buf.toString()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement createTree(root,value); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement return result.toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched return result.toString();
    11Unmatched statement treeModel=new DefaultTreeModel(root); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted