/** * Creates a new MappingRuntimeException * * @param message the error message **/ public MappingRuntimeException(String message, Object[] args) { super(Messages.format(message, args)); } // -- MappingRuntimeException
/** * Creates a new MappingRuntimeException * * @param message the error message **/ public MappingRuntimeException(String message) { super(Messages.message(message)); } // -- MappingRuntimeException
/** * Set the default locale to use for loading messages. Calling this method will reload all the * messages based on the new locale name. */ public static void setDefaultLocale() { setLocale(Locale.getDefault()); }
protected void execute(final Object conn, final AccessMode accessMode) throws PersistenceException { _lastIdentity = null; try { _stmt = ((Connection) conn).prepareCall(_call); ((CallableStatement) _stmt).registerOutParameter(1, ORACLE_CURSOR_TYPE); for (int i = 0; i < _values.length; ++i) { _stmt.setObject(i + 2, _values[i]); _values[ i ] = null; } _stmt.execute(); _rs = (ResultSet) ((CallableStatement) _stmt).getObject(1); } catch (SQLException except) { if (_stmt != null) { try { _stmt.close(); } catch (SQLException e2) { _log.warn (Messages.message ("persist.stClosingFailed"), e2); } } throw new PersistenceException(Messages.format("persist.nested", except)); } }
/** * {@inheritDoc} * @see org.castor.persist.TransactionContext#close() */ public final synchronized void close() throws TransactionAbortedException { if (_status != Status.STATUS_ACTIVE && _status != Status.STATUS_MARKED_ROLLBACK) { throw new IllegalStateException(Messages .message("persist.missingEnd")); } try { // Go through all the connections opened in this transaction, // close them one by one. closeConnections(); } catch (Exception except) { // Any error that happens, we're going to rollback the transaction. _status = Status.STATUS_MARKED_ROLLBACK; throw new TransactionAbortedException(Messages.format( "persist.nested", except), except); } }
/** * Format the named message using two argument and return the full message text. * * @param message The message name * @param arg1 The first argument * @param arg2 The second argument * @return The full message text */ public static String format(final String message, final Object arg1, final Object arg2) { return format(message, new Object[] {arg1, arg2}); }
/** * Generate a new key for the specified table as "MAX(primary_key) + 1". * If there is no records in the table, then the value 1 is returned. * <br/> * {@inheritDoc} */ public Object generateKey(final Connection conn, final String tableName, final String primKeyName) throws PersistenceException { PreparedStatement stmt = null; try { String sql = getQueryExpression(tableName, primKeyName); stmt = conn.prepareStatement(sql); ResultSet rs = stmt.executeQuery(); return _typeHandler.getNextValue(rs); } catch (SQLException ex) { throw new PersistenceException(Messages.format( "persist.keyGenSQL", getClass().getName(), ex.toString()), ex); } finally { if (stmt != null) { try { stmt.close(); } catch (SQLException ex) { LOG.warn (Messages.message ("persist.stClosingFailed"), ex); } } } }
public MappingException(String message) { super(Messages.message(message)); }
/** * Creates a new MappingRuntimeException * * @param exception the Exception which caused this Exception. * @param message the error message **/ public MappingRuntimeException(Throwable exception, String message) { super(Messages.format("mapping.nested", message)); _exception = exception; } // -- MappingRuntimeException
/** * @inheritDoc */ public void beforeCompletion() { // XXX [SMH]: Find another test for txNotInProgress if (_transaction == null || _ctx == null || !_ctx.isOpen()) { throw new IllegalStateException(Messages.message("jdo.txNotInProgress")); } registerSynchronizables(); if (_ctx.getStatus() == Status.STATUS_MARKED_ROLLBACK) { try { _transaction.setRollbackOnly(); } catch (SystemException except) { _log.warn(Messages.format("jdo.warnException", except)); } return; } try { _ctx.prepare(); } catch (TransactionAbortedException tae) { _log.error(Messages.format("jdo.txAbortedMarkRollback", tae.getMessage()), tae); try { _transaction.setRollbackOnly(); } catch (SystemException se) { _log.fatal(Messages.format("jdo.txMarkRollbackFailure", se.getMessage()), se); } _ctx.rollback(); } }
public ValidityException(String message) { super(Messages.message(message)); }
/** * Format the named message using a single argument and return the full message text. * * @param message The message name * @param arg1 The first argument * @return The full message text */ public static String format(final String message, final Object arg1) { return format(message, new Object[] {arg1}); }
throw new TransactionNotInProgressException(Messages.message("jdo.txNotInProgress")); throw new TransactionAbortedException(Messages.message("jdo.txRollback")); _ctx.commit(); } catch (TransactionAbortedException except) { _log.info(Messages.format("jdo.txAborted", except.getMessage()), except); _ctx.rollback(); throw except;
ObjectDeletedWaitingForLockException() { super(Messages.message("persist.deletedWaitingForLock")); }
public MappingException(String message, Object arg1) { super(Messages.format(message, arg1)); }
/** * @inheritDoc */ public void begin() throws PersistenceException { throw new IllegalStateException(Messages.message("jdo.txInJ2EE")); }
/** * Format the named message using three argument and return the full message text. * * @param message The message name * @param arg1 The first argument * @param arg2 The second argument * @param arg3 The third argument * @return The full message text */ public static String format(final String message, final Object arg1, final Object arg2, final Object arg3) { return format(message, new Object[] {arg1, arg2, arg3}); }
/** * @inheritDoc */ public void rollback() throws TransactionNotInProgressException { throw new IllegalStateException(Messages.message("jdo.txInJ2EE")); }
public ValidityException(String message, Object arg1) { super(Messages.format(message, arg1)); }
public void endDocument() throws SAXException { if (_insideRoot) throw new SAXException(Messages.message("dsml.documentRootStillOpen")); }