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

CIF-1624: Remove commons-text dependency in UrlProviderImpl #396

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

hbacila
Copy link
Contributor

@hbacila hbacila commented Sep 9, 2020

Description

This PR replaces the use of StringSubstitutor.replace() in UrlProviderImpl with StringUtils methods to avoid adding dependency on Apache's commons-text package.

Motivation and Context

The commons-text bundle was embedded in ui.apps package. Embedding 3rd party bundles in application type package is now prohibitted for AEM as a Cloud Service.

How Has This Been Tested?

  • unit tests

Types of changes

  • 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 change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

@@ -162,4 +161,24 @@ private String parseIdentifier(IdentifierLocation identifierLocation, SlingHttpS
throw new RuntimeException("Identifier location " + identifierLocation + " is not supported");
}
}

static class StringSubstitutor {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of inventing our own new class can't we just use https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#replaceEach-java.lang.String-java.lang.String:A-java.lang.String:A- ? This bundle is already available in AEM.

Or as alternative use a regex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Our StringSubstitutor:replace method uses just that (StringUtils.replaceEach). Our own StringSubstituor was created to preserve the UrlProviderImpl implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw we use StringUtils.replaceEach, wonder if that also can be done simpler? Mabe with String.formart() or RegEx. But I'm just nitpicking here.

@LSantha LSantha merged commit 60385f5 into master Sep 15, 2020
@LSantha LSantha deleted the issues/CIF-1624 branch September 15, 2020 15:22
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.

4 participants