{
LogDebug("entered");
-// AceSecurityStatus status = CONTACT_CHECK_ACCESS(controller->getContext(), CONTACT_FUNCTION_API_ADD);
+ bool js2ndParamIsValue = false;
+ bool js3rdParamIsValue = false;
+
+// AceSecurityStatus status = CONTACT_CHECK_ACCESS(CONTACT_FUNCTION_API_ADD);
// TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
JSAttributeRangeFilterPriv *priv = static_cast<JSAttributeRangeFilterPriv*>(JSObjectGetPrivate(constructor));
BasicValidator validator = BasicValidatorFactory::getValidator(gContext, exception);
Try {
- if (argumentCount < 2 || argumentCount > 3)
+ if (argumentCount < 1)
ThrowMsg(InvalidArgumentException, "Wrong arguments count.");
if (!JSValueIsString(gContext, arguments[0]))
ThrowMsg(InvalidArgumentException, "1st argument is not string.");
// 2nd and 3rd argument can be any type.
- if (argumentCount == 2)
+ if (argumentCount >= 2)
{
- if(JSValueIsNull(gContext, arguments[1]))
- ThrowMsg(InvalidArgumentException, "At least one of initialValue and endValue needed.");
+ if(!JSValueIsUndefined(gContext, arguments[1]) && !JSValueIsNull(gContext, arguments[1]))
+ js2ndParamIsValue = true;
}
- if (argumentCount == 3)
+ if (argumentCount >= 3)
{
- if(JSValueIsNull(gContext, arguments[1]) && JSValueIsNull(gContext, arguments[2]))
- ThrowMsg(InvalidArgumentException, "At least one of initialValue and endValue needed.");
+ if(!JSValueIsUndefined(gContext, arguments[2]) && !JSValueIsNull(gContext, arguments[2]))
+ js3rdParamIsValue = true;
}
+ if (!js2ndParamIsValue && !js3rdParamIsValue)
+ ThrowMsg(InvalidArgumentException, "At least one of initialValue and endValue are needed.");
+
} Catch(Exception ) {
LogError("Argument type mismatch : " << _rethrown_exception.GetMessage());
*exception = JSTizenExceptionFactory::makeErrorObject(context, JSTizenException::TYPE_MISMATCH_ERROR, "Wrong arguments");
FilterConverterFactory::ConverterType converter = FilterConverterFactory::getConverter(gContext);
std::string attributeName;
- AnyPtr initialValue;
- AnyPtr endValue;
+ AnyPtr initialValue(NULL);
+ AnyPtr endValue(NULL);
Try {
attributeName = converter->toString(arguments[0]);
}
Try {
- if(argumentCount >= 2)
+ if(js2ndParamIsValue)
initialValue = converter->toAny(arguments[1]);
else
initialValue = AnyPtr(new Any());
}
Try {
- if(argumentCount >= 3)
+ if(js3rdParamIsValue)
endValue = converter->toAny(arguments[2]);
else
endValue = AnyPtr(new Any());