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

GH-970: Add AmqpAppender.verifyHostname option #971

Merged
merged 2 commits into from
Apr 8, 2019

Conversation

artembilan
Copy link
Member

Fixes #970

  • Some code polishing and internal refactoring for AmqpAppender

Cherry-pick to 2.1.x

Fixes spring-projects#970

* Some code polishing and internal refactoring for `AmqpAppender`

**Cherry-pick to 2.1.x**
Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

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

What about the Log4j2 appender?

Also

 Task :spring-rabbit:checkstyleMain
[ant:checkstyle] [ERROR] /home/travis/build/spring-projects/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/logback/AmqpAppender.java:24:8: Unused import - java.util.Optional. [UnusedImports]
[ant:checkstyle] [ERROR] /home/travis/build/spring-projects/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/logback/AmqpAppender.java:403:24: Reference to instance variable 'verifyHostname' needs "this.". [RequireThis]

@@ -620,7 +641,7 @@ public void start() {
if (rabbitConnectionFactory != null) {
super.start();
this.routingKeyLayout.setPattern(this.routingKeyLayout.getPattern()
.replaceAll("%property\\{applicationId\\}", this.applicationId));
.replaceAll("%property\\{applicationId}", this.applicationId));
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks wrong, curly brackets must be escaped in RegEx.

Isn't there a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what my IDEA shows me:

изображение

And yes: it is covered by our tests.
Look into logback-test.xml and log4j2-amqp-appender.xml and search for {applicationId}

* Add `verifyHostname` to the Log4J `AmqpAppender`
* Document `verifyHostname` option
@garyrussell garyrussell merged commit a09a89f into spring-projects:master Apr 8, 2019
garyrussell pushed a commit that referenced this pull request Jun 7, 2019
* GH-970: Add `AmqpAppender.verifyHostname` option

Fixes #970

* Some code polishing and internal refactoring for `AmqpAppender`

**Cherry-pick to 2.1.x**

* * Fix Checkstyle violations
* Add `verifyHostname` to the Log4J `AmqpAppender`
* Document `verifyHostname` option
@garyrussell
Copy link
Contributor

I failed to cherry-pick this; 462efc4

@artembilan
Copy link
Member Author

OK. I'll do that myself later or issue a back-port PR.
Thanks

@artembilan
Copy link
Member Author

Wait. Looks like you have figured that out: 462efc4

Thanks

@garyrussell
Copy link
Contributor

Sorry, yes; the link to the cherry pick was in my comment; I should have made that clear.

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.

AmqpAppender: Ability to disable host name verification
2 participants