[Webfunds-commits] java/webfunds/sox ValueAccount.java

Ian Grigg iang@cypherpunks.ai
Wed, 11 Apr 2001 15:22:01 -0400 (AST)


iang        01/04/11 15:22:01

  Modified:    webfunds/sox ValueAccount.java
  Log:
  tightened up definition of exceptions, failures;  removed confusing null

Revision  Changes    Path
1.26      +14 -6     java/webfunds/sox/ValueAccount.java

Index: ValueAccount.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/ValueAccount.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- ValueAccount.java	2001/03/20 23:16:02	1.25
+++ ValueAccount.java	2001/04/11 19:22:00	1.26
@@ -1,5 +1,5 @@
 /*
- * $Id: ValueAccount.java,v 1.25 2001/03/20 23:16:02 iang Exp $
+ * $Id: ValueAccount.java,v 1.26 2001/04/11 19:22:00 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -21,6 +21,8 @@
     extends SubAccount
 {
 
+    protected static String fix = "valAc ";
+
     /**
      * Create a new ValueAccount object.
      * A ValueAccount manages the transactions for a particular item,
@@ -47,10 +49,12 @@
      *  @param desc is binary description
      *  @param did is a suggested idempotent Id to use, ignore if invalid
      *
-     *  @throws SOXArgsException if item in payment is invalid
+     *  @throws SOXDepositException if deposit failed for "user" reasons,
+     *          e.g., there are no funds
+     *  @throws SOXArgsException if item in payment is for other subaccount
      *  @throws SOXLaterException if there is no ability to talk to the server
-     *  @throws SOXSubAccountException if something goes wrong with access
-     *  @throws SOXKeyException if something goes wrong with signing
+     *  @throws SOXSubAccountException if some unexpected error occurs
+     *  @throws SOXKeyException if something goes wrong with deposit signing
      */
     public MailItem[] deposit(AbstractPayment payment, String desc, String did)
           throws SOXSubAccountException, SOXLaterException, SOXKeyException,
@@ -216,6 +220,9 @@
         /*
          *  Anything else should never happen,
          *  if it does, fix it or move it above.
+         *
+         *  XXX: see the PaymentException thrown in ValueManager!
+         *  We should probably have an exception for a faulty Payment.
          */
         else
             throw new SOXSubAccountException(err, "Deposit Failure: " + txt);
@@ -374,7 +381,8 @@
         else if (err == Errors.ERROR_CANCELLED)  // already - good enough
 	{
 	    logmsg("cancelled?  (" + err + ") " + txt);
-            return null ;
+            throw new SOXDepositException(err, "already");
+            // return null ; can't deal with null, exception is better
 	}
         else if (err == Errors.ERROR_NOT_GOOD_KHID)
             // i mean, what are you trying to cancel this for???
@@ -519,7 +527,7 @@
         payment.setSignature(sig);
 
         boolean signed = payment.verify(acct.getPublicKey());
-        logmsg("PAYMENT IS SIGNED: " + signed);
+        logmsg("Payment is signed: " + signed);
         return payment;
     }
      */