diff options
| -rw-r--r-- | main/src/cgeo/geocaching/files/FileParser.java | 16 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/network/HtmlImage.java | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/network/OAuth.java | 8 |
3 files changed, 8 insertions, 19 deletions
diff --git a/main/src/cgeo/geocaching/files/FileParser.java b/main/src/cgeo/geocaching/files/FileParser.java index 9521c70..09b7b84 100644 --- a/main/src/cgeo/geocaching/files/FileParser.java +++ b/main/src/cgeo/geocaching/files/FileParser.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Collection; -import java.util.Date; import java.util.concurrent.CancellationException; public abstract class FileParser { @@ -24,24 +23,19 @@ public abstract class FileParser { * Parses caches from input stream. * * @param stream + * the input stream * @param progressHandler - * for reporting parsing progress (in bytes read from input stream) + * for reporting parsing progress (in bytes read from input stream) * @return collection of caches * @throws IOException - * if the input stream can't be read + * if the input stream can't be read * @throws ParserException - * if the input stream contains data not matching the file format of the parser + * if the input stream contains data not matching the file format of the parser */ public abstract Collection<Geocache> parse(@NonNull final InputStream stream, @Nullable final CancellableHandler progressHandler) throws IOException, ParserException; /** * Convenience method for parsing a file. - * - * @param file - * @param progressHandler - * @return - * @throws IOException - * @throws ParserException */ public Collection<Geocache> parse(final File file, final CancellableHandler progressHandler) throws IOException, ParserException { final BufferedInputStream stream = new BufferedInputStream(new FileInputStream(file)); @@ -84,7 +78,7 @@ public abstract class FileParser { } else { cache.setInventoryItems(0); } - final long time = new Date().getTime(); + final long time = System.currentTimeMillis(); cache.setUpdated(time); cache.setDetailedUpdate(time); } diff --git a/main/src/cgeo/geocaching/network/HtmlImage.java b/main/src/cgeo/geocaching/network/HtmlImage.java index 7826fb0..61606ab 100644 --- a/main/src/cgeo/geocaching/network/HtmlImage.java +++ b/main/src/cgeo/geocaching/network/HtmlImage.java @@ -44,7 +44,6 @@ import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.util.Date; /** * All-purpose image getter that can also be used as a ImageGetter interface when displaying caches. @@ -400,7 +399,7 @@ public class HtmlImage implements Html.ImageGetter { @NonNull private ImmutablePair<Bitmap, Boolean> loadCachedImage(final File file, final boolean forceKeep) { if (file.exists()) { - final boolean freshEnough = listId >= StoredList.STANDARD_LIST_ID || file.lastModified() > (new Date().getTime() - (24 * 60 * 60 * 1000)) || forceKeep; + final boolean freshEnough = listId >= StoredList.STANDARD_LIST_ID || file.lastModified() > (System.currentTimeMillis() - (24 * 60 * 60 * 1000)) || forceKeep; if (freshEnough && onlySave) { return ImmutablePair.of((Bitmap) null, true); } diff --git a/main/src/cgeo/geocaching/network/OAuth.java b/main/src/cgeo/geocaching/network/OAuth.java index c23ffbf..4f1fcc0 100644 --- a/main/src/cgeo/geocaching/network/OAuth.java +++ b/main/src/cgeo/geocaching/network/OAuth.java @@ -8,7 +8,6 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; import java.util.ArrayList; -import java.util.Date; import java.util.List; public class OAuth { @@ -24,7 +23,7 @@ public class OAuth { "oauth_consumer_key", consumerKey, "oauth_nonce", CryptUtils.md5(Long.toString(System.currentTimeMillis())), "oauth_signature_method", "HMAC-SHA1", - "oauth_timestamp", Long.toString(new Date().getTime() / 1000), + "oauth_timestamp", Long.toString(System.currentTimeMillis() / 1000), "oauth_token", StringUtils.defaultString(tokens.getTokenPublic()), "oauth_version", "1.0"); params.sort(); @@ -41,10 +40,7 @@ public class OAuth { } /** - * percent encode following http://tools.ietf.org/html/rfc5849#section-3.6 - * - * @param url - * @return + * Percent encode following http://tools.ietf.org/html/rfc5849#section-3.6 */ static String percentEncode(@NonNull final String url) { return StringUtils.replace(Network.rfc3986URLEncode(url), "*", "%2A"); |
