mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 08:13:43 +01:00
updated pom parsing to resolve issue #210
Former-commit-id: e1092139cc27a01fba8ecfa37aa3904ee96154e6
This commit is contained in:
@@ -83,8 +83,8 @@ public class PomParser {
|
||||
try {
|
||||
final PomHandler handler = new PomHandler();
|
||||
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
factory.setValidating(true);
|
||||
// factory.setNamespaceAware(true);
|
||||
// factory.setValidating(true);
|
||||
final SAXParser saxParser = factory.newSAXParser();
|
||||
final XMLReader xmlReader = saxParser.getXMLReader();
|
||||
xmlReader.setContentHandler(handler);
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class PomUtils {
|
||||
Model model = null;
|
||||
try {
|
||||
PomParser parser = new PomParser();
|
||||
parser.parse(file);
|
||||
model = parser.parse(file);
|
||||
} catch (PomParseException ex) {
|
||||
final String msg = String.format("Unable to parse pom '%s'", file.getPath());
|
||||
LOGGER.log(Level.WARNING, msg);
|
||||
|
||||
@@ -58,24 +58,10 @@ public class PomUtilsTest {
|
||||
*/
|
||||
@Test
|
||||
public void testReadPom_File() throws Exception {
|
||||
File file = BaseTest.getResourceAsFile(this, "dwr-xml.pom");
|
||||
|
||||
File file = BaseTest.getResourceAsFile(this, "dwr-pom.xml");
|
||||
String expResult = "Direct Web Remoting";
|
||||
Model result = PomUtils.readPom(file);
|
||||
assertEquals(expResult, result.getName());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Test of analyzePOM method, of class PomUtils.
|
||||
// */
|
||||
// @Test
|
||||
// public void testAnalyzePOM() throws Exception {
|
||||
// System.out.println("analyzePOM");
|
||||
// Dependency dependency = null;
|
||||
// File pomFile = null;
|
||||
// PomUtils instance = new PomUtils();
|
||||
// instance.analyzePOM(dependency, pomFile);
|
||||
// // TODO review the generated test code and remove the default call to fail.
|
||||
// fail("The test case is a prototype.");
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user