File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/depend/ClassfileSet.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java | |||
Method name: DirectoryScanner getDirectoryScanner(Project)
|
Method name: void checkAndAddDependants(Hashtable)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 7 | |||
1 | /** | 1 | /** | |
2 | * Return the DirectoryScanner associated with this FileSet. | 2 | * Add all available classes, that depend on Remote, Home, Bean, PK | |
3 | * | 3 | * @param checkEntries files, that are extracted from the deployment descriptor | |
4 | * @param p the project used to resolve dirs, etc. | 4 | * @throws BuildException if there is a problem. | |
5 | * | 5 | */ | |
6 | * @return a dependency scanner. | 6 | protected void checkAndAddDependants(Hashtable checkEntries) | |
7 | */ | 7 | throws BuildException { | |
8 | public DirectoryScanner getDirectoryScanner(Project p) { | 8 | ||
9 | if (isReference()) { | 9 | if (dependencyAnalyzer == null) { | |
10 | return getRef(p).getDirectoryScanner(p); | 10 | return; | |
11 | } | 11 | } | |
12 | Vector allRootClasses = (Vector) rootClasses.clone(); | 12 | ||
13 | for (Enumeration e = rootFileSets.elements(); e.hasMoreElements();) { | 13 | dependencyAnalyzer.reset(); | |
14 | FileSet additionalRootSet = (FileSet) e.nextElement(); | 14 | ||
15 | DirectoryScanner additionalScanner | 15 | Iterator i = checkEntries.keySet().iterator(); | |
16 | = additionalRootSet.getDirectoryScanner(p); | 16 | while (i.hasNext()) { | |
17 | String[] files = additionalScanner.getIncludedFiles(); | 17 | String entryName = (String) i.next(); | |
18 | for (int i = 0; i < files.length; ++i) { | 18 | if (entryName.endsWith(".class")) { | |
19 | if (files[i].endsWith(".class")) { | 19 | String className = entryName.substring(0, | |
20 | String classFilePath | 20 | entryName.length() - ".class".length()); | |
21 | = files[i].substring(0, files[i].length() - 6); | 21 | className = className.replace(File.separatorChar, '/'); | |
22 | String className | 22 | className = className.replace('/', '.'); | |
23 | = classFilePath.replace('/', '.').replace('\\', '.'); | 23 | ||
24 | allRootClasses.addElement(className); | 24 | dependencyAnalyzer.addRootClass(className); | |
25 | } | 25 | } | |
26 | } | 26 | } | |
27 | } | 27 | ||
28 | DirectoryScanner parentScanner = super.getDirectoryScanner(p); | 28 | Enumeration e = dependencyAnalyzer.getClassDependencies(); | |
29 | DependScanner scanner = new DependScanner(parentScanner); | 29 | ||
30 | scanner.setBasedir(getDir(p)); | 30 | while (e.hasMoreElements()) { | |
31 | scanner.setRootClasses(allRootClasses); | 31 | String classname = (String) e.nextElement(); | |
32 | scanner.scan(); | 32 | String location | |
33 | return scanner; | 33 | = classname.replace('.', File.separatorChar) + ".class"; | |
34 | } | 34 | File classFile = new File(config.srcDir, location); | |
35 | if (classFile.exists()) { | |||
36 | checkEntries.put(location, classFile); | |||
37 | log("dependent class: " + classname + " - " + classFile, | |||
38 | Project.MSG_VERBOSE); | |||
39 | } | |||
40 | } | |||
41 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.583 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | for (int i = 0; i < files.length; ++i) |
| 5 | while (i.hasNext()) | ||||||||||||||||||||||||||
| 6 | String entryName = (String)i.next(); | ||||||||||||||||||||||||||||
9 | if (files[i].endsWith(".class")) |
| 7 | if (entryName.endsWith(".class")) | ||||||||||||||||||||||||||
10 | String classFilePath = files[i].substring(0, files[i].length() - 6); |
| 8 | String className = entryName.substring(0, entryName.length() - ".class".length()); | ||||||||||||||||||||||||||
| 9 | className = className.replace(File.separatorChar, '/'); | ||||||||||||||||||||||||||||
| 10 | className = className.replace('/', '.'); | ||||||||||||||||||||||||||||
| 11 | dependencyAnalyzer.addRootClass(className); | ||||||||||||||||||||||||||||
11 | String className = classFilePath.replace('/', '.').replace('\\', '.'); |
| | |||||||||||||||||||||||||||
12 | allRootClasses.addElement(className); | |
Row | Violation |
---|---|
1 | Type java.lang.String[] of variable files does not match with type java.util.Set of variable checkEntries.keySet() |
2 | Type java.lang.String[] of variable files does not match with type java.util.Set of variable checkEntries.keySet() |
3 | Type java.lang.String[] of variable files does not match with type java.util.Set of variable checkEntries.keySet() |
4 | Type java.lang.String[] of variable files does not match with type java.util.Set of variable checkEntries.keySet() |
5 | Expression files[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression files[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression files[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement String className=classFilePath.replace('/','.').replace('\\','.'); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |