This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new 97d5d232 Internal refactoring
new 42ac9960 Merge branch 'master' of
https://github.com/apache/commons-codec.git
97d5d232 is described below
commit 97d5d232f544910eb4e6feaef4172d3fbaec4abf
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Jun 18 01:40:59 2026 +0000
Internal refactoring
---
src/main/java/org/apache/commons/codec/net/QCodec.java | 6 ++----
.../java/org/apache/commons/codec/net/QuotedPrintableCodec.java | 5 ++---
src/main/java/org/apache/commons/codec/net/Utils.java | 2 ++
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/net/QCodec.java
b/src/main/java/org/apache/commons/codec/net/QCodec.java
index 658f8c0d..91077414 100644
--- a/src/main/java/org/apache/commons/codec/net/QCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/QCodec.java
@@ -101,8 +101,6 @@ public class QCodec extends RFC1522Codec implements
StringEncoder, StringDecoder
PRINTABLE_CHARS.set('}');
PRINTABLE_CHARS.set('~');
}
- private static final byte SPACE = 32;
-
private static final byte UNDERSCORE = 95;
private boolean encodeBlanks;
@@ -201,7 +199,7 @@ public class QCodec extends RFC1522Codec implements
StringEncoder, StringDecoder
if (b != UNDERSCORE) {
tmp[i] = b;
} else {
- tmp[i] = SPACE;
+ tmp[i] = Utils.SPACE;
}
}
return QuotedPrintableCodec.decodeQuotedPrintable(tmp);
@@ -217,7 +215,7 @@ public class QCodec extends RFC1522Codec implements
StringEncoder, StringDecoder
final byte[] data =
QuotedPrintableCodec.encodeQuotedPrintable(PRINTABLE_CHARS, bytes);
if (this.encodeBlanks) {
for (int i = 0; i < data.length; i++) {
- if (data[i] == SPACE) {
+ if (data[i] == Utils.SPACE) {
data[i] = UNDERSCORE;
}
}
diff --git
a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
b/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
index 61791aef..60ca8f6c 100644
--- a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
@@ -72,7 +72,6 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
private static final BitSet PRINTABLE_CHARS = new BitSet(256);
private static final byte ESCAPE_CHAR = '=';
private static final byte TAB = 9;
- private static final byte SPACE = 32;
private static final byte CR = 13;
private static final byte LF = 10;
@@ -96,7 +95,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
PRINTABLE_CHARS.set(i);
}
PRINTABLE_CHARS.set(TAB);
- PRINTABLE_CHARS.set(SPACE);
+ PRINTABLE_CHARS.set(Utils.SPACE);
}
/**
@@ -284,7 +283,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
* @return {@code true} if the byte is either a space or tab character.
*/
private static boolean isWhitespace(final int b) {
- return b == SPACE || b == TAB;
+ return b == Utils.SPACE || b == TAB;
}
/**
diff --git a/src/main/java/org/apache/commons/codec/net/Utils.java
b/src/main/java/org/apache/commons/codec/net/Utils.java
index bef805eb..a53ec7a7 100644
--- a/src/main/java/org/apache/commons/codec/net/Utils.java
+++ b/src/main/java/org/apache/commons/codec/net/Utils.java
@@ -35,6 +35,8 @@ final class Utils {
*/
private static final int RADIX = 16;
+ static final byte SPACE = 32;
+
/**
* Returns the numeric value of the character {@code b} in radix 16.
*