34197e77 by Ean Schuessler

#4364 use string builder

1 parent 01f33936
...@@ -35,7 +35,7 @@ public class LibreOfficeRenderer { ...@@ -35,7 +35,7 @@ public class LibreOfficeRenderer {
35 context.put("Linux_X86_64", "$Linux_X86_64"); 35 context.put("Linux_X86_64", "$Linux_X86_64");
36 context.put("Build", "$Build"); 36 context.put("Build", "$Build");
37 37
38 String output = ""; 38 StringBuilder output = new StringBuilder();
39 int idx = 0; 39 int idx = 0;
40 40
41 while (idx < template.length()) { 41 while (idx < template.length()) {
...@@ -44,12 +44,12 @@ public class LibreOfficeRenderer { ...@@ -44,12 +44,12 @@ public class LibreOfficeRenderer {
44 String tmplChunk = template.substring(idx, idx + chunkLength); 44 String tmplChunk = template.substring(idx, idx + chunkLength);
45 SimpleTemplateEngine engine = new SimpleTemplateEngine(); 45 SimpleTemplateEngine engine = new SimpleTemplateEngine();
46 Writable stTemplate = engine.createTemplate(tmplChunk).make(context); 46 Writable stTemplate = engine.createTemplate(tmplChunk).make(context);
47 output += stTemplate.toString(); 47 output.append(stTemplate.toString());
48 idx += chunkLength; 48 idx += chunkLength;
49 } 49 }
50 50
51 File outputFile = File.createTempFile("bfdcs-", "-tmpl"); 51 File outputFile = File.createTempFile("bfdcs-", "-tmpl");
52 UtilIO.writeString(outputFile, output); 52 UtilIO.writeString(outputFile, output.toString());
53 53
54 List<String> args = Arrays.asList(new String[]{"libreoffice", "--headless", "--convert-to", "pdf", outputFile.getPath(), "--outdir", "/tmp"}); 54 List<String> args = Arrays.asList(new String[]{"libreoffice", "--headless", "--convert-to", "pdf", outputFile.getPath(), "--outdir", "/tmp"});
55 ProcessBuilder pb = new ProcessBuilder(args); 55 ProcessBuilder pb = new ProcessBuilder(args);
......