Bug 838681
| Summary: | DriftFileSenderTest.doNotSendEmptyZipFile fails on java7 | |||
|---|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Heiko W. Rupp <hrupp> | |
| Component: | Plugin Container | Assignee: | John Sanda <jsanda> | |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | high | |||
| Version: | 4.4 | CC: | hrupp | |
| Target Milestone: | --- | |||
| Target Release: | RHQ 4.5.0 | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 846049 (view as bug list) | Environment: | ||
| Last Closed: | 2013-09-01 10:18:27 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 682878, 846049 | |||
|
Description
Heiko W. Rupp
2012-07-09 19:08:32 UTC
There is clearly a difference in java 6 and 7
This fails on 6 and works on 7:
@Test
public void testEmptyZip() throws Exception {
File file = new File("/tmp/my.zip");
if (file.exists())
file.delete();
FileOutputStream fos = new FileOutputStream(file);
ZipOutputStream zos = new ZipOutputStream(fos);
zos.finish();
zos.close();
}
Did not yet find a bug reference though.
Assigning to jsanda since it seems he was the original author of the drift related code. Since an exception is not thrown when closing a ZipOutputStream on an empty zip file in Java 7, I have added logic to check whether or not the zip file has any content. sendChangeSetContentToServer is called only if the content file is non-empty. The logging logic has been updated as well so that we only log an error message when failing to close the output stream only when the content file is non-empty. This keeps the logging clean and consistent across Java 6 and 7. Changes have been pushed to master. commit hash: 5b37f7a17ef Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since. |