You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Nicolas Leclerc <nl...@novadeck.com> on 2002/08/28 18:40:46 UTC

excalibur.io.FileUtil.normalize () problems

hi,

i've been looking into this method in order to replace
one i had developed myself, but i came accross several issues
that prevented me to do so.
(please note that i'm using excalibur 4.1 but i checked the CVS repository
and this method hasn't changed.)

first, the javadoc is quite vague about what the method is supposed
to do. does it support relative path or only absolute ones ?
reading the code actually helps but this isn't supposed to be that way.

also, i think that it's bugged.
here are examples of the problems i ran into :
(sourcePath => resultPath)

/dir1/dir2/.. => /dir1/dir2/.. (it's the same if you try /dir/dir/. instead)
dir1/../dir2 => [ArrayOutOfBoundException]
./dir1/ => ./dir1/ (this one could actually be kept this way intentionaly)

obviously, something is wrong.

here are the results i get with my implementation :

/dir1/dir2/.. => /dir1
dir1/../dir2 => dir2
./dir1/ => dir1/

the only drawback that i am aware of is that it's slower than the current
implem when the path doesn't need to be changed, or when result should be null.
otherwise, it's just as fast or faster.

so i'm willing to submit my code for review, and (maybe) replacement.
what do i do ? post it right here ?


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: excalibur.io.FileUtil.normalize () problems

Posted by Peter Donald <pe...@apache.org>.
I applied the fix - thanks for that.

On Thu, 29 Aug 2002 18:51, Nicolas Leclerc wrote:
> > > so i'm willing to submit my code for review, and (maybe) replacement.
> > > what do i do ? post it right here ?
> >
> > That would be great. If you just want to send the relevent method(s) then
> > that would be great. Alternatively you could send a unified patch (-u
> > option) and someone can apply that. Sending a patch is the preferred
> > method and is simple as
> >
> > cvs diff -u FileUtil.java >> patchfile.txt
>
> ok, so here's a file with the method. it's not a patch though.
> also, it's been designed with unix & windows in mind.
> i don't know the specificities of other file systems.

-- 
Cheers,

Peter Donald
"All my life I wanted to be someone; I guess I should have been more 
specific."
-- Jane Wagner


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: excalibur.io.FileUtil.normalize () problems

Posted by Nicolas Leclerc <nl...@novadeck.com>.
> > so i'm willing to submit my code for review, and (maybe) replacement.
> > what do i do ? post it right here ?
> 
> That would be great. If you just want to send the relevent method(s) then that 
> would be great. Alternatively you could send a unified patch (-u option) and 
> someone can apply that. Sending a patch is the preferred method and is simple 
> as
> 
> cvs diff -u FileUtil.java >> patchfile.txt

ok, so here's a file with the method. it's not a patch though.
also, it's been designed with unix & windows in mind.
i don't know the specificities of other file systems.

Re: excalibur.io.FileUtil.normalize () problems

Posted by Peter Donald <pe...@apache.org>.
On Thu, 29 Aug 2002 02:40, Nicolas Leclerc wrote:
> hi,
>
> i've been looking into this method in order to replace
> one i had developed myself, but i came accross several issues
> that prevented me to do so.
> (please note that i'm using excalibur 4.1 but i checked the CVS repository
> and this method hasn't changed.)
>
> first, the javadoc is quite vague about what the method is supposed
> to do. does it support relative path or only absolute ones ?
> reading the code actually helps but this isn't supposed to be that way.
>
> also, i think that it's bugged.
> here are examples of the problems i ran into :
> (sourcePath => resultPath)
>
> /dir1/dir2/.. => /dir1/dir2/.. (it's the same if you try /dir/dir/.
> instead) dir1/../dir2 => [ArrayOutOfBoundException]
> ./dir1/ => ./dir1/ (this one could actually be kept this way intentionaly)
>
> obviously, something is wrong.
>
> here are the results i get with my implementation :
>
> /dir1/dir2/.. => /dir1
> dir1/../dir2 => dir2
> ./dir1/ => dir1/
>
> the only drawback that i am aware of is that it's slower than the current
> implem when the path doesn't need to be changed, or when result should be
> null. otherwise, it's just as fast or faster.
>
> so i'm willing to submit my code for review, and (maybe) replacement.
> what do i do ? post it right here ?

That would be great. If you just want to send the relevent method(s) then that 
would be great. Alternatively you could send a unified patch (-u option) and 
someone can apply that. Sending a patch is the preferred method and is simple 
as

cvs diff -u FileUtil.java >> patchfile.txt


-- 
Cheers,

Peter Donald
A right is not what someone gives you; it's what no one can take from you. 
        -- Ramsey Clark


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>