joerghoh commented on code in PR #152:
URL:
https://github.com/apache/sling-org-apache-sling-resourceresolver/pull/152#discussion_r1970081780
##########
src/main/java/org/apache/sling/resourceresolver/impl/mapping/VanityPathHandler.java:
##########
@@ -222,30 +223,43 @@ private String getMapEntryRedirect(final MapEntry
mapEntry) {
}
boolean doRemoveVanity(final String path) {
- final String actualContentPath = getActualContentPath(path);
- final List <String> l = vanityTargets.remove(actualContentPath);
- if (l != null){
- for (final String s : l){
- final List<MapEntry> entries = this.resolveMapsMap.get(s);
- if (entries!= null) {
- for (final Iterator<MapEntry> iterator =
entries.iterator(); iterator.hasNext(); ) {
- final MapEntry entry = iterator.next();
- final String redirect = getMapEntryRedirect(entry);
- if (redirect != null &&
redirect.equals(actualContentPath)) {
- iterator.remove();
- }
- }
+ String actualContentPath = getActualContentPath(path);
+ List<String> targets = this.vanityTargets.remove(actualContentPath);
+
+ if (targets != null) {
+ for (String target : targets) {
+ int count = removeEntriesFromResolvesMap(target,
actualContentPath);
+ if (vanityCounter.longValue() >= count) {
+ vanityCounter.addAndGet(-count);
Review Comment:
why was this changed from ``-2`` to ``-count``? While it sounds logical, is
it a bug in the existing implementation?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]