Source:
<code>public StoreInfo get(List<? extends StoreKey> ids, EnumSet<StoreGetOptions> storeGetOptions) throws StoreException { checkStarted(); final Timer.Context context = metrics.getResponse.time(); try { List<BlobReadOptions> readOptions = new ArrayList<BlobReadOptions>(ids.size()); Map<StoreKey, MessageInfo> indexMessages = new HashMap<StoreKey, MessageInfo>(ids.size()); for (StoreKey key : ids) { BlobReadOptions readInfo = index.getBlobReadInfo(key, storeGetOptions); readOptions.add(readInfo); indexMessages.put(key, readInfo.getMessageInfo()); <START> if (config.storeGetAuthorizationCheck && !Utils.validateAuthorization( <END> readInfo.getMessageInfo().getAccountId(), readInfo.getMessageInfo().getContainerId(), key.getAccountId(), key.getContainerId())) { throw new StoreException( "GET authorization failure. Key: " + key.getID() + " Actually accountId: " + readInfo.getMessageInfo().getAccountId() + " Actually containerId: " + readInfo.getMessageInfo() .getContainerId(), StoreErrorCodes.Authorization_Failure); } } MessageReadSet readSet = new StoreMessageReadSet(readOptions); List<MessageInfo> messageInfoList = new ArrayList<MessageInfo>(readSet.count()); for (int i = 0; i < readSet.count(); i++) { messageInfoList.add(indexMessages.get(readSet.getKeyAt(i))); } return new StoreInfo(readSet, messageInfoList); } catch (StoreException e) { throw e; } catch (Exception e) { throw new StoreException("Unknown exception while trying to fetch blobs from store " + dataDir, e, StoreErrorCodes.Unknown_Error); } finally { context.stop(); } }</code><technical_language>I do auth check throw exception if config is true, fire a metric. This "test-run" this, missed corner cases turn config. if (!authCheckOk()) { if (config) { // throw exception } else { // fire metric } }</technical_language>

Target:
public StoreInfo get(List<? extends StoreKey> ids, EnumSet<StoreGetOptions> storeGetOptions) throws StoreException { checkStarted(); final Timer.Context context = metrics.getResponse.time(); try { List<BlobReadOptions> readOptions = new ArrayList<BlobReadOptions>(ids.size()); Map<StoreKey, MessageInfo> indexMessages = new HashMap<StoreKey, MessageInfo>(ids.size()); for (StoreKey key : ids) { BlobReadOptions readInfo = index.getBlobReadInfo(key, storeGetOptions); readOptions.add(readInfo); indexMessages.put(key, readInfo.getMessageInfo()); if (!validateAuthorization(readInfo.getMessageInfo().getAccountId(), readInfo.getMessageInfo().getContainerId(), key.getAccountId(), key.getContainerId())) { if (config.storeValidateAuthorization) { throw new StoreException( "GET authorization failure. Key: " + key.getID() + " Actually accountId: " + readInfo.getMessageInfo() .getAccountId() + " Actually containerId: " + readInfo.getMessageInfo().getContainerId(), StoreErrorCodes.Authorization_Failure); } else { logger.warn("GET authorization failure. Key: Actually accountId: Actually containerId: {}", key.getID(), readInfo.getMessageInfo().getAccountId(), readInfo.getMessageInfo().getContainerId()); metrics.getAuthorizationFailureCount.inc(); } } } MessageReadSet readSet = new StoreMessageReadSet(readOptions); List<MessageInfo> messageInfoList = new ArrayList<MessageInfo>(readSet.count()); for (int i = 0; i < readSet.count(); i++) { messageInfoList.add(indexMessages.get(readSet.getKeyAt(i))); } return new StoreInfo(readSet, messageInfoList); } catch (StoreException e) { throw e; } catch (Exception e) { throw new StoreException("Unknown exception while trying to fetch blobs from store " + dataDir, e, StoreErrorCodes.Unknown_Error); } finally { context.stop(); } }