[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-07-25 Thread Mikhail Khludnev (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16892594#comment-16892594
 ] 

Mikhail Khludnev commented on SOLR-13545:
-

spawn SOLR-13651

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Fix For: 8.2
>
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-07-24 Thread Mikhail Khludnev (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16892208#comment-16892208
 ] 

Mikhail Khludnev commented on SOLR-13545:
-

Reverting {{/ContentStreamUpdateRequest.java}} locally doesn't heal the test 
failure at branch_8x. I see that this failure happens on v2 auth request.

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Fix For: 8.2
>
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-07-23 Thread Mikhail Khludnev (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16891423#comment-16891423
 ] 

Mikhail Khludnev commented on SOLR-13545:
-

Reproduced for me. I'll check it tomorrow.  

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Fix For: 8.2
>
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-07-23 Thread Ishan Chattopadhyaya (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16891389#comment-16891389
 ] 

Ishan Chattopadhyaya commented on SOLR-13545:
-

There are very frequent failures of BasicAuthIntegrationTest (e.g.: 
https://jenkins.thetaphi.de/job/Lucene-Solr-8.x-Linux/911/), possibly due to 
this. The content stream wasn't closed and it caused 400.
I was able to reproduce those Jenkins failure locally, but they are not there 
just before these commits.

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Fix For: 8.2
>
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-22 Thread Mikhail Khludnev (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16870263#comment-16870263
 ] 

Mikhail Khludnev commented on SOLR-13545:
-

Thanks, [~dsmiley].

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-21 Thread David Smiley (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869916#comment-16869916
 ] 

David Smiley commented on SOLR-13545:
-

This code uses "var", a Java 11 feature.  The backport to Java 11 needs to 
declare the type.
Broadly... I'm not sure we should make extensive use of this language feature.

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-21 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869915#comment-16869915
 ] 

ASF subversion and git services commented on SOLR-13545:


Commit 2d60b69636a554006b82d90d4c2e7188ea7058e9 in lucene-solr's branch 
refs/heads/branch_8x from David Wayne Smiley
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=2d60b69 ]

SOLR-13545: Fix for Java 8 (no var)


> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-21 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869864#comment-16869864
 ] 

ASF subversion and git services commented on SOLR-13545:


Commit fbb64cf16ace94530cea4285242888d4d8566dd5 in lucene-solr's branch 
refs/heads/branch_8x from Mikhail Khludnev
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=fbb64cf ]

SOLR-13545: ContentStreamUpdateRequest to close file.


> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-21 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869861#comment-16869861
 ] 

ASF subversion and git services commented on SOLR-13545:


Commit 9137a0b0fe618ad0762fbda56eab6f6e5c7570e8 in lucene-solr's branch 
refs/heads/master from Mikhail Khludnev
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=9137a0b ]

SOLR-13545: ContentStreamUpdateRequest to close file.


> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-21 Thread Lucene/Solr QA (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869760#comment-16869760
 ] 

Lucene/Solr QA commented on SOLR-13545:
---

| (/) *{color:green}+1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
|| || || || {color:brown} Prechecks {color} ||
| {color:green}+1{color} | {color:green} test4tests {color} | {color:green}  0m 
 0s{color} | {color:green} The patch appears to include 1 new or modified test 
files. {color} |
|| || || || {color:brown} master Compile Tests {color} ||
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  4m  
8s{color} | {color:green} master passed {color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  3m 
43s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  3m 
43s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} Release audit (RAT) {color} | 
{color:green}  3m 43s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} Check forbidden APIs {color} | 
{color:green}  3m 43s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} Validate source patterns {color} | 
{color:green}  3m 43s{color} | {color:green} the patch passed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:green}+1{color} | {color:green} unit {color} | {color:green} 13m 
27s{color} | {color:green} solrj in the patch passed. {color} |
| {color:black}{color} | {color:black} {color} | {color:black} 27m  5s{color} | 
{color:black} {color} |
\\
\\
|| Subsystem || Report/Notes ||
| JIRA Issue | SOLR-13545 |
| JIRA Patch URL | 
https://issues.apache.org/jira/secure/attachment/12972442/SOLR-13545.patch |
| Optional Tests |  compile  javac  unit  ratsources  checkforbiddenapis  
validatesourcepatterns  |
| uname | Linux lucene2-us-west.apache.org 4.4.0-112-generic #135-Ubuntu SMP 
Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | ant |
| Personality | 
/home/jenkins/jenkins-slave/workspace/PreCommit-SOLR-Build/sourcedir/dev-tools/test-patch/lucene-solr-yetus-personality.sh
 |
| git revision | master / b3e759a |
| ant | version: Apache Ant(TM) version 1.9.6 compiled on July 20 2018 |
| Default Java | LTS |
|  Test Results | 
https://builds.apache.org/job/PreCommit-SOLR-Build/449/testReport/ |
| modules | C: solr/solrj U: solr/solrj |
| Console output | 
https://builds.apache.org/job/PreCommit-SOLR-Build/449/console |
| Powered by | Apache Yetus 0.7.0   http://yetus.apache.org |


This message was automatically generated.



> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch, SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-20 Thread Mikhail Khludnev (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869204#comment-16869204
 ] 

Mikhail Khludnev commented on SOLR-13545:
-

Break what's necessary. Adding fix. 

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch, 
> SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-20 Thread Lucene/Solr QA (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869170#comment-16869170
 ] 

Lucene/Solr QA commented on SOLR-13545:
---

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
|| || || || {color:brown} Prechecks {color} ||
| {color:green}+1{color} | {color:green} test4tests {color} | {color:green}  0m 
 0s{color} | {color:green} The patch appears to include 1 new or modified test 
files. {color} |
|| || || || {color:brown} master Compile Tests {color} ||
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  1m 
47s{color} | {color:green} master passed {color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  1m 
33s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  1m 
33s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} Release audit (RAT) {color} | 
{color:green}  1m 33s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} Check forbidden APIs {color} | 
{color:green}  1m 33s{color} | {color:green} the patch passed {color} |
| {color:red}-1{color} | {color:red} Validate source patterns {color} | 
{color:red}  1m 33s{color} | {color:red} Validate source patterns 
validate-source-patterns failed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:red}-1{color} | {color:red} unit {color} | {color:red}  7m  1s{color} 
| {color:red} solrj in the patch failed. {color} |
| {color:black}{color} | {color:black} {color} | {color:black} 13m 36s{color} | 
{color:black} {color} |
\\
\\
|| Reason || Tests ||
| Failed junit tests | solr.client.solrj.embedded.SolrExampleJettyTest |
|   | solr.client.solrj.embedded.SolrExampleXMLHttp2Test |
|   | solr.client.solrj.SolrExampleBinaryHttp2Test |
|   | solr.client.solrj.embedded.SolrExampleStreamingHttp2Test |
|   | solr.client.solrj.embedded.SolrExampleEmbeddedTest |
|   | solr.client.solrj.SolrExampleXMLTest |
|   | solr.client.solrj.SolrExampleBinaryTest |
|   | solr.client.solrj.embedded.SolrExampleStreamingTest |
|   | solr.client.solrj.embedded.SolrExampleStreamingBinaryTest |
|   | solr.client.solrj.embedded.SolrExampleStreamingBinaryHttp2Test |
\\
\\
|| Subsystem || Report/Notes ||
| JIRA Issue | SOLR-13545 |
| JIRA Patch URL | 
https://issues.apache.org/jira/secure/attachment/12972381/SOLR-13545.patch |
| Optional Tests |  compile  javac  unit  ratsources  checkforbiddenapis  
validatesourcepatterns  |
| uname | Linux lucene1-us-west 4.4.0-137-generic #163~14.04.1-Ubuntu SMP Mon 
Sep 24 17:14:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | ant |
| Personality | 
/home/jenkins/jenkins-slave/workspace/PreCommit-SOLR-Build/sourcedir/dev-tools/test-patch/lucene-solr-yetus-personality.sh
 |
| git revision | master / d318a6e |
| ant | version: Apache Ant(TM) version 1.9.3 compiled on July 24 2018 |
| Default Java | LTS |
| Validate source patterns | 
https://builds.apache.org/job/PreCommit-SOLR-Build/448/artifact/out/patch-validate-source-patterns-root.txt
 |
| unit | 
https://builds.apache.org/job/PreCommit-SOLR-Build/448/artifact/out/patch-unit-solr_solrj.txt
 |
|  Test Results | 
https://builds.apache.org/job/PreCommit-SOLR-Build/448/testReport/ |
| modules | C: solr/solrj U: solr/solrj |
| Console output | 
https://builds.apache.org/job/PreCommit-SOLR-Build/448/console |
| Powered by | Apache Yetus 0.7.0   http://yetus.apache.org |


This message was automatically generated.



> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java, SOLR-13545.patch
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void 

[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-15 Thread Colvin Cowie (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16864902#comment-16864902
 ] 

Colvin Cowie commented on SOLR-13545:
-

Hi Mikhail, I had a look at doing it with a mock/spy. It worked, but it feels 
fairly fragile, since I didn't have direct access to the InputStream that is 
created, and had to spy on the invocations all the way down to it.

I also saw StreamingUpdateRequest (which is using an autoclose) and it is 
newing up the stream right where it is used.

 
{code:java}
  @Override
  public void write(OutputStream os) throws IOException {
    try (InputStream is = new FileInputStream(f)) {
  IOUtils.copy(is, os);
    }
  }
{code}
So if I was to try and write a mocking test for it, I wouldn't have anywhere to 
hook in.

 

I could change the actual ContentStreamUpdateRequest and StreamingUpdateRequest 
classes to expose the InputStream(s) they open, so that it's easier to mock 
out, but I don't know what the testing strategy is when it comes to something 
like this.

 

For now, I've updated the tests for both so that they create a copy of the file 
they were uploading, upload it, then delete it. That will fail on Windows if 
the stream isn't closed, but will (probably) always pass on linux, even if the 
stream isn't closed. So it's not a foolproof test either.

I've submitted the PR (https://github.com/apache/lucene-solr/pull/723), but I'm 
happy to do something different with the tests though, if it's worth pursuing.

 

Thanks

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-13 Thread Mikhail Khludnev (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16863007#comment-16863007
 ] 

Mikhail Khludnev commented on SOLR-13545:
-

I think some close checking mockito mock can be injected in 
\{{SolrExampleTests.testContentStreamRequest()}}.

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java
>
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-13 Thread Colvin Cowie (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16862827#comment-16862827
 ] 

Colvin Cowie commented on SOLR-13545:
-

I've not submitted any changes here before, so not totally familiar with 
standards/process. I don't have time right at the moment, so I will do it 
tomorrow / weekend.

Cheers

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java
>
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



[jira] [Commented] (SOLR-13545) ContentStreamUpdateRequest no longer closes stream

2019-06-13 Thread Noble Paul (JIRA)


[ 
https://issues.apache.org/jira/browse/SOLR-13545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16862824#comment-16862824
 ] 

Noble Paul commented on SOLR-13545:
---

[~cjcowie] you could submit a  PR and I shall merge it

> ContentStreamUpdateRequest no longer closes stream
> --
>
> Key: SOLR-13545
> URL: https://issues.apache.org/jira/browse/SOLR-13545
> Project: Solr
>  Issue Type: Bug
>  Security Level: Public(Default Security Level. Issues are Public) 
>  Components: SolrJ
>Affects Versions: 7.4, 7.5, 7.6, 7.7, 7.7.1, 7.7.2, 8.0, 8.1, 8.1.1
> Environment: Windows - file locking may not cause a visible failure 
> on Linux?
>Reporter: Colvin Cowie
>Priority: Major
> Attachments: ContentStreamUpdateRequestBug.java
>
>
> Since the change made in SOLR-12142 _ContentStreamUpdateRequest_ no longer 
> closes the stream that it opens. Therefore if streaming a file, it cannot be 
> deleted until the process exits.
>  
> {code:java}
> @Override
>   public RequestWriter.ContentWriter getContentWriter(String expectedType) {
>     if (contentStreams == null || contentStreams.isEmpty() || 
> contentStreams.size() > 1) return null;
>     ContentStream stream = contentStreams.get(0);
>     return new RequestWriter.ContentWriter() {
>       @Override
>       public void write(OutputStream os) throws IOException {
>         IOUtils.copy(stream.getStream(), os);
>       }
>       @Override
>       public String getContentType() {
>         return stream.getContentType();
>       }
>     };
>   }
> {code}
> IOUtils.copy will not close the stream. Adding a close to the write(), is 
> enough to "fix" it for the test case I've attached, e.g.
>  
> {code:java}
>       @Override
>       public void write(OutputStream os) throws IOException {
>   final InputStream innerStream = stream.getStream();
>   try {
>     IOUtils.copy(innerStream, os);
>   } finally {
>     IOUtils.closeQuietly(innerStream);
>   }
>       }
> {code}
>  
> I don't know whether any other streaming classes have similar issues
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org