From 4e05fcf529cca47961a5d55228b59d5ca0f72b1a Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Thu, 3 Sep 2009 03:57:21 +0000 Subject: [PATCH] took out null checking, as exceptions are now thrown when parsing fails git-svn-id: http://jclouds.googlecode.com/svn/trunk@1873 3d8758e0-26b5-11de-8745-db77d3ebf521 --- .../org/jclouds/http/functions/config/ParserModule.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/jclouds/http/functions/config/ParserModule.java b/core/src/main/java/org/jclouds/http/functions/config/ParserModule.java index 13c6e25882..42759d830e 100755 --- a/core/src/main/java/org/jclouds/http/functions/config/ParserModule.java +++ b/core/src/main/java/org/jclouds/http/functions/config/ParserModule.java @@ -60,13 +60,13 @@ import com.google.inject.assistedinject.FactoryProvider; public class ParserModule extends AbstractModule { private final static TypeLiteral parseSaxFactoryLiteral = new TypeLiteral() { }; - + protected void configure() { bind(parseSaxFactoryLiteral).toProvider( FactoryProvider.newFactory(parseSaxFactoryLiteral, new TypeLiteral>() { })); } - + static class DateTimeAdapter implements JsonSerializer, JsonDeserializer { private final static DateService dateService = new DateService(); @@ -77,9 +77,7 @@ public class ParserModule extends AbstractModule { public DateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { String toParse = json.getAsJsonPrimitive().getAsString(); - DateTime toReturn = dateService.iso8601DateParse(toParse); - if (toReturn == null) toReturn = new DateTime(toParse); - if (toReturn == null) throw new RuntimeException("could not parse: "+toParse); + DateTime toReturn = dateService.jodaIso8601DateParse(toParse); return toReturn; }