{
_logger.debug("executing task: " + this);
}
long capacity = this.getDeviceCapacity();
TransferCDB cdb = (TransferCDB) getCommand().getCommandDescriptorBlock();
long lba = cdb.getLogicalBlockAddress();
long transferLength = cdb.getTransferLength();
// check if transfer would exceed the device size
if (lba < 0 || transferLength < 0 || lba > capacity || (lba + transferLength) > capacity)
{
switch (cdb.getOperationCode())
{
case Write6.OPERATION_CODE :
throw new LogicalBlockAddressOutOfRangeException(true, true, (byte) 4, 1);
default :
throw new LogicalBlockAddressOutOfRangeException(true, true, 2);