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

Ian Grigg iang@cypherpunks.ai
Mon, 4 Sep 2000 07:53:04 -0400 (AST)


iang        00/09/04 07:53:04

  Modified:    webfunds/sox Account.java
  Log:
  oops, that was dumb, maybe the optimisation wasn't worth it after all...
  previous checkin is junk.

Revision  Changes    Path
1.71      +18 -11    java/webfunds/sox/Account.java

Index: Account.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Account.java,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- Account.java	2000/07/21 21:31:17	1.70
+++ Account.java	2000/09/04 11:53:03	1.71
@@ -1,4 +1,4 @@
-/* $Id: Account.java,v 1.70 2000/07/21 21:31:17 gelderen Exp $
+/* $Id: Account.java,v 1.71 2000/09/04 11:53:03 iang Exp $
  *
  * Copyright (c) Systemics Inc. 1995-2000 on behalf of
  * The WebFunds Development Team. All rights reserved.
@@ -25,7 +25,7 @@
  * information, except perhaps for holding a key passphrase,
  * which is not stored in the Store (only in a runtime object).
  *
- * @version $Revision: 1.70 $
+ * @version $Revision: 1.71 $
  * @author  Jeroen C. van Gelderen (gelderen@webfunds.org)
  * @author  Unknown
  */
@@ -221,7 +221,7 @@
 
     public SubAccount[] getSubAccounts()
     {
-        SubAccount[] retval = new SubAccount[subs.size() ];
+        SubAccount[] retval = new SubAccount[subs.size()];
         int i = 0;
         for (Enumeration e = subs.elements(); e.hasMoreElements(); i++)
         {
@@ -241,6 +241,10 @@
         return retval;
     }
 
+    /**
+     *  Only within this object, caller is responsible for other
+     *  objects / persistant copies...
+     */
     public void removeSubAccount(ItemId item)
     {
         SubAccount sub;
@@ -271,7 +275,6 @@
     {
         sub.setAccount(this);      // I know how to find issuers.
         ItemId item = sub.getItemId();
-//logmsg("       found " + item);
         subs.put(item, sub);
     }
 
@@ -282,7 +285,6 @@
     public void newSub(SubAccount sub)
         throws SOXSubAccountException, SOXAccountException
     {
-// logmsg("sub is " + sub);
         insertSub(sub);
 
         try {
@@ -412,23 +414,28 @@
         {
             int size = dis.readInt();
 
+            Class[] argTypes = new Class[1];
+            Object[] argObjs = new Object[1];
+            byte[] buf;
+
             for (int i = 0; i < size;i++)
             {
-                String type = readString(dis);
-//logmsg("Squark! " + i + " of " + size + ":  " + type);
+                String type = readString(dis);     // get Class name first
+                buf = readByteArray(dis);   // then the saved object
                 
                 Class cuss;
                 try {
                     cuss = Class.forName(type);
                 } catch (ClassNotFoundException ex) {
-                    logmsg("not a known class (" + i + "): " + type + "\n"+ex);
+                    logmsg("not a known class (" + i + "): " +
+                           webfunds.utils.Hex.printable(type.getBytes()) +
+                           "  (" +
+                              ((buf==null) ? "<null?>" : (buf.length+" bytes"))
+                           + ")\n" + ex);
                     continue ;
                 }
 
-                byte[] buf = readByteArray(dis);
-                Class[] argTypes = new Class[1];
                 argTypes[0] = buf.getClass();
-                Object[] argObjs = new Object[1];
                 argObjs[0] = buf;
 
                 Object obj;