Class OpenHashException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.hash.exception.OpenHashException
- All Implemented Interfaces:
Serializable
Hash operation exception
哈希操作异常
Exception thrown when hash operations fail, including algorithm not supported, invalid input, illegal state, and other hash-related errors.
哈希操作失败时抛出的异常,包括算法不支持、无效输入、非法状态和其他哈希相关错误。
Features | 主要功能:
- Algorithm information - 算法信息
- Operation context - 操作上下文
- Factory methods for common errors - 常见错误的工厂方法
Usage Examples | 使用示例:
// Catch hash operation failures
// 捕获哈希操作失败
try {
hashFunction.hash(data);
} catch (OpenHashException e) {
log.error("Hash failed: {}", e.getMessage());
}
Security | 安全性:
- Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
- Null-safe: No - 空值安全: 否
- Since:
- JDK 25, opencode-base-hash V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenHashException(String message) Creates exception with message 使用消息创建异常OpenHashException(String algorithm, String operation, String message) Creates exception with algorithm and operation context 使用算法和操作上下文创建异常OpenHashException(String algorithm, String operation, String message, Throwable cause) Creates exception with algorithm, operation, and cause 使用算法、操作和原因创建异常OpenHashException(String message, Throwable cause) Creates exception with message and cause 使用消息和原因创建异常 -
Method Summary
Modifier and TypeMethodDescriptionGets the algorithm name 获取算法名称static OpenHashExceptionalgorithmNotSupported(String algorithm) Creates an algorithm not supported exception 创建算法不支持异常static OpenHashExceptionCreates a hasher already used exception 创建Hasher已使用异常static OpenHashExceptionhashFailed(String algorithm, Throwable cause) Creates a hash computation failed exception 创建哈希计算失败异常static OpenHashExceptionhmacFailed(String algorithm, Throwable cause) Creates an HMAC computation failed exception 创建HMAC计算失败异常static OpenHashExceptionillegalState(String message) Creates an illegal state exception 创建非法状态异常static OpenHashExceptioninvalidBloomFilterConfig(String reason) Creates an invalid bloom filter configuration exception 创建无效布隆过滤器配置异常static OpenHashExceptioninvalidInput(String message) Creates an invalid input exception 创建无效输入异常static OpenHashExceptionnodeNotFound(String nodeId) Creates a node not found exception 创建节点不存在异常Gets the operation type 获取操作类型Methods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
OpenHashException
Creates exception with message 使用消息创建异常- Parameters:
message- error message | 错误消息
-
OpenHashException
-
OpenHashException
-
OpenHashException
Creates exception with algorithm, operation, and cause 使用算法、操作和原因创建异常- Parameters:
algorithm- algorithm name | 算法名称operation- operation type | 操作类型message- error message | 错误消息cause- underlying cause | 底层原因
-
-
Method Details
-
algorithm
Gets the algorithm name 获取算法名称- Returns:
- algorithm name or null | 算法名称或null
-
operation
Gets the operation type 获取操作类型- Returns:
- operation type or null | 操作类型或null
-
algorithmNotSupported
Creates an algorithm not supported exception 创建算法不支持异常- Parameters:
algorithm- the unsupported algorithm | 不支持的算法- Returns:
- exception instance | 异常实例
-
invalidInput
Creates an invalid input exception 创建无效输入异常- Parameters:
message- error message | 错误消息- Returns:
- exception instance | 异常实例
-
illegalState
Creates an illegal state exception 创建非法状态异常- Parameters:
message- error message | 错误消息- Returns:
- exception instance | 异常实例
-
hashFailed
Creates a hash computation failed exception 创建哈希计算失败异常- Parameters:
algorithm- algorithm name | 算法名称cause- underlying cause | 底层原因- Returns:
- exception instance | 异常实例
-
invalidBloomFilterConfig
Creates an invalid bloom filter configuration exception 创建无效布隆过滤器配置异常- Parameters:
reason- the reason | 原因- Returns:
- exception instance | 异常实例
-
nodeNotFound
Creates a node not found exception 创建节点不存在异常- Parameters:
nodeId- node id | 节点ID- Returns:
- exception instance | 异常实例
-
hasherAlreadyUsed
Creates a hasher already used exception 创建Hasher已使用异常- Returns:
- exception instance | 异常实例
-
hmacFailed
Creates an HMAC computation failed exception 创建HMAC计算失败异常- Parameters:
algorithm- algorithm name | 算法名称cause- underlying cause | 底层原因- Returns:
- exception instance | 异常实例
-