} else if (typeChar == *COL_STRING) {
type = DataType::STRING;
}
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
_E("%s", e.what());
}
try {
*records = Tuple::buildFrom(vals);
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
_E("Exception: %s", e.what());
error = E_FAILED;
}
try {
auto tuple = builder.build();
return store->proxy->insert(columns, tuple);
- } catch (std::exception& e) {
+ } catch (const std::exception& e) {
return E_FAILED;
}
}
} else if (methodCall->getMethodName() == METHOD_REMOVE) {
__remove(*store, *methodCall);
}
- } catch (int error) {
+ } catch (const int error) {
_W("Catch: %s", CTX_ERROR_STR(error));
methodCall->reply(error);
- } catch (std::exception& e) {
- _E("Exception: %s", e.what());
- methodCall->reply(E_FAILED);
}
delete methodCall;
ClientBase* ContextStoreService::createClient(const std::string& busName)
{
- return new(std::nothrow) ContextStoreClient(this, busName);
+ return new ContextStoreClient(this, busName);
}
void ContextStoreService::onUserActivated()
if (__storeManager)
return *__storeManager;
- __storeManager = new(std::nothrow) StoreManager();
-
- while (__storeManager == NULL) {
- _W("Memory allocation failed");
- __storeManager = new(std::nothrow) StoreManager();
- }
+ __storeManager = new StoreManager();
return *__storeManager;
}
{
IF_FAIL_RETURN(!isSystemReady(), true);
- __systemDatabase = new(std::nothrow) PlatformDatabase(BASE_PATH);
- IF_FAIL_RETURN_TAG(__systemDatabase, false, _E, "%s", CTX_ERROR_STR(E_NO_MEM));
+ __systemDatabase = new PlatformDatabase(BASE_PATH);
if (!__systemDatabase->open()) {
_E("DB open failed");
closeUser();
}
- __userDatabase = new(std::nothrow) PlatformDatabase(BASE_PATH, uid);
- IF_FAIL_RETURN_TAG(__userDatabase, false, _E, "%s", CTX_ERROR_STR(E_NO_MEM));
+ __userDatabase = new PlatformDatabase(BASE_PATH, uid);
if (!__userDatabase->open()) {
_E("DB open failed");
result = false;
}
- try {
- if (result && !__loadSchemaDir(__getSchemaDir())) {
- _W("Schema loading failed");
- result = false;
- }
- } catch (std::regex_error& e) {
- _E("%s", e.what());
+ if (result && !__loadSchemaDir(__getSchemaDir())) {
+ _W("Schema loading failed");
result = false;
}
if (__schemaChecker)
return __schemaChecker;
- try {
- __schemaChecker = new SchemaChecker;
- } catch (std::exception& e) {
- _E("Exception: %s", e.what());
- return NULL;
- }
+ __schemaChecker = new SchemaChecker;
return __schemaChecker;
}
schema.uri.c_str(), columns.c_str(), schema.retention, schema.limit,
readPrivil.c_str(), writePrivil.c_str(), schema.uri.c_str());
if (length <= 0) {
- _E("Memory allocation failed");
+ _E_ALLOC;
return;
}
readPrivil.c_str(), writePrivil.c_str());
if (length <= 0) {
g_free(updateSql);
- _E("Memory allocation failed");
+ _E_ALLOC;
return;
}
_D("Read: %s", readPrivil.c_str());
_D("Write: %s", writePrivil.c_str());
- StoreType* store = new(std::nothrow) StoreType();
- IF_FAIL_RETURN_TAG(store, NULL, _E, "Memory allocation failed");
-
+ StoreType* store = new StoreType();
store->metadata.uri = uri;
store->metadata.columns = columns;
store->metadata.retention= static_cast<unsigned int>(retention);