Java Code Examples for javax.xml.stream.XMLInputFactory#isPropertySupported()

The following examples show how to use javax.xml.stream.XMLInputFactory#isPropertySupported() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlUtil.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
/**
 * 'safe' is here reflecting:
 * http://activiti.org/userguide/index.html#advanced.safe.bpmn.xml
 */
public static XMLInputFactory createSafeXmlInputFactory() {
	XMLInputFactory xif = XMLInputFactory.newInstance();
	if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) {
		xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
		        false);
	}

	if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) {
		xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES,
		        false);
	}

	if (xif.isPropertySupported(XMLInputFactory.SUPPORT_DTD)) {
		xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
	}
	return xif;
}
 
Example 2
Source File: XmlUtil.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
/**
 * 'safe' is here reflecting: http://www.jorambarrez.be/blog/2013/02/19/uploading -a-funny-xml-can-bring-down-your-server/ and
 * http://www.flowable.org/docs/userguide/index.html#advanced.safe.bpmn.xml
 */
public static XMLInputFactory createSafeXmlInputFactory() {
    XMLInputFactory xif = XMLInputFactory.newInstance();
    if (xif.isPropertySupported(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES)) {
        xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
    }

    if (xif.isPropertySupported(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) {
        xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
    }

    if (xif.isPropertySupported(XMLInputFactory.SUPPORT_DTD)) {
        xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
    }
    return xif;
}
 
Example 3
Source File: BaseStAXUT.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected static boolean setReportCData(XMLInputFactory f, boolean state) throws XMLStreamException {

        Boolean b = state ? Boolean.TRUE : Boolean.FALSE;
        if (f.isPropertySupported(PROP_REPORT_CDATA)) {
            f.setProperty(PROP_REPORT_CDATA, b);
            return true;
        }
        return false;
    }
 
Example 4
Source File: XMLStreamReaderFactory.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
}
 
Example 5
Source File: XmlParsers.java    From galleon with Apache License 2.0 4 votes vote down vote up
private static void setIfSupported(final XMLInputFactory inputFactory, final String property, final Object value) {
    if (inputFactory.isPropertySupported(property)) {
        inputFactory.setProperty(property, value);
    }
}
 
Example 6
Source File: XMLStreamReaderFactory.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
}
 
Example 7
Source File: XMLStreamReaderFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
}
 
Example 8
Source File: XMLStreamReaderFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
}
 
Example 9
Source File: XMLStreamReaderFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
    //Using try/catch instead of isPropertySupported because Woodstox
    //isPropertySupported is not always reliable
    try {
        //this is needed to make sure Woodstox behavior is spec compliant for
        //calls to XMLStreamReader.getNamespacePrefix
        xif.setProperty(P_RETURN_NULL_FOR_DEFAULT_NAMESPACE, Boolean.TRUE);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_RETURN_NULL_FOR_DEFAULT_NAMESPACE + " is {0}", xif.getProperty(P_RETURN_NULL_FOR_DEFAULT_NAMESPACE));
        }
    } catch (Throwable t) {
        //ignore - this should not happen Woodstox 4.1.2 or later (maybe older version of Woodstox).
        LOGGER.log(Level.WARNING, "Expected property not found in Woodstox input factory: '{0}'", P_RETURN_NULL_FOR_DEFAULT_NAMESPACE);
    }
}
 
Example 10
Source File: XMLStreamReaderFactory.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
}
 
Example 11
Source File: XMLStreamReaderFactory.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
}
 
Example 12
Source File: XMLStreamReaderFactory.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public Woodstox(XMLInputFactory xif) {
    super(xif);

    if (xif.isPropertySupported(P_INTERN_NSURIS)) {
        xif.setProperty(P_INTERN_NSURIS, true);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_INTERN_NSURIS + " is {0}", true);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTES_PER_ELEMENT)) {
        maxAttributesPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTES_PER_ELEMENT, DEFAULT_MAX_ATTRIBUTES_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_ATTRIBUTES_PER_ELEMENT, maxAttributesPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTES_PER_ELEMENT + " is {0}", maxAttributesPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ATTRIBUTE_SIZE)) {
        maxAttributeSize = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ATTRIBUTE_SIZE, DEFAULT_MAX_ATTRIBUTE_SIZE)
        );
        xif.setProperty(P_MAX_ATTRIBUTE_SIZE, maxAttributeSize);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ATTRIBUTE_SIZE + " is {0}", maxAttributeSize);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHILDREN_PER_ELEMENT)) {
        maxChildrenPerElement = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_CHILDREN_PER_ELEMENT, DEFAULT_MAX_CHILDREN_PER_ELEMENT)
        );
        xif.setProperty(P_MAX_CHILDREN_PER_ELEMENT, maxChildrenPerElement);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHILDREN_PER_ELEMENT + " is {0}", maxChildrenPerElement);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_DEPTH)) {
        maxElementDepth = Integer.valueOf(buildIntegerValue(
            PROPERTY_MAX_ELEMENT_DEPTH, DEFAULT_MAX_ELEMENT_DEPTH)
        );
        xif.setProperty(P_MAX_ELEMENT_DEPTH, maxElementDepth);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_DEPTH + " is {0}", maxElementDepth);
        }
    }

    if (xif.isPropertySupported(P_MAX_ELEMENT_COUNT)) {
        maxElementCount = Long.valueOf(buildLongValue(
            PROPERTY_MAX_ELEMENT_COUNT, DEFAULT_MAX_ELEMENT_COUNT)
        );
        xif.setProperty(P_MAX_ELEMENT_COUNT, maxElementCount);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_ELEMENT_COUNT + " is {0}", maxElementCount);
        }
    }

    if (xif.isPropertySupported(P_MAX_CHARACTERS)) {
        maxCharacters = Long.valueOf(buildLongValue(
            PROPERTY_MAX_CHARACTERS, DEFAULT_MAX_CHARACTERS)
        );
        xif.setProperty(P_MAX_CHARACTERS, maxCharacters);
        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
        }
    }
}
 
Example 13
Source File: DeploymentStructureDescriptorParser.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void setIfSupported(final XMLInputFactory inputFactory, final String property, final Object value) {
    if (inputFactory.isPropertySupported(property)) {
        inputFactory.setProperty(property, value);
    }
}
 
Example 14
Source File: JBossAllXMLParsingProcessor.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void setIfSupported(final XMLInputFactory inputFactory, final String property, final Object value) {
    if (inputFactory.isPropertySupported(property)) {
        inputFactory.setProperty(property, value);
    }
}
 
Example 15
Source File: PatchBundleXml.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static void setIfSupported(final XMLInputFactory inputFactory, final String property, final Object value) {
    if (inputFactory.isPropertySupported(property)) {
        inputFactory.setProperty(property, value);
    }
}
 
Example 16
Source File: PatchXml.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static void setIfSupported(final XMLInputFactory inputFactory, final String property, final Object value) {
    if (inputFactory.isPropertySupported(property)) {
        inputFactory.setProperty(property, value);
    }
}