Fixed Coding Idioms Violations
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_SearchBarImpl.cpp
index 3356239..d1b00d1 100644 (file)
  * @brief      This is the implementation file for _SearchBarImpl class.
  */
 
-#include <FApp_AppInfo.h>
 #include <FBaseSysLog.h>
-#include <FBase_LocalizedNumParser.h>
 #include <FLclLocale.h>
 #include <FUiAccessibilityContainer.h>
 #include <FUiAccessibilityElement.h>
+#include <FBase_LocalizedNumParser.h>
+#include <FApp_AppInfo.h>
 #include "FUi_ResourceSizeInfo.h"
 #include "FUi_ResourceManager.h"
 #include "FUi_UiBuilder.h"
+#include "FUi_CoordinateSystemUtils.h"
 #include "FUiCtrl_PublicActionEvent.h"
 #include "FUiCtrl_PublicTextBlockEvent.h"
 #include "FUiCtrl_PublicTextEvent.h"
 #include "FUiCtrl_SearchBarImpl.h"
-#include "FUi_CoordinateSystemUtils.h"
 #include "FUiCtrl_EditFieldImpl.h"
 #include "FUiCtrl_ButtonImpl.h"
 
@@ -112,7 +112,7 @@ _SearchBarImpl::CreateSearchBarImplN(SearchBar* pControl, const Rectangle& bound
 
        r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValid(Dimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
-                    "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
+                        "[%s] Invalid argument(s) is used. The given size is not valid.", GetErrorMessage(E_INVALID_ARG));
 
        _SearchBar* pCore = _SearchBar::CreateSearchBarN();
        r = GetLastResult();
@@ -132,6 +132,7 @@ _SearchBarImpl::CreateSearchBarImplN(SearchBar* pControl, const Rectangle& bound
        return pImpl;
 CATCH:
        delete pImpl;
+       SetLastResult(r);
        return null;
 }
 
@@ -143,7 +144,7 @@ _SearchBarImpl::CreateSearchBarImplFN(SearchBar* pControl, const FloatRectangle&
 
        r = GET_SIZE_INFO(SearchBar).CheckInitialSizeValidF(FloatDimension(bounds.width, bounds.height), _CONTROL_ORIENTATION_PORTRAIT);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, E_INVALID_ARG,
-                    "[E_INVALID_ARG] Invalid argument(s) is used. The given size is not valid.");
+                        "[%s] Invalid argument(s) is used. The given size is not valid.", GetErrorMessage(E_INVALID_ARG));
 
        _SearchBar* pCore = _SearchBar::CreateSearchBarN();
        r = GetLastResult();
@@ -163,6 +164,7 @@ _SearchBarImpl::CreateSearchBarImplFN(SearchBar* pControl, const FloatRectangle&
        return pImpl;
 CATCH:
        delete pImpl;
+       SetLastResult(r);
        return null;
 }
 
@@ -260,78 +262,78 @@ _SearchBarImpl::Initialize(bool enableSearchBarButton, KeypadAction keypadAction
        }
 
        __pEditField = new (std::nothrow) EditField();
-       SysTryReturnResult(NID_UI_CTRL, __pEditField, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
+       SysTryReturnResult(NID_UI_CTRL, __pEditField != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        r = __pEditField->Construct(GetBoundsF(), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY, EDIT_FIELD_TITLE_STYLE_NONE, true);
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        __pEditField->AddFocusEventListener(*this);
-       SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "Propagating.");
 
        __pEditField->AddKeyEventListener(*this);
-       SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "Propagating.");
 
        __pEditFieldImpl = _EditFieldImpl::GetInstance(*__pEditField);
        SysTryReturnResult(NID_UI_CTRL, __pEditFieldImpl != null, E_SYSTEM,
-                          "[E_SYSTEM] A system error has occured. Failed to EditFieldImpl instance");
+                          "A system error has occurred. Failed to get _EditFieldImpl instance.");
 
        String cancelButtonText;
        GET_STRING_CONFIG(IDS_TPLATFORM_BUTTON_CANCEL_ABB, cancelButtonText);
 
        __pButton = new (std::nothrow) Button();
-       SysTryReturnResult(NID_UI_CTRL, __pButton, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory.");
+       SysTryReturnResult(NID_UI_CTRL, __pButton != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        r = __pButton->Construct(GetBoundsF(), cancelButtonText);
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        __pButton->AddFocusEventListener(*this);
-       SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       SysTryReturnResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "Propagating.");
 
        __pButtonImpl = _ButtonImpl::GetInstance(*__pButton);
        SysTryReturnResult(NID_UI_CTRL, __pButtonImpl != null, E_SYSTEM,
-                          "[E_SYSTEM] A system error has occured. Failed to ButtonImpl instance");
+                          "A system error has occurred. Failed to get _ButtonImpl instance.");
 
        r = __pSearchBar->Initialize(enableSearchBarButton, coreKeypadAction);
        SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        __pPublicActionEvent = _PublicActionEvent::CreateInstanceN(GetPublic());
        r = GetLastResult();
-       SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturn(NID_UI_CTRL, __pPublicActionEvent != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = __pSearchBar->AddActionEventListener(*this);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pPublicKeypadEvent = _PublicKeypadEvent::CreateInstanceN(GetPublic());
        r = GetLastResult();
-       SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = __pSearchBar->AddKeypadEventListener(*this);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pPublicTextBlockEvent = _PublicTextBlockEvent::CreateInstanceN(GetPublic());
        r = GetLastResult();
-       SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = __pSearchBar->AddTextBlockEventListener(*this);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pPublicTextEvent = _PublicTextEvent::CreateInstanceN(GetPublic());
        r = GetLastResult();
-       SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturn(NID_UI_CTRL, __pPublicTextEvent != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = __pSearchBar->AddTextEventListener(*this);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pPublicSearchBarEvent = _PublicSearchBarEvent::CreateInstanceN(GetPublic());
        r = GetLastResult();
-       SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = __pSearchBar->AddSearchBarEventListener(*this);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        __pPublicLanguageEvent = _PublicLanguageEvent::CreateInstanceN(GetPublic());
        r = GetLastResult();
-       SysTryReturn(NID_UI_CTRL, __pPublicLanguageEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturn(NID_UI_CTRL, __pPublicLanguageEvent != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = __pSearchBar->AddLanguageEventListener(*this);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -362,7 +364,7 @@ _SearchBarImpl::SetContent(const Control* pContent)
                const _Control& content = _ControlImpl::GetInstance(*pContent)->GetCore();
                bool isContentAttachable = __pSearchBar->IsContentAttachable(&content);
                SysTryReturn(NID_UI_CTRL, isContentAttachable, E_INVALID_ARG, E_INVALID_ARG,
-                            "[E_INVALID_ARG] Invalid argument(s) is used. The content cannot be set.");
+                                "[%s] Invalid argument(s) is used. The content cannot be set.", GetErrorMessage(E_INVALID_ARG));
        }
 
        if (pContent != null && __pContentControl == null)
@@ -461,7 +463,7 @@ _SearchBarImpl::SetMode(SearchBarMode mode)
 {
        ClearLastResult();
 
-       return __pSearchBar->SetMode(mode);
+       return __pSearchBar->SetMode(mode, true);
 }
 
 result
@@ -683,7 +685,7 @@ _SearchBarImpl::Clear(void)
        r = __pSearchBar->Clear();
 
        SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM,
-                          "[E_SYSTEM] A system error has occured. Failed to clear the text.");
+                          "A system error has occurred. Failed to clear the text.");
        return r;
 }
 
@@ -807,7 +809,7 @@ _SearchBarImpl::RemoveTextBlock(void)
        ClearLastResult();
        result r = __pSearchBar->RemoveTextBlock();
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occured. Unable to remove the text block.");
+                        "[%s] A system error has occurred. Unable to remove the text block.", GetErrorMessage(E_SYSTEM));
 
        return r;
 }
@@ -1064,8 +1066,8 @@ _SearchBarImpl::AddActionEventListener(IActionEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicActionEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicActionEvent->AddListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
@@ -1078,7 +1080,7 @@ _SearchBarImpl::RemoveActionEventListener(IActionEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicActionEvent, E_SYSTEM, E_SYSTEM,
+       SysTryReturn(NID_UI_CTRL, __pPublicActionEvent != null, E_SYSTEM, E_SYSTEM,
                     "[E_SYSTEM] A system error has occurred.");
 
        result r = __pPublicActionEvent->RemoveListener(listener);
@@ -1092,8 +1094,8 @@ _SearchBarImpl::AddKeypadEventListener(IKeypadEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicKeypadEvent->AddListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
@@ -1107,8 +1109,8 @@ _SearchBarImpl::RemoveKeypadEventListener(IKeypadEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicKeypadEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicKeypadEvent->RemoveListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
@@ -1122,8 +1124,8 @@ _SearchBarImpl::AddTextBlockEventListener(ITextBlockEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicTextBlockEvent->AddListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
@@ -1137,8 +1139,8 @@ _SearchBarImpl::RemoveTextBlockEventListener(ITextBlockEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicTextBlockEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicTextBlockEvent->RemoveListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
@@ -1153,8 +1155,8 @@ _SearchBarImpl::AddTextEventListener(ITextEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicTextEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicTextEvent->AddListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
@@ -1168,8 +1170,8 @@ _SearchBarImpl::RemoveTextEventListener(ITextEventListener& listener)
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicTextEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicTextEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicTextEvent->RemoveListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
@@ -1183,8 +1185,8 @@ _SearchBarImpl::AddSearchBarEventListener(const ISearchBarEventListener& listene
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicSearchBarEvent->AddListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_ALREADY_EXIST, E_SYSTEM,
@@ -1198,8 +1200,8 @@ _SearchBarImpl::RemoveSearchBarEventListener(const ISearchBarEventListener& list
 {
        ClearLastResult();
 
-       SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent, E_SYSTEM, E_SYSTEM,
-                    "[E_SYSTEM] A system error has occurred.");
+       SysTryReturn(NID_UI_CTRL, __pPublicSearchBarEvent != null, E_SYSTEM, E_SYSTEM,
+                        "[%s] A system error has occurred.", GetErrorMessage(E_SYSTEM));
 
        result r = __pPublicSearchBarEvent->RemoveListener(listener);
        SysTryReturnResult(NID_UI_CTRL, r != E_OBJ_NOT_FOUND, E_SYSTEM,
@@ -1253,7 +1255,7 @@ _SearchBarImpl::OnActionPerformed(const _Control& source, int actionId)
        {
                IEventArg* pEventArg = _PublicActionEvent::CreateActionEventArgN(actionId);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicActionEvent->Fire(*pEventArg);
        }
@@ -1270,7 +1272,7 @@ _SearchBarImpl::OnKeypadWillOpen(void)
                IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
                        GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CREATED);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicKeypadEvent->Fire(*pEventArg);
        }
@@ -1287,7 +1289,7 @@ _SearchBarImpl::OnKeypadOpened(void)
                IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
                        GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_OPEN);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicKeypadEvent->Fire(*pEventArg);
        }
@@ -1305,7 +1307,7 @@ _SearchBarImpl::OnKeypadClosed(void)
                IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
                        GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_CLOSE);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicKeypadEvent->Fire(*pEventArg);
        }
@@ -1322,7 +1324,7 @@ _SearchBarImpl::OnKeypadBoundsChanged(void)
                IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
                        GetPublic(), KEYPAD_ACTION_SEARCH, KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicKeypadEvent->Fire(*pEventArg);
        }
@@ -1341,7 +1343,7 @@ _SearchBarImpl::OnKeypadActionPerformed(CoreKeypadAction keypadAction)
                IEventArg* pEventArg = _PublicKeypadEvent::CreateKeypadEventArgN(
                        GetPublic(), publicKeypadAction, KEYPAD_EVENT_STATUS_ENTERACTION);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicKeypadEvent->Fire(*pEventArg);
        }
@@ -1357,7 +1359,7 @@ _SearchBarImpl::OnTextBlockSelected(_Control& source, int start, int end)
        {
                IEventArg* pEventArg = _PublicTextBlockEvent::CreateTextBlockEventArgN(start, end);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicTextBlockEvent->Fire(*pEventArg);
        }
@@ -1373,7 +1375,7 @@ _SearchBarImpl::OnTextValueChanged(const _Control& source)
        {
                IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CHANGED);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicTextEvent->Fire(*pEventArg);
        }
@@ -1389,7 +1391,7 @@ _SearchBarImpl::OnTextValueChangeCanceled(const _Control& source)
        {
                IEventArg* pEventArg = _PublicTextEvent::CreateTextEventArgN(TEXT_EVENT_CANCELED);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicTextEvent->Fire(*pEventArg);
        }
@@ -1418,7 +1420,7 @@ _SearchBarImpl::OnSearchBarModeChanged(_SearchBar& source, SearchBarMode mode)
        {
                IEventArg* pEventArg = _PublicSearchBarEvent::CreateSearchBarEventArgN(SEARCH_BAR_EVENT_MODE_CHANGE);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicSearchBarEvent->Fire(*pEventArg);
        }
@@ -1432,7 +1434,7 @@ _SearchBarImpl::OnLanguageChanged(LanguageCode oldLanguage, LanguageCode newLang
        {
                IEventArg* pKLanguageEventArg = _PublicLanguageEvent::CreateLanguageEventArgN(GetPublic(), oldLanguage, newLanguage);
                result r = GetLastResult();
-               SysTryReturnVoidResult(NID_UI_CTRL, pKLanguageEventArg, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnVoidResult(NID_UI_CTRL, pKLanguageEventArg != null, r, "[%s] Propagating.", GetErrorMessage(r));
 
                __pPublicLanguageEvent->Fire(*pKLanguageEventArg);
        }
@@ -1449,7 +1451,7 @@ _SearchBarImpl::OnFocusEventListenerAdded(IFocusEventListener& listener)
        ClearLastResult();
        SysTryReturnVoidResult(NID_UI,
                                __pPublicFocusEventListeners->Add(const_cast <IFocusEventListener*>(&listener)) == E_SUCCESS, E_SYSTEM,
-                               "[E_SYSTEM] A system error has occured. Failed to add listener.");
+                               "[E_SYSTEM] A system error has occurred. Failed to add listener.");
 }
 
 void
@@ -1458,7 +1460,7 @@ _SearchBarImpl::OnFocusEventListenerRemoved(IFocusEventListener& listener)
        ClearLastResult();
        SysTryReturnVoidResult(NID_UI,
                                __pPublicFocusEventListeners->Remove(&listener) == E_SUCCESS, E_SYSTEM,
-                               "[E_SYSTEM] A system error has occured. Failed to remove listener.");
+                               "[E_SYSTEM] A system error has occurred. Failed to remove listener.");
 }
 
 void
@@ -1480,7 +1482,7 @@ _SearchBarImpl::OnFocusGained(const Tizen::Ui::Control& source)
 
                        IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
 
-                       if (pFocusEventListener != null )
+                       if (pFocusEventListener != null)
                        {
                                pFocusEventListener->OnFocusGained(GetPublic());
                        }
@@ -1510,7 +1512,7 @@ _SearchBarImpl::OnFocusLost(const Tizen::Ui::Control& source)
 
                        IFocusEventListener* pFocusEventListener = dynamic_cast <IFocusEventListener*>(pListener);
 
-                       if (pFocusEventListener != null )
+                       if (pFocusEventListener != null)
                        {
                                pFocusEventListener->OnFocusLost(GetPublic());
                        }
@@ -1535,7 +1537,7 @@ _SearchBarImpl::OnKeyPressed(const Tizen::Ui::Control& source, Tizen::Ui::KeyCod
 
                        IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
 
-                       if (pKeyEventListener != null )
+                       if (pKeyEventListener != null)
                        {
                                pKeyEventListener->OnKeyPressed(GetPublic(), keyCode);
                        }
@@ -1560,7 +1562,7 @@ _SearchBarImpl::OnKeyReleased(const Tizen::Ui::Control& source, Tizen::Ui::KeyCo
 
                        IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
 
-                       if (pKeyEventListener != null )
+                       if (pKeyEventListener != null)
                        {
                                pKeyEventListener->OnKeyReleased(GetPublic(), keyCode);
                        }
@@ -1585,7 +1587,7 @@ _SearchBarImpl::OnKeyLongPressed(const Tizen::Ui::Control& source, Tizen::Ui::Ke
 
                        IKeyEventListener* pKeyEventListener = dynamic_cast <IKeyEventListener*>(pListener);
 
-                       if (pKeyEventListener != null )
+                       if (pKeyEventListener != null)
                        {
                                pKeyEventListener->OnKeyLongPressed(GetPublic(), keyCode);
                        }
@@ -1701,7 +1703,7 @@ protected:
                        return null;
                }
 
-               pSearchBar = new (std::nothrow) SearchBar;
+               pSearchBar = new (std::nothrow) SearchBar();
                if (pSearchBar == null)
                {
                        return null;