[Webfunds-commits] java/webfunds/client/util UpgradesManager.java
Ian Grigg
iang@cypherpunks.ai
Sun, 15 Apr 2001 20:41:06 -0400 (AST)
iang 01/04/15 20:41:06
Modified: webfunds/sox Errors.java ValueAccount.java
webfunds/sox/server SmartServer.java
webfunds/sox/value WalletException.java
webfunds/client/sox WalletException.java
webfunds/client/util UpgradesManager.java
Log:
Added new errors for used Pid/Did, as opposed to 'already'
Revision Changes Path
1.20 +32 -14 java/webfunds/sox/Errors.java
Index: Errors.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Errors.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Errors.java 2001/04/11 19:15:21 1.19
+++ Errors.java 2001/04/16 00:41:04 1.20
@@ -1,5 +1,5 @@
/*
- * $Id: Errors.java,v 1.19 2001/04/11 19:15:21 iang Exp $
+ * $Id: Errors.java,v 1.20 2001/04/16 00:41:04 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -31,7 +31,7 @@
/**
- * 10-19 are routine transaction errors.
+ * 10-16, 18-19 are routine transaction errors.
* Passed up as an exception number.
*/
public static final int ERROR_NO_FUNDS = 10;
@@ -41,17 +41,28 @@
public static final int ERROR_TOO_YOUNG = 14;
public static final int ERROR_UNKNOWN_TARGET = 15;
public static final int ERROR_UNKNOWN_SOURCE = 16;
- public static final int ERROR_ILLEGAL_DEBIT = 17; // mint account
- public static final int ERROR_ALREADY = 18; // pid already set
- public static final int ERROR_DEP_ALREADY = 19; // did already set
+ /** deprecated value */
+ public static final int ERROR_ILLEGAL_DEBIT_OLD = 17; // mint account
+ /** pid is already used in transaction of same value, is repeat? */
+ public static final int ERROR_ALREADY = 18;
+ /** did is already used in transaction of same value, is repeat? */
+ public static final int ERROR_DEP_ALREADY = 19;
+
+ /**
+ * 17,20-29 are more unusual transaction errors.
+ */
+ /** that action is specifically not allowed on this (limited) account */
+ public static final int ERROR_NOT_PERMITTED = 20;
+ /** that action is not supported as a service on this server */
+ public static final int ERROR_NOT_SUPPORTED = 21;
+ /** pid is already used in unrelated transaction (different value) */
+ public static final int ERROR_PID_USED = 22;
+ /** did is already used in unrelated transaction (different value) */
+ public static final int ERROR_DID_USED = 23;
+ /** this is a special mint account, cannot do that */
+ public static final int ERROR_ILLEGAL_DEBIT = 24; // mint account
/**
- * 20-29 are more unusual transaction errors.
- */
- public static final int ERROR_NOT_PERMITTED = 20; // limited account
- public static final int ERROR_NOT_SUPPORTED = 21; // by this Ivan
-
- /**
* 30-39 are bad arguments within a deposit or payment.
* Something is probably wrong with the code if these occur.
*/
@@ -120,13 +131,20 @@
"this payment is too early - not yet in time window",
"unknown target account",
"unknown source account",
- "illegal debit",
- "this payment has been made already (pid previously used)",
+ "illegal debit (old)",
+ "this payment has been made already (pid,value used)",
"deposited already (did has previously been used)",
/* 20 */ "operation not permitted on this account",
"unsupported transaction type on this issuer",
- "", "", "", "", "", "", "", "",
+ "another payment of different value has already used this pid",
+ "another deposit of different value has already used this did",
+ "illegal debit",
+ "",
+ "",
+ "",
+ "",
+ "",
/* 30 */ "Message within Deposit is not a Payment",
"payment not signed",
1.28 +6 -74 java/webfunds/sox/ValueAccount.java
Index: ValueAccount.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/ValueAccount.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ValueAccount.java 2001/04/13 16:31:05 1.27
+++ ValueAccount.java 2001/04/16 00:41:04 1.28
@@ -1,5 +1,5 @@
/*
- * $Id: ValueAccount.java,v 1.27 2001/04/13 16:31:05 iang Exp $
+ * $Id: ValueAccount.java,v 1.28 2001/04/16 00:41:04 iang Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -7,7 +7,7 @@
package webfunds.sox;
import java.io.*;
-import java.util.Date; // deprecate this, SOX can deal in millisecs!
+// import java.util.Date; // deprecate this, SOX can deal in millisecs!
import java.security.KeyException;
import webfunds.comms.NetWatcher;
@@ -209,11 +209,14 @@
(err == Errors.ERROR_TOO_OLD) ||
(err == Errors.ERROR_TOO_YOUNG) ||
(err == Errors.ERROR_UNKNOWN_SOURCE) ||
+ (err == Errors.ERROR_ILLEGAL_DEBIT_OLD) ||
(err == Errors.ERROR_ILLEGAL_DEBIT) ||
(err == Errors.ERROR_ALREADY) ||
+ (err == Errors.ERROR_PID_USED) ||
(err == Errors.ERROR_NOT_ENUF) ||
(err == Errors.ERROR_UNAVAILABLE) ||
- ( (err == Errors.ERROR_DEP_ALREADY) && !myDID )
+ ( (err == Errors.ERROR_DEP_ALREADY) && !myDID ) ||
+ ( (err == Errors.ERROR_DID_USED) && !myDID )
)
throw new SOXDepositException(err, txt);
@@ -438,10 +441,7 @@
long validity)
throws SOXSubAccountException
{
- // before was wrong, was set to 0, but changed to take the current
- // time, which gets adjusted later.
long now = System.currentTimeMillis();
- // Date validTill = new Date(now.getTime() + validity*1000);
return createPayment(target, qty, desc, now, validity);
}
@@ -463,74 +463,6 @@
return createPayment(target, qty, desc, false, from, validTill, null);
}
- /**
- * No real need for this, let caller do it directly?
- *
- * Create a rollover payment. This causes all funds to transfer to the
- * target and the source to be *FROZEN* at the issuer ....
- * Not working yet!
- *
- * We don't use the word freeze because accounts also get frozen
- * here.
- *
- * @param target the target account where all funds end up for all subs
- * @param qty the number of items of which the payment is for
- * @param desc a description of what this payment is for (optional)
- * @param validity the payment is valid for validity seconds (from now)
- public Payment createRollover(AccountId target, byte[] desc, long validTill)
- throws SOXSubAccountException
- {
- long now = System.currentTimeMillis();
- long validTill = now + validity*1000;
- return createPayment(target, 0, desc, true, now, validTill, null);
- }
- */
-
- /**
- * Create a payment, with all params specified.
- *
- * @param target the target account
- * @param qty the number of items of which the payment is for
- * @param desc a description of what this payment is for (optional)
- * @param boolean whether or not the payment is a rollover payment
- * @param from the time from which the payment is valid
- * @param till the time at which the payment will expire
- * @param pid a unique payment identifier, replaced if empty
-
-What is the point of a Date Conversion method? Make the caller do that.
-
- public Payment createPayment(AccountId target, long qty, byte[] desc,
- boolean changekey, Date from, Date till,
- String pid)
- throws SOXSubAccountException
- {
- checkFrozen("createPayment Date");
-
- if (pid == null || pid.length() == 0)
- pid = "P" + System.currentTimeMillis();
-
- Date validFrom = adjustTime(from, true);
- Date validTill = adjustTime(till, false);
-
- Payment payment = new Payment(pid, acct.getId(), target, itemId, qty,
- desc, changekey,
- validFrom.getTime(), validTill.getTime());
- byte[] paymentData = payment.encode();
-
- byte[] sig;
- try {
- // byte[] sig = Crypto.sign(acct.getKey(), paymentData);
- sig = acct.sign(paymentData);
- } catch(KeyException e) {
- throw new InternalError("Unexpected exception: "+e.getMessage());
- }
- payment.setSignature(sig);
-
- boolean signed = payment.verify(acct.getPublicKey());
- logmsg("Payment is signed: " + signed);
- return payment;
- }
- */
/**
* Create a payment, with all params specified.
1.5 +6 -2 java/webfunds/sox/server/SmartServer.java
Index: SmartServer.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/server/SmartServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SmartServer.java 2001/04/12 04:48:01 1.4
+++ SmartServer.java 2001/04/16 00:41:05 1.5
@@ -30,7 +30,7 @@
* switch whenever a problem is detected.
*
* This was webfunds.sox.SmartIssuer.
- * @version $Id: SmartServer.java,v 1.4 2001/04/12 04:48:01 iang Exp $
+ * @version $Id: SmartServer.java,v 1.5 2001/04/16 00:41:05 iang Exp $
*/
public class SmartServer
extends Debug implements Server // , IssuerFinder
@@ -152,10 +152,12 @@
public boolean retryNow()
throws SOXLaterException
{
- boolean retry = false;
+ // boolean retry = false;
+ logmsg("checking timeout count of " + timeouts + " against " + TIMEOUT);
if (timeouts++ > TIMEOUT)
{
timeouts = 0;
+ logmsg("too many timeouts, refresh!");
return ssds.refreshSSD(ssd);
}
@@ -164,6 +166,8 @@
{
if (servers[i].tooDead())
{
+ timeouts = 0;
+ logmsg("server " + i + " is too Dead, refresh!");
return ssds.refreshSSD(ssd);
}
}
1.10 +2 -2 java/webfunds/sox/value/WalletException.java
Index: WalletException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/value/WalletException.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WalletException.java 2001/04/12 04:53:37 1.9
+++ WalletException.java 2001/04/16 00:41:05 1.10
@@ -1,5 +1,5 @@
/*
- * $Id: WalletException.java,v 1.9 2001/04/12 04:53:37 iang Exp $
+ * $Id: WalletException.java,v 1.10 2001/04/16 00:41:05 iang Exp $
*
* Copyright (c) 2000 Systemics Inc on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -64,7 +64,7 @@
(number == SOXException.LATER_DOWN); // no net
}
- public boolean isAlready() // already What?
+ public boolean isAlready() // already done, by us, hopefully
{
return (number == ALREADY) ||
(number == Errors.ERROR_DEP_ALREADY) || // did is used
1.8 +2 -2 java/webfunds/client/sox/WalletException.java
Index: WalletException.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/sox/WalletException.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WalletException.java 2000/11/09 13:28:20 1.7
+++ WalletException.java 2001/04/16 00:41:05 1.8
@@ -1,5 +1,5 @@
/*
- * $Id: WalletException.java,v 1.7 2000/11/09 13:28:20 iang Exp $
+ * $Id: WalletException.java,v 1.8 2001/04/16 00:41:05 iang Exp $
*
* Copyright (c) 2000 Systemics Inc on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -62,7 +62,7 @@
(number == SOXException.LATER_DOWN); // no net
}
- public boolean isAlready() // already What?
+ public boolean isAlready() // already done, by us, hopefully
{
return (number == ALREADY) ||
(number == Errors.ERROR_DEP_ALREADY) || // did is used
1.11 +2 -1 java/webfunds/client/util/UpgradesManager.java
Index: UpgradesManager.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/util/UpgradesManager.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- UpgradesManager.java 2001/04/15 05:33:00 1.10
+++ UpgradesManager.java 2001/04/16 00:41:06 1.11
@@ -1,5 +1,5 @@
/*
- * $Id: UpgradesManager.java,v 1.10 2001/04/15 05:33:00 iang Exp $
+ * $Id: UpgradesManager.java,v 1.11 2001/04/16 00:41:06 iang Exp $
*
* Copyright (c) 2000 Systemics Inc on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -845,6 +845,7 @@
if (ze == null) // is EOF!
break ;
name = ze.getName();
+ // wallet.ini or distribution.ini...
if (name.endsWith(".ini"))
{
logmsg("found ZipEntry: " + ze);