[exif] Fixes based on tests fails, part 2
authorGrzegorz Rynkowski <g.rynkowski@samsung.com>
Fri, 13 Feb 2015 14:25:32 +0000 (15:25 +0100)
committerRafal Galka <r.galka@samsung.com>
Tue, 3 Mar 2015 09:27:30 +0000 (10:27 +0100)
[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 <g.rynkowski@samsung.com>
src/exif/exif_api.js
src/exif/exif_instance.cc
src/exif/get_exif_info.cc

index 5b3f7e9..824da3c 100644 (file)
@@ -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;
         }
       }
     },
index c6d08fc..11e50fb 100644 (file)
@@ -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) {
index 09d2ca6..fa74ff9 100644 (file)
@@ -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");