blob: 3afd47877a796f1dfe2856cb9ee174bad8011c8d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*******************************************************************************
* Copyright (c) 2001, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jem.internal.proxy.common.remote;
/*
*/
import org.eclipse.jem.internal.proxy.common.CommandException;
/**
* This is an exception that is thrown when the processing
* of data was invalid for the command.
* There will be a flag indicting error type, and a flag
* indicating whether the connection is recoverable or not.
* If not recoverable, then the connection needs to be closed.
*
*/
public class UnexpectedCommandException extends CommandException {
/**
* Comment for <code>serialVersionUID</code>
*
* @since 1.1.0
*/
private static final long serialVersionUID = 7097693384453243113L;
private final Object fErrorType;
private final boolean fRecoverable;
public UnexpectedCommandException(Object errorType, boolean recoverable) {
fErrorType = errorType;
fRecoverable = recoverable;
}
public UnexpectedCommandException(Object errorType, boolean recoverable, Object data) {
super(data);
fErrorType = errorType;
fRecoverable = recoverable;
}
public UnexpectedCommandException(Object errorType, boolean recoverable, String msg, Object data) {
super(msg, data);
fErrorType = errorType;
fRecoverable = recoverable;
}
public Object getErrorType() {
return fErrorType;
}
public boolean isRecoverable() {
return fRecoverable;
}
public String getMessage() {
String m = super.getMessage();
if (fErrorType != null) {
String dataMsg = getExceptionData() != null ? " Errordata="+getExceptionData().toString() : ""; //$NON-NLS-1$ //$NON-NLS-2$
if (m == null)
return "Errortype="+fErrorType.toString() + dataMsg; //$NON-NLS-1$
else
return m + ':' + "Errortype="+fErrorType.toString() + dataMsg; //$NON-NLS-1$
} else
return m;
}
}
|