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

Ian Grigg iang@cypherpunks.ai
Sun, 3 Sep 2000 13:04:03 -0400 (AST)


iang        00/09/03 13:04:03

  Modified:    webfunds/ricardian IniFileReader.java Contract.java
  Log:
  Last Multiline was being chopped up by the getBase, and IniFileReader
  was losing the plot.  Now not chopped, and IniFileReader should
  throw the right exception if it were to ever happen again....

Revision  Changes    Path
1.14      +9 -1      java/webfunds/ricardian/IniFileReader.java

Index: IniFileReader.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/IniFileReader.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- IniFileReader.java	2000/08/27 21:53:27	1.13
+++ IniFileReader.java	2000/09/03 17:04:02	1.14
@@ -1,5 +1,5 @@
 /*
- * $Id: IniFileReader.java,v 1.13 2000/08/27 21:53:27 iang Exp $
+ * $Id: IniFileReader.java,v 1.14 2000/09/03 17:04:02 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -374,6 +374,10 @@
                             else
                             {
                                 value += temp + "\n"; 
+                                if (lineNum >= numLines)
+                                    throw new ContractException(
+                                      ContractException.MULTILINE, lineNum,
+                                      "eof reached before end of multiline");
                             }
                         }
                     }
@@ -400,6 +404,10 @@
                     while ( ! (temp = lines[lineNum++]).trim().equals("}") )
                     {
                         value += temp + "\n";
+                        if (lineNum >= numLines)
+                            throw new ContractException(
+                                  ContractException.MULTILINE, lineNum,
+                                  "eof reached before end of multiline");
                     }
                 }
 



1.40      +6 -3      java/webfunds/ricardian/Contract.java

Index: Contract.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/ricardian/Contract.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Contract.java	2000/08/28 13:35:59	1.39
+++ Contract.java	2000/09/03 17:04:02	1.40
@@ -1,4 +1,4 @@
-/* $Id: Contract.java,v 1.39 2000/08/28 13:35:59 edwin Exp $
+/* $Id: Contract.java,v 1.40 2000/09/03 17:04:02 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -1580,7 +1580,10 @@
             return getBase(payload); //  RECURSIVE !?! 
         }
 
-        // ok, should have some content lines, unsigned (unarmoured), by now
+        /*
+         *  ok, should have some content lines, unsigned (unarmoured), by now
+         *  Now skip forward to the [keys] section and delete from there on.
+         */
         int end = start;
 System.err.println("starting search at line " + start);
         while (end < numLines)
@@ -1592,7 +1595,7 @@
             if (s.equals("[keys]"))
             {
 System.err.println("found at line " + end);
-                end -= 2;
+                end--;      // point back at [keys], 0..end-1 is captured below
                 break;
             }
         }