karishma-tirthani / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

JPA Producer #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Create a POJO with a date member
2.  DON'T annotate the member with a TemporalType, leave it blank
3.  Instantiate a JPA Producer

What is the expected output? What do you see instead?

Expected = JPA Producer instantiates without throwing exceptions

Seen = NullPointerException raised in org.odata4j.producer.jpa.JPAEdmGenerator. 

What version of the product are you using? On what operating system?
odata4j = 0.4
os = windows

Please provide any additional information below.

NPE is thrown in this method on the return statement (i.e temporal is null)

protected TemporalType getTemporalType(SingularAttribute<?, ?> sa) {
    Member member = sa.getJavaMember();

    Temporal temporal = null;
    if (member instanceof Field) {
      temporal = ((Field) member).getAnnotation(Temporal.class);
    } else if (member instanceof Method) {
      temporal = ((Method) member).getAnnotation(Temporal.class);
    }

    return temporal.value();
  }

possible fix is to change to 
return temporal == null ? null : temporal.value();

Original issue reported on code.google.com by zenani...@gmail.com on 24 Jun 2011 at 2:16

GoogleCodeExporter commented 8 years ago
Thanks for the heads up - fixed in r244.

Original comment by john.spurlock on 25 Jun 2011 at 4:41