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 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 2.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 147 |
Number of mapped statements | 23 |
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) | 18.1 |
Clone type | Type 2 |
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"); |
| 46 | newWLJarFile = new File(weblogicJarFile.getAbsolutePath() + ".temp"); | |||||||||||||
46 | if (newwasJarFile.exists()) |
| 47 | if (newWLJarFile.exists()) | |||||||||||||
47 | newwasJarFile.delete(); |
| 48 | newWLJarFile.delete(); | |||||||||||||
48 | newJarStream = new JarOutputStream(new FileOutputStream(newwasJarFile)); |
| 49 | newJarStream = new JarOutputStream(new FileOutputStream(newWLJarFile)); | |||||||||||||
49 | newJarStream.setLevel(0); | 50 | newJarStream.setLevel(0); | ||||||||||||||
50 | for (Enumeration e = wasEntries.elements(); e.hasMoreElements(); ) |
| 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); |
| 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(); |
Row | Violation |
---|