[jira] Created: (IO-155) use NIO for copyFile when running on java 1.4

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
use NIO for copyFile when running on java 1.4
---------------------------------------------

                 Key: IO-155
                 URL: https://issues.apache.org/jira/browse/IO-155
             Project: Commons IO
          Issue Type: Improvement
          Components: Utilities
    Affects Versions: 1.4
            Reporter: nicolas de loof
            Priority: Trivial
             Fix For: 1.4


CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

nicolas de loof updated IO-155:
-------------------------------

    Attachment: IO-155.patch

detect a java 1.4 runtime and use nio to copyFile instead of buffers.

Don't require to change minimal JDK requirement as original code for java 1.3 is used as fallback.

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: 1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557658#action_12557658 ]

Sebb commented on IO-155:
-------------------------

Rather than catching Exception, surely the code should catch ClassNotFoundException?

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: 1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557661#action_12557661 ]

nicolas de loof commented on IO-155:
------------------------------------

as this static block is only dedicated to detect java runtime, catching Exception (or maybe Throwable) prevents any possible initialization error. But catching ClassNotFoundException would be also valid

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: 1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated IO-155:
-------------------------------

    Fix Version/s:     (was: 1.4)
                   AFTER-1.4

IMO better to not have the JDK 1.4 hack and just put this into the next release. Also we have a small script to check that JDK 1.4 features haven't crept in (excluding the new implementations that require it) - if we put this in then we would have to exclude IOUtils and everything that depends on it - then theres no way for people reviewing the release to verify easily for themselves that we are still JDK 1.3 compliant for everything except the four new implementations.

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: AFTER-1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557663#action_12557663 ]

Julien Aymé commented on IO-155:
--------------------------------

The given patch will still throw a NoClassDefFoundError: java.nio.channels.FileChannel on class initialisation if run under Java 1.3, since it will try to find a ref to FileChannel when loading the FileUtils class (due to its presence in the methods doCopyFile and closeQuietly(Channel)).

In order to circumvent this error, the simpler solution is to create a new class FileUtils14.java, which contains exactly the code which uses 1.4 features,
and delegate to this class if isJava4 is true.

(The trick is that if isJava14 is false, the FileUtils14.class will not be loaded into the ClassLoader (the execution of code does not need to), and so the NoClassDefFoundError will not be thrown).

The new FileUtils14.java fill follow

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: AFTER-1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Issue Comment Edited: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557663#action_12557663 ]

[hidden email] edited comment on IO-155 at 1/10/08 7:02 AM:
---------------------------------------------------------

The given patch will still throw a NoClassDefFoundError: java.nio.channels.FileChannel on class initialisation if run under Java 1.3, since it will try to find a ref to FileChannel when loading the FileUtils class (due to its presence in the methods doCopyFile and closeQuietly(Channel)).

In order to circumvent this error, the simpler solution is to create a new class FileUtils14.java, which contains exactly the code which uses 1.4 features,
and delegate to this class if isJava4 is true.

(The trick is that if isJava14 is false, the FileUtils14.class will not be loaded into the ClassLoader (the execution of code does not need to), and so the NoClassDefFoundError will not be thrown).

      was (Author: [hidden email]):
    The given patch will still throw a NoClassDefFoundError: java.nio.channels.FileChannel on class initialisation if run under Java 1.3, since it will try to find a ref to FileChannel when loading the FileUtils class (due to its presence in the methods doCopyFile and closeQuietly(Channel)).

In order to circumvent this error, the simpler solution is to create a new class FileUtils14.java, which contains exactly the code which uses 1.4 features,
and delegate to this class if isJava4 is true.

(The trick is that if isJava14 is false, the FileUtils14.class will not be loaded into the ClassLoader (the execution of code does not need to), and so the NoClassDefFoundError will not be thrown).

The new FileUtils14.java fill follow
 

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: AFTER-1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557725#action_12557725 ]

Gary Gregory commented on IO-155:
---------------------------------

I am not a fan of the conditional Java 1.4 code. Let's release 1.4 without it and then set the requirement for IO 1.5 to Java 1.4.

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: AFTER-1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557734#action_12557734 ]

Gary Gregory commented on IO-155:
---------------------------------

Also, how does the Apache nightly-build test this? AFAIK, the n-build only runs on one version of Java. In order to make sure this works, you MUST build on Java 1.3 AND Java 1.4.

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Priority: Trivial
>             Fix For: AFTER-1.4
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (IO-155) use NIO for copyFile when running on java 1.4

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/IO-155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton resolved IO-155.
--------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 2.x)
                   2.0
         Assignee: Niall Pemberton

Fixed thanks

http://svn.apache.org/viewvc?view=rev&revision=619156

> use NIO for copyFile when running on java 1.4
> ---------------------------------------------
>
>                 Key: IO-155
>                 URL: https://issues.apache.org/jira/browse/IO-155
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: nicolas de loof
>            Assignee: Niall Pemberton
>            Priority: Trivial
>             Fix For: 2.0
>
>         Attachments: IO-155.patch
>
>
> CopyFile can rely on java.nio when runtime is java 1.4 +

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