Closed robjay closed 6 years ago
In the method: public static UMID fromURN(String urn) (line 45), you have the following (line 52):
umid[4 i + j] = (byte) Integer.parseInt(urn.substring(13 + i 9 + 2 j, 13 + i 9 + 2 * j + 2), 16);
This should be:
umid[4 i + j] = (byte) Integer.parseInt(urn.substring(15 + i 9 + 2 j, 15 + i 9 + 2 * j + 2), 16);
The 13 is starting the position at d: in the string (urn:smpte:umid:) instead of the 1st digit.
Simple Test case:
public void testUMID () { UMID umid1 = UMID.fromURN("urn:smpte:umid:060A2B34.01010105.01010D20.13000000.D2C9036C.8F195343.AB7014D2.D718BFDA"); byte[] value = umid1.getValue(); assertEquals(32, value.length); assertEquals((byte)0x06, value[0]); assertEquals((byte)0x0A, value[1]); assertEquals((byte)0x2B, value[2]); assertEquals((byte)0x34, value[3]); assertEquals((byte)0x01, value[4]); assertEquals((byte)0x01, value[5]); assertEquals((byte)0x01, value[6]); assertEquals((byte)0x05, value[7]); assertEquals((byte)0x01, value[8]); assertEquals((byte)0x01, value[9]); assertEquals((byte)0x0D, value[10]); assertEquals((byte)0x20, value[11]); assertEquals((byte)0x13, value[12]); assertEquals((byte)0x00, value[13]); assertEquals((byte)0x00, value[14]); assertEquals((byte)0x00, value[15]); assertEquals((byte)0xD2, value[16]); assertEquals((byte)0xC9, value[17]); assertEquals((byte)0x03, value[18]); assertEquals((byte)0x6C, value[19]); assertEquals((byte)0x8F, value[20]); assertEquals((byte)0x19, value[21]); assertEquals((byte)0x53, value[22]); assertEquals((byte)0x43, value[23]); assertEquals((byte)0xAB, value[24]); assertEquals((byte)0x70, value[25]); assertEquals((byte)0x14, value[26]); assertEquals((byte)0xD2, value[27]); assertEquals((byte)0xD7, value[28]); assertEquals((byte)0x18, value[29]); assertEquals((byte)0xBF, value[30]); assertEquals((byte)0xDA, value[31]); }
@robjay Thanks for the report. Please review the PR.
In the method: public static UMID fromURN(String urn) (line 45), you have the following (line 52):
umid[4 i + j] = (byte) Integer.parseInt(urn.substring(13 + i 9 + 2 j, 13 + i 9 + 2 * j + 2), 16);
This should be:
umid[4 i + j] = (byte) Integer.parseInt(urn.substring(15 + i 9 + 2 j, 15 + i 9 + 2 * j + 2), 16);
The 13 is starting the position at d: in the string (urn:smpte:umid:) instead of the 1st digit.
Simple Test case: