mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-21 00:29:21 +01:00
fixed the loading of the suppression schema for validation during parsing
Former-commit-id: 6107226d54e3e7821140de4c04675e9713997924
This commit is contained in:
@@ -68,7 +68,7 @@ public class SuppressionParser {
|
|||||||
*/
|
*/
|
||||||
public List<SuppressionRule> parseSuppressionRules(File file) throws SuppressionParseException {
|
public List<SuppressionRule> parseSuppressionRules(File file) throws SuppressionParseException {
|
||||||
try {
|
try {
|
||||||
final File schema = new File(this.getClass().getClassLoader().getResource("schema/suppression.xsd").getPath());
|
final InputStream schemaStream = this.getClass().getClassLoader().getResourceAsStream("schema/suppression.xsd");
|
||||||
final SuppressionHandler handler = new SuppressionHandler();
|
final SuppressionHandler handler = new SuppressionHandler();
|
||||||
|
|
||||||
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
@@ -76,7 +76,7 @@ public class SuppressionParser {
|
|||||||
factory.setValidating(true);
|
factory.setValidating(true);
|
||||||
final SAXParser saxParser = factory.newSAXParser();
|
final SAXParser saxParser = factory.newSAXParser();
|
||||||
saxParser.setProperty(SuppressionParser.JAXP_SCHEMA_LANGUAGE, SuppressionParser.W3C_XML_SCHEMA);
|
saxParser.setProperty(SuppressionParser.JAXP_SCHEMA_LANGUAGE, SuppressionParser.W3C_XML_SCHEMA);
|
||||||
saxParser.setProperty(SuppressionParser.JAXP_SCHEMA_SOURCE, schema);
|
saxParser.setProperty(SuppressionParser.JAXP_SCHEMA_SOURCE, new InputSource(schemaStream));
|
||||||
final XMLReader xmlReader = saxParser.getXMLReader();
|
final XMLReader xmlReader = saxParser.getXMLReader();
|
||||||
xmlReader.setErrorHandler(new SuppressionErrorHandler());
|
xmlReader.setErrorHandler(new SuppressionErrorHandler());
|
||||||
xmlReader.setContentHandler(handler);
|
xmlReader.setContentHandler(handler);
|
||||||
|
|||||||
Reference in New Issue
Block a user