[ https://issues.apache.org/jira/browse/OLINGO-1373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16911970#comment-16911970 ]
mibo commented on OLINGO-1373: ------------------------------ Hi [~Priyanka_Bharti], [~manasiev] has given the right answer. By default the return object for {{EdmDateTimeOffset}} is {{Calendar}}: {quote} @Override public Class<?> getDefaultType() { return Calendar.class; } {quote} But the {{EdmSimpleType}} (interface) which is implemented by the {{EdmDateTimeOffset}} offers below method where you can pass another return type as parameter. {quote} public <T> T valueOfString(String value, EdmLiteralKind literalKind, EdmFacets facets, Class<T> returnType) throws EdmSimpleTypeException; {quote} When you pass {{java.sql.Timestamp}} as {{returnType}} parameter you will get an according {{java.sql.Timestamp}} which contains the nanoseconds and without getting an exception. Kind Regards, Michael > Olingo Liabrary is not able to parse DataTime with nanosecond value which is > other than 0 or divisible by 1000000 > ----------------------------------------------------------------------------------------------------------------- > > Key: OLINGO-1373 > URL: https://issues.apache.org/jira/browse/OLINGO-1373 > Project: Olingo > Issue Type: Bug > Reporter: Priyanka Bharti > Priority: Blocker > Fix For: V2 2.0.10, V2 2.0.11 > > Original Estimate: 48h > Remaining Estimate: 48h > > Olingo is not able to parse DataTime value where nanosecond is not 0 or > divisible by 1000000 > > eg: 2014-01-10T20:02:08.8757980Z > > I have debugged the issue, this issue is happening because of wrong > validation of DateTime format in olingo library. > > Class: org.apache.olingo.odata2.core.edm.EdmDateTimeOffset.class > > _if ((nanoSeconds % 1000000 != 0) && > (!(returnType.isAssignableFrom(Timestamp.class)))) {_ > _/* 119 */ throw new > EdmSimpleTypeException(EdmSimpleTypeException.LITERAL_ILLEGAL_CONTENT.addContent(new > Object[] \{ value }));_ > _/* */ }_ > > As per above code olingo expects the nanosecond should always be 0 or > divisible by 1000000, Which is not the case in *StartDateTime* field of > *Task* businessObject. > > *Valid payload:* > > <d:DueDateTime m:type="c4codata.LOCALNORMALISED_DateTime"> > <d:timeZoneCode/> > <d:content>2014-01-10T20:32:08.0000000Z</d:content> > </d:DueDateTime> > > *Invalid Payload:* > ** > <d:StartDateTime m:type="c4codata.LOCALNORMALISED_DateTime"> > <d:timeZoneCode/> > <d:content>2014-01-10T20:02:08.8757980Z</d:content> > </d:StartDateTime> -- This message was sent by Atlassian Jira (v8.3.2#803003)