try { ZipFile zipFile = jar.getZipFile(); ZipEntry entry = zipFile.getEntry(name); if(entry == null) return getSystemResourceAsStream(name); else return zipFile.getInputStream(entry); } catch(IOException io) { Log.log(Log.ERROR,this,io); return null; }
try { ZipFile zipFile = jar.getZipFile(); ZipEntry entry = zipFile.getEntry(name); if(entry == null) return getSystemResource(name); else return new URL(getResourceAsPath(name)); } catch(IOException io) { Log.log(Log.ERROR,this,io); return null; }
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: InputStream getResourceAsStream(String) Method name: URL getResource(String)
Number of AST nodes: 6 Number of AST nodes: 6
1
try
1
try
2
		{
2
		{
3
			ZipFile zipFile = jar.getZipFile();
3
			ZipFile zipFile = jar.getZipFile();
4
			ZipEntry entry = zipFile.getEntry(name);
4
			ZipEntry entry = zipFile.getEntry(name);
5
			if(entry == null)
5
			if(entry == null)
6
				return getSystemResourceAsStream(name);
6
				return getSystemResource(name);
7
			else
7
			else
8
				return zipFile.getInputStream(entry);
8
				return new URL(getResourceAsPath(name));
9
		}
9
		}
10
		catch(IOException io)
10
		catch(IOException io)
11
		{
11
		{
12
			Log.log(Log.ERROR,this,io);
12
			Log.log(Log.ERROR,this,io);
13
			return null;
13
			return null;
14
		}
14
		}
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.4
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    try
    3
    try
    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 getSystemResource(name);
    Preondition Violations
    Unmatched return getSystemResource(name);
    7
    return getSystemResource(name);
    7
    return getSystemResourceAsStream(name);
    7
    return getSystemResourceAsStream(name);
    Preondition Violations
    Unmatched return getSystemResourceAsStream(name);
                                                                                        
    else
            
                                                                                          
    8
    return new URL(getResourceAsPath(name));
    Preondition Violations
    Unmatched return new URL(getResourceAsPath(name));
    8
    return new URL(getResourceAsPath(name));
    8
    return zipFile.getInputStream(entry);
    8
    return zipFile.getInputStream(entry);
    Preondition Violations
    Unmatched statement return zipFile.getInputStream(entry); cannot be moved before the extracted code, because it has control dependencies 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);
                                                                                    
    Precondition Violations (7)
    Row Violation
    1Unmatched return getSystemResource(name);
    2Unmatched return getSystemResourceAsStream(name);
    3Unmatched return new URL(getResourceAsPath(name));
    4Unmatched statement return zipFile.getInputStream(entry); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched 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
    6Unmatched return zipFile.getInputStream(entry);
    7Clone fragment #1 returns variables zipFile, entry , while Clone fragment #2 returns variables