What should be the behavior of calling resolveFault() on a transient
DataObject?
Currently nothing happens. Would it be reasonable for it to throw the same
FaultFailureException that an unresolvable hollow object does?
public void resolveFault() {
if (getPersistenceState() == PersistenceState.HOLLOW && dataContext
!= null) {
dataContext.getObjectStore().resolveHollow(this);
if (getPersistenceState() != PersistenceState.COMMITTED) {
throw new FaultFailureException(
"Error resolving fault, no matching row exists in
the database for ObjectId: "
+ getObjectId());
}
}
}
I'm having to write ugly pieces of code that look like what's below, but
maybe that's just how it should be done. It seems like it was better before
as I only had to check to see if the object state was transient. Now I have
to check for transient state in addition to catching an exception part of
the time.
try
{
if (aPaymentMethod.getPersistenceState() ==
PersistenceState.TRANSIENT)
throw new
FaultFailureException("PaymentMethod.state=transient");
// If the fault doesn't resolve, then the payment
method must have been invalidated
aPaymentMethod.resolveFault();
// blah blah blah
}
catch (FaultFailureException e)
{
paymentType = "deleted payment method";
}
On the other hand, I could go back to this code which is just an extra try
condition.
try
{
// If the fault doesn't resolve, then the payment
method must have been invalidated
aPaymentMethod.resolveFault();
}
catch (FaultFailureException e) { //ignore }
if (aPaymentMethod.getPersistenceState() ==
PersistenceState.TRANSIENT)
paymentType = "deleted payment method";
else
{
// blah blah blah
}
Thoughts?
-Mike
This archive was generated by hypermail 2.0.0 : Fri Oct 22 2004 - 16:48:58 EDT