log.info( "configuring from url: " + url.toString() ); try { return doConfigure( url.openStream(), url.toString() ); } catch (IOException ioe) { throw new HibernateException( "could not configure from URL: " + url, ioe ); }
log.info( "configuring from file: " + configFile.getName() ); try { return doConfigure( new FileInputStream( configFile ), configFile.toString() ); } catch (FileNotFoundException fnfe) { throw new HibernateException( "could not find file: " + configFile, fnfe ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java
Method name: Configuration configure(URL) Method name: Configuration configure(File)
Number of AST nodes: 3 Number of AST nodes: 3
1
log.info( "configuring from url: " + url.toString() );
1
log.info( "configuring from file: " + configFile.getName() );
2
		try {
2
		try {
3
			return doConfigure( url.openStream(), url.toString() );
3
			return doConfigure( new FileInputStream( configFile ), configFile.toString() );
4
		}
4
		}
5
		catch (IOException ioe) {
5
		catch (FileNotFoundException fnfe) {
6
			throw new HibernateException( "could not configure from URL: " + url, ioe );
6
			throw new HibernateException( "could not find file: " + configFile, fnfe );
7
		}
7
		}
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.3
Clones locationClones are declared in the same class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                
    1
    log.info("configuring from file: " + configFile.getName());
    1
    log.info("configuring from url: " + url.toString());
                                                                                                                  
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.io.IOExceptionjava.io.FileNotFoundExceptionSUBCLASS_TYPE_MISMATCH
    ioefnfeVARIABLE_NAME_MISMATCH
    java.io.IOExceptionjava.io.FileNotFoundExceptionSUBCLASS_TYPE_MISMATCH
    "could not configure from URL: ""could not find file: "LITERAL_VALUE_MISMATCH
    urlconfigFileVARIABLE_NAME_MISMATCH
    java.net.URLjava.io.FileVARIABLE_TYPE_MISMATCH
    ioefnfeVARIABLE_NAME_MISMATCH
    java.io.IOExceptionjava.io.FileNotFoundExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type java.net.URL of variable url does not match with type java.io.File of variable configFile
    • Make classes java.net.URL and java.io.File extend a common superclass
    2
    try
                                                                                                                                                              
    3
    return doConfigure(new FileInputStream(configFile), configFile.toString());
    Preondition Violations
    Unmatched statement return doConfigure(new FileInputStream(configFile),configFile.toString()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement return doConfigure(new FileInputStream(configFile),configFile.toString()); 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
    Unmatched return doConfigure(new FileInputStream(configFile),configFile.toString());
    3
    return doConfigure(new FileInputStream(configFile), configFile.toString());
    3
    return doConfigure(url.openStream(), url.toString());
    3
    return doConfigure(url.openStream(), url.toString());
    Preondition Violations
    Unmatched statement return doConfigure(url.openStream(),url.toString()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement return doConfigure(url.openStream(),url.toString()); 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
    Unmatched return doConfigure(url.openStream(),url.toString());
                                                                                                                  
    Precondition Violations (7)
    Row Violation
    1Type java.net.URL of variable url does not match with type java.io.File of variable configFile
    2Unmatched statement return doConfigure(new FileInputStream(configFile),configFile.toString()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement return doConfigure(new FileInputStream(configFile),configFile.toString()); 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
    4Unmatched return doConfigure(new FileInputStream(configFile),configFile.toString());
    5Unmatched statement return doConfigure(url.openStream(),url.toString()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement return doConfigure(url.openStream(),url.toString()); 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
    7Unmatched return doConfigure(url.openStream(),url.toString());