Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure why this API has calling conventions that vary so drastically from method to method. Since this is still in M2 stage, it seems like it is still not too late to fix this. One problem with the existing code is that it violates Effective Java 3rd Edition §74, which says:
Another problem with the existing code is that
FileItem#getString(Charset)
is inconsistent withFileItem#getString()
—one declaresthrows IOException
while the other does not, yet it is not obvious how the presence of aCharset
argument should cause any difference in calling convention.Yet another problem with the existing code is that
DiskFileItem#getString(java.nio.charset.Charset)
claims to throwIOException
but is actually implemented withDiskFileItem#get()
which actually throwsUncheckedIOException
.This PR fixes all of these problems by eliminating any usages of
UncheckedIOException
in favor of simple usages ofthrows IOException
.