log("No rebuild needed - updating jar", Project.MSG_VERBOSE); newwasJarFile = new File(websphereJarFile.getAbsolutePath() + ".temp"); if (newwasJarFile.exists()) { newwasJarFile.delete(); } newJarStream = new JarOutputStream(new FileOutputStream(newwasJarFile)); newJarStream.setLevel(0); //Copy files from old websphere jar for (Enumeration e = wasEntries.elements(); e.hasMoreElements();) { 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(); }
log("No rebuild needed - updating jar", Project.MSG_VERBOSE); newWLJarFile = new File(weblogicJarFile.getAbsolutePath() + ".temp"); if (newWLJarFile.exists()) { newWLJarFile.delete(); } newJarStream = new JarOutputStream(new FileOutputStream(newWLJarFile)); newJarStream.setLevel(0); //Copy files from old weblogic jar for (Enumeration e = wlEntries.elements(); e.hasMoreElements();) { 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(); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
Method name: boolean isRebuildRequired(File, File) Method name: boolean isRebuildRequired(File, File)
Number of AST nodes: 23 Number of AST nodes: 23
1
log("No rebuild needed - updating jar", Project.MSG_VERBOSE);
1
log("No rebuild needed - updating jar", Project.MSG_VERBOSE);
2
                    newwasJarFile = new File(websphereJarFile.getAbsolutePath() + ".temp");
2
                    newWLJarFile = new File(weblogicJarFile.getAbsolutePath() + ".temp");
3
                    if (newwasJarFile.exists()) {
3
                    if (newWLJarFile.exists()) {
4
                        newwasJarFile.delete();
4
                        newWLJarFile.delete();
5
                    }
5
                    }
6
                    newJarStream = new JarOutputStream(new FileOutputStream(newwasJarFile));
6
                    newJarStream = new JarOutputStream(new FileOutputStream(newWLJarFile));
7
                    newJarStream.setLevel(0);
7
                    newJarStream.setLevel(0);
8
                    //Copy files from old websphere jar
8
                    //Copy files from old weblogic jar
9
                    for (Enumeration e = wasEntries.elements(); e.hasMoreElements();) {
9
                    for (Enumeration e = wlEntries.elements(); e.hasMoreElements();) {
10
                        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
10
                        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
11
                        int bytesRead;
11
                        int bytesRead;
12
                        InputStream is;
12
                        InputStream is;
13
                        JarEntry je = (JarEntry) e.nextElement();
13
                        JarEntry je = (JarEntry) e.nextElement();
14
                        if (je.getCompressedSize() == -1
14
                        if (je.getCompressedSize() == -1
15
                            || je.getCompressedSize() == je.getSize()) {
15
                            || je.getCompressedSize() == je.getSize()) {
16
                            newJarStream.setLevel(0);
16
                            newJarStream.setLevel(0);
17
                        } else {
17
                        } else {
18
                            newJarStream.setLevel(JAR_COMPRESS_LEVEL);
18
                            newJarStream.setLevel(JAR_COMPRESS_LEVEL);
19
                        }
19
                        }
20
                        // Update with changed Bean class
20
                        // Update with changed Bean class
21
                        if (replaceEntries.containsKey(je.getName())) {
21
                        if (replaceEntries.containsKey(je.getName())) {
22
                            log("Updating Bean class from generic Jar " + je.getName(),
22
                            log("Updating Bean class from generic Jar "
23
                                Project.MSG_VERBOSE);
23
                                + je.getName(), Project.MSG_VERBOSE);
24
                            // Use the entry from the generic jar
24
                            // Use the entry from the generic jar
25
                            je = (JarEntry) replaceEntries.get(je.getName());
25
                            je = (JarEntry) replaceEntries.get(je.getName());
26
                            is = genericJar.getInputStream(je);
26
                            is = genericJar.getInputStream(je);
27
                        } else {
27
                        } else {
28
                            //use fle from original websphere jar
28
                            //use fle from original weblogic jar
29
                            is = wasJar.getInputStream(je);
29
                            is = wlJar.getInputStream(je);
30
                        }
30
                        }
31
                        newJarStream.putNextEntry(new JarEntry(je.getName()));
31
                        newJarStream.putNextEntry(new JarEntry(je.getName()));
32
                        while ((bytesRead = is.read(buffer)) != -1) {
32
                        while ((bytesRead = is.read(buffer)) != -1) {
33
                            newJarStream.write(buffer, 0, bytesRead);
33
                            newJarStream.write(buffer, 0, bytesRead);
34
                        }
34
                        }
35
                        is.close();
35
                        is.close();
36
                    }
36
                    }
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)2.3
Clones locationClones are in different classes having the same super class
Number of node comparisons147
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements23
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)18.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    44
    log("No rebuild needed - updating jar", Project.MSG_VERBOSE);
    45
    log("No rebuild needed - updating jar", Project.MSG_VERBOSE);
    45
    newwasJarFile = new File(websphereJarFile.getAbsolutePath() + ".temp");
    45
    newwasJarFile = new File(websphereJarFile.getAbsolutePath() + ".temp");
    46
    newWLJarFile = new File(weblogicJarFile.getAbsolutePath() + ".temp");
    Differences
    Expression1Expression2Difference
    newwasJarFilenewWLJarFileVARIABLE_NAME_MISMATCH
    websphereJarFileweblogicJarFileVARIABLE_NAME_MISMATCH
    46
    newWLJarFile = new File(weblogicJarFile.getAbsolutePath() + ".temp");
    46
    if (newwasJarFile.exists())
    46
    if (newwasJarFile.exists())
    47
    if (newWLJarFile.exists())
    Differences
    Expression1Expression2Difference
    newwasJarFilenewWLJarFileVARIABLE_NAME_MISMATCH
    47
    if (newWLJarFile.exists())
    47
    newwasJarFile.delete();
    47
    newwasJarFile.delete();
    48
    newWLJarFile.delete();
    Differences
    Expression1Expression2Difference
    newwasJarFilenewWLJarFileVARIABLE_NAME_MISMATCH
    48
    newWLJarFile.delete();
    48
    newJarStream = new JarOutputStream(new FileOutputStream(newwasJarFile));
    48
    newJarStream = new JarOutputStream(new FileOutputStream(newwasJarFile));
    49
    newJarStream = new JarOutputStream(new FileOutputStream(newWLJarFile));
    Differences
    Expression1Expression2Difference
    newwasJarFilenewWLJarFileVARIABLE_NAME_MISMATCH
    49
    newJarStream = new JarOutputStream(new FileOutputStream(newWLJarFile));
    49
    newJarStream.setLevel(0);
    50
    newJarStream.setLevel(0);
    50
    for (Enumeration e = wasEntries.elements(); e.hasMoreElements(); )
    50
    for (Enumeration e = wasEntries.elements(); e.hasMoreElements(); )
    51
    for (Enumeration e = wlEntries.elements(); e.hasMoreElements(); )
    Differences
    Expression1Expression2Difference
    wasEntrieswlEntriesVARIABLE_NAME_MISMATCH
    51
    for (Enumeration e = wlEntries.elements(); e.hasMoreElements(); )
    51
    byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
    52
    byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
    52
    int bytesRead;
    53
    int bytesRead;
    53
    InputStream is;
    54
    InputStream is;
    54
    JarEntry je = (JarEntry)e.nextElement();
    55
    JarEntry je = (JarEntry)e.nextElement();
    55
    if (je.getCompressedSize() == -1 || je.getCompressedSize() == je.getSize())
    56
    if (je.getCompressedSize() == -1 || je.getCompressedSize() == je.getSize())
    56
    newJarStream.setLevel(0);
    57
    newJarStream.setLevel(0);
    else
    else
    57
    newJarStream.setLevel(JAR_COMPRESS_LEVEL);
    58
    newJarStream.setLevel(JAR_COMPRESS_LEVEL);
    58
    if (replaceEntries.containsKey(je.getName()))
    59
    if (replaceEntries.containsKey(je.getName()))
    59
    log("Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE);
    60
    log("Updating Bean class from generic Jar " + je.getName(), Project.MSG_VERBOSE);
    60
    je = (JarEntry)replaceEntries.get(je.getName());
    61
    je = (JarEntry)replaceEntries.get(je.getName());
    61
    is = genericJar.getInputStream(je);
    62
    is = genericJar.getInputStream(je);
    else
    else
    62
    is = wasJar.getInputStream(je);
    62
    is = wasJar.getInputStream(je);
    63
    is = wlJar.getInputStream(je);
    Differences
    Expression1Expression2Difference
    wasJarwlJarVARIABLE_NAME_MISMATCH
    63
    is = wlJar.getInputStream(je);
    63
    newJarStream.putNextEntry(new JarEntry(je.getName()));
    64
    newJarStream.putNextEntry(new JarEntry(je.getName()));
    64
    while ((bytesRead = is.read(buffer)) != -1)
    65
    while ((bytesRead = is.read(buffer)) != -1)
    65
    newJarStream.write(buffer, 0, bytesRead);
    66
    newJarStream.write(buffer, 0, bytesRead);
    66
    is.close();
    67
    is.close();
    Precondition Violations (0)
    Row Violation