You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2018/12/05 21:14:14 UTC
[thrift] branch master updated: Fix warning: catching polymorphic type ‘class std::runtime_error’ by value
This is an automated email from the ASF dual-hosted git repository.
jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new 17a9cff Fix warning: catching polymorphic type ‘class std::runtime_error’ by value
17a9cff is described below
commit 17a9cffabb746f7dc481a5af9d8a1aeeda537fb6
Author: proller <pr...@users.noreply.github.com>
AuthorDate: Wed Dec 5 19:11:20 2018 +0300
Fix warning: catching polymorphic type ‘class std::runtime_error’ by value
../contrib/thrift/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp:902:35: warning: catching polymorphic type ‘class std::runtime_error’ by value [-Wcatch-value=]
} catch (std::runtime_error e) {
^
../contrib/thrift/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp:915:33: warning: catching polymorphic type ‘class std::runtime_error’ by value [-Wcatch-value=]
} catch (std::runtime_error e) {
^
---
lib/cpp/src/thrift/protocol/TJSONProtocol.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
index a49a148..80def7f 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
@@ -899,7 +899,7 @@ uint32_t TJSONProtocol::readJSONDouble(double& num) {
}
try {
num = fromString<double>(str);
- } catch (std::runtime_error e) {
+ } catch (std::runtime_error& e) {
throw TProtocolException(TProtocolException::INVALID_DATA,
"Expected numeric value; got \"" + str + "\"");
}
@@ -912,7 +912,7 @@ uint32_t TJSONProtocol::readJSONDouble(double& num) {
result += readJSONNumericChars(str);
try {
num = fromString<double>(str);
- } catch (std::runtime_error e) {
+ } catch (std::runtime_error& e) {
throw TProtocolException(TProtocolException::INVALID_DATA,
"Expected numeric value; got \"" + str + "\"");
}