ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [02/50] [abbrv] incubator-ignite git commit: # ignite-26
Date Tue, 03 Feb 2015 09:53:16 GMT
# ignite-26


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/0693fa99
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/0693fa99
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/0693fa99

Branch: refs/heads/ignite-106
Commit: 0693fa99f79daac2b71c21edbf2e0453cb5b00c6
Parents: 5103496
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Feb 2 15:00:25 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Feb 2 15:00:25 2015 +0300

----------------------------------------------------------------------
 .../processors/fs/GridGgfsMetaManager.java      | 23 +++++++++++++-------
 .../fs/hadoop/v1/GridGgfsHadoopFileSystem.java  |  6 ++---
 2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0693fa99/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java
index dca0327..002f1ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/fs/GridGgfsMetaManager.java
@@ -27,7 +27,6 @@ import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.transactions.*;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.transactions.*;
 import org.apache.ignite.internal.managers.eventstorage.*;
 import org.apache.ignite.internal.processors.task.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -757,7 +756,7 @@ public class GridGgfsMetaManager extends GridGgfsManager {
         IgniteUuid fileId = newFileInfo.id();
 
         if (!id2InfoPrj.putxIfAbsent(fileId, newFileInfo))
-            throw new IgniteCheckedException("Failed to add file details into cache: " +
newFileInfo);
+            throw fsException("Failed to add file details into cache: " + newFileInfo);
 
         assert metaCache.get(parentId) != null;
 
@@ -974,7 +973,7 @@ public class GridGgfsMetaManager extends GridGgfsManager {
         assert parentInfo.isDirectory();
 
         if (!rmvLocked && fileInfo.lockId() != null)
-            throw new IgniteCheckedException("Failed to remove file (file is opened for writing)
[fileName=" +
+            throw fsException("Failed to remove file (file is opened for writing) [fileName="
+
                 fileName + ", fileId=" + fileId + ", lockId=" + fileInfo.lockId() + ']');
 
         // Validate own directory listing.
@@ -1478,15 +1477,15 @@ public class GridGgfsMetaManager extends GridGgfsManager {
                     GridGgfsFileInfo newInfo = c.apply(oldInfo);
 
                     if (newInfo == null)
-                        throw new IgniteCheckedException("Failed to update file info with
null value" +
+                        throw fsException("Failed to update file info with null value" +
                             " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c
+ ']');
 
                     if (!oldInfo.id().equals(newInfo.id()))
-                        throw new IgniteCheckedException("Failed to update file info (file
IDs differ)" +
+                        throw fsException("Failed to update file info (file IDs differ)"
+
                             " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c
+ ']');
 
                     if (oldInfo.isDirectory() != newInfo.isDirectory())
-                        throw new IgniteCheckedException("Failed to update file info (file
types differ)" +
+                        throw fsException("Failed to update file info (file types differ)"
+
                             " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", c=" + c
+ ']');
 
                     boolean b = metaCache.replace(fileId, oldInfo, newInfo);
@@ -1658,10 +1657,10 @@ public class GridGgfsMetaManager extends GridGgfsManager {
                             IgniteFsFile status = fs.info(path);
 
                             if (status == null)
-                                throw new IgniteCheckedException("Failed to open output stream
to the file created in " +
+                                throw fsException("Failed to open output stream to the file
created in " +
                                     "the secondary file system because it no longer exists:
" + path);
                             else if (status.isDirectory())
-                                throw new IgniteCheckedException("Failed to open output stream
to the file created in " +
+                                throw fsException("Failed to open output stream to the file
created in " +
                                     "the secondary file system because the path points to
a directory: " + path);
 
                             GridGgfsFileInfo newInfo = new GridGgfsFileInfo(status.blockSize(),
status.length(), affKey,
@@ -2651,6 +2650,14 @@ public class GridGgfsMetaManager extends GridGgfsManager {
     }
 
     /**
+     * @param msg Error message.
+     * @return Checked exception.
+     */
+    private static IgniteCheckedException fsException(String msg) {
+        return new IgniteCheckedException(new IgniteFsException(msg));
+    }
+
+    /**
      * Synchronization task interface.
      */
     private static interface SynchronizationTask<T> {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0693fa99/modules/hadoop/src/main/java/org/apache/ignite/fs/hadoop/v1/GridGgfsHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/fs/hadoop/v1/GridGgfsHadoopFileSystem.java
b/modules/hadoop/src/main/java/org/apache/ignite/fs/hadoop/v1/GridGgfsHadoopFileSystem.java
index 5c28e45..68f86db 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/fs/hadoop/v1/GridGgfsHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/fs/hadoop/v1/GridGgfsHadoopFileSystem.java
@@ -724,7 +724,7 @@ public class GridGgfsHadoopFileSystem extends FileSystem {
         catch (IOException e) {
             // Intentionally ignore GGFS exceptions here to follow Hadoop contract.
             if (F.eq(IOException.class, e.getClass()) && (e.getCause() == null ||
-                !IgniteFsException.class.isAssignableFrom(e.getCause().getClass())))
+                !X.hasCause(e.getCause(), IgniteFsException.class)))
                 throw e;
             else
                 return false;
@@ -775,7 +775,7 @@ public class GridGgfsHadoopFileSystem extends FileSystem {
         catch (IOException e) {
             // Intentionally ignore GGFS exceptions here to follow Hadoop contract.
             if (F.eq(IOException.class, e.getClass()) && (e.getCause() == null ||
-                !IgniteFsException.class.isAssignableFrom(e.getCause().getClass())))
+                !!X.hasCause(e.getCause(), IgniteFsException.class)))
                 throw e;
             else
                 return false;
@@ -933,7 +933,7 @@ public class GridGgfsHadoopFileSystem extends FileSystem {
         catch (IOException e) {
             // Intentionally ignore GGFS exceptions here to follow Hadoop contract.
             if (F.eq(IOException.class, e.getClass()) && (e.getCause() == null ||
-                !IgniteFsException.class.isAssignableFrom(e.getCause().getClass())))
+                !!X.hasCause(e.getCause(), IgniteFsException.class)))
                 throw e;
             else
                 return false;


Mime
View raw message