Page 1 of 1

[Bug] Admin3 - Cannot modify items: date parsing error

Posted: Thu Apr 25, 2013 4:39 pm
by karim.hj
Demo Site based on BLC 3.0.0-SNAPSHOT
    Select an product or category
    Modify the date (or not )
    Save it
    Error page occurs
-------------
ScreenShot297.png
ScreenShot297.png (24.44 KiB) Viewed 2568 times

-------------
[...]
Caused by: org.broadleafcommerce.openadmin.server.service.persistence.PersistenceException: java.text.ParseException: Unparseable date: "2013.01.01 00:00:00"
[artifact:mvn] at org.broadleafcommerce.openadmin.server.service.persistence.module.provider.BasicPersistenceProvider.populateValue(BasicPersistenceProvider.java:222)
[artifact:mvn] at org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.createPopulatedInstance(BasicPersistenceModule.java:244)
[artifact:mvn] at org.broadleafcommerce.admin.server.service.handler.ProductCustomPersistenceHandler.update(ProductCustomPersistenceHandler.java:111)
[artifact:mvn] at org.broadleafcommerce.openadmin.server.service.persistence.PersistenceManagerImpl.update(PersistenceManagerImpl.java:308)
[artifact:mvn] at org.broadleafcommerce.openadmin.server.service.DynamicEntityRemoteService.update(DynamicEntityRemoteService.java:241)
[artifact:mvn] ... 132 more
[artifact:mvn] Caused by: java.text.ParseException: Unparseable date: "2013.01.01 00:00:00"
[artifact:mvn] at java.text.DateFormat.parse(DateFormat.java:337)
[artifact:mvn] at org.broadleafcommerce.openadmin.server.service.persistence.module.provider.BasicPersistenceProvider.populateValue(BasicPersistenceProvider.java:115)
[artifact:mvn] ... 136 more
[artifact:mvn] 2013-04-25 23:09:06.791:WARN:oejs.ServletHandler:/admin/product/1
[artifact:mvn] org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Transaction marked as rollbackOnly
[...]
-----------
maybe in BasicPersistenceModule.java ?
protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss Z");

[Fixed] Admin3 - timezone parsing non "chrome" browsers

Posted: Wed May 01, 2013 8:38 am
by karim.hj
This is a bug linked to browser and timezone parsing:
admin/broadleaf-open-admin-platform/src/main/resources/open_admin_style/js/admin/ui/dates.js

- Sometimes you don't have GMT but UTC
- Sometimes you don't have spaces character after timezone code

ko Firefox 20 "Wed May 01 2013 13:24:00 GMT+0200" (space missing)
ko IE10 "Wed May 1 13:24:00 UTC+0200 2013" (UTC)
ok Chrome26 "Wed May 01 2013 13:24:00 GMT+0200 (Paris, Madrid (heure d’été))" (still works)

Because of that Categories & products could not be edited and saved in IE/FF browsers

KO firefox 20.0.1: Unparseable date: "2013.05.01 13:24:00"
KO internet explorer 10: Unparseable date: "2013.05.01 13:24:00 d"
OK google chrome Version 26.0.1410.64 m: "2013.05.01 13:24:00 +0200"

Only the last case matches "yyyy.MM.dd HH:mm:ss Z" pattern.

Fix:

Code: Select all

  var regexTimezone = /.*([\+\-][0-9]{4}).*/;
                timezone = timezone.replace(regexTimezone, "$1");


i send a PullRequest for that...