Commit a1f642ab authored by Piotr Gawron's avatar Piotr Gawron
Browse files

apache commons-text added to replace deprecated escapeXml functionality

parent e9f7817c
......@@ -22,6 +22,11 @@
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${apache.commons-text.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
......
......@@ -21,7 +21,7 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
......@@ -416,7 +416,7 @@ public class XmlParser {
return null;
}
// quite expensive
return StringEscapeUtils.escapeXml(string).replaceAll("\n", "&#10;").replace("\r", "&#13;");
return StringEscapeUtils.escapeXml10(string).replaceAll("\n", "&#10;").replace("\r", "&#13;");
}
public List<Node> getAllNotNecessirellyDirectChild(String tagName, Node root) {
......
......@@ -15,7 +15,7 @@ import java.nio.charset.StandardCharsets;
import javax.xml.bind.JAXBException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggingEvent;
import org.sbgn.SbgnUtil;
......@@ -74,7 +74,7 @@ public class SbgnmlXmlConverter implements IConverter {
throw new ConverterException("problematic output sbgn. Cannot find map tag");
}
String notesNode = "<notes><html:body xmlns:html=\"http://www.w3.org/1999/xhtml\">" +
StringEscapeUtils.escapeXml(notes.toString()) + "\n</html:body></notes> ";
StringEscapeUtils.escapeXml10(notes.toString()) + "\n</html:body></notes> ";
xml = xml.substring(0, position) + notesNode + xml.substring(position, xml.length());
}
result = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8));
......
......@@ -104,7 +104,7 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<!-- https://github.com/sbmlteam/jsbml/issues/156 -->
<!-- https://github.com/sbmlteam/jsbml/issues/156 -->
<exclusion>
<groupId>org.sbml.jsbml</groupId>
<artifactId>jsbml-core</artifactId>
......@@ -153,6 +153,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${apache.commons-text.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......
package lcsb.mapviewer.converter.model.sbml;
import javax.xml.stream.XMLStreamException;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.sbml.jsbml.AbstractNamedSBase;
import lcsb.mapviewer.converter.InvalidInputDataExecption;
......@@ -56,7 +57,7 @@ public class NotesUtility {
if (notes == null) {
return "";
}
return StringEscapeUtils.escapeXml(notes);
return StringEscapeUtils.escapeXml10(notes);
}
}
......@@ -43,6 +43,8 @@
<apache.commons-lang3.version>3.8.1</apache.commons-lang3.version>
<apache.commons-text.version>1.6</apache.commons-text.version>
<commons-cli.version>1.4</commons-cli.version>
<batik.version>1.10</batik.version>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment