auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public KeyVaultCredentialPolicy(TokenCredential credential) { Objects.requireNonNull(credential); this.credential = credential; this.cache = new ScopeTokenCache((scopes) -> credential.getToken(scopes)); }

Target:
public KeyVaultCredentialPolicy(TokenCredential credential) { Objects.requireNonNull(credential); this.cache = new ScopeTokenCache((scopes) -> credential.getToken(scopes)); }
Source:
private void loadGraph(final File vertexfile, final File edgefile) throws IOException { GraphFactory<SequenceSegment> gfact = new FactoryProducer<SequenceSegment>() .getFactory("JGraphT"); DefaultGraphParser graphParser = new DefaultGraphParser(); graph = graphParser.parseGraph(vertexfile, edgefile, gfact); shout(Message.LOADED, graph, graphParser.getSequences()); repaint(); }

Target:
private void loadGraph(final File vertexfile, final File edgefile) throws IOException { GraphFactory<SequenceSegment> gfact = FactoryProducer.getFactory(); GraphParser graphParser = new DefaultGraphParser(); graph = graphParser.parseGraph(vertexfile, edgefile, gfact); shout(Message.LOADED, graph, graphParser.getSequences()); repaint(); }
Source:
public int getSize() { return ingredients.size(); }

Target:
public int getSize() { return this.ingredients.size(); }
Source:
public InstructorCourseDetailsPage clickDeleteAndCancel(String studentName) { int rowId = getStudentRowId(studentName); if (rowId > -1) { clickAndCancel(getDeleteLink(rowId)); } return this; }

Target:
public InstructorCourseDetailsPage clickDeleteAndCancel(String studentName) { int rowId = getStudentRowId(studentName); clickAndCancel(getDeleteLink(rowId)); return this; }
Source:
@Override public RecordType type() { return RecordType.ENCRYPTED_RECORD_V2; }

Target:
@Override public RecordType type() { return RecordType.ENCRYPTED_RECORD; }
Source:
public static boolean isImage(Context context, Uri uri) { return context.getContentResolver().getType(uri).contains("image"); }

Target:
public static boolean isImage(Context context, Uri uri) { if (uri == null) return false; String mimeType = context.getContentResolver().getType(uri); return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("image/"); }
Source:
public void initialize() throws IOException, RepositoryManagementStrategyException { lock = hazelcastInstance.getLock("StorageBooterLock"); if (lock.tryLock()) { try { final Configuration configuration = configurationManager.getConfiguration(); initializeStorages(configuration.getStorages()); Collection<Repository> repositories = getRepositoriesHierarchy(configuration.getStorages()); if (!repositories.isEmpty()) { logger.info(" -> Initializing repositories..."); } repositories.forEach(ThrowingConsumer.unchecked(this::initializeRepository)); } finally { lock.unlock(); } } else { logger.debug("Failed to initialize the repositories. Another JVM may have already done this."); } }

Target:
public void initialize() throws IOException, RepositoryManagementStrategyException { ILock lock = hazelcastInstance.getLock("StorageBooterLock"); if (lock.tryLock()) { try { final Configuration configuration = configurationManager.getConfiguration(); initializeStorages(configuration.getStorages()); Collection<Repository> repositories = getRepositoriesHierarchy(configuration.getStorages()); if (!repositories.isEmpty()) { logger.info(" -> Initializing repositories..."); } repositories.forEach(ThrowingConsumer.unchecked(this::initializeRepository)); } finally { lock.unlock(); } } else { logger.debug("Failed to initialize the repositories. Another JVM may have already done this."); } }
Source:
public void testDDLWithHashDeprecatedWarning() { String schema1 = "create table test (dummy int); " + "create index hashidx on test(dummy);"; VoltCompiler compiler = new VoltCompiler(false); final boolean success = compileDDL(schema1, compiler); assertTrue(success); assertEquals(1, compiler.m_warnings.size()); String warningMsg = compiler.m_warnings.get(0).getMessage(); String expectedMsg = "Warning: hash indexes are deprecated. In a future release, VoltDB will only support tree indexes, even if the index name contains the string \"hash\""; assertEquals(expectedMsg, warningMsg); }

Target:
public void testDDLWithHashDeprecatedWarning() { String schema = "create table test (dummy int); " + "create index hashidx on test(dummy);"; VoltCompiler compiler = new VoltCompiler(false); final boolean success = compileDDL(schema, compiler); assertTrue(success); assertEquals(1, compiler.m_warnings.size()); String warningMsg = compiler.m_warnings.get(0).getMessage(); String expectedMsg = "Hash indexes are deprecated. In a future release, VoltDB will only support tree indexes, even if the index name contains the string \"hash\""; assertEquals(expectedMsg, warningMsg); }
Source:
private void createBulkNewBranchMenuItem(Menu menu, final Repository[] repositories) { MenuItem newBranch = getNewBranchMenuItem(menu); newBranch.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog(e.display.getActiveShell(), UIText.CreateBranchBulkDialog_Title, UIText.CreateBranchBulkDialog_Description, "", new IInputValidator() { @Override public String isValid(String newBranchName) { return validateNewBulkBranchName(newBranchName, repositories); } }); if (dialog.open() == Window.OK) { String name = dialog.getValue(); try { for (Repository repository : repositories) { Ref ref = repository.getRefDatabase() .findRef(Constants.HEAD); CreateLocalBranchOperation op = new CreateLocalBranchOperation( repository, name, ref, BranchRebaseMode.REBASE); op.execute(null); } BranchOperationUI.checkout(repositories, name).start(); } catch (IOException | CoreException exception) { Activator.logError(UIText.CreateBranchBulkDialog_Error, exception); } } } }); }

Target:
private void createBulkNewBranchMenuItem(Menu menu, final Repository[] repositories) { MenuItem newBranch = getNewBranchMenuItem(menu); newBranch.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog(e.display.getActiveShell(), UIText.CreateBranchBulkDialog_Title, UIText.CreateBranchBulkDialog_Description, "", new IInputValidator() { @Override public String isValid(String newBranchName) { return validateNewBulkBranchName(newBranchName, repositories); } }); if (dialog.open() == Window.OK) { String name = dialog.getValue(); try { for (Repository repository : repositories) { Ref headRef = repository.exactRef(Constants.HEAD); if (headRef != null) { ObjectId headId = headRef.getLeaf() .getObjectId(); RevCommit head = repository.parseCommit(headId); CreateLocalBranchOperation op = new CreateLocalBranchOperation( repository, name, head); op.execute(null); } } BranchOperationUI.checkout(repositories, name).start(); } catch (Exception exception) { Activator.handleError( UIText.CreateBranchBulkDialog_Error, exception, true); } } } }); }
Source:
public void jumpBackTest() { int forward = getRandomSteps(20, 150); int backward = getRandomSteps(1, forward); debuggerSession.step(forward); K debugResult = debuggerSession.backStep(backward).getCurrentK(); K expectedResult = utils.stepRewrite(parsed, Optional.ofNullable(new Integer(forward - backward))); assertEquals("Normal and Debug results don't match, when normal takes 25 steps, and debugger goes back 25 steps", expectedResult, debugResult); }

Target:
public void jumpBackTest() { int forward = getRandomSteps(20, 150); int backward = getRandomSteps(1, forward); debuggerSession.step(forward); K debugResult = trans.apply(debuggerSession.backStep(backward).getCurrentK()); K expectedResult = trans.apply(utils.stepRewrite(parsed, Optional.ofNullable(new Integer(forward - backward)))); assertEquals("Normal and Debug results don't match, when normal takes 25 steps, and debugger goes back 25 steps", expectedResult, debugResult); }
Source:
public PieChart getGlobalPC() { return fGlobalPC; }

Target:
PieChart getGlobalPC() { return fGlobalPC; }
Source:
public static Procedure compileNibbleDeleteProcedure(Table catTable, String procName, Column col, ComparisonConstant comp) { Procedure newCatProc = addProcedure(catTable, procName); String countingQuery = genSelectSql(catTable, col, comp); addStatement(catTable, newCatProc, countingQuery, "0"); String deleteQuery = genDeleteSql(catTable, col, comp); addStatement(catTable, newCatProc, deleteQuery, "1"); String valueAtQuery = genValueAtOffsetSql(catTable, col); addStatement(catTable, newCatProc, valueAtQuery, "2"); return newCatProc; }

Target:
public static Procedure compileNibbleDeleteProcedure(Table catTable, String procName, Column col, ComparisonConstant comp) { Procedure newCatProc = addProcedure(catTable, procName); String countingQuery = genSelectSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, countingQuery, "0"); String deleteQuery = genDeleteSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, deleteQuery, "1"); String valueAtQuery = genValueAtOffsetSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, valueAtQuery, "2"); return newCatProc; }
Source:
protected void applyCurrentLocalFilter() { int nbOfItems = this.ds.getCacheData().length + 1; DataSource dataSource = this.getDataSource(); Integer[] visibleRows = this.getVisibleRows(); DSRequest request = new DSRequest(); request.setStartRow(0); request.setEndRow(nbOfItems + visibleRows[1]); request.setSortBy(this.getSort()); dataSource.fetchData(this.filter, (response, rawData, request1) -> { RecordList recordList = new RecordList(response.getData()); setData(recordList); recordList.destroy(); }, request); }

Target:
protected void applyCurrentLocalFilter() { int nbOfItems = this.ds.getCacheData().length + 1; DataSource dataSource = this.getDataSource(); Integer[] visibleRows = this.getVisibleRows(); DSRequest request = new DSRequest(); request.setStartRow(0); request.setEndRow(nbOfItems + visibleRows[1]); request.setSortBy(this.getSort()); dataSource.fetchData(this.filter, (response, rawData, fetchRequest) -> { RecordList recordList = new RecordList(response.getData()); setData(recordList); recordList.destroy(); }, request); }
Source:
public StateChange getDefaultInstance() { if (defaultInstance.frameBuffersManager == null) { defaultInstance.frameBuffersManager = frameBuffersManager; defaultInstance.fbo = frameBuffersManager.getFBO(DEFAULT_FBO_NAME); } return defaultInstance; }

Target:
public StateChange getDefaultInstance() { return defaultInstance; }
Source:
public void updateStatus(JID jid, String type) throws NodeStoreException { if (!LocalDomainChecker.isLocal(jid.getDomain(), configuration)) { return; } if ((type != null) && type.equals(UNAVAILABLE)) { LOGGER.info("User going offline: " + jid.toString()); if (true == useDatabaseStorage) { channelManager.jidOffline(jid); } else { if (users.containsKey(jid.toBareJID())) { ArrayList<JID> user = users.get(jid.toBareJID()); user.remove(jid); } } return; } if (true == useDatabaseStorage) { channelManager.jidOnline(jid); } else { if (!users.containsKey(jid.toBareJID())) { users.put(jid.toBareJID(), new ArrayList<JID>()); } ArrayList<JID> entry = users.get(jid.toBareJID()); if (!entry.contains(jid)) { entry.add(jid); } } LOGGER.info("User now online: " + jid.toFullJID()); }

Target:
public void updateStatus(JID jid, String type) throws NodeStoreException { if (!LocalDomainChecker.isLocal(jid.getDomain(), configuration)) { return; } ArrayList<JID> user = null; if (users.containsKey(jid.toBareJID())) { user = users.get(jid.toBareJID()); } if ((type != null) && type.equals(UNAVAILABLE)) { LOGGER.info("User going offline: " + jid.toString()); if (true == useDatabaseStorage) { channelManager.jidOffline(jid); } else { if (null != user) { user.remove(jid); } } return; } if (true == useDatabaseStorage) { channelManager.jidOnline(jid); } else { if (null == user) { users.put(jid.toBareJID(), new ArrayList<JID>()); } ArrayList<JID> entry = users.get(jid.toBareJID()); if (!entry.contains(jid)) { entry.add(jid); } } LOGGER.info("User now online: " + jid.toFullJID()); }
Source:
public RefreshToken getAsRefreshToken(){ Map<String, Object> props = new LinkedHashMap<String, Object>(1); String accessTokenID = (String)((Map)this.getAsAccessToken().getExpandedJwt().get("claims")).get("rti"); props.put("href", "/refreshTokens/" + accessTokenID); return getDataStore().instantiate(RefreshToken.class, props); }

Target:
public RefreshToken getAsRefreshToken(){ Map<String, Object> props = new LinkedHashMap<String, Object>(1); String refreshTokenID = (String)((Map)this.getAsAccessToken().getExpandedJwt().get("claims")).get("rti"); props.put("href", "/refreshTokens/" + refreshTokenID); return getDataStore().instantiate(RefreshToken.class, props); }
Source:
public Object caseCall(Call object) { Boolean prematureExitValue = null; if (AND.equals(object.getServiceName())) { prematureExitValue = Boolean.FALSE; } if (OR.equals(object.getServiceName())) { prematureExitValue = Boolean.TRUE; } List<Expression> exprArgs = object.getArguments(); Object result = null; int argc = exprArgs.size(); Object[] args = new Object[argc]; int i = 0; while (result == null && i < argc) { args[i] = doSwitch(exprArgs.get(i)); if (prematureExitValue != null && args[i] != null && args[i].equals(prematureExitValue)) { result = prematureExitValue; } i++; } if (result == null) { switch (object.getType()) { case CALLSERVICE: result = services.call(object.getServiceName(), args, diagnostic); break; case CALLORAPPLY: result = services.callOrApply(object.getServiceName(), args, diagnostic); break; case COLLECTIONCALL: result = services.collectionServiceCall(object.getServiceName(), args, diagnostic); break; default: throw new UnsupportedOperationException("should never happen"); } } return result; }

Target:
public Object caseCall(Call object) { boolean shouldShortcut = false; Boolean shortcutReturnValue = null; if (AND.equals(object.getServiceName())) { shouldShortcut = true; shortcutReturnValue = Boolean.FALSE; } if (OR.equals(object.getServiceName())) { shouldShortcut = true; shortcutReturnValue = Boolean.TRUE; } List<Expression> exprArgs = object.getArguments(); Object result = null; int argc = exprArgs.size(); Object[] args = new Object[argc]; int i = 0; while (result == null && i < argc) { args[i] = doSwitch(exprArgs.get(i)); if (shouldShortcut && args[i] != null && args[i].equals(shortcutReturnValue)) { result = shortcutReturnValue; } i++; } if (result == null) { switch (object.getType()) { case CALLSERVICE: result = services.call(object.getServiceName(), args, diagnostic); break; case CALLORAPPLY: result = services.callOrApply(object.getServiceName(), args, diagnostic); break; case COLLECTIONCALL: result = services.collectionServiceCall(object.getServiceName(), args, diagnostic); break; default: throw new UnsupportedOperationException("should never happen"); } } return result; }
Source:
private void validateDatafeed(DataFeed feed) { DataSource dataSource = null; try { dataSource = getDataSource(feed.getDataSourceId()); } catch (Exception ex) { throw new StorageException("Got exception while validating endpoint.", ex); } if (dataSource == null) { throw new StorageException("Cannot add Datafeed for non existent datasource"); } else if (dataSource.getType() == DataSource.Type.DATASET) { QueryParam qp = new QueryParam("type", feed.getType()); Collection<DataFeed> existing = null; try { existing = listDataFeeds(Collections.singletonList(qp)); } catch (Exception ex) { throw new StorageException("Got excepting while listing data feeds with query param " + qp, ex); } if (!existing.isEmpty()) { throw new StorageException("Datafeed endpoint must be unique for a Dataset"); } } }

Target:
private void validateDatafeed(DataFeed feed) { DataSource dataSource = null; LOG.debug("Validating data feed [{}]", feed); try { dataSource = getDataSource(feed.getDataSourceId()); } catch (Exception ex) { throw new StorageException("Got exception while validating datafeed [" + feed + "]", ex); } if (dataSource == null) { throw new StorageException("Cannot add Datafeed [" + feed + "] for non existent datasource"); } else if (dataSource.getType() == DataSource.Type.DATASET) { QueryParam qp = new QueryParam("type", feed.getType()); Collection<DataFeed> existing = null; try { existing = listDataFeeds(Collections.singletonList(qp)); } catch (Exception ex) { throw new StorageException("Got excepting while listing data feeds with query param " + qp, ex); } if (!existing.isEmpty()) { throw new StorageException("Datafeed type must be unique for a Dataset"); } } }
Source:
public void tearDown() { try { Case.closeCurrentCase(); try { Thread.sleep(2000); } catch (Exception ex) { } FileUtils.deleteDirectory(CASE_DIR); } catch (CaseActionException | IOException ex) { Exceptions.printStackTrace(ex); } assertFalse(CASE_DIR.exists()); }

Target:
public void tearDown() { CaseUtils.closeCase(); CaseUtils.deleteCaseDir(CASE_DIRECTORY_PATH); }
Source:
private void a(char[] pwd, String var) { String variable1 = "blabla"; String variable2 = "login=a&password=xxx"; String variable3 = "login=a&passwd=xxx"; String variable4 = "login=a&pwd=xxx"; String variable5 = "login=a&password="; String variableNameWithPasswordInIt = "xxx"; String variableNameWithPasswdInIt = "xxx"; String variableNameWithPwdInIt = "xxx"; String otherVariableNameWithPasswordInIt; fieldNameWithPasswordInIt = "xx"; fieldNameWithPasswordInIt = retrievePassword(); this.fieldNameWithPasswordInIt = "xx"; this.fieldNameWithPasswordInIt = retrievePassword(); variable1 = "xx"; String[] array = {}; array[0] = "xx"; A myA = new A(); myA.setProperty("password", "xxxxx"); myA.setProperty("passwd", "xxxxx"); myA.setProperty("pwd", "xxxxx"); myA.setProperty("password", new Object()); myA.setProperty("xxxxx", "password"); myA.setProperty(12, "xxxxx"); myA.setProperty(new Object(), new Object()); MyUnknownClass.myUnknownMethod("password", "xxxxx"); PasswordAuthentication pa; pa = new PasswordAuthentication("userName", "1234".toCharArray()); pa = new PasswordAuthentication("userName", pwd); pa = new PasswordAuthentication("userName", getPwd(var)); pa = new PasswordAuthentication("userName", var.toCharArray()); }

Target:
private void a(char[] pwd, String var) { String variable1 = "blabla"; String variable2 = "login=a&password=xxx"; String variable3 = "login=a&passwd=xxx"; String variable4 = "login=a&pwd=xxx"; String variable5 = "login=a&password="; String variableNameWithPasswordInIt = "xxx"; String variableNameWithPasswdInIt = "xxx"; String variableNameWithPwdInIt = "xxx"; String otherVariableNameWithPasswordInIt; fieldNameWithPasswordInIt = "xx"; fieldNameWithPasswordInIt = retrievePassword(); this.fieldNameWithPasswordInIt = "xx"; this.fieldNameWithPasswordInIt = retrievePassword(); variable1 = "xx"; String[] array = {}; array[0] = "xx"; A myA = new A(); myA.setProperty("password", "xxxxx"); myA.setProperty("passwd", "xxxxx"); myA.setProperty("pwd", "xxxxx"); myA.setProperty("password", new Object()); myA.setProperty("xxxxx", "password"); myA.setProperty(12, "xxxxx"); myA.setProperty(new Object(), new Object()); MyUnknownClass.myUnknownMethod("password", "xxxxx"); PasswordAuthentication pa; pa = new PasswordAuthentication("userName", "1234".toCharArray()); pa = new PasswordAuthentication("userName", pwd); pa = new PasswordAuthentication("userName", getPwd(var)); pa = new PasswordAuthentication("userName", var.toCharArray()); OtherPasswordAuthentication opa; opa = new OtherPasswordAuthentication("userName", "1234".toCharArray()); }
Source:
private List<String> createResources(final String prefix, final int count) throws IOException { final var resources = new ArrayList<String>(); for (int i = 0; i < count; i++) { final var response = createObject(prefix + "-" + String.format("%05d", i)); resources.add(getLocation(response)); response.close(); } return resources; }

Target:
private List<String> createResources(final String prefix, final int count) throws IOException { final var resources = new ArrayList<String>(); for (int i = 0; i < count; i++) { try (final CloseableHttpResponse response = createObject(prefix + "-" + String.format("%05d", i))) { resources.add(getLocation(response)); } } return resources; }
Source:
public void unselect() { assertMultiSelect("unselect"); int count = selectionCount(); asyncExec(new VoidResult() { public void run() { String[] items = widget.getSelection(); for (String item : items) { widget.deselect(indexOf(item)); } } }); if (count == 0) { log.debug(MessageFormat.format("Nothing to unselect {0}]", this)); } else { notifySelect(count); } }

Target:
public void unselect() { assertMultiSelect("unselect"); asyncExec(new VoidResult() { public void run() { int[] selectionIndices = widget.getSelectionIndices(); for (int i = 0; i < selectionIndices.length; i++) { widget.deselect(selectionIndices[i]); if (i == 0) { notifySelect(true); } else { notifySelect(false); } } } }); }
Source:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { NetworkCluster networkCluster = getParameters().getNetworkCluster(); getNetworkClusterDAO().remove(getParameters().getVdsGroupId(), networkCluster.getNetworkId()); if (networkCluster.isDisplay()) { getManagementNetworkCluster().setDisplay(true); } if (networkCluster.isMigration()) { getManagementNetworkCluster().setMigration(true); } if (managementNetworkCluster != null) { getNetworkClusterDAO().update(managementNetworkCluster); } return null; } }); if (NetworkHelper.shouldRemoveNetworkFromHostUponNetworkRemoval(getPersistedNetwork(), getVdsGroup().getcompatibility_version())) { removeNetworkFromHosts(); } setSucceeded(true); }

Target:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { NetworkClusterHelper helper = new NetworkClusterHelper(getParameters().getNetworkCluster()); helper.removeNetworkAndReassignRoles(); return null; } }); if (NetworkHelper.shouldRemoveNetworkFromHostUponNetworkRemoval(getPersistedNetwork(), getVdsGroup().getcompatibility_version())) { removeNetworkFromHosts(); } setSucceeded(true); }
Source:
public String[] preferenceNames() { Set<String> namesSet = properties.stringPropertyNames(); String[] names = new String[namesSet.size()]; Iterator<String> it = namesSet.iterator(); for (int i = 0; it.hasNext(); i++) { names[i] = it.next(); } return names; }

Target:
public String[] preferenceNames() { Set<String> names = properties.stringPropertyNames(); return names.toArray(new String[names.size()]); }
Source:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length == 0) { throw new NotEnoughArgumentsException(); } final String warpName = args[0]; final String safeWarpName = StringUtil.safeString(warpName); if (NumberUtil.isInt(warpName) || warpName.isEmpty()) { throw new Exception(tl("invalidWarpName")); } final IWarps warps = ess.getWarps(); Location warpLoc = null; try { warpLoc = warps.getWarp(warpName); } catch (WarpNotFoundException | InvalidWorldException ignored) { } final boolean warpExists = warpLoc != null; final boolean canOverwrite = user.isAuthorized("essentials.warp.overwrite." + safeWarpName); final boolean canCreate = user.isAuthorized("essentials.warp.set." + safeWarpName); if (warpExists && !canOverwrite) { throw new Exception(tl("warpOverwrite")); } if (!warpExists && !canCreate && !canOverwrite) { throw new Exception(tl("warpCreate")); } warps.setWarp(user, warpName, user.getLocation()); user.sendMessage(tl("warpSet", warpName)); }

Target:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length == 0) { throw new NotEnoughArgumentsException(); } final String warpName = args[0]; if (NumberUtil.isInt(warpName) || warpName.isEmpty()) { throw new Exception(tl("invalidWarpName")); } final IWarps warps = ess.getWarps(); Location warpLoc = null; try { warpLoc = warps.getWarp(warpName); } catch (final WarpNotFoundException | InvalidWorldException ignored) { } final boolean warpExists = warpLoc != null; final String safeWarpName = StringUtil.safeString(warpName); final boolean canOverwrite = user.isAuthorized("essentials.warp.overwrite." + safeWarpName); final boolean canCreate = user.isAuthorized("essentials.warp.set." + safeWarpName); if (warpExists && !canOverwrite) { throw new Exception(tl("warpOverwrite")); } if (!warpExists && !canCreate && !canOverwrite) { throw new Exception(tl("warpCanCreate")); } warps.setWarp(user, warpName, user.getLocation()); user.sendMessage(tl("warpSet", warpName)); }
Source:
protected boolean validate() { return isNoLeasesOnStorageDomain() && canDetachStorageDomainWithVmsAndDisks(getStorageDomain()) && canDetachDomain(getParameters().getDestroyingPool(), getParameters().getRemoveLast()); }

Target:
protected boolean validate() { return canDetachStorageDomainWithVmsAndDisks(getStorageDomain()) && canDetachDomain(getParameters().getDestroyingPool(), getParameters().getRemoveLast()) && isNoLeasesOnStorageDomain(); }
Source:
public void testMapCount() { HazelcastInstance hz = createHazelcastInstance(); Node node = getNode(hz); PhoneHome phoneHome = new PhoneHome(node); Map<String, String> parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpct"), "0"); Map<String, String> map1 = hz.getMap("hazelcast"); Map<String, String> map2 = hz.getMap("phonehome"); parameters.clear(); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpct"), "2"); Map<String, String> map3 = hz.getMap("maps"); parameters.clear(); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpct"), "3"); }

Target:
public void testMapCount() { HazelcastInstance hz = createHazelcastInstance(); Node node = getNode(hz); PhoneHome phoneHome = new PhoneHome(node); Map<String, String> parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpct"), "0"); Map<String, String> map1 = hz.getMap("hazelcast"); Map<String, String> map2 = hz.getMap("phonehome"); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpct"), "2"); Map<String, String> map3 = hz.getMap("maps"); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpct"), "3"); }
Source:
protected <K> Object handleWriteManyCommand(InvocationContext ctx, FlagAffectedCommand command, Collection<K> keys, boolean forwarded) throws Throwable { try { Object stage; if (hasSkipLocking(command)) { stage = invokeNext(ctx, command); } else { if (!needRemoteLocks(ctx, keys, command)) { acquireLocalLocks(ctx, command, keys); stage = invokeNext(ctx, command); } else { final TxInvocationContext txContext = (TxInvocationContext) ctx; LockControlCommand lcc = cf.buildLockControlCommand(keys, command.getFlagsBitSet(), txContext.getGlobalTransaction()); stage = invokeNextThenApply(ctx, lcc, (rCtx, rCommand, rv) -> { acquireLocalLocks(rCtx, command, keys); return invokeNext(rCtx, command); }); } } return makeStage(stage).andFinally(ctx, command, (rCtx, rCommand, rv, t) -> { if (t != null) { rethrowAndReleaseLocksIfNeeded(rCtx, t); } }); } catch (Throwable t) { rethrowAndReleaseLocksIfNeeded(ctx, t); throw t; } }

Target:
protected <K> Object handleWriteManyCommand(InvocationContext ctx, FlagAffectedCommand command, Collection<K> keys, boolean forwarded) throws Throwable { try { Object stage; if (hasSkipLocking(command)) { stage = invokeNext(ctx, command); } else { if (!needRemoteLocks(ctx, keys, command)) { acquireLocalLocks(ctx, command, keys); stage = invokeNext(ctx, command); } else { final TxInvocationContext txContext = (TxInvocationContext) ctx; LockControlCommand lcc = cf.buildLockControlCommand(keys, command.getFlagsBitSet(), txContext.getGlobalTransaction()); stage = invokeNextThenApply(ctx, lcc, (rCtx, rCommand, rv) -> { acquireLocalLocks(rCtx, command, keys); return invokeNext(rCtx, command); }); } } return makeStage(stage).andExceptionally(ctx, command, (rCtx, rCommand, t) -> { rethrowAndReleaseLocksIfNeeded(rCtx, t); throw t; }); } catch (Throwable t) { rethrowAndReleaseLocksIfNeeded(ctx, t); throw t; } }
Source:
public Class<?>[] getAdapterList() { return new Class[] { ResourceMapping.class, IFile.class }; }

Target:
public Class<?>[] getAdapterList() { return new Class[] { ResourceMapping.class, IFile.class, IResource.class }; }
Source:
public void onPageUpdated(ApiDatasetLandingPage page, String uri) throws IOException { Dataset dataset = new Dataset(); dataset.setId(page.getapiDatasetId()); Link taxonomyLink = new Link(); taxonomyLink.setHref(uri); DatasetLinks datasetLinks = new DatasetLinks(); datasetLinks.setTaxonomy(taxonomyLink); dataset.setLinks(datasetLinks); try { datasetAPIClient.createDataset(page.getapiDatasetId(), dataset); } catch (DatasetAPIException e) { throw new RuntimeException(e); } }

Target:
public void onPageUpdated(ApiDatasetLandingPage page, String uri) throws IOException { Dataset dataset = new Dataset(); dataset.setId(page.getapiDatasetId()); Link taxonomyLink = new Link(); taxonomyLink.setHref(uri); DatasetLinks datasetLinks = new DatasetLinks(); datasetLinks.setTaxonomy(taxonomyLink); dataset.setLinks(datasetLinks); try { datasetAPIClient.createDataset(page.getapiDatasetId(), dataset); } catch (DatasetAPIException e) { logError(e, "failed to create dataset in the dataset api").log(); throw new RuntimeException(e); } }
Source:
public boolean canDeleteTable(TCredentials c, TableId tableId, NamespaceId namespaceId) throws ThriftSecurityException { String tableName = getTableName(tableId); try { boolean result = super.canDeleteTable(c, tableId, namespaceId); audit(c, result, CAN_DELETE_TABLE_AUDIT_TEMPLATE, tableName); return result; } catch (ThriftSecurityException ex) { audit(c, ex, CAN_DELETE_TABLE_AUDIT_TEMPLATE, tableName); throw ex; } }

Target:
public boolean canDeleteTable(TCredentials c, TableId tableId, NamespaceId namespaceId) throws ThriftSecurityException { String tableName = getTableName(tableId); try { boolean result = super.canDeleteTable(c, tableId, namespaceId); audit(c, result, CAN_DELETE_TABLE_AUDIT_TEMPLATE, tableName, tableId); return result; } catch (ThriftSecurityException ex) { audit(c, ex, CAN_DELETE_TABLE_AUDIT_TEMPLATE, tableName, tableId); throw ex; } }
Source:
public void handleException(@Nullable Throwable exception) { Activator.logError(fMessage, exception); ITmfEvent event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } event = fEventsQueue.take(); } closeStateSystem(); }

Target:
public void handleException(@Nullable Throwable exception) { final RuntimeException rException = (exception instanceof RuntimeException) ? (RuntimeException) exception : new RuntimeException("Error in threaded state history backend", exception); fail(rException); fPropagateExceptions = () -> { throw rException; }; ITmfEvent event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } event = fEventsQueue.take(); } closeStateSystem(); }
Source:
public Map<Long, ILogData> read(Iterable<Long> addresses, @NonNull ReadOptions options) { final Map<Long, ILogData> cachedData = readCache.getAllPresent(addresses); final Set<Long> addressesToFetch = Sets.difference( Sets.newHashSet(addresses), cachedData.keySet()); final Map<Long, ILogData> uncachedData = fetchAll(addressesToFetch, options); final List<Long> trimmedAddresses = filterTrimmedAddresses(uncachedData); final List<Long> holes = filterHoles(uncachedData); trimmedAddresses.forEach(uncachedData::remove); holes.forEach(trimmedAddresses::remove); final Map<Long, ILogData> result = uncachedData.entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> cacheLoadAndGet(readCache, entry.getKey(), entry.getValue(), options))); result.putAll(cachedData); if (!trimmedAddresses.isEmpty()) { if (!options.isIgnoreTrim()) { throw new TrimmedException(trimmedAddresses); } log.warn("read: ignoring trimmed addresses {}", trimmedAddresses); } return result; }

Target:
public Map<Long, ILogData> read(Iterable<Long> addresses, @NonNull ReadOptions options) { final Map<Long, ILogData> cachedData = readCache.getAllPresent(addresses); final Set<Long> addressesToFetch = Sets.difference( Sets.newHashSet(addresses), cachedData.keySet()); final Map<Long, ILogData> uncachedData = fetchAll(addressesToFetch, options); final List<Long> trimmedAddresses = filterTrimmedAddresses(uncachedData); trimmedAddresses.forEach(uncachedData::remove); final Map<Long, ILogData> result = uncachedData.entrySet().stream() .collect(Collectors.toMap(Entry::getKey, entry -> cacheLoadAndGet(readCache, entry.getKey(), entry.getValue(), options))); result.putAll(cachedData); if (!trimmedAddresses.isEmpty()) { if (!options.isIgnoreTrim()) { throw new TrimmedException(trimmedAddresses); } log.debug("read: ignoring trimmed addresses {}", trimmedAddresses); } return result; }
Source:
public TimeSegmentPruner(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { _tableNameWithType = tableConfig.getTableName(); _propertyStore = propertyStore; _segmentZKMetadataPathPrefix = ZKMetadataProvider.constructPropertyStorePathForResource(_tableNameWithType) + "/"; _timeColumn = tableConfig.getValidationConfig().getTimeColumnName(); Preconditions .checkNotNull(_timeColumn, "Time column must be configured in table config for table: %s", _tableNameWithType); Schema schema = ZKMetadataProvider.getTableSchema(_propertyStore, _tableNameWithType); Preconditions.checkState(schema != null, "Failed to find schema for table: %s", _tableNameWithType); DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(_timeColumn); Preconditions.checkNotNull(dateTimeSpec, "Field spec must be specified in schema for time column: %s of table: %s", _timeColumn, _tableNameWithType); DateTimeFormatSpec formatSpec = new DateTimeFormatSpec(dateTimeSpec.getFormat()); _timeUnit = formatSpec.getColumnUnit(); Preconditions .checkNotNull(_timeUnit, "Time unit must be configured in the field spec for time column: %s of table: %s", _timeColumn, _tableNameWithType); _segmentToTimeRangeMSCache = new HashMap<String, Interval>(); }

Target:
public TimeSegmentPruner(TableConfig tableConfig, ZkHelixPropertyStore<ZNRecord> propertyStore) { _tableNameWithType = tableConfig.getTableName(); _propertyStore = propertyStore; _segmentZKMetadataPathPrefix = ZKMetadataProvider.constructPropertyStorePathForResource(_tableNameWithType) + "/"; _timeColumn = tableConfig.getValidationConfig().getTimeColumnName(); Preconditions .checkNotNull(_timeColumn, "Time column must be configured in table config for table: %s", _tableNameWithType); Schema schema = ZKMetadataProvider.getTableSchema(_propertyStore, _tableNameWithType); Preconditions.checkNotNull(schema, "Failed to find schema for table: %s", _tableNameWithType); DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(_timeColumn); Preconditions.checkNotNull(dateTimeSpec, "Field spec must be specified in schema for time column: %s of table: %s", _timeColumn, _tableNameWithType); _timeFormatSpec = new DateTimeFormatSpec(dateTimeSpec.getFormat()); }
Source:
private boolean isRequestFresh(CruiseConfig cruiseConfig) { SCM existingSCM = findSCM(cruiseConfig); return entityHashingService.md5ForEntity(existingSCM, existingSCM.getName()).equals(md5); }

Target:
private boolean isRequestFresh(CruiseConfig cruiseConfig) { SCM existingSCM = findSCM(cruiseConfig); boolean freshRequest = entityHashingService.md5ForEntity(existingSCM, existingSCM.getName()).equals(md5); if (!freshRequest) { result.stale(LocalizedMessage.string("STALE_RESOURCE_CONFIG", "SCM", globalScmConfig.getName())); } return freshRequest; }
Source:
private void writeFile(File path, String contents) throws Exception { PrintWriter out = null; String oldContents = null; try { oldContents = readFile(path); } catch (IOException ex) { oldContents = ""; } if (oldContents.isEmpty() || !oldContents.equals(contents)) { try { out = new PrintWriter(path); out.print(contents); } finally { if (out != null) { try { out.close(); } catch (Exception ex) { ; } } } } }

Target:
private void writeFile(File path, String contents) throws Exception { PrintWriter out = null; String oldContents = null; try { oldContents = readFile(path); } catch (IOException ex) { oldContents = ""; } if (!oldContents.equals(contents)) { try { out = new PrintWriter(path); out.print(contents); } finally { if (out != null) { try { out.close(); } catch (Exception ex) { ; } } } } }
Source:
public List<Long> getDownloadingVideoDmIdsForSection(String enrollmentId, String chapter, String section, final DataCallback<List<Long>> callback) { DbOperationGetColumn<Long> op = new DbOperationGetColumn<Long>(true, DbStructure.Table.DOWNLOADS, new String[]{DbStructure.Column.DM_ID}, DbStructure.Column.DOWNLOADED + "=? AND " + DbStructure.Column.EID + "=? AND " + DbStructure.Column.CHAPTER + "=? AND " + DbStructure.Column.SECTION + "=? AND " + DbStructure.Column.USERNAME + "=?", new String[]{String.valueOf(DownloadedState.DOWNLOADING.ordinal()), enrollmentId, chapter, section, username()}, null, Long.class); op.setCallback(callback); return enqueue(op); }

Target:
public long[] getDownloadingVideoDmIdsForSection(String enrollmentId, String chapter, String section, final DataCallback<List<Long>> callback) { DbOperationGetColumn<Long> op = new DbOperationGetColumn<Long>(true, DbStructure.Table .DOWNLOADS, new String[]{DbStructure.Column.DM_ID}, DbStructure.Column.DOWNLOADED + "=? AND " + DbStructure.Column.EID + "=? AND " + DbStructure.Column.CHAPTER + "=? AND " + DbStructure.Column.SECTION + "=? AND " + DbStructure.Column.USERNAME + "=?", new String[]{String.valueOf(DownloadedState.DOWNLOADING.ordinal()), enrollmentId, chapter, section, username()}, null, Long.class); op.setCallback(callback); List<Long> downloadingList = enqueue(op); if (callback != null) { return null; } else { return ArrayUtils.toPrimitive(downloadingList.toArray(new Long[downloadingList.size()])); } }
Source:
private void resolveConflict(CacheEntry<?, ?> entry, DataWriteCommand command, IracMetadata localMetadata, IracMetadata remoteMetadata) { if (isTraceEnabled()) { getLog().tracef("[IRAC] Conflict found between local and remote metadata: %s and %s", localMetadata, remoteMetadata); } assert !localMetadata.getSite().equals(remoteMetadata.getSite()); if (localMetadata.getSite().compareTo(remoteMetadata.getSite()) < 0) { IracUtils.discardUpdate(getLog(), entry, command, remoteMetadata); return; } setIracMetadata(entry, remoteMetadata); }

Target:
private void resolveConflict(CacheEntry<?, ?> entry, DataWriteCommand command, IracMetadata localMetadata, IracMetadata remoteMetadata) { if (isTraceEnabled()) { getLog().tracef("[IRAC] Conflict found between local and remote metadata: %s and %s", localMetadata, remoteMetadata); } assert !localMetadata.getSite().equals(remoteMetadata.getSite()); if (localMetadata.getSite().compareTo(remoteMetadata.getSite()) < 0) { discardUpdate(entry, command, remoteMetadata); return; } setIracMetadata(entry, remoteMetadata); }
Source:
public static int getFrontCamera() { int index = 0; int numCameras = Camera.getNumberOfCameras(); if (numCameras == 0) { Log.w("BarcodeModule", "No cameras!"); return -1; } while (index < numCameras) { Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(index, cameraInfo); CameraFacing reportedFacing = CameraFacing.values()[cameraInfo.facing]; if (reportedFacing == CameraFacing.FRONT) { break; } index++; } return index; }

Target:
public static int getFrontCamera() { int index = 0; int numCameras = Camera.getNumberOfCameras(); if (numCameras == 0) { Log.w("BarcodeModule", "No cameras!"); return -1; } while (index < numCameras) { Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(index, cameraInfo); CameraFacing reportedFacing = CameraFacing.values()[cameraInfo.facing]; if (reportedFacing == CameraFacing.FRONT) { return index; } index++; } return -1; }
Source:
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { String cname = descriptor.replace("/", "."); if (cname.contains(annotationName)) { return new RepeatedAnnotationVisitor() { HashMap<String, Object> info = new HashMap<>(); @Override public AnnotationVisitor visitArray(String name) { List values = new ArrayList<>(); info.put(name, values); return new AnnotationVisitor(api, this) { @Override public void visit(String dummy, Object value) { if (data.indexOf(info) < 0) { data.add(info); } values.add(value); } }; } @Override public void visit(String name, Object value) { if (data.indexOf(info) < 0) { data.add(info); } info.put(name, value); } @Override public AnnotationVisitor visitAnnotation(String name, String descriptor) { info = new HashMap<>(); return this; } }; } return null; }

Target:
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) { String cname = descriptor.replaceFirst("^L(.*);$", "$1").replace("/", "."); if (cname.equals(annotationName)) { return new DataAnnotationVisitor(data, false); } else if (cname.equals(annotationName + "$Container")) { return new DataAnnotationVisitor(data, true); } return null; }
Source:
private static boolean isJavadocLineEmpty(final String line) { return null != line && "*".equals(line.trim()); }

Target:
private static boolean isJavadocLineEmpty(final String line) { return "*".equals(line.trim()); }
Source:
public void parentCompleted() { synchronized (this) { if (childCompleted) { delegate.onCompleted(); } parentCompleted = true; } }

Target:
public void parentCompleted() { boolean bothCompleted = false; synchronized (this) { if (childCompleted) { bothCompleted = true; } parentCompleted = true; } if (bothCompleted) { delegate.onCompleted(); } }
Source:
public RenderGraph(Context context) { nodeMap = Maps.newHashMap(); graph = GraphBuilder.directed().build(); this.context = context; }

Target:
public RenderGraph(Context context) { nodeMap = Maps.newHashMap(); akaNodeMap = Maps.newHashMap(); graph = GraphBuilder.directed().build(); this.context = context; this.shaderManager = context.get(ShaderManager.class); }
Source:
protected void onMessageReceived(WorkspaceStatusEvent statusEvent) { final String workspaceId = statusEvent.getWorkspaceId(); switch (statusEvent.getEventType()) { case STARTING: onWorkspaceStarting(workspaceId); break; case RUNNING: if (statusEvent.getPrevStatus() == WorkspaceStatus.STARTING) { onWorkspaceStarted(workspaceId); } break; case ERROR: notificationManager.notify(locale.workspaceStartFailed(), FAIL, FLOAT_MODE); loader.setError(LoaderPresenter.Phase.STARTING_WORKSPACE_RUNTIME); final String workspaceName = workspace.getConfig().getName(); final String error = statusEvent.getError(); workspaceServiceClient.getWorkspaces(SKIP_COUNT, MAX_COUNT).then(showErrorDialog(workspaceName, error)); eventBus.fireEvent(new WorkspaceStoppedEvent(workspace)); break; case STOPPING: loader.show(LoaderPresenter.Phase.STOPPING_WORKSPACE); break; case STOPPED: loader.setSuccess(LoaderPresenter.Phase.STOPPING_WORKSPACE); startWorkspaceNotification.show(statusEvent.getWorkspaceId()); eventBus.fireEvent(new WorkspaceStoppedEvent(workspace)); break; case SNAPSHOT_CREATING: loader.show(LoaderPresenter.Phase.CREATING_WORKSPACE_SNAPSHOT); break; case SNAPSHOT_CREATED: loader.setSuccess(LoaderPresenter.Phase.CREATING_WORKSPACE_SNAPSHOT); snapshotCreator.successfullyCreated(); break; case SNAPSHOT_CREATION_ERROR: loader.setError(LoaderPresenter.Phase.CREATING_WORKSPACE_SNAPSHOT); snapshotCreator.creationError("Snapshot creation error: " + statusEvent.getError()); break; } }

Target:
protected void onMessageReceived(WorkspaceStatusEvent statusEvent) { final String workspaceId = statusEvent.getWorkspaceId(); switch (statusEvent.getEventType()) { case STARTING: onWorkspaceStarting(workspaceId); break; case RUNNING: onWorkspaceStarted(workspaceId); break; case ERROR: notificationManager.notify(locale.workspaceStartFailed(), FAIL, FLOAT_MODE); loader.setError(LoaderPresenter.Phase.STARTING_WORKSPACE_RUNTIME); final String workspaceName = workspace.getConfig().getName(); final String error = statusEvent.getError(); workspaceServiceClient.getWorkspaces(SKIP_COUNT, MAX_COUNT).then(showErrorDialog(workspaceName, error)); eventBus.fireEvent(new WorkspaceStoppedEvent(workspace)); eventBus.fireEvent(WsAgentStateEvent.createWsAgentStoppedEvent()); break; case STOPPING: loader.show(LoaderPresenter.Phase.STOPPING_WORKSPACE); break; case STOPPED: loader.setSuccess(LoaderPresenter.Phase.STOPPING_WORKSPACE); startWorkspaceNotification.show(statusEvent.getWorkspaceId()); eventBus.fireEvent(new WorkspaceStoppedEvent(workspace)); eventBus.fireEvent(WsAgentStateEvent.createWsAgentStoppedEvent()); break; case SNAPSHOT_CREATING: loader.show(LoaderPresenter.Phase.CREATING_WORKSPACE_SNAPSHOT); break; case SNAPSHOT_CREATED: loader.setSuccess(LoaderPresenter.Phase.CREATING_WORKSPACE_SNAPSHOT); snapshotCreator.successfullyCreated(); break; case SNAPSHOT_CREATION_ERROR: loader.setError(LoaderPresenter.Phase.CREATING_WORKSPACE_SNAPSHOT); snapshotCreator.creationError("Snapshot creation error: " + statusEvent.getError()); break; } }
Source:
private CompletableFuture<Result> failedAuthentication() { logger.info("Failed authentication"); return completedFuture(unauthorized()); }

Target:
private CompletableFuture<Result> failedAuthentication() { logger.info("Failed authentication"); return completedFuture(unauthorized("Unauthorized")); }
Source:
protected ClientMessage encodeResponse(Object response) { if (response == null) { return MapFetchEntriesCodec.encodeResponse(0, Collections.<Map.Entry<Data, Data>>emptyList()); } MapEntriesWithCursor mapEntriesWithCursor = (MapEntriesWithCursor) response; return MapFetchEntriesCodec.encodeResponse(mapEntriesWithCursor.getNextTableIndexToReadFrom(), (List<Map.Entry<Data, Data>>)(Object)mapEntriesWithCursor.getBatch()); }

Target:
protected ClientMessage encodeResponse(Object response) { if (response == null) { return MapFetchEntriesCodec.encodeResponse(0, Collections.<Map.Entry<Data, Data>>emptyList()); } MapEntriesWithCursor mapEntriesWithCursor = (MapEntriesWithCursor) response; return MapFetchEntriesCodec.encodeResponse(mapEntriesWithCursor.getNextTableIndexToReadFrom(), serializeBatch(mapEntriesWithCursor)); }
Source:
private CompletableFuture<Void> addOperation(Operation<K, V> operation) { if (batch.isEmpty()) { setBatchTimer(batch); } else if (batch.isClosed()) { processBatch(); } batch.addOperation(operation); final CompletableFuture<Void> res = batch.getCompletableFuture(); if (batch.isClosed()) { processBatch(); } return res; }

Target:
private CompletableFuture<Void> addOperation(Operation<K, V> operation) { if (batch == null) { startNewBatch(); } final CompletableFuture<Void> res = batch.addOperation(operation); if (batch.isClosed()) { processBatch(true); } return res; }