Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1066199 - Missing stream close on UrlResource.cacheStream()
Summary: Missing stream close on UrlResource.cacheStream()
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: BRMS 5.3.1
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: ---
Assignee: Mario Fusco
QA Contact: Marek Winkler
URL:
Whiteboard:
Depends On:
Blocks: 1080634
TreeView+ depends on / blocked
 
Reported: 2014-02-18 01:47 UTC by Toshiya Kobayashi
Modified: 2018-12-05 17:19 UTC (History)
3 users (show)

Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)
UrlResource.java (deleted)
2014-04-07 10:47 UTC, Toshiya Kobayashi
no flags Details

Description Toshiya Kobayashi 2014-02-18 01:47:07 UTC
Description of problem:

UrlResource.cacheStream() fails to close streams on exception.

Pull request
https://github.com/droolsjbpm/drools/pull/312


Steps to Reproduce:

I don't have verification steps for this. But I think testing BZ1034030 would be good to confirm that this fix doesn't break the behaviour.

https://bugzilla.redhat.com/show_bug.cgi?id=1034030

Comment 1 Toshiya Kobayashi 2014-03-13 01:24:22 UTC
Please wait for applying the above PR. I'll create another PR after BZ1075293 (https://github.com/droolsjbpm/drools/pull/322) is accepted.

Comment 2 Toshiya Kobayashi 2014-04-07 10:47:27 UTC
Created attachment 883571 [details]
UrlResource.java

Attached UrlResource.java which is written on top of https://github.com/droolsjbpm/drools/pull/322

Once the PR#322 is merged into 5.3.x branch, I can create a pull request for this BZ so feel free to let me know. But the change is only for UrlResource.cacheStream() so you may be able to commit referring this java file.

I have changed cacheStream() to throw IOException but I'm not sure if it is a good idea. The original implementation catches and hides all Exceptions. Please review and choose the best way. The main purpose of this BZ is closing stream.

Thanks!

Comment 3 Toshiya Kobayashi 2014-04-07 10:51:00 UTC
# Please note that we have to close FileOutputStream (fout.close()) before renaming (fi.renameTo(cacheFile)). If not, Windows fails to rename.

Comment 4 Mario Fusco 2014-04-23 08:24:21 UTC
Fixed by https://github.com/droolsjbpm/drools/commit/e9f2169e6

Comment 5 Marek Winkler 2014-07-17 15:22:33 UTC
Verified on 5.3.1.BRMS-P06.


Note You need to log in before you can comment on or make changes to this bug.