mirror of
https://github.com/owncloud/android-library.git
synced 2026-08-16 02:43:00 +00:00
A little cleanup and improve some log messages
This commit is contained in:
+5
-24
@@ -37,10 +37,8 @@ import java.util.Locale;
|
||||
import static com.owncloud.android.lib.common.OwnCloudClient.WEBDAV_PATH_4_0_AND_LATER;
|
||||
|
||||
public class WebdavUtils {
|
||||
public static final SimpleDateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat(
|
||||
"dd.MM.yyyy hh:mm");
|
||||
|
||||
private static final SimpleDateFormat DATETIME_FORMATS[] = {
|
||||
private static final SimpleDateFormat[] DATETIME_FORMATS = {
|
||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US),
|
||||
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
|
||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", Locale.US),
|
||||
@@ -52,11 +50,11 @@ public class WebdavUtils {
|
||||
};
|
||||
|
||||
public static Date parseResponseDate(String date) {
|
||||
Date returnDate = null;
|
||||
SimpleDateFormat format = null;
|
||||
for (int i = 0; i < DATETIME_FORMATS.length; ++i) {
|
||||
Date returnDate;
|
||||
SimpleDateFormat format;
|
||||
for (SimpleDateFormat datetimeFormat : DATETIME_FORMATS) {
|
||||
try {
|
||||
format = DATETIME_FORMATS[i];
|
||||
format = datetimeFormat;
|
||||
synchronized (format) {
|
||||
returnDate = format.parse(date);
|
||||
}
|
||||
@@ -84,23 +82,6 @@ public class WebdavUtils {
|
||||
return encodedPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rawEtag
|
||||
* @return
|
||||
*/
|
||||
public static String parseEtag(String rawEtag) {
|
||||
if (rawEtag == null || rawEtag.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
if (rawEtag.endsWith("-gzip")) {
|
||||
rawEtag = rawEtag.substring(0, rawEtag.length() - 5);
|
||||
}
|
||||
if (rawEtag.length() >= 2 && rawEtag.startsWith("\"") && rawEtag.endsWith("\"")) {
|
||||
rawEtag = rawEtag.substring(1, rawEtag.length() - 1);
|
||||
}
|
||||
return rawEtag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param httpBaseMethod from which to get the etag
|
||||
* @return etag from response
|
||||
|
||||
Reference in New Issue
Block a user