[jira] [Commented] (IO-554) FileUtils.copyToFile(InputStream source, File destination) should not close input stream
[ https://issues.apache.org/jira/browse/IO-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17118773#comment-17118773 ] Jochen Wiedmann commented on IO-554: See [https://lists.apache.org/thread.html/r3cca5423debb9d2e8b439fcc4acf8eb150bfefc9ae2338f64ac43428%40%3Cdev.commons.apache.org%3E] > FileUtils.copyToFile(InputStream source, File destination) should not close > input stream > > > Key: IO-554 > URL: https://issues.apache.org/jira/browse/IO-554 > Project: Commons IO > Issue Type: Bug > Components: Streams/Writers >Affects Versions: 2.6 >Reporter: Michele Mariotti >Assignee: Bruno P. Kinoshita >Priority: Blocker > Labels: regression > Fix For: 2.7 > > > In 2.6 this method is closing the input stream, while the javadoc states the > opposite. > The correct behavior is to leave the stream open, as stated in the javadoc. > I assigned a high priority because this incorrect behavior breaks existing > code, especially when used in combination with ZipInputStream. > {code:java} > /** > * Copies bytes from an {@link InputStream} source to a file > * destination. The directories up to destination > * will be created if they don't already exist. destination > * will be overwritten if it already exists. > * The {@code source} stream is left open, e.g. for use with {@link > java.util.zip.ZipInputStream ZipInputStream}. > * See {@link #copyInputStreamToFile(InputStream, File)} for a method that > closes the input stream. > * > * @param source the InputStream to copy bytes from, must > not be {@code null} > * @param destination the non-directory File to write bytes to > *(possibly overwriting), must not be {@code null} > * @throws IOException if destination is a directory > * @throws IOException if destination cannot be written > * @throws IOException if destination needs creating but can't be > * @throws IOException if an IO error occurs during copying > * @since 2.5 > */ > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (InputStream in = source; >OutputStream out = openOutputStream(destination)) { > IOUtils.copy(in, out); > } > } > {code} > instead it should be: > {code:java} > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (OutputStream out = openOutputStream(destination)) { > IOUtils.copy(source, out); > } > }{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-554) FileUtils.copyToFile(InputStream source, File destination) should not close input stream
[ https://issues.apache.org/jira/browse/IO-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17118742#comment-17118742 ] Jochen Reinhardt commented on IO-554: - Just hit by this issue. When can we have a release? Can you do a fix release, e.g. 2.6.1? Is this going to literally take years to make a fix available? > FileUtils.copyToFile(InputStream source, File destination) should not close > input stream > > > Key: IO-554 > URL: https://issues.apache.org/jira/browse/IO-554 > Project: Commons IO > Issue Type: Bug > Components: Streams/Writers >Affects Versions: 2.6 >Reporter: Michele Mariotti >Assignee: Bruno P. Kinoshita >Priority: Blocker > Labels: regression > Fix For: 2.7 > > > In 2.6 this method is closing the input stream, while the javadoc states the > opposite. > The correct behavior is to leave the stream open, as stated in the javadoc. > I assigned a high priority because this incorrect behavior breaks existing > code, especially when used in combination with ZipInputStream. > {code:java} > /** > * Copies bytes from an {@link InputStream} source to a file > * destination. The directories up to destination > * will be created if they don't already exist. destination > * will be overwritten if it already exists. > * The {@code source} stream is left open, e.g. for use with {@link > java.util.zip.ZipInputStream ZipInputStream}. > * See {@link #copyInputStreamToFile(InputStream, File)} for a method that > closes the input stream. > * > * @param source the InputStream to copy bytes from, must > not be {@code null} > * @param destination the non-directory File to write bytes to > *(possibly overwriting), must not be {@code null} > * @throws IOException if destination is a directory > * @throws IOException if destination cannot be written > * @throws IOException if destination needs creating but can't be > * @throws IOException if an IO error occurs during copying > * @since 2.5 > */ > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (InputStream in = source; >OutputStream out = openOutputStream(destination)) { > IOUtils.copy(in, out); > } > } > {code} > instead it should be: > {code:java} > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (OutputStream out = openOutputStream(destination)) { > IOUtils.copy(source, out); > } > }{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-554) FileUtils.copyToFile(InputStream source, File destination) should not close input stream
[ https://issues.apache.org/jira/browse/IO-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16964116#comment-16964116 ] Thomas Mortagne commented on IO-554: A release would definitely be nice, this is starting to be pretty old. > FileUtils.copyToFile(InputStream source, File destination) should not close > input stream > > > Key: IO-554 > URL: https://issues.apache.org/jira/browse/IO-554 > Project: Commons IO > Issue Type: Bug > Components: Streams/Writers >Affects Versions: 2.6 >Reporter: Michele Mariotti >Assignee: Bruno P. Kinoshita >Priority: Blocker > Labels: regression > Fix For: 2.7 > > > In 2.6 this method is closing the input stream, while the javadoc states the > opposite. > The correct behavior is to leave the stream open, as stated in the javadoc. > I assigned a high priority because this incorrect behavior breaks existing > code, especially when used in combination with ZipInputStream. > {code:java} > /** > * Copies bytes from an {@link InputStream} source to a file > * destination. The directories up to destination > * will be created if they don't already exist. destination > * will be overwritten if it already exists. > * The {@code source} stream is left open, e.g. for use with {@link > java.util.zip.ZipInputStream ZipInputStream}. > * See {@link #copyInputStreamToFile(InputStream, File)} for a method that > closes the input stream. > * > * @param source the InputStream to copy bytes from, must > not be {@code null} > * @param destination the non-directory File to write bytes to > *(possibly overwriting), must not be {@code null} > * @throws IOException if destination is a directory > * @throws IOException if destination cannot be written > * @throws IOException if destination needs creating but can't be > * @throws IOException if an IO error occurs during copying > * @since 2.5 > */ > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (InputStream in = source; >OutputStream out = openOutputStream(destination)) { > IOUtils.copy(in, out); > } > } > {code} > instead it should be: > {code:java} > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (OutputStream out = openOutputStream(destination)) { > IOUtils.copy(source, out); > } > }{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (IO-554) FileUtils.copyToFile(InputStream source, File destination) should not close input stream
[ https://issues.apache.org/jira/browse/IO-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16929114#comment-16929114 ] Václav Haisman commented on IO-554: --- Can we get a release of Commons IO with this fix? I have just hit it and it is mighty annoying. > FileUtils.copyToFile(InputStream source, File destination) should not close > input stream > > > Key: IO-554 > URL: https://issues.apache.org/jira/browse/IO-554 > Project: Commons IO > Issue Type: Bug > Components: Streams/Writers >Affects Versions: 2.6 >Reporter: Michele Mariotti >Assignee: Bruno P. Kinoshita >Priority: Blocker > Labels: regression > Fix For: 2.7 > > > In 2.6 this method is closing the input stream, while the javadoc states the > opposite. > The correct behavior is to leave the stream open, as stated in the javadoc. > I assigned a high priority because this incorrect behavior breaks existing > code, especially when used in combination with ZipInputStream. > {code:java} > /** > * Copies bytes from an {@link InputStream} source to a file > * destination. The directories up to destination > * will be created if they don't already exist. destination > * will be overwritten if it already exists. > * The {@code source} stream is left open, e.g. for use with {@link > java.util.zip.ZipInputStream ZipInputStream}. > * See {@link #copyInputStreamToFile(InputStream, File)} for a method that > closes the input stream. > * > * @param source the InputStream to copy bytes from, must > not be {@code null} > * @param destination the non-directory File to write bytes to > *(possibly overwriting), must not be {@code null} > * @throws IOException if destination is a directory > * @throws IOException if destination cannot be written > * @throws IOException if destination needs creating but can't be > * @throws IOException if an IO error occurs during copying > * @since 2.5 > */ > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (InputStream in = source; >OutputStream out = openOutputStream(destination)) { > IOUtils.copy(in, out); > } > } > {code} > instead it should be: > {code:java} > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (OutputStream out = openOutputStream(destination)) { > IOUtils.copy(source, out); > } > }{code} -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (IO-554) FileUtils.copyToFile(InputStream source, File destination) should not close input stream
[ https://issues.apache.org/jira/browse/IO-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16510287#comment-16510287 ] ASF GitHub Bot commented on IO-554: --- Github user asfgit closed the pull request at: https://github.com/apache/commons-io/pull/49 > FileUtils.copyToFile(InputStream source, File destination) should not close > input stream > > > Key: IO-554 > URL: https://issues.apache.org/jira/browse/IO-554 > Project: Commons IO > Issue Type: Bug > Components: Streams/Writers >Affects Versions: 2.6 >Reporter: Michele Mariotti >Assignee: Bruno P. Kinoshita >Priority: Blocker > Labels: regression > Fix For: 2.7 > > > In 2.6 this method is closing the input stream, while the javadoc states the > opposite. > The correct behavior is to leave the stream open, as stated in the javadoc. > I assigned a high priority because this incorrect behavior breaks existing > code, especially when used in combination with ZipInputStream. > {code:java} > /** > * Copies bytes from an {@link InputStream} source to a file > * destination. The directories up to destination > * will be created if they don't already exist. destination > * will be overwritten if it already exists. > * The {@code source} stream is left open, e.g. for use with {@link > java.util.zip.ZipInputStream ZipInputStream}. > * See {@link #copyInputStreamToFile(InputStream, File)} for a method that > closes the input stream. > * > * @param source the InputStream to copy bytes from, must > not be {@code null} > * @param destination the non-directory File to write bytes to > *(possibly overwriting), must not be {@code null} > * @throws IOException if destination is a directory > * @throws IOException if destination cannot be written > * @throws IOException if destination needs creating but can't be > * @throws IOException if an IO error occurs during copying > * @since 2.5 > */ > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (InputStream in = source; >OutputStream out = openOutputStream(destination)) { > IOUtils.copy(in, out); > } > } > {code} > instead it should be: > {code:java} > public static void copyToFile(final InputStream source, final File > destination) throws IOException { > try (OutputStream out = openOutputStream(destination)) { > IOUtils.copy(source, out); > } > }{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)