spring-projects/spring-data-couchbase — pull request #33 by DWvanGeest (2014-09-25 15:38:27+00:00)
Title: Fix DATACOUCH-111

Hi,

Not entirely sure what the protocol is for contributions here, but this is a pretty straightforward fix for https://jira.spring.io/browse/DATACOUCH-111.

The issue is that when `java.util.Date` or `org.joda.time.DateTime` (or similar) are persisted, they are persisted as # of milliseconds since the Unix Epoch. If the date/time in question falls into the range of an `Integer` (any time <= 1970-01-25T20:31:23.647Z), it can't currently be converted back to a date/time when the document is read back from Couchbase.

The following exception is produced:
```
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.Integer to type org.joda.time.DateTime
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:276) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:171) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:153) ~[spring-core-3.2.9.RELEASE.jar:3.2.9.RELEASE]
at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.getPotentiallyConvertedSimpleRead(MappingCouchbaseConverter.java:294) ~[spring-data-couchbase-1.1.0.RELEASE.jar:na]
at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.readValue(MappingCouchbaseConverter.java:687) ~[spring-data-couchbase-1.1.0.RELEASE.jar:na]
at org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter.access$200(MappingCouchbaseConverter.java:51) ~[spring-data-couchbase-1.1.0.RELEASE.jar:na]
....
```

This fixes the issue by providing converters for `Integer`, based off the current converters for `Long`.

I would like to add tests, but was not sure where exactly they should go. I would be happy to add some, given a bit of direction. At any rate, the existing tests pass.

Thanks!