[jira] [Commented] (TOMEE-1933) InputStreamLeak in IO.java

2016-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TOMEE-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15506604#comment-15506604
 ] 

ASF GitHub Bot commented on TOMEE-1933:
---

Github user asfgit closed the pull request at:

https://github.com/apache/tomee/pull/40


> InputStreamLeak in IO.java
> --
>
> Key: TOMEE-1933
> URL: https://issues.apache.org/jira/browse/TOMEE-1933
> Project: TomEE
>  Issue Type: Bug
>Reporter: Svetlin Zarev
>Assignee: Romain Manni-Bucau
> Fix For: 7.0.2
>
>
> slurp() leaks the stream. Patch provided



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TOMEE-1933) InputStreamLeak in IO.java

2016-09-13 Thread Svetlin Zarev (JIRA)

[ 
https://issues.apache.org/jira/browse/TOMEE-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15489525#comment-15489525
 ] 

Svetlin Zarev commented on TOMEE-1933:
--

oops it should be return slurp(in); 

> InputStreamLeak in IO.java
> --
>
> Key: TOMEE-1933
> URL: https://issues.apache.org/jira/browse/TOMEE-1933
> Project: TomEE
>  Issue Type: Bug
>Reporter: Svetlin Zarev
>
> slurp() leaks the stream. Patch provided



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TOMEE-1933) InputStreamLeak in IO.java

2016-09-13 Thread Svetlin Zarev (JIRA)

[ 
https://issues.apache.org/jira/browse/TOMEE-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15489517#comment-15489517
 ] 

Svetlin Zarev commented on TOMEE-1933:
--

Hi,

> this behavior is expected in several places now so not sure we can modify it 
> now
It might not be OK to close the stream for slurp() that has URL or InputStream 
as an argument, but the patch is only for the **slurp(File)** case. It 
internally opens the stream and it never leaves the method, so it just a pure 
leak. Closing the file stream in slurp(file) should not have any negative 
effect.

{code}
public static String slurp(final File file) throws IOException {
   final InputStream in = read(file);
   try {
   return slurp(read(file));
   } finally {
   try {
   in.close();
   } catch (IOException ex) {
   //no-op
   }
   }
}

 public static InputStream read(final File source) throws FileNotFoundException 
{
 final InputStream in = new FileInputStream(source);
 return new BufferedInputStream(in, 32768);
}
{code}

> InputStreamLeak in IO.java
> --
>
> Key: TOMEE-1933
> URL: https://issues.apache.org/jira/browse/TOMEE-1933
> Project: TomEE
>  Issue Type: Bug
>Reporter: Svetlin Zarev
>
> slurp() leaks the stream. Patch provided



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (TOMEE-1933) InputStreamLeak in IO.java

2016-09-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TOMEE-1933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15487358#comment-15487358
 ] 

ASF GitHub Bot commented on TOMEE-1933:
---

GitHub user SvetlinZarev opened a pull request:

https://github.com/apache/tomee/pull/40

Do not leak input stream in IO.java

Bug: https://issues.apache.org/jira/browse/TOMEE-1933

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/SvetlinZarev/tomee stream_leak_3

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/tomee/pull/40.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #40


commit ceb999e8cacdc05d9437426e0deb66e1f101fc72
Author: Svetlin Zarev 
Date:   2016-09-13T14:33:43Z

Do not leak input stream in IO.java




> InputStreamLeak in IO.java
> --
>
> Key: TOMEE-1933
> URL: https://issues.apache.org/jira/browse/TOMEE-1933
> Project: TomEE
>  Issue Type: Bug
>Reporter: Svetlin Zarev
>
> slurp() leaks the stream. Patch provided



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)