public class BaseException extends Exception { /** If this exception is wrapped around another it is stored here. */ private Throwable _wrapee; /** * Default ctor. Creates an exception with an empty string ("") * as its message. */ public BaseException() { this(""); } /** * Ctor specifying the message. * * @param msg The message. */ public BaseException(String msg) { super(msg != null ? msg : ""); } /** * Ctor specifying an exception that this one should * be wrapped around. * * @param wrapee The wrapped exception. */ public BaseException(Throwable wrapee) { super(wrapee); _wrapee = wrapee; } public String toString() { if (_wrapee != null) { return _wrapee.toString(); } return super.toString(); } public void printStackTrace() { if (_wrapee != null) { _wrapee.printStackTrace(); } else { super.printStackTrace(); } } public void printStackTrace(PrintStream s) { if (_wrapee != null) { _wrapee.printStackTrace(s); } else { super.printStackTrace(s); } } public void printStackTrace(PrintWriter wtr) { if (_wrapee != null) { _wrapee.printStackTrace(wtr); } else { super.printStackTrace(wtr); } } private static String getMessageFromException(Throwable th) { String rtn = ""; if (th != null) { String msg = th.getMessage(); if (msg != null) { rtn = msg; } } return rtn; } /** * Retrieve the exception that this one is wrapped around. This can be * <TT>null</TT>. * * @return The wrapped exception or <TT>null</TT>. */ public Throwable getWrappedThrowable() { return _wrapee
public class BaseRuntimeException extends RuntimeException { /** If this exception is wrapped around another it is stored here. */ private Throwable _wrapee; /** * Default ctor. Creates an exception with an empty string ("") * as its message. */ public BaseRuntimeException() { this(""); } /** * Ctor specifying the message. * * @param msg The message. */ public BaseRuntimeException(String msg) { super(msg != null ? msg : ""); } /** * Ctor specifying an exception that this one should * be wrapped around. * * @param wrapee The wrapped exception. */ public BaseRuntimeException(Throwable wrapee) { super(getMessageFromException(wrapee)); _wrapee = wrapee; } public String toString() { if (_wrapee != null) { return _wrapee.toString(); } return super.toString(); } public void printStackTrace() { if (_wrapee != null) { _wrapee.printStackTrace(); } else { super.printStackTrace(); } } public void printStackTrace(PrintStream s) { if (_wrapee != null) { _wrapee.printStackTrace(s); } else { super.printStackTrace(s); } } public void printStackTrace(PrintWriter wtr) { if (_wrapee != null) { _wrapee.printStackTrace(wtr); } else { super.printStackTrace(wtr); } } /** * Retrieve the exception that this one is wrapped around. This can be * <TT>null</TT>. * * @return The wrapped exception or <TT>null</TT>. */ public Throwable getWrappedThrowable() { return _wrapee; } private static String getMessageFromException(Throwable th) { String rtn = ""; if (th != null) { String msg = th.getMessage(); if (msg != null) { rtn = msg; } } return rtn
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/BaseException.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/BaseRuntimeException.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class BaseException extends Exception
1
public class BaseRuntimeException extends RuntimeException
2
{
2
{
3
	/** If this exception is wrapped around another it is stored here. */
3
	/** If this exception is wrapped around another it is stored here. */
4
	private Throwable _wrapee;
4
	private Throwable _wrapee;
5
	/**
5
	/**
6
	 * Default ctor. Creates an exception with an empty string ("")
6
	 * Default ctor. Creates an exception with an empty string ("")
7
	 * as its message.
7
	 * as its message.
8
	 */
8
	 */
9
	public BaseException()
9
	public BaseRuntimeException()
10
	{
10
	{
11
		this("");
11
		this("");
12
	}
12
	}
13
	/**
13
	/**
14
	 * Ctor specifying the message.
14
	 * Ctor specifying the message.
15
	 *
15
	 *
16
	 * @param	msg	 The message.
16
	 * @param	msg	 The message.
17
	 */
17
	 */
18
	public BaseException(String msg)
18
	public BaseRuntimeException(String msg)
19
	{
19
	{
20
		super(msg != null ? msg : "");
20
		super(msg != null ? msg : "");
21
	}
21
	}
22
	/**
22
	/**
23
	 * Ctor specifying an exception that this one should
23
	 * Ctor specifying an exception that this one should
24
	 * be wrapped around.
24
	 * be wrapped around.
25
	 *
25
	 *
26
	 * @param	wrapee	The wrapped exception.
26
	 * @param	wrapee	The wrapped exception.
27
	 */
27
	 */
28
	public BaseException(Throwable wrapee)
28
	public BaseRuntimeException(Throwable wrapee)
29
	{
29
	{
30
      super(wrapee);
30
		super(getMessageFromException(wrapee));
31
		_wrapee = wrapee;
31
		_wrapee = wrapee;
32
	}
32
	}
33
	public String toString()
33
	public String toString()
34
	{
34
	{
35
		if (_wrapee != null)
35
		if (_wrapee != null)
36
		{
36
		{
37
			return _wrapee.toString();
37
			return _wrapee.toString();
38
		}
38
		}
39
		return super.toString();
39
		return super.toString();
40
	}
40
	}
41
	public void printStackTrace()
41
	public void printStackTrace()
42
	{
42
	{
43
		if (_wrapee != null)
43
		if (_wrapee != null)
44
		{
44
		{
45
			_wrapee.printStackTrace();
45
			_wrapee.printStackTrace();
46
		}
46
		}
47
		else
47
		else
48
		{
48
		{
49
			super.printStackTrace();
49
			super.printStackTrace();
50
		}
50
		}
51
	}
51
	}
52
	public void printStackTrace(PrintStream s)
52
	public void printStackTrace(PrintStream s)
53
	{
53
	{
54
		if (_wrapee != null)
54
		if (_wrapee != null)
55
		{
55
		{
56
			_wrapee.printStackTrace(s);
56
			_wrapee.printStackTrace(s);
57
		}
57
		}
58
		else
58
		else
59
		{
59
		{
60
			super.printStackTrace(s);
60
			super.printStackTrace(s);
61
		}
61
		}
62
	}
62
	}
63
	public void printStackTrace(PrintWriter wtr)
63
	public void printStackTrace(PrintWriter wtr)
64
	{
64
	{
65
		if (_wrapee != null)
65
		if (_wrapee != null)
66
		{
66
		{
67
			_wrapee.printStackTrace(wtr);
67
			_wrapee.printStackTrace(wtr);
68
		}
68
		}
69
		else
69
		else
70
		{
70
		{
71
			super.printStackTrace(wtr);
71
			super.printStackTrace(wtr);
72
		}
72
		}
73
	}
73
	}
74
	private static String getMessageFromException(Throwable th)
75
	{
76
		String rtn = "";
77
		if (th != null)
78
		{
79
			String msg = th.getMessage();
80
			if (msg != null)
81
			{
82
				rtn = msg;
83
			}
84
		}
85
		return rtn;
86
	}
87
	/**
74
	/**
88
	 * Retrieve the exception that this one is wrapped around. This can be
75
	 * Retrieve the exception that this one is wrapped around. This can be
89
	 * <TT>null</TT>.
76
	 * <TT>null</TT>.
90
	 *
77
	 *
91
	 * @return	The wrapped exception or <TT>null</TT>.
78
	 * @return	The wrapped exception or <TT>null</TT>.
92
	 */
79
	 */
93
	public Throwable getWrappedThrowable()
80
	public Throwable getWrappedThrowable()
94
	{
81
	{
95
		return _wrapee
82
		return _wrapee;
83
	}
84
	private static String getMessageFromException(Throwable th)
85
	{
86
		String rtn = "";
87
		if (th != null)
88
		{
89
			String msg = th.getMessage();
90
			if (msg != null)
91
			{
92
				rtn = msg;
93
			}
94
		}
95
		return rtn
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.0
Clones location
Number of node comparisons0