[ 
http://jira.dspace.org/jira/browse/DS-594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robin Taylor updated DS-594:
----------------------------

    Status: Open  (was: Received)

> DCDate parsing thread synchronization issue
> -------------------------------------------
>
>                 Key: DS-594
>                 URL: http://jira.dspace.org/jira/browse/DS-594
>             Project: DSpace 1.x
>          Issue Type: Bug
>          Components: DSpace API
>    Affects Versions: 1.6.1
>            Reporter: Andrew Taylor
>            Assignee: Robin Taylor
>            Priority: Critical
>         Attachments: DCDateConcurrencyTest.java, DS-594.diff
>
>
> I have been getting a variety of exceptions coming from 
> org.dspace.content.DCDate that look suspiciously like SimpleDateFormat thread 
> synchronization issues (such as "java.lang.NumberFormatException: multiple 
> points"). On closer inspection I noticed that the DCDate(String) constructor 
> is calling the 'tryParse' method which is not 'static' synchronized and thus 
> the locking is based on the DCDate instance itself and not the class. As such 
> the 'synchronized' keyword on tryParse is redundent since that method is only 
> called by the constructor (a time when no other code can get a lock on the 
> DCDate instance).
> The fix would be to either add the 'static' keyword to tryParse, which would 
> be a fairly major performance bottleneck, or to simply clone the 
> SimpleDateFormat instance and use that to parse the string. Example code:
>     private static Date tryParse(SimpleDateFormat sdf,  String source)
>     {
>         try
>         {
>             SimpleDateFormat clone = (SimpleDateFormat) sdf.clone();
>             return clone.parse(source);
>         }
>         catch (ParseException pe)
>         {
>             return null;
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.dspace.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to