You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@reef.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2015/12/07 12:56:10 UTC

[jira] [Created] (REEF-1045) Add exception handling in LocalScratchSpace

Dongjoon Hyun created REEF-1045:
-----------------------------------

             Summary: Add exception handling in LocalScratchSpace
                 Key: REEF-1045
                 URL: https://issues.apache.org/jira/browse/REEF-1045
             Project: REEF
          Issue Type: Improvement
          Components: REEF-IO
            Reporter: Dongjoon Hyun
            Assignee: Dongjoon Hyun
            Priority: Minor


This issue implements two TODOs in `LocalScratchSpace.java` by implementing exception handling logic.

{code}
- // TODO: Error handling...
- ret += f.length();
+ try {
+   ret += f.length();
+ } catch (final SecurityException e) {
+   LOG.info("Fail to get file info:" + f.getAbsolutePath());
+ }
{code}

{code}
- // TODO: Error handling. Files.delete() would give us an exception. We
- // should pass a set of Exceptions into a ReefRuntimeException.
   for (final File f : tempFiles) {
-    f.delete();
+   try {
+     if (!f.delete()) {
+       throw new RuntimeException("Fail to delete file:" + f.getAbsolutePath());
+     }
+   } catch (final SecurityException e) {
+     throw new RuntimeException("Fail to delete file:" + f.getAbsolutePath(), e);
+ }
{code}



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