Changeset 162

Show
Ignore:
Timestamp:
08/19/09 09:44:30 (2 years ago)
Author:
martijn
Message:

Fixes spurious DataSource? entries.
There was a problem where each call go getByFullName / getBySystemCode
with an empty string would lead to creation of a new DataSource? entry

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/bio/test/org/bridgedb/bio/Test.java

    r135 r162  
    5050        } 
    5151 
     52        public void testInit() 
     53        { 
     54                for (DataSource ds : DataSource.getDataSources()) 
     55                { 
     56                        assertNotNull(ds); 
     57                        assertNotNull(ds.getFullName()); 
     58                        assertNotNull(ds.getSystemCode()); 
     59                } 
     60        } 
     61         
    5262        public void testURN() 
    5363        { 
  • trunk/corelib/src/org/bridgedb/DataSource.java

    r136 r162  
    340340        public static DataSource getBySystemCode(String systemCode) 
    341341        { 
    342                 if (!bySysCode.containsKey(systemCode)) 
     342                if (!bySysCode.containsKey(systemCode) && isSuitableKey(systemCode)) 
    343343                { 
    344344                        register (systemCode, null); 
     
    356356        public static DataSource getByFullName(String fullName) 
    357357        { 
    358                 if (!byFullName.containsKey(fullName)) 
     358                if (!byFullName.containsKey(fullName) && isSuitableKey(fullName)) 
    359359                { 
    360360                        register (null, fullName);