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: 25 | Number of AST nodes: 25 | |||
1 | if (!rebuild) {↵ | 1 | if (!rebuild) {↵ | |
2 | log("No rebuild needed - updating jar", Project.MSG_VERBOSE);↵ | 2 | log("No rebuild needed - updating jar", Project.MSG_VERBOSE);↵ | |
3 | newWLJarFile = new File(weblogicJarFile.getAbsolutePath() + ".temp");↵ | 3 | newwasJarFile = new File(websphereJarFile.getAbsolutePath() + ".temp");↵ | |
4 | if (newWLJarFile.exists()) {↵ | 4 | if (newwasJarFile.exists()) {↵ | |
5 | newWLJarFile.delete();↵ | 5 | newwasJarFile.delete();↵ | |
6 | }↵ | 6 | }↵ | |
7 | newJarStream = new JarOutputStream(new FileOutputStream(newWLJarFile));↵ | 7 | newJarStream = new JarOutputStream(new FileOutputStream(newwasJarFile));↵ | |
8 | newJarStream.setLevel(0);↵ | 8 | newJarStream.setLevel(0);↵ | |
9 | //Copy files from old weblogic jar↵ | 9 | //Copy files from old websphere jar↵ | |
10 | for (Enumeration e = wlEntries.elements(); e.hasMoreElements();) {↵ | 10 | for (Enumeration e = wasEntries.elements(); e.hasMoreElements();) {↵ | |
11 | byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];↵ | 11 | byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];↵ | |
12 | int bytesRead;↵ | 12 | int bytesRead;↵ | |
13 | InputStream is;↵ | 13 | InputStream is;↵ | |
14 | JarEntry je = (JarEntry) e.nextElement();↵ | 14 | JarEntry je = (JarEntry) e.nextElement();↵ | |
15 | if (je.getCompressedSize() == -1↵ | 15 | if (je.getCompressedSize() == -1↵ | |
16 | || je.getCompressedSize() == je.getSize()) {↵ | 16 | || je.getCompressedSize() == je.getSize()) {↵ | |
17 | newJarStream.setLevel(0);↵ | 17 | newJarStream.setLevel(0);↵ | |
18 | } else {↵ | 18 | } else {↵ | |
19 | newJarStream.setLevel(JAR_COMPRESS_LEVEL);↵ | 19 | newJarStream.setLevel(JAR_COMPRESS_LEVEL);↵ | |
20 | }↵ | 20 | }↵ | |
21 | // Update with changed Bean class↵ | 21 | // Update with changed Bean class↵ | |
22 | if (replaceEntries.containsKey(je.getName())) {↵ | 22 | if (replaceEntries.containsKey(je.getName())) {↵ | |
23 | log("Updating Bean class from generic Jar "↵ | 23 | log("Updating Bean class from generic Jar "↵ | |
24 | ↵ | 24 | + je.getName(),↵ | |
25 | + je.getName(), Project.MSG_VERBOSE);↵ | 25 | Project.MSG_VERBOSE);↵ | |
26 | // Use the entry from the generic jar↵ | 26 | // Use the entry from the generic jar↵ | |
27 | je = (JarEntry) replaceEntries.get(je.getName());↵ | 27 | je = (JarEntry) replaceEntries.get(je.getName());↵ | |
28 | is = genericJar.getInputStream(je);↵ | 28 | is = genericJar.getInputStream(je);↵ | |
29 | } else {↵ | 29 | } else {↵ | |
30 | //use fle from original weblogic jar↵ | 30 | //use fle from original websphere jar↵ | |
31 | is = wlJar.getInputStream(je);↵ | 31 | is = wasJar.getInputStream(je);↵ | |
32 | }↵ | 32 | }↵ | |
33 | newJarStream.putNextEntry(new JarEntry(je.getName()));↵ | 33 | newJarStream.putNextEntry(new JarEntry(je.getName()));↵ | |
34 | while ((bytesRead = is.read(buffer)) != -1) {↵ | 34 | while ((bytesRead = is.read(buffer)) != -1) {↵ | |
35 | newJarStream.write(buffer, 0, bytesRead);↵ | 35 | newJarStream.write(buffer, 0, bytesRead);↵ | |
36 | }↵ | 36 | }↵ | |
37 | is.close();↵ | 37 | is.close();↵ | |
38 | }↵ | 38 | }↵ | |
39 | } else {↵ | 39 | } else {↵ | |
40 | log("Weblogic Jar rebuild needed due to changed "↵ | 40 | log("websphere Jar rebuild needed due to changed "↵ | |
41 | + "interface or XML", Project.MSG_VERBOSE);↵ | 41 | + "interface or XML", Project.MSG_VERBOSE);↵ | |
42 | } | 42 |
| |
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.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 167 |
Number of mapped statements | 25 |
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) | 23.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
44 | if (!rebuild) | 43 | if (!rebuild) | ||||||||||||||
45 | log("No rebuild needed - updating jar", Project.MSG_VERBOSE); | 44 | log("No rebuild needed - updating jar", Project.MSG_VERBOSE); | ||||||||||||||
46 | newWLJarFile = new File(weblogicJarFile.getAbsolutePath() + ".temp"); |
| 45 | newwasJarFile = new File(websphereJarFile.getAbsolutePath() + ".temp"); | |||||||||||||
47 | if (newWLJarFile.exists()) |
| 46 | if (newwasJarFile.exists()) | |||||||||||||
48 | newWLJarFile.delete(); |
| 47 | newwasJarFile.delete(); | |||||||||||||
49 | newJarStream = new JarOutputStream(new FileOutputStream(newWLJarFile)); |
| 48 | newJarStream = new JarOutputStream(new FileOutputStream(newwasJarFile)); | |||||||||||||
50 | newJarStream.setLevel(0); | 49 | newJarStream.setLevel(0); | ||||||||||||||
51 | for (Enumeration e = wlEntries.elements(); e.hasMoreElements(); ) |
| 50 | for (Enumeration e = wasEntries.elements(); e.hasMoreElements(); ) | |||||||||||||
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); |
| 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(); | ||||||||||||||
else | else | ||||||||||||||||
68 | log("Weblogic Jar rebuild needed due to changed " + "interface or XML", Project.MSG_VERBOSE); |
| 67 | log("websphere Jar rebuild needed due to changed " + "interface or XML", Project.MSG_VERBOSE); |
Row | Violation |
---|