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

Issue 85: turbineSensor throws occasional NPE #111

Conversation

RaulGracia
Copy link
Contributor

Change log description
Fix in TrubineHeatSensor.java for avoiding the application to throw NullPointerException. Note that this PR only targets this specific problem (i.e., other exceptions or problems will be treated separately).

Purpose of the change
Fixes #85.

What the code does
The reader (SensorReader) is incorrectly interacting with produceStats instead of with consumeStats. Moreover, the read loop of this class parses read events without checking for null events (e.g., after timeout). The fix consists of replacing reader interactions from produceStats to consumeStats as well as to check for a null read event before executing the parse logic.

How to verify it
Execute the application and verify that it does not throws NPE.

…ts instead of consumeStats in reader and lack of null check parsing read events).

Signed-off-by: Raúl Gracia <[email protected]>
@RaulGracia RaulGracia self-assigned this Jun 15, 2018
Copy link
Contributor

@EronWright EronWright 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 this.

return CompletableFuture.completedFuture(null);
}, Long.parseLong(result.getEvent().split(",")[0]), 100);
totalEvents--;
}
} catch (ReinitializationRequiredException e) {
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's create an issue to remove this print stack trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will create it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fpj fpj merged commit 985f3ff into pravega:develop Jun 18, 2018
fpj pushed a commit that referenced this pull request Jun 23, 2018
* Fix in TurbineHeatSensor.java to avoid the application
  to throw NullPointerException. Note that this PR only
  targets this specific problem (i.e., other exceptions
  or problems will be treated separately).

Signed-off-by: Raúl Gracia <[email protected]>
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.

4 participants