davsclaus commented on code in PR #23922:
URL: https://github.com/apache/camel/pull/23922#discussion_r3398287468
##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc:
##########
@@ -2194,14 +2230,3 @@ non-`Camel`-prefixed application headers and map them to
the corresponding
the `salesforce:` `to`. As defence-in-depth, strip inbound Camel-internal
headers
arriving from untrusted producers with `removeHeaders("CamelSalesforce*")` (or
the
broader `removeHeaders("Camel*")`) before the producer.
-
-=== camel-pqc
Review Comment:
**Rebase artifact — `camel-pqc` section deleted.** This section was added by
commit `feea08e7847f` (PR #23912, CAMEL-23726) and must not be removed. This is
almost certainly a merge/rebase conflict artifact. Please rebase on current
`main` to restore it.
##########
components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyAbstractFactory.java:
##########
@@ -204,6 +206,39 @@ protected static Integer generateKey(Integer key1, Integer
key2) {
return Integer.valueOf(keyGenerated);
}
+ protected boolean shouldContinueOnFailure(ContinueOnFailure fieldOpinion) {
+ return switch (fieldOpinion) {
+ case TRUE -> true;
+ case FALSE -> false;
+ case INHERIT -> continueParseOnFailure;
+ };
+ }
+
+ /**
+ * Parse a single field value with optional tolerance for failures.
+ *
+ * If parsing succeeds, returns the parsed value. If it fails and {@code
continueOnFailure} is false, the original
+ * exception is rethrown so the caller can wrap it with position/line
context (this is the existing fail-fast
+ * behavior). If it fails and {@code continueOnFailure} is true, returns
the field's {@code defaultValue} parsed
+ * through the same Format, or — if no defaultValue is set — the
type-appropriate default from
+ * {@link #getDefaultValueForPrimitive}.
+ */
+ protected Object parseField(
+ Format format, String string, boolean continueOnFailure, Class<?>
fieldType, String defaultValue)
+ throws Exception {
+ try {
+ return format.parse(string);
+ } catch (Exception e) {
+ if (!continueOnFailure) {
+ throw e;
+ }
Review Comment:
**Suggestion: add a log line for the tolerance path.** When the exception is
swallowed, there's no trace of what field failed or what fallback was
substituted. The existing bindy factories log extensively at `DEBUG` level
during parsing. A line like `LOG.debug("Parse failed for field type {},
substituting default", fieldType.getSimpleName(), e);` here would help users
troubleshoot unexpected default values without breaking the silent-recovery
intent.
##########
components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/annotation/ContinueOnFailure.java:
##########
@@ -0,0 +1,24 @@
+/*
+ * 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.dataformat.bindy.annotation;
+
+public enum ContinueOnFailure {
Review Comment:
Minor: the enum has no Javadoc. A brief class-level doc explaining the
tri-state semantics (and what each constant means) would help IDE users who
discover this type via autocomplete.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]