This commit is contained in:
Paulo Veiga 2018-09-16 18:27:42 -07:00
parent 4c66002339
commit a52f83d179

View File

@ -65,11 +65,11 @@ public class ExporterFactory {
private static final String UTF_8_CHARSET_NAME = "UTF-8"; private static final String UTF_8_CHARSET_NAME = "UTF-8";
private File baseImgDir; private File baseImgDir;
public ExporterFactory(@NotNull final ServletContext servletContext) throws ParserConfigurationException { public ExporterFactory(@NotNull final ServletContext servletContext) {
this.baseImgDir = new File(servletContext.getRealPath("/")); this.baseImgDir = new File(servletContext.getRealPath("/"));
} }
public ExporterFactory(@NotNull final File baseImgDir) throws ParserConfigurationException { public ExporterFactory(@NotNull final File baseImgDir) {
this.baseImgDir = baseImgDir; this.baseImgDir = baseImgDir;
} }
@ -112,12 +112,11 @@ public class ExporterFactory {
final String svgString = normalizeSvg(mapSvg); final String svgString = normalizeSvg(mapSvg);
CharArrayReader reader = new CharArrayReader(svgString.toCharArray()); CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader); final TranscoderInput input = new TranscoderInput(reader);
reader.close();
TranscoderOutput trascoderOutput = new TranscoderOutput(output); TranscoderOutput trascoderOutput = new TranscoderOutput(output);
// Save the image. // Save the image.
transcoder.transcode(input, trascoderOutput); transcoder.transcode(input, trascoderOutput);
reader.close();
break; break;
} }
case PDF: { case PDF: {
@ -129,9 +128,9 @@ public class ExporterFactory {
CharArrayReader reader = new CharArrayReader(svgString.toCharArray()); CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader); final TranscoderInput input = new TranscoderInput(reader);
TranscoderOutput trascoderOutput = new TranscoderOutput(output); TranscoderOutput trascoderOutput = new TranscoderOutput(output);
reader.close();
// Save the image. // Save the image.
transcoder.transcode(input, trascoderOutput); transcoder.transcode(input, trascoderOutput);
reader.close();
break; break;
} }
case SVG: { case SVG: {