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

pauls pushed a commit to branch SLING-7499
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git


The following commit(s) were added to refs/heads/SLING-7499 by this push:
     new 73bc09f  SLING-7499: improve leading whitespace trimming.
73bc09f is described below

commit 73bc09f81842c68ba1c80d4df3df14fdd7b84cf8
Author: Karl Pauls <karlpa...@gmail.com>
AuthorDate: Wed Feb 14 16:05:37 2018 +0100

    SLING-7499: improve leading whitespace trimming.
---
 .../org/apache/sling/resourceresolver/impl/helper/URI.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/resourceresolver/impl/helper/URI.java 
b/src/main/java/org/apache/sling/resourceresolver/impl/helper/URI.java
index 0760507..2da65cb 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/helper/URI.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/helper/URI.java
@@ -2024,9 +2024,13 @@ public class URI implements Cloneable, Comparable<URI>, 
Serializable {
         else {
             tmp = original;
             length = original.length();
-            while (length > 0 && tmp.charAt(0) == ' ') {
-                tmp = tmp.substring(1);
-                length -= 1;
+            int idx = 0;
+            while (idx < length  && tmp.charAt(idx) <= ' ') {
+                idx++;
+            }
+            if (idx > 0) {
+                tmp = tmp.substring(idx);
+                length -= idx;
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
pa...@apache.org.

Reply via email to