From: rtrimana Date: Sat, 26 Nov 2016 03:42:41 +0000 (-0800) Subject: Replacing throw error with exit statements for now to handle fatal errors when commun... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=062a1eccbd104eab15c711aa380725c513deca14;p=iot2.git Replacing throw error with exit statements for now to handle fatal errors when communication is taking place --- diff --git a/iotjava/iotrmi/C++/IoTRMIUtil.hpp b/iotjava/iotrmi/C++/IoTRMIUtil.hpp index db43722..6b33b61 100644 --- a/iotjava/iotrmi/C++/IoTRMIUtil.hpp +++ b/iotjava/iotrmi/C++/IoTRMIUtil.hpp @@ -215,8 +215,8 @@ int IoTRMIUtil::getVarTypeSize(string type, void* paramObj) { int dataSize = getTypeSize("char"); paramLen = (*(vector*) paramObj).size() * dataSize; } else { - string error = "IoTRMICall: Unrecognizable type: " + type; - throw error; + cerr << "IoTRMIUtil: Unrecognizable type: " << type; + exit(-1); } return paramLen; @@ -278,8 +278,8 @@ void* IoTRMIUtil::getParamObject(void* retObj, const char* type, char* paramByte // This is an array type, i.e. vector retObj = getArrayParamObject(retObj, type, paramBytes, len); } else { - string error = "IoTRMIUtil: Unrecognizable type: " + string(type); - throw error; + cerr << "IoTRMIUtil: Unrecognizable type: " << type; + exit(-1); } return retObj; @@ -308,8 +308,8 @@ void* IoTRMIUtil::getArrayParamObject(void* retObj, const char* type, char* para } else if (strcmp(type, "String[]") == 0) { retObj = byteArrayToStringArray((vector*) retObj, paramBytes, len); } else { - string error = "IoTRMIUtil: Unrecognizable type: " + string(type); - throw error; + cerr << "IoTRMIUtil: Unrecognizable type: " << type; + exit(-1); } return retObj; @@ -351,8 +351,8 @@ char* IoTRMIUtil::getObjectBytes(char* retObjBytes, void* obj, const char* type) // This is an array type, i.e. vector retObjBytes = getArrayObjectBytes(retObjBytes, obj, type); } else { - string error = "IoTRMIUtil: Unrecognizable type: " + string(type); - throw error; + cerr << "IoTRMIUtil: Unrecognizable type: " << type; + exit(-1); } return retObjBytes; @@ -381,8 +381,8 @@ char* IoTRMIUtil::getArrayObjectBytes(char* retObjBytes, void* obj, const char* } else if (strcmp(type, "String[]") == 0) { retObjBytes = arrStringToByteArray(*((vector*) obj), retObjBytes); } else { - string error = "IoTRMIUtil: Unrecognizable type: " + string(type); - throw error; + cerr << "IoTRMIUtil: Unrecognizable type: " << type; + exit(-1); } return retObjBytes;