If the QSO record ends with a lower case "<eor>" it interprets it as another qso field and throws an error for a missing length. According to the ADIF spec this end of record field should be case insensitive.
Log4OM will only accept the uppercase "<EOR>" tag. If there are any lower case characters in the tag it will think it is another QSO field.
If I import the same ADIF into Log4OM from a file it imports just fine.
This one fails using UDP:
" <adif_ver:5>3.1.4 <programid:8>TEST-eor <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS NOT <COMMENT:11>ITS NOT eor <qso_date:8>20230213 <time_on:6>010101 <eor>"
This one succeeds:
" <adif_ver:5>3.1.4 <programid:8>TEST-EOR <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS OK <COMMENT:11>ITS OK EOR <qso_date:8>20230213 <time_on:6>020101 <EOR>"
My current 'workaround' is just to convert any <eor> strings in the ADIF to uppercase which works fine.
Code: Select all
record = record.Replace("<eor>", "<EOR>");
-Mark (KD2QAR)
Code: Select all
/// <summary>
/// This reproduces an observed problem with Log4OM 2 version 2.26.0.0 importing ADIF data from UDP JT message 12
/// If the QSO record ends with a lower case "<eor>" it interprets it as another field and
/// throws an error for a missing length. According to the ADIF spec this end of record field
/// should be case insensitive.
/// Log4OM will only accept the uppercase "<EOR>" tag. If there are any lower case characters
/// in the tag it will think it is another QSO field.
/// If I import the same ADIF from a file it imports just fine.
/// </summary>
[TestMethod]
public void TestBadEoR()
{
byte[] AddUInt32(byte[] bytes, UInt32 i) => bytes.Concat(BitConverter.GetBytes(i).Reverse()).ToArray();
byte[] AddString(byte[] bytes, string i)
{
if (string.IsNullOrEmpty(i))
return bytes.Concat(BitConverter.GetBytes(0xFFFFFFFF).Reverse()).ToArray();
bytes = bytes.Concat(BitConverter.GetBytes((UInt32)(System.Text.UTF32Encoding.UTF8.GetByteCount(i))).Reverse()).ToArray();
bytes = bytes.Concat(System.Text.Encoding.UTF8.GetBytes(i)).ToArray();
return bytes;
}
byte[] Sendbytes(string Id,string adif)
{
byte[] bytes = BitConverter.GetBytes((UInt32)0xadbccbda).Reverse().ToArray();
bytes = AddUInt32(bytes, 3);// SCHEMA
bytes = AddUInt32(bytes, 12);
bytes = AddString(bytes, Id);
bytes = AddString(bytes, adif);
return bytes;
}
UdpClient udpclient = new();
udpclient.Connect("localhost", 2237);
var adif1 = " <adif_ver:5>3.1.4 <programid:8>TEST-eor <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS NOT <COMMENT:11>ITS NOT eor <qso_date:8>20230213 <time_on:6>010101 <eor>";
var adif2 = " <adif_ver:5>3.1.4 <programid:8>TEST-EOR <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS OK <COMMENT:11>ITS OK EOR <qso_date:8>20230213 <time_on:6>020101 <EOR>";
udpclient.Send(Sendbytes("TEST-eor",adif1));
System.Threading.Thread.Sleep(1000);
udpclient.Send(Sendbytes("TEST-EOR",adif2));
}
Code: Select all
2023-02-13 13:31:18.3106 DEBUG: [dje_zVVZ53ZW7FP5B88PCHPHUXDQL3JXQ_ejd][MoveNext] : ##### UDP MESSAGE RECEIVED ##### :
???? TEST-eor ? <adif_ver:5>3.1.4 <programid:8>TEST-eor <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS NOT <COMMENT:11>ITS NOT eor <qso_date:8>20230213 <time_on:6>010101 <eor>
on UDP port 2237 (WSJTX-ROAN/JT_MESSAGE) from 127.0.0.1:65208
#####
2023-02-13 13:31:18.3156 DEBUG: [dje_zBTG68TFNAM356JUTEBZ6GJE65MQQ_ejd][MoveNext] : ???? TEST-eor ? <adif_ver:5>3.1.4 <programid:8>TEST-eor <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS NOT <COMMENT:11>ITS NOT eor <qso_date:8>20230213 <time_on:6>010101 <eor>
2023-02-13 13:31:18.3166 INFO: [dje_zHLBZ327SR5DYGU7VBMHBVGBD4XMQ_ejd] : Begin ADIF QSO import
2023-02-13 13:31:18.3177 DEBUG: [dje_zHLBZ327SR5DYGU7VBMHBVGBD4XMQ_ejd][MoveNext] : <adif_ver:5>3.1.4 <programid:8>TEST-eor <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS NOT <COMMENT:11>ITS NOT eor <qso_date:8>20230213 <time_on:6>010101 <eor>
2023-02-13 13:31:18.3187 ERROR: [dje_zTFDWKKNAYZM5ZDC28AQZ94AR7F2Q_ejd][MoveNext] : Error in QSO import: <eor>
[EXCEPTION] Length cannot be less than zero.
Parameter name: length System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at L4ONG.BL.AdifManagement.dje_zTFDWKKNAYZM5ZDC28AQZ94AR7F2Q_ejd.MoveNext()
2023-02-13 13:31:18.3207 INFO: [dje_zBTG68TFNAM356JUTEBZ6GJE65MQQ_ejd] : {00b6f4c9-60ac-495b-9d00-27ce87fe3bc3} FROM TEST-eor JT Message 12 (ADIF) containing Callsign: Date: 1/1/0001 12:00:00 AM Band: Mode:
2023-02-13 13:31:18.3207 INFO: [dje_zVRT48CL8A2U23D37GUSF2_ejd] : Insufficient data on QSO Callsign: Date: 1/1/0001 12:00:00 AM Band: Mode: . Unable to save
2023-02-13 13:31:19.3179 DEBUG: [dje_zVVZ53ZW7FP5B88PCHPHUXDQL3JXQ_ejd][MoveNext] : ##### UDP MESSAGE RECEIVED ##### :
???? TEST-EOR ? <adif_ver:5>3.1.4 <programid:8>TEST-EOR <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS OK <COMMENT:11>ITS OK EOR <qso_date:8>20230213 <time_on:6>020101 <EOR>
on UDP port 2237 (WSJTX-ROAN/JT_MESSAGE) from 127.0.0.1:65208
#####
2023-02-13 13:31:19.3184 DEBUG: [dje_zBTG68TFNAM356JUTEBZ6GJE65MQQ_ejd][MoveNext] : ???? TEST-EOR ? <adif_ver:5>3.1.4 <programid:8>TEST-EOR <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS OK <COMMENT:11>ITS OK EOR <qso_date:8>20230213 <time_on:6>020101 <EOR>
2023-02-13 13:31:19.3189 INFO: [dje_zHLBZ327SR5DYGU7VBMHBVGBD4XMQ_ejd] : Begin ADIF QSO import
2023-02-13 13:31:19.3194 DEBUG: [dje_zHLBZ327SR5DYGU7VBMHBVGBD4XMQ_ejd][MoveNext] : <adif_ver:5>3.1.4 <programid:8>TEST-EOR <EOH><CALL:6>KD2QAR <BAND:2>2m <MODE:2>FM <NAME:7>ITS OK <COMMENT:11>ITS OK EOR <qso_date:8>20230213 <time_on:6>020101 <EOR>
2023-02-13 13:31:19.3199 DEBUG: * [Countries][SearchCallsign][2632 ms] : Performing Search Callsign on call KD2QAR on date 2/13/2023 2:01:01 AM
2023-02-13 13:31:19.3337 DEBUG: [dje_zJNHB8DUQDUUDKANLX47C9KPTAJT62JAHY2_ejd][MoveNext] : Performing QSO search on callsign KD2QAR