auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addMetaAnnotationsToQueue(Deque<AnnotationTypeMapping> queue, AnnotationTypeMapping source) { Annotation[] metaAnnotations = AnnotationsScanner.getDeclaredAnnotations(source.getAnnotationType(), false); for (Annotation metaAnnotation : metaAnnotations) { if (!isMappable(source, metaAnnotation)) { continue; } Annotation[] repeatedAnnotations = this.repeatableContainers .findRepeatedAnnotations(metaAnnotation); if (repeatedAnnotations != null) { for (Annotation repeatedAnnotation : repeatedAnnotations) { addIfPossible(queue, source, repeatedAnnotation); } } else { addIfPossible(queue, source, metaAnnotation); } } }

Target:
private void addMetaAnnotationsToQueue(Deque<AnnotationTypeMapping> queue, AnnotationTypeMapping source) { Annotation[] metaAnnotations = AnnotationsScanner.getDeclaredAnnotations(source.getAnnotationType(), false); for (Annotation metaAnnotation : metaAnnotations) { if (!isMappable(source, metaAnnotation)) { continue; } Annotation[] repeatedAnnotations = this.repeatableContainers .findRepeatedAnnotations(metaAnnotation); if (repeatedAnnotations != null) { for (Annotation repeatedAnnotation : repeatedAnnotations) { if (!isMappable(source, repeatedAnnotation)) { continue; } addIfPossible(queue, source, repeatedAnnotation); } } else { addIfPossible(queue, source, metaAnnotation); } } }
Source:
public int getSelectedIndex() { return selectedIndex.isPresent() ? selectedIndex.get() : -1; }

Target:
public int getSelectedIndex() { return selectedIndex.get(); }
Source:
private static SSLContext getSslContext() { final Boolean check = AccessController.doPrivileged( (PrivilegedAction<Boolean>) () -> (System.getProperty(KEY_STORE) == null || System.getProperty(KEY_STORE_PASS) == null || System.getProperty(TRUST_STORE) == null || System.getProperty(TRUST_STORE_PASS) == null)); if (check) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } final KeyStore[] trustStore = new KeyStore[1]; final KeyStore[] keyStore = new KeyStore[1]; AccessController.doPrivileged( (PrivilegedAction<Object>) () -> { trustStore[0] = getKeyStore( System.getProperty(TRUST_STORE), System.getProperty(TRUST_STORE_PASS)); keyStore[0] = getKeyStore(System.getProperty(KEY_STORE), System.getProperty(KEY_STORE_PASS)); return null; }); SSLContext sslContext = null; try { sslContext = SSLContexts.custom() .loadKeyMaterial( keyStore[0], AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(KEY_STORE_PASS)) .toCharArray()) .loadTrustMaterial(trustStore[0]) .useTLS() .build(); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } sslContext.getDefaultSSLParameters().setNeedClientAuth(true); sslContext.getDefaultSSLParameters().setWantClientAuth(true); return sslContext; }

Target:
private static SSLContext getSslContext() { final Boolean check = AccessController.doPrivileged( (PrivilegedAction<Boolean>) () -> (System.getProperty(KEY_STORE) == null || System.getProperty(KEY_STORE_PASS) == null || System.getProperty(TRUST_STORE) == null || System.getProperty(TRUST_STORE_PASS) == null)); if (check) { throw new IllegalArgumentException("KeyStore and TrustStore system properties must be set."); } final KeyStore[] trustStore = new KeyStore[1]; final KeyStore[] keyStore = new KeyStore[1]; AccessController.doPrivileged( (PrivilegedAction<Object>) () -> { trustStore[0] = getKeyStore( System.getProperty(TRUST_STORE), System.getProperty(TRUST_STORE_PASS)); keyStore[0] = getKeyStore(System.getProperty(KEY_STORE), System.getProperty(KEY_STORE_PASS)); return null; }); SSLContext sslContext = null; try { sslContext = SSLContexts.custom() .loadKeyMaterial( keyStore[0], AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(KEY_STORE_PASS)) .toCharArray()) .loadTrustMaterial(trustStore[0]) .useTLS() .build(); sslContext.getDefaultSSLParameters().setNeedClientAuth(true); sslContext.getDefaultSSLParameters().setWantClientAuth(true); } catch (UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to use javax.net.ssl.keyStorePassword to load key material to create SSL context for Solr client."); } return sslContext; }
Source:
History parse(File file, Repository repos, String sinceRevision) throws HistoryException { myDir = repos.getDirectoryName() + File.separator; repository = (GitRepository) repos; RenamedFilesParser parser = new RenamedFilesParser(); try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } if (RuntimeEnvironment.getInstance().isHandleHistoryOfRenamedFiles()) { executor = repository.getRenamedFilesExecutor(file, sinceRevision); status = executor.exec(true, parser); if (status != 0) { throw new HistoryException("Failed to get renamed files for: \"" + file.getAbsolutePath() + "\" Exit code: " + status); } } } catch (IOException e) { throw new HistoryException("Failed to get history for: \"" + file.getAbsolutePath() + "\"", e); } return new History(entries, parser.getRenamedFiles()); }

Target:
History parse(File file, Repository repos, String sinceRevision) throws HistoryException { myDir = repos.getDirectoryName() + File.separator; repository = (GitRepository) repos; RenamedFilesParser parser = new RenamedFilesParser(); try { Executor executor = repository.getHistoryLogExecutor(file, sinceRevision); int status = executor.exec(true, this); if (status != 0) { throw new HistoryException( String.format("Failed to get history for: \"%s\" Exit code: %d", file.getAbsolutePath(), status)); } if (RuntimeEnvironment.getInstance().isHandleHistoryOfRenamedFiles()) { executor = repository.getRenamedFilesExecutor(file, sinceRevision); status = executor.exec(true, parser); if (status != 0) { throw new HistoryException( String.format("Failed to get renamed files for: \"%s\" Exit code: %d", file.getAbsolutePath(), status)); } } } catch (IOException e) { throw new HistoryException( String.format("Failed to get history for: \"%s\"", file.getAbsolutePath()), e); } return new History(entries, parser.getRenamedFiles()); }
Source:
public boolean hasPhysMemoryToRunVM(VDS curVds, VM vm, int pendingMemory) { boolean retVal = false; if (curVds.getMemFree() != null && curVds.getGuestOverhead() != null) { double vmMemRequired = vm.getMemSizeMb() + curVds.getGuestOverhead(); double vdsMemLimit = curVds.getMemFree() - pendingMemory; log.debug("hasPhysMemoryToRunVM: host '{}'; free memory is : MB (+ MB pending); free swap is: MB, required memory is MB; Guest overhead MB", curVds.getName(), vdsMemLimit, pendingMemory, curVds.getSwapFree(), vmMemRequired, curVds.getGuestOverhead()); if (curVds.getSwapFree() != null) { vdsMemLimit += curVds.getSwapFree(); } log.debug("{} <= ??? {}", vmMemRequired, vdsMemLimit); retVal = (vmMemRequired <= vdsMemLimit); } return retVal; }

Target:
public boolean hasPhysMemoryToRunVM(VDS curVds, VM vm, int pendingMemory) { if (curVds.getMemFree() != null && curVds.getGuestOverhead() != null) { double vmMemRequired = vm.getMemSizeMb() + curVds.getGuestOverhead(); double vdsMemLimit = curVds.getMemFree() - pendingMemory; log.debug("hasPhysMemoryToRunVM: host '{}'; free memory is : MB (+ MB pending); free swap is: MB, required memory is MB; Guest overhead MB", curVds.getName(), vdsMemLimit, pendingMemory, curVds.getSwapFree(), vmMemRequired, curVds.getGuestOverhead()); if (curVds.getSwapFree() != null) { vdsMemLimit += curVds.getSwapFree(); } log.debug("{} <= ??? {}", vmMemRequired, vdsMemLimit); return (vmMemRequired <= vdsMemLimit); } else { return false; } }
Source:
public static FluidActionResult tryPlaceFluid(@Nullable EntityPlayer player, World world, BlockPos pos, @Nonnull ItemStack container, FluidStack resource) { if (world == null || resource == null || pos == null) { return FluidActionResult.FAILURE; } Fluid fluid = resource.getFluid(); if (fluid == null || !fluid.canBePlacedInWorld()) { return FluidActionResult.FAILURE; } IBlockState destBlockState = world.getBlockState(pos); Material destMaterial = destBlockState.getMaterial(); boolean isDestNonSolid = !destMaterial.isSolid(); boolean isDestReplaceable = destBlockState.getBlock().isReplaceable(world, pos); if (!world.isAirBlock(pos) && !isDestNonSolid && !isDestReplaceable) { return FluidActionResult.FAILURE; } if (world.provider.doesWaterVaporize() && fluid.doesVaporize(resource)) { fluid.vaporize(player, world, pos, resource); return tryEmptyContainer(container, new VoidFluidHandler(), Integer.MAX_VALUE, player, true); } else { if (!world.isRemote && (isDestNonSolid || isDestReplaceable) && !destMaterial.isLiquid()) { world.destroyBlock(pos, true); } IFluidHandler handler = getPlacementFluidHandler(world, pos, fluid); FluidActionResult result = tryEmptyContainer(container, handler, Integer.MAX_VALUE, player, true); if (result.isSuccess()) { SoundEvent soundevent = fluid.getEmptySound(resource); world.playSound(player, pos, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); } return result; } }

Target:
public static FluidActionResult tryPlaceFluid(@Nullable EntityPlayer player, World world, BlockPos pos, @Nonnull ItemStack container, FluidStack resource) { if (world == null || resource == null || pos == null) { return FluidActionResult.FAILURE; } Fluid fluid = resource.getFluid(); if (fluid == null || !fluid.canBePlacedInWorld()) { return FluidActionResult.FAILURE; } IBlockState destBlockState = world.getBlockState(pos); Material destMaterial = destBlockState.getMaterial(); boolean isDestNonSolid = !destMaterial.isSolid(); boolean isDestReplaceable = destBlockState.getBlock().isReplaceable(world, pos); if (!world.isAirBlock(pos) && !isDestNonSolid && !isDestReplaceable) { return FluidActionResult.FAILURE; } if (world.provider.doesWaterVaporize() && fluid.doesVaporize(resource)) { fluid.vaporize(player, world, pos, resource); return tryEmptyContainer(container, new VoidFluidHandler(), Integer.MAX_VALUE, player, true); } else { if (!world.isRemote && (isDestNonSolid || isDestReplaceable) && !destMaterial.isLiquid()) { world.destroyBlock(pos, true); } Block block = fluid.getBlock(); IFluidHandler handler; if (block instanceof IFluidBlock) { handler = new FluidBlockWrapper((IFluidBlock) block, world, pos); } else if (block instanceof BlockLiquid) { handler = new BlockLiquidWrapper((BlockLiquid) block, world, pos); } else { handler = new BlockWrapper(block, world, pos); } FluidActionResult result = tryEmptyContainer(container, handler, Integer.MAX_VALUE, player, true); if (result.isSuccess()) { SoundEvent soundevent = fluid.getEmptySound(resource); world.playSound(player, pos, soundevent, SoundCategory.BLOCKS, 1.0F, 1.0F); } return result; } }
Source:
private void scheduleCheckStatus() { if (urlInitialized && reportBaseUrl.trim().isEmpty()) { return; } if (scheduledStatusCheckInProgress) { return; } scheduledStatusCheckInProgress = true; Scheduler.get().scheduleFixedDelay( new Scheduler.RepeatingCommand() { @Override public boolean execute() { if (retryCount > MAX_RETRY_COUNTS || reportsWebappDeployed) { scheduledStatusCheckInProgress = false; return false; } retryCount++; checkReportsWebAppStatus(); return true; } }, RETRY_INTERVAL); }

Target:
private void scheduleCheckStatus() { if (scheduledStatusCheckInProgress || reportsWebappDeployed) { return; } scheduledStatusCheckInProgress = true; Scheduler.get().scheduleFixedDelay( new Scheduler.RepeatingCommand() { @Override public boolean execute() { if (retryCount > MAX_RETRY_COUNTS || reportsWebappDeployed) { scheduledStatusCheckInProgress = false; return false; } retryCount++; checkReportsWebAppStatus(); return true; } }, RETRY_INTERVAL); }
Source:
void removeConnection(String connectionId) { if (availableConnections.remove(connectionId)) { availableCount--; } poolCount--; }

Target:
void removeConnection(String connectionId) { availableConnections.remove(connectionId); poolCount--; }
Source:
private void loadYolo() { log.info("loadYolo - begin"); log.info("Staritng yolo download verification"); checkFiles(); log.info("Completed downloading yolo model"); net = readNetFromDarknet(darknetHome + File.separator + modelConfig, darknetHome + File.separator + modelWeights); log.info("Loaded yolo darknet model to opencv"); try { classNames = loadClassNames(darknetHome + File.separator + modelNames); } catch (IOException e) { log.warn("Error unable to load class names from file {}", modelNames, e); return; } log.info("Done loading model.."); log.info("loadYolo - end"); }

Target:
private void loadYolo() { log.info("loadYolo - begin"); try { net = readNetFromDarknet(darknetHome + File.separator + modelConfig, darknetHome + File.separator + modelWeights); log.info("Loaded yolo darknet model to opencv"); } catch (Exception e) { log.error("readNetFromDarknet could not read", e); return; } try { classNames = loadClassNames(darknetHome + File.separator + modelNames); } catch (IOException e) { log.warn("Error unable to load class names from file {}", modelNames, e); return; } log.info("Done loading model.."); log.info("loadYolo - end"); }
Source:
public FunctionModel(SedModel sedModel) { this.sedModel = sedModel; StackedStarTable stackedTable = new StackedStarTable(sedModel.getDataTables(), new SegmentColumnInfoMatcher()); stackedTable.setName(sedModel.getSedLayerModel().getSuffix()); try { int col; ColumnIdentifier colId = new ColumnIdentifier(stackedTable); col = colId.getColumnIndex(SegmentColumn.Column.Spectral_Value.name()); sortedStackedStarTable = new SortedStarTable(stackedTable, col, true); sortedStackedStarTable.setName(stackedTable.getName()+FUNCTION_SUFFIX); } catch (IOException ex) { Logger.getLogger(FunctionModel.class.getName()).log(Level.SEVERE, null, ex); } }

Target:
public FunctionModel(SedModel sedModel) { setSedModel(sedModel); }
Source:
private static Set<Annotation> inspectQualifiedCarrier(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(anno -> anno instanceof Qualified) .map(Qualified.class::cast) .map(Qualified::value) .flatMap(Arrays::stream) .map(AnnotationFactory::create) .collect(toSet()); }

Target:
private static Set<Annotation> inspectQualifiedCarrier(AnnotatedElement element) { return Arrays.stream(element.getAnnotations()) .filter(Qualified.class::isInstance) .map(Qualified.class::cast) .map(Qualified::value) .flatMap(Arrays::stream) .map(AnnotationFactory::create) .collect(toSet()); }
Source:
private void addCpuPinning(final String compatibilityVersion) { final String cpuPinning = vm.getCpuPinning(); if (StringUtils.isNotEmpty(cpuPinning) && Boolean.TRUE.equals(Config.<Boolean> GetValue(ConfigValues.CpuPinningEnabled, compatibilityVersion)) && cpuPinning != null) { final XmlRpcStruct pinDict = new XmlRpcStruct(); for (String pin : cpuPinning.split("_")) { final String[] split = pin.split("#"); pinDict.add(split[0], split[1]); } createInfo.add(VdsProperties.cpuPinning, pinDict); } }

Target:
private void addCpuPinning(final String compatibilityVersion) { final String cpuPinning = vm.getCpuPinning(); if (StringUtils.isNotEmpty(cpuPinning) && Boolean.TRUE.equals(Config.<Boolean> GetValue(ConfigValues.CpuPinningEnabled, compatibilityVersion))) { final XmlRpcStruct pinDict = new XmlRpcStruct(); for (String pin : cpuPinning.split("_")) { final String[] split = pin.split("#"); pinDict.add(split[0], split[1]); } createInfo.add(VdsProperties.cpuPinning, pinDict); } }
Source:
private static ValueCounts getValueCounts(QuickAndDirtyXlsxReader workbook, String tableName, String fieldName) { Sheet tableSheet = null; String targetSheetName = Table.createSheetNameFromTableName(tableName); for (Sheet sheet : workbook) { if (sheet.getName().equals(targetSheetName)) { tableSheet = sheet; break; } } if (tableSheet == null) { return new ValueCounts(); } Iterator<org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row> iterator = tableSheet.iterator(); org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row header = iterator.next(); int index = header.indexOf(fieldName); ValueCounts valueCounts = new ValueCounts(); if (index != -1) while (iterator.hasNext()) { org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row row = iterator.next(); if (row.size() > index) { String value = row.get(index); String count; if (row.size() > index + 1) { count = row.get(index + 1); } else { count = ""; } if (value.equals("") && count.equals("")) { break; } try { valueCounts.add(value, (int) (Double.parseDouble(count))); } catch (NumberFormatException e) { } } } return valueCounts; }

Target:
private static ValueCounts getValueCounts(QuickAndDirtyXlsxReader workbook, String tableName, String fieldName) { String targetSheetName = Table.createSheetNameFromTableName(tableName); Sheet tableSheet = workbook.getByName(targetSheetName); if (tableSheet == null) { return new ValueCounts(); } Iterator<org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row> iterator = tableSheet.iterator(); org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row header = iterator.next(); int index = header.indexOf(fieldName); ValueCounts valueCounts = new ValueCounts(); if (index != -1) while (iterator.hasNext()) { org.ohdsi.utilities.files.QuickAndDirtyXlsxReader.Row row = iterator.next(); if (row.size() > index) { String value = row.get(index); String count; if (row.size() > index + 1) { count = row.get(index + 1); } else { count = ""; } if (value.equals("") && count.equals("")) { break; } try { valueCounts.add(value, (int) Double.parseDouble(count)); } catch (NumberFormatException e) { } } } return valueCounts; }
Source:
public void recompile() { TIntIntIterator it = disposalAction.shaderPrograms.iterator(); while (it.hasNext()) { it.advance(); GL20.glDeleteProgram(it.value()); } disposalAction.shaderPrograms.clear(); uniformLocationMap.clear(); bindMap.clear(); disposalAction.shaderPrograms.put(0, shader.linkShaderProgram(0)); for (Set<ShaderProgramFeature> permutation : Sets.powerSet(shader.getAvailableFeatures())) { int featureMask = ShaderProgramFeature.getBitset(permutation); disposalAction.shaderPrograms.put(featureMask, shader.linkShaderProgram(featureMask)); } if (shaderParameters != null) { shaderParameters.initialParameters(this); } for (Map.Entry<String, Texture> entry : materialData.getTextures().entrySet()) { setTexture(entry.getKey(), entry.getValue()); } for (Map.Entry<String, Texture> entry : materialData.getTextures().entrySet()) { setTexture(entry.getKey(), entry.getValue()); } for (Map.Entry<String, Float> entry : materialData.getFloatParams().entrySet()) { setFloat(entry.getKey(), entry.getValue()); } for (Map.Entry<String, Integer> entry : materialData.getIntegerParams().entrySet()) { setInt(entry.getKey(), entry.getValue()); } for (Map.Entry<String, float[]> entry : materialData.getFloatArrayParams().entrySet()) { switch (entry.getValue().length) { case 1: setFloat(entry.getKey(), entry.getValue()[0]); break; case 2: setFloat2(entry.getKey(), entry.getValue()[0], entry.getValue()[1]); break; case 3: setFloat3(entry.getKey(), entry.getValue()[0], entry.getValue()[1], entry.getValue()[2]); break; case 4: setFloat4(entry.getKey(), entry.getValue()[0], entry.getValue()[1], entry.getValue()[2], entry.getValue()[3]); break; default: logger.error("MaterialData contains float array entry of size > 4"); break; } } }

Target:
public void recompile() { TIntIntIterator it = disposalAction.shaderPrograms.iterator(); while (it.hasNext()) { it.advance(); GL20.glDeleteProgram(it.value()); } disposalAction.shaderPrograms.clear(); uniformLocationMap.clear(); bindMap.clear(); disposalAction.shaderPrograms.put(0, shader.linkShaderProgram(0)); for (Set<ShaderProgramFeature> permutation : Sets.powerSet(shader.getAvailableFeatures())) { int featureMask = ShaderProgramFeature.getBitset(permutation); disposalAction.shaderPrograms.put(featureMask, shader.linkShaderProgram(featureMask)); } if (shaderParameters != null) { shaderParameters.initialParameters(this); } rebindVaribles(materialData); }
Source:
public void write(JsonWriter out, T value) throws IOException { JsonElement element = delegate.toJsonTree(value); JsonObject jsonObject = element.getAsJsonObject(); URI problemType = Optional.ofNullable(jsonObject.remove("type")) .map(TypeURIAdapter.INSTANCE::fromJsonTree).get(); jsonObject.add("type", TypeURIAdapter.INSTANCE.toJsonTree(problemType)); if (value instanceof AbstractThrowableProblem) { Optional.ofNullable(jsonObject.remove("parameters")) .map(JsonElement::getAsJsonObject) .ifPresent(params -> params.keySet().forEach(k -> jsonObject.add(k, params.get(k)))); } if (value instanceof Throwable) { jsonObject.remove("detailMessage"); jsonObject.remove("suppressedExceptions"); Optional.ofNullable(jsonObject.remove("stackTrace")) .filter(s -> stackTraces) .ifPresent(s -> { TypeAdapter<StackTraceElement[]> traceAdapter = gson.getAdapter(StackTraceElement[].class); StackTraceElement[] readTraces = traceAdapter.fromJsonTree(s); TypeAdapter<String[]> arrayAdapter = gson.getAdapter(String[].class); String[] traceArray = Arrays.stream(readTraces) .map(StackTraceElement::toString) .toArray(String[]::new); JsonElement stackTraceElement = arrayAdapter.toJsonTree(traceArray); jsonObject.add("stacktrace", stackTraceElement); }); } Streams.write(element, out); }

Target:
public void write(JsonWriter out, T value) throws IOException { JsonElement element = delegate.toJsonTree(value); JsonObject jsonObject = element.getAsJsonObject(); URI problemType = TYPE.fromJsonTree(jsonObject.remove("type")); serializeType(jsonObject, problemType); if (value instanceof AbstractThrowableProblem) { Optional.ofNullable(jsonObject.remove("parameters")) .map(JsonElement::getAsJsonObject) .ifPresent(params -> params.entrySet().forEach(e -> jsonObject.add(e.getKey(), e.getValue()))); } if (value instanceof Throwable) { jsonObject.remove("detailMessage"); jsonObject.remove("suppressedExceptions"); jsonObject.remove("stackTrace"); serializeStackTrace(jsonObject, (Throwable) value); } Streams.write(element, out); }
Source:
public <X> CompletableFuture<X> send(SessionID sessionId, Command<X> command) { long id = NEXT_ID.getAndIncrement(); CompletableFuture<X> result = new CompletableFuture<>(); if (command.getSendsResponse()) { methodCallbacks.put(id, input -> { X value = command.getMapper().apply(input); result.complete(value); }); } ImmutableMap.Builder<String, Object> serialized = ImmutableMap.builder(); serialized.put("id", id); serialized.put("method", command.getMethod()); serialized.put("params", command.getParams()); if (sessionId != null) { serialized.put("sessionId", sessionId); } LOG.finest(JSON.toJson(serialized.build())); socket.sendText(JSON.toJson(serialized.build())); if (!command.getSendsResponse() ) { result.complete(null); } return result; }

Target:
public <X> CompletableFuture<X> send(SessionID sessionId, Command<X> command) { long id = NEXT_ID.getAndIncrement(); CompletableFuture<X> result = new CompletableFuture<>(); if (command.getSendsResponse()) { methodCallbacks.put(id, input -> { X value = command.getMapper().apply(input); result.complete(value); }); } ImmutableMap.Builder<String, Object> serialized = ImmutableMap.builder(); serialized.put("id", id); serialized.put("method", command.getMethod()); serialized.put("params", command.getParams()); if (sessionId != null) { serialized.put("sessionId", sessionId); } LOG.info(JSON.toJson(serialized.build())); socket.sendText(JSON.toJson(serialized.build())); if (!command.getSendsResponse() ) { result.complete(null); } return result; }
Source:
public static <T, B> Function<Type, PojoProperties<T>> immutable(Class<T> defn, Supplier<B> builder) { return t -> (PojoProperties<T>) IMMUTABLE_PROPERTIES.computeIfAbsent(t, x -> new ImmutablePojoProperties<>(t, defn, builder)); }

Target:
public static <T, B> Function<Type, PojoProperties<?>> immutable(Class<T> defn, Supplier<B> builder) { return t -> (PojoProperties<T>) IMMUTABLE_PROPERTIES.computeIfAbsent(t, x -> new ImmutablePojoProperties<>(t, defn, builder)); }
Source:
public void testSetQueryWindowBackward() { List<String> versionList = new ArrayList<>(); versionList.add("5-44"); Calendar cal = new GregorianCalendar(); cal.set(2016, 4, 7, 15, 30, 12); long startTime = cal.getTimeInMillis(); cal.add(Calendar.DAY_OF_MONTH, 3); long endTime = cal.getTimeInMillis(); AdminLogQuery query = new AdminLogQuery(versionList, startTime, endTime); Long fourHours = Long.valueOf(4 * 60 * 60 * 1000); query.moveTimePeriodBackward(fourHours); long expectedEndTime = startTime - 1; long expectedStartTime = expectedEndTime - fourHours; assertEquals(expectedStartTime, query.getStartTime()); assertEquals(expectedEndTime, query.getEndTime()); assertEquals(expectedStartTime, query.getQuery().getStartTimeMillis().longValue()); assertEquals(expectedEndTime, query.getQuery().getEndTimeMillis().longValue()); }

Target:
public void testSetQueryWindowBackward() { List<String> versionList = new ArrayList<>(); versionList.add("5-44"); Calendar cal = new GregorianCalendar(); cal.set(2016, 4, 7, 15, 30, 12); long startTime = cal.getTimeInMillis(); cal.add(Calendar.DATE, 3); long endTime = cal.getTimeInMillis(); AdminLogQuery query = new AdminLogQuery(versionList, startTime, endTime); Long fourHours = Long.valueOf(4 * 60 * 60 * 1000); query.moveTimePeriodBackward(fourHours); long expectedEndTime = startTime - 1; long expectedStartTime = expectedEndTime - fourHours; assertEquals(expectedStartTime, query.getStartTime()); assertEquals(expectedEndTime, query.getEndTime()); assertEquals(expectedStartTime, query.getQuery().getStartTimeMillis().longValue()); assertEquals(expectedEndTime, query.getQuery().getEndTimeMillis().longValue()); }
Source:
private SqlFunctionProperties( boolean parseDecimalLiteralAsDouble, boolean legacyRowFieldOrdinalAccessEnabled, TimeZoneKey timeZoneKey, boolean legacyTimestamp, boolean legacyMapSubscript, long sessionStartTime, Locale sessionLocale, String sessionUser) { this.parseDecimalLiteralAsDouble = parseDecimalLiteralAsDouble; this.legacyRowFieldOrdinalAccessEnabled = legacyRowFieldOrdinalAccessEnabled; this.timeZoneKey = requireNonNull(timeZoneKey, "timeZoneKey is null"); this.legacyTimestamp = legacyTimestamp; this.legacyMapSubscript = legacyMapSubscript; this.sessionStartTime = sessionStartTime; this.sessionLocale = sessionLocale; this.sessionUser = sessionUser; }

Target:
private SqlFunctionProperties( boolean parseDecimalLiteralAsDouble, boolean legacyRowFieldOrdinalAccessEnabled, TimeZoneKey timeZoneKey, boolean legacyTimestamp, boolean legacyMapSubscript, long sessionStartTime, Locale sessionLocale, String sessionUser) { this.parseDecimalLiteralAsDouble = parseDecimalLiteralAsDouble; this.legacyRowFieldOrdinalAccessEnabled = legacyRowFieldOrdinalAccessEnabled; this.timeZoneKey = requireNonNull(timeZoneKey, "timeZoneKey is null"); this.legacyTimestamp = legacyTimestamp; this.legacyMapSubscript = legacyMapSubscript; this.sessionStartTime = sessionStartTime; this.sessionLocale = requireNonNull(sessionLocale, "sessionLocale is null"); this.sessionUser = requireNonNull(sessionUser, "sessionUser is null"); }
Source:
public String registerConfigProvider(String className, Map properties, String layer, String appContext, String description) { AuthConfigProvider acp = null; if (className != null) { try { Class<?> provClass = SecurityActions.getContextClassLoader().loadClass(className); Constructor<?> ctr = provClass.getConstructor(new Class[] {Map.class, AuthConfigFactory.class}); acp = (AuthConfigProvider) ctr.newInstance(new Object[] {properties, null}); } catch (Exception e) { throw PicketBoxMessages.MESSAGES.failedToRegisterAuthConfigProvider(className, e); } } String registrationID = new StringBuilder().append(layer).append(appContext).toString(); boolean providerAlreadyRegistrated = this.keyToAuthConfigProviderMap.containsKey(registrationID); this.keyToAuthConfigProviderMap.put(registrationID, acp); if (providerAlreadyRegistrated) { JBossRegistrationContext context = (JBossRegistrationContext) this.keyToRegistrationContextMap.get(registrationID); context.setDescription(description); context.setIsPersistent(true); RegistrationListener listener = this.keyToRegistrationListenerMap.get(registrationID); if (listener != null) listener.notify(layer, appContext); } else { RegistrationContext context = new JBossRegistrationContext(layer, appContext, description, true); this.keyToRegistrationContextMap.put(registrationID, context); } return registrationID; }

Target:
public String registerConfigProvider(String className, Map properties, String layer, String appContext, String description) { AuthConfigProvider acp = null; if (className != null) { try { Class<?> provClass = SecurityActions.getContextClassLoader().loadClass(className); Constructor<?> ctr = provClass.getConstructor(new Class[] {Map.class, AuthConfigFactory.class}); acp = (AuthConfigProvider) ctr.newInstance(new Object[] {properties, null}); } catch (Exception e) { throw PicketBoxMessages.MESSAGES.failedToRegisterAuthConfigProvider(className, e); } } String registrationID = new StringBuilder().append(layer).append(appContext).toString(); boolean providerAlreadyRegistered = this.keyToAuthConfigProviderMap.containsKey(registrationID); this.keyToAuthConfigProviderMap.put(registrationID, acp); if (providerAlreadyRegistered) { JBossRegistrationContext context = (JBossRegistrationContext) this.keyToRegistrationContextMap.get(registrationID); context.setDescription(description); context.setIsPersistent(true); RegistrationListener listener = this.keyToRegistrationListenerMap.get(registrationID); if (listener != null) listener.notify(layer, appContext); } else { RegistrationContext context = new JBossRegistrationContext(layer, appContext, description, true); this.keyToRegistrationContextMap.put(registrationID, context); } return registrationID; }
Source:
public synchronized void insertEntries(List<BibEntry> newEntries, EntriesEventSource eventSource) throws KeyCollisionException { Objects.requireNonNull(newEntries); BibEntry firstEntry = null; for (BibEntry entry : newEntries) { String id = entry.getId(); if (containsEntryWithId(id)) { throw new KeyCollisionException("ID is already in use, please choose another"); } internalIDs.add(id); entry.registerListener(this); if (firstEntry == null) { firstEntry = entry; } } entries.addAll(newEntries); if (firstEntry == null) { eventBus.post(new EntriesAddedEvent(newEntries, eventSource)); } else { eventBus.post(new EntriesAddedEvent(newEntries, firstEntry, eventSource)); } }

Target:
public synchronized void insertEntries(List<BibEntry> newEntries, EntriesEventSource eventSource) throws KeyCollisionException { Objects.requireNonNull(newEntries); for (BibEntry entry : newEntries) { String id = entry.getId(); if (containsEntryWithId(id)) { throw new KeyCollisionException("ID is already in use, please choose another", id); } internalIDs.add(id); entry.registerListener(this); } if (newEntries.isEmpty()) { eventBus.post(new EntriesAddedEvent(newEntries, eventSource)); } else { eventBus.post(new EntriesAddedEvent(newEntries, newEntries.get(0), eventSource)); } entries.addAll(newEntries); }
Source:
private Map<FilterExpression, List<TurboIssue>> processFilter(List<FilterExpression> filterExprs) { MultiModel models = logic.getModels(); List<TurboIssue> allModelIssues = models.getIssues(); Map<FilterExpression, List<TurboIssue>> filteredSortedAndCounted = new HashMap<>(); filterExprs.forEach(filterExpr -> { List<TurboIssue> filterAndSortedExpression = filteredSortedAndCounted.get(filterExpr); if (filterAndSortedExpression == null) { boolean hasUpdatedQualifier = Qualifier.hasUpdatedQualifier(filterExpr); FilterExpression filterExprNoAlias = Qualifier.replaceMilestoneAliases(models, filterExpr); List<TurboIssue> filteredSortedAndCountedIssues = allModelIssues.stream() .filter(issue -> Qualifier.process(models, filterExprNoAlias, issue)) .sorted(determineComparator(filterExprNoAlias, hasUpdatedQualifier)) .limit(determineCount(allModelIssues, filterExprNoAlias)) .collect(Collectors.toList()); filteredSortedAndCounted.put(filterExpr, filteredSortedAndCountedIssues); } }); return filteredSortedAndCounted; }

Target:
private Map<FilterExpression, List<TurboIssue>> processFilter(List<FilterExpression> filterExprs) { MultiModel models = logic.getModels(); List<TurboIssue> allModelIssues = models.getIssues(); Map<FilterExpression, List<TurboIssue>> filteredSortedAndCounted = new HashMap<>(); filterExprs.forEach(filterExpr -> { List<TurboIssue> filterAndSortedExpression = filteredSortedAndCounted.get(filterExpr); if (filterAndSortedExpression == null) { boolean hasUpdatedQualifier = Qualifier.hasUpdatedQualifier(filterExpr); FilterExpression filterExprNoAlias = Qualifier.replaceMilestoneAliases(models, filterExpr); List<TurboIssue> filteredSortedAndCountedIssues = allModelIssues.stream() .filter(issue -> Qualifier.process(models, filterExprNoAlias, issue)) .sorted(determineComparator(filterExprNoAlias, hasUpdatedQualifier)) .limit(Qualifier.determineCount(allModelIssues, filterExprNoAlias)) .collect(Collectors.toList()); filteredSortedAndCounted.put(filterExpr, filteredSortedAndCountedIssues); } }); return filteredSortedAndCounted; }
Source:
private void initEncryption() throws FunctionalException { try { this.key = new SecretKeySpec(Files.readAllBytes(new File(this.keyPath).toPath()), SECRET_KEY_SPEC); } catch (final IOException e) { final String errorMessage = String.format("Unexpected exception when reading keys"); LOGGER.error(errorMessage, e); throw new FunctionalException(FunctionalExceptionType.READING_KEY_EXCEPTION, ComponentType.SHARED, e); } }

Target:
private void initEncryption() throws FunctionalException { try { this.key = new SecretKeySpec(Files.readAllBytes(new File(this.keyPath).toPath()), SECRET_KEY_SPEC); } catch (final IOException e) { final String errorMessage = String.format("Unexpected exception when reading keys. Key Path: %s", this.keyPath); LOGGER.error(errorMessage); throw new FunctionalException(FunctionalExceptionType.READING_KEY_EXCEPTION, ComponentType.SHARED, e); } }
Source:
public TimeGraphScale(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); addMouseListener(this); addMouseMoveListener(this); }

Target:
public TimeGraphScale(Composite parent, TimeGraphColorScheme colors) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); TmfSignalManager.register(this); addMouseListener(this); addMouseMoveListener(this); }
Source:
private void drawLineRange(GC gc, int startLine, int endLine, int x, int w) { final int viewPortWidth= fTextWidget.getClientArea().width; int spaceCharWidth= gc.stringExtent(" ").x; boolean spaceCharsAreSameWidth= spaceCharWidth == gc.stringExtent(SPACE_SIGN_STRING).x && spaceCharWidth == gc.stringExtent(IDEOGRAPHIC_SPACE_SIGN_STRING).x; for (int line= startLine; line <= endLine; line++) { int lineOffset= fTextWidget.getOffsetAtLine(line); int lineEndOffset; if (line < fTextWidget.getLineCount() - 1) { lineEndOffset= fTextWidget.getOffsetAtLine(line + 1); } else { lineEndOffset= fTextWidget.getCharCount(); } int lineLength= lineEndOffset - lineOffset; while (lineLength > 0) { char c= fTextWidget.getTextRange(lineOffset + lineLength - 1, 1).charAt(0); if (c != '\r' && c != '\n') { break; } --lineLength; } Point endOfLine= fTextWidget.getLocationAtOffset(lineOffset + lineLength); if (x - endOfLine.x > viewPortWidth) { continue; } int y= fTextWidget.getLinePixel(line); int startOffset = fTextWidget.getOffsetAtPoint(new Point(x, y)) - 1; if (startOffset == -1) { startOffset= lineOffset; } else if (startOffset - 2 <= lineOffset) { startOffset= lineOffset; } int endOffset; if (x + w >= endOfLine.x) { endOffset= lineEndOffset; } else { endOffset= fTextWidget.getOffsetAtPoint(new Point(x + w - 1, y)) + 1; if (endOffset == -1) { endOffset= lineEndOffset; } if (endOffset + 2 >= lineEndOffset) { endOffset= lineEndOffset; } } if (endOffset > startOffset) { drawCharRange(gc, startOffset, endOffset, lineOffset, lineEndOffset, spaceCharsAreSameWidth); } } }

Target:
private void drawLineRange(GC gc, int startLine, int endLine, int x, int w) { final int viewPortWidth= fTextWidget.getClientArea().width; int spaceCharWidth= gc.stringExtent(" ").x; boolean spaceCharsAreSameWidth= spaceCharWidth == gc.stringExtent(SPACE_SIGN_STRING).x && spaceCharWidth == gc.stringExtent(IDEOGRAPHIC_SPACE_SIGN_STRING).x; for (int line= startLine; line <= endLine; line++) { int lineOffset= fTextWidget.getOffsetAtLine(line); int lineEndOffset; if (line < fTextWidget.getLineCount() - 1) { lineEndOffset= fTextWidget.getOffsetAtLine(line + 1); } else { lineEndOffset= fTextWidget.getCharCount(); } int lineLength= lineEndOffset - lineOffset; while (lineLength > 0) { char c= fTextWidget.getTextRange(lineOffset + lineLength - 1, 1).charAt(0); if (c != '\r' && c != '\n') { break; } --lineLength; } Point endOfLine= fTextWidget.getLocationAtOffset(lineOffset + lineLength); if (x - endOfLine.x > viewPortWidth) { continue; } int y= fTextWidget.getLinePixel(line); int startOffset = fTextWidget.getOffsetAtPoint(new Point(x, y)) - 1; if (startOffset == -1) { startOffset= lineOffset; } else if (startOffset - 2 <= lineOffset) { startOffset= lineOffset; } int endOffset; if (x + w >= endOfLine.x) { endOffset= lineEndOffset; } else { endOffset= fTextWidget.getOffsetAtPoint(new Point(x + w - 1, y)) + 1; if (endOffset == -1) { endOffset= lineEndOffset; } else if (endOffset + 2 >= lineEndOffset) { endOffset= lineEndOffset; } } if (endOffset > startOffset) { drawCharRange(gc, startOffset, endOffset, lineOffset, lineEndOffset, spaceCharsAreSameWidth); } } }
Source:
public Response<CommentInfo> apply(DraftResource rsrc, Input input) throws OrmException, IOException { ChangeUpdate update = updateFactory.create(rsrc.getControl()); PatchList patchList = null; try { patchList = patchListCache.get(rsrc.getChange(), rsrc.getPatchSet()); } catch (PatchListNotAvailableException e) { throw new OrmException("could not load PatchList for this patchset", e); } RevId patchSetCommit = new RevId(ObjectId.toString(patchList.getNewId())); RevId baseCommit = new RevId(ObjectId.toString(patchList.getOldId())); PatchLineComment c = rsrc.getComment(); if (c.getRevId() == null) { if (c.getRevId() == null) { c.setRevId((c.getSide() == (short) 0) ? baseCommit : patchSetCommit); } } plcUtil.deleteComments(db.get(), update, Collections.singleton(c)); update.commit(); return Response.none(); }

Target:
public Response<CommentInfo> apply(DraftResource rsrc, Input input) throws OrmException, IOException { ChangeUpdate update = updateFactory.create(rsrc.getControl()); PatchLineComment c = rsrc.getComment(); if (c.getRevId() == null) { setCommentRevId(c, patchListCache, rsrc.getChange(), rsrc.getPatchSet()); } plcUtil.deleteComments(db.get(), update, Collections.singleton(c)); update.commit(); return Response.none(); }
Source:
public void refreshLayout(Form form) { super.refreshLayout(form); if (form.getName().equals(Form.MAIN) && connection != null) { for (Form childForm : connection.getForms()) { connection.refreshLayout(childForm); } if (!isPlainOutputConnectionMode()) { updateDocIdColumnPossibleValues(); } form.getWidget(criteria).setVisible(isPlainOutputConnectionMode()); form.getWidget(docIdColumn).setHidden(isPlainOutputConnectionMode()); } if (form.getName().equals(Form.ADVANCED)) { if (isPlainOutputConnectionMode()) { form.getWidget(pageSize).setVisible(); form.getWidget(maxRetrieve).setVisible(); form.getWidget(useQueryOption).setVisible(); form.getWidget(queryLiteralType).setVisible(useQueryOption); form.getWidget(queryOptionName).setVisible(useQueryOption); form.getWidget(queryOptionLiterals).setVisible(useQueryOption); } else { form.getWidget(pageSize).setHidden(); form.getWidget(maxRetrieve).setHidden(); form.getWidget(useQueryOption).setHidden(); form.getWidget(queryLiteralType).setHidden(); form.getWidget(queryOptionName).setHidden(); form.getWidget(queryOptionLiterals).setHidden(); } } }

Target:
public void refreshLayout(Form form) { super.refreshLayout(form); if (form.getName().equals(Form.MAIN) && connection != null) { for (Form childForm : connection.getForms()) { connection.refreshLayout(childForm); } if (!isPlainOutputConnectionMode()) { updateDocIdColumnPossibleValues(); } form.getWidget(criteria).setVisible(isPlainOutputConnectionMode()); form.getWidget(docIdColumn).setHidden(isPlainOutputConnectionMode()); } if (form.getName().equals(Form.ADVANCED)) { boolean isCriteriaModeUsed = isPlainOutputConnectionMode(); form.getWidget(pageSize).setVisible(isCriteriaModeUsed); form.getWidget(maxRetrieve).setVisible(isCriteriaModeUsed); form.getWidget(useQueryOption).setVisible(isCriteriaModeUsed); form.getWidget(queryLiteralType).setVisible(isCriteriaModeUsed && useQueryOption.getValue()); form.getWidget(queryOptionName).setVisible(isCriteriaModeUsed && useQueryOption.getValue()); form.getWidget(queryOptionLiterals).setVisible(isCriteriaModeUsed && useQueryOption.getValue()); } }
Source:
protected void AddVmTemplateToDb() { getVmTemplate().setvds_group_id(getParameters().getVdsGroupId()); getVmTemplate().setstatus(VmTemplateStatus.Locked); DbFacade.getInstance().getVmTemplateDAO().save(getVmTemplate()); getCompensationContext().snapshotNewEntity(getVmTemplate()); for (DiskImage image : getParameters().getImages()) { DbFacade.getInstance().getDiskImageDAO().save(image); getCompensationContext().snapshotNewEntity(image); if (!DbFacade.getInstance().getDiskDao().exists(image.getimage_group_id())) { Disk disk = image.getDisk(); image_vm_map imageVmMap = new image_vm_map(image.getactive(),image.getId(),image.getvm_guid()); getCompensationContext().snapshotNewEntity(imageVmMap); DbFacade.getInstance().getImageVmMapDAO().save(imageVmMap); DbFacade.getInstance().getDiskDao().save(disk); getCompensationContext().snapshotNewEntity(disk); } DiskImageDynamic diskDynamic = new DiskImageDynamic(); diskDynamic.setId(image.getId()); diskDynamic.setactual_size(image.getactual_size()); DbFacade.getInstance().getDiskImageDynamicDAO().save(diskDynamic); getCompensationContext().snapshotNewEntity(diskDynamic); } }

Target:
protected void AddVmTemplateToDb() { getVmTemplate().setvds_group_id(getParameters().getVdsGroupId()); getVmTemplate().setstatus(VmTemplateStatus.Locked); DbFacade.getInstance().getVmTemplateDAO().save(getVmTemplate()); getCompensationContext().snapshotNewEntity(getVmTemplate()); for (DiskImage image : getParameters().getImages()) { DbFacade.getInstance().getDiskImageDAO().save(image); getCompensationContext().snapshotNewEntity(image); if (!DbFacade.getInstance().getDiskDao().exists(image.getimage_group_id())) { Disk disk = image.getDisk(); VmDeviceUtils.addManagedDevice(getCompensationContext(),new VmDeviceId((Guid) image.getId(), image.getvm_guid()), VmDeviceType.DISK, VmDeviceType.DISK, "", true, false); DbFacade.getInstance().getDiskDao().save(disk); getCompensationContext().snapshotNewEntity(disk); image_vm_map imageVmMap = new image_vm_map(true,image.getId(),image.getvm_guid()); DbFacade.getInstance().getImageVmMapDAO().save(imageVmMap); getCompensationContext().snapshotNewEntity(imageVmMap); } DiskImageDynamic diskDynamic = new DiskImageDynamic(); diskDynamic.setId(image.getId()); diskDynamic.setactual_size(image.getactual_size()); DbFacade.getInstance().getDiskImageDynamicDAO().save(diskDynamic); getCompensationContext().snapshotNewEntity(diskDynamic); } }
Source:
public void revertTasks(CommandBase<?> command) { if (command.getParameters().getVdsmTaskIds() != null) { ArrayList<Guid> taskIdAsList = new ArrayList<>(); for (Guid taskId : command.getParameters().getVdsmTaskIds()) { taskIdAsList.add(taskId); List<AsyncTaskStatus> tasksStatuses = getAsyncTaskManager().pollTasks( taskIdAsList); if (tasksStatuses.get(0).getTaskEndedSuccessfully()) { getBackend().getResourceManager().RunVdsCommand( VDSCommandType.SPMRevertTask, new SPMTaskGuidBaseVDSCommandParameters( command.getStoragePool().getId(), taskId)); } taskIdAsList.clear(); } } }

Target:
public void revertTasks(CommandBase<?> command) { if (command.getParameters().getVdsmTaskIds() != null) { List<Guid> taskIdAsList = new ArrayList<>(); for (Guid taskId : command.getParameters().getVdsmTaskIds()) { taskIdAsList.add(taskId); List<AsyncTaskStatus> tasksStatuses = getAsyncTaskManager().pollTasks( taskIdAsList); if (tasksStatuses.get(0).getTaskEndedSuccessfully()) { getBackend().getResourceManager().RunVdsCommand( VDSCommandType.SPMRevertTask, new SPMTaskGuidBaseVDSCommandParameters( command.getStoragePool().getId(), taskId)); } taskIdAsList.clear(); } } }
Source:
default T verify(Duration timeout) throws IOException { return verify(timeout.toMillis()); }

Target:
default T verify(Duration timeout) throws IOException { return timeout != null ? verify(timeout.toMillis()) : verify(); }
Source:
public boolean addAll(@NonNull Disposable... disposables) { ObjectHelper.requireNonNull(disposables, "Disposables are null"); if (!disposed) { synchronized (this) { if (!disposed) { OpenHashSet<Disposable> set = resources; if (set == null) { set = new OpenHashSet<Disposable>(disposables.length + 1); resources = set; } for (Disposable d : disposables) { ObjectHelper.requireNonNull(d, "Disposable item in Disposables is null"); set.add(d); } return true; } } } for (Disposable d : disposables) { d.dispose(); } return false; }

Target:
public boolean addAll(@NonNull Disposable... disposables) { ObjectHelper.requireNonNull(disposables, "disposables is null"); if (!disposed) { synchronized (this) { if (!disposed) { OpenHashSet<Disposable> set = resources; if (set == null) { set = new OpenHashSet<Disposable>(disposables.length + 1); resources = set; } for (Disposable d : disposables) { ObjectHelper.requireNonNull(d, "A Disposable in the disposables array is null"); set.add(d); } return true; } } } for (Disposable d : disposables) { d.dispose(); } return false; }
Source:
protected <C extends VisitableCommand & FlagAffectedCommand & TopologyAffectedCommand, K> Object handleTxWriteManyCommand( InvocationContext ctx, C command, Collection<K> keys, BiFunction<C, List<K>, C> copyCommand) { boolean ignorePreviousValue = command.hasAnyFlag(SKIP_REMOTE_FLAGS) || command.loadType() == VisitableCommand.LoadType.DONT_LOAD; List<K> filtered = new ArrayList<>(keys.size()); List<Object> remoteKeys = new ArrayList<>(); LocalizedCacheTopology cacheTopology = checkTopologyId(command); for (K key : keys) { if (ctx.isOriginLocal() || cacheTopology.isWriteOwner(key)) { if (ctx.lookupEntry(key) == null) { if (ignorePreviousValue) { entryFactory.wrapExternalEntry(ctx, key, null, false, true); } else { remoteKeys.add(key); } } filtered.add(key); } } CompletionStage<?> remoteGetMany = remoteGetMany(ctx, command, keys); return asyncInvokeNext(ctx, copyCommand.apply(command, filtered), remoteGetMany); }

Target:
protected <C extends VisitableCommand & FlagAffectedCommand & TopologyAffectedCommand, K> Object handleTxWriteManyCommand( InvocationContext ctx, C command, Collection<K> keys, BiFunction<C, List<K>, C> copyCommand) { boolean ignorePreviousValue = command.hasAnyFlag(SKIP_REMOTE_FLAGS) || command.loadType() == VisitableCommand.LoadType.DONT_LOAD; List<K> filtered = new ArrayList<>(keys.size()); List<Object> remoteKeys = null; LocalizedCacheTopology cacheTopology = checkTopologyId(command); for (K key : keys) { if (ctx.isOriginLocal() || cacheTopology.isWriteOwner(key)) { if (ctx.lookupEntry(key) == null) { if (ignorePreviousValue) { entryFactory.wrapExternalEntry(ctx, key, null, false, true); } else { if (remoteKeys == null) { remoteKeys = new ArrayList<>(); } remoteKeys.add(key); } } filtered.add(key); } } CompletionStage<?> remoteGetMany = remoteKeys != null ? remoteGetMany(ctx, command, remoteKeys) : CompletableFutures.completedNull(); return asyncInvokeNext(ctx, copyCommand.apply(command, filtered), remoteGetMany); }