aws / aws/aws-sdk-java-v2

SdkFilterInputStream.close should not abort

Open
#6,906 2 comments 0 reactions 1 assignee Claimed by @debora-ito View on GitHub
bug p2
Dominant language
Java
Stars
2.6k
Forks
1k
Avg merge
2d 9h
Merged PRs (30d)
51

Description

### Describe the bug

`SdkFilterInputStream.close`, like all other overrides in `SdkFilterInputStream`, calls `abortIfNeeded`. That method throws an `AbortedException` if the current is thread interrupted. Given that `.close()` is usually called when on a cleanup path anyway, is this necessary? Usually `close()` methods should just try to clean up and return with as little fanfare as possible. `AbortedException` is also an unchecked exception so it may bypass any code anticipating `IOException`.

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Expected Behavior

Closing a `SdkFilterInputStream` doesn't throw exceptions it doesn't have to.

### Current Behavior

`SdkFilterInputStream.close` may throw `AbortedException`.

### Reproduction Steps

I hope the problem is clear from the description.

### Possible Solution

Delete the `SdkFilterInputStream.close` override.

### Additional Information/Context

_No response_

### AWS Java SDK version used

2.42.33

### JDK version used

any

### Operating System and version

any

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.