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

Fix logic error in logging that logs errors in normal cases #97

Closed

Conversation

tmenninger
Copy link

There are coding mistakes in the constructers of both IotHubSendTask and IotHubReceiveTask that log errors under all normal conditions

Checklist

  • I have read the [contribution guidelines] (https://github.com/Azure/azure-iot-sdk-java/blob/master/.github/CONTRIBUTING.md).
  • I added or modified the existing tests to cover the change (we do not allow our test coverage to go down). Should not need more coverage if tests already cover the null/not null cases.
  • If this is a modification that impacts the behavior of a public API
    • I edited the corresponding document in the devdoc folder and added or modified requirements. No API changes.
  • I submitted this PR against the correct branch:
    • This pull-request is submitted against the master branch.

Description of the problem

Please correctly use braces

Description of the solution

 public IotHubReceiveTask(IotHubTransport transport)
    {
        if (transport == null)
            throw new IllegalArgumentException("Parameter 'transport' must not be null");

        // Codes_SRS_IOTHUBRECEIVETASK_11_001: [The constructor shall save the transport.]
        this.transport = transport;

        logger.LogError("IotHubReceiveTask constructor called with null value for parameter transport");
    }

should become

 public IotHubReceiveTask(IotHubTransport transport)
    {
        if (transport == null) {

             logger.LogError("IotHubReceiveTask constructor called with null value for parameter transport");
            throw new IllegalArgumentException("Parameter 'transport' must not be null");
       }
        
        // Codes_SRS_IOTHUBRECEIVETASK_11_001: [The constructor shall save the transport.]
        this.transport = transport;
    }

@msftclas
Copy link

@tmenninger,
Thanks for having already signed the Contribution License Agreement. Your agreement has not been validated yet. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@prmathur-microsoft
Copy link
Member

Thanks for providing this change. I'll merge this in.

@@ -20,14 +20,15 @@
public IotHubReceiveTask(IotHubTransport transport)
{

if (transport == null) {

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@@ -20,13 +20,14 @@

public IotHubSendTask(IotHubTransport transport)
{
if (transport == null)
if (transport == null) {

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@prmathur-microsoft
Copy link
Member

I have two minor comments - if you can address them, this can easily go in. Thanks!

@prmathur-microsoft
Copy link
Member

Thanks for addressing comments. Your changes have been squashed to a single commit and merged at 29a3bcd

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.

3 participants