use of org.apache.directory.api.ldap.model.message.AbandonRequestImpl in project directory-ldap-api by apache.
the class InitAbandonRequest method action.
/**
* {@inheritDoc}
*/
public void action(LdapMessageContainer<AbandonRequestDecorator> container) throws DecoderException {
// Create the AbandonRequest LdapMessage instance and store it in the container
AbandonRequest internalAbandonRequest = new AbandonRequestImpl();
internalAbandonRequest.setMessageId(container.getMessageId());
AbandonRequestDecorator abandonRequest = new AbandonRequestDecorator(container.getLdapCodecService(), internalAbandonRequest);
container.setMessage(abandonRequest);
// The current TLV should be a integer
// We get it and store it in MessageId
TLV tlv = container.getCurrentTLV();
BerValue value = tlv.getValue();
if ((value == null) || (value.getData() == null)) {
String msg = I18n.err(I18n.ERR_04075);
LOG.error(msg);
// This will generate a PROTOCOL_ERROR
throw new DecoderException(msg);
}
try {
int abandonnedMessageId = IntegerDecoder.parse(value, 0, Integer.MAX_VALUE);
abandonRequest.setAbandoned(abandonnedMessageId);
if (IS_DEBUG) {
LOG.debug("AbandonMessage Id has been decoded : {}", Integer.valueOf(abandonnedMessageId));
}
container.setGrammarEndAllowed(true);
return;
} catch (IntegerDecoderException ide) {
LOG.error(I18n.err(I18n.ERR_04076, Strings.dumpBytes(value.getData()), ide.getMessage()));
// This will generate a PROTOCOL_ERROR
throw new DecoderException(ide.getMessage(), ide);
}
}
Aggregations