From bd6bfcdcc9072c314021634a1c1a3a2424b9cf2e Mon Sep 17 00:00:00 2001 From: Dimitrios Efthymiou Date: Sun, 16 Jul 2023 01:56:18 +0100 Subject: [PATCH 1/2] EMAIL-205: removed dead code --- src/main/java/org/apache/commons/mail/EmailUtils.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/apache/commons/mail/EmailUtils.java b/src/main/java/org/apache/commons/mail/EmailUtils.java index a9fb1fe98..f677de78d 100644 --- a/src/main/java/org/apache/commons/mail/EmailUtils.java +++ b/src/main/java/org/apache/commons/mail/EmailUtils.java @@ -295,10 +295,6 @@ static String encodeUrl(final String input) throws UnsupportedEncodingException for (final byte c : input.getBytes(US_ASCII)) { int b = c; - if (b < 0) - { - b = 256 + b; - } if (SAFE_URL.get(b)) { builder.append((char) b); From 262bb8456074905fa5376c2624ad9cc85f5fa7d0 Mon Sep 17 00:00:00 2001 From: Dimitrios Efthymiou Date: Sun, 16 Jul 2023 10:56:41 +0100 Subject: [PATCH 2/2] EMAIL-205: corrected the byte calculation --- src/main/java/org/apache/commons/mail/EmailUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/mail/EmailUtils.java b/src/main/java/org/apache/commons/mail/EmailUtils.java index f677de78d..d0920c285 100644 --- a/src/main/java/org/apache/commons/mail/EmailUtils.java +++ b/src/main/java/org/apache/commons/mail/EmailUtils.java @@ -294,7 +294,7 @@ static String encodeUrl(final String input) throws UnsupportedEncodingException final StringBuilder builder = new StringBuilder(); for (final byte c : input.getBytes(US_ASCII)) { - int b = c; + int b = c & 0xff; if (SAFE_URL.get(b)) { builder.append((char) b);