This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 7781c1e5556e Honour the documented default of two boolean options
(#29419)
7781c1e5556e is described below
commit 7781c1e5556e35260de681840fbe8ca73a24af7a
Author: dhairya05 <[email protected]>
AuthorDate: Mon Nov 9 15:03:38 2026 +0530
Honour the documented default of two boolean options (#29419)
* Honour the documented default of two boolean options
* Add the upgrade guide entries for the two changed defaults
* camel-http: document multiline as defaulting to false instead of changing
it
---
.../catalog/beans/LoggingHttpActivityListener.json | 2 +-
.../camel/bean/LoggingHttpActivityListener.json | 2 +-
.../http/LoggingHttpActivityListener.java | 2 +-
.../http/LoggingHttpActivityListenerTest.java | 48 ++++++++++++++++++++++
.../netty/http/NettyHttpConfiguration.java | 2 +-
.../NettyHttpComponentWithConfigurationTest.java | 17 ++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 7 ++++
7 files changed, 76 insertions(+), 4 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/LoggingHttpActivityListener.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/LoggingHttpActivityListener.json
index 9b6a5cccff6e..be50d5366347 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/LoggingHttpActivityListener.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/beans/LoggingHttpActivityListener.json
@@ -10,7 +10,7 @@
"groupId": "org.apache.camel",
"artifactId": "camel-http",
"version": "4.24.0-SNAPSHOT",
- "properties": { "loggingLevel": { "index": 0, "kind": "property",
"displayName": "Logging Level", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
], "deprecated": false, "autowired": false, "secret": false, "defaultValue":
"INFO", "description": "" }, "showRouteId": { "index": 1, "kind": "property",
"displayName": "Show Route Id", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": fa [...]
+ "properties": { "loggingLevel": { "index": 0, "kind": "property",
"displayName": "Logging Level", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
], "deprecated": false, "autowired": false, "secret": false, "defaultValue":
"INFO", "description": "" }, "showRouteId": { "index": 1, "kind": "property",
"displayName": "Show Route Id", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": fa [...]
}
}
diff --git
a/components/camel-http/src/generated/resources/META-INF/services/org/apache/camel/bean/LoggingHttpActivityListener.json
b/components/camel-http/src/generated/resources/META-INF/services/org/apache/camel/bean/LoggingHttpActivityListener.json
index 9b6a5cccff6e..be50d5366347 100644
---
a/components/camel-http/src/generated/resources/META-INF/services/org/apache/camel/bean/LoggingHttpActivityListener.json
+++
b/components/camel-http/src/generated/resources/META-INF/services/org/apache/camel/bean/LoggingHttpActivityListener.json
@@ -10,7 +10,7 @@
"groupId": "org.apache.camel",
"artifactId": "camel-http",
"version": "4.24.0-SNAPSHOT",
- "properties": { "loggingLevel": { "index": 0, "kind": "property",
"displayName": "Logging Level", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
], "deprecated": false, "autowired": false, "secret": false, "defaultValue":
"INFO", "description": "" }, "showRouteId": { "index": 1, "kind": "property",
"displayName": "Show Route Id", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": fa [...]
+ "properties": { "loggingLevel": { "index": 0, "kind": "property",
"displayName": "Logging Level", "required": false, "type": "enum", "javaType":
"java.lang.String", "enum": [ "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF"
], "deprecated": false, "autowired": false, "secret": false, "defaultValue":
"INFO", "description": "" }, "showRouteId": { "index": 1, "kind": "property",
"displayName": "Show Route Id", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": fa [...]
}
}
diff --git
a/components/camel-http/src/main/java/org/apache/camel/component/http/LoggingHttpActivityListener.java
b/components/camel-http/src/main/java/org/apache/camel/component/http/LoggingHttpActivityListener.java
index e37fdcf0ab84..ba675a044343 100644
---
a/components/camel-http/src/main/java/org/apache/camel/component/http/LoggingHttpActivityListener.java
+++
b/components/camel-http/src/main/java/org/apache/camel/component/http/LoggingHttpActivityListener.java
@@ -79,7 +79,7 @@ public class LoggingHttpActivityListener extends
ServiceSupport implements Camel
private int maxChars = 50000;
@Metadata(description = "If true, mask sensitive information like password
or passphrase in the log")
private Boolean logMask;
- @Metadata(defaultValue = "true", description = "If enabled then each
information is outputted as separate LOG events")
+ @Metadata(defaultValue = "false", description = "If enabled then each
information is outputted as separate LOG events")
private boolean multiline;
@Metadata(defaultValue = "true",
description = "If enabled then the source location of where the
log endpoint is used in Camel routes, would be used as logger name, instead"
diff --git
a/components/camel-http/src/test/java/org/apache/camel/component/http/LoggingHttpActivityListenerTest.java
b/components/camel-http/src/test/java/org/apache/camel/component/http/LoggingHttpActivityListenerTest.java
new file mode 100644
index 000000000000..eb3abf022779
--- /dev/null
+++
b/components/camel-http/src/test/java/org/apache/camel/component/http/LoggingHttpActivityListenerTest.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.http;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class LoggingHttpActivityListenerTest {
+
+ /**
+ * Every option below is annotated with an explicit defaultValue, so a
fresh listener must report exactly that
+ * value.
+ */
+ @Test
+ void documentedDefaults() {
+ LoggingHttpActivityListener listener = new
LoggingHttpActivityListener();
+
+ assertTrue(listener.isShowRouteId());
+ assertTrue(listener.isShowRouteGroup());
+ assertTrue(listener.isShowExchangeId());
+ assertTrue(listener.isShowBody());
+ assertTrue(listener.isShowHeaders());
+ assertTrue(listener.isShowStreams());
+ assertTrue(listener.isSourceLocationLoggerName());
+
+ assertFalse(listener.isShowBinary());
+ assertFalse(listener.isMultiline());
+
+ assertEquals(50000, listener.getMaxChars());
+ }
+}
diff --git
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
index a6f7e4c0b03a..bc7f8414187e 100644
---
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
+++
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/NettyHttpConfiguration.java
@@ -58,7 +58,7 @@ public class NettyHttpConfiguration extends
NettyConfiguration {
@UriParam(label = "consumer")
private boolean matchOnUriPrefix;
@UriParam(label = "consumer,advanced", defaultValue = "true")
- private boolean logWarnOnBadRequest;
+ private boolean logWarnOnBadRequest = true;
@UriParam
private boolean bridgeEndpoint;
@UriParam(label = "advanced")
diff --git
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpComponentWithConfigurationTest.java
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpComponentWithConfigurationTest.java
index f43959863521..7288c47c87b9 100644
---
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpComponentWithConfigurationTest.java
+++
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpComponentWithConfigurationTest.java
@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class NettyHttpComponentWithConfigurationTest extends CamelTestSupport {
@@ -64,6 +65,22 @@ public class NettyHttpComponentWithConfigurationTest extends
CamelTestSupport {
assertEquals(e1.getConfiguration().getMaxChunkSize(),
e2.getConfiguration().getMaxChunkSize());
}
+ /**
+ * Every option asserted here is annotated with defaultValue = "true", so
a fresh endpoint must report true.
+ */
+ @Test
+ public void testNettyComponentDocumentedBooleanDefaults() throws Exception
{
+ NettyHttpComponent comp = context.getComponent("netty-http",
NettyHttpComponent.class);
+
+ NettyHttpEndpoint e = (NettyHttpEndpoint)
comp.createEndpoint("netty-http://http://localhost:4455");
+
+ assertTrue(e.getConfiguration().isMapHeaders());
+ assertTrue(e.getConfiguration().isThrowExceptionOnFailure());
+ assertTrue(e.getConfiguration().isLogWarnOnBadRequest());
+ assertTrue(e.getConfiguration().isSend503whenSuspended());
+ assertTrue(e.getConfiguration().isUseRelativePath());
+ }
+
@Test
public void testNettyComponentWithExplicitConfiguration() throws Exception
{
NettyHttpComponent comp = context.getComponent("netty-http",
NettyHttpComponent.class);
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 75245301ff3e..227aeecdcbcd 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -7466,3 +7466,10 @@ Platform BOM, as for the Camel Quarkus extensions that
the BOM manages. Before,
of the run, which can be another one than the platform of the export, for
example when the export reuses the data of
an earlier `camel run`. An `io.quarkus` dependency that is given with its
version (`--dep` or
`camel.jbang.dependencies`) keeps that version. Nothing else changes for the
Quarkus runtime.
+
+=== camel-netty-http - logWarnOnBadRequest warns by default
+
+The `logWarnOnBadRequest` option of a `netty-http` consumer is documented as
enabled by default, but its field was
+left at `false`, so a request that Netty could not decode got its HTTP 400
returned without a log line. The option now
+defaults to `true`, as documented, so such a request logs `Netty request
decoder failure due: <reason> returning HTTP
+Status 400 to client` at `WARN` level. Set `logWarnOnBadRequest=false` on the
consumer to keep the previous silence.