IDEMPIERE-3894 IllegalArgumentException when printing a print format with a short name

This commit is contained in:
Carlos Ruiz 2019-02-15 17:22:13 +01:00
parent b33c82d14d
commit 1c5a27152c
2 changed files with 12 additions and 16 deletions

View File

@ -334,10 +334,9 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
prefix = makePrefix(jasperPrintList.get(0).getName())+"_List"; prefix = makePrefix(jasperPrintList.get(0).getName())+"_List";
else else
prefix = makePrefix(jasperPrint.getName()); prefix = makePrefix(jasperPrint.getName());
if (log.isLoggable(Level.FINE)) if (prefix.length() < 3)
{ prefix += "_".repeat(3-prefix.length());
log.log(Level.FINE, "Path="+path + " Prefix="+prefix); if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
}
File file = File.createTempFile(prefix, ".html", new File(path)); File file = File.createTempFile(prefix, ".html", new File(path));
HtmlExporter exporter = new HtmlExporter(); HtmlExporter exporter = new HtmlExporter();

View File

@ -1556,10 +1556,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
log.warning("Cannot archive Document"); log.warning("Cannot archive Document");
String path = System.getProperty("java.io.tmpdir"); String path = System.getProperty("java.io.tmpdir");
String prefix = viewer.makePrefix(viewer.m_reportEngine.getName()); String prefix = viewer.makePrefix(viewer.m_reportEngine.getName());
if (log.isLoggable(Level.FINE)) if (prefix.length() < 3)
{ prefix += "_".repeat(3-prefix.length());
log.log(Level.FINE, "Path="+path + " Prefix="+prefix); if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
}
File file = File.createTempFile(prefix, ".pdf", new File(path)); File file = File.createTempFile(prefix, ".pdf", new File(path));
viewer.m_reportEngine.createPDF(file); viewer.m_reportEngine.createPDF(file);
viewer.media = new AMedia(file.getName(), "pdf", "application/pdf", file, true); viewer.media = new AMedia(file.getName(), "pdf", "application/pdf", file, true);
@ -1603,10 +1602,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
log.warning("Cannot archive Document"); log.warning("Cannot archive Document");
String path = System.getProperty("java.io.tmpdir"); String path = System.getProperty("java.io.tmpdir");
String prefix = viewer.makePrefix(viewer.m_reportEngine.getName()); String prefix = viewer.makePrefix(viewer.m_reportEngine.getName());
if (log.isLoggable(Level.FINE)) if (prefix.length() < 3)
{ prefix += "_".repeat(3-prefix.length());
log.log(Level.FINE, "Path="+path + " Prefix="+prefix); if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
}
File file = File.createTempFile(prefix, ".html", new File(path)); File file = File.createTempFile(prefix, ".html", new File(path));
viewer.m_reportEngine.createHTML(file, false, viewer.m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextPath, "rp", viewer.getUuid())); viewer.m_reportEngine.createHTML(file, false, viewer.m_reportEngine.getPrintFormat().getLanguage(), new HTMLExtension(contextPath, "rp", viewer.getUuid()));
viewer.media = new AMedia(file.getName(), "html", "text/html", file, false); viewer.media = new AMedia(file.getName(), "html", "text/html", file, false);
@ -1649,10 +1647,9 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
log.warning("Cannot archive Document"); log.warning("Cannot archive Document");
String path = System.getProperty("java.io.tmpdir"); String path = System.getProperty("java.io.tmpdir");
String prefix = viewer.makePrefix(viewer.m_reportEngine.getName()); String prefix = viewer.makePrefix(viewer.m_reportEngine.getName());
if (log.isLoggable(Level.FINE)) if (prefix.length() < 3)
{ prefix += "_".repeat(3-prefix.length());
log.log(Level.FINE, "Path="+path + " Prefix="+prefix); if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
}
File file = File.createTempFile(prefix, ".xls", new File(path)); File file = File.createTempFile(prefix, ".xls", new File(path));
viewer.m_reportEngine.createXLS(file, viewer.m_reportEngine.getPrintFormat().getLanguage()); viewer.m_reportEngine.createXLS(file, viewer.m_reportEngine.getPrintFormat().getLanguage());
viewer.media = new AMedia(file.getName(), "xls", "application/vnd.ms-excel", file, true); viewer.media = new AMedia(file.getName(), "xls", "application/vnd.ms-excel", file, true);