Skip to content

Commit

Permalink
Fix Error while access large xml in PayloadFactory
Browse files Browse the repository at this point in the history
Initialize XMLInputFactory with XMLInputFactory.properties when
instantiating PF to avoid skipping mandatory properties being added to
factory.

Fixes: wso2/product-micro-integrator#3775
  • Loading branch information
malakaganga committed Nov 21, 2024
1 parent 63e5ffb commit 890ddb6
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ public class PayloadFactoryMediator extends AbstractMediator {
private static final Log log = LogFactory.getLog(PayloadFactoryMediator.class);

public PayloadFactoryMediator() {
//ignore DTDs for XML Input
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
inputFactory.setProperty(XMLInputFactory.IS_COALESCING, true);
Map props = StAXUtils.loadFactoryProperties("XMLInputFactory.properties");
if (props != null) {
for (Object o : props.entrySet()) {
Map.Entry entry = (Map.Entry) o;
inputFactory.setProperty((String) entry.getKey(), entry.getValue());
}
}
}

/**
Expand Down

0 comments on commit 890ddb6

Please sign in to comment.