if ( externalClassLoader != null ) { // classloader wants no leading slash return externalClassLoader.getResourceAsStream( path.substring(1) ); } else return Interpreter.class.getResourceAsStream( path );
if ( externalClassLoader != null ) { // classloader wants no leading slash return externalClassLoader.getResource( path.substring(1) ); } else return Interpreter.class.getResource( path );
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/BshClassManager.java File path: /jEdit-4.2/src/bsh/BshClassManager.java
Method name: InputStream getResourceAsStream(String) Method name: URL getResource(String)
Number of AST nodes: 3 Number of AST nodes: 3
1
if ( externalClassLoader != null )
1
if ( externalClassLoader != null )
2
		{
2
		{
3
			// classloader wants no leading slash
3
			// classloader wants no leading slash
4
			return externalClassLoader.getResourceAsStream( path.substring(1) );
4
			return externalClassLoader.getResource( path.substring(1) );
5
		} else
5
		} else
6
			return Interpreter.class.getResourceAsStream( path );
6
			return Interpreter.class.getResource( path );
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.2
Clones locationClones are declared in the same class
Number of node comparisons9
  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)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (externalClassLoader != null)
    1
    if (externalClassLoader != null)
                                                                                                                              
    2
    return externalClassLoader.getResource(path.substring(1));
    Preondition Violations
    Unmatched statement return externalClassLoader.getResource(path.substring(1)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return externalClassLoader.getResource(path.substring(1));
    2
    return externalClassLoader.getResource(path.substring(1));
    2
    return externalClassLoader.getResourceAsStream(path.substring(1));
    2
    return externalClassLoader.getResourceAsStream(path.substring(1));
    Preondition Violations
    Unmatched statement return externalClassLoader.getResourceAsStream(path.substring(1)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return externalClassLoader.getResourceAsStream(path.substring(1));
                                                                                                                                              
    else
            
                                                                                                
    3
    return Interpreter.class.getResource(path);
    Preondition Violations
    Unmatched return Interpreter.class.getResource(path);
    3
    return Interpreter.class.getResource(path);
    3
    return Interpreter.class.getResourceAsStream(path);
    3
    return Interpreter.class.getResourceAsStream(path);
    Preondition Violations
    Unmatched return Interpreter.class.getResourceAsStream(path);
                                                                                                                
    Precondition Violations (7)
    Row Violation
    1Unmatched statement return externalClassLoader.getResource(path.substring(1)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched return externalClassLoader.getResource(path.substring(1));
    3Unmatched statement return externalClassLoader.getResourceAsStream(path.substring(1)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return externalClassLoader.getResourceAsStream(path.substring(1));
    5Unmatched return Interpreter.class.getResource(path);
    6Unmatched return Interpreter.class.getResourceAsStream(path);
    7The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero