1 | package com.reallifedeveloper.maven.jdepend.xml; | |
2 | ||
3 | import java.io.File; | |
4 | ||
5 | import jakarta.xml.bind.JAXBContext; | |
6 | import jakarta.xml.bind.JAXBException; | |
7 | import jakarta.xml.bind.Unmarshaller; | |
8 | import jakarta.xml.bind.helpers.DefaultValidationEventHandler; | |
9 | ||
10 | /** | |
11 | * A parser for XML files created by JDepend. | |
12 | * | |
13 | * @author RealLifeDeveloper | |
14 | */ | |
15 | public final class XmlReportParser { | |
16 | ||
17 | private final Unmarshaller unmarshaller; | |
18 | ||
19 | /** | |
20 | * Creates a new {@code XmlReportParser}. | |
21 | * | |
22 | * @throws JAXBException if creating the underlying JAXB unmarshaller fails | |
23 | */ | |
24 | public XmlReportParser() throws JAXBException { | |
25 | JAXBContext jaxbContext = JAXBContext.newInstance(XmlReport.class); | |
26 | this.unmarshaller = jaxbContext.createUnmarshaller(); | |
27 |
1
1. <init> : removed call to jakarta/xml/bind/Unmarshaller::setEventHandler → SURVIVED |
this.unmarshaller.setEventHandler(new DefaultValidationEventHandler()); |
28 | } | |
29 | ||
30 | /** | |
31 | * Parses a file with XML generated by JDepend and creates the corresponding {@link XmlReport}. | |
32 | * | |
33 | * @param file the location of the JDepend XML file to parse | |
34 | * | |
35 | * @return an {@link XmlReport} representing the information in the XML file | |
36 | * | |
37 | * @throws JAXBException if any unepxected errors occur while parsing | |
38 | */ | |
39 | public XmlReport parse(File file) throws JAXBException { | |
40 |
1
1. parse : replaced return value with null for com/reallifedeveloper/maven/jdepend/xml/XmlReportParser::parse → KILLED |
return (XmlReport) unmarshaller.unmarshal(file); |
41 | } | |
42 | } | |
Mutations | ||
27 |
1.1 |
|
40 |
1.1 |