>  
>     public static boolean isUrlEncoded(String in) {
> -      return URL_ENCODED_PATTERN.matcher(in).matches();
> +      if (!URL_VALID_PATTERN.matcher(in).matches()) {
> +         return false;
> +      }
> +
> +      // ensure that all % are followed by 2 hexadecimal characters
> +      int percentIdx = 0;
> +      while ((percentIdx = in.indexOf('%', percentIdx)) != -1) {
> +         if (percentIdx + 2 >= in.length()) {
> +            return false;
> +         }
> +         if (!isHexadecimal(in.charAt(percentIdx + 1)) ||
> +                 !isHexadecimal(in.charAt(percentIdx + 2))) {
> +            System.err.println("% is followed by non-alphanumeric " + 
> in.substring(percentIdx, percentIdx + 2));

Remove -- we cannot spam `System.err`.  Optionally introduce a logger instead.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/755/files#r31191727

Reply via email to