auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void imputeZeroCountsAsTargetMedians(final ReadCountCollection readCounts, final Logger logger) { final RealMatrix counts = readCounts.counts(); final int targetCount = counts.getRowDimension(); final Median medianCalculator = new Median(); int totalCounts = counts.getColumnDimension() * counts.getRowDimension(); final long totalZeroCounts = IntStream.range(0, targetCount) .mapToLong(t -> DoubleStream.of(counts.getRow(t)) .filter(c -> c == 0.0).count()).sum(); final double[] medians = IntStream.range(0, targetCount) .mapToDouble(t -> medianCalculator.evaluate( DoubleStream.of(counts.getRow(t)) .filter(c -> c != 0.0) .toArray() )).toArray(); counts.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() { @Override public double visit(final int row, final int column, final double value) { return value != 0 ? value : medians[row]; } }); if (totalZeroCounts > 0) { logger.info(String.format("Some 0.0 counts, %d of %d (%.2f%%), were imputed to their enclosing target non-zero median", totalZeroCounts, totalZeroCounts, 100.0 * (totalZeroCounts / totalCounts))); } else { logger.info("No count is 0.0 thus no count needed to be imputed."); } }

Target:
public static void imputeZeroCountsAsTargetMedians(final ReadCountCollection readCounts, final Logger logger) { final RealMatrix counts = readCounts.counts(); final int targetCount = counts.getRowDimension(); final Median medianCalculator = new Median(); int totalCounts = counts.getColumnDimension() * counts.getRowDimension(); final long totalZeroCounts = IntStream.range(0, targetCount) .mapToLong(t -> DoubleStream.of(counts.getRow(t)) .filter(c -> c == 0.0).count()).sum(); final double[] medians = IntStream.range(0, targetCount) .mapToDouble(t -> medianCalculator.evaluate( DoubleStream.of(counts.getRow(t)) .filter(c -> c != 0.0) .toArray() )).toArray(); counts.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() { @Override public double visit(final int row, final int column, final double value) { return value != 0 ? value : medians[row]; } }); if (totalZeroCounts > 0) { final double totalZeroCountsPercentage = 100.0 * (totalZeroCounts / totalCounts); logger.info(String.format("Some 0.0 counts (%d out of %d, %.2f%%) were imputed to their enclosing target " + "non-zero median", totalZeroCounts, totalZeroCounts, totalZeroCountsPercentage)); } else { logger.info("No count is 0.0 thus no count needed to be imputed."); } }
Source:
protected ImmutableValue<TreeType> constructImmutableValue(TreeType value) { return new ImmutableSpongeValue<>(Keys.TREE_TYPE, value); }

Target:
protected ImmutableValue<TreeType> constructImmutableValue(TreeType value) { return new ImmutableSpongeValue<>(this.key, value); }
Source:
public void getSystemProperty( @Option(value = "named", description = "The property name") final String propertyName, final UIOutput output) { if (propertyName != null && !propertyName.trim().isEmpty()) { output.out().println(System.getProperty(propertyName)); } else { for (final Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { output.out().println(entry.getKey() + " = " + entry.getValue()); } } }

Target:
public String getSystemProperty( @Option(value = "named", description = "The property name") final String propertyName, final UIOutput output) throws IOException { if (!Strings.isNullOrEmpty(propertyName)) { return System.getProperty(propertyName); } else { System.getProperties().store(output.out(), null); } return Strings.EMPTY; }
Source:
public void testGetLoadBalancer() { LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerID); System.out.println(loadBalancer); assertNotNull(loadBalancer); }

Target:
public void testGetLoadBalancer() { LoadBalancer loadBalancer = api.loadBalancerApi().getLoadBalancer(loadBalancerID); assertNotNull(loadBalancer); }
Source:
private ClientMessage encodeAuthenticationRequest() { InternalSerializationService ss = client.getSerializationService(); byte serializationVersion = ss.getVersion(); CandidateClusterContext currentClusterContext = discoveryService.current(); Credentials credentials = currentClusterContext.getCredentialsFactory().newCredentials(); String clusterName = currentClusterContext.getClusterName(); currentCredentials = credentials; if (credentials instanceof PasswordCredentials) { PasswordCredentials cr = (PasswordCredentials) credentials; return ClientAuthenticationCodec .encodeRequest(clusterName, cr.getName(), cr.getPassword(), clientUuid, ClientTypes.JAVA, serializationVersion, BuildInfoProvider.getBuildInfo().getVersion(), client.getName(), labels); } else { Data data; if (credentials instanceof TokenCredentials) { data = new HeapData(((TokenCredentials) credentials).getToken()); } else { data = ss.toData(credentials); } return ClientAuthenticationCustomCodec.encodeRequest(clusterName, data, clientUuid, ClientTypes.JAVA, serializationVersion, BuildInfoProvider.getBuildInfo().getVersion(), client.getName(), labels); } }

Target:
private ClientMessage encodeAuthenticationRequest() { InternalSerializationService ss = client.getSerializationService(); byte serializationVersion = ss.getVersion(); CandidateClusterContext currentClusterContext = discoveryService.current(); Credentials credentials = currentClusterContext.getCredentialsFactory().newCredentials(); String clusterName = currentClusterContext.getClusterName(); currentCredentials = credentials; if (credentials instanceof PasswordCredentials) { PasswordCredentials cr = (PasswordCredentials) credentials; return ClientAuthenticationCodec .encodeRequest(clusterName, cr.getName(), cr.getPassword(), clientUuid, connectionType, serializationVersion, BuildInfoProvider.getBuildInfo().getVersion(), client.getName(), labels); } else { Data data; if (credentials instanceof TokenCredentials) { data = new HeapData(((TokenCredentials) credentials).getToken()); } else { data = ss.toData(credentials); } return ClientAuthenticationCustomCodec.encodeRequest(clusterName, data, clientUuid, connectionType, serializationVersion, BuildInfoProvider.getBuildInfo().getVersion(), client.getName(), labels); } }
Source:
public void testAssetReviews() throws InvalidJsonAssetException, IOException { Asset a = addLittleAsset("weather", "hot", "ground", "flat", "description", "lovely"); List<Map<String, Object>> ars = repository.getAssetReviews(a.get_id()); assertEquals("Should be an empty List", 0, ars.size()); RepositoryContext userRepo = RepositoryContext.toUserContext(repository); try { userRepo.getAssetReviews(a.get_id()); } catch (AssertionError e) { assertThat(e.getMessage(), containsString("Unexpected status code: 404")); } }

Target:
public void testAssetReviews() throws InvalidJsonAssetException, IOException { Asset a = addLittleAsset("weather", "hot", "ground", "flat", "description", "lovely"); List<Map<String, Object>> ars = repository.getAssetReviews(a.get_id()); assertEquals("Should be an empty List", 0, ars.size()); RepositoryContext userRepo = RepositoryContext.toUserContext(repository); userRepo.getAssetReviewsBad(a.get_id(), 404, "asset not found for id: " + a.get_id()); }
Source:
public String sameSite() { return sameSite; }

Target:
public SameSite sameSite() { return sameSite; }
Source:
public List<FieldInfo> createFieldInfoMap(String str) { fieldInfos = new ArrayList<FieldInfo>(); StringTokenizer strtok = new StringTokenizer(str, RECORD_SEPARATOR); while (strtok.hasMoreTokens()) { String[] token = strtok.nextToken().split(FIELD_SEPARATOR); fieldInfos.add(new FieldInfo(token[0], token[1], SupportType.valueOf(token[2]))); } return fieldInfos; }

Target:
private List<FieldInfo> createFieldInfoMap(String str) { fieldInfos = new ArrayList<FieldInfo>(); StringTokenizer strtok = new StringTokenizer(str, RECORD_SEPARATOR); while (strtok.hasMoreTokens()) { String[] token = strtok.nextToken().split(FIELD_SEPARATOR); try { fieldInfos.add(new FieldInfo(token[0], token[1], SupportType.valueOf(token[2]))); } catch (Exception e) { LOG.error("Invalid support type", e); } } return fieldInfos; }
Source:
public void emitsError_whenResponseCodeIsInvalid() throws IOException { given(httpClient.execute(requestCreator.createDownloadRequest(ANY_RAW_URL))).willReturn(INVALID_RESPONSE); networkFileDownloader.startDownloading(ANY_RAW_URL, UNKNOWN_FILE_SIZE, callback); String expectedCause = String.format( "Request: %s with response code: %s failed.", ANY_RAW_URL, 418 ); verify(callback).onError(expectedCause); }

Target:
public void emitsError_whenResponseCodeIsInvalid() throws IOException { given(httpClient.execute(requestCreator.createDownloadRequest(ANY_RAW_URL))).willReturn(INVALID_RESPONSE); networkFileDownloader.startDownloading(ANY_RAW_URL, UNKNOWN_FILE_SIZE, callback); String expectedCause = "Request: <LINK_0> with response code: 418 failed."; verify(callback).onError(expectedCause); }
Source:
public void testCreateValidCase() { final String body = "{\"context\":\"CLUSTER\", \"name\":\"test-name\", \"cluster\":\"test-cluster\", " + "\"metric\":\"test-metric\", \"service\":\"test-service\", \"statistic\": \"test-statistic\", " + "\"period\": 1000, \"operator\":\"EQUAL_TO\", \"value\":{\"value\":12.0, \"unit\":\"MEGABYTE\"}, " + "\"nagiosExtension\":{\"severity\":\"CRITICAL\", \"notify\":\"abc@example.com\", " + "\"maxCheckAttempts\":3, \"freshnessThresholdInSeconds\":300}}"; Http.RequestBuilder request = new Http.RequestBuilder() .method("POST") .bodyJson(Json.parse(body)) .header("Content-Type", "application/json") .uri("/v1/alerts"); Result result = Helpers.route(request); Assert.assertEquals(Http.Status.OK, result.status()); }

Target:
public void testCreateValidCase() throws IOException { Http.RequestBuilder request = new Http.RequestBuilder() .method("PUT") .bodyJson(readTree("testCreateValidCase")) .header("Content-Type", "application/json") .uri("/v1/alerts"); Result result = Helpers.route(request); Assert.assertEquals(Http.Status.OK, result.status()); }
Source:
public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { if (originalViewItem instanceof HostNetworkInterfaceListViewItem) { HostNetworkInterfaceListViewItem original = (HostNetworkInterfaceListViewItem) originalViewItem; setLogicalNetworkExpanded(original.getLogicalNetworkState()); } }

Target:
public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { if (originalViewItem instanceof HostNetworkInterfaceListViewItem) { setLogicalNetworkExpanded(((HostNetworkInterfaceListViewItem) originalViewItem).getLogicalNetworkState()); } }
Source:
private String resolveVariantClassification(String variant, String variantType, Boolean isInframe) { String defaultValue = "Targeted_Region"; if ((variant == null || variantType == null) && !variant.contains("splice")) { return defaultValue; } else { variant = variant.toLowerCase(); } if ((variant.equals("frameshift_variant") || variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && !isInframe) { if (variantType.equals("DEL")) { return "Frame_Shift_Del"; } else if (variantType.equals("INS")) { return "Frame_Shift_Ins"; } } else if ((variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && isInframe) { if (variantType.equals("DEL")) { return "In_Frame_Del"; } else if (variantType.equals("INS")) { return "In_Frame_Ins"; } } return VARIANT_MAP.getOrDefault(variant, defaultValue); }

Target:
private String resolveVariantClassification(String variant, String variantType, Boolean isInframe) { String defaultValue = "Targeted_Region"; if (variant == null || (variantType == null && !variant.contains("splice"))) { return defaultValue; } else { variant = variant.toLowerCase(); } if ((variant.equals("frameshift_variant") || variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && !isInframe) { if (variantType.equals("DEL")) { return "Frame_Shift_Del"; } else if (variantType.equals("INS")) { return "Frame_Shift_Ins"; } } else if ((variant.equals("protein_altering_variant") || variant.equals("coding_sequence_variant")) && isInframe) { if (variantType.equals("DEL")) { return "In_Frame_Del"; } else if (variantType.equals("INS")) { return "In_Frame_Ins"; } } return VARIANT_MAP.getOrDefault(variant, defaultValue); }
Source:
private void onEvent(final Set<Method> onEventMethods, final Object sink, final Object payload, final IEvent<?> event) { try { for (Method method : onEventMethods) { if (canCallListenerInterface(sink, method)) { OnEvent onEvent = method.getAnnotation(OnEvent.class); if (isPayloadApplicableToHandler(onEvent, payload)) { Object result = method.invoke(sink, payload); if (result instanceof Visit<?>) { Visit<?> visit = (Visit<?>) result; if (visit.isDontGoDeeper()) { event.dontBroadcastDeeper(); } else if (visit.isStopped()) { event.stop(); break; } } else if (onEvent.stop()) { event.stop(); break; } } } } } catch (InvocationTargetException e) { if (e.getCause() != null && e.getCause() instanceof ReplaceHandlerException) { throw ((ReplaceHandlerException)e.getCause()); } else { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } } catch (IllegalAccessException e) { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } }

Target:
private void onEvent(final Set<Method> onEventMethods, final Object sink, final Object payload, final IEvent<?> event) { try { for (Method method : onEventMethods) { if (canCallListenerInterface(sink, method)) { OnEvent onEvent = method.getAnnotation(OnEvent.class); if (isPayloadApplicableToHandler(onEvent, payload)) { Object result = method.invoke(sink, payload); if (result instanceof Visit<?>) { Visit<?> visit = (Visit<?>) result; if (visit.isDontGoDeeper()) { event.dontBroadcastDeeper(); } else if (visit.isStopped()) { event.stop(); break; } } else if (onEvent.stop()) { event.stop(); break; } } } } } catch (InvocationTargetException e) { if (e.getCause() instanceof ReplaceHandlerException) { throw ((ReplaceHandlerException)e.getCause()); } else { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } } catch (IllegalAccessException e) { throw new IllegalStateException("Failed to invoke @OnEvent method", e); } }
Source:
private CopyNumberTriStateSegment composeSegment(final List<Target> targets, final CopyNumberTriState call, final Target precedingTarget, final Target followingTarget, final ForwardBackwardAlgorithm.Result<Double, Target, CopyNumberTriState> fbResult, final List<Double> inputValues) { final int length = targets.size(); final Target firstTarget = targets.get(0); final double mean = inputValues.stream().mapToDouble(d -> d).sum() / length; final double stdev = inputValues.size() <= 1 ? 0 : Math.sqrt(inputValues.stream().mapToDouble(d -> (d - mean) * (d - mean)).sum() / (length - 1)); final double logExactProbability = logExactProbability(firstTarget, length, call, fbResult); final double logSomeProbability = logSomeProbability(firstTarget, length, call, fbResult); final double logStartProbability = logStartProbability(precedingTarget, firstTarget, call, fbResult); final double logEndProbability = logEndProbability(targets.get(length - 1), followingTarget, call, fbResult); final double logNeutralProbability = fbResult.logProbability(firstTarget, Collections.nCopies(targets.size(), CopyNumberTriState.NEUTRAL)); return new CopyNumberTriStateSegment(targets, mean, stdev, call, logToPhredScore(logExactProbability, true), logToPhredScore(logSomeProbability, true), logToPhredScore(logStartProbability, true), logToPhredScore(logEndProbability, true), logToPhredScore(logNeutralProbability, false)); }

Target:
private CopyNumberTriStateSegment composeSegment(final List<Target> targets, final CopyNumberTriState call, final Target precedingTarget, final Target followingTarget, final ForwardBackwardAlgorithm.Result<Double, Target, CopyNumberTriState> fbResult, final List<Double> inputValues) { final int length = targets.size(); final Target firstTarget = targets.get(0); final double mean = inputValues.stream().mapToDouble(d -> d).average().getAsDouble(); final double stdev = inputValues.size() <= 1 ? 0 : Math.sqrt(inputValues.stream().mapToDouble(d -> (d - mean) * (d - mean)).sum() / (length - 1)); final double logExactProbability = logExactProbability(firstTarget, length, call, fbResult); final double logSomeProbability = logSomeProbability(firstTarget, length, call, fbResult); final double logStartProbability = logStartProbability(precedingTarget, firstTarget, call, fbResult); final double logEndProbability = logEndProbability(targets.get(length - 1), followingTarget, call, fbResult); final double logNeutralProbability = fbResult.logProbability(firstTarget, Collections.nCopies(targets.size(), CopyNumberTriState.NEUTRAL)); return new CopyNumberTriStateSegment(targets, mean, stdev, call, logToPhredScore(logExactProbability, true), logToPhredScore(logSomeProbability, true), logToPhredScore(logStartProbability, true), logToPhredScore(logEndProbability, true), logToPhredScore(logNeutralProbability, false)); }
Source:
public InvocationContext createSingleKeyNonTxInvocationContext() { InvocationContext ctx = new SingleKeyNonTxInvocationContext(true, keyEq); return ctx; }

Target:
public InvocationContext createSingleKeyNonTxInvocationContext() { return new SingleKeyNonTxInvocationContext(true, keyEq); }
Source:
public void anonymizedUserProfilePageRemoved() { Credentials credentials = new Credentials(); String timestamp = Long.toString(DateTime.now().getMillis()); String qanon = "QAanon" + timestamp; String passw = "makak"; SignUpUser user = new SignUpUser(qanon, credentials.emailAnonymousUserTestWikia, passw, LocalDate.of(1990, 3, 19)); UserRegistration.registerUserEmailConfirmed(user); SpecialAnonymizationUserPage anonymizationStaff = new SpecialAnonymizationUserPage().open(); anonymizationStaff.loginAs(User.STAFF); anonymizationStaff.fillFutureAnon(qanon) .submitAnonymization(); Assertion.assertStringContains(anonymizationStaff.getAnonConfirmation(), qanon); UserProfilePage userProfilePage = new UserProfilePage().open(qanon); Assertion.assertTrue(userProfilePage.getUserNotExists().equals(String.format("User account \"%s\" does not exist or has never logged in on this wiki.", qanon))); }

Target:
public void anonymizedUserProfilePageRemoved() { Credentials credentials = new Credentials(); String timestamp = Long.toString(DateTime.now().getMillis()); String qanon = "QAanon" + timestamp; String passw = "makak"; SignUpUser user = new SignUpUser(qanon, credentials.emailAnonymousUserTestWikia, passw, LocalDate.of(1990, 3, 19)); UserRegistration.registerUserEmailConfirmed(user); SpecialAnonymizationUserPage anonymizationStaff = new SpecialAnonymizationUserPage().open(); anonymizationStaff.loginAs(User.STAFF); anonymizationStaff.fillFutureAnon(qanon) .submitAnonymization(); Assertion.assertStringContains(anonymizationStaff.getAnonConfirmation(), qanon); UserProfilePage userProfilePage = new UserProfilePage().open(qanon); Assertion.assertTrue(userProfilePage.getNotExistsMessage().equals(String.format("User account \"%s\" does not exist or has never logged in on this wiki.", qanon))); }
Source:
private void postProcessAbstractEndpoint(Object bean) { if (bean instanceof IntegrationConsumer) { IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean; MessageHandler handler = integrationConsumer.getHandler(); if (handler instanceof AbstractMessageHandler) { MessageHandler monitor = (MessageHandler) extractTarget(handler); if (monitor instanceof IntegrationManagement) { registerHandler((IntegrationManagement) monitor); this.handlers.put(((IntegrationManagement) monitor).getComponentName(), (IntegrationManagement) monitor); this.runtimeBeans.add(monitor); } return; } } else if (bean instanceof SourcePollingChannelAdapter) { SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean; MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource(); if (messageSource instanceof IntegrationInboundManagement) { IntegrationInboundManagement monitor = (IntegrationInboundManagement) extractTarget(messageSource); registerSource(monitor); this.sourceLifecycles.put(monitor, pollingChannelAdapter); this.runtimeBeans.add(monitor); return; } } registerEndpoint((AbstractEndpoint) bean); this.runtimeBeans.add(bean); }

Target:
private void postProcessAbstractEndpoint(Object bean) { if (bean instanceof IntegrationConsumer) { IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean; MessageHandler handler = integrationConsumer.getHandler(); MessageHandler monitor = (MessageHandler) extractTarget(handler); if (monitor instanceof IntegrationManagement) { registerHandler((IntegrationManagement) monitor); this.handlers.put(((IntegrationManagement) monitor).getComponentName(), (IntegrationManagement) monitor); this.runtimeBeans.add(monitor); } return; } else if (bean instanceof SourcePollingChannelAdapter) { SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean; MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource(); if (messageSource instanceof IntegrationInboundManagement) { IntegrationInboundManagement monitor = (IntegrationInboundManagement) extractTarget(messageSource); registerSource(monitor); this.sourceLifecycles.put(monitor, pollingChannelAdapter); this.runtimeBeans.add(monitor); return; } } registerEndpoint((AbstractEndpoint) bean); this.runtimeBeans.add(bean); }
Source:
private void assertsForRemoveObjectAsLeftSibling(JsonNodeReadOnlyTrx rtx) { assertFalse(rtx.hasNode(17)); assertFalse(rtx.hasNode(18)); assertFalse(rtx.hasNode(19)); rtx.moveTo(16); assertEquals(4, rtx.getChildCount()); assertEquals(6, rtx.getDescendantCount()); assertEquals(20, rtx.getFirstChildKey()); rtx.moveTo(20); assertEquals(-1, rtx.getLeftSiblingKey()); }

Target:
private void assertsForRemoveObjectAsLeftSibling(JsonNodeReadOnlyTrx rtx) { assertFalse(rtx.hasNode(17)); assertFalse(rtx.hasNode(18)); assertFalse(rtx.hasNode(19)); rtx.moveTo(16); assertEquals(4, rtx.getChildCount()); assertEquals(6, rtx.getDescendantCount()); assertEquals(20, rtx.getFirstChildKey()); rtx.moveTo(20); assertEquals(Fixed.NULL_NODE_KEY.getStandardProperty(), rtx.getLeftSiblingKey()); }
Source:
public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); setVmQuotaPercentage(to, vm); if (dpdkHelper.isDpdkvHostUserModeSettingOnServiceOffering(vm)) { dpdkHelper.setDpdkVhostUserMode(to, vm); } if (to.getType() == VirtualMachine.Type.User && MapUtils.isNotEmpty(to.getExtraConfig()) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_NUMA) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_HUGE_PAGES)) { for (final NicTO nic : to.getNics()) { nic.setDpdkEnabled(true); } } GuestOSVO guestOS = _guestOsDao.findByIdIncludingRemoved(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId()); GuestOSHypervisorVO guestOsMapping = null; if (host != null) { guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion()); } if (guestOsMapping == null || host == null) { to.setPlatformEmulator(guestOS.getDisplayName()); } else { to.setPlatformEmulator(guestOsMapping.getGuestOsName()); } return to; }

Target:
public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); setVmQuotaPercentage(to, vm); if (dpdkHelper.isDpdkvHostUserModeSettingOnServiceOffering(vm)) { dpdkHelper.setDpdkVhostUserMode(to, vm); } if (to.getType() == VirtualMachine.Type.User && MapUtils.isNotEmpty(to.getExtraConfig()) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_NUMA) && to.getExtraConfig().containsKey(DpdkHelper.DPDK_HUGE_PAGES)) { for (final NicTO nic : to.getNics()) { nic.setDpdkEnabled(true); } } GuestOSVO guestOS = _guestOsDao.findByIdIncludingRemoved(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId()); GuestOSHypervisorVO guestOsMapping = null; if (host != null) { guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion()); } if (guestOsMapping == null || host == null) { to.setPlatformEmulator(guestOS.getDisplayName() == null ? "Other" : guestOS.getDisplayName()); } else { to.setPlatformEmulator(guestOsMapping.getGuestOsName()); } return to; }
Source:
public static Collection<String> listAllTargets(@NotNull String projectPath) throws PantsException { GeneralCommandLine cmd = PantsUtil.defaultCommandLine(projectPath); try (TempFile tempFile = TempFile.create("list", ".out")) { cmd.addParameters( "list", Paths.get(projectPath).getParent().toString() + ':', String.format("%s=%s", PantsConstants.PANTS_CLI_OPTION_LIST_OUTPUT_FILE, tempFile.getFile().getPath()) ); final ProcessOutput processOutput = PantsUtil.getCmdOutput(cmd, null); final String listOutput = FileUtil.loadFile(tempFile.getFile()); if (processOutput.checkSuccess(LOG)) { return Arrays.asList(listOutput.split("\n")); } else { final String errorDescription = String.format("could not list targets: pants exited with status %d\n", processOutput.getExitCode()) + String.format("argv: '%s'\n", cmd.getCommandLineString()) + String.format("stdout:\n%s\n", listOutput) + String.format("warnings:\n%s\n", processOutput.getStdout()) + String.format("stderr:\n%s\n", processOutput.getStderr()); LOG.warn(errorDescription); throw new PantsException(errorDescription); } } catch (IOException | ExecutionException e) { final String noProcessErrMsg = String.format("could not execute command: '%s' due to error: '%s'", cmd.getCommandLineString(), e.getMessage()); LOG.warn(noProcessErrMsg, e); throw new PantsException(noProcessErrMsg); } }

Target:
public static Collection<String> listAllTargets(@NotNull String projectPath) throws PantsException { if (!PantsUtil.isBUILDFilePath(projectPath)) { return Lists.newArrayList(); } GeneralCommandLine cmd = PantsUtil.defaultCommandLine(projectPath); try (TempFile tempFile = TempFile.create("list", ".out")) { cmd.addParameters( "list", Paths.get(projectPath).getParent().toString() + ':', String.format("%s=%s", PantsConstants.PANTS_CLI_OPTION_LIST_OUTPUT_FILE, tempFile.getFile().getPath() ) ); final ProcessOutput processOutput = PantsUtil.getCmdOutput(cmd, null); if (processOutput.checkSuccess(LOG)) { final String output = FileUtil.loadFile(tempFile.getFile()); return Arrays.asList(output.split("\n")); } else { List<String> errorLogs = Lists.newArrayList( String.format("Could not list targets: Pants exited with status %d", processOutput.getExitCode()), String.format("argv: '%s'", cmd.getCommandLineString()), "stdout:", processOutput.getStdout(), "stderr:", processOutput.getStderr()); final String errorMessage = String.join("\n", errorLogs); LOG.warn(errorMessage); throw new PantsException(errorMessage); } } catch (IOException | ExecutionException e) { final String processCreationFailureMessage = String.format("Could not execute command: '%s' due to error: '%s'", cmd.getCommandLineString(), e.getMessage()); LOG.warn(processCreationFailureMessage, e); throw new PantsException(processCreationFailureMessage); } }
Source:
public void clientId() throws IOException { Stripe.clientId = "ca_test"; chargeBody = resource("charge.json"); }

Target:
public void clientId() throws IOException { chargeBody = resource("charge.json"); }
Source:
ConfigurationDialog(ConfigurationDialogForm form, ConfigurationPanel confPanel) { this.form = form; this.confPanel = confPanel; if (!confPanel.isEmpty()) form.enableClearAll(); confPanel.onChange(() -> { if (!confPanel.getConfiguration().isEmpty()) form.enableClearAll(); else form.disableClearAll(); if (true) form.enableOK(); else form.disableOK(); }); }

Target:
ConfigurationDialog(ConfigurationDialogForm form, ConfigurationPanel confPanel) { this.form = form; this.confPanel = confPanel; if (!confPanel.isEmpty()) form.enableClearAll(); confPanel.onChange(() -> { if (!confPanel.getConfiguration().isEmpty()) form.enableClearAll(); else form.disableClearAll(); if (confPanel.getConfiguration().isValidAsCustomConf()) form.enableOK(); else form.disableOK(); }); }
Source:
public void testEmulator() { Map<String, String> oldEnv = System.getenv();` Map<String, String> testEnv = new HashMap<>(); testEnv.put(BigtableOptions.BIGTABLE_EMULATOR_HOST_ENV_VAR, "localhost:1234"); setTestEnv(testEnv); BigtableOptions options = new BigtableOptions.Builder() .setPort(443) .setDataHost("xxx") .build(); Assert.assertEquals(1234, options.getPort()); Assert.assertEquals("localhost", options.getDataHost()); Assert.assertEquals("localhost", options.getAdminHost()); Assert.assertTrue(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.nullCredential(), options.getCredentialOptions()); setTestEnv(oldEnv); options = new BigtableOptions.Builder() .setDataHost("override") .build(); Assert.assertEquals(BigtableOptions.BIGTABLE_PORT_DEFAULT, options.getPort()); Assert.assertEquals("override", options.getDataHost()); Assert.assertEquals(BigtableOptions.BIGTABLE_ADMIN_HOST_DEFAULT, options.getAdminHost()); Assert.assertFalse(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.defaultCredentials(), options.getCredentialOptions()); }

Target:
public void testEmulator() { Map<String, String> oldEnv = System.getenv(); Map<String, String> testEnv = new HashMap<>(); testEnv.put(BigtableOptions.BIGTABLE_EMULATOR_HOST_ENV_VAR, "localhost:1234"); setTestEnv(testEnv); BigtableOptions options = new BigtableOptions.Builder() .setPort(443) .setDataHost("xxx") .build(); Assert.assertEquals(1234, options.getPort()); Assert.assertEquals("localhost", options.getDataHost()); Assert.assertEquals("localhost", options.getAdminHost()); Assert.assertTrue(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.nullCredential(), options.getCredentialOptions()); setTestEnv(oldEnv); options = new BigtableOptions.Builder() .setDataHost("override") .build(); Assert.assertEquals(BigtableOptions.BIGTABLE_PORT_DEFAULT, options.getPort()); Assert.assertEquals("override", options.getDataHost()); Assert.assertEquals(BigtableOptions.BIGTABLE_ADMIN_HOST_DEFAULT, options.getAdminHost()); Assert.assertFalse(options.usePlaintextNegotiation()); Assert.assertEquals(CredentialOptions.defaultCredentials(), options.getCredentialOptions()); }
Source:
public int getPid() { ITmfEventField pidContext = this.getContent().getField("context._pid"); if (null != pidContext) { return ((Integer) pidContext.getValue()).intValue(); } CtfKernelTrace trace = (CtfKernelTrace) this.getTrace(); ITmfStateSystem ss = trace.getStateSystem(CtfKernelTrace.STATE_ID); int retVal = -1; try { int threadNode = ss.getQuarkAbsolute(Attributes.CPUS, String.valueOf(getCPU()), Attributes.CURRENT_THREAD); ITmfStateValue sv = ss.querySingleState(this.getTimestamp().getValue(), threadNode).getStateValue(); retVal = Math.max(0, sv.unboxInt()); } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (TimeRangeException e) { e.printStackTrace(); } catch (StateSystemDisposedException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } return retVal; }

Target:
public int getPid() { ITmfEventField pidContext = this.getContent().getField("context._pid"); if (null != pidContext) { return ((Integer) pidContext.getValue()).intValue(); } ITmfStateSystem ss = getTrace().getStateSystem(CtfKernelTrace.STATE_ID); int retVal = -1; try { int threadNode = ss.getQuarkAbsolute(Attributes.CPUS, String.valueOf(getCPU()), Attributes.CURRENT_THREAD); ITmfStateValue sv = ss.querySingleState(this.getTimestamp().getValue(), threadNode).getStateValue(); retVal = Math.max(0, sv.unboxInt()); } catch (AttributeNotFoundException e) { } catch (TimeRangeException e) { e.printStackTrace(); } catch (StateSystemDisposedException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } return retVal; }
Source:
private RemoteEMTask(final MemoryStore memorystore, final OperationRouter router, final AggregationSlave aggregationSlave, final EvalSideMsgHandler msgHandler, final SerializableCodec<String> codec, @Parameter(TaskConfigurationOptions.Identifier.class) final String taskId) { this.memoryStore = memorystore; this.router = router; this.aggregationSlave = aggregationSlave; this.msgHandler = msgHandler; this.codec = codec; this.taskId = taskId; LOG.log(Level.INFO, "taskId: {0}", taskId); }

Target:
private RemoteEMTask(final MemoryStore memorystore, final OperationRouter router, final AggregationSlave aggregationSlave, final EvalSideMsgHandler msgHandler, final SerializableCodec<String> codec, @Parameter(TaskConfigurationOptions.Identifier.class) final String taskId) { this.memoryStore = memorystore; this.router = router; this.aggregationSlave = aggregationSlave; this.msgHandler = msgHandler; this.codec = codec; this.taskId = taskId; }
Source:
public SecretStoreAuthzModule(Context context) { this.context = context.getApplicationContext(); sessionStore = openSessionStore(); }

Target:
public SecretStoreAuthzModule(Context context) { this.context = context.getApplicationContext(); this.sessionStore = openSessionStore(); sessionStore.openSync(); }
Source:
void reset(boolean isShutdown) { logger.info("Resetting CallbackHandler: {}. Is resetting for shutdown: {}.", _uid, isShutdown); try { _ready = false; CallbackProcessor callbackProcessorRef = _batchCallbackProcessor.get(); if (callbackProcessorRef != null) { if (isShutdown) { if (_batchCallbackProcessor.compareAndSet(callbackProcessorRef, null)) { callbackProcessorRef.shutdown(); } } else { callbackProcessorRef.resetEventQueue(); } } NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.FINALIZE); changeContext.setChangeType(_changeType); invoke(changeContext); } catch (Exception e) { String msg = "Exception while resetting the listener:" + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }

Target:
void reset(boolean isShutdown) { logger.info("Resetting CallbackHandler: {}. Is resetting for shutdown: {}.", _uid, isShutdown); try { _ready = false; CallbackProcessor callbackProcessor = _batchCallbackProcessorRef.get(); if (callbackProcessor != null) { if (isShutdown) { if (_batchCallbackProcessorRef.compareAndSet(callbackProcessor, null)) { callbackProcessor.shutdown(); } } else { callbackProcessor.resetEventQueue(); } } NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.FINALIZE); changeContext.setChangeType(_changeType); invoke(changeContext); } catch (Exception e) { String msg = "Exception while resetting the listener:" + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }
Source:
public void testProcessInstanceStatus_timedOut() throws Exception { b.setInputFeedDataPath("/samarthData/timedoutStatus/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}"); b.setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:11Z"); b.setProcessPeriodicity(5, TimeUnit.minutes); b.setProcessTimeOut(2, TimeUnit.minutes); b.setOutputFeedPeriodicity(5, TimeUnit.minutes); b.setOutputFeedLocationData("/examples/samarth/output-data/aggregator/aggregatedLogs/${YEAR}/${MONTH}/$" + "{DAY}/${HOUR}/${MINUTE}"); b.setProcessConcurrency(3); b.submitAndScheduleBundle(prism); Status status = null; while (status != Status.TIMEDOUT) { status = InstanceUtil .getInstanceStatus(server1, Util.readEntityName(b.getProcessData()), 0, 0); Thread.sleep(15000); } ProcessInstancesResult r = prism.getProcessHelper() .getProcessInstanceStatus(Util.readEntityName(b.getProcessData()), "?start=2010-01-02T01:00Z&end=2010-01-02T01:11Z"); InstanceUtil.validateSuccessWithStatusCode(r, 2); }

Target:
public void testProcessInstanceStatus_timedOut() throws Exception { b.setInputFeedDataPath(feedInputTimedOutPath); b.setProcessValidity("2010-01-02T01:00Z", "2010-01-02T01:11Z"); b.setProcessPeriodicity(5, TimeUnit.minutes); b.setProcessTimeOut(2, TimeUnit.minutes); b.setOutputFeedPeriodicity(5, TimeUnit.minutes); b.setOutputFeedLocationData(feedOutputTimedOutPath); b.setProcessConcurrency(3); b.submitAndScheduleBundle(prism); Status status = null; while (status != Status.TIMEDOUT) { status = InstanceUtil .getInstanceStatus(server1, Util.readEntityName(b.getProcessData()), 0, 0); Thread.sleep(15000); } ProcessInstancesResult r = prism.getProcessHelper() .getProcessInstanceStatus(Util.readEntityName(b.getProcessData()), "?start=2010-01-02T01:00Z&end=2010-01-02T01:11Z"); InstanceUtil.validateSuccessWithStatusCode(r, 2); }
Source:
public boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { s_logger.debug("No rules to apply. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); } else { s_logger.debug("New rules has to applied. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); } if (rules != null) { s_logger.debug("Handling applyNetworkACLs for network " + config.getName() + " with " + rules.size() + " Network ACLs"); applyACLRules(config, rules, true, null, rules.isEmpty()); } return true; }

Target:
public boolean applyNetworkACLs(Network config, List<? extends NetworkACLItem> rules) throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { if (s_logger.isDebugEnabled()) { s_logger.debug("No rules to apply. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); } } else { if (s_logger.isDebugEnabled()) { s_logger.debug("New rules has to applied. So, delete all the existing ACL in VSP from Subnet with uuid " + config.getUuid()); } } if (rules != null) { s_logger.info("Applying " + rules.size() + " Network ACLs for network " + config.getName()); applyACLRules(config, rules, true, null, rules.isEmpty()); } return true; }
Source:
public Construct exec(Target t, Environment environment, Construct... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].nval() instanceof String)) { throw new CREFormatException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); } String text = args[0].nval(); if(text.length() > 1) { throw new CRECastException("Got " + text + " instead of expected character.", t); } char check = text.charAt(0); if(Character.isUpperCase(check)) { return CBoolean.get(true); } else { return CBoolean.get(false); } }

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].nval() instanceof String)) { throw new CRECastException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); } String text = args[0].nval(); if(text.length() != 1) { throw new CREFormatException("Got \"" + text + "\" instead of expected character.", t); } char check = text.charAt(0); if(!Character.isLetter(check)) { throw new CRECastException("Got \"" + text + "\" instead of alphabetical character.", t); } return CBoolean.get(Character.isUpperCase(check)); }
Source:
private FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities); }

Target:
FetchV0Request(@NonNull Set<ObjectId> wantIds, int depth, @NonNull Set<ObjectId> clientShallowCommits, long filterBlobLimit, @NonNull Set<String> clientCapabilities) { super(wantIds, depth, clientShallowCommits, filterBlobLimit, clientCapabilities); }
Source:
private boolean isMatchingAttributeFilter(Element element) { if(attributeValueFilterPattern == null){ attributeValueFilterPattern = Pattern.compile(attributeValueFilter, attributeValueFilterFlags); } String attributeValue = element.getAttributeValue(attributeNameFilter); if(attributeValue == null){ return false; } Matcher matcher = attributeValueFilterPattern.matcher(attributeValue); return matcher.matches(); }

Target:
private boolean isMatchingAttributeFilter(Element element) throws ZestAssignFailException { if(attributeValueFilterPattern == null){ try { attributeValueFilterPattern = Pattern.compile(attributeValueFilter, attributeValueFilterFlags); }catch (IllegalArgumentException ex){ throw new ZestAssignFailException(this, ex.getMessage() + "\r\nRegEx:'" + attributeValueFilter + "' with Flags:'" + attributeValueFilterFlags + "' can not be compiled to pattern."); } } String attributeValue = element.getAttributeValue(attributeNameFilter); if(attributeValue == null){ return false; } Matcher matcher = attributeValueFilterPattern.matcher(attributeValue); return matcher.matches(); }
Source:
protected void configure() { bind(SnapshotDao.class).to(DummySnapshotDao.class); bind(MachineService.class); Multibinder<String> exposedPortsMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_exposed_ports")); Multibinder<String> volumesMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_volumes")); install(new FactoryModuleBuilder() .implement(Instance.class, DockerInstance.class) .implement(InstanceProcess.class, DockerProcess.class) .implement(DockerNode.class, LocalDockerNode.class) .build(DockerMachineFactory.class)); Multibinder.newSetBinder(binder(), InstanceProvider.class).addBinding().to(DockerInstanceProvider.class); if (SystemInfo.isWindows()) { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderWinOS.class); } else { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderUnix.class); } bind(org.eclipse.che.plugin.docker.machine.node.WorkspaceFolderPathProvider.class) .to(LocalWorkspaceFolderPathProvider.class); }

Target:
protected void configure() { bind(SnapshotDao.class).to(DummySnapshotDao.class); bind(MachineService.class); Multibinder<String> exposedPortsMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_exposed_ports")); Multibinder<String> volumesMultibinder = Multibinder.newSetBinder(binder(), String.class, Names.named("machine.docker.system_volumes")); install(new FactoryModuleBuilder() .implement(Instance.class, DockerInstance.class) .implement(InstanceProcess.class, DockerProcess.class) .implement(DockerNode.class, LocalDockerNode.class) .build(DockerMachineFactory.class)); Multibinder.newSetBinder(binder(), InstanceProvider.class).addBinding().to(DockerInstanceProvider.class); if (SystemInfo.isWindows()) { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderWinOS.class); } else { bind(String.class).annotatedWith(Names.named("host.projects.root")) .toProvider(org.eclipse.che.plugin.docker.machine.ext.HostProjectsFolderProviderUnix.class); } bind(org.eclipse.che.plugin.docker.machine.node.WorkspaceFolderPathProvider.class) .to(org.eclipse.che.plugin.docker.machine.local.node.LocalWorkspaceFolderPathProvider.class); }
Source:
public void successfulExecuteStormTuple() throws MCSException, URISyntaxException { StormTaskTuple tuple = new StormTaskTuple(TASK_ID, TASK_NAME, SOURCE_VERSION_URL, FILE_DATA, prepareStormTaskTupleParameters(SOURCE_DATASET_URL)); Representation representation = prepareRepresentation(SOURCE + CLOUD_ID, SOURCE + REPRESENTATION_NAME, SOURCE + VERSION, SOURCE_VERSION_URL, DATA_PROVIDER, false, date); when(datasetClient.getRepresentationIterator(anyString(), anyString())).thenReturn(representationIterator); when(representationIterator.hasNext()).thenReturn(true, false); when(representationIterator.next()).thenReturn(representation); when(oc.emit(any(Tuple.class), anyList())).thenReturn(null); instance.emitSingleRepresentationFromDataSet(tuple, datasetClient, recordServiceClient); Representation expectedRepresentation = representation; verify(oc, times(1)).emit(any(Tuple.class), captor.capture()); assertThat(captor.getAllValues().size(), is(1)); List<Values> allValues = captor.getAllValues(); assertRepresentation(expectedRepresentation, ((Map<String, String>) allValues.get(0).get(4)).get(PluginParameterKeys.REPRESENTATION)); verifyNoMoreInteractions(oc); }

Target:
public void successfulExecuteStormTuple() throws MCSException, URISyntaxException { StormTaskTuple tuple = new StormTaskTuple(TASK_ID, TASK_NAME, SOURCE_VERSION_URL, FILE_DATA, prepareStormTaskTupleParameters(SOURCE_DATASET_URL)); Representation representation = testHelper.prepareRepresentation(SOURCE + CLOUD_ID, SOURCE + REPRESENTATION_NAME, SOURCE + VERSION, SOURCE_VERSION_URL, DATA_PROVIDER, false, date); List<Representation> representations = new ArrayList<>(); representations.add(representation); when(datasetClient.getRepresentationIterator(anyString(), anyString())).thenReturn(representationIterator); when(representationIterator.hasNext()).thenReturn(true, false); when(representationIterator.next()).thenReturn(representation); assertBoltExecutionResults(tuple, representations); }
Source:
private void handleActivationKeyServiceLevel(Consumer consumer, String level, Owner owner) { if (level != null) { serviceLevelValidator.validate(owner, level); consumer.setServiceLevel(level); } }

Target:
private void handleActivationKeyServiceLevel(Consumer consumer, String level, Owner owner) { if (!StringUtils.isBlank(level)) { serviceLevelValidator.validate(owner, level); consumer.setServiceLevel(level); } }
Source:
RexNode simplifyAnd(RexCall e, RexUnknownAs unknownAs) { List<RexNode> operands = RelOptUtil.conjunctions(e); if (unknownAs == FALSE && predicateElimination) { simplifyAndTerms(operands, FALSE); } else { simplifyList(operands, unknownAs); } final List<RexNode> terms = new ArrayList<>(); final List<RexNode> notTerms = new ArrayList<>(); final SargCollector sargCollector = new SargCollector(rexBuilder, true); operands.forEach(t -> sargCollector.accept(t, terms)); if (sargCollector.needToFix(terms.size())) { operands.clear(); terms.forEach(t -> operands.add(sargCollector.fix(rexBuilder, t))); } terms.clear(); for (RexNode o : operands) { RelOptUtil.decomposeConjunction(o, terms, notTerms); } switch (unknownAs) { case FALSE: return simplifyAnd2ForUnknownAsFalse(terms, notTerms, Comparable.class); default: break; } return simplifyAnd2(terms, notTerms); }

Target:
RexNode simplifyAnd(RexCall e, RexUnknownAs unknownAs) { List<RexNode> operands = RelOptUtil.conjunctions(e); if (unknownAs == FALSE && predicateElimination) { simplifyAndTerms(operands, FALSE); } else { simplifyList(operands, unknownAs); } final List<RexNode> terms = new ArrayList<>(); final List<RexNode> notTerms = new ArrayList<>(); final SargCollector sargCollector = new SargCollector(rexBuilder, true); operands.forEach(t -> sargCollector.accept(t, terms)); if (sargCollector.needToFix(unknownAs)) { operands.clear(); terms.forEach(t -> operands.add(sargCollector.fix(rexBuilder, t))); } terms.clear(); for (RexNode o : operands) { RelOptUtil.decomposeConjunction(o, terms, notTerms); } switch (unknownAs) { case FALSE: return simplifyAnd2ForUnknownAsFalse(terms, notTerms, Comparable.class); default: break; } return simplifyAnd2(terms, notTerms); }
Source:
private void setUpGCExpectations(final int gcAfter) { ReferenceQueue<Integer> queue = mock(ReferenceQueue.class); map = new ReapedMap<String, Integer>(10000, false, queue); final IdAwareReference ref = mock(IdAwareReference.class); when(ref.getKey()).thenReturn("three", new Object[] { null }); when(queue.poll()).thenAnswer(new Answer<Reference<Integer>>() { private int times = 0; @Override public Reference<Integer> answer(InvocationOnMock invocation) throws Throwable { if (times == gcAfter) { ++times; return ref; } ++times; return null; } }); }

Target:
private void setUpGCExpectations(final int gcAfter) { ReferenceQueue<Integer> queue = mock(ReferenceQueue.class); map = new ReapedMap<String, Integer>(10000, false, queue); final IdAwareReference ref = mock(IdAwareReference.class); when(ref.getKey()).thenReturn("three").thenReturn(null); when(queue.poll()).thenAnswer(new Answer<Reference<Integer>>() { private int times = 0; @Override public Reference<Integer> answer(InvocationOnMock invocation) throws Throwable { if (times == gcAfter) { ++times; return ref; } ++times; return null; } }); }