[Biojava-dev] File path problem

Andy Law (RI) andy.law at roslin.ed.ac.uk
Wed Sep 9 10:30:40 UTC 2009


The problem appears not to be in accessing the file - the test code  
generates File objects correctly with the paths escaped to contain %20  
instead of spaces. If I modify the source code of the test so that the  
names of the files are incorrect then the failure is that the File  
object is returned as null. I am confident that this part of the code  
is working.

The problem arises when the biojava code asks for a biojava RAF object  
to be constructed from the File object. RAF is a wrapper around  
java.io.RandomAccessFile, seemingly simply to allow access to the File  
object although java.io.RandomAccessFile does provide access to a  
FileDescriptor. The RAF constructor calls the RandomAccessFile  
constructor passing it the (perfectly valid) File object it was itself  
handed. The failure occurs inside the RandomAccessFile constructor.

I suspect that this occurs in the call to 'open' in the constructor  
which is - obviously - a platform-specific piece of code. Thus we seem  
to have tripped over a bug in the Apple implementation of the JVM.

I will look into this further if/when time permits.

It may be possible to workaround it by manipulating the path in the  
RAF constructor on a platform-by-platform basis but that kind of  
hacking should only be a short-term solution.

On 8 Sep 2009, at 17:08, Mark Fortner wrote:

> Andreas & Andy,
> AFAIK this is a long-standing JVM/OS dependent issue.  The only  
> workaround I know of is to escape the spaces by preceding them with  
> a backslash.
>
> You may be able to create a relative root directory from which all  
> other subdirectories can be resolved.  Andy, do you encounter a  
> problem if you do something like this:
>
> File biojavaHome = new File(".");
>
> in the ~/Desktop/No Time Machine Backup/biojava directory?  Does  
> biojavaHome.exists() return true?
>
> If you don't, then it may be able to resolve subdirectories of the  
> biojavaHome file object.  You might also try to declare a biojava  
> home env variable and use it throughout the unit tests.
>
> The other thing that you might try is the new File(new URI("blah"))  
> constructor.  According to the URI javadoc  it apparently can deal  
> with %20 spaces in file names.
>
> Hope this helps,
>
> Mark
>
> On Tue, Sep 8, 2009 at 2:43 AM, Andy Law (RI) <andy.law at roslin.ed.ac.uk 
> > wrote:
>
> On 7 Sep 2009, at 21:03, Andreas Prlic wrote:
>
> Hi Andy,
>
> Can you send me a few stacktraces / file locations that you are having
> problems with? works fine for me on OSX using eclipse and command line
> mvn...
>
>
>
>
> http://tr.im/y8YT
>
>
> I have lots like this (generated from the command line).
>
> If I move the biojava folder to the Desktop (i.e. at "~/Desktop/ 
> biojava/" rather than "~/Desktop/No Time Machine Backup/biojava/")  
> then the problem goes away.
>
>
>
>
> Later,
>
> Andy
> --------
> Yada, yada, yada...
> The University of Edinburgh is a charitable body, registered in  
> Scotland, with registration number SC005336
> Disclaimer: This e-mail and any attachments are confidential and  
> intended solely for the use of the recipient(s) to whom they are  
> addressed. If you have received it in error, please destroy all  
> copies and inform the sender.
>
>
>
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-dev
>
>
>
> -- 
> Mark Fortner
>
> blog: http://feeds.feedburner.com/jroller/ideafactory

Later,

Andy
--------
Yada, yada, yada...
The University of Edinburgh is a charitable body, registered in  
Scotland, with registration number SC005336
Disclaimer: This e-mail and any attachments are confidential and  
intended solely for the use of the recipient(s) to whom they are  
addressed. If you have received it in error, please destroy all copies  
and inform the sender.






More information about the biojava-dev mailing list