auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGetNextLine() throws IOException { decompressorStream = new FixedLengthCharsetTransformingDecompressorStream(inputStream, FixedLengthCharset.UTF_32, 0, 32); compressionInputStream = new TransformingCompressionInputStream(decompressorStream, 0, 32); setUpRecordReaderForTest(compressionInputStream); Assert.assertTrue(recordReader.nextKeyValue()); Assert.assertEquals(recordReader.getCurrentKey().get(), 0); Assert.assertEquals(recordReader.getCurrentValue().toString(), "abcd"); Assert.assertTrue(recordReader.nextKeyValue()); Assert.assertEquals(recordReader.getCurrentKey().get(), 5); Assert.assertEquals(recordReader.getCurrentValue().toString(), "edfg"); Assert.assertFalse(recordReader.nextKeyValue()); Assert.assertNull(recordReader.getCurrentKey()); Assert.assertNull(recordReader.getCurrentValue()); Assert.assertFalse(recordReader.nextKeyValue()); Assert.assertNull(recordReader.getCurrentKey()); Assert.assertNull(recordReader.getCurrentValue()); }

Target:
public void testGetNextLine() throws IOException { decompressorStream = new FixedLengthCharsetTransformingDecompressorStream(inputStream, FixedLengthCharset.UTF_32, 0, 32); compressionInputStream = new TransformingCompressionInputStream(decompressorStream, 0, 32); setUpRecordReaderForTest(compressionInputStream); Assert.assertTrue(recordReader.nextKeyValue()); Assert.assertEquals(0, recordReader.getCurrentKey().get()); Assert.assertEquals("abcd", recordReader.getCurrentValue().toString()); Assert.assertTrue(recordReader.nextKeyValue()); Assert.assertEquals(5, recordReader.getCurrentKey().get()); Assert.assertEquals("edfg", recordReader.getCurrentValue().toString()); Assert.assertFalse(recordReader.nextKeyValue()); Assert.assertNull(recordReader.getCurrentKey()); Assert.assertNull(recordReader.getCurrentValue()); Assert.assertFalse(recordReader.nextKeyValue()); Assert.assertNull(recordReader.getCurrentKey()); Assert.assertNull(recordReader.getCurrentValue()); }
Source:
private ICPPFunction resolveFunctionBinding(IASTNode point) { ICPPFunction function = getOverload(point); if (function == null) { ICPPEvaluation funcEval = fArguments[0]; if (funcEval instanceof EvalFunctionSet && getOverload(point) == null) { EvalFunctionSet funcEvalFunctionSet = (EvalFunctionSet)funcEval; funcEval = funcEvalFunctionSet.resolveFunction(Arrays.copyOfRange(fArguments, 1, fArguments.length), point); } IBinding binding = null; if (funcEval instanceof EvalBinding) { EvalBinding funcEvalBinding = (EvalBinding)funcEval; binding = funcEvalBinding.getBinding(); } else if (funcEval instanceof EvalMemberAccess) { EvalMemberAccess funcEvalMemberAccess = (EvalMemberAccess)funcEval; binding = funcEvalMemberAccess.getMember(); } if (binding instanceof ICPPFunction) { function = (ICPPFunction) binding; } } return function; }

Target:
private ICPPFunction resolveFunctionBinding(IASTNode point) { ICPPFunction function = getOverload(point); if (function == null) { ICPPEvaluation funcEval = fArguments[0]; if (funcEval instanceof EvalFunctionSet) { EvalFunctionSet funcEvalFunctionSet = (EvalFunctionSet)funcEval; funcEval = funcEvalFunctionSet.resolveFunction(Arrays.copyOfRange(fArguments, 1, fArguments.length), point); } IBinding binding = null; if (funcEval instanceof EvalBinding) { EvalBinding funcEvalBinding = (EvalBinding)funcEval; binding = funcEvalBinding.getBinding(); } else if (funcEval instanceof EvalMemberAccess) { EvalMemberAccess funcEvalMemberAccess = (EvalMemberAccess)funcEval; binding = funcEvalMemberAccess.getMember(); } if (binding instanceof ICPPFunction) { function = (ICPPFunction) binding; } } return function; }
Source:
public Image getImageFromPath(String path) { return getImageDescripterFromPath(path).createImage(); }

Target:
public Image getImageFromPath(String path) { return getImageDescriptorFromPath(path).createImage(); }
Source:
public void getObjectCachedNotification() throws IOException, SignatureException, XmlProcessingException { try { final PutObjectCachedNotificationRegistrationSpectraS3Response putNotificationResponse = client .putObjectCachedNotificationRegistrationSpectraS3 (new PutObjectCachedNotificationRegistrationSpectraS3Request("test@test.test")); final GetObjectCachedNotificationRegistrationSpectraS3Response getNotificationResponse = client .getObjectCachedNotificationRegistrationSpectraS3( (new GetObjectCachedNotificationRegistrationSpectraS3Request (putNotificationResponse.getS3ObjectCachedNotificationRegistrationResult().getId()))); assertThat(getNotificationResponse.getStatusCode(), is(200)); } finally { deleteAllContents(client, BUCKET_NAME); } }

Target:
public void getObjectCachedNotification() throws IOException, SignatureException, XmlProcessingException { final PutObjectCachedNotificationRegistrationSpectraS3Response putNotificationResponse = client .putObjectCachedNotificationRegistrationSpectraS3 (new PutObjectCachedNotificationRegistrationSpectraS3Request("test@test.test")); final GetObjectCachedNotificationRegistrationSpectraS3Response getNotificationResponse = client .getObjectCachedNotificationRegistrationSpectraS3( (new GetObjectCachedNotificationRegistrationSpectraS3Request (putNotificationResponse.getS3ObjectCachedNotificationRegistrationResult().getId()))); assertThat(getNotificationResponse.getStatusCode(), is(200)); }
Source:
private void addDefectWidget(StringBuilder sb, IAtsWorkItem workItem, IAtsWidgetDefinition widget) { sb.append("Defects: "); Collection<String> defects = atsServer.getAttributeResolver().getAttributesToStringList(workItem, AtsAttributeTypes.ReviewDefect); if (!defects.isEmpty()) { sb.append("<table border=\"1\" align=\"center\" width=\"98%\"><tr><th>Severity</th><th>Disposition</th><th>Closed</th><th>User</th><th>Created</th><th>Injected</th><th>Description</th><th>Location</th><th>Resolution</th></tr>"); for (String xml : defects) { sb.append("<tr>"); for (String key : defectKeys) { sb.append("<td>"); String data = AXml.getTagData(xml, key); if (key.equals("user")) { data = atsServer.getUserService().getUserById(data).getName(); } else if (key.equals("date")) { data = DateUtil.getDateStr(new Date(Long.valueOf(data)), DateUtil.MMDDYYHHMM); } sb.append(data); sb.append("</td>"); } sb.append("</tr>"); } sb.append("</table>"); } }

Target:
private void addDefectWidget(StringBuilder sb, IAtsWorkItem workItem, IAtsWidgetDefinition widget) { sb.append("Defects: "); Collection<String> defects = atsServer.getAttributeResolver().getAttributesToStringList(workItem, AtsAttributeTypes.ReviewDefect); if (!defects.isEmpty()) { sb.append(DEFECT_TABLE_HEADER); for (String xml : defects) { sb.append("<tr>"); for (String key : defectKeys) { sb.append("<td>"); String data = AXml.getTagData(xml, key); if (key.equals("user")) { data = atsServer.getUserService().getUserById(data).getName(); } else if (key.equals("date")) { data = DateUtil.getDateStr(new Date(Long.valueOf(data)), DateUtil.MMDDYYHHMM); } sb.append(data); sb.append("</td>"); } sb.append("</tr>"); } sb.append("</table>"); } }
Source:
private int computeInterfaceSpeed(String ifaceName) { VdsNetworkInterface iface = ifaceByNames.get(ifaceName); Iterable<VdsNetworkInterface> slaves = bonds.get(ifaceName); if (slaves == null) { return iface.getSpeed(); } else { Integer speed = bondSpeeds.get(ifaceName); if (speed != null) { return speed; } boolean chooseMinimum = isBondModeFailover(iface.getBondType()); speed = chooseMinimum ? Integer.MAX_VALUE : 0; for (VdsNetworkInterface slave : slaves) { speed = chooseMinimum ? Math.min(speed, slave.getSpeed()) : speed + slave.getSpeed(); } bondSpeeds.put(ifaceName, speed); return speed; } }

Target:
private Integer computeInterfaceSpeed(String ifaceName) { VdsNetworkInterface iface = ifaceByNames.get(ifaceName); if (ifaceSpeeds.containsKey(ifaceName)) { return ifaceSpeeds.get(ifaceName); } else { Integer speed = null; if (iface.hasSpeed()) { speed = iface.getSpeed(); } else { Iterable<VdsNetworkInterface> slaves = bonds.get(ifaceName); if (slaves != null) { boolean chooseMinimum = isBondModeFailover(iface.getBondOptions()); speed = chooseMinimum ? Integer.MAX_VALUE : 0; for (VdsNetworkInterface slave : slaves) { if (!slave.hasSpeed()) { speed = null; break; } speed = chooseMinimum ? Math.min(speed, slave.getSpeed()) : speed + slave.getSpeed(); } } } ifaceSpeeds.put(ifaceName, speed); return speed; } }
Source:
public void remoteInit() { try { Map<Currency, CurrencyMetaData> currenciesMetaData = exchangeMetaData.getCurrencies(); Map<CurrencyPair, CurrencyPairMetaData> pairsMetaData = exchangeMetaData.getCurrencyPairs(); for (LatokenCurrency latokenCurrency : LatokenAdapters.allCurrencies) { Currency currency = LatokenAdapters.adaptCurrency(latokenCurrency); int precision = latokenCurrency.getPrecision(); addCurrencyMetadata(currenciesMetaData, currency, precision); } for (LatokenPair latokenPair : LatokenAdapters.allPairs) { CurrencyPair pair = LatokenAdapters.adaptCurrencyPair(latokenPair); BigDecimal tradingFee = BigDecimal.valueOf(latokenPair.getTakerFee()); BigDecimal minAmount = BigDecimal .valueOf(latokenPair.getMinOrderAmount()) .setScale(latokenPair.getAmountPrecision(), RoundingMode.HALF_DOWN); int priceScale = latokenPair.getPricePrecision(); addCurrencyPairMetadata(pairsMetaData, pair, tradingFee, minAmount, priceScale); } } catch (Exception e) { throw new ExchangeException("Failed to initialize: " + e.getMessage(), e); } }

Target:
public void remoteInit() { try { Map<Currency, CurrencyMetaData> currenciesMetaData = exchangeMetaData.getCurrencies(); Map<CurrencyPair, CurrencyPairMetaData> pairsMetaData = exchangeMetaData.getCurrencyPairs(); List<LatokenPair> allPairs = latoken.getAllPairs(); List<LatokenCurrency> allCurrencies = latoken.getAllCurrencies(); this.exchangeSpecification.setExchangeSpecificParametersItem("pairs", allPairs); for (LatokenCurrency latokenCurrency : allCurrencies) { Currency currency = LatokenAdapters.adaptCurrency(latokenCurrency); addCurrencyMetadata(currenciesMetaData, currency, PRECISION); } for (LatokenPair latokenPair : allPairs) { CurrencyPair pair = LatokenAdapters.adaptCurrencyPair(latokenPair); CurrencyPairMetaData pairMetadata = LatokenAdapters.adaptPairMetaData(latokenPair); addCurrencyPairMetadata(pairsMetaData, pair, pairMetadata); } } catch (Exception e) { throw new ExchangeException("Failed to initialize: " + e.getMessage(), e); } }
Source:
private <T extends Message> CompletableFuture<T> call(ClientMetaService.Interface stub, Callable<T> callable) { HBaseRpcController controller = rpcControllerFactory.newController(); CompletableFuture<T> future = new CompletableFuture<>(); callable.call(controller, stub, resp -> { if (controller.failed()) { future.completeExceptionally(controller.getFailed()); synchronized (refreshMasters) { refreshMasters.notify(); } } else { future.complete(resp); } }); return future; }

Target:
private <T extends Message> CompletableFuture<T> call(ClientMetaService.Interface stub, Callable<T> callable) { HBaseRpcController controller = rpcControllerFactory.newController(); CompletableFuture<T> future = new CompletableFuture<>(); callable.call(controller, stub, resp -> { if (controller.failed()) { IOException failureReason = controller.getFailed(); future.completeExceptionally(failureReason); if (ClientExceptionsUtil.isConnectionException(failureReason)) { masterAddressRefresher.refreshNow(); } } else { future.complete(resp); } }); return future; }
Source:
protected static void assertAuthzDecisionStatements(final Assertion assertion) throws WSSecurityException { if ((assertion.getAuthzDecisionStatements() == null || assertion.getAuthzDecisionStatements().isEmpty()) && assertion.getSubject() == null) { throw new WSSecurityException(ErrorCode.FAILURE, "Subject is required when Statements are absent"); } }

Target:
protected static void assertAuthzDecisionStatements(final Assertion assertion) throws WSSecurityException { if (CollectionUtils.isEmpty(assertion.getAuthzDecisionStatements()) && assertion.getSubject() == null) { throw new WSSecurityException(ErrorCode.FAILURE, "Subject is required when Statements are absent"); } }
Source:
@Override public void postDecode() { if (refreshMinutes == 0) { postDecodeHelper(); } else { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); ScheduledExecutorService executorService = MoreExecutors.getExitingScheduledExecutorService(executor, 100, TimeUnit.MILLISECONDS); executorService.scheduleWithFixedDelay(() -> { postDecodeHelper(); }, 0, refreshMinutes, TimeUnit.MINUTES); } }

Target:
@Override public void postDecode() { postDecodeHelper(); if (refreshMinutes > 0) { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); ScheduledExecutorService executorService = MoreExecutors.getExitingScheduledExecutorService(executor, 100, TimeUnit.MILLISECONDS); executorService.scheduleWithFixedDelay(this :: postDecodeHelper, refreshMinutes, refreshMinutes, TimeUnit.MINUTES); } }
Source:
private String getCacheKey(ResourceDataRequest request) { final CanonicalUri uri = request.getUri(); final String href = uri.getAbsolutePath(); return getCacheKey(href); }

Target:
private String getCacheKey(ResourceDataRequest request) { return getCacheKey(request.getUri().getAbsolutePath()); }
Source:
public void testTextWrapBoundariesUpdatesOnResize() { tested.resize(0, 0, 10, 10, true); verify(textDecorator).setTextBoundaries(any()); }

Target:
public void testTextWrapBoundariesUpdatesOnResize() { tested.resize(0, 0, 10, 10, true); verify(textDecorator).setTextBoundaries(PATH.getBoundingBox()); }
Source:
public void validate_shouldFailIfPatientIsVoided() throws Exception { Cohort cohort = new Cohort(2); Patient patient = new Patient(7); patient.setVoided(true); cohort.addMembership(new CohortMembership(patient)); Errors errors = new BindException(cohort, "cohort"); new CohortValidator().validate(cohort, errors); Assert.assertEquals(true, errors.hasFieldErrors("members")); }

Target:
public void validate_shouldFailIfPatientIsVoided() throws Exception { Cohort cohort = new Cohort(2); Patient patient = new Patient(7); patient.setVoided(true); cohort.addMembership(new CohortMembership(patient)); Errors errors = new BindException(cohort, "cohort"); new CohortValidator().validate(cohort, errors); Assert.assertTrue(errors.hasFieldErrors("members")); String eMessage = "Patient " + patient.getPatientId() + " is voided, cannot add voided members to a cohort"; Assert.assertTrue(errors.getFieldErrors().stream().anyMatch(e -> e.getDefaultMessage().equals(eMessage))); }
Source:
protected Object handleRequestMessage(Message<?> requestMessage) { MessageValues messageValues = (this.extractEmbeddedHeaders) ? extractEmbeddedHeaders(requestMessage) : new MessageValues(requestMessage); return (this.supportDeserializationNatively) ? messageValues.toMessage() : deserializePayloadIfNecessary(messageValues).toMessage(); }

Target:
protected Object handleRequestMessage(Message<?> requestMessage) { if (!(requestMessage.getPayload() instanceof byte[])) { return requestMessage; } MessageValues messageValues; if (this.extractEmbeddedHeaders) { try { messageValues = AbstractMessageChannelBinder.this.embeddedHeadersMessageConverter.extractHeaders( (Message<byte[]>) requestMessage, true); } catch (Exception e) { AbstractMessageChannelBinder.this.logger.error( EmbeddedHeadersMessageConverter.decodeExceptionMessage( requestMessage), e); messageValues = new MessageValues(requestMessage); } messageValues = deserializePayloadIfNecessary(messageValues); } else { messageValues = deserializePayloadIfNecessary(requestMessage); } return messageValues.toMessage(); }
Source:
public <ARCHIVEVIEW extends Assignable> ARCHIVEVIEW resolveArtifactAs(Class<ARCHIVEVIEW> archiveView) throws ResolutionException { Collection<ARCHIVEVIEW> archiveViews = new MavenBuilderImpl(system, session, settings, dependencies, versionManagement) .resolveAs(archiveView); return (archiveViews == null || archiveViews.isEmpty()) ? null : archiveViews.iterator().next(); }

Target:
public <ARCHIVEVIEW extends Assignable> ARCHIVEVIEW resolveArtifactAs(Class<ARCHIVEVIEW> archiveView) throws ResolutionException { Collection<ARCHIVEVIEW> archiveViews = new MavenBuilderImpl(system, session, settings, dependencies, versionManagement) .resolveAs(archiveView, new StrictFilter()); if (archiveViews != null && archiveViews.size() != 1) { throw new ResolutionException("Only one artifact should have been resolved. Resolved " + archiveViews.size() + " artifacts."); } return (archiveViews == null) ? null : archiveViews.iterator().next(); }
Source:
protected boolean validateInputs() { if (!super.validateInputs()) { return false; } VdcQueryReturnValue returnValue = getQueryReturnValue(); returnValue.setExceptionString(""); try { String hostName = getParameters().getVdsHostName(); if (StringUtils.isEmpty(hostName)) { returnValue.setExceptionString("Cannot register Host - no Hostname address specified."); return false; } List<VDS> vdssByUniqueId = getVdssByUniqueId(); if (vdssByUniqueId.size() > 1) { returnValue.setExceptionString("Cannot register Host - unique id is ambigious."); return false; } if (vdssByUniqueId.size() == 1) { VDS vds = vdssByUniqueId.get(0); if (!VdsHandler.isPendingOvirt(vds)) { returnValue.setExceptionString(VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_UPDATE.name()); return false; } Long otp = getParameters().getOtp(); if (otp != null && !isValidOtp(vds, otp)) { returnValue.setExceptionString(String.format("Invalid OTP for host %s", hostName)); return false; } } } catch (RuntimeException ex) { log.error(ex); returnValue.setExceptionString(String.format("Cannot register Host - An exception has been thrown: %1$s", ex.getMessage())); return false; } return true; }

Target:
protected boolean validateInputs() { if (!super.validateInputs()) { return false; } VdcQueryReturnValue returnValue = getQueryReturnValue(); returnValue.setExceptionString(""); try { String hostName = getParameters().getVdsHostName(); if (StringUtils.isEmpty(hostName)) { returnValue.setExceptionString("Cannot register Host - no Hostname address specified."); return false; } List<VDS> vdssByUniqueId = getVdssByUniqueId(); if (vdssByUniqueId.size() > 1) { returnValue.setExceptionString("Cannot register Host - unique id is ambigious."); return false; } if (vdssByUniqueId.size() == 1) { VDS vds = vdssByUniqueId.get(0); if (!VdsHandler.isPendingOvirt(vds)) { returnValue.setExceptionString(VdcBllMessages.VDS_STATUS_NOT_VALID_FOR_UPDATE.name()); return false; } Long otp = getParameters().getOtp(); if (!isValidOtp(vds, otp)) { returnValue.setExceptionString(String.format("Invalid OTP for host %s", hostName)); return false; } } } catch (RuntimeException ex) { log.error(ex); returnValue.setExceptionString(String.format("Cannot register Host - An exception has been thrown: %1$s", ex.getMessage())); return false; } return true; }
Source:
public void reloadOffsets(SubscriptionName subscriptionName, Consumer consumer) { logger.info("Reloading offsets for {}", subscriptionName); try { PartitionOffsets offsets = subscriptionOffsetChangeIndicator.getSubscriptionOffsets( subscriptionName.getTopicName(), subscriptionName.getName(), brokersClusterName); for (PartitionOffset partitionOffset : offsets) { SubscriptionPartitionOffset subscriptionPartitionOffset = new SubscriptionPartitionOffset( new SubscriptionPartition(partitionOffset.getTopic(), subscriptionName, partitionOffset.getPartition(), NON_EXISTENT_PARTITION_ASSIGNMENT_TERM), partitionOffset.getOffset()); if (moveOffset(subscriptionName, consumer, subscriptionPartitionOffset)) { subscriptionOffsetChangeIndicator.removeOffset( subscriptionName.getTopicName(), subscriptionName.getName(), brokersClusterName, partitionOffset.getTopic(), partitionOffset.getPartition() ); logger.info("Removed offset indicator for subscription={} and partition={}", subscriptionName, subscriptionPartitionOffset.getPartition()); } } } catch (Exception ex) { throw new RetransmissionException(ex); } }

Target:
public void reloadOffsets(SubscriptionName subscriptionName, Consumer consumer) { logger.info("Reloading offsets for {}", subscriptionName); try { PartitionOffsets offsets = subscriptionOffsetChangeIndicator.getSubscriptionOffsets( subscriptionName.getTopicName(), subscriptionName.getName(), brokersClusterName); for (PartitionOffset partitionOffset : offsets) { if (moveOffset(subscriptionName, consumer, partitionOffset)) { subscriptionOffsetChangeIndicator.removeOffset( subscriptionName.getTopicName(), subscriptionName.getName(), brokersClusterName, partitionOffset.getTopic(), partitionOffset.getPartition() ); logger.info("Removed offset indicator for subscription={} and partition={}", subscriptionName, partitionOffset.getPartition()); } } } catch (Exception ex) { throw new RetransmissionException(ex); } }
Source:
public boolean swapBlockList(String src, String dst, long maxTimestamp) throws IOException { checkNNStartup(); if (stateChangeLog.isDebugEnabled()) { stateChangeLog.debug("*DIR* NameNode.swapBlockList: and {}", src, dst); } namesystem.checkOperation(OperationCategory.WRITE); return namesystem.swapBlockList(src, dst, maxTimestamp); }

Target:
public boolean swapBlockList(String src, String dst, long maxTimestamp) throws IOException { checkNNStartup(); if (stateChangeLog.isDebugEnabled()) { stateChangeLog.debug("*DIR* NameNode.swapBlockList: and {}", src, dst); } return namesystem.swapBlockList(src, dst, maxTimestamp); }
Source:
public void getEntryByEntryNumber() throws JSONException, IOException { String sha256Hex = DigestUtils.sha256Hex(item1); Response response = getRequest("/entry/1.json"); assertThat(response.getStatus(), equalTo(200)); assertThat(response.getHeaders().get("cache-control").toString(), equalTo("[no-transform, max-age=31536000]")); JsonNode res = Jackson.newObjectMapper().readValue(response.readEntity(String.class), JsonNode.class); assertThat(res.get("entry-number").textValue(), equalTo("1")); assertThat(res.get("item-hash").textValue(), equalTo("sha-256:" + sha256Hex)); assertThat(res.get("entry-timestamp").textValue(), containsString(LocalDate.now().toString())); }

Target:
public void getEntryByEntryNumber() throws JSONException, IOException { String sha256Hex = DigestUtils.sha256Hex(item1); Response response = getRequest("/entry/1.json"); assertThat(response.getStatus(), equalTo(200)); assertThat(response.getHeaders().get("cache-control"), contains("no-transform, max-age=31536000")); JsonNode res = Jackson.newObjectMapper().readValue(response.readEntity(String.class), JsonNode.class); assertThat(res.get("entry-number").textValue(), equalTo("1")); assertThat(res.get("item-hash").textValue(), equalTo("sha-256:" + sha256Hex)); assertTrue(res.get("entry-timestamp").textValue().matches("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$")); }
Source:
public AsyncBenchmark(VoterConfig config) { this.config = config; ClientConfig clientConfig = null; if (config.sslfile.length() > 0) { try { clientConfig = new ClientConfig(config.user, config.password, new StatusListener()); if (config.sslfile.trim().length() > 0) { clientConfig.setTrustStore(config.sslfile); } } catch (Exception e) { System.err.println("Failed to configure ssl, exiting"); e.printStackTrace(); System.exit(-1); } } else clientConfig = new ClientConfig(config.user, config.password, new StatusListener()); if (config.topologyaware) { clientConfig.setTopologyChangeAware(true); } client = ClientFactory.createClient(clientConfig); periodicStatsContext = client.createStatsContext(); fullStatsContext = client.createStatsContext(); switchboard = new PhoneCallGenerator(config.contestants); System.out.print(HORIZONTAL_RULE); System.out.println(" Command Line Configuration"); System.out.println(HORIZONTAL_RULE); System.out.println(config.getConfigDumpString()); if(config.latencyreport) { System.out.println("NOTICE: Option latencyreport is ON for async run, please set a reasonable ratelimit.\n"); } }

Target:
public AsyncBenchmark(VoterConfig config) { this.config = config; ClientConfig clientConfig = new ClientConfig(config.user, config.password, new StatusListener()); if (!config.sslfile.trim().isEmpty()) { clientConfig.setTrustStoreConfigFromPropertyFile(config.sslfile); clientConfig.enableSSL(); } if (config.topologyaware) { clientConfig.setTopologyChangeAware(true); } client = ClientFactory.createClient(clientConfig); periodicStatsContext = client.createStatsContext(); fullStatsContext = client.createStatsContext(); switchboard = new PhoneCallGenerator(config.contestants); System.out.print(HORIZONTAL_RULE); System.out.println(" Command Line Configuration"); System.out.println(HORIZONTAL_RULE); System.out.println(config.getConfigDumpString()); if(config.latencyreport) { System.out.println("NOTICE: Option latencyreport is ON for async run, please set a reasonable ratelimit.\n"); } }
Source:
public void testGetCommunicationSummaryStatisticsServiceName() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setBusinessTransaction("testapp"); ct1.setUri("in1"); ct1.setOperation("op1"); ct1.getProperties().add(new Property("prop", "val")); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); CommunicationDetails cd1 = new CommunicationDetails(); cd1.setBusinessTransaction("testapp"); cd1.setSource("in1[op1]"); cd1.setTarget("out1.1[op1.1]"); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); analytics.storeCommunicationDetails(null, Arrays.asList(cd1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertNotNull("wildfly", communicationSummaryStatistics.getServiceName()); Assert.assertEquals(1, communicationSummaryStatistics.getOutbound().size()); }

Target:
public void testGetCommunicationSummaryStatisticsServiceName() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setBusinessTransaction("testapp"); ct1.setUri("in1"); ct1.setOperation("op1"); ct1.getProperties().add(new Property("prop", "val")); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); CommunicationDetails cd1 = new CommunicationDetails(); cd1.setBusinessTransaction("testapp"); cd1.setSource("in1[op1]"); cd1.setTarget("out1.1[op1.1]"); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); analytics.storeCommunicationDetails(null, Arrays.asList(cd1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertEquals("wildfly", communicationSummaryStatistics.getServiceName()); Assert.assertEquals(1, communicationSummaryStatistics.getOutbound().size()); }
Source:
protected Collection<String> getInAppFrames(Dsn dsn) { String inAppFramesOption = Lookup.lookup(IN_APP_FRAMES_OPTION, dsn); if (Util.isNullOrEmpty(inAppFramesOption)) { if (inAppFramesOption == null) { logger.warn("No '" + IN_APP_FRAMES_OPTION + "' was configured, this option is highly recommended " + "as it affects stacktrace grouping and display on Sentry. See documentation: " + "<LINK_0>"); } return Collections.emptyList(); } List<String> inAppPackages = new ArrayList<>(); for (String inAppPackage : inAppFramesOption.split(",")) { if (!inAppPackage.trim().equals("")) { inAppPackages.add(inAppPackage); } } return Collections.unmodifiableList(inAppPackages); }

Target:
protected Collection<String> getInAppFrames(Dsn dsn) { String inAppFramesOption = Lookup.lookup(IN_APP_FRAMES_OPTION, dsn); if (Util.isNullOrEmpty(inAppFramesOption)) { if (inAppFramesOption == null) { logger.warn("No '" + IN_APP_FRAMES_OPTION + "' was configured, this option is highly recommended " + "as it affects stacktrace grouping and display on Sentry. See documentation: " + "<LINK_0>"); } return Collections.emptyList(); } List<String> inAppPackages = new ArrayList<>(); for (String inAppPackage : inAppFramesOption.split(",")) { if (!inAppPackage.trim().equals("")) { inAppPackages.add(inAppPackage); } } return inAppPackages; }
Source:
public SearchResult loadInBackground() { loading = true; if (search == null) { search = runSearch(); } else { SearchResult newSearch = new SearchResult(search); newSearch.setUrl(search.getUrl()); newSearch.setViewstates(search.getViewstates()); search = GCParser.searchByNextPage(newSearch, Settings.isShowCaptcha(), this); } loading = false; return search; }

Target:
public SearchResult loadInBackground() { loading = true; if (search == null) { search = runSearch(); } else { search = GCParser.searchByNextPage(new SearchResult(search), Settings.isShowCaptcha(), this); } loading = false; return search; }
Source:
private Map<String, Object> mapIPv6(VmInitNetwork vmInitNetwork) { if (!vmInitNetwork.getIpv6BootProtocol().equals(Ipv6BootProtocol.NONE)) { Map<String, Object> networkIPv6 = new HashMap<>(); networkIPv6.put("id", vmInitNetwork.getName()); networkIPv6.put("link", vmInitNetwork.getName()); if (vmInitNetwork.getIpv6BootProtocol().equals(Ipv6BootProtocol.DHCP)) { networkIPv6.put("type", "dhcp6"); } else if (vmInitNetwork.getIpv6BootProtocol().equals(Ipv6BootProtocol.STATIC_IP)) { networkIPv6.put("type", "ipv6"); if (StringUtils.isNotEmpty(vmInitNetwork.getIpv6Address())) { networkIPv6.put("ip_address", vmInitNetwork.getIpv6Address()); } else { throw new IllegalArgumentException("IP address must be supplied for a static IP configuration"); } if (vmInitNetwork.getIpv6Prefix() != null) { networkIPv6.put("netmask", vmInitNetwork.getIpv6Prefix()); } if (StringUtils.isNotEmpty(vmInitNetwork.getIpv6Gateway())) { networkIPv6.put("gateway", vmInitNetwork.getIpv6Gateway()); } } return networkIPv6; } return null; }

Target:
private Map<String, Object> mapIPv6(VmInitNetwork vmInitNetwork) { if (vmInitNetwork.getIpv6BootProtocol() == Ipv6BootProtocol.NONE) { return null; } else if (vmInitNetwork.getIpv6BootProtocol() == Ipv6BootProtocol.AUTOCONF) { throw new IllegalArgumentException("'Stateless address autoconfiguration' is not supported for virtual machines"); } Map<String, Object> networkIPv6 = new HashMap<>(); networkIPv6.put("id", vmInitNetwork.getName()); networkIPv6.put("link", vmInitNetwork.getName()); if (vmInitNetwork.getIpv6BootProtocol() == Ipv6BootProtocol.DHCP) { networkIPv6.put("type", "dhcp6"); } else if (vmInitNetwork.getIpv6BootProtocol() == Ipv6BootProtocol.STATIC_IP) { networkIPv6.put("type", "ipv6"); if (StringUtils.isNotEmpty(vmInitNetwork.getIpv6Address())) { networkIPv6.put("ip_address", vmInitNetwork.getIpv6Address()); } else { throw new IllegalArgumentException("IP address must be supplied for a static IP configuration"); } if (vmInitNetwork.getIpv6Prefix() != null) { networkIPv6.put("netmask", vmInitNetwork.getIpv6Prefix()); } if (StringUtils.isNotEmpty(vmInitNetwork.getIpv6Gateway())) { networkIPv6.put("gateway", vmInitNetwork.getIpv6Gateway()); } } return networkIPv6; }
Source:
private OffsetDateTime getExpirationTime(String sharedAccessSignature) { String[] parts = sharedAccessSignature.split("&"); return Arrays.stream(parts) .map(part -> part.split("=")) .filter(pair -> pair.length == 2 && pair[0].equalsIgnoreCase("se")) .findFirst() .map(pair -> pair[1]) .map(expirationTimeStr -> { try { long epochSeconds = Long.parseLong(expirationTimeStr); return Instant.ofEpochSecond(epochSeconds).atOffset(ZoneOffset.UTC); } catch (NumberFormatException exception) { return OffsetDateTime.MAX; } }) .orElse(OffsetDateTime.MAX); }

Target:
private OffsetDateTime getExpirationTime(String sharedAccessSignature) { String[] parts = sharedAccessSignature.split("&"); return Arrays.stream(parts) .map(part -> part.split("=")) .filter(pair -> pair.length == 2 && pair[0].equalsIgnoreCase("se")) .findFirst() .map(pair -> pair[1]) .map(expirationTimeStr -> { try { long epochSeconds = Long.parseLong(expirationTimeStr); return Instant.ofEpochSecond(epochSeconds).atOffset(ZoneOffset.UTC); } catch (NumberFormatException exception) { logger.verbose("Invalid expiration time format in the SAS token: {}. Falling back to max " + "expiration time.", expirationTimeStr); return OffsetDateTime.MAX; } }) .orElse(OffsetDateTime.MAX); }
Source:
public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) { final Edge edge = this.addOutEdge(label, inVertex, keyValues); if (inVertex.equals(this)) { List<Edge> inE = inEdges.get(label); if (null == inE) { inE = new ArrayList<>(); this.inEdges.put(label, inE); } inE.add(edge); } return edge; }

Target:
public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) { final Edge edge = this.addOutEdge(label, inVertex, keyValues); if (inVertex.equals(this)) { if(null == this.inEdges) this.inEdges = new HashMap<>(); List<Edge> inE = this.inEdges.get(label); if (null == inE) { inE = new ArrayList<>(); this.inEdges.put(label, inE); } inE.add(edge); } return edge; }
Source:
public Optional<CloudResource> findByResourceReferenceAndStatusAndType(String resourceReference, CommonStatus status, ResourceType resourceType) { Optional<Resource> optionalResource = resourceService.findByResourceReferenceAndStatusAndType(resourceReference, status, resourceType); LOGGER.debug("Resource retrieved by optionalResource reference: {}, status: and type: {}. Is present: {}", resourceReference, status, resourceType, optionalResource.isPresent()); return optionalResource .map(resource -> conversionService.convert(resource, CloudResource.class)); }

Target:
public Optional<CloudResource> findByResourceReferenceAndStatusAndType(String resourceReference, CommonStatus status, ResourceType resourceType) { Optional<Resource> optionalResource = resourceService.findByResourceReferenceAndStatusAndType(resourceReference, status, resourceType); LOGGER.debug("Resource retrieved by optionalResource reference: {}, status: and type: {}. Is present: {}", resourceReference, status, resourceType, optionalResource.isPresent()); return optionalResource .map(resource -> cloudResourceConverter.convert(resource)); }
Source:
protected void executeCommand() { try { glusterSyncJob.refreshSelfHealData(cluster); } catch (Exception e) { log.error("Error while refreshing Gluster self heal data of cluster '{}': {}", cluster.getName(), e.getMessage()); log.debug("Exception", e); setSucceeded(false); } setSucceeded(true); }

Target:
protected void executeCommand() { try { glusterSyncJob.refreshSelfHealData(cluster); } catch (Exception e) { addCustomValue("ClusterName", cluster.getName()); auditLog(this, AuditLogType.GLUSTER_VOLUME_HEAL_REFRESH_FAILED); setSucceeded(false); } setSucceeded(true); }
Source:
public List<String> getRequiredAttributeNames() { List<String> requiredAttributeList = new ArrayList<>(); String requiredAttributes = this.configs .getProperty(SalesforceConnectorConstants.PropertyConfig.REQUIRED_FIELDS); if (requiredAttributes != null && !StringUtils.isBlank(requiredAttributes)) { requiredAttributeList = Arrays.asList(requiredAttributes .split(IdentityProvisioningConstants.PropertyConfig.DELIMATOR)); } return requiredAttributeList; }

Target:
public List<String> getRequiredAttributeNames() { List<String> requiredAttributeList = new ArrayList<>(); String requiredAttributes = this.configs .getProperty(SalesforceConnectorConstants.PropertyConfig.REQUIRED_FIELDS); if (StringUtils.isNotBlank(requiredAttributes)) { requiredAttributeList = Arrays.asList(requiredAttributes .split(IdentityProvisioningConstants.PropertyConfig.DELIMATOR)); } return requiredAttributeList; }
Source:
public ClosableIterator<List<CandidateCellForSweeping>> getCandidateCellsForSweeping( TableReference tableRef, CandidateCellForSweepingRequest request) { return new GetCandidateCellsForSweepingIterator(this, new CqlExecutor(clientPool, ConsistencyLevel.ALL), tableRef, request); }

Target:
public ClosableIterator<List<CandidateCellForSweeping>> getCandidateCellsForSweeping( TableReference tableRef, CandidateCellForSweepingRequest request) { return getCandidateRowsForSweeping(tableRef, request) .map(rows -> rows.stream() .map(CandidateRowForSweeping::cells) .flatMap(List::stream) .collect(Collectors.toList())); }
Source:
public void onWireReceive(final WireEnvelope wireEnvelope) { requireNonNull(wireEnvelope, message.wireEnvelopeNonNull()); logger.debug(message.wireEnvelopeReceived(), this.wireSupport); if (hasReadChannels()) { try { emitChannelRecords(readAllChannels()); } catch (final KuraException e) { logger.error(message.errorPerformingRead(), e); } } final List<WireRecord> records = wireEnvelope.getRecords(); for (WireRecord wireRecord : records) { final List<ChannelRecord> assetRecordsToWriteChannels = determineWritingChannels(wireRecord); writeChannels(assetRecordsToWriteChannels); } }

Target:
public void onWireReceive(final WireEnvelope wireEnvelope) { requireNonNull(wireEnvelope, message.wireEnvelopeNonNull()); logger.debug(message.wireEnvelopeReceived(), this.wireSupport); if (hasReadChannels()) { try { emitChannelRecords(readAllChannels()); } catch (final KuraException e) { logger.error(message.errorPerformingRead(), e); } } final List<WireRecord> records = wireEnvelope.getRecords(); for (WireRecord wireRecord : records) { final List<ChannelRecord> channelRecordsToWrite = determineWritingChannels(wireRecord); writeChannels(channelRecordsToWrite); } }
Source:
private URL[] readPluginPath(InputStream input) { Properties ini = new Properties(); try { ini.load(input); } catch (IOException e) { return null; } List<URL>result = new ArrayList<>(5); String group; String entry; for (Enumeration<?> groups = ini.propertyNames(); groups.hasMoreElements();) { group = (String) groups.nextElement(); for (StringTokenizer entries = new StringTokenizer(ini.getProperty(group), ";"); entries.hasMoreElements();) { entry = (String) entries.nextElement(); if (!entry.equals("")) try { result.add(new URL(entry)); } catch (MalformedURLException e) { System.err.println("Ignoring plugin: " + entry); } } } return result.toArray(new URL[result.size()]); }

Target:
private URL[] readPluginPath(InputStream input) { Properties ini = new Properties(); try { ini.load(input); } catch (IOException e) { return null; } List<URL>result = new ArrayList<>(5); for (Enumeration<?> groups = ini.propertyNames(); groups.hasMoreElements();) { String group = (String) groups.nextElement(); for (StringTokenizer entries = new StringTokenizer(ini.getProperty(group), ";"); entries.hasMoreElements();) { String entry = (String) entries.nextElement(); if (!entry.equals("")) try { result.add(new URL(entry)); } catch (MalformedURLException e) { System.err.println("Ignoring plugin: " + entry); } } } return result.toArray(new URL[result.size()]); }
Source:
protected void internalReceiveCommand(String itemName, Command command) { IntertechnoBindingConfig config = null; for (CULIntertechnoBindingProvider provider : providers) { config = provider.getConfigForItemName(itemName); if (config != null) { break; } } if (config != null && culHandlerLifecycle.isCulReady() && command instanceof OnOffType) { OnOffType type = (OnOffType) command; String commandValue = null; switch (type) { case ON: commandValue = config.getCommandON(); break; case OFF: commandValue = config.getCommandOFF(); break; } if (commandValue != null) { try { culHandlerLifecycle.getCul().send("is" + commandValue); } catch (CULCommunicationException e) { logger.error("Can't write to CUL", e); } } else { logger.error("Can't determine value to send for command {}", command); } } }

Target:
protected void internalReceiveCommand(String itemName, Command command) { IntertechnoBindingConfig config = null; for (CULIntertechnoBindingProvider provider : providers) { config = provider.getConfigForItemName(itemName); if (config != null) { break; } } if (config != null && culHandlerLifecycle.isCulReady() && command instanceof OnOffType) { OnOffType type = (OnOffType) command; String commandValue = null; switch (type) { case ON: commandValue = config.getCommandON(); break; case OFF: commandValue = config.getCommandOFF(); break; } if (commandValue != null) { try { culHandlerLifecycle.getCul().send("is" + commandValue); } catch (CULCommunicationException e) { logger.error("Can't write to CUL", e); } } else { logger.warn("Can't determine value to send for command {}", command); } } }
Source:
public static String getTopologyId(String name, Nimbus.Iface client) { try { TopologySummary topologySummary = client.getTopologySummaryByName(name); if (topologySummary != null) { return topologySummary.get_id(); } } catch (Exception e) { throw new RuntimeException(e); } return null; }

Target:
public static String getTopologyId(String name, Nimbus.Iface client) { try { TopologySummary topologySummary = client.getTopologySummaryByName(name); if (topologySummary != null) { return topologySummary.get_id(); } } catch (NotAliveException notAliveException) { return null; } catch (Exception e) { throw new RuntimeException(e); } return null; }
Source:
public static boolean moveToTrash(URI uri) { Preconditions.checkArgument( URIBuilder.DATASET_SCHEME.equals(uri.getScheme()), "Not a dataset URI: " + uri); Pair<DatasetRepository, Map<String, String>> pair = Registration.lookupDatasetUri(URI.create(uri.getRawSchemeSpecificPart())); DatasetRepository repo = pair.first(); Map<String, String> uriOptions = pair.second(); return repo.moveToTrash( uriOptions.get(URIBuilder.NAMESPACE_OPTION), uriOptions.get(URIBuilder.DATASET_NAME_OPTION)); }

Target:
public static boolean moveToTrash(URI uri) { return deleteWithTrash(uri, true); }
Source:
public void testConfigureCustomCollection() throws Exception { String collectioName = "TestMetaStore"; MongoDbFactory mongoDbFactory = this.prepareMongoFactory(collectioName); MongoTemplate template = new MongoTemplate(mongoDbFactory); store = new MongoDbMetadataStore(template,collectioName); testBasics(); }

Target:
public void testConfigureCustomCollection() throws Exception { final String collectionName = "testMetadataStore"; final MongoDbFactory mongoDbFactory = this.prepareMongoFactory(collectionName); final MongoTemplate template = new MongoTemplate(mongoDbFactory); store = new MongoDbMetadataStore(template, collectionName); testBasics(); }
Source:
protected boolean isFiltered() { List<String> filterVar = getHttpHeaders().getRequestHeader(USER_FILTER_FIELD); boolean filter = false; if (filterVar != null && filterVar.size() > 0) filter = Boolean.valueOf(filterVar.iterator().next()); return filter; }

Target:
protected boolean isFiltered() { if (filtered == null) { List<String> filterVar = getHttpHeaders().getRequestHeader(USER_FILTER_FIELD); if (filterVar != null && filterVar.size() > 0) filtered = Boolean.valueOf(filterVar.iterator().next()); else filtered = false; } return filtered; }
Source:
public static boolean isValidCacheEntry(CachableResponse cachedResponse, MessageContext synCtx) { Map<String, Object> httpHeaders = cachedResponse.getHeaderProperties(); org.apache.axis2.context.MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext(); String eTagValue = null; boolean isNoCache = false; long maxAge = -1; if (httpHeaders != null) { eTagValue = getETagValue(httpHeaders); if (httpHeaders.get(HttpHeaders.CACHE_CONTROL) != null) { String cacheControlHeaderValue = String.valueOf(httpHeaders.get(HttpHeaders.CACHE_CONTROL)); List<String> cacheControlHeaders = Arrays.asList(cacheControlHeaderValue.split("\\s*,\\s*")); for (String cacheControlHeader : cacheControlHeaders) { if (cacheControlHeader.equalsIgnoreCase(CachingConstants.NO_CACHE_STRING)) { isNoCache = true; } if (cacheControlHeader.contains(CachingConstants.MAX_AGE_STRING)) { maxAge = Long.parseLong(cacheControlHeader.split("=")[1]); } } } } return isCachedResponseExpired(cachedResponse, maxAge) || isValidateResponseWithETag(msgCtx, eTagValue, isNoCache); }

Target:
public static boolean isValidCacheEntry(CachableResponse cachedResponse, MessageContext synCtx) { Map<String, Object> httpHeaders = cachedResponse.getHeaderProperties(); org.apache.axis2.context.MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext(); String eTagValue = null; boolean isNoCache = false; long maxAge = -1; if (httpHeaders != null) { eTagValue = getETagValue(httpHeaders); if (httpHeaders.get(HttpHeaders.CACHE_CONTROL) != null) { String cacheControlHeaderValue = String.valueOf(httpHeaders.get(HttpHeaders.CACHE_CONTROL)); List<String> cacheControlHeaders = Arrays.asList(cacheControlHeaderValue.split("\\s*,\\s*")); for (String cacheControlHeader : cacheControlHeaders) { if (CachingConstants.NO_CACHE_STRING.equalsIgnoreCase(cacheControlHeader)) { isNoCache = true; } if (cacheControlHeader.contains(CachingConstants.MAX_AGE_STRING)) { maxAge = Long.parseLong(cacheControlHeader.split("=")[1]); } } } } return isCachedResponseExpired(cachedResponse, maxAge) || isValidateResponseWithETag(msgCtx, eTagValue, isNoCache); }
Source:
public NetworkAttachment mapNetworkAttachment(Map<Guid, NetworkAttachment> attachmentsById, org.ovirt.engine.api.model.NetworkAttachment model) { Mapper<org.ovirt.engine.api.model.NetworkAttachment, NetworkAttachment> networkAttachmentMapper = getMapper(org.ovirt.engine.api.model.NetworkAttachment.class, NetworkAttachment.class); NetworkAttachment attachment = networkAttachmentMapper.map(model, null); if (model.isSetId()) { Guid attachmentId = asGuid(model.getId()); attachment = networkAttachmentMapper.map(model, attachmentsById.get(attachmentId)); } else if (model.isSetNetwork() && (model.getNetwork().isSetName() || model.getNetwork().isSetId())) { for (Map.Entry<Guid, NetworkAttachment> backendNetworkAttachmentMapEntry : attachmentsById.entrySet()) { NetworkAttachment backendNetworkAttachment = backendNetworkAttachmentMapEntry.getValue(); String backendNetworkName = backendNetworkAttachment.getNetworkName(); String backendNetworkId = backendNetworkAttachment.getNetworkId().toString(); if (backendNetworkName.equals(model.getNetwork().getName()) || backendNetworkId.equals(model.getNetwork().getId())) { attachment = networkAttachmentMapper.map(model, backendNetworkAttachment); } } } return attachment; }

Target:
public NetworkAttachment mapNetworkAttachment(Map<Guid, NetworkAttachment> attachmentsById, org.ovirt.engine.api.model.NetworkAttachment model) { Mapper<org.ovirt.engine.api.model.NetworkAttachment, NetworkAttachment> networkAttachmentMapper = getMapper(org.ovirt.engine.api.model.NetworkAttachment.class, NetworkAttachment.class); Guid attachmentId = null; if (model.isSetId()) { attachmentId = asGuid(model.getId()); } else if (model.isSetNetwork() && (model.getNetwork().isSetName() || model.getNetwork().isSetId())) { for (Map.Entry<Guid, NetworkAttachment> backendNetworkAttachmentMapEntry : attachmentsById.entrySet()) { NetworkAttachment backendNetworkAttachment = backendNetworkAttachmentMapEntry.getValue(); String backendNetworkName = backendNetworkAttachment.getNetworkName(); String backendNetworkId = backendNetworkAttachment.getNetworkId().toString(); if (backendNetworkName.equals(model.getNetwork().getName()) || backendNetworkId.equals(model.getNetwork().getId())) { attachmentId = backendNetworkAttachment.getId(); break; } } } return networkAttachmentMapper.map(model, attachmentsById.get(attachmentId)); }
Source:
public static Map<String, AutoScaler> mapAutoscalerByCategory(List<AutoScaler> autoScalers) { Map<String, AutoScaler> result = autoScalers.stream().collect(Collectors.groupingBy( ProvisioningUtil::getAutoscalerCategory, Collectors.collectingAndThen(Collectors.toList(), values -> values.get(0)) )); if (result.size() != autoScalers.size()) { log.warn( "Probably autoscalers with duplicated categories were defined. The first instance of each duplicate category will be used."); } return result; }

Target:
public static Map<String, AutoScaler> mapAutoscalerByCategory(List<AutoScaler> autoScalers) { return autoScalers.stream().collect(Collectors.groupingBy( ProvisioningUtil::getAutoscalerCategory, Collectors.collectingAndThen(Collectors.toList(), values -> values.get(0)) )); }