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

Introduce strict payload checks. #844

Merged
merged 1 commit into from
Jan 9, 2019

Conversation

boaks
Copy link
Contributor

@boaks boaks commented Jan 9, 2019

Check, it message is intended to have payload and thorw exceptions, if
not. Overwrite that check by mark a message to have unintended payload.

issue #834

Signed-off-by: Achim Kraus [email protected]

Copy link
Contributor

@sbernard31 sbernard31 left a comment

Choose a reason for hiding this comment

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

LGTM

/**
* {@inheritDoc}
*
* EMPTY message are never intended to have payload!
Copy link
Contributor

Choose a reason for hiding this comment

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

"messages are" or "message is" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -472,8 +510,15 @@ protected String getPayloadTracingString() {
*
* Provides a fluent API to chain setters.
*
* @param payload the payload as sting
* @param payload the payload as sting. {@code null} or a empty string are
Copy link
Contributor

Choose a reason for hiding this comment

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

sting => "string"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -33,7 +33,7 @@

@Test
public void testGetHttpEntity() throws Exception {
Request req = new Request(Code.GET);
Request req = new Request(Code.PUT);
Copy link
Contributor

Choose a reason for hiding this comment

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

I maybe don't get the point here, but should we rename the test name too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the next line calls req.setPayload("payload"); so I changed it.
Yes, the test should be then renamed.

@@ -42,7 +42,7 @@ public void testGetHttpEntity() throws Exception {

@Test
public void testGetHttpEntityWithJSON() throws Exception {
Request req = new Request(Code.GET);
Request req = new Request(Code.PUT);
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above ?

Check, it message is intended to have payload and thorw exceptions, if
not. Overwrite that check by mark a message to have unintended payload.

Signed-off-by: Achim Kraus <[email protected]>
@boaks boaks merged commit 532c03b into eclipse-californium:2.0.x Jan 9, 2019
@boaks boaks deleted the strict_payload branch April 5, 2019 12:59
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.

2 participants