[ 
https://issues.apache.org/jira/browse/NUTCH-2568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16446882#comment-16446882
 ] 

ASF GitHub Bot commented on NUTCH-2568:
---------------------------------------

sebastian-nagel closed pull request #318: NUTCH-2568 Adding error log in 
NutchJob.cleanupAfterFailure()
URL: https://github.com/apache/nutch/pull/318
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/java/org/apache/nutch/util/NutchJob.java 
b/src/java/org/apache/nutch/util/NutchJob.java
index 06f1cc2c5..1ba4a2199 100644
--- a/src/java/org/apache/nutch/util/NutchJob.java
+++ b/src/java/org/apache/nutch/util/NutchJob.java
@@ -18,7 +18,10 @@
 package org.apache.nutch.util;
 
 import java.io.IOException;
+import java.lang.invoke.MethodHandles;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.conf.Configuration;
@@ -27,6 +30,9 @@
 /** A {@link Job} for Nutch jobs. */
 public class NutchJob extends Job {
 
+  private static final Logger LOG = LoggerFactory
+      .getLogger(MethodHandles.lookup().lookupClass());
+
   @SuppressWarnings("deprecation")
   public NutchJob(Configuration conf, String jobName) throws IOException {
     super(conf, jobName);
@@ -47,6 +53,7 @@ public static void cleanupAfterFailure(Path tempDir, Path 
lock, FileSystem fs)
       }
       LockUtil.removeLockFile(fs, lock);
     } catch (IOException e) {
+      LOG.error("NutchJob cleanup failed: {}", e.getMessage());
       throw e;
     }
   }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Caught exception is immediately rethrown
> ----------------------------------------
>
>                 Key: NUTCH-2568
>                 URL: https://issues.apache.org/jira/browse/NUTCH-2568
>             Project: Nutch
>          Issue Type: Bug
>          Components: util
>    Affects Versions: 1.15
>            Reporter: Hans Brende
>            Priority: Minor
>             Fix For: 1.15
>
>
> {{NutchJob.cleanupAfterFailure()}} catches an IOException and immediately 
> rethrows it without logging it. Either remove the try-catch block, or do 
> something with the exception, e.g., log it.
> Relevant line of code:
> https://github.com/apache/nutch/blob/4c3fb71208a29e1e49201002bda08499a14b443d/src/java/org/apache/nutch/util/NutchJob.java#L50



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to