Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw IOE instead of NPE if OpenSSHKeyV1KeyFile reads an empty file #773

Merged
merged 1 commit into from
Apr 1, 2022

Conversation

vladimirlagunov
Copy link
Contributor

There is a contract that FileKeyProvider.readKey throws an IOException if something goes wrong. Throwing an NPE is not expected by API users. Also, it is much more difficult to find out if the NPE is thrown due to a broken key file, or due to an internal bug.

There is a contract that FileKeyProvider.readKey throws an IOException if something goes wrong. Throwing an NPE is not expected by API users. Also, it is much more difficult to find out if the NPE is thrown due to a broken key file, or due to an internal bug.
@codecov-commenter
Copy link

codecov-commenter commented Mar 16, 2022

Codecov Report

Merging #773 (1980072) into master (69812e9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master     #773   +/-   ##
=========================================
  Coverage     64.45%   64.46%           
- Complexity     1460     1461    +1     
=========================================
  Files           211      211           
  Lines          8617     8619    +2     
  Branches        807      808    +1     
=========================================
+ Hits           5554     5556    +2     
- Misses         2640     2641    +1     
+ Partials        423      422    -1     
Impacted Files Coverage Δ
...sshj/userauth/keyprovider/OpenSSHKeyV1KeyFile.java 84.66% <100.00%> (+1.55%) ⬆️
...t/schmizz/sshj/connection/ConnectionException.java 22.22% <0.00%> (-11.12%) ⬇️
...va/net/schmizz/sshj/connection/ConnectionImpl.java 56.09% <0.00%> (-3.26%) ⬇️
...main/java/net/schmizz/sshj/xfer/scp/SCPEngine.java 73.01% <0.00%> (-3.18%) ⬇️
...java/net/schmizz/sshj/transport/TransportImpl.java 66.80% <0.00%> (+1.65%) ⬆️
.../main/java/net/schmizz/sshj/sftp/PacketReader.java 95.74% <0.00%> (+4.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69812e9...1980072. Read the comment docs.

Copy link
Owner

@hierynomus hierynomus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the bug ;)

@hierynomus hierynomus merged commit e9cb909 into hierynomus:master Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants