Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2451 protocol-ftp to resolve relative URL when following redirects - return empty protocol output instead of throwing exception if relative redirect URL fails to resolve - format source code - complete LOG message

Sebastian Nagel5b3cf0e2028a
diff --git a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.java b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.java
index ae7394139..eeba77664 100644
--- a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.java
+++ b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.java
@@ -147,10 +147,9 @@ public class Ftp implements Protocol {
String loc = response.getHeader("Location");
try {
u = new URL(u, loc);
- }
- catch(MalformedURLException mue) {
+ } catch (MalformedURLException mue) {
LOG.error("Could not create redirectURL for {} with {}", url, loc);
- throw mue;
+ return new ProtocolOutput(null, new ProtocolStatus(mue));
}
redirects++;
@@ -162,7 +161,8 @@ public class Ftp implements Protocol {
}
}
} catch (Exception e) {
- LOG.error("Could not get protocol output for {}", url, e);
+ LOG.error("Could not get protocol output for {}: {}", url,
+ e.getMessage());
return new ProtocolOutput(null, new ProtocolStatus(e));
}
}