Fix IDETECT-4533: Update project name mechanism to avoid infinite loop #1282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue caused while adding support for #1098
This is an edge case which is encountered when the name of the project and the parent project are similar causing the execution of this block to stuck in an infinite loop: synopsys-detect/detectable/src/main/java/com/blackduck/integration/detectable/detectables/gradle/inspection/parse/GradleReportLineParser.java at 174aa29e61e115f6d321cef5b9ccc612d8f1fa01 · blackducksoftware/synopsys-detect . This code block looks for a particular dependency in all parent modules of the current module up to root project and checks if rich version was declared and applies it to current level. While checking for the customer’s project, found some modules whose name are similar to the parent module causing the loop to be stuck as Map entry would be E.g. (tts, tts).
To fix the issue, added depth as a suffix for the project name to avoid creating a same name key value pair. So now the key would look like (tts_2,tts_1).