private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException { try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } }
public List<RuleDebt> importXML(Reader xml, ValidationMessages validationMessages) { List<RuleDebt> ruleDebts = newArrayList(); try { SMInputFactory inputFactory = initStax(); SMHierarchicCursor cursor = inputFactory.rootElementCursor(xml); // advance to <sqale> cursor.advance(); SMInputCursor rootCursor = cursor.childElementCursor(CHARACTERISTIC); while (rootCursor.getNext() != null) { process(ruleDebts, validationMessages, rootCursor); } cursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { throw new IllegalStateException("XML is not valid", e); } return ruleDebts; }
public void closeCompletely() throws XMLStreamException { _xmlReader.closeCompletely(); }
public void closeCompletely() throws XMLStreamException { mDelegate2.closeCompletely(); }
public void closeCompletely() throws IOException { try { _xmlReader.closeCompletely(); } catch (XMLStreamException e) { StaxUtil.throwXmlAsIOException(e); } }
public void closeCompletely() throws IOException { try { _xmlReader.closeCompletely(); } catch (XMLStreamException e) { StaxUtil.throwXmlAsIOException(e); } }
private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException { try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } }
private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException { try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } } }
private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException { try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } } }
private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException { try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } } }
private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException { try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } }
private void parse(SMHierarchicCursor rootCursor) throws XMLStreamException { try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } }
public void parse(InputStream xmlInput) throws XMLStreamException { SMHierarchicCursor rootCursor = inf.rootElementCursor(xmlInput); try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } }
public void parse(InputStream xmlInput) throws XMLStreamException { SMHierarchicCursor rootCursor = inf.rootElementCursor(xmlInput); try { streamHandler.stream(rootCursor); } finally { rootCursor.getStreamReader().closeCompletely(); } }
public List<RuleDebt> importXML(Reader xml, ValidationMessages validationMessages) { List<RuleDebt> ruleDebts = newArrayList(); try { SMInputFactory inputFactory = initStax(); SMHierarchicCursor cursor = inputFactory.rootElementCursor(xml); // advance to <sqale> cursor.advance(); SMInputCursor rootCursor = cursor.childElementCursor(CHARACTERISTIC); while (rootCursor.getNext() != null) { process(ruleDebts, validationMessages, rootCursor); } cursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { throw new IllegalStateException("XML is not valid", e); } return ruleDebts; }
/** * Parses a processed violation file. * * @param file * the file to parse */ public void parse(File file) { this.repositoryKey = vsProject.isTest() ? GendarmeConstants.TEST_REPOSITORY_KEY : GendarmeConstants.REPOSITORY_KEY; if (!"cs".equals(project.getLanguageKey())) { // every repository key should be "fxcop-<language_key>", except for C# for which it is simply "fxcop" (for backward compatibility) repositoryKey += "-" + project.getLanguageKey(); } SMInputFactory inputFactory = StaxParserUtils.initStax(); FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(file); SMHierarchicCursor cursor = inputFactory.rootElementCursor(new InputStreamReader(fileInputStream, project.getFileSystem().getSourceCharset())); SMInputCursor rulesCursor = cursor.advance().descendantElementCursor("rule"); parseRuleBlocs(rulesCursor); cursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { throw new SonarException("Error while reading Gendarme result file: " + file.getAbsolutePath(), e); } catch (FileNotFoundException e) { throw new SonarException("Cannot find Gendarme result file: " + file.getAbsolutePath(), e); } finally { IOUtils.closeQuietly(fileInputStream); } }
cursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { throw new SonarException("Error while reading FxCop result file: " + file.getAbsolutePath(), e);
/** * @return */ public List<PhpCodeSnifferViolation> getViolations(File reportFile) { LOG.debug("Report file for PHP_CodeSniffer is " + reportFile); if (reportFile == null || !reportFile.exists()) { throw new SonarException("The XML report '" + reportFile + "' can't be found"); } String reportPath = reportFile.getAbsolutePath(); LOG.debug("Getting violations form report file"); List<PhpCodeSnifferViolation> violations = new ArrayList<PhpCodeSnifferViolation>(); try {// <checkstyle> SMInputFactory inputFactory = new SMInputFactory(XMLInputFactory.newInstance());// <checkstyle> SMInputCursor rootNodeCursor = inputFactory.rootElementCursor(reportFile).advance(); // <file> SMInputCursor fileNodeCursor = rootNodeCursor.childElementCursor(FILE_NODE_NAME).advance(); while (fileNodeCursor.asEvent() != null) { String fileName = fileNodeCursor.getAttrValue(FILE_NAME_ATTRIBUTE_NAME); SMInputCursor violationNodeCursor = fileNodeCursor.childElementCursor().advance(); // <error> while (violationNodeCursor.asEvent() != null) { violations.add(getViolation(fileName, violationNodeCursor)); violationNodeCursor.advance(); } fileNodeCursor.advance(); } rootNodeCursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { throw new XmlParserException("Unable to parse the XML Report '" + reportPath + "'", e); } return violations; }
/** * {@inheritDoc} */ @Override public RulesProfile importProfile(Reader reader, ValidationMessages messages) { RulesProfile profile = RulesProfile.create(); profile.setLanguage(languageKey); SMInputFactory inputFactory = initStax(); try { SMHierarchicCursor cursor = inputFactory.rootElementCursor(reader); SMInputCursor rulesetCursor = cursor.advance().childElementCursor(); parseRules(profile, rulesetCursor); cursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { messages.addErrorText("Failed to read the profile to import: " + e.getMessage()); } return profile; }
bugInstanceCursor.advance(); cursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { throw new IllegalStateException("Unable to parse the Findbugs XML Report '" + findbugsXmlReportPath + "'", e);