[java-shib-shared] branch main updated: Replace more unnecessary UTF-8 lookups.

Scott Cantor cantor.2 at osu.edu
Mon Apr 14 18:33:28 UTC 2025


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=cb25d1e2ddd6d7a62547d17efbff3d49c87e22fe

The following commit(s) were added to refs/heads/main by this push:
     new cb25d1e2 Replace more unnecessary UTF-8 lookups.
cb25d1e2 is described below

commit cb25d1e2ddd6d7a62547d17efbff3d49c87e22fe
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Apr 14 14:33:26 2025 -0400

    Replace more unnecessary UTF-8 lookups.
---
 .../java/net/shibboleth/shared/net/URISupport.java     | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java b/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java
index 488a3674..14b044b8 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/net/URISupport.java
@@ -14,13 +14,12 @@
 
 package net.shibboleth.shared.net;
 
-import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -491,12 +490,7 @@ public final class URISupport {
             return null;
         }
 
-        try {
-            return URLDecoder.decode(value, "UTF-8");
-        } catch (final UnsupportedEncodingException e) {
-            // UTF-8 encoding is required to be supported by all JVMs
-            return null;
-        }
+        return URLDecoder.decode(value, StandardCharsets.UTF_8);
     }
 
     /**
@@ -518,11 +512,7 @@ public final class URISupport {
             return null;
         }
 
-        try {
-            return URLEncoder.encode(value, "UTF-8");
-        } catch (final UnsupportedEncodingException e) {
-            // UTF-8 encoding is required to be supported by all JVMs
-            return null;
-        }
+        return URLEncoder.encode(value, StandardCharsets.UTF_8);
     }
+
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list