loader = getProject().createClassLoader(classpath); loader.setParentFirst(false); loader.addJavaLibraries(); if (loader != null) { try { return loader.findClass(classname); } catch (SecurityException se) { // class found but restricted name; this is // actually the case we're looking for in JDK 1.3+, // so catch the exception and return return null; } } else { return null; }
loader = getProject().createClassLoader(classpath); loader.setParentFirst(false); loader.addJavaLibraries(); if (loader != null) { try { loader.findClass(classname); } catch (SecurityException se) { // class found but restricted name; this is // actually the case we're looking for in JDK 1.3+, // so catch the exception and return return true; } } else { return false; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/condition/HasMethod.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Available.java
Method name: Class loadClass(String) Method name: boolean checkClass(String)
Number of AST nodes: 7 Number of AST nodes: 7
1
loader = getProject().createClassLoader(classpath);
1
loader = getProject().createClassLoader(classpath);
2
                loader.setParentFirst(false);
2
                loader.setParentFirst(false);
3
                loader.addJavaLibraries();
3
                loader.addJavaLibraries();
4
                if (loader != null) {
4
                if (loader != null) {
5
                    try {
5
                    try {
6
                        return loader.findClass(classname);
6
                        loader.findClass(classname);
7
                    } catch (SecurityException se) {
7
                    } catch (SecurityException se) {
8
                        // class found but restricted name; this is
8
                        // class found but restricted name; this is
9
                        // actually the case we're looking for in JDK 1.3+,
9
                        // actually the case we're looking for in JDK 1.3+,
10
                        // so catch the exception and return
10
                        // so catch the exception and return
11
                        return null;
11
                        return true;
12
                    }
12
                    }
13
                } else {
13
                } else {
14
                    return null;
14
                    return false;
15
                }
15
                }
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons1