} else if (cause instanceof HeuristicMixedException) {
throw new ApplicationException(cause);
} else if (cause instanceof HeuristicRollbackException) {
throw new ApplicationException(cause);
} else if (cause instanceof IllegalStateException) {
throw new SystemException(cause);
} else if (cause instanceof SecurityException) {
throw new SystemException(cause);
} else if (cause instanceof javax.transaction.SystemException) {
throw new SystemException(cause);
}
// wrap with application or system exception based on type
if (e instanceof HeuristicCompletionException) {
throw new ApplicationException(e);
} else if (e instanceof UnexpectedRollbackException) {
throw new ApplicationException(e);
}
throw new SystemException(e);
}
}