You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2005/03/07 04:42:58 UTC

svn commit: r156385 - lenya/trunk/src/java/org/apache/lenya/cms/workflow/CMSHistory.java

Author: gregor
Date: Sun Mar  6 19:42:57 2005
New Revision: 156385

URL: http://svn.apache.org/viewcvs?view=rev&rev=156385
Log:
Fixed restoreVersion to correctly restore the workflow version date

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/workflow/CMSHistory.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/CMSHistory.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/workflow/CMSHistory.java?view=diff&r1=156384&r2=156385
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/CMSHistory.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/CMSHistory.java Sun Mar  6 19:42:57 2005
@@ -20,6 +20,8 @@
 package org.apache.lenya.cms.workflow;
 
 import java.io.File;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 
 import org.apache.lenya.cms.publication.Document;
@@ -184,7 +186,13 @@
             throws WorkflowException {
         Version version = super.restoreVersion(helper, element);
         CMSVersion cmsVersion = new CMSVersion(version.getEvent(), version.getState());
-        Date date = new Date(element.getAttribute(DATE_ATTRIBUTE));
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date date;
+        try {
+            date = df.parse(element.getAttribute(DATE_ATTRIBUTE));
+        } catch (final ParseException e) {
+            throw new WorkflowException("Could not parse workflow date: " +e.toString());
+        }
         cmsVersion.setDate(date);
 
         Element identityElement = helper.getFirstChild(element, IDENTITY_ELEMENT);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org