auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldConvertFailureToFailedCompletableFuture() { CompletableFuture<Object> future = failure().toCompletableFuture(); assertThat(future.isDone()); assertThat(future.isCompletedExceptionally()); assertThatThrownBy(future::get) .isExactlyInstanceOf(ExecutionException.class) .hasCauseExactlyInstanceOf(NonFatalException.class) .hasRootCauseExactlyInstanceOf(RuntimeException.class); }

Target:
public void shouldConvertFailureToFailedCompletableFuture() { final CompletableFuture<Object> future = failure().toCompletableFuture(); assertThat(future.isDone()); assertThat(future.isCompletedExceptionally()); assertThatThrownBy(future::get) .isExactlyInstanceOf(ExecutionException.class) .hasCauseExactlyInstanceOf(RuntimeException.class); }
Source:
private void updateValueMetadata(Record<Data> record, Data dataValue) { try { Object valueMetadata = metadataInitializer.createFromData(dataValue); Metadata existing = record.getMetadata(); if (existing != null) { existing.set(false, valueMetadata); } } catch (Exception e) { rethrow(e); } }

Target:
private void updateValueMetadata(Record<Data> record, Data dataValue) { try { Object valueMetadata = metadataInitializer.createFromData(dataValue); if (valueMetadata != null) { Metadata existing = record.getMetadata(); if (existing == null) { existing = new Metadata(); record.setMetadata(existing); } existing.setValueMetadata(valueMetadata); } } catch (Exception e) { rethrow(e); } }
Source:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { List<HttpCookie> cookies = msg.getResponseHeader().getHttpCookies(msg.getRequestHeader().getHostName()); String host = msg.getRequestHeader().getHostName(); Set<String> ignoreList = CookieUtils.getCookieIgnoreList(getModel()); List<HttpCookie> looselyScopedCookies = new LinkedList<HttpCookie>(); for (HttpCookie cookie : cookies) { if (isLooselyScopedCookie(cookie, host)) { if (!ignoreList.contains(cookie.getName())) { looselyScopedCookies.add(cookie); } } } if (looselyScopedCookies.size() > 0) { raiseAlert(msg, id, host, looselyScopedCookies); } }

Target:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { List<HttpCookie> cookies = msg.getResponseHeader().getHttpCookies(msg.getRequestHeader().getHostName()); String host = msg.getRequestHeader().getHostName(); Set<String> ignoreList = CookieUtils.getCookieIgnoreList(getModel()); List<HttpCookie> looselyScopedCookies = new LinkedList<HttpCookie>(); for (HttpCookie cookie : cookies) { if (!ignoreList.contains(cookie.getName()) && isLooselyScopedCookie(cookie, host)) { looselyScopedCookies.add(cookie); } } if (looselyScopedCookies.size() > 0) { raiseAlert(msg, id, host, looselyScopedCookies); } }
Source:
void coordinateByMate() { final List<SAMRecord> newFirstOfPairOrFragment = new ArrayList<>(); final List<SAMRecord> newSecondOfPair = new ArrayList<>(); for (int i = 0; i < firstOfPairOrFragment.size(); i++) { final SAMRecord first = firstOfPairOrFragment.get(i); newFirstOfPairOrFragment.add(i, first); newSecondOfPair.add(null); for (int k = 0; k < secondOfPair.size(); k++) { final SAMRecord second = secondOfPair.get(k); if (arePair(first, second)) { newSecondOfPair.set(i, second); secondOfPair.set(k, null); break; } } } for (int i = 0; i < secondOfPair.size(); i++) { if (secondOfPair.get(i) != null) { newFirstOfPairOrFragment.add(i, null); newSecondOfPair.add(i, secondOfPair.get(i)); } } firstOfPairOrFragment.clear(); firstOfPairOrFragment.addAll(newFirstOfPairOrFragment); secondOfPair.clear(); secondOfPair.addAll(newSecondOfPair); renumberHitIndex(); }

Target:
void coordinateByMate() { final List<SAMRecord> newFirstOfPairOrFragment = new ArrayList<>(); final List<SAMRecord> newSecondOfPair = new ArrayList<>(); for (int i = 0; i < firstOfPairOrFragment.size(); ++i) { final SAMRecord first = firstOfPairOrFragment.get(i); newFirstOfPairOrFragment.add(i, first); newSecondOfPair.add(null); for (int k = 0; k < secondOfPair.size(); ++k) { final SAMRecord second = secondOfPair.get(k); if (arePair(first, second)) { newSecondOfPair.set(i, second); secondOfPair.set(k, null); break; } } } for (int i = 0; i < secondOfPair.size(); ++i) { if (secondOfPair.get(i) != null) { newFirstOfPairOrFragment.add(i, null); newSecondOfPair.add(i, secondOfPair.get(i)); } } firstOfPairOrFragment.clear(); firstOfPairOrFragment.addAll(newFirstOfPairOrFragment); secondOfPair.clear(); secondOfPair.addAll(newSecondOfPair); renumberHitIndex(); }
Source:
public static HaplotypeBAMWriter createBamWriter(final AssemblyBasedCallerArgumentCollection args, final SAMFileHeader header) { return args.bamOutputPath != null ? HaplotypeBAMWriter.create(args.bamWriterType, new File(args.bamOutputPath), header) : null; }

Target:
public static Optional<HaplotypeBAMWriter> createBamWriter(final AssemblyBasedCallerArgumentCollection args, final SAMFileHeader header) { return args.bamOutputPath != null ? Optional.of(HaplotypeBAMWriter.create(args.bamWriterType, new File(args.bamOutputPath), header)) : Optional.empty(); }
Source:
public void fillTimeValueForDatePickerTest(String timeId, Calendar newValue) { WebElement dateInputElement = browser.driver.findElement(By.id(timeId)); click(dateInputElement); dateInputElement.clear(); dateInputElement.sendKeys(new SimpleDateFormat("EE").format(newValue.getTime()) + ", " + newValue.get(Calendar.DATE) + " " + new SimpleDateFormat("MMM").format(newValue.getTime()) + ", " + newValue.get(Calendar.YEAR)); List<WebElement> elements = browser.driver.findElements(By.className("ui-datepicker-current-day")); for (WebElement element : elements) { click(element); } }

Target:
public void fillTimeValueForDatePickerTest(String timeId, Calendar newValue) { WebElement dateInputElement = browser.driver.findElement(By.id(timeId)); click(dateInputElement); dateInputElement.clear(); dateInputElement.sendKeys(TimeHelper.formatDateForSessionsForm(newValue.getTime())); List<WebElement> elements = browser.driver.findElements(By.className("ui-datepicker-current-day")); for (WebElement element : elements) { click(element); } }
Source:
public void testGetQueryResultWithoutSessionId() throws Exception { String sessionId = generateNewSessionAndGetId(); URI queryIdURI = sendNewQueryResquest(sessionId, "select * from lineitem"); URI queryResultURI = new URI(queryIdURI + "/result"); boolean isBadRequest = false; try { GetQueryResultDataResponse response = restClient.target(queryResultURI) .request() .get(new GenericType<>(GetQueryResultDataResponse.class)); } catch (BadRequestException e) { isBadRequest = true; } catch (Exception e) { } assertTrue(isBadRequest); }

Target:
public void testGetQueryResultWithoutSessionId() throws Exception { String sessionId = generateNewSessionAndGetId(); URI queryIdURI = sendNewQueryResquest(sessionId, "select * from lineitem"); URI queryResultURI = new URI(queryIdURI + "/result"); GetQueryResultDataResponse response = restClient.target(queryResultURI) .request() .get(new GenericType<>(GetQueryResultDataResponse.class)); }
Source:
private List<Workflow> createBioWorkflowsAndVersionsFromDockstoreYml(List<YamlWorkflow> yamlWorkflows, String repository, String gitReference, GitHubSourceCodeRepo gitHubSourceCodeRepo, User user, final SourceFile dockstoreYml) { try { List<Workflow> updatedWorkflows = new ArrayList<>(); final Path gitRefPath = Path.of(gitReference); for (YamlWorkflow wf : yamlWorkflows) { final List<String> filters = wf.getFilter(); Boolean isFiltered = !filters.isEmpty(); for (String filter : filters) { final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:**/" + filter); if (pathMatcher.matches(gitRefPath)) { isFiltered = false; break; } } if (isFiltered) { continue; } String subclass = wf.getSubclass(); String workflowName = wf.getName(); Workflow workflow = createOrGetWorkflow(BioWorkflow.class, repository, user, workflowName, subclass, gitHubSourceCodeRepo); workflow = addDockstoreYmlVersionToWorkflow(repository, gitReference, dockstoreYml, gitHubSourceCodeRepo, workflow); updatedWorkflows.add(workflow); } return updatedWorkflows; } catch (ClassCastException ex) { throw new CustomWebApplicationException("Could not parse workflow array from YML.", LAMBDA_FAILURE); } }

Target:
private List<Workflow> createBioWorkflowsAndVersionsFromDockstoreYml(List<YamlWorkflow> yamlWorkflows, String repository, String gitReference, GitHubSourceCodeRepo gitHubSourceCodeRepo, User user, final SourceFile dockstoreYml) { try { List<Workflow> updatedWorkflows = new ArrayList<>(); final Path gitRefPath = Path.of(gitReference); for (YamlWorkflow wf : yamlWorkflows) { if (!DockstoreYamlHelper.filterGitReference(gitRefPath, wf.getFilters())) { continue; } String subclass = wf.getSubclass(); String workflowName = wf.getName(); Workflow workflow = createOrGetWorkflow(BioWorkflow.class, repository, user, workflowName, subclass, gitHubSourceCodeRepo); workflow = addDockstoreYmlVersionToWorkflow(repository, gitReference, dockstoreYml, gitHubSourceCodeRepo, workflow); updatedWorkflows.add(workflow); } return updatedWorkflows; } catch (ClassCastException ex) { throw new CustomWebApplicationException("Could not parse workflow array from YML.", LAMBDA_FAILURE); } }
Source:
public static Bitmap centerCrop(Bitmap inputBitmap, int newWidth, int newHeight) { if (inputBitmap == null || inputBitmap.isRecycled()) { return null; } float sourceWidth = inputBitmap.getWidth(); float sourceHeight = inputBitmap.getHeight(); float xScale = newWidth / sourceWidth; float yScale = newHeight / sourceHeight; float newXScale; float newYScale; if (yScale > xScale) { newXScale = (1.0f / yScale) * xScale; newYScale = 1.0f; } else { newXScale = 1.0f; newYScale = (1.0f / xScale) * yScale; } float scaledWidth = newXScale * sourceWidth; float scaledHeight = newYScale * sourceHeight; int left = (int) ((sourceWidth - scaledWidth) / 2); int top = (int) ((sourceHeight - scaledHeight) / 2); int width = (int) scaledWidth; int height = (int) scaledHeight; return Bitmap.createBitmap(inputBitmap, left, top, width, height); }

Target:
public static Bitmap centerCrop(Bitmap inputBitmap, int newWidth, int newHeight) { if (inputBitmap == null || inputBitmap.isRecycled()) { return null; } float sourceWidth = inputBitmap.getWidth(); float sourceHeight = inputBitmap.getHeight(); float xScale = newWidth / sourceWidth; float yScale = newHeight / sourceHeight; float newXScale; float newYScale; if (yScale > xScale) { newXScale = xScale / yScale; newYScale = 1.0f; } else { newXScale = 1.0f; newYScale = yScale / xScale; } float scaledWidth = newXScale * sourceWidth; float scaledHeight = newYScale * sourceHeight; int left = (int) ((sourceWidth - scaledWidth) / 2); int top = (int) ((sourceHeight - scaledHeight) / 2); int width = (int) scaledWidth; int height = (int) scaledHeight; return Bitmap.createBitmap(inputBitmap, left, top, width, height); }
Source:
public ACL getACL(@Nonnull AbstractItem item) { if(item instanceof WorkflowMultiBranchProject) { GithubRequireOrganizationMembershipACL githubACL = (GithubRequireOrganizationMembershipACL) getRootACL(); return githubACL.cloneForProject(item); } else { return getRootACL(); } }

Target:
public ACL getACL(@Nonnull AbstractItem item) { if(item instanceof MultiBranchProject) { GithubRequireOrganizationMembershipACL githubACL = (GithubRequireOrganizationMembershipACL) getRootACL(); return githubACL.cloneForProject(item); } else { return getRootACL(); } }
Source:
public MethodsGroupBuilder methods(List<String> methodNames) { requireNonNull(methodNames, "methodNames is null"); checkArgument(!methodNames.isEmpty(), "methods list is empty"); List<MethodAndNativeContainerTypes> matchingMethods = asList(clazz.getMethods()).stream() .filter(method -> methodNames.contains(method.getName())) .map(method -> new MethodAndNativeContainerTypes(method, nCopies(signature.getArgumentTypes().size(), Optional.empty()))) .collect(toImmutableList()); List<String> matchingMethodNames = matchingMethods.stream() .map(methodAndNativeContainerTypes -> methodAndNativeContainerTypes.getMethod().getName()) .collect(toImmutableList()); for (String methodName : methodNames) { checkState(matchingMethodNames.contains(methodName), "method %s was not found in %s", methodName, clazz); } this.methodAndNativeContainerTypes = matchingMethods; return this; }

Target:
public MethodsGroupBuilder methods(List<String> methodNames) { requireNonNull(methodNames, "methodNames is null"); checkArgument(!methodNames.isEmpty(), "methods list is empty"); methodNames.forEach(methodName -> this.methodWithExplicitJavaTypes(methodName, nCopies(signature.getArgumentTypes().size(), Optional.empty()))); return this; }
Source:
public ApiConstants.BootMode getBootMode() { if (StringUtils.isNotBlank(bootMode)) { try { String mode = bootMode.trim().toUpperCase(); return ApiConstants.BootMode.valueOf(mode); } catch (IllegalArgumentException e) { String errMesg = "Invalid bootMode " + bootMode + "Specified for vm " + getName() + " Valid values are: LEGACY,SECURE "; s_logger.warn(errMesg); throw new InvalidParameterValueException(errMesg); } } return null; }

Target:
public ApiConstants.BootMode getBootMode() { if (StringUtils.isNotBlank(bootMode)) { try { String mode = bootMode.trim().toUpperCase(); return ApiConstants.BootMode.valueOf(mode); } catch (IllegalArgumentException e) { String errMesg = "Invalid bootMode " + bootMode + "Specified for vm " + getName() + " Valid values are: "+ Arrays.toString(ApiConstants.BootMode.values()); s_logger.warn(errMesg); throw new InvalidParameterValueException(errMesg); } } return null; }
Source:
public void init() { Collection<String> serviceIdList = conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY); if (serviceIdList.size() == 0) { omServiceAdd = SecurityUtil.buildTokenService(OmUtils. getOmAddressForClients(conf)); } else { Collection<String> serviceIds = conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY); if (serviceIds.size() > 1) { throw new IllegalArgumentException("Multiple serviceIds are " + "configured. " + serviceIds.toArray().toString()); } else { String serviceId = serviceIds.iterator().next(); Collection<String> omNodeIds = OmUtils.getOMNodeIds(conf, serviceId); if (omNodeIds.size() == 0) { throw new IllegalArgumentException(OZONE_OM_NODES_KEY + "." + serviceId + " is not defined"); } omServiceAdd = new Text(OzoneS3Util.buildServiceNameForToken(conf, serviceId, omNodeIds)); omserviceID = serviceId; } } }

Target:
public void init() { Collection<String> serviceIdList = conf.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY); if (serviceIdList.size() == 0) { omServiceAddr = SecurityUtil.buildTokenService(OmUtils. getOmAddressForClients(conf)); } else { if (serviceIdList.size() > 1) { throw new IllegalArgumentException("Multiple serviceIds are " + "configured. " + Arrays.toString(serviceIdList.toArray())); } else { String serviceId = serviceIdList.iterator().next(); Collection<String> omNodeIds = OmUtils.getOMNodeIds(conf, serviceId); if (omNodeIds.size() == 0) { throw new IllegalArgumentException(OZONE_OM_NODES_KEY + "." + serviceId + " is not defined"); } omServiceAddr = new Text(OzoneS3Util.buildServiceNameForToken(conf, serviceId, omNodeIds)); omserviceID = serviceId; } } }
Source:
public void testSerializeDeserialize() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); final OrderType type = OrderType.ASK; final BigDecimal originalAmount = new BigDecimal("100.501"); final BigDecimal averagePrice = new BigDecimal("255.00"); final BigDecimal cumulativeAmount = new BigDecimal("0.00"); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; final BigDecimal limitPrice = new BigDecimal("250.34"); final BigDecimal fee = new BigDecimal("22.2"); final Date timestamp = new Date(); final String id = "id"; final Order.OrderStatus status = Order.OrderStatus.FILLED; final LimitOrder original = new LimitOrder( type, originalAmount, currencyPair, id, timestamp, limitPrice, averagePrice, cumulativeAmount, fee, status); original.addOrderFlag(TestFlags.TEST1); original.addOrderFlag(TestFlags.TEST3); LimitOrder jsonCopy = ObjectMapperHelper.viaJSON(original); assertThat(jsonCopy).isEqualToIgnoringGivenFields(original, "cumulativeAmount"); assertTrue(jsonCopy.getCumulativeAmount().compareTo(original.getCumulativeAmount()) == 0); }

Target:
public void testSerializeDeserialize() throws IOException { final OrderType type = OrderType.ASK; final BigDecimal originalAmount = new BigDecimal("100.501"); final BigDecimal averagePrice = new BigDecimal("255.00"); final BigDecimal cumulativeAmount = new BigDecimal("0.00"); final CurrencyPair currencyPair = CurrencyPair.BTC_USD; final BigDecimal limitPrice = new BigDecimal("250.34"); final BigDecimal fee = new BigDecimal("22.2"); final Date timestamp = new Date(); final String id = "id"; final Order.OrderStatus status = Order.OrderStatus.FILLED; final LimitOrder original = new LimitOrder( type, originalAmount, currencyPair, id, timestamp, limitPrice, averagePrice, cumulativeAmount, fee, status); original.addOrderFlag(TestFlags.TEST1); original.addOrderFlag(TestFlags.TEST3); LimitOrder jsonCopy = ObjectMapperHelper.viaJSON(original); assertThat(jsonCopy).isEqualToIgnoringGivenFields(original, "cumulativeAmount"); assertTrue(jsonCopy.getCumulativeAmount().compareTo(original.getCumulativeAmount()) == 0); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; if (getClass() != o.getClass()) return false; TestAutoSerializerObject1 test = (TestAutoSerializerObject1) o; return Objects.equals(data1, test.data1) && Objects.equals(data2, test.data2) && Objects.equals(numData3, test.numData3); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TestAutoSerializerObject1 test = (TestAutoSerializerObject1) o; return Objects.equals(data1, test.data1) && Objects.equals(data2, test.data2) && Objects.equals(numData, test.numData); }
Source:
@Override public void init(ServiceContext ctx) throws Exception { }

Target:
@Override public void init(ServiceContext ctx) { }
Source:
public boolean onSpawnEntityInWorld(World world, Entity entity, IBlockSource source, ItemStack stack) { ((Projectile) entity).setShooter((ProjectileSource) source.getBlockTileEntity()); return world.spawnEntityInWorld(entity); }

Target:
public boolean onSpawnEntityInWorld(World world, Entity entity, IBlockSource source, ItemStack stack) { TileEntity tileEntity = source.getBlockTileEntity(); if (entity instanceof Projectile && tileEntity instanceof ProjectileSource) { ((Projectile) entity).setShooter((ProjectileSource) tileEntity); } return world.spawnEntityInWorld(entity); }
Source:
private void validateHavingClause(FilterExpression havingClause) { if (havingClause instanceof FilterPredicate) { Path path = ((FilterPredicate) havingClause).getPath(); Path.PathElement last = path.lastElement().get(); Class<?> cls = last.getType(); String fieldName = last.getFieldName(); if (cls != queriedTable.getCls()) { throw new InvalidOperationException( String.format( "Classes don't match when try filtering on %s in having clause of %s.", cls.getSimpleName(), queriedTable.getCls().getSimpleName())); } if (queriedTable.isMetric(fieldName)) { if (metrics.stream().noneMatch(m -> m.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Metric field %s must be aggregated before filtering in having clause.", fieldName)); } } else { if (dimensionProjections.stream().noneMatch(dim -> dim.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Dimension field %s must be grouped before filtering in having clause.", fieldName)); } } } else if (havingClause instanceof AndFilterExpression) { validateHavingClause(((AndFilterExpression) havingClause).getLeft()); validateHavingClause(((AndFilterExpression) havingClause).getRight()); } else if (havingClause instanceof OrFilterExpression) { validateHavingClause(((OrFilterExpression) havingClause).getLeft()); validateHavingClause(((OrFilterExpression) havingClause).getRight()); } else if (havingClause instanceof NotFilterExpression) { validateHavingClause(((NotFilterExpression) havingClause).getNegated()); } }

Target:
private void validateHavingClause(FilterExpression havingClause) { if (havingClause instanceof FilterPredicate) { Path path = ((FilterPredicate) havingClause).getPath(); Path.PathElement last = path.lastElement().get(); Class<?> cls = last.getType(); String fieldName = last.getFieldName(); if (cls != queriedTable.getCls()) { throw new InvalidOperationException( String.format( "Can't filter on relationship field %s in HAVING clause when querying table %s.", path.toString(), queriedTable.getCls().getSimpleName())); } if (queriedTable.isMetric(fieldName)) { if (metrics.stream().noneMatch(m -> m.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Metric field %s must be aggregated before filtering in having clause.", fieldName)); } } else { if (dimensionProjections.stream().noneMatch(dim -> dim.getAlias().equals(fieldName))) { throw new InvalidOperationException( String.format( "Dimension field %s must be grouped before filtering in having clause.", fieldName)); } } } else if (havingClause instanceof AndFilterExpression) { validateHavingClause(((AndFilterExpression) havingClause).getLeft()); validateHavingClause(((AndFilterExpression) havingClause).getRight()); } else if (havingClause instanceof OrFilterExpression) { validateHavingClause(((OrFilterExpression) havingClause).getLeft()); validateHavingClause(((OrFilterExpression) havingClause).getRight()); } else if (havingClause instanceof NotFilterExpression) { validateHavingClause(((NotFilterExpression) havingClause).getNegated()); } }
Source:
protected void execute() { try { int resetCode = starter.launch() .cmds(Arrays.asList(gitPath, "reset", "--hard", baseCommit)) .stdout(logStream) .join(); if (resetCode != 0) { info("Got non-zero exit code resetting to base commit " + baseCommit + ": " + resetCode); } starter.launch() .stdout(logStream) .cmds(Arrays.asList(gitPath, "clean", "-fd", "-f")) .join(); starter.launch() .stdout(logStream) .cmds(Arrays.asList(gitPath, "submodule", "update", "--init", "--recursive")) .join(); List<String> params = new ArrayList<String>(Arrays.asList("--nobranch", "--diff", diffID)); if (!createCommit) { params.add("--nocommit"); } ArcanistClient arc = new ArcanistClient( arcPath, "patch", conduitToken, params.toArray(new String[params.size()])); int result = arc.callConduit(starter.launch(), logStream); if (result == 0) { this.result = Result.SUCCESS; } else { this.result = Result.FAILURE; } } catch (IOException e) { e.printStackTrace(logStream); this.result = Result.FAILURE; } catch (InterruptedException e) { e.printStackTrace(logStream); this.result = Result.FAILURE; } }

Target:
protected void execute() { try { int exitCode = starter.launch() .cmds(Arrays.asList(gitPath, "reset", "--hard", baseCommit)) .stdout(logStream) .join(); if (exitCode != 0) { info("Got non-zero exit code resetting to base commit " + baseCommit + ": " + exitCode); } starter.launch() .stdout(logStream) .cmds(Arrays.asList(gitPath, "clean", "-fd", "-f")) .join(); starter.launch() .stdout(logStream) .cmds(Arrays.asList(gitPath, "submodule", "update", "--init", "--recursive")) .join(); List<String> arcPatchParams = new ArrayList<String>(Arrays.asList("--nobranch", "--diff", diffID)); if (!createCommit) { arcPatchParams.add("--nocommit"); } ArcanistClient arc = new ArcanistClient( arcPath, "patch", conduitToken, arcPatchParams.toArray(new String[arcPatchParams.size()])); exitCode = arc.callConduit(starter.launch(), logStream); this.result = exitCode == 0 ? Result.SUCCESS : Result.FAILURE; } catch (IOException e) { e.printStackTrace(logStream); this.result = Result.FAILURE; } catch (InterruptedException e) { e.printStackTrace(logStream); this.result = Result.FAILURE; } }
Source:
public void refreshAll() { pruneStaleJobs(); Object[] listenersArray = listeners.getListeners(); for (Object element : listenersArray) { ((IJobProgressManagerListener)element).refreshAll(); } }

Target:
public void refreshAll() { pruneStaleJobs(); for (Object element : listeners.getListeners()) { ((IJobProgressManagerListener)element).refreshAll(); } }
Source:
private void initModerator() { moderatorService.isModerator().thenAccept(isModerator -> { if (!isModerator || getPlayer().getSocialStatus().equals(SocialStatus.SELF)) { return; } showModeratorOptions(true); }); }

Target:
private void initModerator() { moderatorService.isModerator().thenAccept(isModeratorProperty::set); }
Source:
private static List<Type> getInputTypes(Type valueType, int arity) { ImmutableList.Builder<Type> builder = ImmutableList.<Type>builder().add(valueType); if (arity > 1) { builder.add(BIGINT); } if (arity > 2) { builder.add(DOUBLE); } return builder.build(); }

Target:
private static List<Type> getInputTypes(Type valueType, int arity) { switch (arity) { case 1: return ImmutableList.of(valueType); case 2: return ImmutableList.of(valueType, BIGINT); case 3: return ImmutableList.of(valueType, BIGINT, DOUBLE); default: throw new IllegalArgumentException(format("Unsupported number of arguments: %s", arity)); } }
Source:
private int maybeUpdateLastAckedSequence(TopicPartition topicPartition, int sequence) { if (sequence > lastAckedSequence(topicPartition).orElse(NO_LAST_ACKED_SEQUENCE_NUMBER)) { topicPartitionBookkeeper.getPartition(topicPartition).lastAckedSequence = sequence; return sequence; } return NO_LAST_ACKED_SEQUENCE_NUMBER; }

Target:
private int maybeUpdateLastAckedSequence(TopicPartition topicPartition, int sequence) { int lastAckedSequence = lastAckedSequence(topicPartition).orElse(NO_LAST_ACKED_SEQUENCE_NUMBER); if (sequence > lastAckedSequence) { topicPartitionBookkeeper.getPartition(topicPartition).lastAckedSequence = sequence; return sequence; } return lastAckedSequence; }
Source:
public void deleteGroup(String username, String group) { throw new RuntimeException("Deleting a group is not supporting in LDAP"); }

Target:
public void deleteGroup(String username, String group) { throw new UnsupportedOperationException("Deleting a group is not supporting in LDAP"); }
Source:
public static <T extends ToolInstallation> T addTool(Jenkins jenkins, Class<T> type) { final ConfigurablePageObject page = ensureConfigPage(jenkins); final String name = type.getAnnotation(ToolInstallationPageObject.class).name(); final Control expandButton = page.control(by.button(name + " installations...")); try { expandButton.click(); } catch (Exception e) { } final Control button = page.control(by.button("Add " + name)); String pathPrefix = button.resolve().getAttribute("path").replaceAll("repeatable-add", "tool"); String path = page.createPageArea(pathPrefix, button::click); return page.newInstance(type, jenkins, path); }

Target:
public static <T extends ToolInstallation> T addTool(Jenkins jenkins, Class<T> type) { final ConfigurablePageObject page = ensureConfigPage(jenkins); final String name = type.getAnnotation(ToolInstallationPageObject.class).name(); final Control expandButton = page.control(by.button(name + " installations...")); try { expandButton.click(); } catch (NoSuchElementException e) { } final Control button = page.control(by.button("Add " + name)); String pathPrefix = button.resolve().getAttribute("path").replaceAll("repeatable-add", "tool"); String path = page.createPageArea(pathPrefix, button::click); return page.newInstance(type, jenkins, path); }
Source:
private void removeFormFromAssignments(DatastoreService ds, Long surveyId, boolean doit) { final List<Entity> toBeSaved = new ArrayList<>(); final Query query = new Query("SurveyAssignment").setFilter(new Query.FilterPredicate("surveyIds", FilterOperator.EQUAL, surveyId)); final PreparedQuery pquery = ds.prepare(query); for (Entity ass : pquery.asIterable(FetchOptions.Builder.withChunkSize(500))) { List<Long> forms = (List<Long>) ass.getProperty("surveyIds"); if (forms == null) { System.out.println("Assignment with no forms:" + ass); } else { forms.remove(surveyId); ass.setProperty("surveyIds", forms); toBeSaved.add(ass); } } if (doit) { System.out.println("Removing from " + toBeSaved.size() + " assignments."); ds.put(toBeSaved); } else { System.out.println("Found in " + toBeSaved.size() + " assignments."); } }

Target:
private void removeFormFromAssignments(DatastoreService ds, Long surveyId, boolean doit) { final List<Entity> toBeSaved = new ArrayList<>(); final Query query = new Query("SurveyAssignment").setFilter(new Query.FilterPredicate("surveyIds", FilterOperator.EQUAL, surveyId)); final PreparedQuery pquery = ds.prepare(query); for (Entity ass : pquery.asIterable(FetchOptions.Builder.withChunkSize(500))) { List<Long> forms = (List<Long>) ass.getProperty("surveyIds"); if (forms == null) { System.out.println("Assignment with no forms:" + ass); } else { forms.remove(surveyId); ass.setProperty("surveyIds", forms); toBeSaved.add(ass); } } if (doit) { System.out.println("Removing from " + toBeSaved.size() + " assignments."); DataUtils.batchSaveEntities(ds,toBeSaved); } else { System.out.println("Found in " + toBeSaved.size() + " assignments."); } }
Source:
private static void assertPartitionsHaveCorrectSize( List<RowsColumnRangeBatchRequest> partitions, int expectedSize) { for (int i = 0; i < partitions.size(); i++) { int actualPartitionSize = RowsColumnRangeBatchRequests.getAllRowsInOrder(partitions.get(i)) .size(); if (i < partitions.size() - 1) { assertThat(actualPartitionSize).isEqualTo(expectedSize); } else { assertThat(actualPartitionSize <= expectedSize).isTrue(); } } }

Target:
private static void assertPartitionsHaveCorrectSize( List<RowsColumnRangeBatchRequest> partitions, int expectedSize) { for (int i = 0; i < partitions.size(); i++) { int actualPartitionSize = RowsColumnRangeBatchRequests.getAllRowsInOrder(partitions.get(i)) .size(); if (i < partitions.size() - 1) { assertThat(actualPartitionSize).isEqualTo(expectedSize); } else { assertThat(actualPartitionSize).isLessThanOrEqualTo(expectedSize); } } }
Source:
public void should_select_from_materialized_view() { String table = TestUtils.generateIdentifier("table"); final String mv = TestUtils.generateIdentifier("mv"); execute( String.format("CREATE TABLE %s (pk int, cc int, v int, PRIMARY KEY (pk, cc))", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,0,0)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,1,1)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,2,2)", table), String.format( "CREATE MATERIALIZED VIEW %s AS SELECT cc FROM %s WHERE cc IS NOT NULL PRIMARY KEY (pk, cc)", mv, table)); ConditionChecker.check() .that( new Callable<Boolean>() { @Override public Boolean call() { return session().execute("SELECT * FROM " + mv).all().size() == 3; } }) .before(1, MINUTES) .becomesTrue(); assertThat(session().execute(select().column("cc").as("mycc").from(mv))) .containsExactly(row(0), row(1), row(2)); }

Target:
public void should_select_from_materialized_view() { String table = TestUtils.generateIdentifier("table"); final String mv = TestUtils.generateIdentifier("mv"); execute( String.format("CREATE TABLE %s (pk int, cc int, v int, PRIMARY KEY (pk, cc))", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,0,0)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,1,1)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,2,2)", table), String.format( "CREATE MATERIALIZED VIEW %s AS SELECT cc FROM %s WHERE cc IS NOT NULL PRIMARY KEY (pk, cc)", mv, table)); ConditionChecker.check() .that( new Callable<Boolean>() { @Override public Boolean call() { return session().execute("SELECT * FROM " + mv).all().size() == 3; } }) .before(1, MINUTES) .becomesTrue(); MaterializedViewMetadata materializedView = session().getCluster().getMetadata().getKeyspace(keyspace).getMaterializedView(mv); assertThat(session().execute(select().column("cc").as("mycc").from(materializedView))) .containsExactly(row(0), row(1), row(2)); }
Source:
public void shutdown(IMediaStream stream, String msg){ logger.error(msg); IClient client = stream.getClient(); if (client != null){ sendClientOnStatusError((IClient)client, "NetStream.Play.Failed", msg); client.setShutdownClient(true); DiagnosticsProvider.addRejectedStreamFromClient(msg, client); } if (stream.getRTPStream() != null && stream.getRTPStream().getSession() !=null){ String sessionId = stream.getRTPStream().getSession().getSessionId(); Ivhost.killRTSPSession(sessionId); RTPSession rtpSession = stream.getRTPStream().getSession(); DiagnosticsProvider.addRejectedStreamFromRTSP(msg, rtpSession); } }

Target:
private void shutdown(IMediaStream stream, String msg){ logger.error(msg); IClient client = stream.getClient(); KalturaStreamType streamType = Utils.getStreamType(stream, stream.getName()); switch(streamType) { case RTMP: sendClientOnStatusError((IClient)client, "NetStream.Play.Failed", msg); client.setShutdownClient(true); DiagnosticsProvider.addRejectedRTMPStream(client, msg); break; case RTSP: sendStreamOnStatusError(stream, "NetStream.Play.Failed", msg); RTPSession rtpSession = stream.getRTPStream().getSession(); appInstance.getVHost().getRTPContext().shutdownRTPSession(rtpSession); DiagnosticsProvider.addRejectedRTSPStream(rtpSession, msg); break; default: sendStreamOnStatusError(stream, "NetStream.Play.Failed", msg); logger.error("Critical, " + streamType + " stream type! failed to play stream. " + msg); break; } }
Source:
public PIDChassisController(ChassisController controller, IMU imu, MotionController motionController, double maxDegreesPerSecond) { this.controller = controller; this.maxDegreesPerSecond = maxDegreesPerSecond; this.imu = imu; this.imu.reset(); this.imu.setPIDSourceType(PIDSourceType.kDisplacement); this.motionController = motionController; motionController.setInputRange(-180.0f, 180.0f); motionController.setOutputRange(-1.0f, 1.0f); motionController.setContinuous(true); try { motionController.reset(); } catch (InvalidSensorException e) { LogKitten.ex(e); } motionController.enable(); targetYaw = imu.getYaw(); lastUpdate = System.currentTimeMillis() / 1000.0; }

Target:
public PIDChassisController(ChassisController controller, IMU imu, MotionController motionController, double maxDegreesPerSecond) { this.controller = controller; this.maxDegreesPerSecond = maxDegreesPerSecond; this.imu = imu; this.imu.reset(); this.imu.setPIDSourceType(PIDSourceType.kDisplacement); this.motionController = motionController; motionController.setInputRange(-180.0f, 180.0f); motionController.setOutputRange(-1.0f, 1.0f); motionController.setContinuous(true); motionController.reset(); motionController.enable(); targetYaw = imu.getYaw(); lastUpdate = System.currentTimeMillis() / 1000.0; }
Source:
protected String getAlias(String field) { String alias = null; Filter include = getMatchingConf().getInclude(); LinkedHashMap<String, Object> conf = getMatchingConf().getConf(); String fullAttributeName =(field!=null)?(getAttribute().getName() + "." + field):(getAttribute().getName()); if (include.getAttribute() instanceof LinkedHashMap<?, ?>) { LinkedHashMap<String, LinkedHashMap<String, String>> attribute = (LinkedHashMap<String, LinkedHashMap<String, String>>) (include.getAttribute()); if (attribute.get(fullAttributeName).get("alias_match") != null) { Pattern p = Pattern.compile(attribute.get(fullAttributeName).get("alias_match")); Matcher m = p.matcher(getBeanName().getCanonicalName() + "." + fullAttributeName); if (m.find()) { alias = m.replaceFirst(attribute.get(fullAttributeName).get(ALIAS)); } } else { alias = attribute.get(fullAttributeName).get(ALIAS); } } else if (conf.get("metric_prefix") != null) { alias = conf.get("metric_prefix") + "." + getDomain() + "." + fullAttributeName; } else if (getDomain().startsWith("org.apache.cassandra")) { alias = getCassandraAlias(); } if (alias == null) { alias = "jmx." + getDomain() + "." + fullAttributeName; } alias = convertMetricName(alias); return alias; }

Target:
protected String getAlias(String field) { String alias = null; Filter include = getMatchingConf().getInclude(); LinkedHashMap<String, Object> conf = getMatchingConf().getConf(); String fullAttributeName =(field!=null)?(getAttribute().getName() + "." + field):(getAttribute().getName()); if (include.getAttribute() instanceof LinkedHashMap<?, ?>) { LinkedHashMap<String, LinkedHashMap<String, String>> attribute = (LinkedHashMap<String, LinkedHashMap<String, String>>) (include.getAttribute()); alias = getUserAlias(attribute, fullAttributeName); } else if (conf.get("metric_prefix") != null) { alias = conf.get("metric_prefix") + "." + getDomain() + "." + fullAttributeName; } else if (getDomain().startsWith("org.apache.cassandra")) { alias = getCassandraAlias(); } if (alias == null) { alias = "jmx." + getDomain() + "." + fullAttributeName; } alias = convertMetricName(alias); return alias; }
Source:
private NumberToStringConverter(NumberFormat numberFormat, Class<?> fromType) { super(fromType, String.class); Objects.requireNonNull(numberFormat, "numberFormat cannot be null"); this.numberFormat = numberFormat; this.fromType = fromType; if (Integer.class.equals(fromType) || Integer.TYPE.equals(fromType) || Long.class.equals(fromType) || Long.TYPE.equals(fromType) || Short.class.equals(fromType) || Short.TYPE.equals(fromType) || Byte.class.equals(fromType) || Byte.TYPE.equals(fromType)) { fromTypeFitsLong = true; } else if (Float.class.equals(fromType) || Float.TYPE.equals(fromType) || Double.class.equals(fromType) || Double.TYPE.equals(fromType)) { fromTypeIsDecimalType = true; } else if (BigInteger.class.equals(fromType)) { fromTypeIsBigInteger = true; } else if (BigDecimal.class.equals(fromType)) { fromTypeIsBigDecimal = true; } }

Target:
private NumberToStringConverter(NumberFormat numberFormat, Class<?> fromType) { super(fromType, String.class); Objects.requireNonNull(numberFormat, "numberFormat must not be null"); this.numberFormat = numberFormat; this.fromType = fromType; if (Integer.class.equals(fromType) || Integer.TYPE.equals(fromType) || Long.class.equals(fromType) || Long.TYPE.equals(fromType) || Short.class.equals(fromType) || Short.TYPE.equals(fromType) || Byte.class.equals(fromType) || Byte.TYPE.equals(fromType)) { fromTypeFitsLong = true; } else if (Float.class.equals(fromType) || Float.TYPE.equals(fromType) || Double.class.equals(fromType) || Double.TYPE.equals(fromType)) { fromTypeIsDecimalType = true; } else if (BigInteger.class.equals(fromType)) { fromTypeIsBigInteger = true; } else if (BigDecimal.class.equals(fromType)) { fromTypeIsBigDecimal = true; } }
Source:
public void buildHeaders(long objectSize, String etag) throws InvalidArgumentException { if (offset != null && offset >= objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": offset " + offset + " is beyond object size " + objectSize); } if (length != null) { if (length >= objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": length " + length + " is beyond object size " + objectSize); } if (offset + length > objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": compose size " + (offset + length) + " is beyond object size " + objectSize); } } Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("x-amz-copy-source", S3Escaper.encodePath(bucketName + "/" + objectName)); headers.put("x-amz-copy-source-if-match", etag); if (headerMap != null) { headers.putAll(headerMap); } if (copyConditions != null) { headers.putAll(copyConditions.getConditions()); } if (sse != null) { headers = sse.headers(); } this.objectSize = objectSize; this.headers = headers; }

Target:
public void buildHeaders(long objectSize, String etag) throws InvalidArgumentException { if (offset != null && offset >= objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": offset " + offset + " is beyond object size " + objectSize); } if (length != null) { if (length > objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": length " + length + " is beyond object size " + objectSize); } if (offset + length > objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": compose size " + (offset + length) + " is beyond object size " + objectSize); } } Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("x-amz-copy-source", S3Escaper.encodePath(bucketName + "/" + objectName)); headers.put("x-amz-copy-source-if-match", etag); if (headerMap != null) { headers.putAll(headerMap); } if (copyConditions != null) { headers.putAll(copyConditions.getConditions()); } if (sse != null) { headers.putAll(sse.copySourceHeaders()); } this.objectSize = objectSize; this.headers = headers; }
Source:
public void testNoArgumentFactoryRegisteredForProperty() { handle.execute("create table beans (id integer, value_type varchar)"); assertThatThrownBy(() -> handle.attach(BeanDao.class).insert(new Bean(1, ValueType.valueOf("foo")))) .hasMessageContaining("No argument factory registered"); handle.registerArgument(new ValueTypeArgumentFactory()); BeanDao dao = handle.attach(BeanDao.class); dao.insert(new Bean(1, ValueType.valueOf("foo"))); assertThat(dao.getById(1)).extracting(Bean::getId, Bean::getValueType) .containsExactly(1, ValueType.valueOf("foo")); }

Target:
public void testNoArgumentFactoryRegisteredForProperty() { handle.execute("create table beans (id integer, value_type varchar)"); assertThatThrownBy(() -> handle.attach(BeanDao.class).insert(new Bean(1, ValueType.valueOf("foo")))) .hasMessageContaining("No argument factory registered"); }
Source:
protected void validateRootGroups(ManagerSpec managerSpec) { Queue<ResourceGroupSpec> groups = new LinkedList<>(managerSpec.getRootGroups()); while (!groups.isEmpty()) { ResourceGroupSpec group = groups.poll(); groups.addAll(group.getSubGroups()); if (group.getSoftCpuLimit().isPresent() || group.getHardCpuLimit().isPresent()) { checkArgument(managerSpec.getCpuQuotaPeriod().isPresent(), "cpuQuotaPeriod must be specified to use cpu limits on group: %s", group.getName()); } if (group.getSoftCpuLimit().isPresent()) { checkArgument(group.getHardCpuLimit().isPresent(), "Must specify hard CPU limit in addition to soft limit"); checkArgument(group.getSoftCpuLimit().get().compareTo(group.getHardCpuLimit().get()) <= 0, "Soft CPU limit cannot be greater than hard CPU limit"); } if (group.getSchedulingPolicy().isPresent()) { switch (group.getSchedulingPolicy().get()) { case WEIGHTED: case WEIGHTED_FAIR: break; case QUERY_PRIORITY: case FAIR: for (ResourceGroupSpec subGroup : group.getSubGroups()) { checkArgument(!subGroup.getSchedulingWeight().isPresent(), "Must use \"weighted\" or \"weighted_fair\" scheduling policy when using scheduling weight"); } break; default: throw new UnsupportedOperationException(); } } } }

Target:
protected void validateRootGroups(ManagerSpec managerSpec) { Queue<ResourceGroupSpec> groups = new LinkedList<>(managerSpec.getRootGroups()); while (!groups.isEmpty()) { ResourceGroupSpec group = groups.poll(); List<ResourceGroupSpec> subGroups = group.getSubGroups(); groups.addAll(subGroups); if (group.getSoftCpuLimit().isPresent() || group.getHardCpuLimit().isPresent()) { checkArgument(managerSpec.getCpuQuotaPeriod().isPresent(), "cpuQuotaPeriod must be specified to use cpu limits on group: %s", group.getName()); } if (group.getSoftCpuLimit().isPresent()) { checkArgument(group.getHardCpuLimit().isPresent(), "Must specify hard CPU limit in addition to soft limit"); checkArgument(group.getSoftCpuLimit().get().compareTo(group.getHardCpuLimit().get()) <= 0, "Soft CPU limit cannot be greater than hard CPU limit"); } if (group.getSchedulingPolicy().isPresent()) { switch (group.getSchedulingPolicy().get()) { case WEIGHTED: case WEIGHTED_FAIR: checkArgument( subGroups.stream().allMatch(t -> t.getSchedulingWeight().isPresent()) || subGroups.stream().noneMatch(t -> t.getSchedulingWeight().isPresent()), format("Must specify scheduling weight for all sub-groups of '%s' or none of them", group.getName())); break; case QUERY_PRIORITY: case FAIR: for (ResourceGroupSpec subGroup : subGroups) { checkArgument(!subGroup.getSchedulingWeight().isPresent(), String.format("Must use 'weighted' or 'weighted_fair' scheduling policy if specifying scheduling weight for '%s'", group.getName())); } break; default: throw new UnsupportedOperationException(); } } } }
Source:
private LeafNode getOrCreateLeafNodeProsodyWorkaround(final String id) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { try { return createNode(id); } catch (XMPPErrorException e1) { if (e1.getXMPPError().getCondition() == Condition.conflict || e1.getXMPPError().getCondition() == Condition.service_unavailable) { Constructor<?> constructor = LeafNode.class.getDeclaredConstructors()[0]; constructor.setAccessible(true); LeafNode res; try { res = (LeafNode) constructor.newInstance(this, id); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e2) { throw new AssertionError(e2); } return res; } throw e1; } }

Target:
private LeafNode getOrCreateLeafNodeProsodyWorkaround(final String id) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { try { return createNode(id); } catch (XMPPErrorException e1) { if (e1.getXMPPError().getCondition() == Condition.conflict) { Constructor<?> constructor = LeafNode.class.getDeclaredConstructors()[0]; constructor.setAccessible(true); LeafNode res; try { res = (LeafNode) constructor.newInstance(this, id); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e2) { throw new AssertionError(e2); } return res; } throw e1; } }
Source:
void checkPartialDisconnectivity(long timestamp) { if (!partialDisconnectionDetectionEnabled) { return; } else if (!clusterService.isMaster()) { logger.severe("Cannot check disconnected members since I am not the master."); return; } try { clusterServiceLock.lock(); if (partialDisconnectionHandler.shouldResolvePartialDisconnections(timestamp)) { Map<MemberImpl, Set<MemberImpl>> disconnections = partialDisconnectionHandler.reset(); nodeEngine.getExecutionService().execute(ASYNC_EXECUTOR, new ResolvePartialDisconnectionsTask(disconnections)); } } finally { clusterServiceLock.unlock(); } }

Target:
void checkPartialDisconnectivity(long timestamp) { if (!partialDisconnectionDetectionEnabled) { return; } else if (!clusterService.isMaster()) { logger.severe("Cannot check disconnected members since I am not the master."); return; } clusterServiceLock.lock(); try { if (partialDisconnectionHandler.shouldResolvePartialDisconnections(timestamp)) { Map<MemberImpl, Set<MemberImpl>> disconnections = partialDisconnectionHandler.reset(); nodeEngine.getExecutionService().execute(ASYNC_EXECUTOR, new ResolvePartialDisconnectionsTask(disconnections)); } } finally { clusterServiceLock.unlock(); } }
Source:
public CreateAdvBuilder makeAdv() { if(advBuilder == null) { advBuilder = new CreateAdvBuilderImpl(this); } return advBuilder; }

Target:
public CreateAdvBuilder makeAdv() { return new CreateAdvBuilderImpl(this); }
Source:
public void execute() { ListResponse<HostResponse> response = null; if (getVirtualMachineId() == null) { response = _queryService.searchForServers(this); } else { Pair<List<? extends Host>, Integer> result; Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal(), null); result = hostsForMigration.first(); List<? extends Host> hostsWithCapacity = hostsForMigration.second(); response = new ListResponse<HostResponse>(); List<HostResponse> hostResponses = new ArrayList<HostResponse>(); for (Host host : result.first()) { HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails()); Boolean suitableForMigration = false; if (hostsWithCapacity.contains(host)) { suitableForMigration = true; } hostResponse.setSuitableForMigration(suitableForMigration); hostResponse.setObjectName("host"); hostResponses.add(hostResponse); } response.setResponses(hostResponses, result.second()); } response.setResponseName(getCommandName()); this.setResponseObject(response); }

Target:
public void execute() { ListResponse<HostResponse> response = getHostResponses(); response.setResponseName(getCommandName()); this.setResponseObject(response); }