@Test public void testOtherLanguage() { assertThat(parse("rulepack/other-rulepack.xml").size()).isEqualTo(0); }
RulePack parse(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { SMInputFactory inputFactory = FortifyUtils.newStaxParser(); try { SMHierarchicCursor rootC = inputFactory.rootElementCursor(inputStream); rootC.advance(); SMInputCursor childCursor = rootC.childCursor(); RulePack rulePack = new RulePack(); while (childCursor.getNext() != null) { String nodeName = childCursor.getLocalName(); if ("Name".equals(nodeName)) { rulePack.setName(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Language".equals(nodeName)) { rulePack.setLanguage(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Rules".equals(nodeName)) { processRules(childCursor, rulePack); } } RulePackStAXParser.LOG.debug(rulePack.name() + " - " + rulePack.language() + " - " + rulePack.getRules().size()); return rulePack; } catch (XMLStreamException e) { throw new IllegalStateException("XML is not valid", e); } }
RulePackStAXParser { RulePack parse(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { SMInputFactory inputFactory = FortifyUtils.newStaxParser(); try { SMHierarchicCursor rootC = inputFactory.rootElementCursor(inputStream); rootC.advance(); SMInputCursor childCursor = rootC.childCursor(); RulePack rulePack = new RulePack(); while (childCursor.getNext() != null) { String nodeName = childCursor.getLocalName(); if ("Name".equals(nodeName)) { rulePack.setName(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Language".equals(nodeName)) { rulePack.setLanguage(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Rules".equals(nodeName)) { processRules(childCursor, rulePack); } } RulePackStAXParser.LOG.debug(rulePack.name() + " - " + rulePack.language() + " - " + rulePack.getRules().size()); return rulePack; } catch (XMLStreamException e) { throw new IllegalStateException("XML is not valid", e); } } }
RulePackStAXParser { RulePack parse(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { SMInputFactory inputFactory = FortifyUtils.newStaxParser(); try { SMHierarchicCursor rootC = inputFactory.rootElementCursor(inputStream); rootC.advance(); SMInputCursor childCursor = rootC.childCursor(); RulePack rulePack = new RulePack(); while (childCursor.getNext() != null) { String nodeName = childCursor.getLocalName(); if ("Name".equals(nodeName)) { rulePack.setName(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Language".equals(nodeName)) { rulePack.setLanguage(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Rules".equals(nodeName)) { processRules(childCursor, rulePack); } } RulePackStAXParser.LOG.debug(rulePack.name() + " - " + rulePack.language() + " - " + rulePack.getRules().size()); return rulePack; } catch (XMLStreamException e) { throw new IllegalStateException("XML is not valid", e); } }  }
RulePackStAXParser { RulePack parse(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { SMInputFactory inputFactory = FortifyUtils.newStaxParser(); try { SMHierarchicCursor rootC = inputFactory.rootElementCursor(inputStream); rootC.advance(); SMInputCursor childCursor = rootC.childCursor(); RulePack rulePack = new RulePack(); while (childCursor.getNext() != null) { String nodeName = childCursor.getLocalName(); if ("Name".equals(nodeName)) { rulePack.setName(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Language".equals(nodeName)) { rulePack.setLanguage(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Rules".equals(nodeName)) { processRules(childCursor, rulePack); } } RulePackStAXParser.LOG.debug(rulePack.name() + " - " + rulePack.language() + " - " + rulePack.getRules().size()); return rulePack; } catch (XMLStreamException e) { throw new IllegalStateException("XML is not valid", e); } }   }
RulePackStAXParser { RulePack parse(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { SMInputFactory inputFactory = FortifyUtils.newStaxParser(); try { SMHierarchicCursor rootC = inputFactory.rootElementCursor(inputStream); rootC.advance(); SMInputCursor childCursor = rootC.childCursor(); RulePack rulePack = new RulePack(); while (childCursor.getNext() != null) { String nodeName = childCursor.getLocalName(); if ("Name".equals(nodeName)) { rulePack.setName(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Language".equals(nodeName)) { rulePack.setLanguage(StringUtils.trim(childCursor.collectDescendantText(false))); } else if ("Rules".equals(nodeName)) { processRules(childCursor, rulePack); } } RulePackStAXParser.LOG.debug(rulePack.name() + " - " + rulePack.language() + " - " + rulePack.getRules().size()); return rulePack; } catch (XMLStreamException e) { throw new IllegalStateException("XML is not valid", e); } }    }