[Webfunds-commits] java/webfunds/ricardian Contract.java

Ian Grigg iang@cypherpunks.ai
Sun, 15 Apr 2001 01:31:08 -0400 (AST)


iang        01/04/15 01:31:08

  Modified:    webfunds/ricardian Contract.java
  Log:
  uses proper code in Support to read URL streams!

Revision  Changes    Path
1.57      +5 -7      java/webfunds/ricardian/Contract.java

Index: Contract.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/Contract.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- Contract.java	2001/04/13 17:10:22	1.56
+++ Contract.java	2001/04/15 05:31:07	1.57
@@ -1,4 +1,4 @@
-/* $Id: Contract.java,v 1.56 2001/04/13 17:10:22 iang Exp $
+/* $Id: Contract.java,v 1.57 2001/04/15 05:31:07 iang Exp $
  *
  * Copyright (c) 1995-2001 Systemics Inc on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -38,6 +38,7 @@
 
 import webfunds.util.Armoury;
 import webfunds.util.Log;
+import webfunds.util.Support;
 
 import webfunds.util.IniFileReader;
 import webfunds.util.FormattedFileException;
@@ -332,7 +333,7 @@
         Base64Coder b64 = new Base64Coder();
         String s = b64.encode(hash);
         byte b[]  = b64.decode(s);
-        if (!webfunds.util.Support.equals(b, hash))
+        if (!Support.equals(b, hash))
             throw new RuntimeException("Base64 failed: " +
                       name + " ==> " + fileName + " ==> " + Hex.data2hex(b));
         s = s.replace('/', '_').trim();
@@ -743,8 +744,7 @@
         try
         {
             InputStream is = ascurl.openStream();
-            contractData = new byte[is.available()];
-            is.read(contractData);
+            contractData = Support.streamToByteArray(is);
             is.close();
         }
         catch (FileNotFoundException ex)
@@ -763,8 +763,7 @@
         try
         {
             InputStream is = localurl.openStream();
-            localData = new byte[is.available()];
-            is.read(localData);
+            localData = Support.streamToByteArray(is);
             is.close();
         }
         catch (FileNotFoundException ex)
@@ -783,7 +782,6 @@
 
         return getContract(contractData, localData, new byte[0]);
     }
-
 
     /**
      *  Work out what type of contract this is.