use of com.sun.jdo.api.persistence.support.JDOUserException in project Payara by payara.
the class Vector method setElementAt.
/**
* ------------------Public Methods----------------
*/
/**
* Sets the component at the specified <code>index</code> of this
* vector to be the specified object. The previous component at that
* position is discarded.<p>
*
* @param obj what the component is to be set to.
* @param index the specified index.
* @exception ArrayIndexOutOfBoundsException if the index was invalid.
* @see java.util.Vector
*/
public synchronized void setElementAt(Object obj, int index) {
throwUnsupportedOption();
if (obj == null) {
if (allowNulls == false) {
throw new JDOUserException(I18NHelper.getMessage(messages, // NOI18N
"sco.nulls_not_allowed"));
}
// It is actualy remove
this.removeElementAt(index);
}
if (elementType == null || elementType.isAssignableFrom(obj.getClass())) {
// Mark the field as dirty
StateManager stateManager = this.makeDirty();
Object o = super.elementAt(index);
super.setElementAt(obj, index);
if (added.remove(o) == false)
removed.add(o);
if (removed.remove(obj) == false)
added.add(obj);
// Apply updates
this.applyUpdates(stateManager, true);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages, "sco.classcastexception", // NOI18N
elementType.getName()), new ClassCastException(), new Object[] { obj });
}
}
use of com.sun.jdo.api.persistence.support.JDOUserException in project Payara by payara.
the class Vector method add.
/**
* Appends the specified element to the end of this Vector.
*
* @param o element to be appended to this Vector.
* @return true (as per the general contract of Collection.add).
* @see java.util.Vector
*/
public synchronized boolean add(Object o) {
if (allowNulls == false && o == null) {
throw new JDOUserException(I18NHelper.getMessage(messages, // NOI18N
"sco.nulls_not_allowed"));
}
if (elementType == null || elementType.isAssignableFrom(o.getClass())) {
// Mark the field as dirty
StateManager stateManager = this.makeDirty();
if (removed.remove(o) == false)
added.add(o);
boolean modified = super.add(o);
// Apply updates
this.applyUpdates(stateManager, modified);
return modified;
} else {
throw new JDOUserException(I18NHelper.getMessage(messages, "sco.classcastexception", // NOI18N
elementType.getName()), new ClassCastException(), new Object[] { o });
}
}
use of com.sun.jdo.api.persistence.support.JDOUserException in project Payara by payara.
the class Vector method addAll.
/**
* Appends all of the elements in the specified Collection to the end of
* this Vector, in the order that they are returned by the specified
* Collection's Iterator.
*
* @param c elements to be inserted into this Vector.
* @see java.util.Vector
*/
public synchronized boolean addAll(Collection c) {
if (allowNulls == false && c.contains(null)) {
throw new JDOUserException(I18NHelper.getMessage(messages, // NOI18N
"sco.nulls_not_allowed"));
}
java.util.Vector errc = new java.util.Vector();
if (elementType != null) {
// iterate the collection and make a list of wrong elements.
Iterator i = c.iterator();
while (i.hasNext()) {
Object o = i.next();
if (!elementType.isAssignableFrom(o.getClass()))
errc.add(o);
}
}
if (errc != null && errc.size() > 0) {
throw new JDOUserException(I18NHelper.getMessage(messages, "sco.classcastexception", // NOI18N
elementType.getName()), new ClassCastException(), errc.toArray());
}
// Mark the field as dirty
StateManager stateManager = this.makeDirty();
removed.removeAll(c);
added.addAll(c);
boolean modified = super.addAll(c);
// Apply updates
this.applyUpdates(stateManager, modified);
return modified;
}
use of com.sun.jdo.api.persistence.support.JDOUserException in project Payara by payara.
the class Vector method insertElementAt.
/**
* Inserts the specified object as a component in this vector at the
* specified <code>index</code>.
*
* @param obj the component to insert.
* @param index where to insert the new component.
* @exception ArrayIndexOutOfBoundsException if the index was invalid.
* @see java.util.Vector
*/
public synchronized void insertElementAt(Object obj, int index) {
if (allowNulls == false && obj == null) {
throw new JDOUserException(I18NHelper.getMessage(messages, // NOI18N
"sco.nulls_not_allowed"));
}
if (elementType == null || elementType.isAssignableFrom(obj.getClass())) {
// Mark the field as dirty
StateManager stateManager = this.makeDirty();
super.insertElementAt(obj, index);
if (removed.remove(obj) == false)
added.add(obj);
// Apply updates
this.applyUpdates(stateManager, true);
} else {
throw new JDOUserException(I18NHelper.getMessage(messages, "sco.classcastexception", // NOI18N
elementType.getName()), new ClassCastException(), new Object[] { obj });
}
}
use of com.sun.jdo.api.persistence.support.JDOUserException in project Payara by payara.
the class TransactionImpl method commitComplete.
/**
* Lower-level complete-commit method - phase 2.
*
* State transition:
* STATUS_PREPARED starting state
* STATUS_COMMITTING starting to do final phase
* commitResources() maybe one-phase
* STATUS_COMMITTED
* afterCompletion() no longer active
*
* For exceptions see commit() method.
*/
private void commitComplete() {
if (this.tracing)
// NOI18N
this.traceCallInfo("commitComplete", TRACE_ONE_PHASE, null);
//
if (this.status == Status.STATUS_ROLLING_BACK) {
// st);
this.setStatus(Status.STATUS_ROLLING_BACK);
internalRollback();
} else if (this.status == Status.STATUS_PREPARED) {
this.setStatus(Status.STATUS_COMMITTING);
internalCommit();
} else {
throw new JDOUserException(I18NHelper.getMessage(messages, // NOI18N
"transaction.transactionimpl.commitprepare.wrongstatus", // NOI18N
"commitComplete", // NOI18N
"STATUS_PREPARED", this.statusString(this.status)));
}
}
Aggregations