You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/10/19 07:17:20 UTC

[camel] 07/09: (chores) camel-json-validator: use standard check for exception type in catch blocks

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit db3b93b53b5354c1ba04da0a3e696d8f1e437933
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Tue Oct 18 16:53:53 2022 +0200

    (chores) camel-json-validator: use standard check for exception type in catch blocks
---
 .../camel/component/jsonvalidator/JsonValidatorEndpoint.java  | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorEndpoint.java b/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorEndpoint.java
index 0642458be2f..5a86f61ee29 100644
--- a/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorEndpoint.java
+++ b/components/camel-json-validator/src/main/java/org/apache/camel/component/jsonvalidator/JsonValidatorEndpoint.java
@@ -127,14 +127,11 @@ public class JsonValidatorEndpoint extends ResourceEndpoint {
                     }
                 }
             }
+        } catch (ValidationException e) {
+            throw e; // already as validation error
         } catch (Exception e) {
-            if (e instanceof ValidationException) {
-                // already as validation error
-                throw e;
-            } else {
-                // general error
-                this.errorHandler.handleErrors(exchange, schema, e);
-            }
+            // general error
+            this.errorHandler.handleErrors(exchange, schema, e);
         } finally {
             if (cache != null) {
                 cache.reset();