private static class LocationUserDataHandler implements UserDataHandler { public static final LocationUserDataHandler INSTANCE = new LocationUserDataHandler(); public void handle(short operation, String key, Object data, Node src, Node dst) { if (operation == NODE_CLONED) { dst.setUserData(key, data, this); } } }
@Override public int next() throws XMLStreamException { int next = super.next(); if (next == START_ELEMENT) { if (props.getInnerElementLevelThreshold() != -1 && getDepth() >= props.getInnerElementLevelThreshold()) { throw new DepthExceededStaxException(); } if (props.getElementCountThreshold() != -1 && ++totalElementCount >= props.getElementCountThreshold()) { throw new DepthExceededStaxException(); } if (props.getInnerElementCountThreshold() != -1) { if (!stack.empty()) { int currentCount = stack.pop(); if (++currentCount >= props.getInnerElementCountThreshold()) { throw new DepthExceededStaxException(); } else { stack.push(currentCount); } } stack.push(0); } } else if (next == END_ELEMENT && props.getInnerElementCountThreshold() != -1) { stack.pop(); } return next; } }
@Override public int next() throws XMLStreamException { int next = super.next(); if (next == START_ELEMENT) { if (props.getInnerElementLevelThreshold() != -1 && getDepth() >= props.getInnerElementLevelThreshold()) { throw new DepthExceededStaxException(); } if (props.getElementCountThreshold() != -1 && ++totalElementCount >= props.getElementCountThreshold()) { throw new DepthExceededStaxException(); } if (props.getInnerElementCountThreshold() != -1) { if (!stack.empty()) { int currentCount = stack.pop(); if (++currentCount >= props.getInnerElementCountThreshold()) { throw new DepthExceededStaxException(); } stack.push(currentCount); } stack.push(0); } } else if (next == END_ELEMENT && props.getInnerElementCountThreshold() != -1) { stack.pop(); } return next; } }
private static class LocationUserDataHandler implements UserDataHandler { public static final LocationUserDataHandler INSTANCE = new LocationUserDataHandler(); public void handle(short operation, String key, Object data, Node src, Node dst) { if (operation == NODE_CLONED) { dst.setUserData(key, data, this); } } }
@Override public int next() throws XMLStreamException { int next = super.next(); if (next == START_ELEMENT) { if (props.getInnerElementLevelThreshold() != -1 && getDepth() >= props.getInnerElementLevelThreshold()) { throw new DepthExceededStaxException(); } if (props.getElementCountThreshold() != -1 && ++totalElementCount >= props.getElementCountThreshold()) { throw new DepthExceededStaxException(); } if (props.getInnerElementCountThreshold() != -1) { if (!stack.empty()) { int currentCount = stack.pop(); if (++currentCount >= props.getInnerElementCountThreshold()) { throw new DepthExceededStaxException(); } stack.push(currentCount); } stack.push(0); } } else if (next == END_ELEMENT && props.getInnerElementCountThreshold() != -1) { stack.pop(); } return next; } }
private static class LocationUserDataHandler implements UserDataHandler { public static final LocationUserDataHandler INSTANCE = new LocationUserDataHandler(); public void handle(short operation, String key, Object data, Node src, Node dst) { if (operation == NODE_CLONED) { dst.setUserData(key, data, this); } } }
@Override public int next() throws XMLStreamException { int next = super.next(); if (next == START_ELEMENT) { if (props.getInnerElementLevelThreshold() != -1 && getDepth() >= props.getInnerElementLevelThreshold()) { throw new DepthExceededStaxException(); } if (props.getElementCountThreshold() != -1 && ++totalElementCount >= props.getElementCountThreshold()) { throw new DepthExceededStaxException(); } if (props.getInnerElementCountThreshold() != -1) { if (!stack.empty()) { int currentCount = stack.pop(); if (++currentCount >= props.getInnerElementCountThreshold()) { throw new DepthExceededStaxException(); } else { stack.push(currentCount); } } stack.push(0); } } else if (next == END_ELEMENT && props.getInnerElementCountThreshold() != -1) { stack.pop(); } return next; } }
private static class LocationUserDataHandler implements UserDataHandler { public static final LocationUserDataHandler INSTANCE = new LocationUserDataHandler(); public void handle(short operation, String key, Object data, Node src, Node dst) { if (operation == NODE_CLONED) { dst.setUserData(key, data, this); } } }
@Override public int next() throws XMLStreamException { int next = super.next(); if (next == START_ELEMENT) { if (props.getInnerElementLevelThreshold() != -1 && getDepth() >= props.getInnerElementLevelThreshold()) { throw new DepthExceededStaxException(); } if (props.getElementCountThreshold() != -1 && ++totalElementCount >= props.getElementCountThreshold()) { throw new DepthExceededStaxException(); } if (props.getInnerElementCountThreshold() != -1) { if (!stack.empty()) { int currentCount = stack.pop(); if (++currentCount >= props.getInnerElementCountThreshold()) { throw new DepthExceededStaxException(); } else { stack.push(currentCount); } } stack.push(0); } } else if (next == END_ELEMENT && props.getInnerElementCountThreshold() != -1) { stack.pop(); } return next; } }
protected XMLStreamReader createDepthReaderIfNeeded(XMLStreamReader reader, InputStream is) { DocumentDepthProperties props = getDepthProperties(); if (props != null && props.isEffective()) { reader = TransformUtils.createNewReaderIfNeeded(reader, is); reader = new DepthRestrictingStreamReader(reader, props); } else if (reader != null) { reader = configureReaderRestrictions(reader); } return reader; }
protected XMLStreamReader createDepthReaderIfNeeded(XMLStreamReader reader, InputStream is) { DocumentDepthProperties props = getDepthProperties(); if (props != null && props.isEffective()) { reader = TransformUtils.createNewReaderIfNeeded(reader, is); reader = new DepthRestrictingStreamReader(reader, props); } else if (reader != null) { reader = configureReaderRestrictions(reader); } return reader; }
public void handleMessage(Message message) { if (canBeIgnored(message)) { return; } XMLStreamReader reader = message.getContent(XMLStreamReader.class); if (reader == null) { InputStream is = message.getContent(InputStream.class); if (is != null) { reader = StaxUtils.createXMLStreamReader(is); message.setContent(InputStream.class, null); } if (reader == null) { return; } } DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader, elementCountThreshold, innerElementLevelThreshold, innerElementCountThreshold); message.setContent(XMLStreamReader.class, dr); }
public void handleMessage(Message message) { if (canBeIgnored(message)) { return; } XMLStreamReader reader = message.getContent(XMLStreamReader.class); if (reader == null) { InputStream is = message.getContent(InputStream.class); if (is != null) { reader = StaxUtils.createXMLStreamReader(is); message.setContent(InputStream.class, null); } if (reader == null) { return; } } DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader, elementCountThreshold, innerElementLevelThreshold, innerElementCountThreshold); message.setContent(XMLStreamReader.class, dr); }
public void handleMessage(Message message) { if (canBeIgnored(message)) { return; } XMLStreamReader reader = message.getContent(XMLStreamReader.class); if (reader == null) { InputStream is = message.getContent(InputStream.class); if (is != null) { reader = StaxUtils.createXMLStreamReader(is); message.setContent(InputStream.class, null); } if (reader == null) { return; } } DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader, elementCountThreshold, innerElementLevelThreshold, innerElementCountThreshold); message.setContent(XMLStreamReader.class, dr); }
public void handleMessage(Message message) { if (canBeIgnored(message)) { return; } XMLStreamReader reader = message.getContent(XMLStreamReader.class); if (reader == null) { InputStream is = message.getContent(InputStream.class); if (is != null) { reader = StaxUtils.createXMLStreamReader(is); message.setContent(InputStream.class, null); } if (reader == null) { return; } } DepthRestrictingStreamReader dr = new DepthRestrictingStreamReader(reader, elementCountThreshold, innerElementLevelThreshold, innerElementCountThreshold); message.setContent(XMLStreamReader.class, dr); }
reader = new DepthRestrictingStreamReader(reader, p);