Revision 21173 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/operation/GeometryOperationException.java

View differences:

GeometryOperationException.java
57 57
/**
58 58
 * @author Jorge Piera Llodr� (jorge.piera@iver.es)
59 59
 */
60
public class GeometryOperationException extends BaseException{
61
	private static final long serialVersionUID = 1L;
60
public class GeometryOperationException extends BaseException {
61
	
62
	/**
63
	 * Generated serial version UID 
64
	 */
65
	private static final long serialVersionUID = 8230919748601156772L;
66
	private static final String MESSAGE_KEY = "geometry_operation_exception";
67
	private static final String FORMAT_STRING = 
68
		"Exception executing the operation with code %(operationCode) for the geometry with type %(geometryType).";
69
	
62 70
	private int geometryType = -1;
63 71
	private int operationCode = -1;
64 72
	
73
	/**
74
	 * Constructor with some context data for cases in which the root cause of 
75
	 * <code>this</code> is internal (usually an unsatisfied logic rule).
76
	 * @param geometryType
77
	 * @param operationCode
78
	 */
65 79
	public GeometryOperationException(int geometryType, int operationCode){
66
		this.geometryType = geometryType;	
67
		this.operationCode = operationCode;
68
		init();
80
		this(geometryType, operationCode, null);
69 81
	}
70 82
	
71 83
	/**
72
	 * Initializes some values
84
	 * Constructor to use when <code>this</code> is caused by another Exception 
85
	 * but there is not further context data available.
86
	 * @param e
73 87
	 */
74
	public void init() {
75
		messageKey="geometry_operation_exception";
76
		formatString = "Exception executing the operation with code %(operationCode) " +
77
			"for the geometry with type %(geometryType).";
88
	public GeometryOperationException(Exception e) {
89
		this(-1, -1, e);
90
	}
91
	
92
	/**
93
	 * Main constructor that provides both context data and a cause Exception
94
	 * @param geometryType
95
	 * @param operationCode
96
	 * @param exp
97
	 */
98
	public GeometryOperationException(int geometryType, int operationCode, Exception e) {
99
		if (e != null) {
100
			initCause(e);
101
		}
102
		
103
		this.geometryType = geometryType;	
104
		this.operationCode = operationCode;
105
		
106
		messageKey = MESSAGE_KEY;
107
		formatString = FORMAT_STRING;
78 108
		code = serialVersionUID;
79 109
	}
80 110
	
......
88 118
		map.put("operationCode", new Integer(operationCode));
89 119
		return map;
90 120
	}
91

  
92 121
}
93 122

  

Also available in: Unified diff