Author: max.andersen(a)jboss.com
Date: 2007-10-26 10:23:14 -0400 (Fri, 26 Oct 2007)
New Revision: 4541
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java
Log:
fixed some annoying NPE's
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java 2007-10-26
13:50:20 UTC (rev 4540)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeTransactionManagerLookup.java 2007-10-26
14:23:14 UTC (rev 4541)
@@ -58,12 +58,16 @@
public void commit() throws RollbackException, HeuristicMixedException,
HeuristicRollbackException, SecurityException,
IllegalStateException, SystemException {
- current.commit();
+ if(current!=null) current.commit();
}
public int getStatus() throws SystemException {
- return current.getStatus();
+ if(current!=null) {
+ return current.getStatus();
+ } else {
+ return Status.STATUS_NO_TRANSACTION;
+ }
}
public Transaction getTransaction() throws SystemException {
@@ -72,17 +76,16 @@
public void resume(Transaction tx) throws InvalidTransactionException,
IllegalStateException, SystemException {
- current = (FakeTransaction) tx;
+ current = (FakeTransaction) tx;
}
public void rollback() throws IllegalStateException, SecurityException,
SystemException {
- current.rollback();
-
+ if(current!=null) current.rollback();
}
public void setRollbackOnly() throws IllegalStateException, SystemException {
- current.setRollbackOnly();
+ if(current!=null) current.setRollbackOnly();
}
public void setTransactionTimeout(int t) throws SystemException {