java/com/ceph/fs/CephStat.java \
java/com/ceph/fs/CephStatVFS.java \
java/com/ceph/fs/CephNativeLoader.java \
- java/com/ceph/fs/CephNotMountedException.java
+ java/com/ceph/fs/CephNotMountedException.java \
+ java/com/ceph/fs/CephFileAlreadyExistsException.java
EXTRA_DIST = $(JAVA_SRC) test
--- /dev/null
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+package com.ceph.fs;
+
+import java.io.IOException;
+
+/**
+ * Ceph file/directory already exists.
+ */
+public class CephFileAlreadyExistsException extends IOException {
+
+ /**
+ * Construct CephFileAlreadyExistsException.
+ */
+ public CephFileAlreadyExistsException() {
+ super();
+ }
+
+ /**
+ * Construct CephFileAlreadyExistsException with message.
+ */
+ public CephFileAlreadyExistsException(String s) {
+ super(s);
+ }
+}
#define CEPH_STAT_VFS_CP "com/ceph/fs/CephStatVFS"
#define CEPH_MOUNT_CP "com/ceph/fs/CephMount"
#define CEPH_NOTMOUNTED_CP "com/ceph/fs/CephNotMountedException"
+#define CEPH_FILEEXISTS_CP "com/ceph/fs/CephFileAlreadyExistsException"
/*
* Flags to open(). must be synchronized with CephMount.java
THROW(env, "java/io/FileNotFoundException", msg);
}
+static void cephThrowFileExists(JNIEnv *env, const char *msg)
+{
+ THROW(env, CEPH_FILEEXISTS_CP, msg);
+}
+
static void handle_error(JNIEnv *env, int rc)
{
switch (rc) {
case -ENOENT:
cephThrowFNF(env, "");
return;
+ case -EEXIST:
+ cephThrowFileExists(env, "");
+ return;
default:
break;
}