diff options
author | Joachim Lingner <jl@openoffice.org> | 2002-10-16 09:36:47 +0000 |
---|---|---|
committer | Joachim Lingner <jl@openoffice.org> | 2002-10-16 09:36:47 +0000 |
commit | fc06b25d09dcfb1d7d99c7cfa151efd2f850695a (patch) | |
tree | 5e3fe484a6865fed5a7fe0871861cccd2a6a1fc8 /sandbox | |
parent | 4248c502b09c806315167199e807d6bb24a73d5e (diff) |
#101435# replaced java 1.4 method
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/com/sun/star/lib/sandbox/SandboxSecurity.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sandbox/com/sun/star/lib/sandbox/SandboxSecurity.java b/sandbox/com/sun/star/lib/sandbox/SandboxSecurity.java index 997550a47ad3..89db32295726 100644 --- a/sandbox/com/sun/star/lib/sandbox/SandboxSecurity.java +++ b/sandbox/com/sun/star/lib/sandbox/SandboxSecurity.java @@ -2,9 +2,9 @@ * * $RCSfile: SandboxSecurity.java,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jl $ $Date: 2002-09-27 14:34:37 $ + * last change: $Author: jl $ $Date: 2002-10-16 10:36:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -444,7 +444,20 @@ public class SandboxSecurity extends SecurityManager //implements SecurityManage try { // If the file url contains spaces (i.e. %20) then URL.getFile() still contains %20 // File.getCanonicalPath does not replace %20 - String sWithSpaces= base.getFile().replaceAll("%20"," "); + // create a string with real spaces instead of %20 + StringBuffer buf= new StringBuffer(256); + String sSpace= "%20"; + String sFile= base.getFile(); + int begin= 0; + int end= 0; + while((end= sFile.indexOf(sSpace, begin)) != -1) { + buf.append( sFile.substring(begin, end)); + buf.append(" "); + begin= end + sSpace.length(); + } + buf.append(sFile.substring(begin)); + + String sWithSpaces= buf.toString(); dir = (new File(sWithSpaces).getCanonicalPath()); } catch (IOException e) { // shouldn't happen throw(new SandboxSecurityException("checkread.exception2", e.toString())); |