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 | }
|
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 declared in the same class |
Number of node comparisons | 18 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.1 |
Clone type | Type 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 | | | 6 | |
| | | 7 | return getSystemResource(name); |
7 | return getSystemResourceAsStream(name); | | | |
| | | | |
| | | 8 | return new URL(getResourceAsPath(name)); |
8 | return zipFile.getInputStream(entry); | | | |
Precondition Violations (7)
Row |
Violation |
1 | Unmatched return getSystemResource(name); |
2 | Unmatched return getSystemResourceAsStream(name); |
3 | Unmatched return new URL(getResourceAsPath(name)); |
4 | Unmatched statement return zipFile.getInputStream(entry); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | 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 |
6 | Unmatched return zipFile.getInputStream(entry); |
7 | Clone fragment #1 returns variables zipFile, entry , while Clone fragment #2 returns variables |