CB-438: File metadata.modificationTime returns an invalid date

This commit is contained in:
macdonst 2012-04-04 13:03:39 -04:00
parent e213772f98
commit 04aa6d3c38

View File

@ -142,8 +142,7 @@ public class FileUtils extends Plugin {
return new PluginResult(status, obj); return new PluginResult(status, obj);
} }
else if (action.equals("getMetadata")) { else if (action.equals("getMetadata")) {
JSONObject obj = getMetadata(args.getString(0)); return new PluginResult(status, getMetadata(args.getString(0)));
return new PluginResult(status, obj);
} }
else if (action.equals("getFileMetadata")) { else if (action.equals("getFileMetadata")) {
JSONObject obj = getFileMetadata(args.getString(0)); JSONObject obj = getFileMetadata(args.getString(0));
@ -764,21 +763,17 @@ public class FileUtils extends Plugin {
* Look up metadata about this entry. * Look up metadata about this entry.
* *
* @param filePath to entry * @param filePath to entry
* @return a Metadata object * @return a long
* @throws FileNotFoundException * @throws FileNotFoundException
* @throws JSONException
*/ */
private JSONObject getMetadata(String filePath) throws FileNotFoundException, JSONException { private long getMetadata(String filePath) throws FileNotFoundException {
File file = createFileObject(filePath); File file = createFileObject(filePath);
if (!file.exists()) { if (!file.exists()) {
throw new FileNotFoundException("Failed to find file in getMetadata"); throw new FileNotFoundException("Failed to find file in getMetadata");
} }
JSONObject metadata = new JSONObject(); return file.lastModified();
metadata.put("modificationTime", file.lastModified());
return metadata;
} }
/** /**