[ 
https://jira.duraspace.org/browse/DS-775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19916#action_19916
 ] 

Mark H. Wood commented on DS-775:
---------------------------------

How are the results incorrect?  Your patch looks reasonable, but I can't make 
the old code fail -- at least, when I test old and new thus, I get identical 
results from each:

import java.util.Calendar;
import java.util.Date;

public class embargo
{
  public static void main(String[] argv)
  {
    String days = argv[0];
    long lift = System.currentTimeMillis() +
      (Long.parseLong(days) * 24 * 60 * 60 * 1000);
    System.out.println("Longs:     " + new Date(lift));

    Calendar lift2 = Calendar.getInstance();
    lift2.add(Calendar.DAY_OF_YEAR, Integer.parseInt(days));
    Date liftDate = lift2.getTime();
    System.out.println("Calendar:  " + liftDate);
  }
}


> Implementation of DayTableEmbargoSetter.java not working as expected.
> ---------------------------------------------------------------------
>
>                 Key: DS-775
>                 URL: https://jira.duraspace.org/browse/DS-775
>             Project: DSpace
>          Issue Type: Code Task
>          Components: DSpace API
>    Affects Versions: 1.7.0
>            Reporter: Tim Ribaric
>            Assignee: Mark H. Wood
>            Priority: Major
>         Attachments: DayTableEmbargoSetter_mod.java
>
>
> The original implementation of DayTableEmbargoSetter.java worked by grabbing 
> the system time in milliseconds computing the embargo period in milliseconds 
> adding the two and then casting into a Date.  For whatever reason this never 
> calculates correctly in all the test cases I attempted.  I rewrote a few 
> lines of the class to instead use a Calendar offset to figure out the Lift 
> Date.  I think this is a more reliable implementation but I'm happy to hear 
> what others say.

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

        

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to