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 impl/p2p/P2...


From: Benja Fallenstein
Subject: [Gzz-commits] storm/org/nongnu/storm BlockId.java impl/p2p/P2...
Date: Tue, 13 May 2003 09:44:19 -0400

CVSROOT:        /cvsroot/storm
Module name:    storm
Changes by:     Benja Fallenstein <address@hidden>      03/05/13 09:44:19

Modified files:
        org/nongnu/storm: BlockId.java 
        org/nongnu/storm/impl/p2p: P2PPool.java 

Log message:
        fix one bug uncovered by running on kaffe

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/BlockId.java.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/impl/p2p/P2PPool.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: storm/org/nongnu/storm/BlockId.java
diff -u storm/org/nongnu/storm/BlockId.java:1.17 
storm/org/nongnu/storm/BlockId.java:1.18
--- storm/org/nongnu/storm/BlockId.java:1.17    Mon Apr 28 05:40:53 2003
+++ storm/org/nongnu/storm/BlockId.java Tue May 13 09:44:19 2003
@@ -187,7 +187,7 @@
                                               + "Storm URNs");
 
        if(s.indexOf(' ') >= 0)
-           throw new IllegalArgumentException("URIs cannot contain spaces");
+           throw new IllegalArgumentException("URIs cannot contain spaces; 
space was in: '"+s+"'");
     }
 
     /** Create a new SHA-1 message digest; throw an error
Index: storm/org/nongnu/storm/impl/p2p/P2PPool.java
diff -u storm/org/nongnu/storm/impl/p2p/P2PPool.java:1.8 
storm/org/nongnu/storm/impl/p2p/P2PPool.java:1.9
--- storm/org/nongnu/storm/impl/p2p/P2PPool.java:1.8    Fri May  9 06:54:56 2003
+++ storm/org/nongnu/storm/impl/p2p/P2PPool.java        Tue May 13 09:44:19 2003
@@ -61,7 +61,7 @@
            p("Trying to find the block from the local pool...");
            return cache.get(id);           
        } catch(FileNotFoundException _) {
-           p("Block didn't found from the local pool...");
+           p("Block not found in local pool...");
            Collector c = map.get(id.toString());
            for(Iterator i=c.blockingIterator(); i.hasNext();) {
                String url = (String)i.next();
@@ -70,8 +70,18 @@
                    URLConnection conn = new URL(url).openConnection();
                    String contentType = conn.getContentType();             
                    if(contentType == null) continue;
+
+                   // The content type may contain spaces like this:
+                   // "text/html; charset=utf-8"
+                   // Storm would choke on these, but we can
+                   // safely remove them...
+                   int sp;
+                   while((sp = contentType.indexOf(' ')) >= 0)
+                       contentType = contentType.substring(0, sp) +
+                                     contentType.substring(sp+1);
+
                    BlockOutputStream bos = 
-                       cache.getBlockOutputStream(conn.getContentType());
+                       cache.getBlockOutputStream(contentType);
                    CopyUtil.copy(conn.getInputStream(), bos);
                    if(bos.getBlockId().equals(id)) { 
                        p("Block found @ " + url);
@@ -81,7 +91,8 @@
                        bos.getBlockId()+" (from "+url+").");
                    }
                } catch(IOException e) {
-                   // next iteration
+                   // not // next iteration
+                   throw e;
                }
            }
            throw new FileNotFoundException(""+id);




reply via email to

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