HDFS-15927. Catch polymorphic type by reference (#2824)
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/hdfs_configuration.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/hdfs_configuration.cc
index 07e2edc..7b1496c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/hdfs_configuration.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/hdfs_configuration.cc
@@ -135,7 +135,7 @@
URI uri;
try {
uri = URI::parse_from_string(PrependHdfsScheme(Get(dom_node_name)));
- } catch (const uri_parse_error) {
+ } catch (const uri_parse_error&) {
throw ha_parse_error("unable to find " + dom_node_name);
}
@@ -148,7 +148,7 @@
NamenodeInfo node(nameservice, *node_id, uri);
namenodes.push_back(node);
}
- } catch (ha_parse_error e) {
+ } catch (const ha_parse_error& e) {
LOG_ERROR(kRPC, << "HA cluster detected but failed because : " << e.what());
namenodes.clear(); // Don't return inconsistent view
}