if(e instanceof TargetError) { Throwable t = ((TargetError)e).getTarget(); if(t instanceof Exception) throw (Exception)t; else if(t instanceof Error) throw (Error)t; }
if(e instanceof InvocationTargetException) { Throwable t = ((InvocationTargetException)e).getTargetException(); if(t instanceof Exception) throw (Exception)t; else if(t instanceof Error) throw (Error)t; }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/BeanShell.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/BeanShell.java
Method name: void unwrapException(Exception) Method name: void unwrapException(Exception)
Number of AST nodes: 6 Number of AST nodes: 6
1
if(e instanceof TargetError)
1
if(e instanceof InvocationTargetException)
2
		{
2
		{
3
			Throwable t = ((TargetError)e).getTarget();
3
			Throwable t = ((InvocationTargetException)e).getTargetException();
4
			if(t instanceof Exception)
4
			if(t instanceof Exception)
5
				throw (Exception)t;
5
				throw (Exception)t;
6
			else if(t instanceof Error)
6
			else if(t instanceof Error)
7
				throw (Error)t;
7
				throw (Error)t;
8
		}
8
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in the same method
Number of node comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (e instanceof TargetError)
    1
    if (e instanceof TargetError)
    7
    if (e instanceof InvocationTargetException)
    Differences
    Expression1Expression2Difference
    bsh.TargetErrorjava.lang.reflect.InvocationTargetExceptionSUBCLASS_TYPE_MISMATCH
    7
    if (e instanceof InvocationTargetException)
    2
    Throwable t = ((TargetError)e).getTarget();
    2
    Throwable t = ((TargetError)e).getTarget();
    8
    Throwable t = ((InvocationTargetException)e).getTargetException();
    Differences
    Expression1Expression2Difference
    getTargetgetTargetExceptionMETHOD_INVOCATION_NAME_MISMATCH
    bsh.TargetErrorjava.lang.reflect.InvocationTargetExceptionSUBCLASS_TYPE_MISMATCH
    8
    Throwable t = ((InvocationTargetException)e).getTargetException();
    3
    if (t instanceof Exception)
    9
    if (t instanceof Exception)
    4
    throw (Exception)t;
    10
    throw (Exception)t;
    5
    else if (t instanceof Error)
    11
    else if (t instanceof Error)
    6
    throw (Error)t;
    12
    throw (Error)t;
    Precondition Violations (0)
    Row Violation