/**
* Returns the gene id related to the given identifier (which may be for a
- * gene, transcript or protein)
+ * gene, transcript or protein), or null if none is found
*
* @param identifier
* @return
/**
* Returns the gene id related to the given identifier (which may be for a
- * gene, transcript or protein)
+ * gene, transcript or protein), or null if none is found
*
* @param identifier
* @param objectType
*/
protected String parseGeneId(JSONObject val)
{
+ if (val == null)
+ {
+ return null;
+ }
String geneId = null;
String type = val.get(OBJECT_TYPE).toString();
if (OBJECT_TYPE_GENE.equalsIgnoreCase(type))
{
url = getIdMapUrl(domain, accession, start, end, cdsOrCdna);
br = getHttpResponse(url, null);
- return (parseIdMappingResponse(br, accession, domain));
+ if (br != null)
+ {
+ return (parseIdMappingResponse(br, accession, domain));
+ }
}
return null;
} catch (Throwable t)
}
/**
- * Sends the HTTP request and gets the response as a reader
+ * Sends the HTTP request and gets the response as a reader. Returns null if
+ * the HTTP response code was not 200.
*
* @param url
* @param ids
* in milliseconds
* @return
* @throws IOException
- * if response code was not 200, or other I/O error
*/
protected BufferedReader getHttpResponse(URL url, List<String> ids,
int readTimeout) throws IOException