java/com/ceph/fs/CephNativeLoader.java \
java/com/ceph/fs/CephNotMountedException.java \
java/com/ceph/fs/CephFileAlreadyExistsException.java \
- java/com/ceph/fs/CephAlreadyMountedException.java
+ java/com/ceph/fs/CephAlreadyMountedException.java \
+ java/com/ceph/fs/CephNotDirectoryException.java
JAVA_TEST_SRC = \
test/com/ceph/fs/CephDoubleMountTest.java \
* @param path Path of file to stat.
* @param stat CephStat structure to hold file status.
*/
- public void lstat(String path, CephStat stat) throws FileNotFoundException {
+ public void lstat(String path, CephStat stat) throws FileNotFoundException, CephNotDirectoryException {
native_ceph_lstat(instance_ptr, path, stat);
}
--- /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;
+
+/**
+ * Component of path is not a directory.
+ */
+public class CephNotDirectoryException extends IOException {
+
+ /**
+ * Construct CephNotDirectoryException.
+ */
+ public CephNotDirectoryException() {
+ super();
+ }
+
+ /**
+ * Construct CephNotDirectoryException with message.
+ */
+ public CephNotDirectoryException(String s) {
+ super(s);
+ }
+}
#define CEPH_NOTMOUNTED_CP "com/ceph/fs/CephNotMountedException"
#define CEPH_FILEEXISTS_CP "com/ceph/fs/CephFileAlreadyExistsException"
#define CEPH_ALREADYMOUNTED_CP "com/ceph/fs/CephAlreadyMountedException"
+#define CEPH_NOTDIR_CP "com/ceph/fs/CephNotDirectoryException"
/*
* Flags to open(). must be synchronized with CephMount.java
THROW(env, CEPH_FILEEXISTS_CP, msg);
}
+static void cephThrowNotDir(JNIEnv *env, const char *msg)
+{
+ THROW(env, CEPH_NOTDIR_CP, msg);
+}
+
static void handle_error(JNIEnv *env, int rc)
{
switch (rc) {
case -EEXIST:
cephThrowFileExists(env, "");
return;
+ case -ENOTDIR:
+ cephThrowNotDir(env, "");
+ return;
default:
break;
}
assertTrue(orig_st.blocks == other_st.blocks);
}
+ @Test(expected=CephNotDirectoryException.class)
+ public void test_enotdir() throws Exception {
+ String path = makePath();
+ int fd = createFile(path, 1);
+ mount.close(fd);
+
+ try {
+ CephStat stat = new CephStat();
+ mount.lstat(path + "/blah", stat);
+ } finally {
+ mount.unlink(path);
+ }
+ }
+
/*
* setattr
*/