Hi Marc, Thanks for the bug report and for proposing a patch. In order to directly apply your patch, we need you to sign a JCA. This adds some paperwork, but this is important for us. See details here: http://www.restlet.org/community/contribute
Best regards, Jerome 2007/7/25, Marc Portier <[EMAIL PROTECTED]>:
Thierry Boileau wrote: > Hi Marc, > > Thanks a lot for having reported this problem. An issue has been created : > http://restlet.tigris.org/issues/show_bug.cgi?id=337 > ok, thx for confirming this as a defect. I've taken the liberty of adding my proposed fix in patch-format to the issue. I don't have a unit test to go with that though (since to my knowledge Java has no platform independent way of creating symbolic links) regards, -marc= > best regards, > Thierry Boileau >> Hi all, >> >> I'm testing an adapted version of org.restlet.example.tutorial.Part06 >> to make it display a directory listing of my home directory >> >> The changed part looks like this: >> >>> >>> // Create an application >>> Application application = new >>> Application(component.getContext()) { >>> @Override >>> public Restlet createRoot() { >>> final Directory directory = new >>> Directory(getContext(), "file:///home/mpo"); >>> directory.setListingAllowed(true); >>> directory.setIndexName(""); >>> return directory; >>> } >>> }; >> >> I'm running this on a linux system with a symbolic link in >> /home/mpo/mnt to /mnt >> >> This symbolic link outside the directory-resources' root will cause a >> StringIndexOutOfBound on trying to make 'external' uri's for the >> local-references assembled in this.directoryContent: >> >> Since that contains file:////mnt rather then file:////home/mpo/mnt >> substracting the root-uri fails: >> >>> SEVERE: Unhandled exception or error intercepted >>> java.lang.StringIndexOutOfBoundsException: String index out of range: -2 >>> at java.lang.String.substring(String.java:1768) >>> at java.lang.String.substring(String.java:1735) >>> at >>> com.noelios.restlet.local.DirectoryResource.getVariants( DirectoryResource.java:445) >>> >>> at org.restlet.resource.Resource.handleGet(Resource.java:407) >>> at >>> com.noelios.restlet.local.DirectoryResource.handleGet( DirectoryResource.java:254) >>> >> >> The problem is resolved by changing the method at >> org.restlet.data.LocalReference#86 >> >>> public static LocalReference createFileReference(File file) >>> throws IOException { >>> return createFileReference(file.getCanonicalPath()); >>> } >> >> by replacing the 'getCanonicalPath' to 'getAbsolutePath' >> >> >> AFAICS making the reference 'canonical' is outside the responsibility >> of the LocalReference class, but I might be jumping to conclusions here. >> >> kind regards, >> -marc= >>

