while ( iter.hasNext() ) {
String prop = (String) iter.next();
if ( prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop) ) {
result.setProperty(
prop.substring( Environment.JNDI_PREFIX.length()+1 ),
properties.getProperty(prop)
);
}
}
while ( iter.hasNext() ) {
String prop = (String) iter.next();
if ( prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop) ) {
result.setProperty(
prop.substring( Environment.CONNECTION_PREFIX.length()+1 ),
properties.getProperty(prop)
);
}
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/NamingHelper.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/connection/ConnectionProviderFactory.java
|
Method name: Properties getJndiProperties(Properties)
|
|
Method name: Properties getConnectionProperties(Properties)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | while ( iter.hasNext() ) {↵ | | 1 | while ( iter.hasNext() ) {↵
|
2 | String prop = (String) iter.next();↵ | | 2 | String prop = (String) iter.next();↵
|
3 | if ( prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop) ) {↵ | | 3 | if ( prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop) ) {↵
|
4 | result.setProperty(↵ | | 4 | result.setProperty(↵
|
5 | prop.substring( Environment.JNDI_PREFIX.length()+1 ),↵ | | 5 | prop.substring( Environment.CONNECTION_PREFIX.length()+1 ),↵
|
6 | properties.getProperty(prop)↵ | | 6 | properties.getProperty(prop)↵
|
7 | );↵ | | 7 | );↵
|
8 | }↵ | | 8 | }↵
|
9 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes |
Number of node comparisons | 8 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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) | 0.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
6 | while (iter.hasNext()) | | 3 | while (iter.hasNext()) |
7 | String prop = (String)iter.next(); | | 4 | String prop = (String)iter.next(); |
8 | if (prop.indexOf(Environment.JNDI_PREFIX) > -1 && !specialProps.contains(prop)) | | 5 | if (prop.indexOf(Environment.CONNECTION_PREFIX) > -1 && !SPECIAL_PROPERTIES.contains(prop)) |
9 | result.setProperty(prop.substring(Environment.JNDI_PREFIX.length() + 1), properties.getProperty(prop)); | | 6 | result.setProperty(prop.substring(Environment.CONNECTION_PREFIX.length() + 1), properties.getProperty(prop)); |
Precondition Violations (1)
Row |
Violation |
1 | Type java.util.HashSet of variable specialProps does not match with type java.util.Set of variable SPECIAL_PROPERTIES |