nutch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "songwanging (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (NUTCH-2076) exceptions are not handled when using method waitForCompletion in a try block
Date Mon, 10 Aug 2015 21:55:47 GMT

     [ https://issues.apache.org/jira/browse/NUTCH-2076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

songwanging updated NUTCH-2076:
-------------------------------
    Description: 
Locations: src\java\org\apache\nutch\crawl\WebTableReader.java
when using function waitForCompletion in a try block, exceptions are not handled :

waitForCompletion might throw  : IOException, InterruptedException, ClassNotFoundException
so when calling this function in a try block, we should use a catch block to handle potential
Exceptions.

public Map<String, Object> run(Map<String, Object> args) throws Exception {
...
try {
      currentJob.waitForCompletion(true);
    } finally {
      ToolUtil.recordJobStatus(null, currentJob, results);
      if (!currentJob.isSuccessful()) {
        fileSystem.delete(tmpFolder, true);
        return results;
      }
    }
...
}

  was:
Locations: src\java\org\apache\nutch\crawl\WebTableReader.java
when using function waitForCompletion in a try block, exceptions are not handled :
public Map<String, Object> run(Map<String, Object> args) throws Exception {
...
try {
      currentJob.waitForCompletion(true);
    } finally {
      ToolUtil.recordJobStatus(null, currentJob, results);
      if (!currentJob.isSuccessful()) {
        fileSystem.delete(tmpFolder, true);
        return results;
      }
    }
...
}


> exceptions are not handled when using method waitForCompletion in a try block
> -----------------------------------------------------------------------------
>
>                 Key: NUTCH-2076
>                 URL: https://issues.apache.org/jira/browse/NUTCH-2076
>             Project: Nutch
>          Issue Type: Bug
>          Components: crawldb
>    Affects Versions: 2.2, 2.3
>            Reporter: songwanging
>            Priority: Minor
>
> Locations: src\java\org\apache\nutch\crawl\WebTableReader.java
> when using function waitForCompletion in a try block, exceptions are not handled :
> waitForCompletion might throw  : IOException, InterruptedException, ClassNotFoundException
> so when calling this function in a try block, we should use a catch block to handle potential
Exceptions.
> public Map<String, Object> run(Map<String, Object> args) throws Exception
{
> ...
> try {
>       currentJob.waitForCompletion(true);
>     } finally {
>       ToolUtil.recordJobStatus(null, currentJob, results);
>       if (!currentJob.isSuccessful()) {
>         fileSystem.delete(tmpFolder, true);
>         return results;
>       }
>     }
> ...
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message