Class XmlSecurityException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.xml.exception.OpenXmlException
cloud.opencode.base.xml.exception.XmlSecurityException
- All Implemented Interfaces:
Serializable
XML Security Exception - Thrown when a security violation is detected
XML 安全异常 - 当检测到安全违规时抛出
This exception is thrown when the parser detects potential security threats, such as XXE (XML External Entity) attacks or entity expansion attacks.
当解析器检测到潜在的安全威胁(如 XXE 攻击或实体扩展攻击)时抛出此异常。
Features | 主要功能:
- Exception for XML security violations (XXE, entity expansion, etc.) - XML 安全违规异常(XXE、实体扩展等)
- Carries SecurityViolationType for programmatic handling - 携带 SecurityViolationType 用于编程式处理
Usage Examples | 使用示例:
// Catch security exception
try {
DomParser.parse(untrustedXml);
} catch (XmlSecurityException e) {
System.err.println("Security violation: " + e.getType());
}
- Since:
- JDK 25, opencode-base-xml V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSecurity Violation Type Enumeration 安全违规类型枚举 -
Constructor Summary
ConstructorsConstructorDescriptionXmlSecurityException(XmlSecurityException.SecurityViolationType type, String message) Constructs a security exception with violation type and message.XmlSecurityException(XmlSecurityException.SecurityViolationType type, String message, Throwable cause) Constructs a security exception with violation type, message and cause. -
Method Summary
Methods inherited from class OpenXmlException
bindError, getColumn, getLine, hasLocation, parseError, transformError, validationError, xpathErrorMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
XmlSecurityException
Constructs a security exception with violation type and message. 构造带违规类型和消息的安全异常。- Parameters:
type- the security violation type | 安全违规类型message- the detail message | 详细消息
-
XmlSecurityException
public XmlSecurityException(XmlSecurityException.SecurityViolationType type, String message, Throwable cause) Constructs a security exception with violation type, message and cause. 构造带违规类型、消息和原因的安全异常。- Parameters:
type- the security violation type | 安全违规类型message- the detail message | 详细消息cause- the cause | 原因
-
-
Method Details
-
getType
Returns the type of security violation. 返回安全违规类型。- Returns:
- the security violation type | 安全违规类型
-