You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2005/05/09 02:02:50 UTC

svn commit: r169196 - in /lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya: ac/file/FileAccreditableManager.java ac/file/FilePolicyManager.java lucene/index/ConfigurableIndexer.java

Author: gregor
Date: Sun May  8 17:02:50 2005
New Revision: 169196

URL: http://svn.apache.org/viewcvs?rev=169196&view=rev
Log:
Made sure that URI strings are properly encoded when calling the URI default constructor. This resolves the long-standing issue http://issues.apache.org/bugzilla/show_bug.cgi?id=27558 where Lenya could not be installed in a directory with spaces in the path.

Modified:
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FileAccreditableManager.java
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FilePolicyManager.java
    lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/lucene/index/ConfigurableIndexer.java

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FileAccreditableManager.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FileAccreditableManager.java?rev=169196&r1=169195&r2=169196&view=diff
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FileAccreditableManager.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FileAccreditableManager.java Sun May  8 17:02:50 2005
@@ -44,6 +44,8 @@
 import org.apache.lenya.ac.UserType;
 import org.apache.lenya.ac.impl.AbstractAccreditableManager;
 
+import org.apache.cocoon.util.NetUtils;
+
 /**
  * File-based accreditable manager.
  */
@@ -112,7 +114,7 @@
                 source = resolver.resolveURI(configurationDirectoryPath);
 
                 getLogger().debug("Configuration directory URI: " + source.getURI());
-                directory = new File(new URI(source.getURI()));
+                directory = new File(new URI(NetUtils.encodePath(source.getURI())));
             } catch (Exception e) {
                 throw new AccessControlException(e);
             } finally {

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FilePolicyManager.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FilePolicyManager.java?rev=169196&r1=169195&r2=169196&view=diff
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FilePolicyManager.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/ac/file/FilePolicyManager.java Sun May  8 17:02:50 2005
@@ -15,7 +15,7 @@
  *
  */
 
-/* $Id: FilePolicyManager.java,v 1.11 2004/08/25 13:45:59 andreas Exp $  */
+/* $Id$  */
 
 package org.apache.lenya.ac.file;
 
@@ -35,6 +35,7 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.util.NetUtils;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.lenya.ac.AccessControlException;
@@ -184,8 +185,8 @@
         String fileUri = getPolicySourceURI(url, policyFilename);
         File file;
         try {
-            file = new File(new URI(fileUri));
-        } catch (Exception e) {
+            file = new File(new URI(NetUtils.encodePath(fileUri)));
+        } catch (final Exception e) {
             throw new AccessControlException(e);
         }
         return file;
@@ -300,8 +301,8 @@
                 resolver = (SourceResolver) getServiceManager().lookup(SourceResolver.ROLE);
                 source = resolver.resolveURI(policiesDirectoryUri);
                 getLogger().debug("Policies directory source: [" + source.getURI() + "]");
-                directory = new File(new URI(source.getURI()));
-            } catch (Exception e) {
+                directory = new File(new URI(NetUtils.encodePath(source.getURI())));
+            } catch (final Exception e) {
                 throw new AccessControlException("Resolving policies directory failed: ", e);
             } finally {
                 if (resolver != null) {

Modified: lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/lucene/index/ConfigurableIndexer.java
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/lucene/index/ConfigurableIndexer.java?rev=169196&r1=169195&r2=169196&view=diff
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/lucene/index/ConfigurableIndexer.java (original)
+++ lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/lucene/index/ConfigurableIndexer.java Sun May  8 17:02:50 2005
@@ -15,7 +15,7 @@
  *
  */
 
-/* $Id: ConfigurableIndexer.java,v 1.17 2004/05/16 23:25:15 michi Exp $  */
+/* $Id$  */
 
 package org.apache.lenya.lucene.index;
 
@@ -32,6 +32,7 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.cocoon.util.NetUtils;
 import org.apache.lenya.xml.DocumentHelper;
 import org.apache.log4j.Category;
 import org.w3c.dom.Document;
@@ -70,7 +71,7 @@
         log.debug(".getStylesheet(): Configuration file: " + configurationFile.getAbsolutePath());
 
         URL configurationCreatorURL = ConfigurableIndexer.class.getClassLoader().getResource(CONFIGURATION_CREATOR_STYLESHEET);
-        File configurationStylesheetFile = new File(new URI(configurationCreatorURL.toString()));
+        File configurationStylesheetFile = new File(new URI(NetUtils.encodePath(configurationCreatorURL.toString())));
         Document configurationDocument = DocumentHelper.readDocument(configurationFile);
 
         TransformerFactory tFactory = TransformerFactory.newInstance();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org