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
This commit is contained in:
adrian.f.cole 2009-09-03 03:57:21 +00:00
parent 94b13626f1
commit 4e05fcf529
1 changed files with 3 additions and 5 deletions

View File

@ -60,13 +60,13 @@ import com.google.inject.assistedinject.FactoryProvider;
public class ParserModule extends AbstractModule {
private final static TypeLiteral<ParseSax.Factory> parseSaxFactoryLiteral = new TypeLiteral<ParseSax.Factory>() {
};
protected void configure() {
bind(parseSaxFactoryLiteral).toProvider(
FactoryProvider.newFactory(parseSaxFactoryLiteral, new TypeLiteral<ParseSax<?>>() {
}));
}
static class DateTimeAdapter implements JsonSerializer<DateTime>, JsonDeserializer<DateTime> {
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;
}