/* 89 */ this.tm = getContainer().getTransactionManager();
/* */ }
/* */
/* */ protected Object invokeNext(Invocation invocation, boolean inheritedTx) throws Exception {
/* 112 */ InvocationType type = invocation.getType();
/* */ TransactionRolledbackException ex;
/* */ try {
/* 115 */ if ((type == InvocationType.REMOTE) || (type == InvocationType.LOCAL) || (type == InvocationType.SERVICE_ENDPOINT))
/* */ {
/* 118 */ if (ejbTimeout.equals(invocation.getMethod())) {
/* 119 */ registerTimer(invocation);
/* */ }
/* 121 */ return getNext().invoke(invocation);
/* */ }
/* */
/* 125 */ return getNext().invokeHome(invocation);
/* */ }
/* */ catch (Throwable e)
/* */ {
/* 131 */ if (((e instanceof Exception)) && (!(e instanceof RuntimeException)) && (!(e instanceof RemoteException)))
/* */ {
/* 134 */ throw ((Exception)e);
/* */ }
/* */
/* 138 */ Transaction tx = invocation.getTransaction();
/* 139 */ if (tx == null)
/* */ {
/* */ try
/* */ {
/* 144 */ tx = this.tm.getTransaction();
/* 145 */ if (!TxUtils.isActive(tx))
/* 146 */ tx = null;
/* */ }
/* */ catch (Exception ex)
/* */ {
/* 150 */ this.log.warn("Unable to determine transaction context", ex);
/* */ }
/* */ }
/* 153 */ if (tx != null)
/* */ {
/* */ try
/* */ {
/* 157 */ tx.setRollbackOnly();
/* */ }
/* */ catch (SystemException ex)
/* */ {
/* 161 */ this.log.error("SystemException while setting transaction for rollback only", ex);
/* */ }
/* */ catch (IllegalStateException ex)
/* */ {
/* 166 */ this.log.error("IllegalStateException while setting transaction for rollback only", ex);
/* */ }
/* */
/* */ }
/* */
/* 172 */ boolean isLocal = (type == InvocationType.LOCAL) || (type == InvocationType.LOCALHOME);
/* */
/* 179 */ if (!inheritedTx)
/* */ {
/* 181 */ if ((e instanceof Exception))
/* */ {
/* 183 */ throw ((Exception)e);
/* */ }
/* 185 */ if ((e instanceof Error))
/* */ {
/* 187 */ throw ((Error)e);
/* */ }
/* */
/* 191 */ if (isLocal)
/* */ {
/* 193 */ String msg = formatException("Unexpected Throwable", e);
/* 194 */ throw new EJBException(msg);
/* */ }
/* */
/* 198 */ ServerException ex = new ServerException("Unexpected Throwable");
/* 199 */ ex.detail = e;
/* 200 */ throw ex;
/* */ }
/* */ Throwable cause;
/* 207 */ if ((e instanceof NoSuchEntityException))
/* */ {
/* 209 */ NoSuchEntityException nsee = (NoSuchEntityException)e;
/* */ Throwable cause;
/* 210 */ if (isLocal)
/* */ {
/* 212 */ cause = new NoSuchObjectLocalException(nsee.getMessage(), nsee.getCausedByException());
/* */ }
/* */ else
/* */ {
/* 217 */ Throwable cause = new NoSuchObjectException(nsee.getMessage());
/* */
/* 220 */ ((NoSuchObjectException)cause).detail = nsee.getCausedByException();
/* */ }
/* */ }
/* */ else
/* */ {
/* */ Throwable cause;
/* 226 */ if (isLocal)
/* */ {
/* */ Throwable cause;
/* 230 */ if ((e instanceof Exception))
/* */ {
/* 232 */ cause = e;
/* */ }
/* */ else
/* */ {
/* */ Throwable cause;
/* 234 */ if ((e instanceof Error))
/* */ {
/* 236 */ String msg = formatException("Unexpected Error", e);
/* 237 */ cause = new EJBException(msg);
/* */ }
/* */ else
/* */ {
/* 241 */ String msg = formatException("Unexpected Throwable", e);
/* 242 */ cause = new EJBException(msg);
/* */ }
/* */ }
/* */
/* */ }
/* */ else
/* */ {
/* 249 */ cause = e;
/* */ }
/* */
/* */ }
/* */
/* 254 */ if (isLocal)
/* */ {
/* 256 */ if ((cause instanceof TransactionRolledbackLocalException))
/* */ {
/* 258 */ throw ((TransactionRolledbackLocalException)cause);
/* */ }
/* */
/* 262 */ throw new TransactionRolledbackLocalException(cause.getMessage(), (Exception)cause);
/* */ }
/* */
/* 268 */ if ((cause instanceof TransactionRolledbackException))
/* */ {
/* 270 */ throw ((TransactionRolledbackException)cause);
/* */ }
/* */
/* 274 */ ex = new TransactionRolledbackException(cause.getMessage());
/* */
/* 276 */ ex.detail = cause;
/* 277 */ }throw ex;
/* */ }