/** * Throw an error with a localized message identified by the given key. */ PCState error(String key, StateManagerImpl context) { throw new InvalidStateException(_loc.get(key)). setFailedObject(context.getManagedInstance()); }
/** * Throw an exception if the context is closed. The exact message and * content of the exception varies whether TRACE is enabled or not. */ public void assertOpen() { if (_closed) { if (_closedException == null) // TRACE not enabled throw new InvalidStateException(_loc.get("closed-notrace")) .setFatal(true); else { OpenJPAException e = new InvalidStateException( _loc.get("closed"), _closedException).setFatal(true); e.setCause(_closedException); throw e; } } }
/** * Gets the GlobalTransaction ID of the WebSphere managed transaction. * If no Global Transaction is active null will be returned. * * @return Null if a global transaction is not active or if an error * occurs. byte[] id if a global transaction is active. */ private byte[] getGlobalId() { try { return (byte[]) _getGlobalId.invoke(_extendedTransaction, null); } catch (Exception e) { throw new InvalidStateException(_loc .get("was-reflection-exception")).setCause(e); } }
class Foo { public static enum fooState { young, adult, old; } public Foo(fooState i) { switch(i) { case young: ... break; case adult: ... break; case old: ... break; default: throw new InvalidStateException(); } ... }
/** * Throws a {@link UserException} if a transaction is active. The thrown * exception will contain all the Brokers with active transactions as * failed objects in the nested exceptions. */ private void assertNoActiveTransaction() { Collection<Throwable> excs; if (_transactional.isEmpty()) return; excs = new ArrayList<Throwable>(_transactional.size()); for (Collection<Broker> brokers : _transactional.values()) { for (Broker broker : brokers) { excs.add(new InvalidStateException(_loc.get("active")).setFailedObject(broker)); } } if (!excs.isEmpty()) throw new InvalidStateException(_loc.get("nested-exceps")). setNestedThrowables((Throwable[]) excs.toArray(new Throwable[excs.size()])); }
public InvalidStateException(Message msg, Object failed) { super(msg); setFailedObject(failed); }
String str = ultimaalt.getText(); if (str == null) { throw new NullPointerException("No text captured."); } if (str.isEmpty()) { throw new InvalidStateException("No text captured."); }
/** * Throws a {@link UserException} if a transaction is active. The thrown * exception will contain all the Brokers with active transactions as * failed objects in the nested exceptions. */ private void assertNoActiveTransaction() { Collection<Throwable> excs; if (_transactional.isEmpty()) return; excs = new ArrayList<Throwable>(_transactional.size()); for (Collection<Broker> brokers : _transactional.values()) { for (Broker broker : brokers) { excs.add(new InvalidStateException(_loc.get("active")).setFailedObject(broker)); } } if (!excs.isEmpty()) throw new InvalidStateException(_loc.get("nested-exceps")). setNestedThrowables((Throwable[]) excs.toArray(new Throwable[excs.size()])); }
public InvalidStateException(Message msg, Object failed) { super(msg); setFailedObject(failed); }
/** * Throw an error with a localized message identified by the given key. */ PCState error(String key, StateManagerImpl context) { throw new InvalidStateException(_loc.get(key)). setFailedObject(context.getManagedInstance()); }
/** * Unimplemented, WAS does not provide this level of control. Throws an * IllegalStateException */ public void resume(Transaction arg0) throws IllegalStateException, InvalidTransactionException, SystemException { throw new InvalidStateException(_loc.get("was-unsupported-op", "resume")); }
/** * Throw an exception if the context is closed. The exact message and * content of the exception varies whether TRACE is enabled or not. */ public void assertOpen() { if (_closed) { if (_closedException == null) // TRACE not enabled throw new InvalidStateException(_loc.get("closed-notrace")) .setFatal(true); else { OpenJPAException e = new InvalidStateException( _loc.get("closed"), _closedException).setFatal(true); e.setCause(_closedException); throw e; } } }
/** * Throw an exception if the factory is closed. The exact message and * content of the exception varies whether TRACE is enabled or not. */ private void assertOpen() { if (_closed) { if (_closedException == null) // TRACE not enabled throw new InvalidStateException(_loc .get("closed-factory-notrace")); else throw new InvalidStateException(_loc.get("closed-factory")) .setCause(_closedException); } }
/** * Throws a {@link UserException} if a transaction is active. The thrown * exception will contain all the Brokers with active transactions as * failed objects in the nested exceptions. */ private void assertNoActiveTransaction() { Collection<Throwable> excs; if (_transactional.isEmpty()) return; excs = new ArrayList<Throwable>(_transactional.size()); for (Collection<Broker> brokers : _transactional.values()) { for (Broker broker : brokers) { excs.add(new InvalidStateException(_loc.get("active")).setFailedObject(broker)); } } if (!excs.isEmpty()) throw new InvalidStateException(_loc.get("nested-exceps")). setNestedThrowables((Throwable[]) excs.toArray(new Throwable[excs.size()])); }
public InvalidStateException(Message msg, Object failed) { super(msg); setFailedObject(failed); }
/** * Throw an error with a localized message identified by the given key. */ PCState error(String key, StateManagerImpl context) { throw new InvalidStateException(_loc.get(key)). setFailedObject(context.getManagedInstance()); }
/** * Unimplemented, WAS does not provide this level of control. Throws an * IllegalStateException */ public boolean delistResource(XAResource arg0, int arg1) throws IllegalStateException, SystemException { throw new InvalidStateException(_loc.get("was-unsupported-op", "delistResource")); }
/** * Throw an exception if the context is closed. The exact message and * content of the exception varies whether TRACE is enabled or not. */ public void assertOpen() { if (_closed) { if (_closedException == null) // TRACE not enabled throw new InvalidStateException(_loc.get("closed-notrace")) .setFatal(true); else { OpenJPAException e = new InvalidStateException( _loc.get("closed"), _closedException).setFatal(true); e.setCause(_closedException); throw e; } } }
/** * Throw an exception if the factory is closed. The exact message and * content of the exception varies whether TRACE is enabled or not. */ public void assertOpen() { if (_closed) { if (_closedException == null) // TRACE not enabled throw new InvalidStateException(_loc .get("closed-factory-notrace")); else throw new InvalidStateException(_loc.get("closed-factory")) .setCause(_closedException); } }
public InvalidStateException(Message msg, Object failed) { super(msg); setFailedObject(failed); }