[Java] Messages without channel code not supported
The current version of the Vdm.add(String) method does not allow messages with no channel code set. If such message is being parsed, it throws a StringIndexOutOfBoundsException.
Is this an issue in the Vdm class or should a valid message always contain a channel code?
It should gracefully handle not having a channel code, as long as the checksum matches it should parse it. Maybe use 'U' for unknown channel?
Given the following two sentences, it looks like sentence 1 and 2 of a 2 part message with sequential ID of 4. But should they be combined if the channel doesn't match?? Does the channel have to match if it is given?
!BSVDM,2,1,4,A,53@oJeH00001Q2oCC30pK7KV0`4ppF220000000N0P82240Ht520C4p8,0*5D !BSVDM,2,2,4,B,00000000000,2*3A
No, they should not be combined. AIS doesn't split messages between channels.
When feeding messages to the parser they need to be from the same channel and sequence, and in order. I just looked at the C and Java code (for the first time in a long while) and it looks like there is a bug in the Java code. It doesn't check the channel to make sure it matches the existing sequence. I've opened issue #37 for this.