gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] storm/org/nongnu/storm BlockId.java util/HTTPPr...


From: Tuukka Hastrup
Subject: [Gzz-commits] storm/org/nongnu/storm BlockId.java util/HTTPPr...
Date: Fri, 25 Apr 2003 12:55:28 -0400

CVSROOT:        /cvsroot/storm
Module name:    storm
Changes by:     Tuukka Hastrup <address@hidden> 03/04/25 12:55:28

Modified files:
        org/nongnu/storm: BlockId.java 
        org/nongnu/storm/util: HTTPProxy.java 

Log message:
        better error message to client

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/BlockId.java.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/util/HTTPProxy.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: storm/org/nongnu/storm/BlockId.java
diff -u storm/org/nongnu/storm/BlockId.java:1.14 
storm/org/nongnu/storm/BlockId.java:1.15
--- storm/org/nongnu/storm/BlockId.java:1.14    Fri Apr 25 08:46:34 2003
+++ storm/org/nongnu/storm/BlockId.java Fri Apr 25 12:55:27 2003
@@ -53,12 +53,14 @@
         int dot = uri.lastIndexOf('.');
        int comma = uri.lastIndexOf(',');
 
-       if(!uri.startsWith(PREFIX)
-          || dot < 0 || comma < 0            // URN must contain . and ,
-          || dot - comma != 32 + 1        // SHA1 part must be 32 chars
-          || uri.length() - dot != 39 + 1 // TigerTree part must be 39 chars
-          )
-           throw new IllegalArgumentException("Bad block URN: "+uri);
+       if(!uri.startsWith(PREFIX))
+           throw new IllegalArgumentException("Storm URN must start "+PREFIX);
+       if(dot < 0 || comma < 0)
+            throw new IllegalArgumentException("URN must contain . and ,");
+       if(dot - comma != 32 + 1)
+           throw new IllegalArgumentException("1st hash must be 32 chars");
+       if(uri.length() - dot != 39 + 1) 
+           throw new IllegalArgumentException("2nd hash must be 39 chars");
 
        contentType = uri.substring(PREFIX_LEN, comma);
        checkContentType(contentType);
Index: storm/org/nongnu/storm/util/HTTPProxy.java
diff -u storm/org/nongnu/storm/util/HTTPProxy.java:1.10 
storm/org/nongnu/storm/util/HTTPProxy.java:1.11
--- storm/org/nongnu/storm/util/HTTPProxy.java:1.10     Fri Apr 25 10:02:43 2003
+++ storm/org/nongnu/storm/util/HTTPProxy.java  Fri Apr 25 12:55:28 2003
@@ -138,7 +138,7 @@
                resp.setField("Content-Type", "text/plain");
                Writer w = new OutputStreamWriter(resp.getOutputStream(), 
"US-ASCII");
                w.write("404 - Not found\n\n");
-               w.write("The URN in request is invalid.\n");
+               w.write("The URN in request is invalid: "+e.getMessage()+"\n");
                w.write("Requested URI: "+req.getRequestURI()+"\n");
                w.close();
                return resp;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]