String myText = null; if (text != null) { myText = text.trim(); } if (myText != null && myText.length() > 0) { _textLbl.setText(myText); } else { clearText(); }
final boolean wasEmpty = _textLbl.getText().equals(_msgWhenEmpty); if (value != null && value.length() > 0) { _msgWhenEmpty = value; } else { _msgWhenEmpty = " "; } if (wasEmpty) { clearText(); }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/gui/StatusBar.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/gui/StatusBar.java
Method name: void setText(String) Method name: void setTextWhenEmpty(String)
Number of AST nodes: 6 Number of AST nodes: 6
1
String myText = null;
2
		if (text != null)
3
		{
4
			myText = text.trim();
5
		}
6
		if (myText
1
final boolean wasEmpty = _textLbl.getText().equals(_msgWhenEmpty);
7
 != null && myText.length() > 0)
2
		if (value != null && value.length() > 0)
8
		{
3
		{
9
			_textLbl.setText(myText);
4
			_
10
		}
11
		else
5
msgWhenEmpty = value;
6
		}
7
		else
8
		{
9
			_msgWhenEmpty = " ";
10
		}
11
		if (wasEmpty)
12
		{
12
		{
13
			clearText();
13
			clearText();
14
		}
14
		}
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 declared in the same class
Number of node comparisons13
  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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                          
    1
    final boolean wasEmpty = _textLbl.getText().equals(_msgWhenEmpty);
    1
    String myText = null;
                                                
    4
    if (myText != null && myText.length() > 0)
    4
    if (myText != null && myText.length() > 0)
    2
    if (value != null && value.length() > 0)
    Differences
    Expression1Expression2Difference
    myTextvalueVARIABLE_NAME_MISMATCH
    myTextvalueVARIABLE_NAME_MISMATCH
    2
    if (value != null && value.length() > 0)
                                                  
    3
    _msgWhenEmpty = value;
    Preondition Violations
    Unmatched statement _msgWhenEmpty=value; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    _msgWhenEmpty = value;
    5
    _textLbl.setText(myText);
    5
    _textLbl.setText(myText);
    Preondition Violations
    Unmatched statement _textLbl.setText(myText); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                            
    else
            
                                              
    4
    _msgWhenEmpty = " ";
    Preondition Violations
    Unmatched statement _msgWhenEmpty=" "; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    _msgWhenEmpty = " ";
    6
    clearText();
                                  
    Precondition Violations (4)
    Row Violation
    1Unmatched statement _msgWhenEmpty=value; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement _textLbl.setText(myText); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement _msgWhenEmpty=" "; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero