This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-xmlschema.git


The following commit(s) were added to refs/heads/master by this push:
     new ea036993 Avoid a cache leak if there is an error serialiazing the 
schema
ea036993 is described below

commit ea03699389d0f7dd1cc3fba424eb4db863069ebd
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Mon Apr 20 11:45:03 2026 +0100

    Avoid a cache leak if there is an error serialiazing the schema
---
 .../java/org/apache/ws/commons/schema/XmlSchemaSerializer.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
 
b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
index a6b43102..9f5ec5d2 100644
--- 
a/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
+++ 
b/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
@@ -137,9 +137,11 @@ public class XmlSchemaSerializer {
     public Document[] serializeSchema(XmlSchema schemaObj, boolean 
serializeIncluded)
         throws XmlSchemaSerializerException {
         serializedSchemaElements.set(new HashSet<>());
-        Document[] result = serializeSchemaElement(schemaObj, 
serializeIncluded);
-        serializedSchemaElements.remove();
-        return result;
+        try {
+            return serializeSchemaElement(schemaObj, serializeIncluded);
+        } finally {
+            serializedSchemaElements.remove();
+        }
     }
 
     /**

Reply via email to