You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Xeno Amess <xe...@gmail.com> on 2020/01/19 10:08:12 UTC

some questions (/bug?) about commons-vfs2 make me confused.

I'm trying to migrate to commons-vfs2 now
severial things I found not quite right / amazing.

1.
 I tested version 2.6.0 and 2.5.0, and I just start at
VSF.getManager() (of cause I have no additional contfigure or
something)

It said class not
found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider

And I looked into your binary jars I get from maven central (2.6.0).

they really do not have that class WebdavFileProvider.
(even not found that package org.apache.commons.vfs2.provider.webdav)

And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
that is not important)
It can run now.(and never tell me class not found again)
I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
All I get is:
2.6.0, broken.
2.5.0, broken.
2.3, fine.

According to the file on github, it said it might be deprecated, so I
wonder if you already deprecate d it and you just forgotten it?

 btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
there even do not exist 2.6.0
But there be a 2.6.0 in maven central.
really make me confused.

2.
for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
We all know slf4j's author really do not care about backward
maintenance or something.
His codes are never able to migrate.
even though, will there be some plan about using reflect or something
to make vfs2 CAN suit slf4j 2.0?

3.
for some reason I need to deal with relative file path.
Is there any guide about using relative file path in vfs2?

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Xeno Amess <xe...@gmail.com>.
Yep,that can do...
I upgrade vfs to 2.6 and tried adding commons-vfs2-jackrabbit1 and 2 and it
can work correctly now.
thx for your help guys.

Woonsan Ko <wo...@apache.org> 于2020年1月24日周五 上午4:05写道:

> On Thu, Jan 23, 2020 at 2:44 PM Xeno Amess <xe...@gmail.com> wrote:
> >
> > Likely but not exactly.
> > the provider I missed im my case here is
> > [org.apache.commons.vfs2.provider.webdav.WebdavFileProvider]
> > and the required classes are [org.apache.commons.httpclient.HttpClient]
> and
> > [org.apache.jackrabbit.webdav.client.methods.DavMethod]
> >
> > I went analyze my pom.
> > I use
> >
> > <dependency>
> >     <groupId>org.codehaus.mojo</groupId>
> >     <artifactId>versions-maven-plugin</artifactId>
> >     <version>2.7</version>
> > </dependency>
> >
> > [versions-maven-plugin] use [maven-plugin-plugin] to generate plugin.xml,
> > and which contains
> >
> > <dependency>
> >   <groupId>org.apache.maven.wagon</groupId>
> >   <artifactId>wagon-webdav-jackrabbit</artifactId>
> >   <type>jar</type>
> >   <version>1.0-beta-6</version>
> > </dependency>
> >
> > so [wagon-webdav-jackrabbit] contains
> > [org.apache.jackrabbit.webdav.client.methods.BaseDavRequest]
> >
> > [versions-maven-plugin] use [maven-plugin-plugin] to generate plugin.xml,
> > and which also contains
> >
> > <dependency>
> >   <groupId>commons-httpclient</groupId>
> >   <artifactId>commons-httpclient</artifactId>
> >   <type>jar</type>
> >   <version>3.0</version>
> > </dependency>
> >
> > so [commons-httpclient] contains
> [org.apache.commons.httpclient.HttpClient]
> >
> >
> > *So things goes clear here.Every project who have [versions-maven-plugin]
> > 2.7 as dependency will not start VFS normally.*
>
> Thank you very much for your thorough analysis!
> So, the problem may occur when commons-vfs2-jackrabbit1 doesn't exist
> whereas the required classes (if-available elements) exist. A
> temporary workaround could be just to add commons-vfs2-jackrabbit1
> dependency. Of course it's not a real fix.
>
> Back to your PR, I saw you suggest checking the provider class itself
> and skipping if the provider class is unavailable.
> Another approach is to add one more if-available element in the
> providers.xml to make sure whether the _specific_ provider can be
> loaded or not.
> For example, if we added
> 'org.apache.commons.vfs2.provider.webdav.WebdavFileSystem' as a new
> if-available element, it would work too.
> ('org.apache.commons.vfs2.provider.webdav4.Webdav4FileSystem' for
> webdav4 and webdav4s likewise.)
> This approach seems better to me because we can keep the "fail-fast"
> behavior if a provider class is wrong or misconfigured and the fix is
> provider-specific.
>
> Regards,
>
> Woonsan
>
> >
> > versions-maven-plugin is a plugin for auto upgrade version num in pom,
> and
> > is really useful to me.
> > I have no idea about why [versions-maven-plugin]'s author need do this.
> >
> > besides.
> >
> >   [versions-maven-plugin]'s plugin.xml contains some things like
> jackrabbit.
> > and yeah there be 3 jackrabbit libs.
> > I have no idea whether they invoke each other or what.
> > I just hope this can be a little useful for you.
> >
> >     <dependency>
> >       <groupId>org.apache.maven.wagon</groupId>
> >       <artifactId>wagon-webdav-jackrabbit</artifactId>
> >       <type>jar</type>
> >       <version>1.0-beta-6</version>
> >     </dependency>
> >     <dependency>
> >       <groupId>org.apache.jackrabbit</groupId>
> >       <artifactId>jackrabbit-webdav</artifactId>
> >       <type>jar</type>
> >       <version>1.5.0</version>
> >     </dependency>
> >     <dependency>
> >       <groupId>org.apache.jackrabbit</groupId>
> >       <artifactId>jackrabbit-jcr-commons</artifactId>
> >       <type>jar</type>
> >       <version>1.5.0</version>
> >     </dependency>
> >
> > besides.
> >
> > I really think split one java package into several maven project be
> > dangerous.
> >
> >
> >
> > Woonsan Ko <wo...@apache.org> 于2020年1月24日周五 上午1:03写道:
> >
> > > On Sun, Jan 19, 2020 at 11:41 AM Xeno Amess <xe...@gmail.com>
> wrote:
> > > >
> > > > yep that make sense.
> > > > but I'd rather add a class-check for provider class.
> > > > there already be a mechanism for making sure if all classes needed
> for
> > > > this provider class exist -> if not then just do not add the
> provider.
> > > > I will add a similar mechanism for making sure if the provider class
> > > > itself exist -> if not then just do not add the provider.
> > > > pull request here.
> > > > https://github.com/apache/commons-vfs/pull/78
> > >
> > > I thought the nested if-available elements [1] would do necessary
> > > checks before attempting to create the provider. In my understanding,
> > > if the required class doesn't exist, then the provider won't be
> > > created.
> > > So, in your case, do you have both org.apache.http.client.HttpClient
> > > and org.apache.jackrabbit.webdav.client.methods.BaseDavRequest, but
> > > not have commons-vfs2-jackrabbit1-2.5.0? Is it why you met the
> > > problem?
> > >
> > > Regards,
> > >
> > > Woonsan
> > >
> > > [1]
> > >
> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.5.0/commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml#L107-L108
> > >
> > > >
> > > > Rob Spoor <ap...@icemanx.nl> 于2020年1月20日周一 上午12:13写道:
> > > > >
> > > > > It seems that when the webdav support was moved to a separate
> artifact,
> > > > > the developers forgot to update file
> > > > >
> > >
> commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml.
> > > > > This file is used by StandardFileSystemManager to load the default
> > > > > providers.
> > > > >
> > > > > I think this warrants a fix, to move the webdav provider from this
> > > > > default providers.xml file to file
> > > > >
> commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml,
> > > > > and create the same file with the correct providers for the
> > > > > commons-vfs2-jackrabbit2 module.
> > > > >
> > > > >
> > > > > On 19/01/2020 16:57, Xeno Amess wrote:
> > > > > > OK I get where is bugged.
> > > > > > I will fix it and add a test for that never happen again.
> > > > > >
> > > > > > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
> > > > > >>
> > > > > >> The key point is even if I do not wanna use it I must have this
> > > > > >> class,or VFS.getManager() can never run.
> > > > > >>
> > > > > >> IMO this type of class relationship cause the project where hold
> > > this
> > > > > >> class must be added into vfs's pom as a dependency, or just move
> > > class
> > > > > >> VFS into that project aswell.
> > > > > >>
> > > > > >> Otherwise we should not let the VFS.getManager() rely on this
> class.
> > > > > >>
> > > > > >> Thanks for finding this class though.
> > > > > >>
> > > > > >> btw I tested 2.4, 2.4 is correct.
> > > > > >>
> > > > > >> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> > > > > >>>
> > > > > >>> The class was there in release 2.4.1:
> > > > > >>>
> > >
> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
> > > .
> > > > > >>> In the next release, 2.5.0, it can indeed no longer be found. A
> > > bit of
> > > > > >>> investigating showed that the webdav classes got moved to a new
> > > > > >>> artifact:
> > > > > >>>
> > >
> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> > > > > >>>
> > > > > >>> That means you can still use it, you just need to include an
> extra
> > > > > >>> dependency:
> > > > > >>>
> > >
> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> > > > > >>>
> > > > > >>> There's apparently also a Jackrabbit 2 version available:
> > > > > >>>
> > >
> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> > > > > >>>
> > > > > >>>
> > > > > >>> On 19/01/2020 11:24, Xeno Amess wrote:
> > > > > >>>> Right now I'm using something like
> > > > > >>>> this to deal with relative files.
> > > > > >>>> But I just think there might be a more elegant way...
> > > > > >>>>
> > > > > >>>> fileSystemManager = new
> > > > > >>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > > > > >>>> fileSystemManager.setLogger(null);
> > > > > >>>> try {
> > > > > >>>>       fileSystemManager.init();
> > > > > >>>>       fileSystemManager.setBaseFile(new File(""));
> > > > > >>>> } catch (FileSystemException e) {
> > > > > >>>>       e.printStackTrace();
> > > > > >>>> }
> > > > > >>>>
> > > > > >>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> > > > > >>>>>
> > > > > >>>>> I'm trying to migrate to commons-vfs2 now
> > > > > >>>>> severial things I found not quite right / amazing.
> > > > > >>>>>
> > > > > >>>>> 1.
> > > > > >>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
> > > > > >>>>> VSF.getManager() (of cause I have no additional contfigure or
> > > > > >>>>> something)
> > > > > >>>>>
> > > > > >>>>> It said class not
> > > > > >>>>>
> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> > > > > >>>>>
> > > > > >>>>> And I looked into your binary jars I get from maven central
> > > (2.6.0).
> > > > > >>>>>
> > > > > >>>>> they really do not have that class WebdavFileProvider.
> > > > > >>>>> (even not found that package
> > > org.apache.commons.vfs2.provider.webdav)
> > > > > >>>>>
> > > > > >>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not
> 2.3.0
> > > but
> > > > > >>>>> that is not important)
> > > > > >>>>> It can run now.(and never tell me class not found again)
> > > > > >>>>> I dont't want to try 2.4.0. Really bad connection here(I'm
> in a
> > > villige now).
> > > > > >>>>> All I get is:
> > > > > >>>>> 2.6.0, broken.
> > > > > >>>>> 2.5.0, broken.
> > > > > >>>>> 2.3, fine.
> > > > > >>>>>
> > > > > >>>>> According to the file on github, it said it might be
> deprecated,
> > > so I
> > > > > >>>>> wonder if you already deprecate d it and you just forgotten
> it?
> > > > > >>>>>
> > > > > >>>>>    btw, according to your webpage
> > > https://commons.apache.org/proper/commons-vfs/
> > > > > >>>>> there even do not exist 2.6.0
> > > > > >>>>> But there be a 2.6.0 in maven central.
> > > > > >>>>> really make me confused.
> > > > > >>>>>
> > > > > >>>>> 2.
> > > > > >>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to
> > > 1.7.30
> > > > > >>>>> We all know slf4j's author really do not care about backward
> > > > > >>>>> maintenance or something.
> > > > > >>>>> His codes are never able to migrate.
> > > > > >>>>> even though, will there be some plan about using reflect or
> > > something
> > > > > >>>>> to make vfs2 CAN suit slf4j 2.0?
> > > > > >>>>>
> > > > > >>>>> 3.
> > > > > >>>>> for some reason I need to deal with relative file path.
> > > > > >>>>> Is there any guide about using relative file path in vfs2?
> > > > > >>>>
> > > > > >>>>
> > > ---------------------------------------------------------------------
> > > > > >>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > > >>>> For additional commands, e-mail: dev-help@commons.apache.org
> > > > > >>>
> > > > > >>>
> > > ---------------------------------------------------------------------
> > > > > >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > > >>> For additional commands, e-mail: dev-help@commons.apache.org
> > > > > >>>
> > > > > >
> > > > > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > > > For additional commands, e-mail: dev-help@commons.apache.org
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > > For additional commands, e-mail: dev-help@commons.apache.org
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > For additional commands, e-mail: dev-help@commons.apache.org
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Woonsan Ko <wo...@apache.org>.
On Thu, Jan 23, 2020 at 2:44 PM Xeno Amess <xe...@gmail.com> wrote:
>
> Likely but not exactly.
> the provider I missed im my case here is
> [org.apache.commons.vfs2.provider.webdav.WebdavFileProvider]
> and the required classes are [org.apache.commons.httpclient.HttpClient] and
> [org.apache.jackrabbit.webdav.client.methods.DavMethod]
>
> I went analyze my pom.
> I use
>
> <dependency>
>     <groupId>org.codehaus.mojo</groupId>
>     <artifactId>versions-maven-plugin</artifactId>
>     <version>2.7</version>
> </dependency>
>
> [versions-maven-plugin] use [maven-plugin-plugin] to generate plugin.xml,
> and which contains
>
> <dependency>
>   <groupId>org.apache.maven.wagon</groupId>
>   <artifactId>wagon-webdav-jackrabbit</artifactId>
>   <type>jar</type>
>   <version>1.0-beta-6</version>
> </dependency>
>
> so [wagon-webdav-jackrabbit] contains
> [org.apache.jackrabbit.webdav.client.methods.BaseDavRequest]
>
> [versions-maven-plugin] use [maven-plugin-plugin] to generate plugin.xml,
> and which also contains
>
> <dependency>
>   <groupId>commons-httpclient</groupId>
>   <artifactId>commons-httpclient</artifactId>
>   <type>jar</type>
>   <version>3.0</version>
> </dependency>
>
> so [commons-httpclient] contains [org.apache.commons.httpclient.HttpClient]
>
>
> *So things goes clear here.Every project who have [versions-maven-plugin]
> 2.7 as dependency will not start VFS normally.*

Thank you very much for your thorough analysis!
So, the problem may occur when commons-vfs2-jackrabbit1 doesn't exist
whereas the required classes (if-available elements) exist. A
temporary workaround could be just to add commons-vfs2-jackrabbit1
dependency. Of course it's not a real fix.

Back to your PR, I saw you suggest checking the provider class itself
and skipping if the provider class is unavailable.
Another approach is to add one more if-available element in the
providers.xml to make sure whether the _specific_ provider can be
loaded or not.
For example, if we added
'org.apache.commons.vfs2.provider.webdav.WebdavFileSystem' as a new
if-available element, it would work too.
('org.apache.commons.vfs2.provider.webdav4.Webdav4FileSystem' for
webdav4 and webdav4s likewise.)
This approach seems better to me because we can keep the "fail-fast"
behavior if a provider class is wrong or misconfigured and the fix is
provider-specific.

Regards,

Woonsan

>
> versions-maven-plugin is a plugin for auto upgrade version num in pom, and
> is really useful to me.
> I have no idea about why [versions-maven-plugin]'s author need do this.
>
> besides.
>
>   [versions-maven-plugin]'s plugin.xml contains some things like jackrabbit.
> and yeah there be 3 jackrabbit libs.
> I have no idea whether they invoke each other or what.
> I just hope this can be a little useful for you.
>
>     <dependency>
>       <groupId>org.apache.maven.wagon</groupId>
>       <artifactId>wagon-webdav-jackrabbit</artifactId>
>       <type>jar</type>
>       <version>1.0-beta-6</version>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.jackrabbit</groupId>
>       <artifactId>jackrabbit-webdav</artifactId>
>       <type>jar</type>
>       <version>1.5.0</version>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.jackrabbit</groupId>
>       <artifactId>jackrabbit-jcr-commons</artifactId>
>       <type>jar</type>
>       <version>1.5.0</version>
>     </dependency>
>
> besides.
>
> I really think split one java package into several maven project be
> dangerous.
>
>
>
> Woonsan Ko <wo...@apache.org> 于2020年1月24日周五 上午1:03写道:
>
> > On Sun, Jan 19, 2020 at 11:41 AM Xeno Amess <xe...@gmail.com> wrote:
> > >
> > > yep that make sense.
> > > but I'd rather add a class-check for provider class.
> > > there already be a mechanism for making sure if all classes needed for
> > > this provider class exist -> if not then just do not add the provider.
> > > I will add a similar mechanism for making sure if the provider class
> > > itself exist -> if not then just do not add the provider.
> > > pull request here.
> > > https://github.com/apache/commons-vfs/pull/78
> >
> > I thought the nested if-available elements [1] would do necessary
> > checks before attempting to create the provider. In my understanding,
> > if the required class doesn't exist, then the provider won't be
> > created.
> > So, in your case, do you have both org.apache.http.client.HttpClient
> > and org.apache.jackrabbit.webdav.client.methods.BaseDavRequest, but
> > not have commons-vfs2-jackrabbit1-2.5.0? Is it why you met the
> > problem?
> >
> > Regards,
> >
> > Woonsan
> >
> > [1]
> > https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.5.0/commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml#L107-L108
> >
> > >
> > > Rob Spoor <ap...@icemanx.nl> 于2020年1月20日周一 上午12:13写道:
> > > >
> > > > It seems that when the webdav support was moved to a separate artifact,
> > > > the developers forgot to update file
> > > >
> > commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml.
> > > > This file is used by StandardFileSystemManager to load the default
> > > > providers.
> > > >
> > > > I think this warrants a fix, to move the webdav provider from this
> > > > default providers.xml file to file
> > > > commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml,
> > > > and create the same file with the correct providers for the
> > > > commons-vfs2-jackrabbit2 module.
> > > >
> > > >
> > > > On 19/01/2020 16:57, Xeno Amess wrote:
> > > > > OK I get where is bugged.
> > > > > I will fix it and add a test for that never happen again.
> > > > >
> > > > > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
> > > > >>
> > > > >> The key point is even if I do not wanna use it I must have this
> > > > >> class,or VFS.getManager() can never run.
> > > > >>
> > > > >> IMO this type of class relationship cause the project where hold
> > this
> > > > >> class must be added into vfs's pom as a dependency, or just move
> > class
> > > > >> VFS into that project aswell.
> > > > >>
> > > > >> Otherwise we should not let the VFS.getManager() rely on this class.
> > > > >>
> > > > >> Thanks for finding this class though.
> > > > >>
> > > > >> btw I tested 2.4, 2.4 is correct.
> > > > >>
> > > > >> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> > > > >>>
> > > > >>> The class was there in release 2.4.1:
> > > > >>>
> > https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
> > .
> > > > >>> In the next release, 2.5.0, it can indeed no longer be found. A
> > bit of
> > > > >>> investigating showed that the webdav classes got moved to a new
> > > > >>> artifact:
> > > > >>>
> > https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> > > > >>>
> > > > >>> That means you can still use it, you just need to include an extra
> > > > >>> dependency:
> > > > >>>
> > https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> > > > >>>
> > > > >>> There's apparently also a Jackrabbit 2 version available:
> > > > >>>
> > https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> > > > >>>
> > > > >>>
> > > > >>> On 19/01/2020 11:24, Xeno Amess wrote:
> > > > >>>> Right now I'm using something like
> > > > >>>> this to deal with relative files.
> > > > >>>> But I just think there might be a more elegant way...
> > > > >>>>
> > > > >>>> fileSystemManager = new
> > > > >>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > > > >>>> fileSystemManager.setLogger(null);
> > > > >>>> try {
> > > > >>>>       fileSystemManager.init();
> > > > >>>>       fileSystemManager.setBaseFile(new File(""));
> > > > >>>> } catch (FileSystemException e) {
> > > > >>>>       e.printStackTrace();
> > > > >>>> }
> > > > >>>>
> > > > >>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> > > > >>>>>
> > > > >>>>> I'm trying to migrate to commons-vfs2 now
> > > > >>>>> severial things I found not quite right / amazing.
> > > > >>>>>
> > > > >>>>> 1.
> > > > >>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
> > > > >>>>> VSF.getManager() (of cause I have no additional contfigure or
> > > > >>>>> something)
> > > > >>>>>
> > > > >>>>> It said class not
> > > > >>>>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> > > > >>>>>
> > > > >>>>> And I looked into your binary jars I get from maven central
> > (2.6.0).
> > > > >>>>>
> > > > >>>>> they really do not have that class WebdavFileProvider.
> > > > >>>>> (even not found that package
> > org.apache.commons.vfs2.provider.webdav)
> > > > >>>>>
> > > > >>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0
> > but
> > > > >>>>> that is not important)
> > > > >>>>> It can run now.(and never tell me class not found again)
> > > > >>>>> I dont't want to try 2.4.0. Really bad connection here(I'm in a
> > villige now).
> > > > >>>>> All I get is:
> > > > >>>>> 2.6.0, broken.
> > > > >>>>> 2.5.0, broken.
> > > > >>>>> 2.3, fine.
> > > > >>>>>
> > > > >>>>> According to the file on github, it said it might be deprecated,
> > so I
> > > > >>>>> wonder if you already deprecate d it and you just forgotten it?
> > > > >>>>>
> > > > >>>>>    btw, according to your webpage
> > https://commons.apache.org/proper/commons-vfs/
> > > > >>>>> there even do not exist 2.6.0
> > > > >>>>> But there be a 2.6.0 in maven central.
> > > > >>>>> really make me confused.
> > > > >>>>>
> > > > >>>>> 2.
> > > > >>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to
> > 1.7.30
> > > > >>>>> We all know slf4j's author really do not care about backward
> > > > >>>>> maintenance or something.
> > > > >>>>> His codes are never able to migrate.
> > > > >>>>> even though, will there be some plan about using reflect or
> > something
> > > > >>>>> to make vfs2 CAN suit slf4j 2.0?
> > > > >>>>>
> > > > >>>>> 3.
> > > > >>>>> for some reason I need to deal with relative file path.
> > > > >>>>> Is there any guide about using relative file path in vfs2?
> > > > >>>>
> > > > >>>>
> > ---------------------------------------------------------------------
> > > > >>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > >>>> For additional commands, e-mail: dev-help@commons.apache.org
> > > > >>>
> > > > >>>
> > ---------------------------------------------------------------------
> > > > >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > >>> For additional commands, e-mail: dev-help@commons.apache.org
> > > > >>>
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > > For additional commands, e-mail: dev-help@commons.apache.org
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > For additional commands, e-mail: dev-help@commons.apache.org
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Xeno Amess <xe...@gmail.com>.
Likely but not exactly.
the provider I missed im my case here is
[org.apache.commons.vfs2.provider.webdav.WebdavFileProvider]
and the required classes are [org.apache.commons.httpclient.HttpClient] and
[org.apache.jackrabbit.webdav.client.methods.DavMethod]

I went analyze my pom.
I use

<dependency>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>versions-maven-plugin</artifactId>
    <version>2.7</version>
</dependency>

[versions-maven-plugin] use [maven-plugin-plugin] to generate plugin.xml,
and which contains

<dependency>
  <groupId>org.apache.maven.wagon</groupId>
  <artifactId>wagon-webdav-jackrabbit</artifactId>
  <type>jar</type>
  <version>1.0-beta-6</version>
</dependency>

so [wagon-webdav-jackrabbit] contains
[org.apache.jackrabbit.webdav.client.methods.BaseDavRequest]

[versions-maven-plugin] use [maven-plugin-plugin] to generate plugin.xml,
and which also contains

<dependency>
  <groupId>commons-httpclient</groupId>
  <artifactId>commons-httpclient</artifactId>
  <type>jar</type>
  <version>3.0</version>
</dependency>

so [commons-httpclient] contains [org.apache.commons.httpclient.HttpClient]


*So things goes clear here.Every project who have [versions-maven-plugin]
2.7 as dependency will not start VFS normally.*

versions-maven-plugin is a plugin for auto upgrade version num in pom, and
is really useful to me.
I have no idea about why [versions-maven-plugin]'s author need do this.

besides.

  [versions-maven-plugin]'s plugin.xml contains some things like jackrabbit.
and yeah there be 3 jackrabbit libs.
I have no idea whether they invoke each other or what.
I just hope this can be a little useful for you.

    <dependency>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-webdav-jackrabbit</artifactId>
      <type>jar</type>
      <version>1.0-beta-6</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-webdav</artifactId>
      <type>jar</type>
      <version>1.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-jcr-commons</artifactId>
      <type>jar</type>
      <version>1.5.0</version>
    </dependency>

besides.

I really think split one java package into several maven project be
dangerous.



Woonsan Ko <wo...@apache.org> 于2020年1月24日周五 上午1:03写道:

> On Sun, Jan 19, 2020 at 11:41 AM Xeno Amess <xe...@gmail.com> wrote:
> >
> > yep that make sense.
> > but I'd rather add a class-check for provider class.
> > there already be a mechanism for making sure if all classes needed for
> > this provider class exist -> if not then just do not add the provider.
> > I will add a similar mechanism for making sure if the provider class
> > itself exist -> if not then just do not add the provider.
> > pull request here.
> > https://github.com/apache/commons-vfs/pull/78
>
> I thought the nested if-available elements [1] would do necessary
> checks before attempting to create the provider. In my understanding,
> if the required class doesn't exist, then the provider won't be
> created.
> So, in your case, do you have both org.apache.http.client.HttpClient
> and org.apache.jackrabbit.webdav.client.methods.BaseDavRequest, but
> not have commons-vfs2-jackrabbit1-2.5.0? Is it why you met the
> problem?
>
> Regards,
>
> Woonsan
>
> [1]
> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.5.0/commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml#L107-L108
>
> >
> > Rob Spoor <ap...@icemanx.nl> 于2020年1月20日周一 上午12:13写道:
> > >
> > > It seems that when the webdav support was moved to a separate artifact,
> > > the developers forgot to update file
> > >
> commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml.
> > > This file is used by StandardFileSystemManager to load the default
> > > providers.
> > >
> > > I think this warrants a fix, to move the webdav provider from this
> > > default providers.xml file to file
> > > commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml,
> > > and create the same file with the correct providers for the
> > > commons-vfs2-jackrabbit2 module.
> > >
> > >
> > > On 19/01/2020 16:57, Xeno Amess wrote:
> > > > OK I get where is bugged.
> > > > I will fix it and add a test for that never happen again.
> > > >
> > > > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
> > > >>
> > > >> The key point is even if I do not wanna use it I must have this
> > > >> class,or VFS.getManager() can never run.
> > > >>
> > > >> IMO this type of class relationship cause the project where hold
> this
> > > >> class must be added into vfs's pom as a dependency, or just move
> class
> > > >> VFS into that project aswell.
> > > >>
> > > >> Otherwise we should not let the VFS.getManager() rely on this class.
> > > >>
> > > >> Thanks for finding this class though.
> > > >>
> > > >> btw I tested 2.4, 2.4 is correct.
> > > >>
> > > >> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> > > >>>
> > > >>> The class was there in release 2.4.1:
> > > >>>
> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
> .
> > > >>> In the next release, 2.5.0, it can indeed no longer be found. A
> bit of
> > > >>> investigating showed that the webdav classes got moved to a new
> > > >>> artifact:
> > > >>>
> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> > > >>>
> > > >>> That means you can still use it, you just need to include an extra
> > > >>> dependency:
> > > >>>
> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> > > >>>
> > > >>> There's apparently also a Jackrabbit 2 version available:
> > > >>>
> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> > > >>>
> > > >>>
> > > >>> On 19/01/2020 11:24, Xeno Amess wrote:
> > > >>>> Right now I'm using something like
> > > >>>> this to deal with relative files.
> > > >>>> But I just think there might be a more elegant way...
> > > >>>>
> > > >>>> fileSystemManager = new
> > > >>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > > >>>> fileSystemManager.setLogger(null);
> > > >>>> try {
> > > >>>>       fileSystemManager.init();
> > > >>>>       fileSystemManager.setBaseFile(new File(""));
> > > >>>> } catch (FileSystemException e) {
> > > >>>>       e.printStackTrace();
> > > >>>> }
> > > >>>>
> > > >>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> > > >>>>>
> > > >>>>> I'm trying to migrate to commons-vfs2 now
> > > >>>>> severial things I found not quite right / amazing.
> > > >>>>>
> > > >>>>> 1.
> > > >>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
> > > >>>>> VSF.getManager() (of cause I have no additional contfigure or
> > > >>>>> something)
> > > >>>>>
> > > >>>>> It said class not
> > > >>>>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> > > >>>>>
> > > >>>>> And I looked into your binary jars I get from maven central
> (2.6.0).
> > > >>>>>
> > > >>>>> they really do not have that class WebdavFileProvider.
> > > >>>>> (even not found that package
> org.apache.commons.vfs2.provider.webdav)
> > > >>>>>
> > > >>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0
> but
> > > >>>>> that is not important)
> > > >>>>> It can run now.(and never tell me class not found again)
> > > >>>>> I dont't want to try 2.4.0. Really bad connection here(I'm in a
> villige now).
> > > >>>>> All I get is:
> > > >>>>> 2.6.0, broken.
> > > >>>>> 2.5.0, broken.
> > > >>>>> 2.3, fine.
> > > >>>>>
> > > >>>>> According to the file on github, it said it might be deprecated,
> so I
> > > >>>>> wonder if you already deprecate d it and you just forgotten it?
> > > >>>>>
> > > >>>>>    btw, according to your webpage
> https://commons.apache.org/proper/commons-vfs/
> > > >>>>> there even do not exist 2.6.0
> > > >>>>> But there be a 2.6.0 in maven central.
> > > >>>>> really make me confused.
> > > >>>>>
> > > >>>>> 2.
> > > >>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to
> 1.7.30
> > > >>>>> We all know slf4j's author really do not care about backward
> > > >>>>> maintenance or something.
> > > >>>>> His codes are never able to migrate.
> > > >>>>> even though, will there be some plan about using reflect or
> something
> > > >>>>> to make vfs2 CAN suit slf4j 2.0?
> > > >>>>>
> > > >>>>> 3.
> > > >>>>> for some reason I need to deal with relative file path.
> > > >>>>> Is there any guide about using relative file path in vfs2?
> > > >>>>
> > > >>>>
> ---------------------------------------------------------------------
> > > >>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > >>>> For additional commands, e-mail: dev-help@commons.apache.org
> > > >>>
> > > >>>
> ---------------------------------------------------------------------
> > > >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > >>> For additional commands, e-mail: dev-help@commons.apache.org
> > > >>>
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > > For additional commands, e-mail: dev-help@commons.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Woonsan Ko <wo...@apache.org>.
On Sun, Jan 19, 2020 at 11:41 AM Xeno Amess <xe...@gmail.com> wrote:
>
> yep that make sense.
> but I'd rather add a class-check for provider class.
> there already be a mechanism for making sure if all classes needed for
> this provider class exist -> if not then just do not add the provider.
> I will add a similar mechanism for making sure if the provider class
> itself exist -> if not then just do not add the provider.
> pull request here.
> https://github.com/apache/commons-vfs/pull/78

I thought the nested if-available elements [1] would do necessary
checks before attempting to create the provider. In my understanding,
if the required class doesn't exist, then the provider won't be
created.
So, in your case, do you have both org.apache.http.client.HttpClient
and org.apache.jackrabbit.webdav.client.methods.BaseDavRequest, but
not have commons-vfs2-jackrabbit1-2.5.0? Is it why you met the
problem?

Regards,

Woonsan

[1] https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.5.0/commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml#L107-L108

>
> Rob Spoor <ap...@icemanx.nl> 于2020年1月20日周一 上午12:13写道:
> >
> > It seems that when the webdav support was moved to a separate artifact,
> > the developers forgot to update file
> > commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml.
> > This file is used by StandardFileSystemManager to load the default
> > providers.
> >
> > I think this warrants a fix, to move the webdav provider from this
> > default providers.xml file to file
> > commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml,
> > and create the same file with the correct providers for the
> > commons-vfs2-jackrabbit2 module.
> >
> >
> > On 19/01/2020 16:57, Xeno Amess wrote:
> > > OK I get where is bugged.
> > > I will fix it and add a test for that never happen again.
> > >
> > > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
> > >>
> > >> The key point is even if I do not wanna use it I must have this
> > >> class,or VFS.getManager() can never run.
> > >>
> > >> IMO this type of class relationship cause the project where hold this
> > >> class must be added into vfs's pom as a dependency, or just move class
> > >> VFS into that project aswell.
> > >>
> > >> Otherwise we should not let the VFS.getManager() rely on this class.
> > >>
> > >> Thanks for finding this class though.
> > >>
> > >> btw I tested 2.4, 2.4 is correct.
> > >>
> > >> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> > >>>
> > >>> The class was there in release 2.4.1:
> > >>> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java.
> > >>> In the next release, 2.5.0, it can indeed no longer be found. A bit of
> > >>> investigating showed that the webdav classes got moved to a new
> > >>> artifact:
> > >>> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> > >>>
> > >>> That means you can still use it, you just need to include an extra
> > >>> dependency:
> > >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> > >>>
> > >>> There's apparently also a Jackrabbit 2 version available:
> > >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> > >>>
> > >>>
> > >>> On 19/01/2020 11:24, Xeno Amess wrote:
> > >>>> Right now I'm using something like
> > >>>> this to deal with relative files.
> > >>>> But I just think there might be a more elegant way...
> > >>>>
> > >>>> fileSystemManager = new
> > >>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > >>>> fileSystemManager.setLogger(null);
> > >>>> try {
> > >>>>       fileSystemManager.init();
> > >>>>       fileSystemManager.setBaseFile(new File(""));
> > >>>> } catch (FileSystemException e) {
> > >>>>       e.printStackTrace();
> > >>>> }
> > >>>>
> > >>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> > >>>>>
> > >>>>> I'm trying to migrate to commons-vfs2 now
> > >>>>> severial things I found not quite right / amazing.
> > >>>>>
> > >>>>> 1.
> > >>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
> > >>>>> VSF.getManager() (of cause I have no additional contfigure or
> > >>>>> something)
> > >>>>>
> > >>>>> It said class not
> > >>>>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> > >>>>>
> > >>>>> And I looked into your binary jars I get from maven central (2.6.0).
> > >>>>>
> > >>>>> they really do not have that class WebdavFileProvider.
> > >>>>> (even not found that package org.apache.commons.vfs2.provider.webdav)
> > >>>>>
> > >>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
> > >>>>> that is not important)
> > >>>>> It can run now.(and never tell me class not found again)
> > >>>>> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
> > >>>>> All I get is:
> > >>>>> 2.6.0, broken.
> > >>>>> 2.5.0, broken.
> > >>>>> 2.3, fine.
> > >>>>>
> > >>>>> According to the file on github, it said it might be deprecated, so I
> > >>>>> wonder if you already deprecate d it and you just forgotten it?
> > >>>>>
> > >>>>>    btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
> > >>>>> there even do not exist 2.6.0
> > >>>>> But there be a 2.6.0 in maven central.
> > >>>>> really make me confused.
> > >>>>>
> > >>>>> 2.
> > >>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
> > >>>>> We all know slf4j's author really do not care about backward
> > >>>>> maintenance or something.
> > >>>>> His codes are never able to migrate.
> > >>>>> even though, will there be some plan about using reflect or something
> > >>>>> to make vfs2 CAN suit slf4j 2.0?
> > >>>>>
> > >>>>> 3.
> > >>>>> for some reason I need to deal with relative file path.
> > >>>>> Is there any guide about using relative file path in vfs2?
> > >>>>
> > >>>> ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > >>>> For additional commands, e-mail: dev-help@commons.apache.org
> > >>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > >>> For additional commands, e-mail: dev-help@commons.apache.org
> > >>>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Xeno Amess <xe...@gmail.com>.
also suggest adding come comments for toURL to aware users of this problem.

Xeno Amess <xe...@gmail.com> 于 2020年1月24日周五 下午5:51写道:

> File(FileObject.getName().getPathDecoded())
>
> yep I use this now.
> it works correctly(at least in my usecase)
>
> Bernd Eckenfels <ec...@zusammenkunft.net> 于 2020年1月24日周五 下午5:02写道:
>
>> Hello,
>>
>> I think FileObject#getURL() suffers from the same(similar) encoding
>> problems as File#toURL did. It proofed to be hard to change file, so we
>> should I guess not do it for FileObject:
>>
>> https://bugs.java.com/bugdatabase/view_bug.do?bug_id=61794
>>
>> One option would be to add a FileObject#getURI()?
>>
>> Having said that, I would still use new
>> File(FileObject.getName().getPathDecoded()) instead.
>>
>> Gruss
>> Bernd
>>
>>
>> --
>> http://bernd.eckenfels.net
>> ________________________________
>> Von: Xeno Amess <xe...@gmail.com>
>> Gesendet: Thursday, January 23, 2020 11:45:21 PM
>> An: Commons Developers List <de...@commons.apache.org>
>> Betreff: Re: Getting File of FileObject (was: some questions (/bug?)
>> about commons-vfs2 make me confused.)
>>
>> class org.apache.commons.httpclient.HttpClient
>> interface org.apache.jackrabbit.webdav.client.methods.DavMethod
>> log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
>> log4j: Level token is [DEBUG].
>> log4j: Category root set to DEBUG
>> log4j: Parsing appender named "DEBUG_LOG".
>> log4j: Parsing layout options for "DEBUG_LOG".
>> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>> [
>> %t:%r ] - [ %p ]  %m%n].
>> log4j: End of parsing for "DEBUG_LOG".
>> log4j: Setting property [threshold] to [DEBUG].
>> log4j: Setting property [file] to [logs/logs.log].
>> log4j: Setting property [append] to [true].
>> log4j: setFile called: logs/logs.log, true
>> log4j: setFile ended
>> log4j: Appender [DEBUG_LOG] to be rolled at midnight.
>> log4j: Parsed "DEBUG_LOG" options.
>> log4j: Parsing appender named "ERROR_LOG".
>> log4j: Parsing layout options for "ERROR_LOG".
>> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>> [
>> %t:%r ] - [ %p ]  %m%n].
>> log4j: End of parsing for "ERROR_LOG".
>> log4j: Setting property [file] to [logs/error.log].
>> log4j: Setting property [threshold] to [ERROR].
>> log4j: Setting property [append] to [true].
>> log4j: setFile called: logs/error.log, true
>> log4j: setFile ended
>> log4j: Appender [ERROR_LOG] to be rolled at midnight.
>> log4j: Parsed "ERROR_LOG" options.
>> log4j: Finished configuring.
>> File : file:/D:/1%201.txt
>> FileObject : file:///D:/1 1.txt
>> D:\1 1.txt
>> java.net.URISyntaxException: Illegal character in path at index 12:
>> file:///D:/1 1.txt
>> at java.base/java.net.URI$Parser.fail(URI.java:2936)
>> at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
>> at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
>> at java.base/java.net.URI$Parser.parse(URI.java:3137)
>> at java.base/java.net.URI.<init>(URI.java:623)
>> at java.base/java.net.URL.toURI(URL.java:1048)
>> at FileManagerTest.test(FileManagerTest.java:66)
>> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>> at
>>
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> at
>>
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.base/java.lang.reflect.Method.invoke(Method.java:567)
>> at
>>
>> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
>> at
>>
>> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
>> at
>>
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
>> at
>>
>> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
>> at
>>
>> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
>> at
>>
>> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
>> at
>>
>> org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
>> at
>>
>> org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
>> at
>>
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
>> at
>>
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
>> at
>>
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
>> at
>>
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
>> at
>>
>> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
>> at
>>
>> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
>> at
>>
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> at
>>
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
>> at
>>
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
>> at
>>
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
>> at
>> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
>> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
>> at
>> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
>> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
>> at
>> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
>> at
>>
>> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
>> at
>>
>> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
>> at
>>
>> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
>> at
>>
>> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
>> at
>>
>> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
>> at
>>
>> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
>> at
>>
>> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
>> at
>>
>> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
>> at
>>
>> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
>> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
>>
>>
>> Process finished with exit code 0
>>
>> (I forgot to refresh the console. sorry.)
>> (Although I guess you can get what I mean)
>>
>> Xeno Amess <xe...@gmail.com> 于2020年1月24日周五 上午6:26写道:
>>
>> > OK>
>> > 1. I use win10, jdk 13 here.
>> > 2. make a file [D:/1 1.txt] , there is a character space between the two
>> > character '1'.
>> > 3. run a code like this.
>> >
>> > /*
>> >  * MIT License
>> >  *
>> >  * Copyright (c) 2020 XenoAmess
>> >  *
>> >  * Permission is hereby granted, free of charge, to any person
>> obtaining a copy
>> >  * of this software and associated documentation files (the
>> "Software"), to deal
>> >  * in the Software without restriction, including without limitation
>> the rights
>> >  * to use, copy, modify, merge, publish, distribute, sublicense, and/or
>> sell
>> >  * copies of the Software, and to permit persons to whom the Software is
>> >  * furnished to do so, subject to the following conditions:
>> >  *
>> >  * The above copyright notice and this permission notice shall be
>> included in all
>> >  * copies or substantial portions of the Software.
>> >  *
>> >  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> >  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> >  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
>> SHALL THE
>> >  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>> OTHER
>> >  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
>> ARISING FROM,
>> >  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> DEALINGS IN THE
>> >  * SOFTWARE.
>> >  */
>> >
>> > import com.xenoamess.cyan_potion.base.memory.ResourceManager;
>> > import org.apache.commons.vfs2.FileSystemException;
>> > import org.apache.commons.vfs2.FileSystemManager;
>> > import org.junit.jupiter.api.Test;
>> >
>> > import java.io.File;
>> > import java.net.MalformedURLException;
>> > import java.net.URISyntaxException;
>> > import java.net.URL;
>> >
>> > public class FileManagerTest {
>> >     @Test
>> >     public void test() {
>> >
>>  System.out.println(org.apache.commons.httpclient.HttpClient.class);
>> >
>>  System.out.println(org.apache.jackrabbit.webdav.client.methods.DavMethod.class);
>> >         FileSystemManager fileSystemManager =
>> ResourceManager.getFileSystemManager();
>> >
>> >         URL url2 = null;
>> >         URL url1 = null;
>> >
>> >         try {
>> >             url2 = new File("D:/1 1.txt").toURI().toURL();
>> >             System.out.println("File : " + url2);
>> >         } catch (MalformedURLException e) {
>> >             e.printStackTrace();
>> >         }
>> >
>> >         try {
>> >             url1 = fileSystemManager.resolveFile("D:/1 1.txt").getURL();
>> >             System.out.println("FileObject : " + url1);
>> >         } catch (FileSystemException e) {
>> >             e.printStackTrace();
>> >         }
>> >
>> >         try {
>> >             System.out.println(new File(url2.toURI()));
>> >         } catch (URISyntaxException e) {
>> >             e.printStackTrace();
>> >         }
>> >
>> >         try {
>> >             System.out.println(new File(url1.toURI()));
>> >         } catch (URISyntaxException e) {
>> >             e.printStackTrace();
>> >         }
>> >
>> >
>> >     }
>> > }
>> >
>> >   ResourceManager.getFileSystemManager();  is a smally changed
>> > VFS.getManager (I use a different slf4j version in my project so I have
>> to
>> > make the Logger be null before init())
>> >  the result be:
>> >
>> > class org.apache.commons.httpclient.HttpClient
>> > interface org.apache.jackrabbit.webdav.client.methods.DavMethod
>> > log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
>> > log4j: Level token is [DEBUG].
>> > log4j: Category root set to DEBUG
>> > log4j: Parsing appender named "DEBUG_LOG".
>> > log4j: Parsing layout options for "DEBUG_LOG".
>> > log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>> >  [ %t:%r ] - [ %p ]  %m%n].
>> > log4j: End of parsing for "DEBUG_LOG".
>> > log4j: Setting property [threshold] to [DEBUG].
>> > log4j: Setting property [file] to [logs/logs.log].
>> > log4j: Setting property [append] to [true].
>> > log4j: setFile called: logs/logs.log, true
>> > log4j: setFile ended
>> > log4j: Appender [DEBUG_LOG] to be rolled at midnight.
>> > log4j: Parsed "DEBUG_LOG" options.
>> > log4j: Parsing appender named "ERROR_LOG".
>> > log4j: Parsing layout options for "ERROR_LOG".
>> > log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>> >  [ %t:%r ] - [ %p ]  %m%n].
>> > log4j: End of parsing for "ERROR_LOG".
>> > log4j: Setting property [file] to [logs/error.log].
>> > log4j: Setting property [threshold] to [ERROR].
>> > log4j: Setting property [append] to [true].
>> > log4j: setFile called: logs/error.log, true
>> > log4j: setFile ended
>> > log4j: Appender [ERROR_LOG] to be rolled at midnight.
>> > log4j: Parsed "ERROR_LOG" options.
>> > log4j: Finished configuring.
>> > FileObject : file:///D:/1 1.txt
>> > File : file:/D:/1%201.txt
>> > java.net.URISyntaxException: Illegal character in path at index 12:
>> > file:///D:/1 1.txt
>> > at java.base/java.net.URI$Parser.fail(URI.java:2936)
>> > at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
>> > at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
>> > at java.base/java.net.URI$Parser.parse(URI.java:3137)
>> > at java.base/java.net.URI.<init>(URI.java:623)
>> > at java.base/java.net.URL.toURI(URL.java:1048)
>> > at FileManagerTest.test(FileManagerTest.java:59)
>> > at
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
>> > Method)
>> > at
>> >
>> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> > at
>> >
>> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> > at java.base/java.lang.reflect.Method.invoke(Method.java:567)
>> > at
>> >
>> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
>> > at
>> >
>> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
>> > at
>> >
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
>> > at
>> >
>> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
>> > at
>> >
>> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
>> > at
>> >
>> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
>> > at
>> >
>> org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
>> > at
>> >
>> org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
>> > at
>> >
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
>> > at
>> >
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
>> > at
>> >
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
>> > at
>> >
>> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
>> > at
>> >
>> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
>> > at
>> >
>> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
>> > at
>> >
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> > at
>> >
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
>> > at
>> >
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
>> > at
>> >
>> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
>> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
>> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
>> > at
>> >
>> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
>> > at
>> >
>> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
>> > at
>> >
>> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
>> > at
>> >
>> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
>> > at
>> >
>> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
>> > at
>> >
>> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
>> > at
>> >
>> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
>> > at
>> >
>> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
>> > at
>> >
>> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
>> > at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
>> >
>> >
>> > Process finished with exit code 0
>> >
>> > We can skip the log4j part, then you can see, the url parser in javaio
>> > cannot deal with " ", and " " must be transcoded to "%20", and if not
>> do so
>> > in URL, then url.toURI() will fail.
>> >
>> >
>> >
>> > Bernd Eckenfels <ec...@zusammenkunft.net> 于2020年1月24日周五 上午4:21写道:
>> >
>> >> Hello,
>> >>
>> >> I am not sure I understand what the actual difference is, but you are
>> >> right, the URL should actually be useable. However there are a lot of
>> >> inconsistencies and backward compatibilities to look out for (even File
>> >> itself has different URL/URI methods and never defined how Windows
>> drives
>> >> are to be handled). So can you give us an example path and what it
>> looks
>> >> like in URL from VFS and from java.io, so we can check if there is
>> >> something to tweak.
>> >>
>> >> Gruss
>> >> Bernd
>> >> --
>> >> http://bernd.eckenfels.net
>> >> ________________________________
>> >> Von: Xeno Amess <xe...@gmail.com>
>> >> Gesendet: Thursday, January 23, 2020 2:40:59 PM
>> >> An: Commons Developers List <de...@commons.apache.org>
>> >> Betreff: Re: Getting File of FileObject (was: some questions (/bug?)
>> >> about commons-vfs2 make me confused.)
>> >>
>> >> I put it in dev-list because I really donot know wether it be a bug or
>> >> not.
>> >> If it be a but then I'm actually willing for help.
>> >> But it seems by design but not a bug here, so I apologize.
>> >> Still, some questions hold.
>> >>
>> >> /**
>> >>  * Returns a URL representing this file.
>> >>  *
>> >>  * @return the URL for the file.
>> >>  * @throws FileSystemException if an error occurs.
>> >>  */
>> >> URL getURL() throws FileSystemException;
>> >> that is the comments on getURL()
>> >> And IMO that is quite confusing actually.
>> >> You see if we use the same URL class and return it in such a public
>> >> method, it be normally to think it fit Java's standard, and can use
>> >> .URI if the protocol should be able to.
>> >> But the truth is the standard we used in vfs is sometimes different
>> than
>> >> Java.
>> >> The word [Sometimes] here is very dangerous and might be a bug causer,
>> >> because it can pass most tests and make users feel "Oh, it just return
>> >> a normal URL, and it really works right."
>> >> So IMO at least we shall add some more warning about "not using this
>> >> returned URL's some functions,including to URL, they might be
>> >> dangerous" or "we use different standard about file:// than Java's
>> >> file://"
>> >>
>> >> Besides, I wonder why we must use a same URL class in vfs, if we
>> >> cannot guarantee it works consistently to Java lib?
>> >> Is it a better thought to create a new VFSURL class for URL in vfs?
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> >> For additional commands, e-mail: dev-help@commons.apache.org
>> >>
>> >>
>>
>

Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Xeno Amess <xe...@gmail.com>.
File(FileObject.getName().getPathDecoded())

yep I use this now.
it works correctly(at least in my usecase)

Bernd Eckenfels <ec...@zusammenkunft.net> 于 2020年1月24日周五 下午5:02写道:

> Hello,
>
> I think FileObject#getURL() suffers from the same(similar) encoding
> problems as File#toURL did. It proofed to be hard to change file, so we
> should I guess not do it for FileObject:
>
> https://bugs.java.com/bugdatabase/view_bug.do?bug_id=61794
>
> One option would be to add a FileObject#getURI()?
>
> Having said that, I would still use new
> File(FileObject.getName().getPathDecoded()) instead.
>
> Gruss
> Bernd
>
>
> --
> http://bernd.eckenfels.net
> ________________________________
> Von: Xeno Amess <xe...@gmail.com>
> Gesendet: Thursday, January 23, 2020 11:45:21 PM
> An: Commons Developers List <de...@commons.apache.org>
> Betreff: Re: Getting File of FileObject (was: some questions (/bug?) about
> commons-vfs2 make me confused.)
>
> class org.apache.commons.httpclient.HttpClient
> interface org.apache.jackrabbit.webdav.client.methods.DavMethod
> log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
> log4j: Level token is [DEBUG].
> log4j: Category root set to DEBUG
> log4j: Parsing appender named "DEBUG_LOG".
> log4j: Parsing layout options for "DEBUG_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
> %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "DEBUG_LOG".
> log4j: Setting property [threshold] to [DEBUG].
> log4j: Setting property [file] to [logs/logs.log].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/logs.log, true
> log4j: setFile ended
> log4j: Appender [DEBUG_LOG] to be rolled at midnight.
> log4j: Parsed "DEBUG_LOG" options.
> log4j: Parsing appender named "ERROR_LOG".
> log4j: Parsing layout options for "ERROR_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
> %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "ERROR_LOG".
> log4j: Setting property [file] to [logs/error.log].
> log4j: Setting property [threshold] to [ERROR].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/error.log, true
> log4j: setFile ended
> log4j: Appender [ERROR_LOG] to be rolled at midnight.
> log4j: Parsed "ERROR_LOG" options.
> log4j: Finished configuring.
> File : file:/D:/1%201.txt
> FileObject : file:///D:/1 1.txt
> D:\1 1.txt
> java.net.URISyntaxException: Illegal character in path at index 12:
> file:///D:/1 1.txt
> at java.base/java.net.URI$Parser.fail(URI.java:2936)
> at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
> at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
> at java.base/java.net.URI$Parser.parse(URI.java:3137)
> at java.base/java.net.URI.<init>(URI.java:623)
> at java.base/java.net.URL.toURI(URL.java:1048)
> at FileManagerTest.test(FileManagerTest.java:66)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
>
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
>
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:567)
> at
>
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
> at
>
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> at
>
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
> at
>
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
> at
>
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
> at
>
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
> at
>
> org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> at
>
> org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> at
>
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
> at
>
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
> at
>
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
> at
>
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
> at
>
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> at
>
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> at
>
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
> at
>
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
>
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
> at
>
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
> at
>
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
> at
>
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
>
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
>
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
>
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
>
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
>
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
>
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
>
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
>
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at
>
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
> at
>
> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> at
>
> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
> at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
> at
>
> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
> at
>
> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
> at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
> at
>
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
> at
>
> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
> at
>
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> at
>
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
>
>
> Process finished with exit code 0
>
> (I forgot to refresh the console. sorry.)
> (Although I guess you can get what I mean)
>
> Xeno Amess <xe...@gmail.com> 于2020年1月24日周五 上午6:26写道:
>
> > OK>
> > 1. I use win10, jdk 13 here.
> > 2. make a file [D:/1 1.txt] , there is a character space between the two
> > character '1'.
> > 3. run a code like this.
> >
> > /*
> >  * MIT License
> >  *
> >  * Copyright (c) 2020 XenoAmess
> >  *
> >  * Permission is hereby granted, free of charge, to any person obtaining
> a copy
> >  * of this software and associated documentation files (the "Software"),
> to deal
> >  * in the Software without restriction, including without limitation the
> rights
> >  * to use, copy, modify, merge, publish, distribute, sublicense, and/or
> sell
> >  * copies of the Software, and to permit persons to whom the Software is
> >  * furnished to do so, subject to the following conditions:
> >  *
> >  * The above copyright notice and this permission notice shall be
> included in all
> >  * copies or substantial portions of the Software.
> >  *
> >  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> >  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> >  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> SHALL THE
> >  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> >  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING FROM,
> >  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS IN THE
> >  * SOFTWARE.
> >  */
> >
> > import com.xenoamess.cyan_potion.base.memory.ResourceManager;
> > import org.apache.commons.vfs2.FileSystemException;
> > import org.apache.commons.vfs2.FileSystemManager;
> > import org.junit.jupiter.api.Test;
> >
> > import java.io.File;
> > import java.net.MalformedURLException;
> > import java.net.URISyntaxException;
> > import java.net.URL;
> >
> > public class FileManagerTest {
> >     @Test
> >     public void test() {
> >
>  System.out.println(org.apache.commons.httpclient.HttpClient.class);
> >
>  System.out.println(org.apache.jackrabbit.webdav.client.methods.DavMethod.class);
> >         FileSystemManager fileSystemManager =
> ResourceManager.getFileSystemManager();
> >
> >         URL url2 = null;
> >         URL url1 = null;
> >
> >         try {
> >             url2 = new File("D:/1 1.txt").toURI().toURL();
> >             System.out.println("File : " + url2);
> >         } catch (MalformedURLException e) {
> >             e.printStackTrace();
> >         }
> >
> >         try {
> >             url1 = fileSystemManager.resolveFile("D:/1 1.txt").getURL();
> >             System.out.println("FileObject : " + url1);
> >         } catch (FileSystemException e) {
> >             e.printStackTrace();
> >         }
> >
> >         try {
> >             System.out.println(new File(url2.toURI()));
> >         } catch (URISyntaxException e) {
> >             e.printStackTrace();
> >         }
> >
> >         try {
> >             System.out.println(new File(url1.toURI()));
> >         } catch (URISyntaxException e) {
> >             e.printStackTrace();
> >         }
> >
> >
> >     }
> > }
> >
> >   ResourceManager.getFileSystemManager();  is a smally changed
> > VFS.getManager (I use a different slf4j version in my project so I have
> to
> > make the Logger be null before init())
> >  the result be:
> >
> > class org.apache.commons.httpclient.HttpClient
> > interface org.apache.jackrabbit.webdav.client.methods.DavMethod
> > log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
> > log4j: Level token is [DEBUG].
> > log4j: Category root set to DEBUG
> > log4j: Parsing appender named "DEBUG_LOG".
> > log4j: Parsing layout options for "DEBUG_LOG".
> > log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
> >  [ %t:%r ] - [ %p ]  %m%n].
> > log4j: End of parsing for "DEBUG_LOG".
> > log4j: Setting property [threshold] to [DEBUG].
> > log4j: Setting property [file] to [logs/logs.log].
> > log4j: Setting property [append] to [true].
> > log4j: setFile called: logs/logs.log, true
> > log4j: setFile ended
> > log4j: Appender [DEBUG_LOG] to be rolled at midnight.
> > log4j: Parsed "DEBUG_LOG" options.
> > log4j: Parsing appender named "ERROR_LOG".
> > log4j: Parsing layout options for "ERROR_LOG".
> > log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
> >  [ %t:%r ] - [ %p ]  %m%n].
> > log4j: End of parsing for "ERROR_LOG".
> > log4j: Setting property [file] to [logs/error.log].
> > log4j: Setting property [threshold] to [ERROR].
> > log4j: Setting property [append] to [true].
> > log4j: setFile called: logs/error.log, true
> > log4j: setFile ended
> > log4j: Appender [ERROR_LOG] to be rolled at midnight.
> > log4j: Parsed "ERROR_LOG" options.
> > log4j: Finished configuring.
> > FileObject : file:///D:/1 1.txt
> > File : file:/D:/1%201.txt
> > java.net.URISyntaxException: Illegal character in path at index 12:
> > file:///D:/1 1.txt
> > at java.base/java.net.URI$Parser.fail(URI.java:2936)
> > at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
> > at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
> > at java.base/java.net.URI$Parser.parse(URI.java:3137)
> > at java.base/java.net.URI.<init>(URI.java:623)
> > at java.base/java.net.URL.toURI(URL.java:1048)
> > at FileManagerTest.test(FileManagerTest.java:59)
> > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at
> >
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > at
> >
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:567)
> > at
> >
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
> > at
> >
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> > at
> >
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
> > at
> >
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
> > at
> >
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
> > at
> >
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
> > at
> >
> org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> > at
> >
> org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> > at
> >
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
> > at
> >
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
> > at
> >
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
> > at
> >
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
> > at
> >
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> > at
> >
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> > at
> >
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
> > at
> >
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at
> >
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
> > at
> >
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
> > at
> >
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
> > at
> >
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> > at
> > org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> > at
> >
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> > at
> >
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> > at
> >
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> > at
> > org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> > at
> >
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> > at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> > at
> >
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> > at
> >
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> > at
> > org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> > at
> >
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> > at
> >
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> > at
> >
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
> > at
> >
> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> > at
> >
> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
> > at
> >
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
> > at
> >
> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
> > at
> >
> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
> > at
> >
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
> > at
> >
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
> > at
> >
> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
> > at
> >
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> > at
> >
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> > at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
> >
> >
> > Process finished with exit code 0
> >
> > We can skip the log4j part, then you can see, the url parser in javaio
> > cannot deal with " ", and " " must be transcoded to "%20", and if not do
> so
> > in URL, then url.toURI() will fail.
> >
> >
> >
> > Bernd Eckenfels <ec...@zusammenkunft.net> 于2020年1月24日周五 上午4:21写道:
> >
> >> Hello,
> >>
> >> I am not sure I understand what the actual difference is, but you are
> >> right, the URL should actually be useable. However there are a lot of
> >> inconsistencies and backward compatibilities to look out for (even File
> >> itself has different URL/URI methods and never defined how Windows
> drives
> >> are to be handled). So can you give us an example path and what it looks
> >> like in URL from VFS and from java.io, so we can check if there is
> >> something to tweak.
> >>
> >> Gruss
> >> Bernd
> >> --
> >> http://bernd.eckenfels.net
> >> ________________________________
> >> Von: Xeno Amess <xe...@gmail.com>
> >> Gesendet: Thursday, January 23, 2020 2:40:59 PM
> >> An: Commons Developers List <de...@commons.apache.org>
> >> Betreff: Re: Getting File of FileObject (was: some questions (/bug?)
> >> about commons-vfs2 make me confused.)
> >>
> >> I put it in dev-list because I really donot know wether it be a bug or
> >> not.
> >> If it be a but then I'm actually willing for help.
> >> But it seems by design but not a bug here, so I apologize.
> >> Still, some questions hold.
> >>
> >> /**
> >>  * Returns a URL representing this file.
> >>  *
> >>  * @return the URL for the file.
> >>  * @throws FileSystemException if an error occurs.
> >>  */
> >> URL getURL() throws FileSystemException;
> >> that is the comments on getURL()
> >> And IMO that is quite confusing actually.
> >> You see if we use the same URL class and return it in such a public
> >> method, it be normally to think it fit Java's standard, and can use
> >> .URI if the protocol should be able to.
> >> But the truth is the standard we used in vfs is sometimes different than
> >> Java.
> >> The word [Sometimes] here is very dangerous and might be a bug causer,
> >> because it can pass most tests and make users feel "Oh, it just return
> >> a normal URL, and it really works right."
> >> So IMO at least we shall add some more warning about "not using this
> >> returned URL's some functions,including to URL, they might be
> >> dangerous" or "we use different standard about file:// than Java's
> >> file://"
> >>
> >> Besides, I wonder why we must use a same URL class in vfs, if we
> >> cannot guarantee it works consistently to Java lib?
> >> Is it a better thought to create a new VFSURL class for URL in vfs?
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: dev-help@commons.apache.org
> >>
> >>
>

Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

I think FileObject#getURL() suffers from the same(similar) encoding problems as File#toURL did. It proofed to be hard to change file, so we should I guess not do it for FileObject:

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=61794

One option would be to add a FileObject#getURI()?

Having said that, I would still use new File(FileObject.getName().getPathDecoded()) instead.

Gruss
Bernd


--
http://bernd.eckenfels.net
________________________________
Von: Xeno Amess <xe...@gmail.com>
Gesendet: Thursday, January 23, 2020 11:45:21 PM
An: Commons Developers List <de...@commons.apache.org>
Betreff: Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

class org.apache.commons.httpclient.HttpClient
interface org.apache.jackrabbit.webdav.client.methods.DavMethod
log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "DEBUG_LOG".
log4j: Parsing layout options for "DEBUG_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "DEBUG_LOG".
log4j: Setting property [threshold] to [DEBUG].
log4j: Setting property [file] to [logs/logs.log].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/logs.log, true
log4j: setFile ended
log4j: Appender [DEBUG_LOG] to be rolled at midnight.
log4j: Parsed "DEBUG_LOG" options.
log4j: Parsing appender named "ERROR_LOG".
log4j: Parsing layout options for "ERROR_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "ERROR_LOG".
log4j: Setting property [file] to [logs/error.log].
log4j: Setting property [threshold] to [ERROR].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/error.log, true
log4j: setFile ended
log4j: Appender [ERROR_LOG] to be rolled at midnight.
log4j: Parsed "ERROR_LOG" options.
log4j: Finished configuring.
File : file:/D:/1%201.txt
FileObject : file:///D:/1 1.txt
D:\1 1.txt
java.net.URISyntaxException: Illegal character in path at index 12:
file:///D:/1 1.txt
at java.base/java.net.URI$Parser.fail(URI.java:2936)
at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
at java.base/java.net.URI$Parser.parse(URI.java:3137)
at java.base/java.net.URI.<init>(URI.java:623)
at java.base/java.net.URL.toURI(URL.java:1048)
at FileManagerTest.test(FileManagerTest.java:66)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
at
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at
org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at
org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
at
org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
at
org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
at
com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)


Process finished with exit code 0

(I forgot to refresh the console. sorry.)
(Although I guess you can get what I mean)

Xeno Amess <xe...@gmail.com> 于2020年1月24日周五 上午6:26写道:

> OK>
> 1. I use win10, jdk 13 here.
> 2. make a file [D:/1 1.txt] , there is a character space between the two
> character '1'.
> 3. run a code like this.
>
> /*
>  * MIT License
>  *
>  * Copyright (c) 2020 XenoAmess
>  *
>  * Permission is hereby granted, free of charge, to any person obtaining a copy
>  * of this software and associated documentation files (the "Software"), to deal
>  * in the Software without restriction, including without limitation the rights
>  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>  * copies of the Software, and to permit persons to whom the Software is
>  * furnished to do so, subject to the following conditions:
>  *
>  * The above copyright notice and this permission notice shall be included in all
>  * copies or substantial portions of the Software.
>  *
>  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>  * SOFTWARE.
>  */
>
> import com.xenoamess.cyan_potion.base.memory.ResourceManager;
> import org.apache.commons.vfs2.FileSystemException;
> import org.apache.commons.vfs2.FileSystemManager;
> import org.junit.jupiter.api.Test;
>
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URISyntaxException;
> import java.net.URL;
>
> public class FileManagerTest {
>     @Test
>     public void test() {
>         System.out.println(org.apache.commons.httpclient.HttpClient.class);
>         System.out.println(org.apache.jackrabbit.webdav.client.methods.DavMethod.class);
>         FileSystemManager fileSystemManager = ResourceManager.getFileSystemManager();
>
>         URL url2 = null;
>         URL url1 = null;
>
>         try {
>             url2 = new File("D:/1 1.txt").toURI().toURL();
>             System.out.println("File : " + url2);
>         } catch (MalformedURLException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             url1 = fileSystemManager.resolveFile("D:/1 1.txt").getURL();
>             System.out.println("FileObject : " + url1);
>         } catch (FileSystemException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             System.out.println(new File(url2.toURI()));
>         } catch (URISyntaxException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             System.out.println(new File(url1.toURI()));
>         } catch (URISyntaxException e) {
>             e.printStackTrace();
>         }
>
>
>     }
> }
>
>   ResourceManager.getFileSystemManager();  is a smally changed
> VFS.getManager (I use a different slf4j version in my project so I have to
> make the Logger be null before init())
>  the result be:
>
> class org.apache.commons.httpclient.HttpClient
> interface org.apache.jackrabbit.webdav.client.methods.DavMethod
> log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
> log4j: Level token is [DEBUG].
> log4j: Category root set to DEBUG
> log4j: Parsing appender named "DEBUG_LOG".
> log4j: Parsing layout options for "DEBUG_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>  [ %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "DEBUG_LOG".
> log4j: Setting property [threshold] to [DEBUG].
> log4j: Setting property [file] to [logs/logs.log].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/logs.log, true
> log4j: setFile ended
> log4j: Appender [DEBUG_LOG] to be rolled at midnight.
> log4j: Parsed "DEBUG_LOG" options.
> log4j: Parsing appender named "ERROR_LOG".
> log4j: Parsing layout options for "ERROR_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>  [ %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "ERROR_LOG".
> log4j: Setting property [file] to [logs/error.log].
> log4j: Setting property [threshold] to [ERROR].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/error.log, true
> log4j: setFile ended
> log4j: Appender [ERROR_LOG] to be rolled at midnight.
> log4j: Parsed "ERROR_LOG" options.
> log4j: Finished configuring.
> FileObject : file:///D:/1 1.txt
> File : file:/D:/1%201.txt
> java.net.URISyntaxException: Illegal character in path at index 12:
> file:///D:/1 1.txt
> at java.base/java.net.URI$Parser.fail(URI.java:2936)
> at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
> at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
> at java.base/java.net.URI$Parser.parse(URI.java:3137)
> at java.base/java.net.URI.<init>(URI.java:623)
> at java.base/java.net.URL.toURI(URL.java:1048)
> at FileManagerTest.test(FileManagerTest.java:59)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:567)
> at
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
> at
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
> at
> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> at
> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
> at
> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
> at
> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
> at
> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
> at
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> at
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
>
>
> Process finished with exit code 0
>
> We can skip the log4j part, then you can see, the url parser in javaio
> cannot deal with " ", and " " must be transcoded to "%20", and if not do so
> in URL, then url.toURI() will fail.
>
>
>
> Bernd Eckenfels <ec...@zusammenkunft.net> 于2020年1月24日周五 上午4:21写道:
>
>> Hello,
>>
>> I am not sure I understand what the actual difference is, but you are
>> right, the URL should actually be useable. However there are a lot of
>> inconsistencies and backward compatibilities to look out for (even File
>> itself has different URL/URI methods and never defined how Windows drives
>> are to be handled). So can you give us an example path and what it looks
>> like in URL from VFS and from java.io, so we can check if there is
>> something to tweak.
>>
>> Gruss
>> Bernd
>> --
>> http://bernd.eckenfels.net
>> ________________________________
>> Von: Xeno Amess <xe...@gmail.com>
>> Gesendet: Thursday, January 23, 2020 2:40:59 PM
>> An: Commons Developers List <de...@commons.apache.org>
>> Betreff: Re: Getting File of FileObject (was: some questions (/bug?)
>> about commons-vfs2 make me confused.)
>>
>> I put it in dev-list because I really donot know wether it be a bug or
>> not.
>> If it be a but then I'm actually willing for help.
>> But it seems by design but not a bug here, so I apologize.
>> Still, some questions hold.
>>
>> /**
>>  * Returns a URL representing this file.
>>  *
>>  * @return the URL for the file.
>>  * @throws FileSystemException if an error occurs.
>>  */
>> URL getURL() throws FileSystemException;
>> that is the comments on getURL()
>> And IMO that is quite confusing actually.
>> You see if we use the same URL class and return it in such a public
>> method, it be normally to think it fit Java's standard, and can use
>> .URI if the protocol should be able to.
>> But the truth is the standard we used in vfs is sometimes different than
>> Java.
>> The word [Sometimes] here is very dangerous and might be a bug causer,
>> because it can pass most tests and make users feel "Oh, it just return
>> a normal URL, and it really works right."
>> So IMO at least we shall add some more warning about "not using this
>> returned URL's some functions,including to URL, they might be
>> dangerous" or "we use different standard about file:// than Java's
>> file://"
>>
>> Besides, I wonder why we must use a same URL class in vfs, if we
>> cannot guarantee it works consistently to Java lib?
>> Is it a better thought to create a new VFSURL class for URL in vfs?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>

Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

I think FileObject#getURL() suffers from the same(similar) encoding problems as File#toURL did. Especially it passes blank unescaped, (which does help in some situations but is incompatible with the URI Parser) - but it proofed to be hard to change.

 so we should I guess not do it for FileObject but follow File lead:
   https://bugs.java.com/bugdatabase/view_bug.do?bug_id=61794
and add a FileObject#getURI()?

Having said that, I would still use new File(FileObject.getName().getPathDecoded()) and avoid URI completely.

I will add a javadoc to getURL to make clear it does not encode all characters and provide a getURI Instead.

The toFile() method is requested here https://issues.apache.org/jira/browse/VFS-443

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
Von: Xeno Amess <xe...@gmail.com>
Gesendet: Thursday, January 23, 2020 11:45:21 PM
An: Commons Developers List <de...@commons.apache.org>
Betreff: Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

class org.apache.commons.httpclient.HttpClient
interface org.apache.jackrabbit.webdav.client.methods.DavMethod
log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "DEBUG_LOG".
log4j: Parsing layout options for "DEBUG_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "DEBUG_LOG".
log4j: Setting property [threshold] to [DEBUG].
log4j: Setting property [file] to [logs/logs.log].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/logs.log, true
log4j: setFile ended
log4j: Appender [DEBUG_LOG] to be rolled at midnight.
log4j: Parsed "DEBUG_LOG" options.
log4j: Parsing appender named "ERROR_LOG".
log4j: Parsing layout options for "ERROR_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "ERROR_LOG".
log4j: Setting property [file] to [logs/error.log].
log4j: Setting property [threshold] to [ERROR].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/error.log, true
log4j: setFile ended
log4j: Appender [ERROR_LOG] to be rolled at midnight.
log4j: Parsed "ERROR_LOG" options.
log4j: Finished configuring.
File : file:/D:/1%201.txt
FileObject : file:///D:/1 1.txt
D: 1.txt
java.net.URISyntaxException: Illegal character in path at index 12:
file:///D:/1 1.txt
at java.base/java.net.URI$Parser.fail(URI.java:2936)
at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
at java.base/java.net.URI$Parser.parse(URI.java:3137)
at java.base/java.net.URI.<init>(URI.java:623)
at java.base/java.net.URL.toURI(URL.java:1048)
at FileManagerTest.test(FileManagerTest.java:66)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
at
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at
org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at
org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
at
org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
at
org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
at
com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)


Process finished with exit code 0

(I forgot to refresh the console. sorry.)
(Although I guess you can get what I mean)

Xeno Amess <xe...@gmail.com> 于2020年1月24日周五 上午6:26写道:

> OK>
> 1. I use win10, jdk 13 here.
> 2. make a file [D:/1 1.txt] , there is a character space between the two
> character '1'.
> 3. run a code like this.
>
> /*
>  * MIT License
>  *
>  * Copyright (c) 2020 XenoAmess
>  *
>  * Permission is hereby granted, free of charge, to any person obtaining a copy
>  * of this software and associated documentation files (the "Software"), to deal
>  * in the Software without restriction, including without limitation the rights
>  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>  * copies of the Software, and to permit persons to whom the Software is
>  * furnished to do so, subject to the following conditions:
>  *
>  * The above copyright notice and this permission notice shall be included in all
>  * copies or substantial portions of the Software.
>  *
>  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>  * SOFTWARE.
>  */
>
> import com.xenoamess.cyan_potion.base.memory.ResourceManager;
> import org.apache.commons.vfs2.FileSystemException;
> import org.apache.commons.vfs2.FileSystemManager;
> import org.junit.jupiter.api.Test;
>
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URISyntaxException;
> import java.net.URL;
>
> public class FileManagerTest {
>     @Test
>     public void test() {
>         System.out.println(org.apache.commons.httpclient.HttpClient.class);
>         System.out.println(org.apache.jackrabbit.webdav.client.methods.DavMethod.class);
>         FileSystemManager fileSystemManager = ResourceManager.getFileSystemManager();
>
>         URL url2 = null;
>         URL url1 = null;
>
>         try {
>             url2 = new File("D:/1 1.txt").toURI().toURL();
>             System.out.println("File : " + url2);
>         } catch (MalformedURLException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             url1 = fileSystemManager.resolveFile("D:/1 1.txt").getURL();
>             System.out.println("FileObject : " + url1);
>         } catch (FileSystemException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             System.out.println(new File(url2.toURI()));
>         } catch (URISyntaxException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             System.out.println(new File(url1.toURI()));
>         } catch (URISyntaxException e) {
>             e.printStackTrace();
>         }
>
>
>     }
> }
>
>   ResourceManager.getFileSystemManager();  is a smally changed
> VFS.getManager (I use a different slf4j version in my project so I have to
> make the Logger be null before init())
>  the result be:
>
> class org.apache.commons.httpclient.HttpClient
> interface org.apache.jackrabbit.webdav.client.methods.DavMethod
> log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
> log4j: Level token is [DEBUG].
> log4j: Category root set to DEBUG
> log4j: Parsing appender named "DEBUG_LOG".
> log4j: Parsing layout options for "DEBUG_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>  [ %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "DEBUG_LOG".
> log4j: Setting property [threshold] to [DEBUG].
> log4j: Setting property [file] to [logs/logs.log].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/logs.log, true
> log4j: setFile ended
> log4j: Appender [DEBUG_LOG] to be rolled at midnight.
> log4j: Parsed "DEBUG_LOG" options.
> log4j: Parsing appender named "ERROR_LOG".
> log4j: Parsing layout options for "ERROR_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>  [ %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "ERROR_LOG".
> log4j: Setting property [file] to [logs/error.log].
> log4j: Setting property [threshold] to [ERROR].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/error.log, true
> log4j: setFile ended
> log4j: Appender [ERROR_LOG] to be rolled at midnight.
> log4j: Parsed "ERROR_LOG" options.
> log4j: Finished configuring.
> FileObject : file:///D:/1 1.txt
> File : file:/D:/1%201.txt
> java.net.URISyntaxException: Illegal character in path at index 12:
> file:///D:/1 1.txt
> at java.base/java.net.URI$Parser.fail(URI.java:2936)
> at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
> at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
> at java.base/java.net.URI$Parser.parse(URI.java:3137)
> at java.base/java.net.URI.<init>(URI.java:623)
> at java.base/java.net.URL.toURI(URL.java:1048)
> at FileManagerTest.test(FileManagerTest.java:59)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:567)
> at
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
> at
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
> at
> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> at
> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
> at
> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
> at
> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
> at
> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
> at
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> at
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
>
>
> Process finished with exit code 0
>
> We can skip the log4j part, then you can see, the url parser in javaio
> cannot deal with " ", and " " must be transcoded to "%20", and if not do so
> in URL, then url.toURI() will fail.
>
>
>
> Bernd Eckenfels <ec...@zusammenkunft.net> 于2020年1月24日周五 上午4:21写道:
>
>> Hello,
>>
>> I am not sure I understand what the actual difference is, but you are
>> right, the URL should actually be useable. However there are a lot of
>> inconsistencies and backward compatibilities to look out for (even File
>> itself has different URL/URI methods and never defined how Windows drives
>> are to be handled). So can you give us an example path and what it looks
>> like in URL from VFS and from java.io, so we can check if there is
>> something to tweak.
>>
>> Gruss
>> Bernd
>> --
>> http://bernd.eckenfels.net
>> ________________________________
>> Von: Xeno Amess <xe...@gmail.com>
>> Gesendet: Thursday, January 23, 2020 2:40:59 PM
>> An: Commons Developers List <de...@commons.apache.org>
>> Betreff: Re: Getting File of FileObject (was: some questions (/bug?)
>> about commons-vfs2 make me confused.)
>>
>> I put it in dev-list because I really donot know wether it be a bug or
>> not.
>> If it be a but then I'm actually willing for help.
>> But it seems by design but not a bug here, so I apologize.
>> Still, some questions hold.
>>
>> /**
>>  * Returns a URL representing this file.
>>  *
>>  * @return the URL for the file.
>>  * @throws FileSystemException if an error occurs.
>>  */
>> URL getURL() throws FileSystemException;
>> that is the comments on getURL()
>> And IMO that is quite confusing actually.
>> You see if we use the same URL class and return it in such a public
>> method, it be normally to think it fit Java's standard, and can use
>> .URI if the protocol should be able to.
>> But the truth is the standard we used in vfs is sometimes different than
>> Java.
>> The word [Sometimes] here is very dangerous and might be a bug causer,
>> because it can pass most tests and make users feel "Oh, it just return
>> a normal URL, and it really works right."
>> So IMO at least we shall add some more warning about "not using this
>> returned URL's some functions,including to URL, they might be
>> dangerous" or "we use different standard about file:// than Java's
>> file://"
>>
>> Besides, I wonder why we must use a same URL class in vfs, if we
>> cannot guarantee it works consistently to Java lib?
>> Is it a better thought to create a new VFSURL class for URL in vfs?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>

Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Xeno Amess <xe...@gmail.com>.
class org.apache.commons.httpclient.HttpClient
interface org.apache.jackrabbit.webdav.client.methods.DavMethod
log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "DEBUG_LOG".
log4j: Parsing layout options for "DEBUG_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "DEBUG_LOG".
log4j: Setting property [threshold] to [DEBUG].
log4j: Setting property [file] to [logs/logs.log].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/logs.log, true
log4j: setFile ended
log4j: Appender [DEBUG_LOG] to be rolled at midnight.
log4j: Parsed "DEBUG_LOG" options.
log4j: Parsing appender named "ERROR_LOG".
log4j: Parsing layout options for "ERROR_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "ERROR_LOG".
log4j: Setting property [file] to [logs/error.log].
log4j: Setting property [threshold] to [ERROR].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/error.log, true
log4j: setFile ended
log4j: Appender [ERROR_LOG] to be rolled at midnight.
log4j: Parsed "ERROR_LOG" options.
log4j: Finished configuring.
File : file:/D:/1%201.txt
FileObject : file:///D:/1 1.txt
D:\1 1.txt
java.net.URISyntaxException: Illegal character in path at index 12:
file:///D:/1 1.txt
at java.base/java.net.URI$Parser.fail(URI.java:2936)
at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
at java.base/java.net.URI$Parser.parse(URI.java:3137)
at java.base/java.net.URI.<init>(URI.java:623)
at java.base/java.net.URL.toURI(URL.java:1048)
at FileManagerTest.test(FileManagerTest.java:66)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
at
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at
org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at
org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
at
org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
at
org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
at
com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)


Process finished with exit code 0

(I forgot to refresh the console. sorry.)
(Although I guess you can get what I mean)

Xeno Amess <xe...@gmail.com> 于2020年1月24日周五 上午6:26写道:

> OK>
> 1. I use win10, jdk 13 here.
> 2. make a file [D:/1 1.txt] , there is a character space between the two
> character '1'.
> 3. run a code like this.
>
> /*
>  * MIT License
>  *
>  * Copyright (c) 2020 XenoAmess
>  *
>  * Permission is hereby granted, free of charge, to any person obtaining a copy
>  * of this software and associated documentation files (the "Software"), to deal
>  * in the Software without restriction, including without limitation the rights
>  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
>  * copies of the Software, and to permit persons to whom the Software is
>  * furnished to do so, subject to the following conditions:
>  *
>  * The above copyright notice and this permission notice shall be included in all
>  * copies or substantial portions of the Software.
>  *
>  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
>  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
>  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
>  * SOFTWARE.
>  */
>
> import com.xenoamess.cyan_potion.base.memory.ResourceManager;
> import org.apache.commons.vfs2.FileSystemException;
> import org.apache.commons.vfs2.FileSystemManager;
> import org.junit.jupiter.api.Test;
>
> import java.io.File;
> import java.net.MalformedURLException;
> import java.net.URISyntaxException;
> import java.net.URL;
>
> public class FileManagerTest {
>     @Test
>     public void test() {
>         System.out.println(org.apache.commons.httpclient.HttpClient.class);
>         System.out.println(org.apache.jackrabbit.webdav.client.methods.DavMethod.class);
>         FileSystemManager fileSystemManager = ResourceManager.getFileSystemManager();
>
>         URL url2 = null;
>         URL url1 = null;
>
>         try {
>             url2 = new File("D:/1 1.txt").toURI().toURL();
>             System.out.println("File : " + url2);
>         } catch (MalformedURLException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             url1 = fileSystemManager.resolveFile("D:/1 1.txt").getURL();
>             System.out.println("FileObject : " + url1);
>         } catch (FileSystemException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             System.out.println(new File(url2.toURI()));
>         } catch (URISyntaxException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             System.out.println(new File(url1.toURI()));
>         } catch (URISyntaxException e) {
>             e.printStackTrace();
>         }
>
>
>     }
> }
>
>   ResourceManager.getFileSystemManager();  is a smally changed
> VFS.getManager (I use a different slf4j version in my project so I have to
> make the Logger be null before init())
>  the result be:
>
> class org.apache.commons.httpclient.HttpClient
> interface org.apache.jackrabbit.webdav.client.methods.DavMethod
> log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
> log4j: Level token is [DEBUG].
> log4j: Category root set to DEBUG
> log4j: Parsing appender named "DEBUG_LOG".
> log4j: Parsing layout options for "DEBUG_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>  [ %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "DEBUG_LOG".
> log4j: Setting property [threshold] to [DEBUG].
> log4j: Setting property [file] to [logs/logs.log].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/logs.log, true
> log4j: setFile ended
> log4j: Appender [DEBUG_LOG] to be rolled at midnight.
> log4j: Parsed "DEBUG_LOG" options.
> log4j: Parsing appender named "ERROR_LOG".
> log4j: Parsing layout options for "ERROR_LOG".
> log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}
>  [ %t:%r ] - [ %p ]  %m%n].
> log4j: End of parsing for "ERROR_LOG".
> log4j: Setting property [file] to [logs/error.log].
> log4j: Setting property [threshold] to [ERROR].
> log4j: Setting property [append] to [true].
> log4j: setFile called: logs/error.log, true
> log4j: setFile ended
> log4j: Appender [ERROR_LOG] to be rolled at midnight.
> log4j: Parsed "ERROR_LOG" options.
> log4j: Finished configuring.
> FileObject : file:///D:/1 1.txt
> File : file:/D:/1%201.txt
> java.net.URISyntaxException: Illegal character in path at index 12:
> file:///D:/1 1.txt
> at java.base/java.net.URI$Parser.fail(URI.java:2936)
> at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
> at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
> at java.base/java.net.URI$Parser.parse(URI.java:3137)
> at java.base/java.net.URI.<init>(URI.java:623)
> at java.base/java.net.URL.toURI(URL.java:1048)
> at FileManagerTest.test(FileManagerTest.java:59)
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:567)
> at
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
> at
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
> at
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
> at
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
> at
> org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
> at
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
> at
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
> at
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
> at
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
> at
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
> at
> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
> at
> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
> at
> org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
> at
> org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
> at
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
> at
> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
> at
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
> at
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
> at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
>
>
> Process finished with exit code 0
>
> We can skip the log4j part, then you can see, the url parser in javaio
> cannot deal with " ", and " " must be transcoded to "%20", and if not do so
> in URL, then url.toURI() will fail.
>
>
>
> Bernd Eckenfels <ec...@zusammenkunft.net> 于2020年1月24日周五 上午4:21写道:
>
>> Hello,
>>
>> I am not sure I understand what the actual difference is, but you are
>> right, the URL should actually be useable. However there are a lot of
>> inconsistencies and backward compatibilities to look out for (even File
>> itself has different URL/URI methods and never defined how Windows drives
>> are to be handled). So can you give us an example path and what it looks
>> like in URL from VFS and from java.io, so we can check if there is
>> something to tweak.
>>
>> Gruss
>> Bernd
>> --
>> http://bernd.eckenfels.net
>> ________________________________
>> Von: Xeno Amess <xe...@gmail.com>
>> Gesendet: Thursday, January 23, 2020 2:40:59 PM
>> An: Commons Developers List <de...@commons.apache.org>
>> Betreff: Re: Getting File of FileObject (was: some questions (/bug?)
>> about commons-vfs2 make me confused.)
>>
>> I put it in dev-list because I really donot know wether it be a bug or
>> not.
>> If it be a but then I'm actually willing for help.
>> But it seems by design but not a bug here, so I apologize.
>> Still, some questions hold.
>>
>> /**
>>  * Returns a URL representing this file.
>>  *
>>  * @return the URL for the file.
>>  * @throws FileSystemException if an error occurs.
>>  */
>> URL getURL() throws FileSystemException;
>> that is the comments on getURL()
>> And IMO that is quite confusing actually.
>> You see if we use the same URL class and return it in such a public
>> method, it be normally to think it fit Java's standard, and can use
>> .URI if the protocol should be able to.
>> But the truth is the standard we used in vfs is sometimes different than
>> Java.
>> The word [Sometimes] here is very dangerous and might be a bug causer,
>> because it can pass most tests and make users feel "Oh, it just return
>> a normal URL, and it really works right."
>> So IMO at least we shall add some more warning about "not using this
>> returned URL's some functions,including to URL, they might be
>> dangerous" or "we use different standard about file:// than Java's
>> file://"
>>
>> Besides, I wonder why we must use a same URL class in vfs, if we
>> cannot guarantee it works consistently to Java lib?
>> Is it a better thought to create a new VFSURL class for URL in vfs?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>

Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Xeno Amess <xe...@gmail.com>.
OK>
1. I use win10, jdk 13 here.
2. make a file [D:/1 1.txt] , there is a character space between the two
character '1'.
3. run a code like this.

/*
 * MIT License
 *
 * Copyright (c) 2020 XenoAmess
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import com.xenoamess.cyan_potion.base.memory.ResourceManager;
import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;

public class FileManagerTest {
    @Test
    public void test() {
        System.out.println(org.apache.commons.httpclient.HttpClient.class);
        System.out.println(org.apache.jackrabbit.webdav.client.methods.DavMethod.class);
        FileSystemManager fileSystemManager =
ResourceManager.getFileSystemManager();

        URL url2 = null;
        URL url1 = null;

        try {
            url2 = new File("D:/1 1.txt").toURI().toURL();
            System.out.println("File : " + url2);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        try {
            url1 = fileSystemManager.resolveFile("D:/1 1.txt").getURL();
            System.out.println("FileObject : " + url1);
        } catch (FileSystemException e) {
            e.printStackTrace();
        }

        try {
            System.out.println(new File(url2.toURI()));
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }

        try {
            System.out.println(new File(url1.toURI()));
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }


    }
}

  ResourceManager.getFileSystemManager();  is a smally changed
VFS.getManager (I use a different slf4j version in my project so I have to
make the Logger be null before init())
 the result be:

class org.apache.commons.httpclient.HttpClient
interface org.apache.jackrabbit.webdav.client.methods.DavMethod
log4j: Parsing for [root] with value=[DEBUG,DEBUG_LOG,ERROR_LOG].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "DEBUG_LOG".
log4j: Parsing layout options for "DEBUG_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "DEBUG_LOG".
log4j: Setting property [threshold] to [DEBUG].
log4j: Setting property [file] to [logs/logs.log].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/logs.log, true
log4j: setFile ended
log4j: Appender [DEBUG_LOG] to be rolled at midnight.
log4j: Parsed "DEBUG_LOG" options.
log4j: Parsing appender named "ERROR_LOG".
log4j: Parsing layout options for "ERROR_LOG".
log4j: Setting property [conversionPattern] to [%-d{yyyy-MM-dd HH:mm:ss}  [
%t:%r ] - [ %p ]  %m%n].
log4j: End of parsing for "ERROR_LOG".
log4j: Setting property [file] to [logs/error.log].
log4j: Setting property [threshold] to [ERROR].
log4j: Setting property [append] to [true].
log4j: setFile called: logs/error.log, true
log4j: setFile ended
log4j: Appender [ERROR_LOG] to be rolled at midnight.
log4j: Parsed "ERROR_LOG" options.
log4j: Finished configuring.
FileObject : file:///D:/1 1.txt
File : file:/D:/1%201.txt
java.net.URISyntaxException: Illegal character in path at index 12:
file:///D:/1 1.txt
at java.base/java.net.URI$Parser.fail(URI.java:2936)
at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
at java.base/java.net.URI$Parser.parse(URI.java:3137)
at java.base/java.net.URI.<init>(URI.java:623)
at java.base/java.net.URL.toURI(URL.java:1048)
at FileManagerTest.test(FileManagerTest.java:59)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
at
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at
org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at
org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at
org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at
org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:205)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:201)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
at
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1507)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at
org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
at
org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
at
org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
at
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
at
com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)


Process finished with exit code 0

We can skip the log4j part, then you can see, the url parser in javaio
cannot deal with " ", and " " must be transcoded to "%20", and if not do so
in URL, then url.toURI() will fail.



Bernd Eckenfels <ec...@zusammenkunft.net> 于2020年1月24日周五 上午4:21写道:

> Hello,
>
> I am not sure I understand what the actual difference is, but you are
> right, the URL should actually be useable. However there are a lot of
> inconsistencies and backward compatibilities to look out for (even File
> itself has different URL/URI methods and never defined how Windows drives
> are to be handled). So can you give us an example path and what it looks
> like in URL from VFS and from java.io, so we can check if there is
> something to tweak.
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net
> ________________________________
> Von: Xeno Amess <xe...@gmail.com>
> Gesendet: Thursday, January 23, 2020 2:40:59 PM
> An: Commons Developers List <de...@commons.apache.org>
> Betreff: Re: Getting File of FileObject (was: some questions (/bug?) about
> commons-vfs2 make me confused.)
>
> I put it in dev-list because I really donot know wether it be a bug or not.
> If it be a but then I'm actually willing for help.
> But it seems by design but not a bug here, so I apologize.
> Still, some questions hold.
>
> /**
>  * Returns a URL representing this file.
>  *
>  * @return the URL for the file.
>  * @throws FileSystemException if an error occurs.
>  */
> URL getURL() throws FileSystemException;
> that is the comments on getURL()
> And IMO that is quite confusing actually.
> You see if we use the same URL class and return it in such a public
> method, it be normally to think it fit Java's standard, and can use
> .URI if the protocol should be able to.
> But the truth is the standard we used in vfs is sometimes different than
> Java.
> The word [Sometimes] here is very dangerous and might be a bug causer,
> because it can pass most tests and make users feel "Oh, it just return
> a normal URL, and it really works right."
> So IMO at least we shall add some more warning about "not using this
> returned URL's some functions,including to URL, they might be
> dangerous" or "we use different standard about file:// than Java's
> file://"
>
> Besides, I wonder why we must use a same URL class in vfs, if we
> cannot guarantee it works consistently to Java lib?
> Is it a better thought to create a new VFSURL class for URL in vfs?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

I am not sure I understand what the actual difference is, but you are right, the URL should actually be useable. However there are a lot of inconsistencies and backward compatibilities to look out for (even File itself has different URL/URI methods and never defined how Windows drives are to be handled). So can you give us an example path and what it looks like in URL from VFS and from java.io, so we can check if there is something to tweak.

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
Von: Xeno Amess <xe...@gmail.com>
Gesendet: Thursday, January 23, 2020 2:40:59 PM
An: Commons Developers List <de...@commons.apache.org>
Betreff: Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

I put it in dev-list because I really donot know wether it be a bug or not.
If it be a but then I'm actually willing for help.
But it seems by design but not a bug here, so I apologize.
Still, some questions hold.

/**
 * Returns a URL representing this file.
 *
 * @return the URL for the file.
 * @throws FileSystemException if an error occurs.
 */
URL getURL() throws FileSystemException;
that is the comments on getURL()
And IMO that is quite confusing actually.
You see if we use the same URL class and return it in such a public
method, it be normally to think it fit Java's standard, and can use
.URI if the protocol should be able to.
But the truth is the standard we used in vfs is sometimes different than Java.
The word [Sometimes] here is very dangerous and might be a bug causer,
because it can pass most tests and make users feel "Oh, it just return
a normal URL, and it really works right."
So IMO at least we shall add some more warning about "not using this
returned URL's some functions,including to URL, they might be
dangerous" or "we use different standard about file:// than Java's
file://"

Besides, I wonder why we must use a same URL class in vfs, if we
cannot guarantee it works consistently to Java lib?
Is it a better thought to create a new VFSURL class for URL in vfs?

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


Re: Getting File of FileObject (was: some questions (/bug?) about commons-vfs2 make me confused.)

Posted by Xeno Amess <xe...@gmail.com>.
I put it in dev-list because I really donot know wether it be a bug or not.
If it be a but then I'm actually willing for help.
But it seems by design but not a bug here, so I apologize.
Still, some questions hold.

/**
 * Returns a URL representing this file.
 *
 * @return the URL for the file.
 * @throws FileSystemException if an error occurs.
 */
URL getURL() throws FileSystemException;
that is the comments on getURL()
And IMO that is quite confusing actually.
You see if we use the same URL class and return it in such a public
method, it be normally to think it fit Java's standard, and can use
.URI if the protocol should be able to.
But the truth is the standard we used in vfs is sometimes different than Java.
The word [Sometimes] here is very dangerous and might be a bug causer,
because it can pass most tests and make users feel "Oh, it just return
a normal URL, and it really works right."
So IMO at least we shall add some more warning about "not using this
returned URL's some functions,including to URL, they might be
dangerous" or "we use different standard about file:// than Java's
file://"

Besides, I wonder why we must use a same URL class in vfs, if we
cannot guarantee it works consistently to Java lib?
Is it a better thought to create a new VFSURL class for URL in vfs?

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

If you represent a local file then I think you can use

   fileObj.getName().getPathDecoded()

However it might be a good idea to add a method like

   File fileSystemManager.toFile(FileObject)

As the reverse of FileObject fsm.toFileObject(File).

Ps: usage questions are better on commons-user mailing list.

Gruss
Bernd



--
http://bernd.eckenfels.net
________________________________
Von: Xeno Amess <xe...@gmail.com>
Gesendet: Thursday, January 23, 2020 3:02:02 AM
An: Commons Developers List <de...@commons.apache.org>
Betreff: Re: some questions (/bug?) about commons-vfs2 make me confused.

and there comes one more question:
how to transfer a FileObject(vfs) to a File(in Java) (if possible)?
I know that sonds insane but sometimes we just need a function like this.
I tried

try {
    result = new File(fileObject.getURL().toURI());
} catch (URISyntaxException | FileSystemException e) {
    LOGGER.error("this FileObject cannot be transformed to a File", e);
}

it works in normal cases but when your path contains character space
in them, it will throw URISyntaxException
seems vfs and java holds different rules about space in file path?
and how should I achieve this?

Xeno Amess <xe...@gmail.com> 于2020年1月20日周一 上午12:41写道:
>
> yep that make sense.
> but I'd rather add a class-check for provider class.
> there already be a mechanism for making sure if all classes needed for
> this provider class exist -> if not then just do not add the provider.
> I will add a similar mechanism for making sure if the provider class
> itself exist -> if not then just do not add the provider.
> pull request here.
> https://github.com/apache/commons-vfs/pull/78
>
> Rob Spoor <ap...@icemanx.nl> 于2020年1月20日周一 上午12:13写道:
> >
> > It seems that when the webdav support was moved to a separate artifact,
> > the developers forgot to update file
> > commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml.
> > This file is used by StandardFileSystemManager to load the default
> > providers.
> >
> > I think this warrants a fix, to move the webdav provider from this
> > default providers.xml file to file
> > commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml,
> > and create the same file with the correct providers for the
> > commons-vfs2-jackrabbit2 module.
> >
> >
> > On 19/01/2020 16:57, Xeno Amess wrote:
> > > OK I get where is bugged.
> > > I will fix it and add a test for that never happen again.
> > >
> > > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
> > >>
> > >> The key point is even if I do not wanna use it I must have this
> > >> class,or VFS.getManager() can never run.
> > >>
> > >> IMO this type of class relationship cause the project where hold this
> > >> class must be added into vfs's pom as a dependency, or just move class
> > >> VFS into that project aswell.
> > >>
> > >> Otherwise we should not let the VFS.getManager() rely on this class.
> > >>
> > >> Thanks for finding this class though.
> > >>
> > >> btw I tested 2.4, 2.4 is correct.
> > >>
> > >> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> > >>>
> > >>> The class was there in release 2.4.1:
> > >>> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java.
> > >>> In the next release, 2.5.0, it can indeed no longer be found. A bit of
> > >>> investigating showed that the webdav classes got moved to a new
> > >>> artifact:
> > >>> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> > >>>
> > >>> That means you can still use it, you just need to include an extra
> > >>> dependency:
> > >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> > >>>
> > >>> There's apparently also a Jackrabbit 2 version available:
> > >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> > >>>
> > >>>
> > >>> On 19/01/2020 11:24, Xeno Amess wrote:
> > >>>> Right now I'm using something like
> > >>>> this to deal with relative files.
> > >>>> But I just think there might be a more elegant way...
> > >>>>
> > >>>> fileSystemManager = new
> > >>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > >>>> fileSystemManager.setLogger(null);
> > >>>> try {
> > >>>>       fileSystemManager.init();
> > >>>>       fileSystemManager.setBaseFile(new File(""));
> > >>>> } catch (FileSystemException e) {
> > >>>>       e.printStackTrace();
> > >>>> }
> > >>>>
> > >>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> > >>>>>
> > >>>>> I'm trying to migrate to commons-vfs2 now
> > >>>>> severial things I found not quite right / amazing.
> > >>>>>
> > >>>>> 1.
> > >>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
> > >>>>> VSF.getManager() (of cause I have no additional contfigure or
> > >>>>> something)
> > >>>>>
> > >>>>> It said class not
> > >>>>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> > >>>>>
> > >>>>> And I looked into your binary jars I get from maven central (2.6.0).
> > >>>>>
> > >>>>> they really do not have that class WebdavFileProvider.
> > >>>>> (even not found that package org.apache.commons.vfs2.provider.webdav)
> > >>>>>
> > >>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
> > >>>>> that is not important)
> > >>>>> It can run now.(and never tell me class not found again)
> > >>>>> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
> > >>>>> All I get is:
> > >>>>> 2.6.0, broken.
> > >>>>> 2.5.0, broken.
> > >>>>> 2.3, fine.
> > >>>>>
> > >>>>> According to the file on github, it said it might be deprecated, so I
> > >>>>> wonder if you already deprecate d it and you just forgotten it?
> > >>>>>
> > >>>>>    btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
> > >>>>> there even do not exist 2.6.0
> > >>>>> But there be a 2.6.0 in maven central.
> > >>>>> really make me confused.
> > >>>>>
> > >>>>> 2.
> > >>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
> > >>>>> We all know slf4j's author really do not care about backward
> > >>>>> maintenance or something.
> > >>>>> His codes are never able to migrate.
> > >>>>> even though, will there be some plan about using reflect or something
> > >>>>> to make vfs2 CAN suit slf4j 2.0?
> > >>>>>
> > >>>>> 3.
> > >>>>> for some reason I need to deal with relative file path.
> > >>>>> Is there any guide about using relative file path in vfs2?
> > >>>>
> > >>>> ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > >>>> For additional commands, e-mail: dev-help@commons.apache.org
> > >>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > >>> For additional commands, e-mail: dev-help@commons.apache.org
> > >>>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Xeno Amess <xe...@gmail.com>.
and there comes one more question:
how to transfer a FileObject(vfs) to a File(in Java) (if possible)?
I know that sonds insane but sometimes we just need a function like this.
I tried

try {
    result = new File(fileObject.getURL().toURI());
} catch (URISyntaxException | FileSystemException e) {
    LOGGER.error("this FileObject cannot be transformed to a File", e);
}

it works in normal cases but when your path contains character space
in them, it will throw URISyntaxException
seems vfs and java holds different rules about space in file path?
and how should I achieve this?

Xeno Amess <xe...@gmail.com> 于2020年1月20日周一 上午12:41写道:
>
> yep that make sense.
> but I'd rather add a class-check for provider class.
> there already be a mechanism for making sure if all classes needed for
> this provider class exist -> if not then just do not add the provider.
> I will add a similar mechanism for making sure if the provider class
> itself exist -> if not then just do not add the provider.
> pull request here.
> https://github.com/apache/commons-vfs/pull/78
>
> Rob Spoor <ap...@icemanx.nl> 于2020年1月20日周一 上午12:13写道:
> >
> > It seems that when the webdav support was moved to a separate artifact,
> > the developers forgot to update file
> > commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml.
> > This file is used by StandardFileSystemManager to load the default
> > providers.
> >
> > I think this warrants a fix, to move the webdav provider from this
> > default providers.xml file to file
> > commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml,
> > and create the same file with the correct providers for the
> > commons-vfs2-jackrabbit2 module.
> >
> >
> > On 19/01/2020 16:57, Xeno Amess wrote:
> > > OK I get where is bugged.
> > > I will fix it and add a test for that never happen again.
> > >
> > > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
> > >>
> > >> The key point is even if I do not wanna use it I must have this
> > >> class,or VFS.getManager() can never run.
> > >>
> > >> IMO this type of class relationship cause the project where hold this
> > >> class must be added into vfs's pom as a dependency, or just move class
> > >> VFS into that project aswell.
> > >>
> > >> Otherwise we should not let the VFS.getManager() rely on this class.
> > >>
> > >> Thanks for finding this class though.
> > >>
> > >> btw I tested 2.4, 2.4 is correct.
> > >>
> > >> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> > >>>
> > >>> The class was there in release 2.4.1:
> > >>> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java.
> > >>> In the next release, 2.5.0, it can indeed no longer be found. A bit of
> > >>> investigating showed that the webdav classes got moved to a new
> > >>> artifact:
> > >>> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> > >>>
> > >>> That means you can still use it, you just need to include an extra
> > >>> dependency:
> > >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> > >>>
> > >>> There's apparently also a Jackrabbit 2 version available:
> > >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> > >>>
> > >>>
> > >>> On 19/01/2020 11:24, Xeno Amess wrote:
> > >>>> Right now I'm using something like
> > >>>> this to deal with relative files.
> > >>>> But I just think there might be a more elegant way...
> > >>>>
> > >>>> fileSystemManager = new
> > >>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > >>>> fileSystemManager.setLogger(null);
> > >>>> try {
> > >>>>       fileSystemManager.init();
> > >>>>       fileSystemManager.setBaseFile(new File(""));
> > >>>> } catch (FileSystemException e) {
> > >>>>       e.printStackTrace();
> > >>>> }
> > >>>>
> > >>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> > >>>>>
> > >>>>> I'm trying to migrate to commons-vfs2 now
> > >>>>> severial things I found not quite right / amazing.
> > >>>>>
> > >>>>> 1.
> > >>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
> > >>>>> VSF.getManager() (of cause I have no additional contfigure or
> > >>>>> something)
> > >>>>>
> > >>>>> It said class not
> > >>>>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> > >>>>>
> > >>>>> And I looked into your binary jars I get from maven central (2.6.0).
> > >>>>>
> > >>>>> they really do not have that class WebdavFileProvider.
> > >>>>> (even not found that package org.apache.commons.vfs2.provider.webdav)
> > >>>>>
> > >>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
> > >>>>> that is not important)
> > >>>>> It can run now.(and never tell me class not found again)
> > >>>>> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
> > >>>>> All I get is:
> > >>>>> 2.6.0, broken.
> > >>>>> 2.5.0, broken.
> > >>>>> 2.3, fine.
> > >>>>>
> > >>>>> According to the file on github, it said it might be deprecated, so I
> > >>>>> wonder if you already deprecate d it and you just forgotten it?
> > >>>>>
> > >>>>>    btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
> > >>>>> there even do not exist 2.6.0
> > >>>>> But there be a 2.6.0 in maven central.
> > >>>>> really make me confused.
> > >>>>>
> > >>>>> 2.
> > >>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
> > >>>>> We all know slf4j's author really do not care about backward
> > >>>>> maintenance or something.
> > >>>>> His codes are never able to migrate.
> > >>>>> even though, will there be some plan about using reflect or something
> > >>>>> to make vfs2 CAN suit slf4j 2.0?
> > >>>>>
> > >>>>> 3.
> > >>>>> for some reason I need to deal with relative file path.
> > >>>>> Is there any guide about using relative file path in vfs2?
> > >>>>
> > >>>> ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > >>>> For additional commands, e-mail: dev-help@commons.apache.org
> > >>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > >>> For additional commands, e-mail: dev-help@commons.apache.org
> > >>>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Xeno Amess <xe...@gmail.com>.
yep that make sense.
but I'd rather add a class-check for provider class.
there already be a mechanism for making sure if all classes needed for
this provider class exist -> if not then just do not add the provider.
I will add a similar mechanism for making sure if the provider class
itself exist -> if not then just do not add the provider.
pull request here.
https://github.com/apache/commons-vfs/pull/78

Rob Spoor <ap...@icemanx.nl> 于2020年1月20日周一 上午12:13写道:
>
> It seems that when the webdav support was moved to a separate artifact,
> the developers forgot to update file
> commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml.
> This file is used by StandardFileSystemManager to load the default
> providers.
>
> I think this warrants a fix, to move the webdav provider from this
> default providers.xml file to file
> commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml,
> and create the same file with the correct providers for the
> commons-vfs2-jackrabbit2 module.
>
>
> On 19/01/2020 16:57, Xeno Amess wrote:
> > OK I get where is bugged.
> > I will fix it and add a test for that never happen again.
> >
> > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
> >>
> >> The key point is even if I do not wanna use it I must have this
> >> class,or VFS.getManager() can never run.
> >>
> >> IMO this type of class relationship cause the project where hold this
> >> class must be added into vfs's pom as a dependency, or just move class
> >> VFS into that project aswell.
> >>
> >> Otherwise we should not let the VFS.getManager() rely on this class.
> >>
> >> Thanks for finding this class though.
> >>
> >> btw I tested 2.4, 2.4 is correct.
> >>
> >> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> >>>
> >>> The class was there in release 2.4.1:
> >>> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java.
> >>> In the next release, 2.5.0, it can indeed no longer be found. A bit of
> >>> investigating showed that the webdav classes got moved to a new
> >>> artifact:
> >>> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> >>>
> >>> That means you can still use it, you just need to include an extra
> >>> dependency:
> >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> >>>
> >>> There's apparently also a Jackrabbit 2 version available:
> >>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> >>>
> >>>
> >>> On 19/01/2020 11:24, Xeno Amess wrote:
> >>>> Right now I'm using something like
> >>>> this to deal with relative files.
> >>>> But I just think there might be a more elegant way...
> >>>>
> >>>> fileSystemManager = new
> >>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> >>>> fileSystemManager.setLogger(null);
> >>>> try {
> >>>>       fileSystemManager.init();
> >>>>       fileSystemManager.setBaseFile(new File(""));
> >>>> } catch (FileSystemException e) {
> >>>>       e.printStackTrace();
> >>>> }
> >>>>
> >>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> >>>>>
> >>>>> I'm trying to migrate to commons-vfs2 now
> >>>>> severial things I found not quite right / amazing.
> >>>>>
> >>>>> 1.
> >>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
> >>>>> VSF.getManager() (of cause I have no additional contfigure or
> >>>>> something)
> >>>>>
> >>>>> It said class not
> >>>>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> >>>>>
> >>>>> And I looked into your binary jars I get from maven central (2.6.0).
> >>>>>
> >>>>> they really do not have that class WebdavFileProvider.
> >>>>> (even not found that package org.apache.commons.vfs2.provider.webdav)
> >>>>>
> >>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
> >>>>> that is not important)
> >>>>> It can run now.(and never tell me class not found again)
> >>>>> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
> >>>>> All I get is:
> >>>>> 2.6.0, broken.
> >>>>> 2.5.0, broken.
> >>>>> 2.3, fine.
> >>>>>
> >>>>> According to the file on github, it said it might be deprecated, so I
> >>>>> wonder if you already deprecate d it and you just forgotten it?
> >>>>>
> >>>>>    btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
> >>>>> there even do not exist 2.6.0
> >>>>> But there be a 2.6.0 in maven central.
> >>>>> really make me confused.
> >>>>>
> >>>>> 2.
> >>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
> >>>>> We all know slf4j's author really do not care about backward
> >>>>> maintenance or something.
> >>>>> His codes are never able to migrate.
> >>>>> even though, will there be some plan about using reflect or something
> >>>>> to make vfs2 CAN suit slf4j 2.0?
> >>>>>
> >>>>> 3.
> >>>>> for some reason I need to deal with relative file path.
> >>>>> Is there any guide about using relative file path in vfs2?
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >>>> For additional commands, e-mail: dev-help@commons.apache.org
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> >>> For additional commands, e-mail: dev-help@commons.apache.org
> >>>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Rob Spoor <ap...@icemanx.nl>.
It seems that when the webdav support was moved to a separate artifact, 
the developers forgot to update file 
commons-vfs2/src/main/resources/org/apache/commons/vfs2/impl/providers.xml. 
This file is used by StandardFileSystemManager to load the default 
providers.

I think this warrants a fix, to move the webdav provider from this 
default providers.xml file to file 
commons-vfs2-jackrabbit1/src/main/resources/META-INF/vfs-providers.xml, 
and create the same file with the correct providers for the 
commons-vfs2-jackrabbit2 module.


On 19/01/2020 16:57, Xeno Amess wrote:
> OK I get where is bugged.
> I will fix it and add a test for that never happen again.
> 
> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
>>
>> The key point is even if I do not wanna use it I must have this
>> class,or VFS.getManager() can never run.
>>
>> IMO this type of class relationship cause the project where hold this
>> class must be added into vfs's pom as a dependency, or just move class
>> VFS into that project aswell.
>>
>> Otherwise we should not let the VFS.getManager() rely on this class.
>>
>> Thanks for finding this class though.
>>
>> btw I tested 2.4, 2.4 is correct.
>>
>> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
>>>
>>> The class was there in release 2.4.1:
>>> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java.
>>> In the next release, 2.5.0, it can indeed no longer be found. A bit of
>>> investigating showed that the webdav classes got moved to a new
>>> artifact:
>>> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
>>>
>>> That means you can still use it, you just need to include an extra
>>> dependency:
>>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
>>>
>>> There's apparently also a Jackrabbit 2 version available:
>>> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
>>>
>>>
>>> On 19/01/2020 11:24, Xeno Amess wrote:
>>>> Right now I'm using something like
>>>> this to deal with relative files.
>>>> But I just think there might be a more elegant way...
>>>>
>>>> fileSystemManager = new
>>>> org.apache.commons.vfs2.impl.StandardFileSystemManager();
>>>> fileSystemManager.setLogger(null);
>>>> try {
>>>>       fileSystemManager.init();
>>>>       fileSystemManager.setBaseFile(new File(""));
>>>> } catch (FileSystemException e) {
>>>>       e.printStackTrace();
>>>> }
>>>>
>>>> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
>>>>>
>>>>> I'm trying to migrate to commons-vfs2 now
>>>>> severial things I found not quite right / amazing.
>>>>>
>>>>> 1.
>>>>>    I tested version 2.6.0 and 2.5.0, and I just start at
>>>>> VSF.getManager() (of cause I have no additional contfigure or
>>>>> something)
>>>>>
>>>>> It said class not
>>>>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
>>>>>
>>>>> And I looked into your binary jars I get from maven central (2.6.0).
>>>>>
>>>>> they really do not have that class WebdavFileProvider.
>>>>> (even not found that package org.apache.commons.vfs2.provider.webdav)
>>>>>
>>>>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
>>>>> that is not important)
>>>>> It can run now.(and never tell me class not found again)
>>>>> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
>>>>> All I get is:
>>>>> 2.6.0, broken.
>>>>> 2.5.0, broken.
>>>>> 2.3, fine.
>>>>>
>>>>> According to the file on github, it said it might be deprecated, so I
>>>>> wonder if you already deprecate d it and you just forgotten it?
>>>>>
>>>>>    btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
>>>>> there even do not exist 2.6.0
>>>>> But there be a 2.6.0 in maven central.
>>>>> really make me confused.
>>>>>
>>>>> 2.
>>>>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
>>>>> We all know slf4j's author really do not care about backward
>>>>> maintenance or something.
>>>>> His codes are never able to migrate.
>>>>> even though, will there be some plan about using reflect or something
>>>>> to make vfs2 CAN suit slf4j 2.0?
>>>>>
>>>>> 3.
>>>>> for some reason I need to deal with relative file path.
>>>>> Is there any guide about using relative file path in vfs2?
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Xeno Amess <xe...@gmail.com>.
OK I get where is bugged.
I will fix it and add a test for that never happen again.

Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午11:21写道:
>
> The key point is even if I do not wanna use it I must have this
> class,or VFS.getManager() can never run.
>
> IMO this type of class relationship cause the project where hold this
> class must be added into vfs's pom as a dependency, or just move class
> VFS into that project aswell.
>
> Otherwise we should not let the VFS.getManager() rely on this class.
>
> Thanks for finding this class though.
>
> btw I tested 2.4, 2.4 is correct.
>
> Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
> >
> > The class was there in release 2.4.1:
> > https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java.
> > In the next release, 2.5.0, it can indeed no longer be found. A bit of
> > investigating showed that the webdav classes got moved to a new
> > artifact:
> > https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
> >
> > That means you can still use it, you just need to include an extra
> > dependency:
> > https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
> >
> > There's apparently also a Jackrabbit 2 version available:
> > https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
> >
> >
> > On 19/01/2020 11:24, Xeno Amess wrote:
> > > Right now I'm using something like
> > > this to deal with relative files.
> > > But I just think there might be a more elegant way...
> > >
> > > fileSystemManager = new
> > > org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > > fileSystemManager.setLogger(null);
> > > try {
> > >      fileSystemManager.init();
> > >      fileSystemManager.setBaseFile(new File(""));
> > > } catch (FileSystemException e) {
> > >      e.printStackTrace();
> > > }
> > >
> > > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> > >>
> > >> I'm trying to migrate to commons-vfs2 now
> > >> severial things I found not quite right / amazing.
> > >>
> > >> 1.
> > >>   I tested version 2.6.0 and 2.5.0, and I just start at
> > >> VSF.getManager() (of cause I have no additional contfigure or
> > >> something)
> > >>
> > >> It said class not
> > >> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> > >>
> > >> And I looked into your binary jars I get from maven central (2.6.0).
> > >>
> > >> they really do not have that class WebdavFileProvider.
> > >> (even not found that package org.apache.commons.vfs2.provider.webdav)
> > >>
> > >> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
> > >> that is not important)
> > >> It can run now.(and never tell me class not found again)
> > >> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
> > >> All I get is:
> > >> 2.6.0, broken.
> > >> 2.5.0, broken.
> > >> 2.3, fine.
> > >>
> > >> According to the file on github, it said it might be deprecated, so I
> > >> wonder if you already deprecate d it and you just forgotten it?
> > >>
> > >>   btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
> > >> there even do not exist 2.6.0
> > >> But there be a 2.6.0 in maven central.
> > >> really make me confused.
> > >>
> > >> 2.
> > >> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
> > >> We all know slf4j's author really do not care about backward
> > >> maintenance or something.
> > >> His codes are never able to migrate.
> > >> even though, will there be some plan about using reflect or something
> > >> to make vfs2 CAN suit slf4j 2.0?
> > >>
> > >> 3.
> > >> for some reason I need to deal with relative file path.
> > >> Is there any guide about using relative file path in vfs2?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Xeno Amess <xe...@gmail.com>.
The key point is even if I do not wanna use it I must have this
class,or VFS.getManager() can never run.

IMO this type of class relationship cause the project where hold this
class must be added into vfs's pom as a dependency, or just move class
VFS into that project aswell.

Otherwise we should not let the VFS.getManager() rely on this class.

Thanks for finding this class though.

btw I tested 2.4, 2.4 is correct.

Rob Spoor <ap...@icemanx.nl> 于2020年1月19日周日 下午10:00写道:
>
> The class was there in release 2.4.1:
> https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java.
> In the next release, 2.5.0, it can indeed no longer be found. A bit of
> investigating showed that the webdav classes got moved to a new
> artifact:
> https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2
>
> That means you can still use it, you just need to include an extra
> dependency:
> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0
>
> There's apparently also a Jackrabbit 2 version available:
> https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0
>
>
> On 19/01/2020 11:24, Xeno Amess wrote:
> > Right now I'm using something like
> > this to deal with relative files.
> > But I just think there might be a more elegant way...
> >
> > fileSystemManager = new
> > org.apache.commons.vfs2.impl.StandardFileSystemManager();
> > fileSystemManager.setLogger(null);
> > try {
> >      fileSystemManager.init();
> >      fileSystemManager.setBaseFile(new File(""));
> > } catch (FileSystemException e) {
> >      e.printStackTrace();
> > }
> >
> > Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
> >>
> >> I'm trying to migrate to commons-vfs2 now
> >> severial things I found not quite right / amazing.
> >>
> >> 1.
> >>   I tested version 2.6.0 and 2.5.0, and I just start at
> >> VSF.getManager() (of cause I have no additional contfigure or
> >> something)
> >>
> >> It said class not
> >> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
> >>
> >> And I looked into your binary jars I get from maven central (2.6.0).
> >>
> >> they really do not have that class WebdavFileProvider.
> >> (even not found that package org.apache.commons.vfs2.provider.webdav)
> >>
> >> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
> >> that is not important)
> >> It can run now.(and never tell me class not found again)
> >> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
> >> All I get is:
> >> 2.6.0, broken.
> >> 2.5.0, broken.
> >> 2.3, fine.
> >>
> >> According to the file on github, it said it might be deprecated, so I
> >> wonder if you already deprecate d it and you just forgotten it?
> >>
> >>   btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
> >> there even do not exist 2.6.0
> >> But there be a 2.6.0 in maven central.
> >> really make me confused.
> >>
> >> 2.
> >> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
> >> We all know slf4j's author really do not care about backward
> >> maintenance or something.
> >> His codes are never able to migrate.
> >> even though, will there be some plan about using reflect or something
> >> to make vfs2 CAN suit slf4j 2.0?
> >>
> >> 3.
> >> for some reason I need to deal with relative file path.
> >> Is there any guide about using relative file path in vfs2?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Rob Spoor <ap...@icemanx.nl>.
The class was there in release 2.4.1: 
https://github.com/apache/commons-vfs/blob/rel/commons-vfs-2.4.1/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java. 
In the next release, 2.5.0, it can indeed no longer be found. A bit of 
investigating showed that the webdav classes got moved to a new 
artifact: 
https://github.com/apache/commons-vfs/commit/42ff473acbb5363b88f5ab3c5fddbae7b206c1d2

That means you can still use it, you just need to include an extra 
dependency: 
https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit1/2.6.0

There's apparently also a Jackrabbit 2 version available: 
https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2-jackrabbit2/2.6.0


On 19/01/2020 11:24, Xeno Amess wrote:
> Right now I'm using something like
> this to deal with relative files.
> But I just think there might be a more elegant way...
> 
> fileSystemManager = new
> org.apache.commons.vfs2.impl.StandardFileSystemManager();
> fileSystemManager.setLogger(null);
> try {
>      fileSystemManager.init();
>      fileSystemManager.setBaseFile(new File(""));
> } catch (FileSystemException e) {
>      e.printStackTrace();
> }
> 
> Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
>>
>> I'm trying to migrate to commons-vfs2 now
>> severial things I found not quite right / amazing.
>>
>> 1.
>>   I tested version 2.6.0 and 2.5.0, and I just start at
>> VSF.getManager() (of cause I have no additional contfigure or
>> something)
>>
>> It said class not
>> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
>>
>> And I looked into your binary jars I get from maven central (2.6.0).
>>
>> they really do not have that class WebdavFileProvider.
>> (even not found that package org.apache.commons.vfs2.provider.webdav)
>>
>> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
>> that is not important)
>> It can run now.(and never tell me class not found again)
>> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
>> All I get is:
>> 2.6.0, broken.
>> 2.5.0, broken.
>> 2.3, fine.
>>
>> According to the file on github, it said it might be deprecated, so I
>> wonder if you already deprecate d it and you just forgotten it?
>>
>>   btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
>> there even do not exist 2.6.0
>> But there be a 2.6.0 in maven central.
>> really make me confused.
>>
>> 2.
>> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
>> We all know slf4j's author really do not care about backward
>> maintenance or something.
>> His codes are never able to migrate.
>> even though, will there be some plan about using reflect or something
>> to make vfs2 CAN suit slf4j 2.0?
>>
>> 3.
>> for some reason I need to deal with relative file path.
>> Is there any guide about using relative file path in vfs2?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org

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


Re: some questions (/bug?) about commons-vfs2 make me confused.

Posted by Xeno Amess <xe...@gmail.com>.
Right now I'm using something like
this to deal with relative files.
But I just think there might be a more elegant way...

fileSystemManager = new
org.apache.commons.vfs2.impl.StandardFileSystemManager();
fileSystemManager.setLogger(null);
try {
    fileSystemManager.init();
    fileSystemManager.setBaseFile(new File(""));
} catch (FileSystemException e) {
    e.printStackTrace();
}

Xeno Amess <xe...@gmail.com> 于2020年1月19日周日 下午6:08写道:
>
> I'm trying to migrate to commons-vfs2 now
> severial things I found not quite right / amazing.
>
> 1.
>  I tested version 2.6.0 and 2.5.0, and I just start at
> VSF.getManager() (of cause I have no additional contfigure or
> something)
>
> It said class not
> found:org.apache.commons.vfs2.provider.webdav.WebdavFileProvider
>
> And I looked into your binary jars I get from maven central (2.6.0).
>
> they really do not have that class WebdavFileProvider.
> (even not found that package org.apache.commons.vfs2.provider.webdav)
>
> And after I downgrade to 2.3 (I really wonder why 2.3 not 2.3.0 but
> that is not important)
> It can run now.(and never tell me class not found again)
> I dont't want to try 2.4.0. Really bad connection here(I'm in a villige now).
> All I get is:
> 2.6.0, broken.
> 2.5.0, broken.
> 2.3, fine.
>
> According to the file on github, it said it might be deprecated, so I
> wonder if you already deprecate d it and you just forgotten it?
>
>  btw, according to your webpage https://commons.apache.org/proper/commons-vfs/
> there even do not exist 2.6.0
> But there be a 2.6.0 in maven central.
> really make me confused.
>
> 2.
> for using commons-vfs2 I downgrade slf4j from 2.0.0alpha to 1.7.30
> We all know slf4j's author really do not care about backward
> maintenance or something.
> His codes are never able to migrate.
> even though, will there be some plan about using reflect or something
> to make vfs2 CAN suit slf4j 2.0?
>
> 3.
> for some reason I need to deal with relative file path.
> Is there any guide about using relative file path in vfs2?

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