ZipFile zipFile = jar.getZipFile(); ZipEntry entry = zipFile.getEntry(name); if(entry == null) return getSystemResource(name); else return new URL(getResourceAsPath(name));
ZipFile zipFile = jar.getZipFile(); ZipEntry entry = zipFile.getEntry(name); if(entry == null) return getSystemResourceAsStream(name); else return zipFile.getInputStream(entry);
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/JARClassLoader.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/JARClassLoader.java
Method name: URL getResource(String) Method name: InputStream getResourceAsStream(String)
Number of AST nodes: 5 Number of AST nodes: 5
1
ZipFile zipFile = jar.getZipFile();
1
ZipFile zipFile = jar.getZipFile();
2
			ZipEntry entry = zipFile.getEntry(name);
2
			ZipEntry entry = zipFile.getEntry(name);
3
			if(entry == null)
3
			if(entry == null)
4
				return getSystemResource(name);
4
				return getSystemResourceAsStream(name);
5
			else
5
			else
6
				return new URL(getResourceAsPath(name));
6
				return zipFile.getInputStream(entry);
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.8
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    ZipFile zipFile = jar.getZipFile();
    4
    ZipFile zipFile = jar.getZipFile();
    5
    ZipEntry entry = zipFile.getEntry(name);
    5
    ZipEntry entry = zipFile.getEntry(name);
    6
    if (entry == null)
    6
    if (entry == null)
                                                                                        
    7
    return getSystemResourceAsStream(name);
    Preondition Violations
    Unmatched statement return getSystemResourceAsStream(name); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return getSystemResourceAsStream(name);
    7
    return getSystemResourceAsStream(name);
    7
    return getSystemResource(name);
    7
    return getSystemResource(name);
    Preondition Violations
    Unmatched statement return getSystemResource(name); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return getSystemResource(name);
                                                                        
    else
            
                                                                                    
    8
    return zipFile.getInputStream(entry);
    Preondition Violations
    Unmatched statement return zipFile.getInputStream(entry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement return zipFile.getInputStream(entry); 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 zipFile.getInputStream(entry);
    8
    return zipFile.getInputStream(entry);
    8
    return new URL(getResourceAsPath(name));
    8
    return new URL(getResourceAsPath(name));
    Preondition Violations
    Unmatched statement return new URL(getResourceAsPath(name)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement return new URL(getResourceAsPath(name)); 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 new URL(getResourceAsPath(name));
                                                                                          
    Precondition Violations (11)
    Row Violation
    1Unmatched statement return getSystemResourceAsStream(name); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched return getSystemResourceAsStream(name);
    3Unmatched statement return getSystemResource(name); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return getSystemResource(name);
    5Unmatched statement return zipFile.getInputStream(entry); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement return zipFile.getInputStream(entry); 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 zipFile.getInputStream(entry);
    8Unmatched statement return new URL(getResourceAsPath(name)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9Unmatched statement return new URL(getResourceAsPath(name)); 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
    10Unmatched return new URL(getResourceAsPath(name));
    11Clone fragment #1 returns variables , while Clone fragment #2 returns variables zipFile, entry