You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "David Maplesden (JIRA)" <ji...@apache.org> on 2008/05/07 22:25:56 UTC

[jira] Created: (IVY-815) SFTPRepository incorrectly calculates last modified time for resources

SFTPRepository incorrectly calculates last modified time for resources
----------------------------------------------------------------------

                 Key: IVY-815
                 URL: https://issues.apache.org/jira/browse/IVY-815
             Project: Ivy
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.0-beta-2
         Environment: Pretty sure this is irrelevant but anyway...
Ivy client running on Windows XP
SFTP repository running on OpenSuse Linux
            Reporter: David Maplesden
             Fix For: 2.0-RC1


When the {{org.apache.ivy.plugins.repository.sftp.SFTPRepository}} implementation calculates the last modified time for the resources it returns it uses an {{int}} constant {{MILLIS_PER_SECOND}} to multiply the {{int}} value returned by {{attrs.getMTime()}}.   

This means the calculation is done using integer arithmetic but the result is virtually always too big for an {{int}} value and so it overflows, returning a negative number.

This can easily be fixed by changing the {{MILLIS_PER_SECOND}} constant to {{long}}, the multiplication is then done using longs and the result does not overflow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (IVY-815) SFTPRepository incorrectly calculates last modified time for resources

Posted by "David Maplesden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Maplesden updated IVY-815:
--------------------------------

    Attachment: SFTPRepository.diff

Unified diff file for SFTPRepository

> SFTPRepository incorrectly calculates last modified time for resources
> ----------------------------------------------------------------------
>
>                 Key: IVY-815
>                 URL: https://issues.apache.org/jira/browse/IVY-815
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-beta-2
>         Environment: Pretty sure this is irrelevant but anyway...
> Ivy client running on Windows XP
> SFTP repository running on OpenSuse Linux
>            Reporter: David Maplesden
>             Fix For: 2.0-RC1
>
>         Attachments: SFTPRepository.diff
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> When the {{org.apache.ivy.plugins.repository.sftp.SFTPRepository}} implementation calculates the last modified time for the resources it returns it uses an {{int}} constant {{MILLIS_PER_SECOND}} to multiply the {{int}} value returned by {{attrs.getMTime()}}.   
> This means the calculation is done using integer arithmetic but the result is virtually always too big for an {{int}} value and so it overflows, returning a negative number.
> This can easily be fixed by changing the {{MILLIS_PER_SECOND}} constant to {{long}}, the multiplication is then done using longs and the result does not overflow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (IVY-815) SFTPRepository incorrectly calculates last modified time for resources

Posted by "Nicolas Lalevée (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nicolas Lalevée resolved IVY-815.
---------------------------------

    Resolution: Fixed
      Assignee: Nicolas Lalevée

Good catch David, and thanks for contributing !



> SFTPRepository incorrectly calculates last modified time for resources
> ----------------------------------------------------------------------
>
>                 Key: IVY-815
>                 URL: https://issues.apache.org/jira/browse/IVY-815
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-beta-2
>         Environment: Pretty sure this is irrelevant but anyway...
> Ivy client running on Windows XP
> SFTP repository running on OpenSuse Linux
>            Reporter: David Maplesden
>            Assignee: Nicolas Lalevée
>             Fix For: 2.0-RC1
>
>         Attachments: SFTPRepository.diff
>
>   Original Estimate: 0.02h
>  Remaining Estimate: 0.02h
>
> When the {{org.apache.ivy.plugins.repository.sftp.SFTPRepository}} implementation calculates the last modified time for the resources it returns it uses an {{int}} constant {{MILLIS_PER_SECOND}} to multiply the {{int}} value returned by {{attrs.getMTime()}}.   
> This means the calculation is done using integer arithmetic but the result is virtually always too big for an {{int}} value and so it overflows, returning a negative number.
> This can easily be fixed by changing the {{MILLIS_PER_SECOND}} constant to {{long}}, the multiplication is then done using longs and the result does not overflow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.