[Webfunds-commits] java/webfunds/client/sox SOXWallet.java

Ian Grigg iang@cypherpunks.ai
Thu, 6 Jul 2000 21:53:52 -0400 (AST)


iang        00/07/06 21:53:52

  Modified:    webfunds/client SimplePaymentFrame.java
               webfunds/client/sox SOXWallet.java
  Log:
  1. fixed no-money Payment No button causing NPE.
  2. added back in the description field in the permission for no-money payment

Revision  Changes    Path
1.43      +4 -1      java/webfunds/client/SimplePaymentFrame.java

Index: SimplePaymentFrame.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/SimplePaymentFrame.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- SimplePaymentFrame.java	2000/04/13 02:34:14	1.42
+++ SimplePaymentFrame.java	2000/07/07 01:53:51	1.43
@@ -1,5 +1,5 @@
 /*
- * $Id: SimplePaymentFrame.java,v 1.42 2000/04/13 02:34:14 iang Exp $
+ * $Id: SimplePaymentFrame.java,v 1.43 2000/07/07 01:53:51 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -352,6 +352,9 @@
         byte[] pay = wallet.makePayment(contractid, source, tgt,
                              longamount, description.getText().getBytes(),
                              validFrom, validTill);
+
+        if (pay == null)     // wallet encountered error, already reported
+            return ;
 
         //
         // Two sorts - direct transfer or make payment for email.



1.127     +13 -7     java/webfunds/client/sox/SOXWallet.java

Index: SOXWallet.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/SOXWallet.java,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -r1.126 -r1.127
--- SOXWallet.java	2000/07/06 19:32:50	1.126
+++ SOXWallet.java	2000/07/07 01:53:52	1.127
@@ -1,4 +1,4 @@
-/* $Id: SOXWallet.java,v 1.126 2000/07/06 19:32:50 gelderen Exp $
+/* $Id: SOXWallet.java,v 1.127 2000/07/07 01:53:52 iang Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * The WebFunds Development Team.  All Rights Reserved.
@@ -70,11 +70,13 @@
     // these should probably be protected
     public void error(String e)
     {
-        if(e==null) 
-            return;
-
         logmsg("[ " + e + " ]");
-        context.getUInterface(this).errorMessage(e);
+
+        try {
+            context.getUInterface(this).errorMessage(e);
+        } catch (Exception ex) {
+            /* ignore exception whilst waiting for wallet separation */
+        }
     }
     public void aviso(String e)   // aviso is info, but info is used elsewhere
     {
@@ -466,8 +468,10 @@
      *     * checks balances, and
      *     * saves the pending payment for later reconciliation.
      *  and delivers the pure payment back.
+     *
      *  As a principle, we deal in Units of Contract (underlying units)
      *  and not Units of Account (displayed units).
+     *
      * @param target the target account, may be bearer
      * @param source the source account where funds are written from
      * @param contractid is the name of the contract
@@ -540,10 +544,12 @@
                 am = contract.getAmount(amount);
                 name = contract.getName();
             }
+            String descString = Hex.printable(desc);
 
             String q = "There is not enough for a payment of\n" +
                        "\n" +
                        "                   " + am + " " + name + "\n" +
+                       "                   \"" + descString + "\"\n" +
                        "\n" +
                        "and it may bounce when deposited!\n\n\n" +
                        "Are you sure you want to make this payment?";
@@ -604,14 +610,14 @@
         try {
             thing = Armoury.decode(pay);
             return thing;
-        } catch (Exception ex) { ex=null; } // jikes
+        } catch (Exception ex) { }
 
         logmsg("failed on Armoury.decode, trying decodeByteArray");
 
         try {
             thing = Armoury.decodeByteArray("SOX MESSAGE", pay);
             return thing;
-        } catch (Exception ex) { ex=null; } // jikes
+        } catch (Exception ex) { }
 
         logmsg("failed on Armoury.decodeByteArray");