PresentResponse_type presentResponse = (PresentResponse_type) pdu.o;
Records_type recordsType = presentResponse.records;
if (recordsType == null)
{
throw new ProtocolException("Records attribute of present-response PDU is null");
}
if (recordsType.which != Records_type.responserecords_CID)
{
// TODO: care about diagnostic records
throw new ProtocolException("Present-response PDU does not contain response records (maybe diagnostic info)");
}
this.records = new ArrayList<Record>(this.numOfRecords);
for (NamePlusRecord_type namePlusRecordType : (List<NamePlusRecord_type>) recordsType.o)
{
for (RecordDecoder decoder : this.association.getRecordDecoders())
{
if (decoder.decodes(namePlusRecordType))
{
try
{
this.records.add(decoder.decode(namePlusRecordType));
break;
}
catch (RecordFormatException e)
{
throw new ProtocolException("Record format error while parsing present-response PDU", e);
}
}
}
}
}