auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public FormValidation doSendTestMail( @QueryParameter String smtpServer, @QueryParameter String adminAddress, @QueryParameter boolean useSMTPAuth, @QueryParameter String smtpAuthUserName, @QueryParameter Secret smtpAuthPasswordSecret, @QueryParameter boolean useSsl, @QueryParameter String smtpPort, @QueryParameter String charset, @QueryParameter String sendTestMailTo) throws IOException, ServletException, InterruptedException { try { final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { throw new IOException("Jenkins instance is not ready"); } if (!useSMTPAuth) { smtpAuthUserName = null; smtpAuthPasswordSecret = null; } MimeMessage msg = new MimeMessage(createSession(smtpServer, smtpPort, useSsl, smtpAuthUserName, smtpAuthPasswordSecret)); msg.setSubject(Messages.Mailer_TestMail_Subject(incrementTestEmailCount()), charset); msg.setText(Messages.Mailer_TestMail_Content(getTestEmailCount(), jenkins.getDisplayName()), charset); msg.setFrom(stringToAddress(adminAddress, charset)); if (StringUtils.isNotBlank(replyToAddress)) { msg.setReplyTo(new Address[]{stringToAddress(replyToAddress, charset)}); } msg.setSentDate(new Date()); msg.setRecipient(Message.RecipientType.TO, stringToAddress(sendTestMailTo, charset)); Transport.send(msg); return FormValidation.ok(Messages.Mailer_EmailSentSuccessfully()); } catch (MessagingException e) { return FormValidation.errorWithMarkup("<p>"+Messages.Mailer_FailedToSendEmail()+"</p><pre>"+Util.escape(Functions.printThrowable(e))+"</pre>"); } }

Target:
public FormValidation doSendTestMail( @QueryParameter String smtpServer, @QueryParameter String adminAddress, @QueryParameter boolean useSMTPAuth, @QueryParameter String smtpAuthUserName, @QueryParameter Secret smtpAuthPasswordSecret, @QueryParameter boolean useSsl, @QueryParameter String smtpPort, @QueryParameter String charset, @QueryParameter String sendTestMailTo) throws IOException, ServletException, InterruptedException { try { final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { throw new IOException("Jenkins instance is not ready"); } if (!useSMTPAuth) { smtpAuthUserName = null; smtpAuthPasswordSecret = null; } MimeMessage msg = new MimeMessage(createSession(smtpServer, smtpPort, useSsl, smtpAuthUserName, smtpAuthPasswordSecret)); msg.setSubject(Messages.Mailer_TestMail_Subject(testEmailCount.incrementAndGet()), charset); msg.setText(Messages.Mailer_TestMail_Content(testEmailCount.get(), jenkins.getDisplayName()), charset); msg.setFrom(stringToAddress(adminAddress, charset)); if (StringUtils.isNotBlank(replyToAddress)) { msg.setReplyTo(new Address[]{stringToAddress(replyToAddress, charset)}); } msg.setSentDate(new Date()); msg.setRecipient(Message.RecipientType.TO, stringToAddress(sendTestMailTo, charset)); Transport.send(msg); return FormValidation.ok(Messages.Mailer_EmailSentSuccessfully()); } catch (MessagingException e) { return FormValidation.errorWithMarkup("<p>"+Messages.Mailer_FailedToSendEmail()+"</p><pre>"+Util.escape(Functions.printThrowable(e))+"</pre>"); } }
Source:
public UpdateRequest processPreUpdate( UpdateRequest input, Map<String, Metacard> existingMetacards) throws StopProcessingException { Function<Metacard, Metacard> oldVersionOfMetacard = (update) -> Optional.of(existingMetacards.get(update.getId())).orElse(null); boolean foundInaccessibleMetacard = input .getUpdates() .stream() .map(Map.Entry::getValue) .filter( newVersionOfMetacard -> isAccessControlUpdated( oldVersionOfMetacard.apply(newVersionOfMetacard), newVersionOfMetacard)) .filter(Objects::nonNull) .filter(mc -> !subjectIsAccessAdmin.test(mc) && !subjectIsOwner.test(mc)) .findFirst() .isPresent(); if (foundInaccessibleMetacard) { throw new StopProcessingException( "Cannot update metacard(s). Subject cannot change access control permissions because they are not in the assigned access-administrators list."); } return input; }

Target:
public UpdateRequest processPreUpdate( UpdateRequest input, Map<String, Metacard> existingMetacards) throws StopProcessingException { Function<Metacard, Metacard> oldVersionOfMetacard = (update) -> { Optional<Metacard> oldMetacard = Optional.ofNullable(existingMetacards.get(update.getId())); if (oldMetacard.isPresent()) { return oldMetacard.get(); } return null; }; boolean foundInaccessibleMetacard = input .getUpdates() .stream() .map(Map.Entry::getValue) .filter( newVersionOfMetacard -> isAccessControlUpdated( oldVersionOfMetacard.apply(newVersionOfMetacard), newVersionOfMetacard)) .filter(Objects::nonNull) .filter(mc -> !subjectIsAccessAdmin.test(mc) && !subjectIsOwner.test(mc)) .findFirst() .isPresent(); if (foundInaccessibleMetacard) { throw new StopProcessingException( "Cannot update metacard(s). Subject cannot change access control permissions because they are not in the assigned access-administrators list."); } return input; }
Source:
private void createModeSelectionControl(Map<String, ILaunchGroup> modes, Composite comp) { Label label = new Label(comp, SWT.NONE); label.setText(DebugUIMessages.GroupLaunchConfigurationSelectionDialog_4); Map<String, String> labelToMode = new LinkedHashMap<>(); modes.forEach((modeName, launchGrp) -> { String launchGrpLabel = DebugUIPlugin.removeAccelerators(launchGrp.getLabel()); labelToMode.put(launchGrpLabel, modeName); }); Combo cvMode = new Combo(comp, SWT.READ_ONLY); GridDataFactory.fillDefaults().applyTo(cvMode); cvMode.setItems(labelToMode.keySet().toArray(new String[labelToMode.size()])); int index = 0; for (String m : modes.keySet()) { if (m.equals(mode)) { cvMode.select(index); break; } index++; } cvMode.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { modeLabel = cvMode.getText(); mode = labelToMode.get(cvMode.getText()); validate(); } }); Composite c = new Composite(comp, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(c); GridDataFactory.fillDefaults().span(2, 1).applyTo(c); }

Target:
private void createModeSelectionControl(Map<String, ILaunchGroup> modes, Composite comp) { Label label = new Label(comp, SWT.NONE); label.setText(DebugUIMessages.GroupLaunchConfigurationSelectionDialog_4); Map<String, String> labelToMode = new LinkedHashMap<>(); modes.forEach((modeName, launchGrp) -> { String launchGrpLabel = DebugUIPlugin.removeAccelerators(launchGrp.getLabel()); labelToMode.put(launchGrpLabel, modeName); }); Combo cvMode = new Combo(comp, SWT.READ_ONLY); GridDataFactory.fillDefaults().applyTo(cvMode); cvMode.setItems(labelToMode.keySet().toArray(new String[labelToMode.size()])); int index = 0; for (String m : modes.keySet()) { if (m.equals(mode)) { cvMode.select(index); break; } index++; } cvMode.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { mode = labelToMode.get(cvMode.getText()); validate(); } }); Composite c = new Composite(comp, SWT.NONE); GridLayoutFactory.fillDefaults().applyTo(c); GridDataFactory.fillDefaults().span(2, 1).applyTo(c); }
Source:
void connectSensors() { addEnricher(Enrichers.builder() .propagatingAllBut(SERVICE_UP, ROOT_URL, GROUP_MEMBERS, GROUP_SIZE) .from(getCluster()) .build()); addEnricher(Enrichers.builder() .propagating(LoadBalancer.HOSTNAME, Attributes.ADDRESS, SERVICE_UP, ROOT_URL) .from(getController()) .build()); }

Target:
void connectSensors() { addEnricher(Enrichers.builder() .propagatingAllBut(SERVICE_STATE, SERVICE_UP, ROOT_URL, GROUP_MEMBERS, GROUP_SIZE) .from(getCluster()) .build()); addEnricher(Enrichers.builder() .propagating(LoadBalancer.HOSTNAME, Attributes.ADDRESS, ROOT_URL) .from(getController()) .build()); SensorEventListener<Boolean> updateServiceUp = new SensorEventListener<Boolean>() { @Override public void onEvent(SensorEvent<Boolean> event) { setAttribute(SERVICE_UP, calculateServiceUp()); } }; SensorEventListener<Lifecycle> updateServiceState = new SensorEventListener<Lifecycle>() { @Override public void onEvent(SensorEvent<Lifecycle> event) { setAttribute(SERVICE_STATE, calculateServiceState()); } }; subscribe(getCluster(), SERVICE_STATE, updateServiceState); subscribe(getController(), SERVICE_STATE, updateServiceState); subscribe(getCluster(), SERVICE_UP, updateServiceUp); subscribe(getController(), SERVICE_UP, updateServiceUp); }
Source:
public String makeString() { return UiUtils.typeFormatHtml(makeBaseString(), getReturnType()); }

Target:
public String makeString() { return UiUtils.typeFormat(makeBaseString(), getReturnType()); }
Source:
public Optional<Invocation> getModelClass() { final Invocation invocation = new Invocation(); return Optional.of(invocation); }

Target:
public Optional<Invocation> getModelClass() { return Optional.of(new Invocation()); }
Source:
private PlanNodeStatsEstimate calculateRemoteSourceStats(RemoteSourceNode node, StatsProvider statsProvider) { PlanNodeStatsEstimate estimate = null; for (PlanFragment sourceFragment : sourceProvider.getSourceFragments(node)) { PlanNodeStatsEstimate sourceStatsWithMappedSymbols = mapToOutputSymbols(statsProvider.getStats(sourceFragment.getRoot()), sourceFragment.getPartitioningScheme().getOutputLayout(), node.getOutputSymbols()); if (estimate != null) { addStatsAndMaxDistinctValues(estimate, sourceStatsWithMappedSymbols); } else { estimate = sourceStatsWithMappedSymbols; } } verify(estimate != null, "estimate is null"); return estimate; }

Target:
private PlanNodeStatsEstimate calculateRemoteSourceStats(RemoteSourceNode node, StatsProvider statsProvider) { PlanNodeStatsEstimate estimate = null; for (PlanFragment sourceFragment : sourceProvider.getSourceFragments(node)) { PlanNodeStatsEstimate sourceStatsWithMappedSymbols = mapToOutputSymbols(statsProvider.getStats(sourceFragment.getRoot()), sourceFragment.getPartitioningScheme().getOutputLayout(), node.getOutputSymbols()); if (estimate != null) { estimate = addStatsAndMaxDistinctValues(estimate, sourceStatsWithMappedSymbols); } else { estimate = sourceStatsWithMappedSymbols; } } verify(estimate != null, "estimate is null"); return estimate; }
Source:
protected C3Color createColor() { return factory.c3Color(new String[0], null); }

Target:
protected C3Color createColor() { return factory.c3Color(new String[0]); }
Source:
public static TmfStateValue readSerializedValue(ISafeByteBufferReader buffer) { byte customType = buffer.get(); CustomStateValueFactory customFactory = CustomStateValue.getCustomFactory(customType); if (customFactory == null) { Activator.getDefault().logWarning("Custom factory for type " + customType + " does not exist"); return NullStateValue.INSTANCE; } return customFactory.readCustomValue(buffer); }

Target:
public static TmfStateValue readSerializedValue(ISafeByteBufferReader buffer) { byte customType = buffer.get(); CustomStateValueFactory customFactory = CustomStateValue.getCustomFactory(customType); if (customFactory == null) { Activator.getDefault().logWarning("Custom factory for type " + customType + " does not exist"); return TmfStateValue.nullValue(); } return customFactory.readCustomValue(buffer); }
Source:
public void shouldSetTheRedirectAttribute() { String redirectUrl = "www.openmrs.org/_HASHTAG_"; MockHttpServletRequest mockRequest = new MockHttpServletRequest(); mockRequest.setParameter("redirect_url", redirectUrl); WebRequest webRequest = new ServletWebRequest(mockRequest); webRequest.setAttribute(WebConstants.INSUFFICIENT_PRIVILEGES, true, WebRequest.SCOPE_SESSION); ModelMap model = new ModelMap(); controller.handleRequest(webRequest, model); assertEquals(webRequest.getAttribute(WebConstants.OPENMRS_LOGIN_REDIRECT_HTTPSESSION_ATTR, 1), "www.openmrs.org/#"); }

Target:
public void shouldSetTheRedirectAttribute() { String redirectUrl = "www.openmrs.org/index"; MockHttpServletRequest mockRequest = new MockHttpServletRequest(); mockRequest.setParameter("redirect_url", redirectUrl); WebRequest webRequest = new ServletWebRequest(mockRequest); webRequest.setAttribute(WebConstants.INSUFFICIENT_PRIVILEGES, true, WebRequest.SCOPE_SESSION); ModelMap model = new ModelMap(); controller.handleRequest(webRequest, model); assertEquals(webRequest.getAttribute(WebConstants.OPENMRS_LOGIN_REDIRECT_HTTPSESSION_ATTR, 1), "www.openmrs.org/index"); }
Source:
private String getRandomText(int textLength) { SecureRandom random = new SecureRandom(); return new BigInteger(5 * textLength, random).toString(32); }

Target:
private String getRandomText(int textLength) { return new BigInteger(5 * textLength, new SecureRandom()).toString(32); }
Source:
protected boolean canDoAction() { boolean retValue = false; String event; if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); return false; } if (getParameters().getAction() == FenceActionType.Start) { event = AuditLogType.USER_VDS_STOP.name(); } else { event = AuditLogType.USER_VDS_START.name(); } if (getVds().getpm_enabled() && isPowerManagementLegal()) { Date waitTo = Backend.getInstance() .getStartedAt() .addSeconds((Integer) Config.getValue(ConfigValues.DisableFenceAtStartupInSec)); Date now = new Date(); if (waitTo.before(now) || waitTo.equals(now)) { int secondsLeftToNextPmOp = (isInternalExecution() || (getParameters().getParentCommand() == VdcActionType.RestartVds)) ? 0 : DbFacade.getInstance() .getAuditLogDao() .getTimeToWaitForNextPmOp(getVds().getName(), event); if (secondsLeftToNextPmOp <= 0) { if (createProxyHostLocator().isProxyHostAvailable()) { retValue = true; } else { addCanDoActionMessage(VdcBllMessages.VDS_NO_VDS_PROXY_FOUND); } } else { addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED_AT_QUIET_TIME); addCanDoActionMessageVariable("seconds", secondsLeftToNextPmOp); } } else { addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED_AT_SYSTEM_STARTUP_INTERVAL); } } if (!retValue) { handleError(); } else { addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED); handleError(); } getReturnValue().setSucceeded(retValue); return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = false; String event; if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); return false; } if (getParameters().getAction() == FenceActionType.Start) { event = AuditLogType.USER_VDS_STOP.name(); } else { event = AuditLogType.USER_VDS_START.name(); } if (getVds().getpm_enabled() && isPowerManagementLegal()) { Date waitTo = Backend.getInstance() .getStartedAt() .addSeconds((Integer) Config.getValue(ConfigValues.DisableFenceAtStartupInSec)); Date now = new Date(); if (waitTo.before(now) || waitTo.equals(now)) { int secondsLeftToNextPmOp = (isInternalExecution() || (getParameters().getParentCommand() == VdcActionType.RestartVds)) ? 0 : DbFacade.getInstance() .getAuditLogDao() .getTimeToWaitForNextPmOp(getVds().getName(), event); if (secondsLeftToNextPmOp <= 0) { if (createProxyHostLocator().isProxyHostAvailable()) { retValue = true; } else { addCanDoActionMessage(VdcBllMessages.VDS_NO_VDS_PROXY_FOUND); } } else { addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED_AT_QUIET_TIME); addCanDoActionMessageVariable("seconds", secondsLeftToNextPmOp); } } else { addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED_AT_SYSTEM_STARTUP_INTERVAL); } if (!retValue) { handleError(); } } else { addCanDoActionMessage(VdcBllMessages.VDS_FENCE_DISABLED); handleError(); } getReturnValue().setSucceeded(retValue); return retValue; }
Source:
public Mono<Void> start() { PartitionLoadBalancerImpl self = this; synchronized (lock) { if (this.started) { throw new IllegalStateException("Partition load balancer already started"); } this.started = true; this.cancellationTokenSource = new CancellationTokenSource(); } return Mono.fromRunnable( () -> { Thread thread = new Thread(() -> self.run(self.cancellationTokenSource.getToken()).subscribe()); executorService.execute(thread); }); }

Target:
public Mono<Void> start() { synchronized (lock) { if (this.started) { throw new IllegalStateException("Partition load balancer already started"); } this.started = true; this.cancellationTokenSource = new CancellationTokenSource(); } return Mono.fromRunnable( () -> { scheduler.schedule(() -> this.run(this.cancellationTokenSource.getToken()).subscribe()); }); }
Source:
public void testGroupMaxSizeExceptionIsFatal() { setupCoordinator(); mockClient.prepareResponse(groupCoordinatorResponse(node, Errors.NONE)); coordinator.ensureCoordinatorReady(mockTime.timer(0)); mockClient.prepareResponse(joinGroupFollowerResponse(defaultGeneration, memberId, JoinGroupResponse.UNKNOWN_MEMBER_ID, Errors.GROUP_MAX_SIZE_REACHED)); RequestFuture<ByteBuffer> future = coordinator.sendJoinGroupRequest(coordinator.generation); assertTrue(consumerClient.poll(future, mockTime.timer(REQUEST_TIMEOUT_MS))); assertTrue(future.exception().getClass().isInstance(Errors.GROUP_MAX_SIZE_REACHED.exception())); assertFalse(future.isRetriable()); }

Target:
public void testGroupMaxSizeExceptionIsFatal() { setupCoordinator(); mockClient.prepareResponse(groupCoordinatorResponse(node, Errors.NONE)); coordinator.ensureCoordinatorReady(mockTime.timer(0)); mockClient.prepareResponse(joinGroupFollowerResponse(defaultGeneration, memberId, JoinGroupResponse.UNKNOWN_MEMBER_ID, Errors.GROUP_MAX_SIZE_REACHED)); RequestFuture<ByteBuffer> future = coordinator.sendJoinGroupRequest(); assertTrue(consumerClient.poll(future, mockTime.timer(REQUEST_TIMEOUT_MS))); assertTrue(future.exception().getClass().isInstance(Errors.GROUP_MAX_SIZE_REACHED.exception())); assertFalse(future.isRetriable()); }
Source:
private void populateAnnouncements(List<AnnouncementsModel> announcementsList) { if(announcementsList !=null && announcementsList.size()>0) { hideEmptyAnnouncementMessage(); for (AnnouncementView view : announcementViewList) { view.stop(); } announcementViewList.clear(); announcementContainer.removeAllViews(); for (AnnouncementsModel m : announcementsList) { AnnouncementView announcementView = generateAnnouncementView(m); announcementViewList.add(announcementView); announcementContainer.addView(announcementView.getView()); } } else { showEmptyAnnouncementMessage(); } }

Target:
private void populateAnnouncements(List<AnnouncementsModel> announcementsList) { if(announcementsList !=null && announcementsList.size()>0) { hideEmptyAnnouncementMessage(); final String divider = "<div style='height:2px; width:100%; background-color: #E2E3E5'></div>"; StringBuffer buff = new StringBuffer(); buff.append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"); for (AnnouncementsModel m : announcementsList) { String entry = String.format("%s <br/><br/> %s <br/> %s <br/><br/>", m.getDate(), divider, m.getContent()); buff.append(entry); } announcementWebView.loadDataWithBaseURL(Config.getInstance().getApiHostURL(), buff.toString(), "text/html", HTTP.UTF_8, null); } else { showEmptyAnnouncementMessage(); } }
Source:
public static AcidTable decode(String encoded) throws IOException { if (!encoded.startsWith(PROLOG_V1)) { throw new IllegalStateException("Unsupported version."); } encoded = encoded.substring(PROLOG_V1.length()); byte[] decoded = Base64.decodeBase64(encoded); AcidTable table = null; try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(decoded))) { String databaseName = in.readUTF(); String tableName = in.readUTF(); boolean createPartitions = in.readBoolean(); long transactionId = in.readLong(); TableType tableType = TableType.valueOf(in.readByte()); int thriftLength = in.readInt(); table = new AcidTable(databaseName, tableName, createPartitions, tableType); table.setWriteId(transactionId); Table metaTable = null; if (thriftLength > 0) { metaTable = new Table(); try { byte[] thriftEncoded = new byte[thriftLength]; in.readFully(thriftEncoded, 0, thriftLength); new TDeserializer(new TCompactProtocol.Factory()).deserialize(metaTable, thriftEncoded); table.setTable(metaTable); } catch (TException e) { throw new IOException("Error deserializing meta store table.", e); } } } return table; }

Target:
public static AcidTable decode(String encoded) throws IOException { if (!encoded.startsWith(PROLOG_V1)) { throw new IllegalStateException("Unsupported version."); } encoded = encoded.substring(PROLOG_V1.length()); byte[] decoded = Base64.decodeBase64(encoded); AcidTable table = null; try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(decoded))) { String databaseName = in.readUTF(); String tableName = in.readUTF(); boolean createPartitions = in.readBoolean(); long writeId = in.readLong(); TableType tableType = TableType.valueOf(in.readByte()); int thriftLength = in.readInt(); table = new AcidTable(databaseName, tableName, createPartitions, tableType); table.setWriteId(writeId); Table metaTable = null; if (thriftLength > 0) { metaTable = new Table(); try { byte[] thriftEncoded = new byte[thriftLength]; in.readFully(thriftEncoded, 0, thriftLength); new TDeserializer(new TCompactProtocol.Factory()).deserialize(metaTable, thriftEncoded); table.setTable(metaTable); } catch (TException e) { throw new IOException("Error deserializing meta store table.", e); } } } return table; }
Source:
private static URL getServiceUrl() { try { if (service == null) { Path logFile = Files.createTempFile("edgedriver", ".log"); boolean isLegacy = System.getProperty("webdriver.edge.edgehtml") == null || Boolean.getBoolean("webdriver.edge.edgehtml"); EdgeDriverService.Builder<?, ?> builder = StreamSupport.stream(ServiceLoader.load(DriverService.Builder.class).spliterator(), false) .filter(b -> b instanceof EdgeDriverService.Builder) .map(b -> (EdgeDriverService.Builder<?, ?>) b) .filter(b -> b.isLegacy() == isLegacy) .findFirst().orElseThrow(WebDriverException::new); service = (EdgeDriverService) builder.withVerbose(true).withLogFile(logFile.toFile()).build(); LOG.fine("edgedriver will log to " + logFile); service.start(); Runtime.getRuntime().addShutdownHook(new Thread(() -> service.stop())); } return service.getUrl(); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private static URL getServiceUrl() { try { if (service == null) { Path logFile = Files.createTempFile("edgedriver", ".log"); boolean isLegacy = System.getProperty("webdriver.edge.edgehtml") == null || Boolean.getBoolean("webdriver.edge.edgehtml"); EdgeDriverService.Builder<?, ?> builder = StreamSupport.stream(ServiceLoader.load(DriverService.Builder.class).spliterator(), false) .filter(b -> b instanceof EdgeDriverService.Builder) .map(b -> (EdgeDriverService.Builder<?, ?>) b) .filter(b -> b.isLegacy() == isLegacy) .findFirst().orElseThrow(WebDriverException::new); service = (EdgeDriverService) builder.withVerbose(true).withLogFile(logFile.toFile()).build(); LOG.info("edgedriver will log to " + logFile); service.start(); Runtime.getRuntime().addShutdownHook(new Thread(() -> service.stop())); } return service.getUrl(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public Construct exec(Target t, Env environment, Construct... args) throws ConfigRuntimeException { MCPlayer m = environment.GetPlayer(); String listName; if(args.length == 2){ m = Static.GetPlayer(args[0]); listName = args[1].nval(); } else { listName = args[0].nval(); } if (listName.length() > 16) { throw new ConfigRuntimeException("set_list_name([player,] name) expects name to be 16 characters or less", t); } Static.AssertPlayerNonNull(m, t); m.setPlayerListName(listName); return new CVoid(t); }

Target:
public Construct exec(Target t, Env environment, Construct... args) throws ConfigRuntimeException { MCPlayer m = environment.GetPlayer(); String listName; if(args.length == 2){ m = Static.GetPlayer(args[0]); listName = args[1].nval(); } else { listName = args[0].nval(); } if (listName.length() > 16) { throw new ConfigRuntimeException("set_list_name([player,] name) expects name to be 16 characters or less", Exceptions.ExceptionType.LengthException, t); } Static.AssertPlayerNonNull(m, t); m.setPlayerListName(listName); return new CVoid(t); }
Source:
public DistroXV1Request convert(StackV4Request source) { DistroXV1Request request = new DistroXV1Request(); request.setName(source.getName()); if (source.getEnvironmentCrn() != null) { Optional<DetailedEnvironmentResponse> environment = getEnvironmentName(source.getEnvironmentCrn()); environment.ifPresent(env -> request.setEnvironmentName(getIfNotNull(env, EnvironmentBaseResponse::getName))); } request.setImage(getIfNotNull(source.getImage(), imageConverter::convert)); request.setCluster(getIfNotNull(source.getCluster(), clusterConverter::convert)); request.setInstanceGroups(getIfNotNull(source.getInstanceGroups(), instanceGroupConverter::convertFrom)); request.setNetwork(getIfNotNull(source.getNetwork(), networkConverter::convertToNetworkV1Request)); request.setAws(getIfNotNull(source.getAws(), stackParameterConverter::convert)); request.setAzure(getIfNotNull(source.getAzure(), stackParameterConverter::convert)); request.setGcp(getIfNotNull(source.getGcp(), stackParameterConverter::convert)); request.setYarn(getIfNotNull(source.getYarn(), stackParameterConverter::convert)); request.setInputs(source.getInputs()); request.setTags(getIfNotNull(source.getTags(), this::getTags)); request.setSdx(getIfNotNull(source.getSharedService(), sdxConverter::getSdx)); request.setGatewayPort(source.getGatewayPort()); request.setExternalDatabase(getIfNotNull(source.getExternalDatabase(), databaseRequestConverter::convert)); return request; }

Target:
public DistroXV1Request convert(StackV4Request source) { DistroXV1Request request = new DistroXV1Request(); request.setName(source.getName()); if (source.getEnvironmentCrn() != null) { getEnvironmentName(source.getEnvironmentCrn()).ifPresent(envName -> request.setEnvironmentName(envName)); } request.setImage(getIfNotNull(source.getImage(), imageConverter::convert)); request.setCluster(getIfNotNull(source.getCluster(), clusterConverter::convert)); request.setInstanceGroups(getIfNotNull(source.getInstanceGroups(), instanceGroupConverter::convertFrom)); request.setNetwork(getIfNotNull(source.getNetwork(), networkConverter::convertToNetworkV1Request)); request.setAws(getIfNotNull(source.getAws(), stackParameterConverter::convert)); request.setAzure(getIfNotNull(source.getAzure(), stackParameterConverter::convert)); request.setGcp(getIfNotNull(source.getGcp(), stackParameterConverter::convert)); request.setYarn(getIfNotNull(source.getYarn(), stackParameterConverter::convert)); request.setInputs(source.getInputs()); request.setTags(getIfNotNull(source.getTags(), this::getTags)); request.setSdx(getIfNotNull(source.getSharedService(), sdxConverter::getSdx)); request.setGatewayPort(source.getGatewayPort()); request.setExternalDatabase(getIfNotNull(source.getExternalDatabase(), databaseRequestConverter::convert)); return request; }
Source:
private void signalRemoving(Path p, SftpEventListener listener, ServerSession session, boolean isDirectory) throws IOException { if (isDirectory) { listener.removingDirectory(session, p); } else { listener.removingFile(session, p); } }

Target:
protected void signalRemoving( Path p, SftpEventListener listener, ServerSession session, boolean isDirectory) throws IOException { if (isDirectory) { listener.removingDirectory(session, p); } else { listener.removingFile(session, p); } }
Source:
void cleanObsoleteContent() { if (controlledProcessStateService.getCurrentState() == ControlledProcessState.State.RUNNING) { try { String hostName = getHostName(); PathAddress address = PathAddress.EMPTY_ADDRESS; if (!hostName.isEmpty()) { address = address.append(HOST, hostName); } ModelNode response = client.execute(Util.createOperation(CleanObsoleteContentHandler.OPERATION_NAME, address)); if (!FAILED.equals(response.get(OUTCOME).asString())) { if(response.get(RESULT).isDefined()) { ServerLogger.ROOT_LOGGER.debug(response.get(RESULT)); } } else { if (response.hasDefined(FAILURE_DESCRIPTION)) { ServerLogger.ROOT_LOGGER.error("Error cleaning content " + response.get(FAILURE_DESCRIPTION)); } else { ServerLogger.ROOT_LOGGER.error("Error cleaning content " + response); } } } catch (IOException e) { ServerLogger.ROOT_LOGGER.error("Error cleaning content ", e); } } }

Target:
void cleanObsoleteContent() { if (controlledProcessStateService.getCurrentState() == ControlledProcessState.State.RUNNING) { try { PathAddress address = PathAddress.EMPTY_ADDRESS; if (!server) { ModelNode response = client.execute(Util.getReadAttributeOperation(PathAddress.EMPTY_ADDRESS, LOCAL_HOST_NAME)); if (SUCCESS.equals(response.get(OUTCOME).asString()) && response.get(RESULT).isDefined()) { address = address.append(HOST, response.get(RESULT).asString()); } else if (CANCELLED.equals(response.get(OUTCOME).asString())) { return; } else if (FAILED.equals(response.get(OUTCOME).asString())) { error(response); } } ModelNode response = client.execute(Util.createOperation(CleanObsoleteContentHandler.OPERATION_NAME, address)); if (SUCCESS.equals(response.get(OUTCOME).asString())) { if(response.get(RESULT).isDefined()) { ServerLogger.ROOT_LOGGER.debug(response.get(RESULT)); } } else if (CANCELLED.equals(response.get(OUTCOME).asString())) { return; } else if (FAILED.equals(response.get(OUTCOME).asString())) { error(response); } } catch (IOException e) { ServerLogger.ROOT_LOGGER.failedToCleanObsoleteContent(e); } } }
Source:
private boolean isIDBrokerInstanceGroup(InstanceGroup instanceGroup) { return groupNameIDBroker.equalsIgnoreCase(instanceGroup.getGroupName()); }

Target:
private boolean isIDBrokerInstanceGroup(InstanceGroup instanceGroup) { return GROUP_NAME_ID_BROKER.equalsIgnoreCase(instanceGroup.getGroupName()); }
Source:
protected MatchResult visitPlan(PlanNode node, PlanMatchPattern pattern) { List<PlanMatchingState> states = pattern.shapeMatches(node); if (states.isEmpty()) { return NO_MATCH; } if (sources(node).isEmpty()) { return matchLeaf(node, pattern, states); } MatchResult result = NO_MATCH; for (PlanMatchingState state : states) { MatchResult sourcesMatch = matchSources(node, state); if (!sourcesMatch.isMatch()) { continue; } SymbolAliases allSourceAliases = sourcesMatch.getAliases(); MatchResult matchResult = pattern.detailMatches(node, statsProvider, session, metadata, allSourceAliases); if (matchResult.isMatch()) { checkState(result == NO_MATCH, format("Ambiguous match on node %s", node)); result = match(allSourceAliases.withNewAliases(matchResult.getAliases())); } } return result; }

Target:
protected MatchResult visitPlan(PlanNode node, PlanMatchPattern pattern) { List<PlanMatchingState> states = pattern.shapeMatches(node); if (states.isEmpty()) { return NO_MATCH; } if (node.getSources().isEmpty()) { return matchLeaf(node, pattern, states); } MatchResult result = NO_MATCH; for (PlanMatchingState state : states) { MatchResult sourcesMatch = matchSources(node, state); if (!sourcesMatch.isMatch()) { continue; } SymbolAliases allSourceAliases = sourcesMatch.getAliases(); MatchResult matchResult = pattern.detailMatches(node, statsProvider, session, metadata, allSourceAliases); if (matchResult.isMatch()) { checkState(result == NO_MATCH, format("Ambiguous match on node %s", node)); result = match(allSourceAliases.withNewAliases(matchResult.getAliases())); } } return result; }
Source:
public void testLoadingMixOfValidAndInvalidPlugins() throws Exception { TestPlugins.assertAvailable(); pluginPath.newFile("invalid.jar"); pluginPath.newFolder("my-plugin"); pluginPath.newFile("my-plugin/invalid.jar"); for (String fullPath : TestPlugins.pluginPath()) { FileUtils.copyFileToDirectory(new File(fullPath), pluginPath.getRoot()); } DelegatingClassLoader classLoader = new DelegatingClassLoader( Collections.singletonList(pluginPath.getRoot().getAbsolutePath())); classLoader.initLoaders(); for (String pluginClassName : TestPlugins.pluginClasses()) { assertNotNull(classLoader.loadClass(pluginClassName)); assertNotNull(classLoader.pluginClassLoader(pluginClassName)); } }

Target:
public void testLoadingMixOfValidAndInvalidPlugins() throws Exception { TestPlugins.assertAvailable(); pluginDir.newFile("invalid.jar"); pluginDir.newFolder("my-plugin"); pluginDir.newFile("my-plugin/invalid.jar"); Path pluginPath = this.pluginDir.getRoot().toPath(); for (String sourceJar : TestPlugins.pluginPath()) { Path source = new File(sourceJar).toPath(); Files.copy(source, pluginPath.resolve(source.getFileName())); } DelegatingClassLoader classLoader = new DelegatingClassLoader( Collections.singletonList(pluginDir.getRoot().getAbsolutePath())); classLoader.initLoaders(); for (String pluginClassName : TestPlugins.pluginClasses()) { assertNotNull(classLoader.loadClass(pluginClassName)); assertNotNull(classLoader.pluginClassLoader(pluginClassName)); } }
Source:
public void handle(GlowSession session, InteractEntityMessage message) { if (message.getAction() != InteractEntityMessage.Action.ATTACK_AT.ordinal()) { return; } final GlowPlayer player = session.getPlayer(); if (player == null) return; final GlowWorld world = player.getWorld(); final GlowEntity entity = world.getEntityManager().getEntity(message.getId()); PlayerInteractEntityEvent event = EventFactory.callEvent(new PlayerInteractEntityEvent(player, entity)); if (!event.isCancelled()) { entity.entityInteract(player, message); } }

Target:
public void handle(GlowSession session, InteractEntityMessage message) { GlowPlayer player = session.getPlayer(); if (player.isDead()) { GlowServer.logger.info("Player " + player.getName() + " tried to interact with an entity while dead"); return; } GlowEntity possibleTarget = player.getWorld().getEntityManager().getEntity(message.getId()); GlowLivingEntity target = possibleTarget instanceof GlowLivingEntity ? (GlowLivingEntity) possibleTarget : null; if (message.getAction() == InteractEntityMessage.Action.ATTACK.ordinal()) { if (target == null) { if (possibleTarget != null) { possibleTarget.entityInteract(player, message); } else { GlowServer.logger.info("Player " + player.getName() + " tried to attack an entity that does not exist"); } } else if (!target.isDead() && target.canTakeDamage(EntityDamageEvent.DamageCause.ENTITY_ATTACK)) { ItemStack hand = player.getItemInHand(); Material type = hand == null ? Material.AIR : hand.getType(); float damage = AttackDamage.getMeleeDamage(type, false); target.damage(damage, player, EntityDamageEvent.DamageCause.ENTITY_ATTACK); short durabilityLoss = AttackDamage.getMeleeDurabilityLoss(type); if (durabilityLoss > 0 && hand != null && player.getGameMode() != GameMode.CREATIVE) { hand.setDurability((short) (hand.getDurability() + durabilityLoss)); } } } else if (message.getAction() == InteractEntityMessage.Action.INTERACT_AT.ordinal()) { } else if (message.getAction() == InteractEntityMessage.Action.INTERACT.ordinal()) { PlayerInteractEntityEvent event = new PlayerInteractEntityEvent(player, possibleTarget); EventFactory.callEvent(event); if (!event.isCancelled()) { possibleTarget.entityInteract(player, message); } } else { GlowServer.logger.info("Player " + player.getName() + " sent unknown interact action: " + message.getAction()); } }
Source:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (!(msg instanceof Send)) { ctx.write(msg, promise); return; } Send send = (Send) msg; Http2Headers http2Headers; if (forServer) { logger.trace("Write content to channel as server {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().status(HttpResponseStatus.OK.codeAsText()); } else { logger.trace("Write content to channel as client {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().method(HttpMethod.POST.asciiName()).scheme("https").path("/"); } DefaultHttp2HeadersFrame headersFrame = new DefaultHttp2HeadersFrame(http2Headers, false); ctx.write(headersFrame); ByteBufChannel byteBufChannel = new ByteBufChannel(); try { send.writeTo(byteBufChannel); } catch (IOException e) { promise.setFailure(e); return; } DefaultHttp2DataFrame dataFrame = new DefaultHttp2DataFrame(byteBufChannel.getBuf(), true); ctx.writeAndFlush(dataFrame, promise); }

Target:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (!ctx.channel().isOpen()) { logger.debug("Channel closed when write. Channel: {}", ctx.channel()); promise.setFailure(new ChannelException("Channel has been closed when write.")); } if (!(msg instanceof Send)) { ctx.write(msg, promise); return; } Send send = (Send) msg; Http2Headers http2Headers; if (forServer) { logger.trace("Write content to channel as server {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().status(HttpResponseStatus.OK.codeAsText()); } else { logger.trace("Write content to channel as client {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().method(HttpMethod.POST.asciiName()).scheme("https").path("/"); } DefaultHttp2HeadersFrame headersFrame = new DefaultHttp2HeadersFrame(http2Headers, false); ctx.write(headersFrame); ByteBufChannel byteBufChannel = new ByteBufChannel(); try { send.writeTo(byteBufChannel); } catch (IOException e) { promise.setFailure(e); return; } DefaultHttp2DataFrame dataFrame = new DefaultHttp2DataFrame(byteBufChannel.getBuf(), true); ctx.write(dataFrame, promise); }
Source:
protected void refresh() { long startTime = System.currentTimeMillis(); cacheRefreshTimer.record(new Runnable() { public void run() { allItemsCache.set(fetchAllItems(allItemsCache.get())); } }); long endTime = System.currentTimeMillis(); log.debug("Refreshed (" + (endTime - startTime) + "ms)"); }

Target:
protected void refresh() { long startTime = System.nanoTime(); allItemsCache.set(fetchAllItems(allItemsCache.get())); long elapsed = System.nanoTime() - startTime; registry.timer("storageServiceSupport.cacheRefreshTime", "objectType", objectType.name()) .record(elapsed, TimeUnit.NANOSECONDS); log.debug("Refreshed (" + TimeUnit.NANOSECONDS.toMillis(elapsed) + "ms)"); }
Source:
public void testToMapWithNull() throws Exception { Map<?, ?> entries = PROPERTIES_LOADER.toMap(null); Assert.assertEquals("Returns an empty map", Collections.emptyMap(), entries); }

Target:
public void testToMapWithNull() throws Exception { Map<?, ?> entries = PROPERTIES_LOADER.toMap(null); assertThat(entries.entrySet(), is(empty())); }
Source:
public JdbcEnvironmentRepository(JdbcTemplate jdbc, JdbcEnvironmentProperties properties) { this.jdbc = jdbc; if (properties != null) { this.order = properties.getOrder() == null ? this.order : properties.getOrder(); this.sql = properties.getSql() == null ? this.sql : properties.getSql(); } }

Target:
public JdbcEnvironmentRepository(JdbcTemplate jdbc, JdbcEnvironmentProperties properties) { this.jdbc = jdbc; this.order = properties.getOrder(); this.sql = properties.getSql(); }
Source:
private void setupPlaybackSpeedPreference() { ListPreference feedPlaybackSpeedPreference = (ListPreference) findPreference(PREF_FEED_PLAYBACK_SPEED); String[] speeds = UserPreferences.getPlaybackSpeedArray(); String[] values = new String[speeds.length + 1]; values[0] = "global"; String[] entries = new String[speeds.length + 1]; entries[0] = getString(R.string.feed_auto_download_global); for (int i = 0; i < speeds.length; i++) { values[i + 1] = speeds[i]; entries[i + 1] = speeds[i]; } feedPlaybackSpeedPreference.setEntryValues(values); feedPlaybackSpeedPreference.setEntries(entries); feedPlaybackSpeedPreference.setOnPreferenceChangeListener((preference, newValue) -> { feedPreferences.setFeedPlaybackSpeed((String) newValue); feed.savePreferences(); updatePlaybackSpeedPreference(); return false; }); }

Target:
private void setupPlaybackSpeedPreference() { ListPreference feedPlaybackSpeedPreference = findPreference(PREF_FEED_PLAYBACK_SPEED); String[] speeds = UserPreferences.getPlaybackSpeedArray(); String[] values = new String[speeds.length + 1]; values[0] = decimalFormat.format(SPEED_USE_GLOBAL); String[] entries = new String[speeds.length + 1]; entries[0] = getString(R.string.feed_auto_download_global); System.arraycopy(speeds, 0, values, 1, speeds.length); System.arraycopy(speeds, 0, entries, 1, speeds.length); feedPlaybackSpeedPreference.setEntryValues(values); feedPlaybackSpeedPreference.setEntries(entries); feedPlaybackSpeedPreference.setOnPreferenceChangeListener((preference, newValue) -> { feedPreferences.setFeedPlaybackSpeed(Float.parseFloat((String) newValue)); feed.savePreferences(); updatePlaybackSpeedPreference(); return false; }); }
Source:
private boolean isDrop(TcpDiscoveryAbstractMessage msg) { if (!drop) { if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) { TcpDiscoveryNodeAddFinishedMessage finishMsg = (TcpDiscoveryNodeAddFinishedMessage)msg; if ((finishMsg.nodeId().getLeastSignificantBits() & 0xFFFF) == dropNodeIdx) { drop = true; dropLatch.countDown(); } } } if (drop && msg != null) ignite.log().info(">> Drop message " + msg); return drop; }

Target:
private boolean isDrop(TcpDiscoveryAbstractMessage msg) { if (!drop) { if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) { TcpDiscoveryNodeAddFinishedMessage finishMsg = (TcpDiscoveryNodeAddFinishedMessage)msg; if ((finishMsg.nodeId().getLeastSignificantBits() & 0xFFFF) == dropNodeIdx) { drop = true; dropLatch.countDown(); } } } if (drop) ignite.log().info(">> Drop message " + msg); return drop; }
Source:
public void testLoadOrderedPublicEvents_11() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_CREATION_DATE_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String[] expectedFreeContentsId = {"EVN21", "EVN25", "EVN24", "EVN23", "EVN20", "EVN194", "EVN193", "EVN192", "EVN191"}; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); Assert.assertEquals(expectedFreeContentsId.length, payloadSize); for (int i = 0; i < expectedFreeContentsId.length; i++) { String expectedId = expectedFreeContentsId[i]; String extractedId = JsonPath.read(bodyResult, "$.payload[" + i + "].id"); Assert.assertEquals(expectedId, extractedId); } }

Target:
public void testLoadOrderedPublicEvents_11() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_CREATION_DATE_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(9))) .andExpect(jsonPath("$.payload[0].id", is("EVN21"))) .andExpect(jsonPath("$.payload[1].id", is("EVN25"))) .andExpect(jsonPath("$.payload[2].id", is("EVN24"))) .andExpect(jsonPath("$.payload[3].id", is("EVN23"))) .andExpect(jsonPath("$.payload[4].id", is("EVN20"))) .andExpect(jsonPath("$.payload[5].id", is("EVN194"))) .andExpect(jsonPath("$.payload[6].id", is("EVN193"))) .andExpect(jsonPath("$.payload[7].id", is("EVN192"))) .andExpect(jsonPath("$.payload[8].id", is("EVN191"))); }
Source:
protected void paintLine(int line, int y, int lineheight, GC gc, Display display) { int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line); String s= createDisplayString(line); if (s.length() == 0) { return; } int indentation= fIndentation[s.length()]; int baselineBias= getBaselineBias(gc, widgetLine); gc.drawString(s, indentation, y + baselineBias, true); }

Target:
protected void paintLine(int line, int y, int lineheight, GC gc, Display display) { int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line); String s= createDisplayString(line); int indentation= fIndentation[s.length()]; int baselineBias= getBaselineBias(gc, widgetLine); gc.drawString(s, indentation, y + baselineBias, true); }
Source:
private IndexClient() { try { if (ElasticSearchClient.getClient() == null) { ElasticSearchClient.init(); } } catch (IOException e) { e.printStackTrace(); } this.client = ElasticSearchClient.getClient(); }

Target:
private IndexClient() { try { if (ElasticSearchClient.getClient() == null) { ElasticSearchClient.init(); } } catch (IOException e) { logError(e) .addMessage("Caught exception initialising Elasticsearch client") .log(); throw new RuntimeException(e); } this.client = ElasticSearchClient.getClient(); }
Source:
public void seek(LogOffset offset) { log.debug("Seek to: " + offset + " from tailer: " + id); TopicPartition topicPartition = new TopicPartition(prefix + offset.partition().name(), offset.partition().partition()); consumer.seek(topicPartition, offset.offset()); lastOffsets.remove(topicPartition); List<ConsumerRecord<String, Bytes>> toRemove = records.stream().filter(rec -> rec.partition() == topicPartition.partition()).collect(Collectors.toList()); toRemove.forEach(records::remove); }

Target:
public void seek(LogOffset offset) { log.debug("Seek to: " + offset + " from tailer: " + id); TopicPartition topicPartition = new TopicPartition(prefix + offset.partition().name(), offset.partition().partition()); consumer.seek(topicPartition, offset.offset()); lastOffsets.remove(topicPartition); int partition = topicPartition.partition(); records.removeIf(rec -> rec.partition() == partition); }
Source:
private ImmutableList<Ds3Property> toDs3Properties() { final ImmutableList.Builder<Ds3Property> ds3PropertyBuilder = ImmutableList.builder(); for (Property property : properties) { ds3PropertyBuilder.add(property.toDs3Property()); } return ds3PropertyBuilder.build(); }

Target:
private ImmutableList<Ds3Property> toDs3Properties() { final ImmutableList.Builder<Ds3Property> ds3PropertyBuilder = ImmutableList.builder(); for (final Property property : properties) { ds3PropertyBuilder.add(property.toDs3Property()); } return ds3PropertyBuilder.build(); }
Source:
AwsCredentialSource(Map<String, Object> credentialSourceMap) { super(credentialSourceMap); this.regionUrl = (String) checkNotNull(credentialSourceMap.get("region_url")); this.url = (String) checkNotNull(credentialSourceMap.get("url")); this.regionalCredentialVerificationUrl = (String) checkNotNull(credentialSourceMap.get("regional_cred_verification_url")); }

Target:
AwsCredentialSource(Map<String, Object> credentialSourceMap) { super(credentialSourceMap); if (!credentialSourceMap.containsKey("region_url")) { throw new IllegalArgumentException( "A region_url representing the targeted region must be specified."); } if (!credentialSourceMap.containsKey("url")) { throw new IllegalArgumentException( "A url representing the metadata server endpoint must be specified."); } if (!credentialSourceMap.containsKey("regional_cred_verification_url")) { throw new IllegalArgumentException( "A regional_cred_verification_url representing the" + " GetCallerIdentity action URL must be specified."); } this.regionUrl = (String) credentialSourceMap.get("region_url"); this.url = (String) credentialSourceMap.get("url"); this.regionalCredentialVerificationUrl = (String) credentialSourceMap.get("regional_cred_verification_url"); }
Source:
public void validate(final PreparedUpdate update, final UpdateContext updateContext) { final RpslObject updatedObject = update.getUpdatedObject(); if (updatedObject == null) { return; } final Optional<CIString> prefix = getPrefix(updatedObject); if (prefix.isPresent() && isBogon(prefix.get().toString())) { updateContext.addMessage(update, UpdateMessages.bogonPrefixNotAllowed(prefix.get().toString())); } }

Target:
public void validate(final PreparedUpdate update, final UpdateContext updateContext) { final RpslObject updatedObject = update.getUpdatedObject(); if (updatedObject == null) { return; } getPrefix(updatedObject).ifPresent(prefix -> { if (isBogon(prefix.toString())) { updateContext.addMessage(update, UpdateMessages.bogonPrefixNotAllowed(prefix.toString())); } }); }