]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
hadoop: check for valid filehandler, before using in next calls
authorAndrey Stepachev <octo@yandex-team.ru>
Fri, 13 Jan 2012 11:58:36 +0000 (15:58 +0400)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Tue, 17 Jan 2012 21:00:22 +0000 (13:00 -0800)
In case of nonexistent file, calling Client::replication()
triggers assert.

Signed-off-by: Andrey Stepachev <octo@yandex-team.ru>
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/client/hadoop/CephFSInterface.cc

index 4a050f2fc6c4c4e1ecbefa9aa70d69f6d63d03cd..5ffca646286553de3bfd38e6ea8b82ff6deb2667 100644 (file)
@@ -750,9 +750,12 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_fs_ceph_CephTalker_ceph_1replicati
   ceph_mount_info *cmount = get_ceph_mount_t(env, obj);
   int fh = 0;
   fh = ceph_open(cmount, c_path, O_RDONLY, 0);
+  env->ReleaseStringUTFChars(j_path, c_path);
+  if (fh < 0) {
+         return fh;
+  }
   int replication = ceph_get_file_replication(cmount, fh);
   ceph_close(cmount, fh);
-  env->ReleaseStringUTFChars(j_path, c_path);
   return replication;
 }