logisimayml - "Unparseable date" exception

153 views
Skip to first unread message

grzeh

unread,
Mar 9, 2012, 7:45:03 AM3/9/12
to play-fr...@googlegroups.com
I use logisimayml (1.8) to generate yaml data file from my Oracle database. During this export there is exception:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at play.modules.yml.YmlExtractor.main(YmlExtractor.java:78)
Caused by: java.text.ParseException: Unparseable date: "2012-01-02"
    at java.text.DateFormat.parse(DateFormat.java:354)
    at play.modules.yml.YmlExtractorUtil.object2YmlObject(YmlExtractorUtil.java:288)
    at play.modules.yml.YmlExtractor.mainWork(YmlExtractor.java:96)
    ... 5 more

I don't know which relation generate this error (this project uses many tables), so I can not do any test case.
When I turn on trace by log4j.logger.org.hibernate.type=trace, then I see that some date values are exported, so there must be some exception in one table column.
How resolve this problem?



Sim51

unread,
Mar 9, 2012, 2:49:24 PM3/9/12
to play-fr...@googlegroups.com
Hi,

Do you have a "Temporal" on your Date field ?

I don't see where is the problem from the code :
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        if (field.getAnnotation(Temporal.class) != null) {
                            Temporal temporal = field.getAnnotation(Temporal.class);
                            switch (temporal.value()) {
                                case DATE:
                                    sdf = new SimpleDateFormat("yyyy-MM-dd");
                                    break;
                                case TIME:
                                    sdf = new SimpleDateFormat("hh:mm:ss");
                                    break;
                                case TIMESTAMP:
                                    sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                                    break;
                            }
                        }

                        Date myDate = (Date) sdf.parse(field.get(jpaBase).toString());


Cheers.

grzeh

unread,
Mar 10, 2012, 4:29:22 AM3/10/12
to play-fr...@googlegroups.com
Thanks for answer!

Finally I found the table which stop generating yaml export file.
It has DATE type field in Oracle db. In model is defined as:
    @Type(type="date")
    public Date dateFrom;
So, I add annotation:
    @Temporal(TemporalType.DATE)
... and it runs.

Thank you for help!
Reply all
Reply to author
Forward
0 new messages