if (identifier == null || identifier.equals("")) { return identifier; } try { DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData(); // Don't change the case of the identifier if database allows mixed // case. if (md.storesMixedCaseIdentifiers()) { return identifier; } // Fix the case according to what the database tells us. if (md.storesUpperCaseIdentifiers()) { return identifier.toUpperCase(); } else { return identifier.toLowerCase(); } } catch (SQLException e) { if (log.isDebugEnabled()) { log.debug("fixCase: unexpected exception: " + e.getMessage()); } return identifier; }
if (identifier == null || identifier.equals("")) { return identifier; } try { DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData(); // Don't change the case of the identifier if database allows mixed // case. if (md.storesMixedCaseIdentifiers()) { return identifier; } // Fix the case according to what the database tells us. if (md.storesUpperCaseIdentifiers()) { return identifier.toUpperCase(); } else { return identifier.toLowerCase(); } } catch (SQLException e) { if (log.isDebugEnabled()) { log.debug("fixCase: unexpected exception: " + e.getMessage()); } return identifier; }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil.java File path: /sql12/plugins/dbdiff/src/net/sourceforge/squirrel_sql/plugins/dbdiff/util/DBUtil.java
Method name: String fixCase(ISession, String) Method name: String fixCase(ISession, String)
Number of AST nodes: 9 Number of AST nodes: 9
1
if (identifier == null || identifier.equals(""))
1
if (identifier == null || identifier.equals(""))
2
		{
3
			return identifier;
2
 { return identifier;
4
		}
3
 }
5
		try
4
		try
6
		{
5
		{
7
			DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();
6
			DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();
8
			// Don't change the case of the identifier if database allows mixed
7
			// Don't change the case of the identifier if database allows mixed
9
			// case.
8
			// case.
10
			if (md.storesMixedCaseIdentifiers())
9
			if (md.storesMixedCaseIdentifiers())
11
			{
12
				return identifier;
10
 { return identifier;
13
			}
11
 }
14
			// Fix the case according to what the database tells us.
12
			// Fix the case according to what the database tells us.
15
			if (md.storesUpperCaseIdentifiers())
13
			if (md.storesUpperCaseIdentifiers())
16
			{
14
			{
17
				return identifier.toUpperCase();
15
				return identifier.toUpperCase();
18
			} 
16
			}
19
else
17
			else
20
			{
18
			{
21
				return identifier.toLowerCase();
19
				return identifier.toLowerCase();
22
			}
20
			}
23
		} 
21
		}
24
catch (SQLException e)
22
		catch (SQLException e)
25
		{
23
		{
26
			if (log.isDebugEnabled())
24
			if (log.isDebugEnabled())
27
			{
25
			{
28
				log.debug("fixCase: unexpected exception: " + e.getMessage());
26
				log.debug("fixCase: unexpected exception: " + e.getMessage());
29
			}
27
			}
30
			return identifier;
28
			return identifier;
31
		}
29
		}
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)1.1
Clones locationClones are in different classes
Number of node comparisons23
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (identifier == null || identifier.equals(""))
    1
    if (identifier == null || identifier.equals(""))
    2
    return identifier;
    2
    return identifier;
    3
    try
    3
    try
    4
    DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();
    4
    DatabaseMetaData md = session.getSQLConnection().getConnection().getMetaData();
    5
    if (md.storesMixedCaseIdentifiers())
    5
    if (md.storesMixedCaseIdentifiers())
    6
    return identifier;
    6
    return identifier;
    7
    if (md.storesUpperCaseIdentifiers())
    7
    if (md.storesUpperCaseIdentifiers())
    8
    return identifier.toUpperCase();
    8
    return identifier.toUpperCase();
    else
    else
    9
    return identifier.toLowerCase();
    9
    return identifier.toLowerCase();
    Precondition Violations (0)
    Row Violation