From 02fffda058d906c8f6f36398b3fceed98b597c9f Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 26 Jan 2011 19:23:22 -0800 Subject: [PATCH] fixed date parser when there's a wrong date format specified --- .../ParseSystemAndUserMetadataFromHeaders.java | 18 ++++++++---------- ...seSystemAndUserMetadataFromHeadersTest.java | 16 ++++++++-------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/blobstore/src/main/java/org/jclouds/blobstore/functions/ParseSystemAndUserMetadataFromHeaders.java b/blobstore/src/main/java/org/jclouds/blobstore/functions/ParseSystemAndUserMetadataFromHeaders.java index c4e8d68e0a..f7f75cab64 100755 --- a/blobstore/src/main/java/org/jclouds/blobstore/functions/ParseSystemAndUserMetadataFromHeaders.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/functions/ParseSystemAndUserMetadataFromHeaders.java @@ -22,7 +22,6 @@ package org.jclouds.blobstore.functions; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX; import static org.jclouds.blobstore.util.BlobStoreUtils.getNameFor; @@ -49,21 +48,19 @@ import com.google.common.base.Function; * @author Adrian Cole */ public class ParseSystemAndUserMetadataFromHeaders implements Function, - InvocationContext { + InvocationContext { private final String metadataPrefix; private final DateService dateParser; private final Provider metadataFactory; - private final String apiVersion; private String key; @Inject public ParseSystemAndUserMetadataFromHeaders(Provider metadataFactory, DateService dateParser, - @Named(PROPERTY_USER_METADATA_PREFIX) String metadataPrefix, @Named(PROPERTY_API_VERSION) String apiVersion) { + @Named(PROPERTY_USER_METADATA_PREFIX) String metadataPrefix) { this.metadataFactory = checkNotNull(metadataFactory, "metadataFactory"); this.dateParser = checkNotNull(dateParser, "dateParser"); this.metadataPrefix = checkNotNull(metadataPrefix, "metadataPrefix"); - this.apiVersion = checkNotNull(metadataPrefix, "metadataPrefix"); } public MutableBlobMetadata apply(HttpResponse from) { @@ -84,7 +81,7 @@ public class ParseSystemAndUserMetadataFromHeaders implements Function header : from.getHeaders().entries()) { if (header.getKey() != null && header.getKey().startsWith(metadataPrefix)) metadata.getUserMetadata().put((header.getKey().substring(metadataPrefix.length())).toLowerCase(), - header.getValue()); + header.getValue()); } } @@ -95,11 +92,12 @@ public class ParseSystemAndUserMetadataFromHeaders implements Function