summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2022-11-07 11:54:33 +0100
committerSimon Rettberg2022-11-07 11:54:33 +0100
commit32dfa69d3452ac63f2b0b17a22c0e9ae15487f49 (patch)
treeafe8dc58ef5ce77a8828d0ce195b44e372553a92
parent[client] Check VM HDD size limit on upload (diff)
downloadtutor-module-32dfa69d3452ac63f2b0b17a22c0e9ae15487f49.tar.gz
tutor-module-32dfa69d3452ac63f2b0b17a22c0e9ae15487f49.tar.xz
tutor-module-32dfa69d3452ac63f2b0b17a22c0e9ae15487f49.zip
[server] Remove apache commons dependencies
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java4
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java7
2 files changed, 5 insertions, 6 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java
index 1d232a57..4a0bb522 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/Mail.java
@@ -3,8 +3,8 @@ package org.openslx.bwlp.sat.mail;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.util.Base64;
-import org.apache.commons.codec.binary.Hex;
import org.openslx.bwlp.thrift.iface.UserInfo;
public class Mail {
@@ -39,7 +39,7 @@ public class Mail {
synchronized (md) {
md.update(recipient.userId.getBytes(StandardCharsets.UTF_8));
md.update(message.getBytes(StandardCharsets.UTF_8));
- return Hex.encodeHexString(md.digest());
+ return Base64.getEncoder().encodeToString(md.digest());
}
}
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java
index 35be803a..86bb3073 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/mail/QuotingSmtpHeader.java
@@ -2,8 +2,8 @@ package org.openslx.bwlp.sat.mail;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;
+import java.util.Base64;
-import org.apache.commons.codec.binary.Base64;
import org.apache.commons.net.smtp.SimpleSMTPHeader;
public class QuotingSmtpHeader extends SimpleSMTPHeader {
@@ -42,9 +42,8 @@ public class QuotingSmtpHeader extends SimpleSMTPHeader {
return "\"" + input + "\"";
return input;
}
- return "=?utf-8?B?"
- + new String(Base64.encodeBase64(input.getBytes(StandardCharsets.UTF_8), false),
- StandardCharsets.UTF_8) + "?=";
+ return "=?utf-8?B?" + Base64.getEncoder().encodeToString(input.getBytes(StandardCharsets.UTF_8))
+ + "?=";
}
private static String buildNamedAddress(String address, String name) {