Author: toad
Date: 2006-04-26 20:59:00 +0000 (Wed, 26 Apr 2006)
New Revision: 8585

Modified:
   trunk/freenet/src/freenet/node/Version.java
   trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java
Log:
661:
Add RedirectURI to GetFailed. (Fixes #254).

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-04-26 20:49:21 UTC (rev 
8584)
+++ trunk/freenet/src/freenet/node/Version.java 2006-04-26 20:59:00 UTC (rev 
8585)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 660;
+       private static final int buildNumber = 661;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 591;

Modified: trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java    2006-04-26 
20:49:21 UTC (rev 8584)
+++ trunk/freenet/src/freenet/node/fcp/GetFailedMessage.java    2006-04-26 
20:59:00 UTC (rev 8585)
@@ -4,6 +4,7 @@

 import freenet.client.FailureCodeTracker;
 import freenet.client.FetchException;
+import freenet.keys.FreenetURI;
 import freenet.node.Node;
 import freenet.support.Fields;
 import freenet.support.Logger;
@@ -21,6 +22,7 @@
        final long expectedDataLength;
        final String expectedMimeType;
        final boolean finalizedExpected;
+       final FreenetURI redirectURI;

        public GetFailedMessage(FetchException e, String identifier) {
                Logger.minor(this, "Creating get failed from "+e+" for 
"+identifier, e);
@@ -34,6 +36,7 @@
                this.expectedDataLength = e.expectedSize;
                this.expectedMimeType = e.getExpectedMimeType();
                this.finalizedExpected = e.finalizedSize();
+               this.redirectURI = e.newURI;
        }

        /**
@@ -42,9 +45,8 @@
         * client library. FIXME.
         * @param useVerboseFields If true, read in verbose fields 
(CodeDescription
         * etc), if false, reconstruct them from the error code.
-        * @throws MalformedURLException 
         */
-       public GetFailedMessage(SimpleFieldSet fs, boolean useVerboseFields) {
+       public GetFailedMessage(SimpleFieldSet fs, boolean useVerboseFields) 
throws MalformedURLException {
                identifier = fs.get("Identifier");
                if(identifier == null) throw new NullPointerException();
                code = Integer.parseInt(fs.get("Code"));
@@ -73,6 +75,7 @@
                        expectedDataLength = Long.parseLong(s);
                } else
                        expectedDataLength = -1;
+               this.redirectURI = new FreenetURI(fs.get("RedirectURI"));
        }

        public SimpleFieldSet getFieldSet() {
@@ -107,6 +110,8 @@
                        sfs.put("ExpectedMetadata.ContentType", 
expectedMimeType);
                if(finalizedExpected)
                        sfs.put("FinalizedExpected", "true");
+               if(redirectURI != null)
+                       sfs.put("RedirectURI", redirectURI.toString(false));
                return sfs;
        }



Reply via email to