private XAException handleException()

in tx-control-services/tx-control-service-xa/src/main/java/org/apache/aries/tx/control/service/xa/impl/NamedXAResourceImpl.java [94:119]


	private XAException handleException(Exception e) throws XAException {
		if(e instanceof XAException) {
			XAException xae = (XAException) e;
			if(xae.errorCode == 0) {
				if(original) {
					// We are the originally enlisted resource, and will play some tricks to attempt recovery 
					if(transactionManager.getNamedResource(name) == null) {
						logger.error("The XA resource named {} threw an XAException but did not set the error code. There is also no RecoverableXAResource available with the name {}. It is not possible to recover from this situation and so the transaction will have to be resolved by an operator.", name, name, xae);
						xae.errorCode = XAException.XAER_RMERR;
					} else {
						logger.warn("The XA resource named {} threw an XAException but did not set the error code. Changing it to be an \"RM_FAIL\" to permit recovery attempts", name, xae);
						xae.errorCode = XAException.XAER_RMFAIL;
					}
				} else {
					logger.warn("The XA resource named {} threw an XAException but did not set the error code. Recovery has already been attempted for this resource and it has not been possible to recover from this situation. The transaction will have to be resolved by an operator.", name, xae);
					xae.errorCode = XAException.XAER_RMERR;
				}
			}
			return xae;
		} else {
			logger.warn("The recoverable XA resource named {} threw an Exception which is not permitted by the interface. Changing it to be a \"Resource Manager Error\" XAException which prevents recovery", name, e);
			XAException xaException = new XAException(XAException.XAER_RMERR);
			xaException.initCause(e);
			return xaException;
		}
	}