Skip to content

Conversation

@CarsonCook
Copy link
Contributor

@CarsonCook CarsonCook commented Aug 7, 2020

Description

Malformed URLs are apt to occur when the baseUrl or contextPath parameters end with a trailing /, and/or when homePageRelativeUrl, statusPageRelativeUrl, healthCheckRelativeUrl, and contextPath parameters don't begin with a /. This PR adds warnings that are logged when the / are not in appropriate places.

Tests were not added as there is no precedent in api-layer for using log messages as acceptance conditions, and there are no other acceptance conditions than log status.

Fixes #744

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

For more details about how should the code look like read the Contributing guideline

Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Carson Cook <carson.cook@ibm.com>
URLs can easily be malformed with poor configuration parameters. Relative path URLs are concatenated with the base URL, so the baseUrl parameter is expected not to have a trailing '/' and relative URLs are expected to begin with '/'. Logging has been added for the baseUrl, contextPath, homePageRelativeUrl, statusPageRelativeUrl, and healthCheckRelativeUrl parameters.

Signed-off-by: Carson Cook <carson.cook@ibm.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 7, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

82.8% 82.8% Coverage
0.0% 0.0% Duplication

warning The version of Java (1.8.0_242) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11.
Read more here

@CarsonCook CarsonCook merged commit 460f0a1 into master Aug 10, 2020
balhar-jakub pushed a commit that referenced this pull request Aug 13, 2020
* Fix intellij warnings in EurekaInstanceConfigValidator

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Fix intellij warnings in EurekaInstanceConfigValidatorTest

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Add new logging for URL parameters

URLs can easily be malformed with poor configuration parameters. Relative path URLs are concatenated with the base URL, so the baseUrl parameter is expected not to have a trailing '/' and relative URLs are expected to begin with '/'. Logging has been added for the baseUrl, contextPath, homePageRelativeUrl, statusPageRelativeUrl, and healthCheckRelativeUrl parameters.

Signed-off-by: Carson Cook <carson.cook@ibm.com>
balhar-jakub pushed a commit that referenced this pull request Aug 13, 2020
* Fix intellij warnings in EurekaInstanceConfigValidator

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Fix intellij warnings in EurekaInstanceConfigValidatorTest

Signed-off-by: Carson Cook <carson.cook@ibm.com>

* Add new logging for URL parameters

URLs can easily be malformed with poor configuration parameters. Relative path URLs are concatenated with the base URL, so the baseUrl parameter is expected not to have a trailing '/' and relative URLs are expected to begin with '/'. Logging has been added for the baseUrl, contextPath, homePageRelativeUrl, statusPageRelativeUrl, and healthCheckRelativeUrl parameters.

Signed-off-by: Carson Cook <carson.cook@ibm.com>
Signed-off-by: Jakub Balhar <jakub.balhar@broadcom.com>
@balhar-jakub balhar-jakub deleted the carsoncook/gh744/urlLoggingEnhancement branch August 17, 2020 06:17
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.

Unable to set a root URL as the service home page

4 participants