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(); }
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(); }
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
for (Enumeration e = wlEntries.elements(); e.hasMoreElements();) {
1
for (Enumeration e = wasEntries.elements(); e.hasMoreElements();) {
2
                        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
2
                        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
3
                        int bytesRead;
3
                        int bytesRead;
4
                        InputStream is;
4
                        InputStream is;
5
                        JarEntry je = (JarEntry) e.nextElement();
5
                        JarEntry je = (JarEntry) e.nextElement();
6
                        if (je.getCompressedSize() == -1
6
                        if (je.getCompressedSize() == -1
7
                            || je.getCompressedSize() == je.getSize()) {
7
                            || je.getCompressedSize() == je.getSize()) {
8
                            newJarStream.setLevel(0);
8
                            newJarStream.setLevel(0);
9
                        } else {
9
                        } else {
10
                            newJarStream.setLevel(JAR_COMPRESS_LEVEL);
10
                            newJarStream.setLevel(JAR_COMPRESS_LEVEL);
11
                        }
11
                        }
12
                        // Update with changed Bean class
12
                        // Update with changed Bean class
13
                        if (replaceEntries.containsKey(je.getName())) {
13
                        if (replaceEntries.containsKey(je.getName())) {
14
                            log("Updating Bean class from generic Jar "
14
                            log("Updating Bean class from generic Jar " + je.getName(),
15
                                + je.getName(), Project.MSG_VERBOSE);
15
                                Project.MSG_VERBOSE);
16
                            // Use the entry from the generic jar
16
                            // Use the entry from the generic jar
17
                            je = (JarEntry) replaceEntries.get(je.getName());
17
                            je = (JarEntry) replaceEntries.get(je.getName());
18
                            is = genericJar.getInputStream(je);
18
                            is = genericJar.getInputStream(je);
19
                        } else {
19
                        } else {
20
                            //use fle from original weblogic jar
20
                            //use fle from original websphere jar
21
                            is = wlJar.getInputStream(je);
21
                            is = wasJar.getInputStream(je);
22
                        }
22
                        }
23
                        newJarStream.putNextEntry(new JarEntry(je.getName()));
23
                        newJarStream.putNextEntry(new JarEntry(je.getName()));
24
                        while ((bytesRead = is.read(buffer)) != -1) {
24
                        while ((bytesRead = is.read(buffer)) != -1) {
25
                            newJarStream.write(buffer, 0, bytesRead);
25
                            newJarStream.write(buffer, 0, bytesRead);
26
                        }
26
                        }
27
                        is.close();
27
                        is.close();
28
                    }
28
                    }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0