Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonar fix #193

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading