Object instance = null; try { instance = ClassUtils.getClass(className).newInstance(); } catch (ClassNotFoundException e) { throw new JMeterException(e); } catch (InstantiationException e) { throw new JMeterException(e); } catch (IllegalAccessException e) { throw new JMeterException(e); } return instance;
Method m; try { m = ClassUtils.getPublicMethod(instance.getClass(), methodName, new Class [] {}); m.invoke(instance, null); } catch (NoSuchMethodException e) { throw new JMeterException(e); } catch (IllegalAccessException e) { throw new JMeterException(e); } catch (InvocationTargetException e) { throw new JMeterException(e); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/reflect/ClassTools.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/reflect/ClassTools.java
Method name: Object construct(String) Method name: void invoke(Object, String)
Number of AST nodes: 4 Number of AST nodes: 4
1
Object instance = null;
1
Method m;
2
		try {
2
		try {
3
			instance = ClassUtils.getClass(className).newI
3
			m = ClassUtils.getPublicMethod(instance.getClass(), methodName, new Class [] {});
4
nstance();
4
			m.invoke(instance, null);
5
		} catch (ClassNotFoundException e) {
5
		} catch (NoSuchMethodException e) {
6
			throw new JMeterException(e);
6
			throw new JMeterException(e);
7
		} catch (InstantiationException e) {
7
		} catch (IllegalAccessException e) {
8
			throw new JMeterException(e);
8
			throw new JMeterException(e);
9
		} catch (IllegalAccessException e) {
9
		} catch (InvocationTargetException e) {
10
			throw new JMeterException(e);
10
			throw new JMeterException(e);
11
		}
11
		}
12
		return instance;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.0
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                            
    1
    Method m;
    1
    Object instance = null;
                                                    
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.lang.ClassNotFoundExceptionjava.lang.NoSuchMethodExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.ClassNotFoundExceptionjava.lang.NoSuchMethodExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.ClassNotFoundExceptionjava.lang.NoSuchMethodExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionSUBCLASS_TYPE_MISMATCH
    java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionSUBCLASS_TYPE_MISMATCH
    2
    try
                                                                                                                                                                
    3
    m = ClassUtils.getPublicMethod(instance.getClass(), methodName, new Class[] {});
    Preondition Violations
    Unmatched statement m=ClassUtils.getPublicMethod(instance.getClass(),methodName,new Class[]{}); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3
    m = ClassUtils.getPublicMethod(instance.getClass(), methodName, new Class[] {});
    3
    instance = ClassUtils.getClass(className).newInstance();
    3
    instance = ClassUtils.getClass(className).newInstance();
    Preondition Violations
    Unmatched statement instance=ClassUtils.getClass(className).newInstance(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                      
                                                          
    4
    m.invoke(instance, null);
    Preondition Violations
    Unmatched statement m.invoke(instance,null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4
    m.invoke(instance, null);
    4
    return instance;
    4
    return instance;
    Preondition Violations
    Unmatched return instance;
                                          
    Precondition Violations (4)
    Row Violation
    1Unmatched statement m=ClassUtils.getPublicMethod(instance.getClass(),methodName,new Class[]{}); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2Unmatched statement instance=ClassUtils.getClass(className).newInstance(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched statement m.invoke(instance,null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4Unmatched return instance;