-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Actual behavior
In the logs I get this warning:
2 matches found for XPath configuration[@default='true' and @type='JUnit'] in workspace XML at /project[@version='4']/component[@name='RunManager' @selected='JUnit.StepTest']
It is missing the path to the files in the workspace and the template leading to this error so the user can easily analyse and fix the problem.
Reproduce
- edit your
workspace.xml
in your IJ workspace and duplicate theJUnit
defaultRunManager
. - run
ide intellij
Expected behavior
I would rather expect a warning like this:
2 matches found for XPath configuration[@default='true' and @type='JUnit'] in workspace XML file `~/projects/example/workspaces/main/.idea/workspace.xml at /project[@version='4']/component[@name='RunManager' @selected='JUnit.StepTest'] for template file `~/projects/example/settings/intellij/workspace/update/.idea/workspace.xml
IDEasy status
$ ide status
IDE_ROOT is set to D:\projects
IDE_HOME is set to D:\projects\IDEasy
You are online.
Your settings are up-to-date.
Your version of IDEasy is 2025.05.002-05_29_02-SNAPSHOT but version 2025.05.002-20250529.024405-8 is available. Please run the following command to upgrade to the latest version:
ide upgrade
Your operating system is windows(10.0)@x64 [Windows 11@amd64]
Successfully completed ide (status)
Related/Dependent issues
Comments/Hints
Problem is here in the warning
logging:
IDEasy/cli/src/main/java/com/devonfw/tools/ide/merge/xml/matcher/IdComputer.java
Lines 71 to 76 in f0c6451
String message = length + " matches found for XPath " + xpathExpr + " in workspace XML at " + XmlMergeSupport.getXPath(workspaceElement, true); | |
if ("true".equals(this.context.getVariables().get(FAIL_ON_AMBIGOUS_MERGE))) { | |
throw new IllegalStateException(message); | |
} else { | |
this.context.warning(message); | |
} |
Problem is that the Element
only allows getOwnerDocument()
but from there we cannot get the source from where the XML was loaded. Therefore, this method needs to be refactored to additionally get the two Path
args for the XMLs so this can also be logged here.
Log-messages should be helpful and give contextual information.
See https://github.com/devonfw/IDEasy/blob/main/documentation/coding-conventions.adoc#log-messages
Metadata
Metadata
Assignees
Labels
Type
Projects
Status