final String key = "getDatabaseProductVersion";
String value = (String)_cache.get(key);
if (value == null)
{
value = privateGetJDBCMetaData().getDatabaseProductVersion();
_cache.put(key, value);
}
return value;
final String key = "getUserName";
String value = (String)_cache.get(key);
if (value == null)
{
value = privateGetJDBCMetaData().getUserName();
_cache.put(key, value);
}
return value;
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/sql/SQLDatabaseMetaData.java
|
|
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/sql/SQLDatabaseMetaData.java
|
Method name: String getDatabaseProductVersion()
|
|
Method name: String getUserName()
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | final String key = "getDatabaseProductVersion";↵ | | 1 | final String key = "getUserName";↵
|
2 | String value = (String)_cache.get(key);↵ | | 2 | String value = (String)_cache.get(key);↵
|
3 | if (value == null)↵ | | 3 | if (value == null)↵
|
4 | {↵ | | 4 | {↵
|
5 | value = privateGetJDBCMetaData().getDatabaseProductVersion();↵ | | 5 | value = privateGetJDBCMetaData().getUserName();↵
|
6 | _cache.put(key, value);↵ | | 6 | _cache.put(key, value);↵
|
7 | }↵ | | 7 | }↵
|
8 | return value; | | 8 | return value;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 18 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 15.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | final String key = "getDatabaseProductVersion"; | | 1 | final String key = "getUserName"; |
2 | String value = (String)_cache.get(key); | | 2 | String value = (String)_cache.get(key); |
3 | if (value == null) | | 3 | if (value == null) |
4 | value = privateGetJDBCMetaData().getDatabaseProductVersion(); | | 4 | value = privateGetJDBCMetaData().getUserName(); |
5 | | | 5 | |
6 | return value; | | 6 | return value; |
Precondition Violations (2)
Row |
Violation |
1 | Expression privateGetJDBCMetaData().getDatabaseProductVersion() is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression privateGetJDBCMetaData().getUserName() is a method call throwing exception(s) that should be caught by a try block that will be extracted |