Hello,

Attached is a tiny patch to fix the exceptions in fproxy that haven't
let anybody insert using fproxy for a while now.  Basically it was
just caused by creating new DocumentCommand objects with null Metadata
object arguments.  DocumentCommand always references that argument's
methods, so a NullPointerException kept getting thrown.

This just changes those calls to the DocumentCommand constructor to
include dummy Metadata objects.  I'm not sure if it's 100% correct,
but it works.   (Patch created with cvs diff -u)

-- 
David Allen
http://opop.nols.com/
----------------------------------------
Fashion is a form of ugliness so intolerable
that we have to alter it every six months.
        -- Oscar Wilde
-------------- next part --------------
Index: src/freenet/client/AutoRequester.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/client/AutoRequester.java,v
retrieving revision 1.4
diff -u -r1.4 AutoRequester.java
--- src/freenet/client/AutoRequester.java       10 Aug 2002 18:20:31 -0000      
1.4
+++ src/freenet/client/AutoRequester.java       16 Aug 2002 03:07:59 -0000
@@ -182,7 +182,7 @@

             DocumentCommand mdc = metadata.getDefaultDocument();
             if (mdc == null) {
-                mdc = new DocumentCommand((Metadata) null);
+                mdc = new DocumentCommand(new Metadata(new 
MetadataSettings()));
                 metadata.addDocument(mdc);
             }
             mdc.addPart(new InfoPart("file", contentType));
@@ -196,6 +196,7 @@
                                                      0, true));
         } catch (Throwable e) {
             error = "Internal error preparing insert metadata: " + e;
+            e.printStackTrace(System.out);
             return false;
         }
     }
@@ -276,7 +277,8 @@
                 String name = data[i].getName();

                 if (metadata.getDocument(name) == null) {
-                    DocumentCommand dc = new DocumentCommand(null, name);
+                    Metadata _m = new Metadata(new MetadataSettings());
+                    DocumentCommand dc = new DocumentCommand(_m, name);
                     dc.addPart(new Redirect(new FreenetURI("CHK@")));
                     String type = MimeTypeUtils.getExtType(name);
                     if (type != null)
@@ -376,7 +378,7 @@
             && (doRedirect || doDateRedirect)) {

             DocumentCommand redirect = 
-                new DocumentCommand((Metadata) null);
+                new DocumentCommand(new Metadata(new MetadataSettings()));
             try {
                 redirect.addPart(doDateRedirect ? 
                                  new DateRedirect(drIncrement, drOffset, 

Reply via email to