/**
* {@inheritDoc}
*/
public void action( E container ) throws DecoderException
{
TLV tlv = container.getCurrentTLV();
// The Length should not be null
if ( tlv.getLength() == 0 )
{
LOG.error( I18n.err( I18n.ERR_04066 ) );
// This will generate a PROTOCOL_ERROR
throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
}
// Now, let's decode the HostAddress
Asn1Decoder hostAddressDecoder = new Asn1Decoder();
HostAddressContainer hostAddressContainer = new HostAddressContainer();
// Passes the Stream to the decoder
hostAddressContainer.setStream( container.getStream() );
// Decode the HostAddress PDU
try
{
hostAddressDecoder.decode( container.getStream(), hostAddressContainer );
}
catch ( DecoderException de )
{
throw de;
}
// Store the HostAddress in the container
HostAddress hostAddress = hostAddressContainer.getHostAddress();
// Update the expected length for the current TLV
tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
// Update the parent
container.updateParent();
setAddress( hostAddress, container );