[Yanel-dev] Bug in Split Path Generator Logic

Balz Schreier balz.schreier at gmail.com
Fri Oct 29 15:26:31 CEST 2010


Hi there,

as the split logic (currently in VirtualFileSystemRepository.splitPath()) is
going to be used by many other virtual file system adapters,
I moved the split logic into a new class so that it can used like a static
factory method.

I did some testing now and observed the following bug:

Let's assume the following configuration:
- include path =3D "/users/"
- splitlength =3D 2
- splitparts =3D 2
- escape character =3D "+" (I dont' fully understand the logic yet, but it
somehow replaces all the "/" in the original string by a "+"). The problem
is only that you can not find the original string anymore in certain cases!!
Example Strings:

Test strings:

       1. /users/hugobosss.xml --> /users/hug/obo/sss.xml

 2. /users/hugo-boss.xml --> /users/hug/o-b/oss.xml

 3. /users/hu-goboss.xml --> /users/hu-/gob/oss.xml

 4.  -->

 5. /users/hugobos/s.xml --> /users/hug/obo/s/s.xml

 6. /users/hugobo/ss.xml --> /users/hug/obo//ss.xml

 7. /users/hugob/oss.xml --> /users/hug/ob+/oss.xml

 8. /users/hugo/boss.xml --> /users/hug/o+b/oss.xml

 9. /users/hug/oboss.xml --> /users/hug/+ob/oss.xml

10. /users/hu/goboss.xml --> /users/hu+/gob/oss.xml

11. /users/h/ugoboss.xml --> /users/h+u/gob/oss.xml

12. /users/hugobos+s.xml --> /users/hug/obo/s+s.xml

13. /users/hugobo+ss.xml --> /users/hug/obo/+ss.xml

14. /users/hugob+oss.xml --> /users/hug/ob+/oss.xml

15. /users/hugo+boss.xml --> /users/hug/o+b/oss.xml

16. /users/hug+oboss.xml --> /users/hug/+ob/oss.xml

17. /users/hu+goboss.xml --> /users/hu+/gob/oss.xml

18. /users/hu+/+g+o/++/boss.xml --> /users/hu+/++g/+o/++/boss.xml

19. /downloads/hugoboss.xml --> /downloads/hugoboss.xml


Issues:
Number 6: a double slash gets saved as a single slash in most OSs. So if you
want to "unsplit" this string, you loose the original "/" in the string!
Overall Issue: If the "escape" character occurs in the original string, it
gets not escaped? It is impossible to construct the original string if it
contained the escape character.

I will fix this in the separate class which implements all the split logic
and will send a patch.

Cheers
Balz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wyona.org/pipermail/yanel-development/attachments/2010102=
9/2e8bac24/attachment.htm


More information about the Yanel-development mailing list