Commit 4a71ee18 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

sbgn2String doens't create temporary file

parent 3a8d4e6f
......@@ -4,7 +4,6 @@ import java.io.*;
import javax.xml.bind.JAXBException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.logging.log4j.core.LogEvent;
import org.sbgn.SbgnUtil;
......@@ -51,10 +50,10 @@ public class SbgnmlXmlConverter extends Converter {
MinervaLoggerAppender.unregisterLogEventStorage(appender);
}
try {
File tempFile = File.createTempFile("sbgnmlExportTempFile", ".tmp");
SbgnUtil.writeToFile(exportedData, tempFile);
try (FileInputStream inputStream = new FileInputStream(tempFile)) {
String xml = IOUtils.toString(inputStream, "UTF-8");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SbgnUtil.writeTo(exportedData, baos);
String xml = new String(baos.toByteArray(), "UTF-8");
if (notes.length() > 0) {
int position = xml.indexOf("<map language");
if (position < 0) {
......@@ -65,7 +64,6 @@ public class SbgnmlXmlConverter extends Converter {
xml = xml.substring(0, position) + notesNode + xml.substring(position);
}
return xml;
}
} catch (IOException | JAXBException e) {
throw new ConverterException(e);
}
......
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