From 5ea9cad2d49041cc2f62f59e9e850e8a68e1c15f Mon Sep 17 00:00:00 2001 From: Ravi Prakash Date: Tue, 26 Jun 2018 13:13:59 -0700 Subject: [PATCH] MCOL-1155 Remove try-catch block by an explicit check for a null pointer. --- dbcon/mysql/ha_calpont_execplan.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index c47bd8d52..6113e7ca4 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -1375,15 +1375,16 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip) ParseTree* equal_ptp = or_ptp->left(); ParseTree* nullck_left_ptp = and_ptp->left(); ParseTree* nullck_right_ptp = and_ptp->right(); - SimpleFilter *sf = dynamic_cast(nullck_left_ptp->data()); - try - { - sf->op()->reverseOp(); - sf = dynamic_cast(nullck_right_ptp->data()); - sf->op()->reverseOp(); - sf = dynamic_cast(equal_ptp->data()); - sf->op()->reverseOp(); - // Rehook the trees + SimpleFilter *sf_left_nullck = dynamic_cast(nullck_left_ptp->data()); + SimpleFilter *sf_right_nullck = dynamic_cast(nullck_right_ptp->data()); + SimpleFilter *sf_equal = dynamic_cast(equal_ptp->data()); + + if (sf_left_nullck && sf_right_nullck && sf_equal) { + // Negate the null checks + sf_left_nullck->op()->reverseOp(); + sf_right_nullck->op()->reverseOp(); + sf_equal->op()->reverseOp(); + // Rehook the nodes ptp = and_ptp; ptp->left(equal_ptp); ptp->right(or_ptp); @@ -1392,10 +1393,9 @@ bool buildPredicateItem(Item_func* ifp, gp_walk_info* gwip) gwip->ptWorkStack.pop(); gwip->ptWorkStack.push(ptp); } - catch (std::exception& ex ) - { + else { gwip->fatalParseError = true; - gwip->parseErrorText = ex.what(); + gwip->parseErrorText = IDBErrorInfo::instance()->errorMsg(ERR_ASSERTION_FAILURE); return false; } }