IDEMPIERE-6144 Can't export a report if the name has less than 3 characters (#2363)
This commit is contained in:
parent
88a9d3eb3a
commit
a5a1ce3050
|
|
@ -467,10 +467,8 @@ public class FileUtil
|
||||||
|
|
||||||
public static File createTempFile(String prefix, String suffix, File directory) throws IOException
|
public static File createTempFile(String prefix, String suffix, File directory) throws IOException
|
||||||
{
|
{
|
||||||
if (prefix.length() < 3) {
|
if (Util.isEmpty(prefix))
|
||||||
throw new IllegalArgumentException("Prefix string \"" + prefix +
|
throw new IllegalArgumentException("Prefix is required");
|
||||||
"\" too short: length must be at least 3");
|
|
||||||
}
|
|
||||||
|
|
||||||
prefix = Util.setFilenameCorrect(prefix);
|
prefix = Util.setFilenameCorrect(prefix);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,7 @@ public class CSVReportViewerRenderer implements IReportViewerRenderer {
|
||||||
try {
|
try {
|
||||||
String path = System.getProperty("java.io.tmpdir");
|
String path = System.getProperty("java.io.tmpdir");
|
||||||
String prefix = makePrefix(reportEngine.getName());
|
String prefix = makePrefix(reportEngine.getName());
|
||||||
if (log.isLoggable(Level.FINE))
|
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||||
{
|
|
||||||
log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
|
||||||
}
|
|
||||||
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
||||||
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
||||||
CSVReportRendererConfiguration config = new CSVReportRendererConfiguration()
|
CSVReportRendererConfiguration config = new CSVReportRendererConfiguration()
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,6 @@ public class HTMLReportViewerRenderer implements IReportViewerRenderer {
|
||||||
try {
|
try {
|
||||||
String path = System.getProperty("java.io.tmpdir");
|
String path = System.getProperty("java.io.tmpdir");
|
||||||
String prefix = makePrefix(reportEngine.getName());
|
String prefix = makePrefix(reportEngine.getName());
|
||||||
if (prefix.length() < 3)
|
|
||||||
prefix += "_".repeat(3-prefix.length());
|
|
||||||
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||||
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
||||||
String contextPath = Executions.getCurrent().getContextPath();
|
String contextPath = Executions.getCurrent().getContextPath();
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,6 @@ public class PDFReportViewerRenderer implements IReportViewerRenderer {
|
||||||
try {
|
try {
|
||||||
String path = System.getProperty("java.io.tmpdir");
|
String path = System.getProperty("java.io.tmpdir");
|
||||||
String prefix = makePrefix(reportEngine.getName());
|
String prefix = makePrefix(reportEngine.getName());
|
||||||
if (prefix.length() < 3)
|
|
||||||
prefix += "_".repeat(3-prefix.length());
|
|
||||||
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||||
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
||||||
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,6 @@ public class XLSReportViewerRenderer implements IReportViewerRenderer {
|
||||||
try {
|
try {
|
||||||
String path = System.getProperty("java.io.tmpdir");
|
String path = System.getProperty("java.io.tmpdir");
|
||||||
String prefix = makePrefix(reportEngine.getName());
|
String prefix = makePrefix(reportEngine.getName());
|
||||||
if (prefix.length() < 3)
|
|
||||||
prefix += "_".repeat(3-prefix.length());
|
|
||||||
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||||
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
||||||
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,7 @@ public class XLSXReportViewerRenderer implements IReportViewerRenderer {
|
||||||
try {
|
try {
|
||||||
String path = System.getProperty("java.io.tmpdir");
|
String path = System.getProperty("java.io.tmpdir");
|
||||||
String prefix = makePrefix(reportEngine.getName());
|
String prefix = makePrefix(reportEngine.getName());
|
||||||
if (log.isLoggable(Level.FINE))
|
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path=" + path + " Prefix=" + prefix);
|
||||||
{
|
|
||||||
log.log(Level.FINE, "Path=" + path + " Prefix=" + prefix);
|
|
||||||
}
|
|
||||||
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
||||||
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
||||||
XLSXReportRendererConfiguration config = new XLSXReportRendererConfiguration()
|
XLSXReportRendererConfiguration config = new XLSXReportRendererConfiguration()
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,6 @@ public class DatatableReportViewerRenderer implements IReportViewerRenderer {
|
||||||
try {
|
try {
|
||||||
String path = System.getProperty("java.io.tmpdir");
|
String path = System.getProperty("java.io.tmpdir");
|
||||||
String prefix = makePrefix(reportEngine.getName());
|
String prefix = makePrefix(reportEngine.getName());
|
||||||
if (prefix.length() < 3)
|
|
||||||
prefix += "_".repeat(3-prefix.length());
|
|
||||||
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||||
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
||||||
String contextPath = Executions.getCurrent().getContextPath();
|
String contextPath = Executions.getCurrent().getContextPath();
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,6 @@ public class PivotReportVieweRenderer implements IReportViewerRenderer {
|
||||||
try {
|
try {
|
||||||
String path = System.getProperty("java.io.tmpdir");
|
String path = System.getProperty("java.io.tmpdir");
|
||||||
String prefix = makePrefix(reportEngine.getName());
|
String prefix = makePrefix(reportEngine.getName());
|
||||||
if (prefix.length() < 3)
|
|
||||||
prefix += "_".repeat(3-prefix.length());
|
|
||||||
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "Path="+path + " Prefix="+prefix);
|
||||||
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
File file = FileUtil.createTempFile(prefix, "."+getFileExtension(), new File(path));
|
||||||
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
IReportRenderer<IReportRendererConfiguration> renderer = Core.getReportRenderer(getId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue