if (isInputOK()) { Statement stmt = null; try { String sql = "Create ROLE " + jtextfieldRolename.getText().trim(); stmt = session.getSQLConnection().createStatement(); stmt.execute(sql); readRoles(); return true; } catch (Exception e) { JOptionPane.showMessageDialog(null, i18n.ERROR_SAVE_ROLE); log.error(i18n.ERROR_SAVE_ROLE + CR + e.getLocalizedMessage()); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { log.error(i18n.ERROR_GLOBAL_CLOSE_STATEMENT + CR + e.getLocalizedMessage()); } } } }
Statement stmt = null; try { String sql = "Drop ROLE " + jtextfieldRolename.getText().trim(); stmt = session.getSQLConnection().createStatement(); stmt.execute(sql); readRoles(); } catch (Exception e) { JOptionPane.showMessageDialog(null, i18n.ERROR_DELETE_ROLE); log.error(i18n.ERROR_DELETE_ROLE + CR + e.getLocalizedMessage()); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { log.error(i18n.ERROR_GLOBAL_CLOSE_STATEMENT + CR + e.getLocalizedMessage()); } } }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/firebirdmanager/src/net/sourceforge/squirrel_sql/plugins/firebirdmanager/gui/FirebirdManagerRoleFrame.java File path: /sql12/plugins/firebirdmanager/src/net/sourceforge/squirrel_sql/plugins/firebirdmanager/gui/FirebirdManagerRoleFrame.java
Method name: boolean saveData() Method name: void deleteRole()
Number of AST nodes: 8 Number of AST nodes: 6
1
if (isInputOK()) {
2
			Statement stmt = null;
1
Statement stmt = null;
3
			try {
2
			try {
4
				String sql = "Create ROLE " + jtextfieldRolename.getText().trim();
3
				String sql = "Drop ROLE " + jtextfieldRolename.getText().trim();
5
				stmt = session.getSQLConnection().createStatement();
4
				stmt = session.getSQLConnection().createStatement();
6
				stmt.execute(sql);
5
				stmt.execute(sql);
7
				readRoles();
6
				readRoles();
8
				return true;
7
			
9
			} catch (Exception e) {
8
} catch (Exception e) {
10
				JOptionPane.showMessageDialog(null, i18n.ERROR_SAVE_ROLE);
9
				JOptionPane.showMessageDialog(null, i18n.ERROR_DELETE_ROLE);
11
				log.error(i18n.ERROR_SAVE_ROLE + CR + e.getLocalizedMessage());
10
				log.error(i18n.ERROR_DELETE_ROLE + CR + e.getLocalizedMessage());
12
			} finally {
11
			} finally {
13
				if (stmt != null) {
12
				if (stmt != null) {
14
					try {
13
					try {
15
						stmt.close();
14
						stmt.close();
16
					} catch (SQLException e) {
15
					} catch (SQLException e) {
17
						log.error(i18n.ERROR_GLOBAL_CLOSE_STATEMENT + CR + e.getLocalizedMessage());
16
						log.error(i18n.ERROR_GLOBAL_CLOSE_STATEMENT + CR + e.getLocalizedMessage());
18
					}
17
					}
19
				}
18
				}
20
			}
19
			}
21
		}
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)1.8
Clones locationClones are declared in the same class
Number of node comparisons32
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    Statement stmt = null;
    3
    Statement stmt = null;
    3
    try
    3
    try
    4
    try
    Differences
    Expression1Expression2Difference
    ERROR_SAVE_ROLEERROR_DELETE_ROLEVARIABLE_NAME_MISMATCH
    ERROR_SAVE_ROLEERROR_DELETE_ROLEVARIABLE_NAME_MISMATCH
    4
    try
    4
    String sql = "Create ROLE " + jtextfieldRolename.getText().trim();
    4
    String sql = "Create ROLE " + jtextfieldRolename.getText().trim();
    5
    String sql = "Drop ROLE " + jtextfieldRolename.getText().trim();
    Differences
    Expression1Expression2Difference
    "Create ROLE ""Drop ROLE "LITERAL_VALUE_MISMATCH
    5
    String sql = "Drop ROLE " + jtextfieldRolename.getText().trim();
    5
    stmt = session.getSQLConnection().createStatement();
    6
    stmt = session.getSQLConnection().createStatement();
    6
    stmt.execute(sql);
    7
    stmt.execute(sql);
    7
    readRoles();
    8
    readRoles();
    8
    return true;
    8
    return true;
    Preondition Violations
    Unmatched return true;
                                  
    Precondition Violations (1)
    Row Violation
    1Unmatched return true;