From: Grzegorz Rynkowski Date: Fri, 13 Feb 2015 14:25:32 +0000 (+0100) Subject: [exif] Fixes based on tests fails, part 2 X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~341 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19b032e20d39403a3ff51669976d516ff47bfc12;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [exif] Fixes based on tests fails, part 2 [Problem] Fails and timeouts. [Verification] 1. Build the code. 2. Run Exif tests. 3. All tests should pass except: ExifManager_getExifInfo_errorCallback_invoked_InvalidValuesError ExifManager_getThumbnail_errorCallback_invoked_InvalidValuesError ExifManager_saveExifInfo_errorCallback_invoked_InvalidValuesError [SCMRequest] Required commit to verification: https://mcdsrvbld02.digital.local/review/#/c/20331/ Change-Id: I87c814348ac73b7024d87809c8c5e0a643166b63 Signed-off-by: Grzegorz Rynkowski --- diff --git a/src/exif/exif_api.js b/src/exif/exif_api.js index 5b3f7e91..824da3cd 100644 --- a/src/exif/exif_api.js +++ b/src/exif/exif_api.js @@ -172,10 +172,6 @@ ExifManager.prototype.getExifInfo = function() { } ]); - var callArgs = { - uri: args.uri - }; - var callback = function(result) { if (native_.isFailure(result)) { native_.callIfPossible(args.errorCallback, native_.getErrorObject(result)); @@ -193,7 +189,17 @@ ExifManager.prototype.getExifInfo = function() { } }; - native_.call('ExifManager_getExifInfo', callArgs, callback); + // TODO: Check if uri is correct (invalid characters) + // It could be done by file.resolve(uri), but at now is not implemented. + tizen.filesystem.resolve(args.uri, + function() { + native_.call('ExifManager_getExifInfo', {'uri': args.uri}, callback); + }, + function() { + native_.callIfPossible(args.errorCallback, new tizen.WebAPIException( + tizen.WebAPIException.NOT_FOUND_ERR, + 'File can not be found.')); + }); }; ExifManager.prototype.saveExifInfo = function() { @@ -230,6 +236,7 @@ ExifManager.prototype.saveExifInfo = function() { } }; + // TODO: check args.exifInfo.uri native_.call('ExifManager_saveExifInfo', json, callback); }; @@ -267,6 +274,8 @@ ExifManager.prototype.getThumbnail = function() { } }; + // TODO: Check if uri is correct (invalid characters) + // It could be done by file.resolve(uri), but at now is not implemented. tizen.filesystem.resolve(args.uri, function() { native_.call('ExifManager_getThumbnail', {'uri': args.uri}, _callback); @@ -510,7 +519,7 @@ tizen.ExifInformation = function() { }, set: function(v) { if (!type_.isUndefined(v)) { - if (v === null || v instanceof Date) gpsTime_ = v; + if (v === null || v instanceof Date || v instanceof tizen.TZDate) gpsTime_ = v; } } }, diff --git a/src/exif/exif_instance.cc b/src/exif/exif_instance.cc index c6d08fcc..11e50fbe 100644 --- a/src/exif/exif_instance.cc +++ b/src/exif/exif_instance.cc @@ -126,9 +126,8 @@ void ExifInstance::ExifManagerGetThumbnail(const picojson::value& args, picojson exif_data = exif_data_new_from_file(file_path.c_str()); if (!exif_data) { - LoggerE("Thumbnail can not be loaded from path (%s)", - file_path.c_str()); - throw common::InvalidValuesException("File can not be loaded"); + LoggerE("Error reading from file [%s]", file_path.c_str()); + throw common::UnknownException("Error reading from file"); } if (exif_data->data && exif_data->size) { diff --git a/src/exif/get_exif_info.cc b/src/exif/get_exif_info.cc index 09d2ca63..fa74ff95 100644 --- a/src/exif/get_exif_info.cc +++ b/src/exif/get_exif_info.cc @@ -491,7 +491,7 @@ JsonValue GetExifInfo::LoadFromURI(const std::string& uri) { ExifData* ed = exif_data_new_from_file(file_path.c_str()); if (!ed) { LoggerE("Error reading exif from file %s", file_path.c_str()); - throw common::NotFoundException("Error reading exif from file"); + throw common::UnknownException("Error reading exif from file"); } LoggerD("loadFromURI_into_json exif_data_foreach_content START");