Changeset 441

Show
Ignore:
Timestamp:
08/30/10 16:05:59 (17 months ago)
Author:
martijn
Message:

Fixes NPE when calling xrefExists with null DataSource?

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/benchmarking/test/org/bridgedb/benchmarking/Base.java

    r247 r441  
    1212import org.bridgedb.IDMapperException; 
    1313import org.bridgedb.Xref; 
     14import org.bridgedb.bio.BioDataSource; 
    1415 
    1516import buildsystem.Measure; 
     
    2021{ 
    2122        static final Xref NONEXISTENT = new Xref("123", DataSource.getBySystemCode("??")); 
     23        static final Xref HALFNULL1 = new Xref("123", null); 
     24        static final Xref HALFNULL2 = new Xref(null, BioDataSource.ENTREZ_GENE); 
    2225         
    2326        /** 
     
    4750                // check that xrefexists doesn't lead to exception 
    4851                assertFalse (mapper.xrefExists(NONEXISTENT)); 
     52                assertFalse (mapper.xrefExists(HALFNULL1)); 
     53                assertFalse (mapper.xrefExists(HALFNULL2)); 
    4954                assertTrue (mapper.xrefExists(from)); 
    5055                assertTrue (mapper.xrefExists(to)); 
  • trunk/org.bridgedb.rdb/src/org/bridgedb/rdb/SimpleGdbImplCommon.java

    r318 r441  
    8181        public boolean xrefExists(Xref xref) throws IDMapperException  
    8282        { 
     83                if (xref.getDataSource() == null) return false; 
    8384                final QueryLifeCycle pst = qXrefExists; 
    8485                synchronized (pst) {