mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-26 02:51:27 +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 {
|
try {
|
||||||
final PomHandler handler = new PomHandler();
|
final PomHandler handler = new PomHandler();
|
||||||
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||||
factory.setNamespaceAware(true);
|
// factory.setNamespaceAware(true);
|
||||||
factory.setValidating(true);
|
// factory.setValidating(true);
|
||||||
final SAXParser saxParser = factory.newSAXParser();
|
final SAXParser saxParser = factory.newSAXParser();
|
||||||
final XMLReader xmlReader = saxParser.getXMLReader();
|
final XMLReader xmlReader = saxParser.getXMLReader();
|
||||||
xmlReader.setContentHandler(handler);
|
xmlReader.setContentHandler(handler);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public final class PomUtils {
|
|||||||
Model model = null;
|
Model model = null;
|
||||||
try {
|
try {
|
||||||
PomParser parser = new PomParser();
|
PomParser parser = new PomParser();
|
||||||
parser.parse(file);
|
model = parser.parse(file);
|
||||||
} catch (PomParseException ex) {
|
} catch (PomParseException ex) {
|
||||||
final String msg = String.format("Unable to parse pom '%s'", file.getPath());
|
final String msg = String.format("Unable to parse pom '%s'", file.getPath());
|
||||||
LOGGER.log(Level.WARNING, msg);
|
LOGGER.log(Level.WARNING, msg);
|
||||||
|
|||||||
@@ -58,24 +58,10 @@ public class PomUtilsTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadPom_File() throws Exception {
|
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";
|
String expResult = "Direct Web Remoting";
|
||||||
Model result = PomUtils.readPom(file);
|
Model result = PomUtils.readPom(file);
|
||||||
assertEquals(expResult, result.getName());
|
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