Skip to content

Commit

Permalink
Merge pull request #194 from Adsobat/sonar-fix
Browse files Browse the repository at this point in the history
Sonar fix
  • Loading branch information
Adsobat authored Jul 3, 2024
2 parents 25b628a + 34b6268 commit 9af1fad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class VersionUtils {

private static String version;

private static final Pattern MAJOR_MINOR_PATTERN = Pattern.compile("$([0-9]+).([0-9]+)");
private static final Pattern MAJOR_MINOR_PATTERN = Pattern.compile("^([0-9]+).([0-9]+)");

private VersionUtils() {
// private constructor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.correomqtt.plugin.xml_format;

public final class CustomXMLConstants {
public static final String NULL_NS_URI = "";

public static final String FEATURE_DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl";
private CustomXMLConstants() {
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ private Document getXmlDocument() {
private Document createXmlDocument() {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
factory.setFeature(CustomXMLConstants.FEATURE_DISALLOW_DOCTYPE_DECL, true);
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
} catch (ParserConfigurationException e) {
LOGGER.debug("Could not configure document builder factory. ", e);
Expand Down Expand Up @@ -184,6 +185,7 @@ public String getPrettyString() {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer;
try {
transformerFactory.setFeature(CustomXMLConstants.FEATURE_DISALLOW_DOCTYPE_DECL, true);
transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
transformer = transformerFactory.newTransformer();
} catch (TransformerConfigurationException e) {
Expand Down

0 comments on commit 9af1fad

Please sign in to comment.