Locale[] availableLocales = getAvailableLocales(); String[] result = new String[availableLocales.length]; for (int i = 0; i < availableLocales.length; i++) { result[i] = availableLocales[i].toString(); } return result;
JInternalFrame[] jInternalFrames = getAllFrames(); IWidget[] ret = new IWidget[jInternalFrames.length]; for (int i = 0; i < jInternalFrames.length; i++) { ret[i] = ((InternalFrameDelegate)jInternalFrames[i]).getWidget(); } return ret;
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/LocaleUtils.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/ScrollableDesktopPane.java
Method name: String[] getAvailableLocaleStrings() Method name: IWidget[] getAllWidgets()
Number of AST nodes: 5 Number of AST nodes: 5
1
Locale[] availableLocales = getAvailableLocales();
2
		String
1
JInternalFrame[] jInternalFrames = getAllFrames();
3
[] result = new String[availableLocales.length];
2
      IWidget[] ret = new IWidget[jInternalFrames.length];
4
		for (int i = 0; i < availableLocales.length; i++) {
3
      for (int i = 0; i < jInternalFrames.length; i++)
5
			result[i] = availableLocales[i].toString();
6
		}
7
		
4
      {
5
         ret[i] = ((InternalFrameDelegate)jInternalFrames[i]).getWidget();
6
      }
8
return result;
7
      return ret;
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.2
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                          
    1
    JInternalFrame[] jInternalFrames = getAllFrames();
    1
    Locale[] availableLocales = getAvailableLocales();
                                                                                                          
                                                                                                              
    2
    IWidget[] ret = new IWidget[jInternalFrames.length];
    2
    String[] result = new String[availableLocales.length];
                                                                                                                  
    3
    for (int i = 0; i < availableLocales.length; i++)
    3
    for (int i = 0; i < availableLocales.length; i++)
    3
    for (int i = 0; i < jInternalFrames.length; i++)
    Differences
    Expression1Expression2Difference
    availableLocalesjInternalFramesVARIABLE_NAME_MISMATCH
    java.util.Locale[]javax.swing.JInternalFrame[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable availableLocales.length does not match with type int of variable jInternalFrames.length
    • Make classes java.util.Locale[] and javax.swing.JInternalFrame[] extend a common superclass
    3
    for (int i = 0; i < jInternalFrames.length; i++)
                                                                                                                                        
    4
    ret[i] = ((InternalFrameDelegate)jInternalFrames[i]).getWidget();
    Preondition Violations
    Unmatched statement ret[i]=((InternalFrameDelegate)jInternalFrames[i]).getWidget(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    ret[i] = ((InternalFrameDelegate)jInternalFrames[i]).getWidget();
    4
    result[i] = availableLocales[i].toString();
    4
    result[i] = availableLocales[i].toString();
    Preondition Violations
    Unmatched statement result[i]=availableLocales[i].toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
                                
    5
    return ret;
    Preondition Violations
    Unmatched return ret;
    5
    return ret;
    5
    return result;
    5
    return result;
    Preondition Violations
    Unmatched return result;
                                      
    Precondition Violations (6)
    Row Violation
    1Type int of variable availableLocales.length does not match with type int of variable jInternalFrames.length
    2Unmatched statement ret[i]=((InternalFrameDelegate)jInternalFrames[i]).getWidget(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement result[i]=availableLocales[i].toString(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return ret;
    5Unmatched return result;
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero