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

Change the BZip2 Compress/Decompress functions to throw ArgumentNullxception rather than Exception when null stream parameters are provided #432

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/ICSharpCode.SharpZipLib/BZip2/BZip2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ public static class BZip2
/// <param name="isStreamOwner">Both streams are closed on completion if true.</param>
public static void Decompress(Stream inStream, Stream outStream, bool isStreamOwner)
{
if (inStream == null || outStream == null)
{
throw new Exception("Null Stream");
}
if (inStream == null)
throw new ArgumentNullException(nameof(inStream));

if (outStream == null)
throw new ArgumentNullException(nameof(outStream));

try
{
Expand Down Expand Up @@ -51,10 +52,11 @@ public static void Decompress(Stream inStream, Stream outStream, bool isStreamOw
/// the lowest compression and 9 the highest.</param>
public static void Compress(Stream inStream, Stream outStream, bool isStreamOwner, int level)
{
if (inStream == null || outStream == null)
{
throw new Exception("Null Stream");
}
if (inStream == null)
throw new ArgumentNullException(nameof(inStream));

if (outStream == null)
throw new ArgumentNullException(nameof(outStream));

try
{
Expand Down