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

Ian Grigg iang@cypherpunks.ai
Thu, 17 Aug 2000 14:17:46 -0400 (AST)


iang        00/08/17 14:17:46

  Modified:    webfunds/ricardian Contract.java
               webfunds/sox Utils.java
  Log:
  extra diags in case of unknown Cert exceptions

Revision  Changes    Path
1.33      +5 -2      java/webfunds/ricardian/Contract.java

Index: Contract.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/Contract.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- Contract.java	2000/08/17 01:59:18	1.32
+++ Contract.java	2000/08/17 18:17:45	1.33
@@ -1,4 +1,4 @@
-/* $Id: Contract.java,v 1.32 2000/08/17 01:59:18 iang Exp $
+/* $Id: Contract.java,v 1.33 2000/08/17 18:17:45 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -834,11 +834,14 @@
             cert = getOpenPGPCertFromString(text, name, errno, userIdTag);
 
 
-        } else {
+        } else if (text.indexOf("-----BEGIN CERTIFICATE") >= 0) {
         
             // X.509 key
             cert = getX509CertFromString(text, name, errno);
 
+        } else {
+            throw new ContractException(errno, "not a recognised cert for " +
+                                        name + ":\n\n" + text + "\n\n");
         }
 
         return cert;



1.18      +9 -2      java/webfunds/sox/Utils.java

Index: Utils.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Utils.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Utils.java	2000/07/30 00:07:06	1.17
+++ Utils.java	2000/08/17 18:17:46	1.18
@@ -1,5 +1,5 @@
 /*
- * $Id: Utils.java,v 1.17 2000/07/30 00:07:06 gelderen Exp $
+ * $Id: Utils.java,v 1.18 2000/08/17 18:17:46 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -63,7 +63,14 @@
                 return cert;
             }
         } catch(CertificateException e) {
-            throw new IOException("Uh :-(");
+            String s;
+            if (data.length < 200)
+                s = (new String(data, 0, 99)) +
+                    " \\\n....\n" +
+                    (new String(data, data.length-100, data.length-1));
+            else
+                s = new String(data);
+            throw new IOException("unknown cert type\n\n" + s + "\n\n");
         }
     }