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


The following commit(s) were added to refs/heads/main by this push:
     new c6493094061 (chores) camel-util: replace a few String-related 
duplications in URISupport (#11409)
c6493094061 is described below

commit c6493094061eccd46dc2c7c26196523dabbf02da
Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com>
AuthorDate: Sun Sep 17 12:38:47 2023 +0200

    (chores) camel-util: replace a few String-related duplications in 
URISupport (#11409)
---
 .../src/main/java/org/apache/camel/util/URISupport.java   | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git 
a/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java 
b/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java
index 4dbda46c59b..6564b7255f2 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/URISupport.java
@@ -129,12 +129,8 @@ public final class URISupport {
         if (uri == null) {
             return null;
         }
-        int pos = uri.indexOf('?');
-        if (pos != -1) {
-            return uri.substring(pos + 1);
-        } else {
-            return null;
-        }
+
+        return StringHelper.after(uri, "?");
     }
 
     /**
@@ -286,12 +282,7 @@ public final class URISupport {
         String query = uri.getQuery();
         if (query == null) {
             String schemeSpecificPart = uri.getSchemeSpecificPart();
-            int idx = schemeSpecificPart.indexOf('?');
-            if (idx < 0) {
-                return null;
-            } else {
-                query = schemeSpecificPart.substring(idx + 1);
-            }
+            query = StringHelper.after(schemeSpecificPart, "?");
         } else if (query.indexOf('?') == 0) {
             // skip leading query
             query = query.substring(1);

Reply via email to