Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -4,6 +4,8 @@

public class MessageFormatProperties {

/** Custom prefix */
protected String prefix = null;
/** Include URI protocol / scheme */
protected boolean scheme = true;
/** Include URI host */
Expand All @@ -15,6 +17,14 @@ public class MessageFormatProperties {
/** Include URI query */
protected boolean query = true;

public String getPrefix() {
return prefix;
}

public void setPrefix(String prefix) {
this.prefix = prefix;
}

public boolean isScheme() {
return scheme;
}
Expand Down Expand Up @@ -56,6 +66,6 @@ public void setQuery(boolean query) {
}

public MessageComposer toComposer() {
return new MessageComposer(scheme, host, port, path, query);
return new MessageComposer(prefix, scheme, host, port, path, query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

public class MessageComposer {

protected String prefix;
protected boolean scheme;
protected boolean host;
protected boolean port;
protected boolean path;
protected boolean query;

public MessageComposer(boolean scheme, boolean host, boolean port, boolean path, boolean query) {
public MessageComposer(String prefix, boolean scheme, boolean host, boolean port, boolean path, boolean query) {
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

Adding a new parameter at the beginning of the constructor changes the constructor signature and is a breaking change for any code that directly instantiates MessageComposer. While the internal usage has been updated in MessageFormatProperties.toComposer(), external consumers who directly instantiate this class will be broken.

Consider either:

  1. Adding the new parameter at the end to minimize breakage: MessageComposer(boolean scheme, boolean host, boolean port, boolean path, boolean query, String prefix)
  2. Deprecating the old constructor and adding a new one with the prefix parameter
  3. If breaking changes are acceptable, document this as a breaking change in the release notes

Copilot uses AI. Check for mistakes.
this.prefix = prefix;
this.scheme = scheme;
this.host = host;
this.port = port;
Expand All @@ -36,6 +38,9 @@ static boolean isNotStandardPort(final String scheme, final int port) {
}

protected void constructMessage(HttpRequest request, StringBuilder messageBuilder) throws IOException {
if (prefix != null) {
messageBuilder.append(prefix);
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

The prefix is appended directly without any spacing. This will result in the prefix running into the URL, producing output like GET [in]https://example.com or 200 OK [in]https://example.com. Consider adding a space after the prefix to improve readability:

if (prefix != null) {
    messageBuilder.append(prefix);
    messageBuilder.append(' ');
}

Alternatively, document that users should include the trailing space in the prefix value itself (e.g., "[in] ").

Suggested change
messageBuilder.append(prefix);
messageBuilder.append(prefix);
messageBuilder.append(' ');

Copilot uses AI. Check for mistakes.
}
if (scheme) {
String schemeValue = request.getScheme();
if(schemeValue != null && !schemeValue.isEmpty()) {
Expand Down
Loading