File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
server/src/org/openintegrationengine/engine/plugins/datatypes Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1414import org .xml .sax .SAXNotRecognizedException ;
1515import org .xml .sax .SAXNotSupportedException ;
1616import org .xml .sax .XMLReader ;
17+ import org .xml .sax .helpers .AttributesImpl ;
1718
1819/**
1920 * A base class for custom XMLReaders used in data type plugins.
@@ -37,6 +38,9 @@ public abstract class AbstractXMLReader implements XMLReader {
3738 /** The EntityResolver to resolve external entities. */
3839 protected EntityResolver entityResolver ;
3940
41+ /** Reusable instance that is cleared on each call of the accessor */
42+ private final AttributesImpl emptyAttributes = new AttributesImpl ();
43+
4044 /**
4145 * Helper method for subclasses to ensure the ContentHandler is configured.
4246 * <p>
@@ -51,6 +55,20 @@ protected void ensureHandlerSet() throws SAXException {
5155 }
5256 }
5357
58+ /**
59+ * Helper method for subclasses to get an empty instance of {@link AttributesImpl}.
60+ * <p>
61+ * This method reuses the same instance of {@link AttributesImpl} and clears it
62+ * before use.
63+ * </p>
64+ *
65+ * @return An empty instance of {@link AttributesImpl}
66+ */
67+ protected AttributesImpl getEmptyAttributes () {
68+ emptyAttributes .clear ();
69+ return emptyAttributes ;
70+ }
71+
5472 /**
5573 * Parse an XML document from the given input source.
5674 * <p>
You can’t perform that action at this time.
0 commit comments