@Test(expected = IllegalArgumentException.class) public void testConfigure_NullUserTransaction() throws Exception { Jta.configure(transactionManager, null); }
public static void configure(TransactionManager transactionManager, UserTransaction userTransaction) { synchronized (initLock) { if (Jta.frozen) { if (transactionManager != Jta.transactionManager || userTransaction != Jta.userTransaction) { throw new IllegalStateException("JTA configured is frozen and attempt was made to reconfigure it."); } } if (userTransaction == null && transactionManager != null) { throw new IllegalArgumentException("TransactionManager has a value but UserTransaction is null, please provide a complete JTA configuration."); } if (userTransaction != null && transactionManager == null) { throw new IllegalArgumentException("UserTransaction has a value but TransactionManager is null, please provide a complete JTA configuration."); } Jta.transactionManager = transactionManager; Jta.userTransaction = userTransaction; Jta.frozen = true; } }
Jta { public static void configure(TransactionManager transactionManager, UserTransaction userTransaction) { synchronized (initLock) { if (Jta.frozen) { if (transactionManager != Jta.transactionManager || userTransaction != Jta.userTransaction) { throw new IllegalStateException("JTA configured is frozen and attempt was made to reconfigure it."); } } if (userTransaction == null && transactionManager != null) { throw new IllegalArgumentException("TransactionManager has a value but UserTransaction is null, please provide a complete JTA configuration."); } if (userTransaction != null && transactionManager == null) { throw new IllegalArgumentException("UserTransaction has a value but TransactionManager is null, please provide a complete JTA configuration."); } Jta.transactionManager = transactionManager; Jta.userTransaction = userTransaction; Jta.frozen = true; } } }
Jta { public static void configure(TransactionManager transactionManager, UserTransaction userTransaction) { synchronized (initLock) { if (Jta.frozen) { if (transactionManager != Jta.transactionManager || userTransaction != Jta.userTransaction) { throw new IllegalStateException("JTA configured is frozen and attempt was made to reconfigure it."); } } if (userTransaction == null && transactionManager != null) { throw new IllegalArgumentException("TransactionManager has a value but UserTransaction is null, please provide a complete JTA configuration."); } if (userTransaction != null && transactionManager == null) { throw new IllegalArgumentException("UserTransaction has a value but TransactionManager is null, please provide a complete JTA configuration."); } Jta.transactionManager = transactionManager; Jta.userTransaction = userTransaction; Jta.frozen = true; } } private  Jta(); }
Jta { public static void configure(TransactionManager transactionManager, UserTransaction userTransaction) { synchronized (initLock) { if (Jta.frozen) { if (transactionManager != Jta.transactionManager || userTransaction != Jta.userTransaction) { throw new IllegalStateException("JTA configured is frozen and attempt was made to reconfigure it."); } } if (userTransaction == null && transactionManager != null) { throw new IllegalArgumentException("TransactionManager has a value but UserTransaction is null, please provide a complete JTA configuration."); } if (userTransaction != null && transactionManager == null) { throw new IllegalArgumentException("UserTransaction has a value but TransactionManager is null, please provide a complete JTA configuration."); } Jta.transactionManager = transactionManager; Jta.userTransaction = userTransaction; Jta.frozen = true; } } private  Jta(); static void configure(TransactionManager transactionManager, UserTransaction userTransaction); static void reset(); static boolean isFrozen(); static boolean isEnabled(); static TransactionManager getTransactionManager(); static UserTransaction getUserTransaction(); }
Jta { public static void configure(TransactionManager transactionManager, UserTransaction userTransaction) { synchronized (initLock) { if (Jta.frozen) { if (transactionManager != Jta.transactionManager || userTransaction != Jta.userTransaction) { throw new IllegalStateException("JTA configured is frozen and attempt was made to reconfigure it."); } } if (userTransaction == null && transactionManager != null) { throw new IllegalArgumentException("TransactionManager has a value but UserTransaction is null, please provide a complete JTA configuration."); } if (userTransaction != null && transactionManager == null) { throw new IllegalArgumentException("UserTransaction has a value but TransactionManager is null, please provide a complete JTA configuration."); } Jta.transactionManager = transactionManager; Jta.userTransaction = userTransaction; Jta.frozen = true; } } private  Jta(); static void configure(TransactionManager transactionManager, UserTransaction userTransaction); static void reset(); static boolean isFrozen(); static boolean isEnabled(); static TransactionManager getTransactionManager(); static UserTransaction getUserTransaction();  }