Skip to content

Commit

Permalink
core: Removed unused exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
cederberg committed Dec 9, 2023
1 parent 130db5e commit 7f05c76
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/java/org/rapidcontext/core/data/Binary.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;

Expand Down Expand Up @@ -231,7 +230,7 @@ public String mimeType() {
public String sha256() {
try {
return BinaryUtil.hashSHA256(data);
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
} catch (NoSuchAlgorithmException e) {
return null;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/java/org/rapidcontext/core/security/SecurityContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package org.rapidcontext.core.security;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -292,7 +291,7 @@ public static User authHash(String id, String suffix, String hash)
", expected: " + test + ", received: " + hash);
throw new SecurityException(msg);
}
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
} catch (NoSuchAlgorithmException e) {
String msg = "invalid environment, MD5 not supported";
LOG.log(Level.SEVERE, msg, e);
throw new SecurityException(msg, e);
Expand Down
9 changes: 2 additions & 7 deletions src/java/org/rapidcontext/util/BinaryUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand All @@ -41,11 +40,9 @@ public final class BinaryUtil {
*
* @throws NoSuchAlgorithmException if the MD5 algorithm isn't
* available (should be RuntimeException)
* @throws UnsupportedEncodingException if the UTF-8 encoding isn't
* available (should be RuntimeException)
*/
public static String hashMD5(String input)
throws NoSuchAlgorithmException, UnsupportedEncodingException {
throws NoSuchAlgorithmException {
return encodeHexString(hashBytes("MD5", input.getBytes(StandardCharsets.UTF_8)));
}

Expand All @@ -59,11 +56,9 @@ public static String hashMD5(String input)
*
* @throws NoSuchAlgorithmException if the SHA-256 algorithm isn't
* available (should be RuntimeException)
* @throws UnsupportedEncodingException if the UTF-8 encoding isn't
* available (should be RuntimeException)
*/
public static String hashSHA256(String input)
throws NoSuchAlgorithmException, UnsupportedEncodingException {
throws NoSuchAlgorithmException {
return encodeHexString(hashBytes("SHA-256", input.getBytes(StandardCharsets.UTF_8)));
}

Expand Down
1 change: 0 additions & 1 deletion src/java/org/rapidcontext/util/ClasspathUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package org.rapidcontext.util;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLDecoder;
Expand Down

0 comments on commit 7f05c76

Please sign in to comment.