try {
try {
encodedBlock = innerEncode(context.random, block.uri, block.copyBucket, block.isMetadata, block.compressionCodec, block.sourceLength, compressorDescriptor, block.pre1254, block.cryptoAlgorithm, block.cryptoKey);
b = encodedBlock.getBlock();
} catch (CHKEncodeException e) {
throw new LowLevelPutException(LowLevelPutException.INTERNAL_ERROR, e.toString() + ":" + e.getMessage(), e);
} catch (SSKEncodeException e) {
throw new LowLevelPutException(LowLevelPutException.INTERNAL_ERROR, e.toString() + ":" + e.getMessage(), e);
} catch (MalformedURLException e) {
throw new LowLevelPutException(LowLevelPutException.INTERNAL_ERROR, e.toString() + ":" + e.getMessage(), e);
} catch (InsertException e) {
throw new LowLevelPutException(LowLevelPutException.INTERNAL_ERROR, e.toString() + ":" + e.getMessage(), e);
} catch (IOException e) {
throw new LowLevelPutException(LowLevelPutException.INTERNAL_ERROR, e.toString() + ":" + e.getMessage(), e);
} catch (InvalidCompressionCodecException e) {
throw new LowLevelPutException(LowLevelPutException.INTERNAL_ERROR, e.toString() + ":" + e.getMessage(), e);
}
if (b==null) {
Logger.error(this, "Asked to send empty block", new Exception("error"));
return false;
}
key = encodedBlock.getClientKey();
k = key;
context.getJobRunner(block.persistent).queueNormalOrDrop(new PersistentJob() {
@Override
public boolean run(ClientContext context) {
orig.onEncode(key, context);
return true;
}
});
if(req.localRequestOnly)
try {
core.node.store(b, false, req.canWriteClientCache, true, false);
} catch (KeyCollisionException e) {
LowLevelPutException failed = new LowLevelPutException(LowLevelPutException.COLLISION);
KeyBlock collided = core.node.fetch(k.getNodeKey(), true, req.canWriteClientCache, false, false, null);
if(collided == null) {
Logger.error(this, "Collided but no key?!");
// Could be a race condition.
try {
core.node.store(b, false, req.canWriteClientCache, true, false);
} catch (KeyCollisionException e2) {
Logger.error(this, "Collided but no key and still collided!");
throw new LowLevelPutException(LowLevelPutException.INTERNAL_ERROR, "Collided, can't find block, but still collides!", e);
}
}
failed.setCollidedBlock(collided);
throw failed;
}
else
core.realPut(b, req.canWriteClientCache, req.forkOnCacheable, Node.PREFER_INSERT_DEFAULT, Node.IGNORE_LOW_BACKOFF_DEFAULT, req.realTimeFlag);
} catch (LowLevelPutException e) {