[Biojava-dev] SystemRegistry.java under Windows

Sicotte, Hugues (NIH/NCI) sicotteh at mail.nih.gov
Wed Apr 16 23:09:13 EDT 2003


>From sheer laziness of typing an
email address, I sent this message
using reply (and delete) and I forgot
to change the subject.

.. so you may have seen this message once before.. but here it is with it's
own title.

-----Original Message-----
From: Sicotte, Hugues (NIH/NCI) 
Sent: Wednesday, April 16, 2003 3:43 PM
To: biojava-dev at biojava.org
Subject: RE: [Biojava-dev] Writing to AceDB with Java


Hi, 
    I submitted a bug report.. and being impatient.. 
I went ahead and fixed it in my own copy..
but the jitterbug system won't allow me to log in
comments as a guest user..
Here is my original submission for bug 21
.. and below the '----------', the additional comments
as well as poking fun at VMS.


by the way .. what I writing is an OBDA compliant
sequence retrieving engine for retrieving small chunks
out of a genome. I had to rewrite from scratch the indexer
to make it work for large genomic sequences.
I'll post when it is all fully tested. the index it
generates can be read by BioJava. (that's what I use
for the retrieval).

Full_Name: Hugues SIcotte
Module: SystemRegistry.java
Version: biojava-live
JavaVer: 1.4
OS: Windows
Submission from: (NULL) (128.231.13.54)


line 86.
in instance() method of System registry
when the protocol is file, then under Windows,
one needs to prepend the url path with the
url host so the filename ends up being
C:\Documents and Settings\sicotteh\.bioinformatics\seqdatabase.ini

.. because the way it is now, Java looks for a file
\Documents and Settings\sicotteh\.bioinformatics\seqdatabase.ini .. which if
I
start my process from another drive.. does not work.

.. the solution is to see if the host is defined.. and prepend the file name
with it.

-----------------------------------------------------------------
Actually the bug is a lot deeper than this.
Any System Registry under Windows will fail to openStream()
because the Windows URI are not compliants.
when getting a windows filename 
from an environment variable (e.g. "user.home")
biojava must do 2 things
before passing it to the URL class.
1. translate all \ to /
2. if the leading character of a path is not
'/', the put a '/' in front.
This will take
C:\test.txt
to /C:/text.txt
this code in org.biojava.directory.SystemRegistry getRegistryPath()
can be inserted in the try block after the if(userHome!=null)

		    if(!userHome.startsWith("/")) {
			// Windows user home should be converted to a valid
URL
			userHome = "/" +userHome;
			userHome = userHome.replace('\\','/');
		    }
The problem is that there is no way to make Windows change the 
way they encode their environment variables.. so the program
HAS to be able to understand the windows filesystem.
I tried it in windows and it works.
.. I can't think of any Unix or MAC case that it would screw up.. and
hopefully noone is using VMS anymore. (in which case the path would start
with
a $ sign .. and the fix I suggested doesn't break anything that wasn't
already broken.. e.g. no VMS support)
_______________________________________________
biojava-dev mailing list
biojava-dev at biojava.org
http://biojava.org/mailman/listinfo/biojava-dev


More information about the biojava-dev mailing list