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; }
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);
/** * {@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; }