protected void assertOpen() { if (isClosed()) throw new NoSuchElementException(_loc.get("closed").getMessage()); }
/** * Auto-configuration method for the default access type of base classes * with ACCESS_UNKNOWN */ public void setDefaultAccessType(String type) { if ("PROPERTY".equals(type.toUpperCase())) setDefaultAccessType(AccessCode.PROPERTY); else if ("FIELD".equals(type.toUpperCase())) setDefaultAccessType(AccessCode.FIELD); else throw new IllegalArgumentException(_loc.get("access-invalid", type).toString()); }
/** * Asserts that this query is a JPQL or Criteria Query. */ void assertJPQLOrCriteriaQuery() { String language = getLanguage(); if (JPQLParser.LANG_JPQL.equals(language) || QueryLanguages.LANG_PREPARED_SQL.equals(language) || CriteriaBuilderImpl.LANG_CRITERIA.equals(language)) { return; } else { throw new IllegalStateException(_loc.get("not-jpql-or-criteria-query").getMessage()); } }
public void assertRoot() { if (_roots == null || _roots.isEmpty()) throw new IllegalStateException(_loc.get("root-undefined").getMessage()); }
private void assertDefault(String name, boolean enabled, boolean deferred, boolean specified, int updateAction, int deleteAction) { boolean isDefault = StringUtil.isEmpty(name) && enabled && !deferred && deleteAction == org.apache.openjpa.jdbc.schema.ForeignKey.ACTION_RESTRICT && updateAction == org.apache.openjpa.jdbc.schema.ForeignKey.ACTION_RESTRICT && _columnNames.length == 0 && specified; if (!isDefault) throw new UserException(_loc.get("implicit-non-default-fk", _cls, getSourceFile()).getMessage()); }
public FetchConfiguration setLockTimeout(int timeout) { if (timeout == DEFAULT && _state.ctx != null) _state.lockTimeout = _state.ctx.getConfiguration().getLockTimeout(); else if (timeout != DEFAULT) { if (timeout < -1) { throw new IllegalArgumentException(_loc.get("invalid-timeout", timeout).getMessage()); } else { _state.lockTimeout = timeout; } } return this; }
public FetchConfiguration setLockTimeout(int timeout) { if (timeout == DEFAULT && _state.ctx != null) _state.lockTimeout = _state.ctx.getConfiguration().getLockTimeout(); else if (timeout != DEFAULT) { if (timeout < -1) { throw new IllegalArgumentException(_loc.get("invalid-timeout", timeout).getMessage()); } else { _state.lockTimeout = timeout; } } return this; }
private UnsupportedOperationException readOnly() { return new UnsupportedOperationException(_loc.get("read-only") .getMessage()); }
public void add(E o) { throw new UnsupportedOperationException(_loc.get("read-only") .getMessage()); }
public ArgumentException(Message msg, Throwable[] nested, Object failed, boolean fatal) { this(msg.getMessage(), nested, failed, fatal); }
public InvalidStateException(Message msg, Throwable[] nested, Object failed, boolean fatal) { this(msg.getMessage(), nested, failed, fatal); }
public String toString() { return getMessage(); } }
public boolean getRollbackOnly() { if (!isActive()) throw new IllegalStateException(_loc.get("no-transaction") .getMessage()); return _broker.getRollbackOnly(); }
protected void setInternalString(String str) { if (str == null) set(null); else throw new IllegalArgumentException(_loc.get("cant-set-string", getProperty()).getMessage()); }
public DuplicateKeyException(String key, Object firstVal, String secondVal) { super(_loc.get("dup-key", key, firstVal, secondVal).getMessage()); } }
<X,Y> void validate(Field mField, Member<X, Y> member) { if (!ParameterizedType.class.isInstance(mField.getGenericType())) { throw new IllegalArgumentException(_loc.get("meta-bad-field", mField).getMessage()); } ParameterizedType mfType = (ParameterizedType)mField.getGenericType(); java.lang.reflect.Type[] args = mfType.getActualTypeArguments(); java.lang.reflect.Type owner = args[0]; if (member.getDeclaringType().getJavaType() != owner) throw new IllegalArgumentException(_loc.get("meta-bad-field-owner", mField, owner).getMessage()); }
/** * Returns a SAXException with the source file name and the given error * message. */ protected SAXException getException(Message msg) { return new SAXException(getSourceName() + currentLocation() + ": " + msg.getMessage()); }
public <X> X get(int i, Class<X> type) { if (i >= values.length || i < 0) { throw new IllegalArgumentException(_loc.get("tuple-exceeded-size", i, values.length).getMessage()); } Object val = values[i]; return assertAndConvertType(""+i, val, type); }
protected Connection getSimpleConnection(Properties props) throws SQLException { Connection con = getSimpleDriver().connect(_connectionURL, props == null? new Properties() : props); if (con == null) { throw new SQLException(_eloc.get("poolds-null", _connectionDriverName, _connectionURL).getMessage()); } return con; }
void assertDefault(ForeignKey fk) { boolean isDefault = StringUtils.isEmpty(fk.name()) && fk.enabled() && !fk.deferred() && fk.deleteAction() == ForeignKeyAction.RESTRICT && fk.updateAction() == ForeignKeyAction.RESTRICT && fk.columnNames().length == 0 && fk.specified(); if (!isDefault) throw new UserException(_loc.get("implicit-non-default-fk", _cls, getSourceFile()).getMessage()); }