commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r209499 - in /jakarta/commons/proper/vfs/trunk: ./ src/java/org/apache/commons/vfs/provider/ src/java/org/apache/commons/vfs/provider/url/ src/test/org/apache/commons/vfs/provider/test/
Date Wed, 06 Jul 2005 19:24:40 GMT
Author: imario
Date: Wed Jul  6 12:24:37 2005
New Revision: 209499

URL: http://svn.apache.org/viewcvs?rev=209499&view=rev
Log:
minor fixes

Modified:
    jakarta/commons/proper/vfs/trunk/project.xml
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/DelegateFileObject.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/URLFileName.java
    jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/url/UrlFileObject.java
    jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/provider/test/GenericFileNameTestCase.java

Modified: jakarta/commons/proper/vfs/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/project.xml?rev=209499&r1=209498&r2=209499&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/project.xml (original)
+++ jakarta/commons/proper/vfs/trunk/project.xml Wed Jul  6 12:24:37 2005
@@ -166,7 +166,9 @@
 
     <build>
         <sourceDirectory>src/java</sourceDirectory>
+
         <!-- Unit test classes -->
+        <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
         <unitTest>
             <includes>
                 <include>**/test/*TestCase.java</include>

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/DelegateFileObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/DelegateFileObject.java?rev=209499&r1=209498&r2=209499&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/DelegateFileObject.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/DelegateFileObject.java
Wed Jul  6 12:24:37 2005
@@ -329,6 +329,8 @@
      */
     public void close() throws FileSystemException
     {
+        super.close();
+
         if (file != null)
         {
             file.close();

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/URLFileName.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/URLFileName.java?rev=209499&r1=209498&r2=209499&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/URLFileName.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/URLFileName.java
Wed Jul  6 12:24:37 2005
@@ -24,6 +24,7 @@
 
     /**
      * get the query string
+     *
      * @return the query string part of the filename
      */
     public String getQueryString()
@@ -33,6 +34,7 @@
 
     /**
      * get the path and query string e.g. /path/servlet?param1=true
+     *
      * @return the path and its query string
      */
     public String getPathQuery()
@@ -47,6 +49,7 @@
 
     /**
      * get the path encoded suitable for url like filesystem e.g. (http, webdav)
+     *
      * @param charset the charset used for the path encoding
      */
     public String getPathQueryEncoded(String charset) throws URIException, FileSystemException
@@ -91,6 +94,7 @@
 
     /**
      * append query string to the uri
+     *
      * @return the uri
      */
     protected String createURI()
@@ -106,5 +110,13 @@
         }
 
         return super.createURI();
+    }
+
+    public String getURIEncoded(String charset) throws FileSystemException, URIException
+    {
+        StringBuffer sb = new StringBuffer(80);
+        appendRootUri(sb);
+        sb.append(getPathQueryEncoded(charset));
+        return sb.toString();
     }
 }

Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/url/UrlFileObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/url/UrlFileObject.java?rev=209499&r1=209498&r2=209499&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/url/UrlFileObject.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/url/UrlFileObject.java
Wed Jul  6 12:24:37 2005
@@ -15,11 +15,13 @@
  */
 package org.apache.commons.vfs.provider.url;
 
+import org.apache.commons.httpclient.URIException;
 import org.apache.commons.vfs.FileName;
 import org.apache.commons.vfs.FileObject;
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.FileType;
 import org.apache.commons.vfs.provider.AbstractFileObject;
+import org.apache.commons.vfs.provider.URLFileName;
 
 import java.io.FileNotFoundException;
 import java.io.InputStream;
@@ -62,8 +64,15 @@
         }
     }
 
-    protected URL createURL(final FileName name) throws MalformedURLException
+    protected URL createURL(final FileName name) throws MalformedURLException, FileSystemException,
URIException
     {
+        if (name instanceof URLFileName)
+        {
+            URLFileName urlName = (URLFileName) getName();
+
+            // TODO: charset
+            return new URL(urlName.getURIEncoded(null));
+        }
         return new URL(getName().getURI());
     }
 

Modified: jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/provider/test/GenericFileNameTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/provider/test/GenericFileNameTestCase.java?rev=209499&r1=209498&r2=209499&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/provider/test/GenericFileNameTestCase.java
(original)
+++ jakarta/commons/proper/vfs/trunk/src/test/org/apache/commons/vfs/provider/test/GenericFileNameTestCase.java
Wed Jul  6 12:24:37 2005
@@ -19,7 +19,6 @@
 import org.apache.commons.vfs.FileSystemException;
 import org.apache.commons.vfs.provider.GenericFileName;
 import org.apache.commons.vfs.provider.URLFileNameParser;
-import org.apache.commons.vfs.provider.local.GenericFileNameParser;
 
 /**
  * Some GenericFileName test cases.
@@ -136,7 +135,7 @@
     {
         try
         {
-            GenericFileNameParser.getInstance().parseUri(null, null, uri);
+            new URLFileNameParser(80).parseUri(null, null, uri);
             fail();
         }
         catch (final FileSystemException e)



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


Mime
View raw message