code: @FFDCIgnore(Throwable.class)
      public static XMLInputFactory createXMLInputFactory(boolean nsAware) {
          XMLInputFactory factory = null;
          try {
              factory = XMLInputFactory.newInstance();
          } catch (Throwable t) {
              if (LOG.isLoggable(Level.FINE)) {
                  LOG.log(Level.FINE, "XMLInputFactory.newInstance() failed with: ", t);
              }
              factory = null;
          }
          if (factory == null || !setRestrictionProperties(factory)) {
              try {
                  factory = createWoodstoxFactory();
              } catch (Throwable t) {
                  if (LOG.isLoggable(Level.FINE)) {
                      LOG.log(Level.FINE, "Cannot create Woodstox XMLInputFactory: ", t);
                  }
              }
  
              if (factory == null) {
                  throw new RuntimeException("Failed to create XMLInputFactory.");
              }
  
              if (!setRestrictionProperties(factory)) {
                  if (allowInsecureParser) {
                      //Liberty change start
                      //defect 165502: comment out the warning
                      //LOG.log(Level.WARNING, "INSECURE_PARSER_DETECTED", factory.getClass().getName());
                      //Liberty change end
                  } else {
                      throw new RuntimeException("Cannot create a secure XMLInputFactory");
                  }
              }
          }
          setProperty(factory, XMLInputFactory.IS_NAMESPACE_AWARE, nsAware);
          setProperty(factory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
          setProperty(factory, XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
          setProperty(factory, XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
          factory.setXMLResolver(new XMLResolver() {
              @Override
              public Object resolveEntity(String publicID, String systemID,
                                          String baseURI, String namespace)
                  throws XMLStreamException {
                  throw new XMLStreamException("Reading external entities is disabled");
              }
          });
  
          return factory;
      }
docs: Return a new factory so that the caller can set sticky parameters.
  
  @param nsAware
  @throws XMLStreamException