try { dialect.getAddPrimaryKeySQL(pkName, colInfos, ti, qualifier, prefs); failDialect(dialect, "adding a primary key"); } catch (Exception e) { // This is expected System.err.println(e.getMessage()); }
try { dialect.getAddUniqueConstraintSQL(tableName, uniqueConstraintName, columns, qualifier, prefs); failDialect(dialect, "for adding a unique constraint"); } catch (Exception e) { // this is expected System.err.println(e.getMessage()); }
Clone fragments detected by clone detection tool
File path: /sql12/test/external/net/sourceforge/squirrel_sql/fw/dialects/DialectExternalTest.java File path: /sql12/test/external/net/sourceforge/squirrel_sql/fw/dialects/DialectExternalTest.java
Method name: void testAddPrimaryKey(ISession, TableColumnInfo[]) Method name: void testAddUniqueConstraint(ISession)
Number of AST nodes: 3 Number of AST nodes: 3
1
try {
1
try {
2
      		dialect.getAddPrimaryKeySQL(pkName, colInfos, ti, 
2
   			dialect.getAddUniqueConstraintSQL(tableName,
3
   				uniqueConstraintName,
4
					columns,
3
qualifier, 
5
					qualifier,
4
prefs);
6
					prefs);
5
      		failDialect(dialect, "adding a primary key");
7
   			failDialect(dialect, "for adding a unique constraint");
6
   		} catch (Exception e) {
8
   		} catch (Exception e) {
7
   			// This is expected
9
   			// this is expected
8
   			System.err.println(e.getMessage());
10
   			System.err.println(e.getMessage());
9
   		}
11
   		}
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.7
Clones locationClones are declared in the same class
Number of node comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    25
    try
    14
    try
                                                                                                                                                                                                
    15
    dialect.getAddUniqueConstraintSQL(tableName, uniqueConstraintName, columns, qualifier, prefs);
    Preondition Violations
    Unmatched statement dialect.getAddUniqueConstraintSQL(tableName,uniqueConstraintName,columns,qualifier,prefs); 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
    15
    dialect.getAddUniqueConstraintSQL(tableName, uniqueConstraintName, columns, qualifier, prefs);
    26
    dialect.getAddPrimaryKeySQL(pkName, colInfos, ti, qualifier, prefs);
    26
    dialect.getAddPrimaryKeySQL(pkName, colInfos, ti, qualifier, prefs);
    Preondition Violations
    Unmatched statement dialect.getAddPrimaryKeySQL(pkName,colInfos,ti,qualifier,prefs); 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
                                                                                                                                            
    27
    failDialect(dialect, "adding a primary key");
    27
    failDialect(dialect, "adding a primary key");
    16
    failDialect(dialect, "for adding a unique constraint");
    Differences
    Expression1Expression2Difference
    "adding a primary key""for adding a unique constraint"LITERAL_VALUE_MISMATCH
    16
    failDialect(dialect, "for adding a unique constraint");
    Precondition Violations (2)
    Row Violation
    1Unmatched statement dialect.getAddUniqueConstraintSQL(tableName,uniqueConstraintName,columns,qualifier,prefs); 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
    2Unmatched statement dialect.getAddPrimaryKeySQL(pkName,colInfos,ti,qualifier,prefs); 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