final TreePath selPath = evt.getNewLeadSelectionPath(); if (selPath != null) { StringBuffer buf = new StringBuffer(); Object[] fullPath = selPath.getPath(); for (int i = 0; i < fullPath.length; ++i) { if (fullPath[i] instanceof ObjectTreeNode) { ObjectTreeNode node = (ObjectTreeNode)fullPath[i]; buf.append('/').append(node.toString()); } } setStatusBarMessage(buf.toString()); }
final TreePath selPath = evt.getNewLeadSelectionPath(); if (selPath != null) { StringBuffer buf = new StringBuffer(); Object[] fullPath = selPath.getPath(); for (int i = 0; i < fullPath.length; ++i) { if (fullPath[i] instanceof ObjectTreeNode) { ObjectTreeNode node = (ObjectTreeNode)fullPath[i]; buf.append('/').append(node.toString()); } } //JASON: have a main application status bar setStatusBarMessage(buf.toString()); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/session/SessionPanel.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/session/ObjectTreeInternalFrame.java
Method name: void valueChanged(TreeSelectionEvent) Method name: void valueChanged(TreeSelectionEvent)
Number of AST nodes: 9 Number of AST nodes: 8
1
final TreePath selPath = evt.getNewLeadSelectionPath();
1
final TreePath selPath = evt.getNewLeadSelectionPath();
2
			if (selPath != null)
2
         if (selPath != null)
3
			{
4
				
3
         {
5
StringBuffer buf = new StringBuffer();
4
            StringBuffer buf = new StringBuffer();
6
				Object[] fullPath = selPath.getPath();
5
            Object[] fullPath = selPath.getPath();
7
				for (int i = 0; i < fullPath.length; ++i)
6
            for (int i = 0; i < fullPath.length; ++i)
8
				{
9
					
7
            {
10
if (fullPath[i] instanceof ObjectTreeNode)
8
               if (fullPath[i] instanceof ObjectTreeNode)
11
					{
12
						
9
               {
13
ObjectTreeNode node = (ObjectTreeNode)fullPath[i];
10
                  ObjectTreeNode node = (ObjectTreeNode)fullPath[i];
14
						buf.append('/').append(node.toString());
11
                  buf.append('/').append(node.toString());
15
					}
16
				}
17
				
12
               }
13
            }
18
setStatusBarMessage(buf.toString());
14
            //JASON: have a main application status bar setStatusBarMessage(buf.toString());
19
			}
15
         }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are in different classes
Number of node comparisons23
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    final TreePath selPath = evt.getNewLeadSelectionPath();
    1
    final TreePath selPath = evt.getNewLeadSelectionPath();
    2
    if (selPath != null)
    2
    if (selPath != null)
    3
    StringBuffer buf = new StringBuffer();
    3
    StringBuffer buf = new StringBuffer();
    4
    Object[] fullPath = selPath.getPath();
    4
    Object[] fullPath = selPath.getPath();
    5
    for (int i = 0; i < fullPath.length; ++i)
    5
    for (int i = 0; i < fullPath.length; ++i)
    6
    if (fullPath[i] instanceof ObjectTreeNode)
    6
    if (fullPath[i] instanceof ObjectTreeNode)
    7
    ObjectTreeNode node = (ObjectTreeNode)fullPath[i];
    7
    ObjectTreeNode node = (ObjectTreeNode)fullPath[i];
    8
    buf.append('/').append(node.toString());
    8
    buf.append('/').append(node.toString());
    9
    setStatusBarMessage(buf.toString());
    9
    setStatusBarMessage(buf.toString());
    Preondition Violations
    Unmatched statement setStatusBarMessage(buf.toString()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement setStatusBarMessage(buf.toString()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                  
    Precondition Violations (2)
    Row Violation
    1Unmatched statement setStatusBarMessage(buf.toString()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement setStatusBarMessage(buf.toString()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted