Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void write(Writer w, Model newModel, boolean namespaceDeclaration)
if (namespaceDeclaration) {
String modelVersion = newModel.getModelVersion();

Namespace pomNamespace = Namespace.getNamespace("", "http://maven.apache.org/POM/" + modelVersion);
Namespace pomNamespace = Namespace.getNamespace("http://maven.apache.org/POM/4.0.0");

Comment thread
elharo marked this conversation as resolved.
root.setNamespace(pomNamespace);

Expand All @@ -52,7 +52,7 @@ public static void write(Writer w, Model newModel, boolean namespaceDeclaration)
if (root.getAttribute("schemaLocation", xsiNamespace) == null) {
root.setAttribute(
"schemaLocation",
"http://maven.apache.org/POM/" + modelVersion + " http://maven.apache.org/maven-v"
"http://maven.apache.org/POM/4.0.0" + " http://maven.apache.org/maven-v"

Copilot AI Mar 20, 2026

Copy link

Choose a reason for hiding this comment

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

This concatenation joins two string literals (".../4.0.0" + " http://...") which is harder to read than a single literal. Collapsing it into one string (or building it from constants) would improve readability.

Suggested change
"http://maven.apache.org/POM/4.0.0" + " http://maven.apache.org/maven-v"
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v"

Copilot uses AI. Check for mistakes.
+ modelVersion.replace('.', '_') + ".xsd",
xsiNamespace);
}
Expand Down
Loading