byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int bytesRead; InputStream is; JarEntry je = (JarEntry) e.nextElement(); if (je.getCompressedSize() == -1 || je.getCompressedSize() == je.getSize()) { newJarStream.setLevel(0); } else { newJarStream.setLevel(JAR_COMPRESS_LEVEL); } // Update with changed Bean class if (replaceEntries.containsKey(je.getName())) { log("Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE); // Use the entry from the generic jar je = (JarEntry) replaceEntries.get(je.getName()); is = genericJar.getInputStream(je); } else { //use fle from original weblogic jar is = wlJar.getInputStream(je); } newJarStream.putNextEntry(new JarEntry(je.getName())); while ((bytesRead = is.read(buffer)) != -1) { newJarStream.write(buffer, 0, bytesRead); } is.close();
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int bytesRead; InputStream is; JarEntry je = (JarEntry) e.nextElement(); if (je.getCompressedSize() == -1 || je.getCompressedSize() == je.getSize()) { newJarStream.setLevel(0); } else { newJarStream.setLevel(JAR_COMPRESS_LEVEL); } // Update with changed Bean class if (replaceEntries.containsKey(je.getName())) { log("Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE); // Use the entry from the generic jar je = (JarEntry) replaceEntries.get(je.getName()); is = genericJar.getInputStream(je); } else { //use fle from original websphere jar is = wasJar.getInputStream(je); } newJarStream.putNextEntry(new JarEntry(je.getName())); while ((bytesRead = is.read(buffer)) != -1) { newJarStream.write(buffer, 0, bytesRead); } is.close();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java
Method name: boolean isRebuildRequired(File, File) Method name: boolean isRebuildRequired(File, File)
Number of AST nodes: 16 Number of AST nodes: 16
1
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
1
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
2
                        int bytesRead;
2
                        int bytesRead;
3
                        InputStream is;
3
                        InputStream is;
4
                        JarEntry je = (JarEntry) e.nextElement();
4
                        JarEntry je = (JarEntry) e.nextElement();
5
                        if (je.getCompressedSize() == -1
5
                        if (je.getCompressedSize() == -1
6
                            || je.getCompressedSize() == je.getSize()) {
6
                            || je.getCompressedSize() == je.getSize()) {
7
                            newJarStream.setLevel(0);
7
                            newJarStream.setLevel(0);
8
                        } else {
8
                        } else {
9
                            newJarStream.setLevel(JAR_COMPRESS_LEVEL);
9
                            newJarStream.setLevel(JAR_COMPRESS_LEVEL);
10
                        }
10
                        }
11
                        // Update with changed Bean class
11
                        // Update with changed Bean class
12
                        if (replaceEntries.containsKey(je.getName())) {
12
                        if (replaceEntries.containsKey(je.getName())) {
13
                            log("Updating Bean class from generic Jar "
13
                            log("Updating Bean class from generic Jar " + je.getName(),
14
                                + je.getName(), Project.MSG_VERBOSE);
14
                                Project.MSG_VERBOSE);
15
                            // Use the entry from the generic jar
15
                            // Use the entry from the generic jar
16
                            je = (JarEntry) replaceEntries.get(je.getName());
16
                            je = (JarEntry) replaceEntries.get(je.getName());
17
                            is = genericJar.getInputStream(je);
17
                            is = genericJar.getInputStream(je);
18
                        } else {
18
                        } else {
19
                            //use fle from original weblogic jar
19
                            //use fle from original websphere jar
20
                            is = wlJar.getInputStream(je);
20
                            is = wasJar.getInputStream(je);
21
                        }
21
                        }
22
                        newJarStream.putNextEntry(new JarEntry(je.getName()));
22
                        newJarStream.putNextEntry(new JarEntry(je.getName()));
23
                        while ((bytesRead = is.read(buffer)) != -1) {
23
                        while ((bytesRead = is.read(buffer)) != -1) {
24
                            newJarStream.write(buffer, 0, bytesRead);
24
                            newJarStream.write(buffer, 0, bytesRead);
25
                        }
25
                        }
26
                        is.close();
26
                        is.close();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.7
Clones locationClones are in different classes having the same super class
Number of node comparisons112
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)14.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    52
    byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
    51
    byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
    53
    int bytesRead;
    52
    int bytesRead;
    54
    InputStream is;
    53
    InputStream is;
    55
    JarEntry je = (JarEntry)e.nextElement();
    54
    JarEntry je = (JarEntry)e.nextElement();
    56
    if (je.getCompressedSize() == -1 || je.getCompressedSize() == je.getSize())
    55
    if (je.getCompressedSize() == -1 || je.getCompressedSize() == je.getSize())
    57
    newJarStream.setLevel(0);
    56
    newJarStream.setLevel(0);
    else
    else
    58
    newJarStream.setLevel(JAR_COMPRESS_LEVEL);
    57
    newJarStream.setLevel(JAR_COMPRESS_LEVEL);
    59
    if (replaceEntries.containsKey(je.getName()))
    58
    if (replaceEntries.containsKey(je.getName()))
    60
    log("Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE);
    59
    log("Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE);
    61
    je = (JarEntry)replaceEntries.get(je.getName());
    60
    je = (JarEntry)replaceEntries.get(je.getName());
    62
    is = genericJar.getInputStream(je);
    61
    is = genericJar.getInputStream(je);
    else
    else
    63
    is = wlJar.getInputStream(je);
    63
    is = wlJar.getInputStream(je);
    62
    is = wasJar.getInputStream(je);
    Differences
    Expression1Expression2Difference
    wlJarwasJarVARIABLE_NAME_MISMATCH
    62
    is = wasJar.getInputStream(je);
    64
    newJarStream.putNextEntry(new JarEntry(je.getName()));
    63
    newJarStream.putNextEntry(new JarEntry(je.getName()));
    65
    while ((bytesRead = is.read(buffer)) != -1)
    64
    while ((bytesRead = is.read(buffer)) != -1)
    66
    newJarStream.write(buffer, 0, bytesRead);
    65
    newJarStream.write(buffer, 0, bytesRead);
    67
    is.close();
    66
    is.close();
    Precondition Violations (0)
    Row Violation