for (int i = 0; i < _colInfos.length; i++) { if(_colInfos[i].getName().equals(colName)) { return _colInfos[i]; } } throw new IllegalArgumentException("Column " + colName + " not found");
for (int i = 0; i < schemaDetails.length; i++) { if(schemaDetails[i].getSchemaName().equals(schemaName)) { return schemaDetails[i]; } } return null;
Clone fragments detected by clone detection tool
File path: /sql12/plugins/graph/src/net/sourceforge/squirrel_sql/plugins/graph/TableFrameController.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/db/SQLAliasSchemaProperties.java
Method name: ColumnInfo findColumnInfo(String) Method name: SQLAliasSchemaDetailProperties getMatchingDetail(String, SQLAliasSchemaDetailProperties[])
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int i = 0; i < _colInfos.length; i++)
1
for (int i = 0; i < schemaDetails.length; i++)
2
      {
2
      {
3
         if(_colInfos[i].getName().equals(colName))
3
         if(schemaDetails[i].getSchemaName().equals(schemaName))
4
         {
4
         {
5
            return _colInfos[i];
5
            return schemaDetails[i];
6
         }
6
         }
7
      }
7
      }
8
      throw new IllegalArgumentException("Column " + colName + " not found");
8
      return null;
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.4
Clones locationClones are in different classes
Number of node comparisons3
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < _colInfos.length; i++)
    1
    for (int i = 0; i < _colInfos.length; i++)
    1
    for (int i = 0; i < schemaDetails.length; i++)
    Differences
    Expression1Expression2Difference
    _colInfosschemaDetailsVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.graph.ColumnInfo[]net.sourceforge.squirrel_sql.client.gui.db.SQLAliasSchemaDetailProperties[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable _colInfos.length does not match with type int of variable schemaDetails.length
    • Make classes net.sourceforge.squirrel_sql.plugins.graph.ColumnInfo[] and net.sourceforge.squirrel_sql.client.gui.db.SQLAliasSchemaDetailProperties[] extend a common superclass
    1
    for (int i = 0; i < schemaDetails.length; i++)
                                                                                                                        
    2
    if (schemaDetails[i].getSchemaName().equals(schemaName))
    Preondition Violations
    Unmatched statement if(schemaDetails[i].getSchemaName().equals(schemaName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    if (schemaDetails[i].getSchemaName().equals(schemaName))
                                                          
    3
    return schemaDetails[i];
    Preondition Violations
    Unmatched statement return schemaDetails[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return schemaDetails[i];
    3
    return schemaDetails[i];
    2
    if (_colInfos[i].getName().equals(colName))
    2
    if (_colInfos[i].getName().equals(colName))
    Preondition Violations
    Unmatched statement if(_colInfos[i].getName().equals(colName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
    3
    return _colInfos[i];
    3
    return _colInfos[i];
    Preondition Violations
    Unmatched statement return _colInfos[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return _colInfos[i];
                                                  
                                  
    4
    return null;
    Preondition Violations
    Unmatched return null;
    4
    return null;
    4
    throw new IllegalArgumentException("Column " + colName + " not found");
    4
    throw new IllegalArgumentException("Column " + colName + " not found");
    Preondition Violations
    Unmatched throw new IllegalArgumentException("Column " + colName + " not found");
                                                                                                                                                        
    Precondition Violations (10)
    Row Violation
    1Type int of variable _colInfos.length does not match with type int of variable schemaDetails.length
    2Unmatched statement if(schemaDetails[i].getSchemaName().equals(schemaName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement return schemaDetails[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return schemaDetails[i];
    5Unmatched statement if(_colInfos[i].getName().equals(colName)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement return _colInfos[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched return _colInfos[i];
    8Unmatched return null;
    9Unmatched throw new IllegalArgumentException("Column " + colName + " not found");
    10The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero