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

#473 Refactoring Request-Line validation #484

Merged
merged 11 commits into from
Jan 6, 2016
Merged

Conversation

xupyprmv
Copy link
Contributor

Refactoring for #473 RqHref.java:83-86: RqMethod already validates Request-Line and... #473

I created RqRequestLine interface that 2 methods:

String requestLineHeader() throws IOException; // returns valid Request-line

String requestLineHeaderToken(Token token) throws IOException; // returns specified token from Request-Line

Also I added class that implements RqRequestLine interface and provides Request-Line validation.

@xupyprmv
Copy link
Contributor Author

@davvd Please proceed with code review.

@davvd
Copy link

davvd commented Dec 26, 2015

@xupyprmv Many thanks, I will find someone to review it before we merge

@davvd
Copy link

davvd commented Dec 26, 2015

@dmzaytsev review this one, please

@dmzaytsev
Copy link
Contributor

@xupyprmv pull request description explains the solution proposed and contains a link to the original ticket it is related to
the solution should be described more detail

*
* @author Vladimir Maksimenko (xupypr@xupypr.com)
* @version $Id$
* @since 1.0
Copy link
Contributor

Choose a reason for hiding this comment

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

@xupyprmv 0.30

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dmzaytsev I take version 1.0 from pom.xml file. Please, can you explain where I can get information about next version. That helps me not to do the same mistake in future.

Copy link
Contributor

Choose a reason for hiding this comment

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

@xupyprmv I add 0.0.1 to the last release usually
https://github.com/yegor256/takes/releases

Copy link
Contributor

Choose a reason for hiding this comment

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

@xupyprmv so it will be 0.29.1

@dmzaytsev
Copy link
Contributor

@xupyprmv please see a few comments above
also pay attention the indentation step should be 4 spaces

@xupyprmv
Copy link
Contributor Author

@dmzaytsev Thank you for CR. I refactored code according to your remarks. Please, proceed with CR.

* @author Piotr Pradzynski (prondzyn@gmail.com)
* @version $Id$
*/
public final class BkReuse extends BkWrap {
Copy link
Contributor

Choose a reason for hiding this comment

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

@xupyprmv why did you remove this class?

@dmzaytsev
Copy link
Contributor

@xupyprmv just two questions above

@xupyprmv
Copy link
Contributor Author

@dmzaytsev I rollback removing of BkReuse and BkReuseTest. It was my fail. It was a part of work for #456, not for current issue.

@dmzaytsev
Copy link
Contributor

@xupyprmv no problem
thanks for PR

@dmzaytsev
Copy link
Contributor

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Dec 28, 2015

@rultor merge

@dmzaytsev Thanks for your request. @yegor256 Please confirm this.

@xupyprmv
Copy link
Contributor Author

xupyprmv commented Jan 4, 2016

@yegor256 I refactored code according to your remark. Please, proceed with CR. (Sorry, I'm not wait for end of your previous CR, @davvd urges me to close #473 in 2 days)

/**
* HTTP Request-line pattern.
* [!-~] is for method or extension-method token (octets 33 - 126).
* @see <a href="http://www
Copy link
Owner

Choose a reason for hiding this comment

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

@xupyprmv this won't work with JavaDoc. just put it all in one long line, checkstyle won't complain

@yegor256
Copy link
Owner

yegor256 commented Jan 4, 2016

@xupyprmv the code is good, but your naming is rather messy. I posted some comments above. first rule: use single words for method and variable names. second rule: read this

@xupyprmv
Copy link
Contributor Author

xupyprmv commented Jan 4, 2016

@yegor256 Thanks for advises. I refactored code according to your review. Please proceed with CR.

public String header() throws IOException {
final String line = this.line();
this.matcher(line);
return line;
Copy link
Owner

Choose a reason for hiding this comment

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

@xupyprmv read this one again: http://www.yegor256.com/2015/12/08/temporal-coupling-between-method-calls.html Your code here should look like this:

public String header() {
  return this.validated(this.line());
}

See the idea?

Copy link
Owner

Choose a reason for hiding this comment

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

@xupyprmv maybe I'm wrong with this exact example, but this.matcher(line) is a code smell. You should never use functions as procedures, ignoring their returns.

@yegor256
Copy link
Owner

yegor256 commented Jan 4, 2016

@xupyprmv see my comments above, I don't like the design of private methods. they are very "procedural"

@xupyprmv
Copy link
Contributor Author

xupyprmv commented Jan 4, 2016

@yegor256 I refactored code. It is more "functional" now. The reason why I used "procedural" approach before is to avoid "copy-paste style". Because I need Matcher for two purposes: to validate Request-Line and to extract groups. But for performance reasons I try to use match only once for each call. Please, proceed with CR.

@yegor256
Copy link
Owner

yegor256 commented Jan 6, 2016

@rultor try to merge

@yegor256
Copy link
Owner

yegor256 commented Jan 6, 2016

@xupyprmv looks good now, thanks

@rultor
Copy link
Collaborator

rultor commented Jan 6, 2016

@rultor try to merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit c343a53 into yegor256:master Jan 6, 2016
@rultor
Copy link
Collaborator

rultor commented Jan 6, 2016

@rultor try to merge

@yegor256 Done! FYI, the full log is here (took me 21min)

@davvd
Copy link

davvd commented Jan 7, 2016

@elenavolokhova please, review this ticket for compliance with our QA rules

@davvd
Copy link

davvd commented Jan 7, 2016

@rultor deploy

@rultor
Copy link
Collaborator

rultor commented Jan 7, 2016

@rultor deploy

@davvd OK, I'll try to deploy now. You can check the progress here

@rultor
Copy link
Collaborator

rultor commented Jan 7, 2016

@rultor deploy

@davvd Done! FYI, the full log is here (took me 11min)

@elenavolokhova
Copy link

@davvd Looks good!

@davvd
Copy link

davvd commented Jan 7, 2016

@davvd Looks good!

@elenavolokhova thank you

@davvd
Copy link

davvd commented Jan 7, 2016

@dmzaytsev just added 10 mins to @elenavolokhova (for QA), payment ID is 74003682... thanks, I just added 31 mins to your account, payment 74003698, 263 hours and 12 mins spent... review comments (c=16) added as a bonus... added +31 to your rating, now it is equal to +1501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants