changeset 2641:2bad13107161

Make file upload cross platform. flys-artifacts/trunk@4296 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 25 Apr 2012 14:21:09 +0000
parents b484318ca9c6
children 42b05a4bed25
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Apr 25 14:14:14 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Apr 25 14:21:09 2012 +0000
@@ -1,3 +1,8 @@
+2012-04-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java:
+	  Make it cross platform.
+
 2012-04-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java	Wed Apr 25 14:14:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FileUploadService.java	Wed Apr 25 14:21:09 2012 +0000
@@ -59,10 +59,14 @@
 
                 File artifactDir = FileTools.getDirectory(shapePath, uuid);
                 FileOutputStream fos =
-                    new FileOutputStream(artifactDir.getCanonicalPath() +
-                                         "/user-rgd.zip");
-                fos.write(fileData);
-                fos.close();
+                    new FileOutputStream(
+                    new File(artifactDir, "user-rgd.zip"));
+                try {
+                    fos.write(fileData);
+                }
+                finally {
+                    fos.close();
+                }
             }
             catch (IOException ioe) {
                 logger.warn(ioe, ioe);

http://dive4elements.wald.intevation.org