[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    Re: [patch] use File.separator instead of "/" in DefaultFileItem.java
From:       Brent Verner <brent () rcfile ! org>
Date:       2003-02-25 5:48:27
[Download RAW message or body]

uhmm, here's the patch :-)

  b
-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

["commons-fileupload-1.0-beta-1.diff" (text/plain)]

diff -rc commons-fileupload-1.0-beta-1.orig/src/java/org/apache/commons/fileupload/DefaultFileItem.java \
commons-fileupload-1.0-beta-1/src/java/org/apache/commons/fileupload/DefaultFileItem.java
                
*** commons-fileupload-1.0-beta-1.orig/src/java/org/apache/commons/fileupload/DefaultFileItem.java	Sat \
                Feb 15 12:14:40 2003
--- commons-fileupload-1.0-beta-1/src/java/org/apache/commons/fileupload/DefaultFileItem.java	Mon \
                Feb 24 17:40:37 2003
***************
*** 575,582 ****
          if (requestSize > threshold)
          {
              String fileName = getUniqueId();
              fileName = "upload_" + fileName + ".tmp";
!             fileName = path + "/" + fileName;
              File f = new File(fileName);
              f.deleteOnExit();
              item.storeLocation = f;
--- 575,590 ----
          if (requestSize > threshold)
          {
              String fileName = getUniqueId();
+             if( path == null ){
+               try {
+                 path = System.getProperty("java.io.tmpdir");
+               }
+               catch(SecurityException ex){
+                 // doh!  cruel security policy detected :-P
+               }
+             }
              fileName = "upload_" + fileName + ".tmp";
!             fileName = path + File.separator + fileName;
              File f = new File(fileName);
              f.deleteOnExit();
              item.storeLocation = f;



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic