Class ZipBombDetectedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.io.exception.OpenIOOperationException
cloud.opencode.base.io.compress.ZipBombDetectedException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
Thrown when ZIP archive operations breach the configured anti-bomb thresholds.
当 ZIP 操作触发配置的反炸弹阈值时抛出。
Triggered by any of the ZipOptions caps:
maxCompressionRatio / maxTotalSize / maxEntryCount /
maxNestingDepth / maxSingleEntrySize. Carries structured fields
(getViolatedThreshold() / getActualValue() / getConfiguredLimit())
so observability and policy code can react without parsing the free-text message.
由 ZipOptions 的以下任一上限触发:
maxCompressionRatio / maxTotalSize / maxEntryCount /
maxNestingDepth / maxSingleEntrySize。携带结构化字段
(getViolatedThreshold() / getActualValue() / getConfiguredLimit()),
让观测与策略代码无需解析自由文本消息即可处理。
- Since:
- JDK 25, opencode-base-io V1.0.4
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionZipBombDetectedException(String zipFile, String message) Constructs a new exception describing which threshold was breached.ZipBombDetectedException(String zipFile, String violatedThreshold, long actualValue, long configuredLimit) Constructs a new exception with structured threshold metadata.ZipBombDetectedException(String zipFile, String message, Throwable cause) Constructs a new exception with cause. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the observed value that breached the cap, or0when not provided.longReturns the cap value the caller configured viaZipOptions, or0when not provided.Returns the logical name of the threshold that was breached, or empty string when the exception was constructed without structured metadata.Methods inherited from class OpenIOOperationException
checksumFailed, copyFailed, createDirectoryFailed, createFileFailed, deleteFailed, fileNotFound, invalidPath, moveFailed, operation, path, readFailed, readFailed, resourceNotFound, sizeLimitExceeded, streamOperationFailed, watchFailed, writeFailed, writeFailedMethods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OpenExceptionMeta
getMetaPrefix
-
Constructor Details
-
ZipBombDetectedException
public ZipBombDetectedException(String zipFile, String violatedThreshold, long actualValue, long configuredLimit) Constructs a new exception with structured threshold metadata. 构造异常并携带结构化阈值元数据。- Parameters:
zipFile- path of the archive being processed | 正在处理的 ZIP 路径violatedThreshold- logical name of the breached cap, e.g."maxCompressionRatio"| 被触发的限制名(逻辑标识符)actualValue- the observed value that breached the cap | 触发上限时观测到的值configuredLimit- the cap value the caller configured viaZipOptions| 调用方通过ZipOptions配置的限制值
-
ZipBombDetectedException
Constructs a new exception describing which threshold was breached. Free-text constructor retained for callers that don't have numeric values to attach (e.g. nested-zip detection by name); structured fields default to empty /0. 构造异常说明被触发的阈值。本重载保留供没有数值可附带的调用方(如按名称检测嵌套 ZIP); 结构化字段默认为空 /0。- Parameters:
zipFile- path of the archive being processed | 正在处理的 ZIP 路径message- description of which limit was breached | 被触发的限制说明
-
ZipBombDetectedException
-
-
Method Details
-
getViolatedThreshold
Returns the logical name of the threshold that was breached, or empty string when the exception was constructed without structured metadata. 返回被触发阈值的逻辑名;以无结构化元数据的构造器创建时返回空串。- Returns:
- threshold identifier such as
"maxCompressionRatio"| 阈值标识符
-
getActualValue
public long getActualValue()Returns the observed value that breached the cap, or0when not provided. 返回触发上限时观测到的值;未提供时返回0。- Returns:
- observed value | 观测值
-
getConfiguredLimit
public long getConfiguredLimit()Returns the cap value the caller configured viaZipOptions, or0when not provided. 返回调用方通过ZipOptions配置的限制值;未提供时返回0。- Returns:
- configured limit | 配置的限制值
-