written += 12;
// file name length
byte[] name = getBytes(ze.getName());
writeOut(ZipShort.getBytes(name.length));
written += 2;
// extra field length
byte[] extra = ze.getCentralDirectoryExtra();
writeOut(ZipShort.getBytes(extra.length));
written += 2;
written += 12;
// file name length
byte[] name = getBytes(ze.getName());
writeOut(ZipShort.getBytes(name.length));
written += 2;
// extra field length
byte[] extra = ze.getLocalFileDataExtra();
writeOut(ZipShort.getBytes(extra.length));
written += 2;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/zip/ZipOutputStream.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/zip/ZipOutputStream.java
|
Method name: void writeCentralFileHeader(ZipEntry)
|
|
Method name: void writeLocalFileHeader(ZipEntry)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | written += 12;↵ | | 1 | written += 12;↵
|
|
2 | // file name length↵ | | 2 | // file name length↵
|
3 | byte[] name = getBytes(ze.getName());↵ | | 3 | byte[] name = getBytes(ze.getName());↵
|
4 | writeOut(ZipShort.getBytes(name.length));↵ | | 4 | writeOut(ZipShort.getBytes(name.length));↵
|
5 | written += 2;↵ | | 5 | written += 2;↵
|
|
6 | // extra field length↵ | | 6 | // extra field length↵
|
7 | byte[] extra = ze.getCentralDirectoryExtra();↵ | | 7 | byte[] extra = ze.getLocalFileDataExtra();↵
|
8 | writeOut(ZipShort.getBytes(extra.length));↵ | | 8 | writeOut(ZipShort.getBytes(extra.length));↵
|
9 | written += 2; | | 9 | written += 2;
|
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 25 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
18 | written += 12; | | 23 | written += 12; |
19 | byte[] name = getBytes(ze.getName()); | | 24 | byte[] name = getBytes(ze.getName()); |
20 | writeOut(ZipShort.getBytes(name.length)); | | 25 | writeOut(ZipShort.getBytes(name.length)); |
21 | written += 2; | | 26 | written += 2; |
22 | byte[] extra = ze.getCentralDirectoryExtra(); | | 27 | byte[] extra = ze.getLocalFileDataExtra(); |
23 | writeOut(ZipShort.getBytes(extra.length)); | | 28 | writeOut(ZipShort.getBytes(extra.length)); |
24 | written += 2; | | 29 | written += 2; |
Precondition Violations (1)
Row |
Violation |
1 | Clone fragment #1 returns variables name, extra , while Clone fragment #2 returns variables name, extra |