Commit 1e8a2302 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

identifiers.org uris were not properly parsed

parent 61cc3462
Pipeline #22678 failed with stage
in 12 minutes and 49 seconds
minerva (14.0.10) stable; urgency=medium
* Bug fix: reaction without ports in SBGN crashed upload (#1065)
* Bug fix: annotations using newer identifiers.org uri schema were truncated
by one character (#1191)
-- Piotr Gawron <piotr.gawron@uni.lu> Tue, 27 Feb 2020 10:00:00 +0200
......
......@@ -907,7 +907,11 @@ public enum MiriamType {
if (foundUri.length() >= miriamUri.length()) {
throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri);
}
return new MiriamData(foundType, miriamUri.substring(foundUri.length() + 1));
int uriLength = foundUri.length();
if (!foundUri.endsWith("/")) { // add one character for separator
uriLength++;
}
return new MiriamData(foundType, miriamUri.substring(uriLength));
}
throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri);
}
......
......@@ -93,6 +93,12 @@ public class MiriamTypeTest extends ModelTestFunctions {
assertTrue(new MiriamData(MiriamType.PANTHER, "PTHR19384:SF5").equals(md));
}
@Test
public void testGetMiriamByIdentifiersOrgUri() throws Exception {
MiriamData md = MiriamType.getMiriamByUri("http://identifiers.org/uniprot/P42224");
assertEquals(new MiriamData(MiriamType.UNIPROT, "P42224"), md);
}
@Test(expected = InvalidArgumentException.class)
public void testGetMiriamByInvalidUri() throws Exception {
MiriamType.getMiriamByUri("invalid_uri");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment