From 64de18a629fa817af3bccf6e5cd3c1e660ea12e2 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sun, 15 Feb 2009 21:19:53 +0000 Subject: [PATCH] Fix [ adempiere-ZK Web Client-2603516 ] Concurrency problem loading files https://sourceforge.net/tracker2/?func=detail&atid=955896&aid=2603516&group_id=176962 --- .../adempiere/webui/editor/WFilenameEditor.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java index 71a14d8979..bd3f437e21 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java @@ -23,6 +23,7 @@ import org.adempiere.webui.component.FilenameBox; import org.adempiere.webui.event.ValueChangeEvent; import org.compiere.model.GridField; import org.compiere.util.CLogger; +import org.compiere.util.Env; import org.zkoss.util.media.Media; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; @@ -121,13 +122,16 @@ public class WFilenameEditor extends WEditor return; } - String fileName = System.getProperty("java.io.tmpdir") - + System.getProperty("file.separator") + file.getName(); - - File tempFile = new File(fileName); - FileOutputStream fos = null; + // String fileName = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + ; + // File tempFile = new File(fileName); + FileOutputStream fos = null; + String fileName = null; try { + + File tempFile = File.createTempFile(Env.getContext(Env.getCtx(), "#AD_User_Name")+"_", "_"+file.getName()); + fileName = tempFile.getAbsolutePath(); + fos = new FileOutputStream(tempFile); fos.write(file.getByteData()); fos.flush();