auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private SnomedNamespaceAndModuleAssignerProvider() { Builder<String, SnomedNamespaceAndModuleAssigner> mapBuilder = ImmutableMap.builder(); Extensions.getExtensions(NAMESPACE_ASSIGNER_EXTENSION, SnomedNamespaceAndModuleAssigner.class) .forEach(assigner -> mapBuilder.put(assigner.getConfigurationKey(), assigner)); assigners = mapBuilder.build(); }

Target:
private SnomedNamespaceAndModuleAssignerProvider() { Extensions.getExtensions(NAMESPACE_ASSIGNER_EXTENSION, SnomedNamespaceAndModuleAssigner.class) .forEach(assigner -> { if (assigners.containsKey(assigner.getName())) { LOG.warn(String.format("A namespace/module assigner with the name '%s' is already registered.", assigner.getName())); } else { assigners.put(assigner.getName(), assigner); } }); }
Source:
public static String normalizeBranchName(String name) { if (name == null || name.isEmpty()) { return name; } String result = name.trim(); String fullName = result.startsWith(Constants.R_HEADS) ? result : Constants.R_HEADS + result; if (isValidRefName(fullName)) { return result; } result = result.replaceAll("(?:\\h|\\v)+", "_"); StringBuilder b = new StringBuilder(); char p = '/'; for (int i = 0, len = result.length(); i < len; i++) { char c = result.charAt(i); if (c < ' ' || c == 127) { continue; } switch (c) { case '\\': case '^': case '~': case ':': case '?': case '*': case '[': case '@': case '<': case '>': case '|': case '"': c = '-'; break; default: break; } switch (c) { case '/': if (p == '/') { continue; } p = '/'; break; case '.': case '_': case '-': if (p == '/' || p == '-') { continue; } p = '-'; break; default: p = c; break; } b.append(c); } result = b.toString().replaceFirst("[/_.-]+$", "") .replaceAll("\\.lock($|/)", "_lock$1"); return FORBIDDEN_BRANCH_NAME_COMPONENTS.matcher(result) .replaceAll("$1+$2$3"); }

Target:
public static String normalizeBranchName(String name) { if (name == null || name.isEmpty()) { return ""; } String result = name.trim(); String fullName = result.startsWith(Constants.R_HEADS) ? result : Constants.R_HEADS + result; if (isValidRefName(fullName)) { return result; } result = result.replaceAll("(?:\\h|\\v)+", "_"); StringBuilder b = new StringBuilder(); char p = '/'; for (int i = 0, len = result.length(); i < len; i++) { char c = result.charAt(i); if (c < ' ' || c == 127) { continue; } switch (c) { case '\\': case '^': case '~': case ':': case '?': case '*': case '[': case '@': case '<': case '>': case '|': case '"': c = '-'; break; default: break; } switch (c) { case '/': if (p == '/') { continue; } p = '/'; break; case '.': case '_': case '-': if (p == '/' || p == '-') { continue; } p = '-'; break; default: p = c; break; } b.append(c); } result = b.toString().replaceFirst("[/_.-]+$", "") .replaceAll("\\.lock($|/)", "_lock$1"); return FORBIDDEN_BRANCH_NAME_COMPONENTS.matcher(result) .replaceAll("$1+$2$3"); }
Source:
private UriBuilder buildUri(long offset) { UriBuilder builder = UriBuilder.fromUri(baseUrl) .queryParam(offsetParameter, startIndex + offset) .queryParam(limitParameter, limit); for (String curKey : parameters.keySet()) { Object[] value = parameters.get(curKey); if (value != null && value.length > 0) { builder.queryParam(curKey, value); } } return builder; }

Target:
private String buildUri(long offset) { UriBuilder builder = UriBuilder.fromUri(baseUrl) .queryParam(offsetParameter, startIndex + offset) .queryParam(limitParameter, limit); for (String curKey : parameters.keySet()) { Object[] value = parameters.get(curKey); if (value != null && value.length > 0) { builder.queryParam(curKey, value); } } return builder.toString(); }
Source:
public void disposeComponent() { executorService.shutdown(); }

Target:
public void disposeComponent() { List<Runnable> rejected = executorService.shutdownNow(); if (!rejected.isEmpty()) { LOGGER.debug("rejected " + rejected.size() + " pending tasks"); } }
Source:
private static String getAbbreviation(String name, String token) { StringBuilder abbrev = new StringBuilder(); if (name != null) { for (String t : name.split(token)) { abbrev.append(t.substring(0, 1).toUpperCase()); } } return abbrev.toString(); }

Target:
private static String getAbbreviation(String name, String token) { StringBuilder abbrev = new StringBuilder(); if (name != null) { List<String> nameList = new ArrayList<String>(); for (String t : name.split(token)) { nameList.add(t); } RegExp re = RegExp.compile("[A-Za-z]+"); if (!re.test(nameList.get(0))) { abbrev.append(nameList.get(0).toUpperCase()); if (nameList.size() > 1) { abbrev.append(" ("+ nameList.get(nameList.size()-1).substring(0, 1).toUpperCase()+ ")"); } } else { for (String t : nameList) { abbrev.append(t.substring(0, 1).toUpperCase()); } } } return abbrev.toString(); }
Source:
public ZkRoutingDataWriter(String namespace, String zkAddress) { if (namespace == null || namespace.isEmpty()) { throw new IllegalArgumentException("namespace cannot be null or empty!"); } _namespace = namespace; if (zkAddress == null || zkAddress.isEmpty()) { throw new IllegalArgumentException("Zk address cannot be null or empty!"); } _zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), new HelixZkClient.ZkClientConfig().setZkSerializer(new ZNRecordSerializer())); try { _zkClient.createPersistent(MetadataStoreRoutingConstants.ROUTING_DATA_PATH, true); } catch (ZkNodeExistsException e) { } ZNRecord myServerInfo = new ZNRecord( System.getProperty(MetadataStoreRoutingConstants.HOSTNAME_SYSTEM_PROPERTY_KEY)); _leaderElection = new ZkDistributedLeaderElection(_zkClient, MetadataStoreRoutingConstants.LEADER_ELECTION_ZNODE, myServerInfo); _forwardHttpClient = HttpClients.createDefault(); }

Target:
public ZkRoutingDataWriter(String namespace, String zkAddress) { if (namespace == null || namespace.isEmpty()) { throw new IllegalArgumentException("namespace cannot be null or empty!"); } _namespace = namespace; if (zkAddress == null || zkAddress.isEmpty()) { throw new IllegalArgumentException("Zk address cannot be null or empty!"); } _zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), new HelixZkClient.ZkClientConfig().setZkSerializer(new ZNRecordSerializer())); try { _zkClient.createPersistent(MetadataStoreRoutingConstants.ROUTING_DATA_PATH, true); } catch (ZkNodeExistsException e) { } String hostName = System.getProperty(MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY); if (hostName == null || hostName.isEmpty()) { throw new IllegalStateException( "Unable to get the hostname of this server instance. System.getProperty fails to fetch " + MetadataStoreRoutingConstants.MSDS_SERVER_HOSTNAME_KEY + "."); } if (hostName.charAt(hostName.length() - 1) == '/') { hostName = hostName.substring(0, hostName.length() - 1); } _myHostName = hostName; ZNRecord myServerInfo = new ZNRecord(_myHostName); _leaderElection = new ZkDistributedLeaderElection(_zkClient, MetadataStoreRoutingConstants.LEADER_ELECTION_ZNODE, myServerInfo); RequestConfig config = RequestConfig.custom().setConnectTimeout(HTTP_REQUEST_FORWARDING_TIMEOUT) .setConnectionRequestTimeout(HTTP_REQUEST_FORWARDING_TIMEOUT) .setSocketTimeout(HTTP_REQUEST_FORWARDING_TIMEOUT).build(); _forwardHttpClient = HttpClientBuilder.create().setDefaultRequestConfig(config).build(); }
Source:
public void whenPOSTEventTypeWithAuthorizationThenOk() throws JsonProcessingException { final EventType eventType = buildDefaultEventType(); eventType.setAuthorization(new EventTypeAuthorization( ImmutableList.of(new EventTypeAuthorizationAttribute("type1", "value1")), ImmutableList.of(new EventTypeAuthorizationAttribute("type2", "value2")), ImmutableList.of(new EventTypeAuthorizationAttribute("type3", "value3")))); final String body = MAPPER.writer().writeValueAsString(eventType); System.out.println(body); given().body(body) .header("accept", "application/json") .contentType(JSON) .when() .post(ENDPOINT) .then() .statusCode(HttpStatus.SC_CREATED); when().get(String.format("%s/%s", ENDPOINT, eventType.getName())) .then() .body("authorization.admins[0].data_type", equalTo("type1")) .body("authorization.admins[0].value", equalTo("value1")) .body("authorization.readers[0].data_type", equalTo("type2")) .body("authorization.readers[0].value", equalTo("value2")) .body("authorization.writers[0].data_type", equalTo("type3")) .body("authorization.writers[0].value", equalTo("value3")); }

Target:
public void whenPOSTEventTypeWithAuthorizationThenOk() throws JsonProcessingException { final EventType eventType = buildDefaultEventType(); eventType.setAuthorization(new EventTypeAuthorization( ImmutableList.of(new EventTypeAuthorizationAttribute("type1", "value1")), ImmutableList.of(new EventTypeAuthorizationAttribute("type2", "value2")), ImmutableList.of(new EventTypeAuthorizationAttribute("type3", "value3")))); final String body = MAPPER.writer().writeValueAsString(eventType); given().body(body) .header("accept", "application/json") .contentType(JSON) .when() .post(ENDPOINT) .then() .statusCode(HttpStatus.SC_CREATED); when().get(String.format("%s/%s", ENDPOINT, eventType.getName())) .then() .body("authorization.admins[0].data_type", equalTo("type1")) .body("authorization.admins[0].value", equalTo("value1")) .body("authorization.readers[0].data_type", equalTo("type2")) .body("authorization.readers[0].value", equalTo("value2")) .body("authorization.writers[0].data_type", equalTo("type3")) .body("authorization.writers[0].value", equalTo("value3")); }
Source:
public Map<ContingencyState, Long> getContingencyStateCounts(final GenotypeConcordanceScheme scheme) { scheme.validateScheme(); final Map<ContingencyState, Long> counts = new HashMap<ContingencyState, Long>(); for (final ContingencyState contingencyState : ContingencyState.values()) { counts.put(contingencyState, (long)0); } for (final TruthState truthState : TruthState.values()) { for (final CallState callState : CallState.values()) { final TruthAndCallStates truthAndCallStates = new TruthAndCallStates(truthState, callState); final ContingencyState[] contingencyStateArray = scheme.getConcordanceStateArray(truthAndCallStates); for (final ContingencyState contingencyState : contingencyStateArray) { final long newCount = counts.get(contingencyState) + getCount(truthAndCallStates); counts.put(contingencyState, newCount); } } } return counts; }

Target:
public Map<ContingencyState, Long> getContingencyStateCounts(final GenotypeConcordanceScheme scheme) { scheme.validateScheme(); final Map<ContingencyState, Long> counts = new HashMap<ContingencyState, Long>(); for (final ContingencyState contingencyState : ContingencyState.values()) { counts.put(contingencyState, 0L); } for (final TruthState truthState : TruthState.values()) { for (final CallState callState : CallState.values()) { final TruthAndCallStates truthAndCallStates = new TruthAndCallStates(truthState, callState); final ContingencyState[] contingencyStateArray = scheme.getConcordanceStateArray(truthAndCallStates); for (final ContingencyState contingencyState : contingencyStateArray) { final long newCount = counts.get(contingencyState) + getCount(truthAndCallStates); counts.put(contingencyState, newCount); } } } return counts; }
Source:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } TargetCard target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURE, controller.getId()); controller.choose(outcome, controller.getHand(), target, game); int counters = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null || counters < 1) { return true; } return permanent.addCounters(CounterType.P1P1.createInstance(counters), source, game); }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } TargetCard target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_CREATURE, controller.getId()); controller.choose(outcome, controller.getHand(), target, game); int counters = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null || counters < 1) { return true; } permanent.addCounters(CounterType.P1P1.createInstance(counters), source, game); return true; }
Source:
protected void setDimension(String dimension, String value) { synchronized (lock) { String oldValue = singleValueDims.put(dimension, value); if (oldValue != null && !oldValue.equals(value)) { handleIllegalModification(singleValueDims.getOrDefault(DruidMetrics.ID, ""), dimension); } } }

Target:
protected void setDimension(String dimension, String value) { synchronized (lock) { singleValueDims.compute(dimension, (key, oldValue) -> { if (oldValue != null && !oldValue.equals(value)) { throw new ISE("Changing dimension values in QueryMetrics is not allowed: %s", dimension); } return oldValue; }); } }
Source:
public void create_ProjectEndpointNoScheme() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage( "Project endpoint \"prom-qa/datastore/v1beta42/projects/project-id\" must" + " include scheme."); factory.create(new DatastoreOptions.Builder() .projectEndpoint("prom-qa/datastore/v1beta42/projects/project-id") .build()); }

Target:
public void create_ProjectEndpointNoScheme() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage( "Project endpoint \"localhost:1234/datastore/v1beta42/projects/project-id\" must" + " include scheme."); factory.create(new DatastoreOptions.Builder() .projectEndpoint("localhost:1234/datastore/v1beta42/projects/project-id") .build()); }
Source:
public final synchronized void publish(Transcript transcript) { if (published) { return; } else { published = true; } if (this.recorder != null) { this.recorder.stop(); } innerPublish(transcript); maybeExecuteBashScripts(); }

Target:
public final synchronized void publish(Transcript transcript) { if (published) { return; } else { published = true; } if (this.recorder != null) { this.recorder.stop(); } doPublish(transcript); maybeExecuteBashScripts(); }
Source:
public void returnExistingTelephonePayment() { requestBody.put("card_expiry", "01/08"); createTelephonePaymentRequest .withCardExpiry("01/08"); connectorMockClient.respondOk_whenCreateTelephoneCharge(GATEWAY_ACCOUNT_ID, createTelephonePaymentRequest .build()); postPaymentResponse(toJson(requestBody)) .statusCode(200) .contentType(JSON) .body("amount", is(100)) .body("reference", is("Some reference")) .body("description", is("Some description")) .body("processor_id", is("1PROC")) .body("payment_outcome.status", is("success")) .body("card_type", is("visa")) .body("card_expiry", is("01/08")) .body("last_four_digits", is("1234")) .body("first_six_digits", is("123456")) .body("payment_id", is("dummypaymentid123notpersisted")) .body("state.status", is("success")) .body("state.finished", is(true)); }

Target:
public void returnExistingTelephonePayment() { connectorMockClient.respondOk_whenCreateTelephoneCharge(GATEWAY_ACCOUNT_ID, createTelephonePaymentRequest .build()); postPaymentResponse(toJson(requestBody)) .statusCode(200) .contentType(JSON) .body("amount", is(100)) .body("reference", is("Some reference")) .body("description", is("Some description")) .body("processor_id", is("1PROC")) .body("payment_outcome.status", is("success")) .body("card_type", is("visa")) .body("card_expiry", is(nullValue())) .body("last_four_digits", is("1234")) .body("first_six_digits", is("123456")) .body("payment_id", is("dummypaymentid123notpersisted")) .body("state.status", is("success")) .body("state.finished", is(true)); }
Source:
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 foundNonWriteableMetacard = input .getUpdates() .stream() .map(Map.Entry::getValue) .filter(Objects::nonNull) .filter( mc -> !subjectIsAccessAdmin.test(mc) && !subjectIsOwner.test(mc) && !subjectHasWritePerms.test(mc)) .findFirst() .isPresent(); if (foundNonWriteableMetacard) { throw new StopProcessingException( "Cannot update metacard(s). Subject cannot change access control permissions because they are not in set of users with writeable permissions."); } 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:
public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItem item) { return (tryActivateAndGet(e, item) != null); }

Target:
public static boolean tryActivate(@Nonnull Event e, @Nonnull SlimefunItem item) { return tryActivateAndGet(e, item) != null; }
Source:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final String PREFS_NAME = getString(R.string.openmrs_pref_filename); SharedPreferences settings2 = getActivity().getSharedPreferences(PREFS_NAME, 0); if (settings2.getBoolean("my_first_time", true)) { showOverlayTutorialOne(); settings2.edit().putBoolean("my_first_time", false).apply(); } }

Target:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final String PREFS_NAME = ApplicationConstants.OPENMRS_PREF_FILE; SharedPreferences settings2 = getActivity().getSharedPreferences(ApplicationConstants.OPENMRS_PREF_FILE, 0); if (settings2.getBoolean("my_first_time", true)) { showOverlayTutorial(R.id.findPatientView, getString(R.string.dashboard_search_icon_label), getString(R.string.showcase_find_patients), R.style.CustomShowcaseTheme, ApplicationConstants.ShowCaseViewConstants.SHOW_FIND_PATIENT, true); settings2.edit().putBoolean("my_first_time", false).apply(); } }
Source:
Optional<CacheFileCopy> findAndCopyCacheFile(String cacheFileName, String cachePath) throws TskCoreException, IngestModuleException { Optional<AbstractFile> cacheFileOptional = findCacheFile(cacheFileName, cachePath); if (!cacheFileOptional.isPresent()) { return Optional.empty(); } AbstractFile cacheFile = cacheFileOptional.get(); String tempFilePathname = RAImageIngestModule.getRATempPath(currentCase, moduleName) + cachePath + cacheFile.getName(); try { File newFile = new File(tempFilePathname); ContentUtils.writeToFile(cacheFile, newFile, context::dataSourceIngestIsCancelled); RandomAccessFile randomAccessFile = new RandomAccessFile(tempFilePathname, "r"); FileChannel roChannel = randomAccessFile.getChannel(); ByteBuffer cacheFileROBuf = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, (int) roChannel.size()); cacheFileROBuf.order(ByteOrder.nativeOrder()); CacheFileCopy cacheFileCopy = new CacheFileCopy(cacheFile, randomAccessFile, cacheFileROBuf ); if (!cacheFileName.startsWith("f_")) { filesTable.put(cachePath + cacheFileName, cacheFileCopy); } return Optional.of(cacheFileCopy); } catch (ReadContentInputStream.ReadContentInputStreamException ex) { String msg = String.format("Error reading Chrome cache file '%s' (id=%d).", cacheFile.getName(), cacheFile.getId()); throw new IngestModuleException(msg, ex); } catch (IOException ex) { String msg = String.format("Error writing temp Chrome cache file '%s' (id=%d).", cacheFile.getName(), cacheFile.getId()); throw new IngestModuleException(msg, ex); } }

Target:
Optional<CacheFileCopy> findAndCopyCacheFile(String cacheFileName, String cachePath) throws TskCoreException, IngestModuleException { Optional<AbstractFile> cacheFileOptional = findCacheFile(cacheFileName, cachePath); if (!cacheFileOptional.isPresent()) { return Optional.empty(); } AbstractFile cacheFile = cacheFileOptional.get(); RandomAccessFile randomAccessFile = null; String tempFilePathname = RAImageIngestModule.getRATempPath(currentCase, moduleName) + cachePath + cacheFile.getName(); try { File newFile = new File(tempFilePathname); ContentUtils.writeToFile(cacheFile, newFile, context::dataSourceIngestIsCancelled); randomAccessFile = new RandomAccessFile(tempFilePathname, "r"); FileChannel roChannel = randomAccessFile.getChannel(); ByteBuffer cacheFileROBuf = roChannel.map(FileChannel.MapMode.READ_ONLY, 0, (int) roChannel.size()); cacheFileROBuf.order(ByteOrder.nativeOrder()); CacheFileCopy cacheFileCopy = new CacheFileCopy(cacheFile, randomAccessFile, cacheFileROBuf ); if (!cacheFileName.startsWith("f_")) { filesTable.put(cachePath + cacheFileName, cacheFileCopy); } return Optional.of(cacheFileCopy); } catch (IOException ex) { try { if (randomAccessFile != null) { randomAccessFile.close(); } } catch (IOException ex2) { logger.log(Level.SEVERE, "Error while trying to close temp file after exception.", ex2); } String msg = String.format("Error reading/copying Chrome cache file '%s' (id=%d).", cacheFile.getName(), cacheFile.getId()); throw new IngestModuleException(msg, ex); } }
Source:
private boolean belongToSameGroup(ITestResult result) { ITestNGMethod m = result.getMethod(); if (!m.isBeforeGroupsConfiguration()) { return false; } String[] mygroups = this.m_method.getGroups(); if (mygroups.length == 0) { return false; } List<String> cfgMethodGroups = Arrays.asList(result.getMethod().getGroups()); if (cfgMethodGroups.isEmpty()) { return false; } for (String each : mygroups) { if (cfgMethodGroups.contains(each)) { return true; } } return false; }

Target:
private boolean belongToSameGroup(ITestResult result) { ITestNGMethod m = result.getMethod(); if (!m.isBeforeGroupsConfiguration()) { return false; } String[] mygroups = this.m_method.getGroups(); if (mygroups.length == 0 || m.getGroups().length ==0) { return false; } List<String> cfgMethodGroups = Arrays.asList(m.getGroups()); return Arrays.stream(mygroups).anyMatch(cfgMethodGroups::contains); }
Source:
private void updateDigest(PipelineTemplate pipelineTemplate) { String digestId = String.format("%s@sha256%s", pipelineTemplate.getId(), computeSHA256Digest(pipelineTemplate)); getPipelineTemplateDAO().update(digestId, pipelineTemplate); }

Target:
private void updateDigest(PipelineTemplate pipelineTemplate) { String digestId = String.format("%s@sha256:%s", pipelineTemplate.getId(), computeSHA256Digest(pipelineTemplate)); getPipelineTemplateDAO().update(digestId, pipelineTemplate); }
Source:
private static String getCustomErrorMsg(final String errorType) { StringBuilder errorBuilder = new StringBuilder(); errorBuilder.append(SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT); errorBuilder.append(" "); errorBuilder.append(SamlConstants.URN_OASIS_NAMES); errorBuilder.append(" and "); errorBuilder.append(errorType); errorBuilder.append(" "); errorBuilder.append(IS_PRESENT); return errorBuilder.toString(); }

Target:
private static String getCustomErrorMsg(final String errorType) { return new StringBuilder(SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT).append("").append(" ") .append(SamlConstants.URN_OASIS_NAMES).append(" and ").append(errorType).append(" ").append(IS_PRESENT) .toString(); }
Source:
public CenterCrop(Context context) { super(context, 0.5f, 0.5f); }

Target:
public CenterCrop(Context context) { super(context, PositionedCrop.CENTER, PositionedCrop.CENTER); }
Source:
public void preCommit() { if (!deletionPlan.isRejected() && !deletionPlan.isEmpty()) { final Set<String> deletedIds = deletionPlan.getDeletedItems() .stream() .filter(FSMUtil::isTransient) .filter(obj -> !(obj instanceof SnomedRefSetMember) && !(obj instanceof SnomedRefSet)) .map(Component.class::cast) .map(Component::getId) .collect(Collectors.toSet()); if (!deletedIds.isEmpty()) { deletionPlan.markForDeletion(getReferringRefSetMembers(deletedIds)); } delete(); } if (isUniquenessCheckEnabled()) { List<CDOIDAndVersion> newObjects = transaction.getChangeSetData().getNewObjects(); ComponentIdUniquenessValidator uniquenessEnforcer = new ComponentIdUniquenessValidator(this); for (CDOIDAndVersion newCdoIdAndVersion : newObjects) { CDOObject newObject = transaction.getObject(newCdoIdAndVersion.getID()); if (newObject instanceof Component) { Component newComponent = (Component) newObject; uniquenessEnforcer.validateAndReplaceComponentId(newComponent); } } } }

Target:
public void preCommit() { if (deletionPlan.isRejected()) { throw new ConflictException(deletionPlan.toString()); } else if (!deletionPlan.isEmpty()) { final Set<String> deletedIds = deletionPlan.getDeletedItems() .stream() .filter(FSMUtil::isTransient) .filter(obj -> !(obj instanceof SnomedRefSetMember) && !(obj instanceof SnomedRefSet)) .map(Component.class::cast) .map(Component::getId) .collect(Collectors.toSet()); if (!deletedIds.isEmpty()) { deletionPlan.markForDeletion(getReferringRefSetMembers(deletedIds)); } delete(); deletionPlan = new SnomedDeletionPlan(); } if (isUniquenessCheckEnabled()) { List<CDOIDAndVersion> newObjects = transaction.getChangeSetData().getNewObjects(); ComponentIdUniquenessValidator uniquenessEnforcer = new ComponentIdUniquenessValidator(this); for (CDOIDAndVersion newCdoIdAndVersion : newObjects) { CDOObject newObject = transaction.getObject(newCdoIdAndVersion.getID()); if (newObject instanceof Component) { Component newComponent = (Component) newObject; uniquenessEnforcer.validateAndReplaceComponentId(newComponent); } } } }
Source:
public AbstractSegmentStoreStatisticsViewer(Composite parent) { super(parent, false); setLabelProvider(new SegmentStoreStatisticsLabelProvider()); fTablePopupMenuManager = new MenuManager(); fTablePopupMenuManager.setRemoveAllWhenShown(true); fTablePopupMenuManager.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final @Nullable IMenuManager manager) { TreeViewer viewer = getTreeViewer(); ISelection selection = viewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection) selection; if (manager != null) { appendToTablePopupMenu(manager, sel); } } } }); Menu tablePopup = fTablePopupMenuManager.createContextMenu(getTreeViewer().getTree()); getTreeViewer().getTree().setMenu(tablePopup); }

Target:
public AbstractSegmentStoreStatisticsViewer(Composite parent) { super(parent, false); setLabelProvider(new SegmentStoreStatisticsLabelProvider()); fTablePopupMenuManager = new MenuManager(); fTablePopupMenuManager.setRemoveAllWhenShown(true); fTablePopupMenuManager.addMenuListener(manager -> { TreeViewer viewer = getTreeViewer(); ISelection selection = viewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection) selection; if (manager != null) { appendToTablePopupMenu(manager, sel); } } }); Menu tablePopup = fTablePopupMenuManager.createContextMenu(getTreeViewer().getTree()); getTreeViewer().getTree().setMenu(tablePopup); }
Source:
private void handleMetadataBlob(BlobData blobData) throws IOException, MessageFormatException { ByteBuffer serializedMetadataContent = blobData.getStream().getByteBuffer(); CompositeBlobInfo compositeBlobInfo = MetadataContentSerDe.deserializeMetadataContentRecord(serializedMetadataContent, blobIdFactory); chunkSize = compositeBlobInfo.getChunkSize(); totalSize = compositeBlobInfo.getTotalSize(); List<StoreKey> keys = compositeBlobInfo.getKeys(); if (options != null && options.getRange() != null) { try { resolvedByteRange = options.getRange().toResolvedByteRange(totalSize); } catch (IllegalArgumentException e) { onInvalidRange("ByteRange " + options.getRange() + " is not within total blob size " + totalSize); return; } int firstChunkIndexInRange = (int) (resolvedByteRange.getStartOffset() / chunkSize); int lastChunkIndexInRange = (int) (resolvedByteRange.getEndOffset() / chunkSize); keys = keys.subList(firstChunkIndexInRange, lastChunkIndexInRange + 1); } chunkIdIterator = keys.listIterator(); numChunksTotal = keys.size(); dataChunks = new GetChunk[Math.min(keys.size(), NonBlockingRouter.MAX_IN_MEM_CHUNKS)]; for (int i = 0; i < dataChunks.length; i++) { dataChunks[i] = new GetChunk(chunkIdIterator.nextIndex(), (BlobId) chunkIdIterator.next()); } }

Target:
private void handleMetadataBlob(BlobData blobData) throws IOException, MessageFormatException { ByteBuffer serializedMetadataContent = blobData.getStream().getByteBuffer(); CompositeBlobInfo compositeBlobInfo = MetadataContentSerDe.deserializeMetadataContentRecord(serializedMetadataContent, blobIdFactory); chunkSize = compositeBlobInfo.getChunkSize(); totalSize = compositeBlobInfo.getTotalSize(); List<StoreKey> keys = compositeBlobInfo.getKeys(); boolean rangeResolutionFailure = false; try { if (options != null && options.getRange() != null) { resolvedByteRange = options.getRange().toResolvedByteRange(totalSize); int firstChunkIndexInRange = (int) (resolvedByteRange.getStartOffset() / chunkSize); int lastChunkIndexInRange = (int) (resolvedByteRange.getEndOffset() / chunkSize); keys = keys.subList(firstChunkIndexInRange, lastChunkIndexInRange + 1); } } catch (IllegalArgumentException e) { onInvalidRange(e); rangeResolutionFailure = true; } if (!rangeResolutionFailure) { chunkIdIterator = keys.listIterator(); numChunksTotal = keys.size(); dataChunks = new GetChunk[Math.min(keys.size(), NonBlockingRouter.MAX_IN_MEM_CHUNKS)]; for (int i = 0; i < dataChunks.length; i++) { dataChunks[i] = new GetChunk(chunkIdIterator.nextIndex(), (BlobId) chunkIdIterator.next()); } } }
Source:
protected String getPath(String filename) throws IOException { return super.getPath("checks" + File.separator + "SeparatorWrap" + File.separator + filename); }

Target:
protected String getPath(String filename) throws IOException { return super.getPath("checks" + File.separator + "whitespace" + File.separator + "separatorwrap" + File.separator + filename); }
Source:
private List<String> getToolTip(RulesetManagementInterface ruleset, Process linkedProcess) throws IOException { Collection<String> summaryKeys = ruleset.getFunctionalKeys(FunctionalMetadata.DISPLAY_SUMMARY); List<String> toolTip = new ArrayList<>(); if (!summaryKeys.isEmpty()) { Workpiece workpiece = metsService.loadWorkpiece(processService.getMetadataFileUri(linkedProcess)); IncludedStructuralElement rootElement = workpiece.getRootElement(); final String metadataLanguage = ServiceManager.getUserService().getCurrentUser().getMetadataLanguage(); List<LanguageRange> priorityList = Locale.LanguageRange.parse(metadataLanguage); for (String key : summaryKeys) { String value = MetadataEditor.getMetadataValue(rootElement, key); if (Objects.nonNull(value)) { Optional<String> label = ruleset.getTranslationForKey(rootElement.getType(), priorityList); toolTip.add(label.orElse(rootElement.getType()) + ": " + value); } } } if (toolTip.isEmpty()) { toolTip.add(linkedProcess.toString()); } return toolTip; }

Target:
private List<String> getToolTip(RulesetManagementInterface ruleset, Process linkedProcess) throws IOException { Collection<String> summaryKeys = ruleset.getFunctionalKeys(FunctionalMetadata.DISPLAY_SUMMARY); List<String> toolTip = new ArrayList<>(); if (!summaryKeys.isEmpty()) { Workpiece workpiece = metsService.loadWorkpiece(processService.getMetadataFileUri(linkedProcess)); IncludedStructuralElement rootElement = workpiece.getRootElement(); final String metadataLanguage = ServiceManager.getUserService().getCurrentUser().getMetadataLanguage(); List<LanguageRange> priorityList = Locale.LanguageRange.parse(metadataLanguage); for (String key : summaryKeys) { String value = MetadataEditor.getMetadataValue(rootElement, key); if (Objects.nonNull(value)) { Optional<String> label = ruleset.getTranslationForKey(key, priorityList); toolTip.add(label.orElse(key) + ": " + value); } } } if (toolTip.isEmpty()) { toolTip.add(linkedProcess.toString()); } return toolTip; }
Source:
public IntegrationTestingConfig get() { return new IntegrationTestingConfig() { @Override public String getCoordinatorUrl() { return "http://" + dockerIp + ":8081"; } @Override public String getIndexerUrl() { return "http://" + dockerIp + ":8090"; } @Override public String getRouterUrl() { return "http://" + dockerIp + ":8888"; } @Override public String getBrokerUrl() { return "http://" + dockerIp + ":8082"; } @Override public String getHistoricalUrl() { return "http://" + dockerIp + ":8083"; } @Override public String getMiddleManagerHost() { return dockerIp; } @Override public String getZookeeperHosts() { return dockerIp + ":2181"; } @Override public String getZookeeperIntenalHosts() { return "druid-zookeeper-kafka:2181"; } @Override public String getKafkaHost() { return dockerIp + ":9093"; } @Override public String getKafkaInternalHost() { return "druid-zookeeper-kafka:9092"; } @Override public String getProperty(String prop) { if (prop.equals("hadoopTestDir")) { return hadoopDir; } throw new UnsupportedOperationException("DockerConfigProvider does not support property " + prop); } @Override public String getUsername() { return null; } @Override public String getPassword() { return null; } @Override public Map<String, String> getProperties() { return new HashMap<>(); } @Override public boolean manageKafkaTopic() { return true; } }; }

Target:
public IntegrationTestingConfig get() { return new IntegrationTestingConfig() { @Override public String getCoordinatorUrl() { return "http://" + dockerIp + ":8081"; } @Override public String getIndexerUrl() { return "http://" + dockerIp + ":8090"; } @Override public String getRouterUrl() { return "http://" + dockerIp + ":8888"; } @Override public String getBrokerUrl() { return "http://" + dockerIp + ":8082"; } @Override public String getHistoricalUrl() { return "http://" + dockerIp + ":8083"; } @Override public String getMiddleManagerHost() { return dockerIp; } @Override public String getZookeeperHosts() { return dockerIp + ":2181"; } @Override public String getZookeeperInternalHosts() { return "druid-zookeeper-kafka:2181"; } @Override public String getKafkaHost() { return dockerIp + ":9093"; } @Override public String getKafkaInternalHost() { return "druid-zookeeper-kafka:9092"; } @Override public String getProperty(String prop) { if (prop.equals("hadoopTestDir")) { return hadoopDir; } throw new UnsupportedOperationException("DockerConfigProvider does not support property " + prop); } @Override public String getUsername() { return null; } @Override public String getPassword() { return null; } @Override public Map<String, String> getProperties() { return new HashMap<>(); } @Override public boolean manageKafkaTopic() { return true; } }; }
Source:
private void refreshToken(final Activity activity, final AuthenticationRequest request, final RefreshItem refreshItem, final boolean useCache, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.v(TAG, "Process refreshToken for " + request.getLogInfo()); Oauth2 oauthRequest = new Oauth2(request, mWebRequest); oauthRequest.refreshToken(refreshItem.mRefreshToken, new AuthenticationCallback<AuthenticationResult>() { @Override public void onSuccess(AuthenticationResult result) { if (useCache) { if (result == null || StringExtensions.IsNullOrBlank(result.getAccessToken())) { Logger.w( TAG, "Refresh token did not return accesstoken.", request.getLogInfo() + " CorrelationId:" + result.getCorrelationId() + " ErrorCode:" + result.getErrorCode() + " ErrorDescription:" + result.getErrorDescription(), ADALError.AUTH_FAILED_NO_TOKEN); removeItemFromCache(refreshItem); acquireTokenLocal(activity, request, externalCallback); } else { Logger.v( TAG, "Refresh token is finished. Request:" + request.getLogInfo()); Logger.v( TAG, "Cache is used. It will set item to cache" + request.getLogInfo()); setItemToCache(request, result); externalCallback.onSuccess(result); } } else { externalCallback.onSuccess(result); } } @Override public void onError(Exception exc) { Logger.e(TAG, "Error in refresh token for request:" + request.getLogInfo(), ExceptionExtensions.getExceptionMessage(exc), ADALError.AUTH_FAILED_NO_TOKEN, exc); if (useCache) { Logger.v(TAG, "Error in refresh token. Cache is used. It will remove item from cache" + request.getLogInfo()); removeItemFromCache(refreshItem); } externalCallback.onError(exc); } }); }

Target:
private void refreshToken(final Activity activity, final AuthenticationRequest request, final RefreshItem refreshItem, final boolean useCache, final AuthenticationCallback<AuthenticationResult> externalCallback) { Logger.v(TAG, "Process refreshToken for " + request.getLogInfo()); Oauth2 oauthRequest = new Oauth2(request, mWebRequest); oauthRequest.refreshToken(refreshItem.mRefreshToken, new AuthenticationCallback<AuthenticationResult>() { @Override public void onSuccess(AuthenticationResult result) { if (useCache) { if (result == null || StringExtensions.IsNullOrBlank(result.getAccessToken())) { Logger.w( TAG, "Refresh token did not return accesstoken.", request.getLogInfo() + result.getErrorLogInfo(), ADALError.AUTH_FAILED_NO_TOKEN); removeItemFromCache(refreshItem); acquireTokenLocal(activity, request, externalCallback); } else { Logger.v( TAG, "Refresh token is finished. Request:" + request.getLogInfo()); Logger.v( TAG, "Cache is used. It will set item to cache" + request.getLogInfo()); setItemToCache(request, result); externalCallback.onSuccess(result); } } else { externalCallback.onSuccess(result); } } @Override public void onError(Exception exc) { Logger.e(TAG, "Error in refresh token for request:" + request.getLogInfo(), ExceptionExtensions.getExceptionMessage(exc), ADALError.AUTH_FAILED_NO_TOKEN, exc); if (useCache) { Logger.v(TAG, "Error in refresh token. Cache is used. It will remove item from cache" + request.getLogInfo()); removeItemFromCache(refreshItem); } externalCallback.onError(exc); } }); }
Source:
public IPath buildPath(IPath sourcePath, IPath targetPath, int count) { sourcePath = sourcePath.removeFirstSegments(count); return targetPath.append(sourcePath); }

Target:
public static IPath buildPath(IPath sourcePath, IPath targetPath, int count) { sourcePath = sourcePath.removeFirstSegments(count); return targetPath.append(sourcePath); }
Source:
public void checkNotExists() throws IOException, XmlPullParserException { final File baseDir = new File("src/test/files/structure/test-resources-folder-exists/not-exists"); when(fs.baseDir()).thenReturn(baseDir); final TestResourcesFolderExistsCheck check = new TestResourcesFolderExistsCheck(fs); final Iterable<ConnectorIssue> pomIssues = check.analyze(null); assertThat(Iterables.size(pomIssues), is(1)); final ConnectorIssue first = Iterables.getFirst(pomIssues, null); assertThat(first.ruleKey(), is("test-resources-folder-exists")); assertThat(first.message(), is("Test Resources directory doesn't exist.")); }

Target:
public void checkNotExists() throws IOException, XmlPullParserException { final File baseDir = new File("src/test/files/structure/test-resources-folder-exists/not-exists"); when(fs.baseDir()).thenReturn(baseDir); final TestResourcesFolderExistsCheck check = new TestResourcesFolderExistsCheck(fs); final Iterable<ConnectorIssue> pomIssues = check.analyze(null); assertThat(Iterables.size(pomIssues), is(1)); final ConnectorIssue first = Iterables.getOnlyElement(pomIssues, null); assertThat(first.ruleKey(), is("test-resources-folder-exists")); assertThat(first.message(), is("src/test/resources doesn't exist.")); }
Source:
public OrderRequestBuilder withAuthorisationDetails(AuthCardDetails authCardDetails) { OrderRequestBuilder orderRequestBuilder = super.withAuthorisationDetails(authCardDetails); authCardDetails.getAddress().ifPresent(address -> northAmericanRegionMapper.getNorthAmericanRegionForCountry(address) .ifPresent(stateOrProvince -> worldpayTemplateData.setState(stateOrProvince.getAbbreviation())) ); return orderRequestBuilder; }

Target:
public OrderRequestBuilder withAuthorisationDetails(AuthCardDetails authCardDetails) { OrderRequestBuilder orderRequestBuilder = super.withAuthorisationDetails(authCardDetails); authCardDetails.getAddress() .flatMap(northAmericanRegionMapper::getNorthAmericanRegionForCountry) .map(NorthAmericaRegion::getAbbreviation) .ifPresent(worldpayTemplateData::setState); return orderRequestBuilder; }
Source:
public static String extractEndpointName(String name) { NhincConstants.NHIN_SERVICE_NAMES[] nhinServices = NhincConstants.NHIN_SERVICE_NAMES.values(); for (NhincConstants.NHIN_SERVICE_NAMES nhinService : nhinServices) { try { String serviceNames = PropertyAccessor.getInstance().getProperty(NhincConstants.FHIR_DIRECTORY_FILE, nhinService.getUDDIServiceName()); if (serviceNames == null) { LOG.warn("Service does not have any FHIR property defined", nhinService.getUDDIServiceName()); } else if (isServiceNameMatch(serviceNames.split(SEPARATOR), name)) { return nhinService.getUDDIServiceName(); } } catch (PropertyAccessException ex) { LOG.error("Unable to read from for NHIN Service {}", nhinService.toString(), NhincConstants.FHIR_DIRECTORY_FILE, nhinService, ex); } } return null; }

Target:
public static String extractEndpointName(String name) { NhincConstants.NHIN_SERVICE_NAMES[] nhinServices = NhincConstants.NHIN_SERVICE_NAMES.values(); for (NhincConstants.NHIN_SERVICE_NAMES nhinService : nhinServices) { String serviceNames = PropertyAccessor.getInstance().getProperty(NhincConstants.FHIR_DIRECTORY_FILE, nhinService.getUDDIServiceName(), null); if (serviceNames == null) { LOG.warn("Service does not have any FHIR property defined", nhinService.getUDDIServiceName()); } else if (isServiceNameMatch(serviceNames.split(SEPARATOR), name)) { return nhinService.getUDDIServiceName(); } } return null; }
Source:
public GameDetails(GameBean game, int detailsRequesterId) { this.gameId = game.getGameId(); this.creatorId = game.getCreator().getId(); this.privateGame = game.isPrivateGame(); this.privateCode = game.isPrivateGame() ? game.getPrivateCode() : null; this.dateCreated = game.getDateCreated().getTime(); this.dateStarted = game.getDateStarted() != null ? game.getDateStarted().getTime() : 0; this.status = game.getStatus().name(); this.gameUsers = game.getGameUserDetails(detailsRequesterId); this.minPlayers = game.getMinPlayers(); this.maxPlayers = game.getMaxPlayers(); this.targetVictoryPoints = game.getTargetVictoryPoints(); this.currentMove = game.getCurrentMove(); this.dice = new DiceDetails(game.getDiceFirstValue(), game.getDiceSecondValue()); this.map = new MapDetails(game.getEdgeDetails(), game.getHexDetails(), game.getNodeDetails()); }

Target:
public GameDetails(GameBean game, int detailsRequesterId) { this.gameId = game.getGameId(); this.creatorId = game.getCreator().getId(); this.privateGame = game.isPrivateGame(); this.privateCode = game.isPrivateGame() ? game.getPrivateCode() : null; this.dateCreated = game.getDateCreated().getTime(); this.dateStarted = game.getDateStarted() != null ? game.getDateStarted().getTime() : 0; this.status = game.getStatus().name(); this.gameUsers = game.getGameUserDetails(detailsRequesterId); this.minPlayers = game.getMinPlayers(); this.maxPlayers = game.getMaxPlayers(); this.targetVictoryPoints = game.getTargetVictoryPoints(); this.currentMove = game.getCurrentMove(); this.dice = game.isDiceThrown() == null ? null : new DiceDetails(game.isDiceThrown(), game.calculateDiceSumValue(), game.getDiceFirstValue(), game.getDiceSecondValue()); this.map = new MapDetails(game.getEdgeDetails(), game.getHexDetails(), game.getNodeDetails()); }
Source:
protected String getZkfcServerBindHost(Configuration conf) { String addr = conf.getTrimmed(DFSConfigKeys.DFS_NAMENODE_SERVICE_RPC_BIND_HOST_KEY); if (addr == null || addr.isEmpty()) { addr = conf.getTrimmed(DFSConfigKeys.DFS_NAMENODE_RPC_BIND_HOST_KEY); if (addr == null || addr.isEmpty()) { return null; } } return addr; }

Target:
private static String getZkfcServerBindHost(Configuration conf) { String addr = conf.getTrimmed( DFSConfigKeys.DFS_NAMENODE_SERVICE_RPC_BIND_HOST_KEY); if (addr == null || addr.isEmpty()) { addr = conf.getTrimmed(DFSConfigKeys.DFS_NAMENODE_RPC_BIND_HOST_KEY); } return addr; }
Source:
private void startService() { try { lastCacheCleanupMillis = new Date().getTime(); serviceTrans.startThreads(); StepInterface serviceStep = serviceTrans.findRunThread( serviceStepName ); if ( serviceStep == null ) { throw Throwables.propagate( new KettleException( "Service step is not accessible" ) ); } serviceStep.addRowListener( new RowAdapter() { @Override public void rowWrittenEvent( RowMetaInterface rowMeta, Object[] row ) throws KettleStepException { LogChannelInterface log = serviceTrans.getLogChannel(); try { if ( log.isRowLevel() ) { log.logRowlevel( DataServiceConstants.PASSING_ALONG_ROW + rowMeta.getString( row ) ); } } catch ( KettleValueException e ) { } RowMetaAndData rowData = new RowMetaAndData(); rowData.setRowMeta( rowMeta ); rowData.setData( row ); serviceCacheCleanup(); if ( serviceListeners.size() > 0 ) { stepStream.add( rowData ); } else { isRunning.compareAndSet( true, false ); serviceTrans.stopAll(); serviceTrans.waitUntilFinished(); stepStream = null; log.logDebug( DataServiceConstants.STREAMING_TRANSFORMATION_STOPPED ); } } } ); } catch ( KettleException e ) { throw Throwables.propagate( e ); } }

Target:
private void startService() { try { lastCacheCleanupMillis = System.currentTimeMillis(); serviceTrans.startThreads(); StepInterface serviceStep = serviceTrans.findRunThread( serviceStepName ); if ( serviceStep == null ) { throw Throwables.propagate( new KettleException( "Service step is not accessible" ) ); } serviceStep.addRowListener( new RowAdapter() { @Override public void rowWrittenEvent( RowMetaInterface rowMeta, Object[] row ) throws KettleStepException { LogChannelInterface log = serviceTrans.getLogChannel(); try { if ( log.isRowLevel() ) { log.logRowlevel( DataServiceConstants.PASSING_ALONG_ROW + rowMeta.getString( row ) ); } } catch ( KettleValueException e ) { } serviceCacheCleanup(); if ( serviceListeners.size() > 0 ) { RowMetaAndData rowData = new RowMetaAndData(); rowData.setRowMeta( rowMeta ); rowData.setData( row ); stepStream.add( rowData ); } else if ( isRunning.compareAndSet( true, false ) ) { serviceTrans.stopAll(); serviceTrans.waitUntilFinished(); stepStream = null; log.logDebug( DataServiceConstants.STREAMING_TRANSFORMATION_STOPPED ); } } } ); } catch ( KettleException e ) { throw Throwables.propagate( e ); } }
Source:
public CompletableFuture<Boolean> bootstrapNewNode(String endpoint) { Layout layout = new Layout(runtime.getLayoutView().getLayout()); CompletableFuture<Boolean> future = new CompletableFuture<>(); try { boolean bootstrapped = runtime.getLayoutView().bootstrapLayoutServer(endpoint, layout); future.complete(bootstrapped); return future; } catch (TimeoutException toe){ future.completeExceptionally(toe); return future; } }

Target:
public CompletableFuture<Boolean> bootstrapNewNode(String endpoint) { Layout layout = new Layout(runtime.getLayoutView().getLayout()); return runtime.getLayoutView().bootstrapLayoutServer(endpoint, layout) .thenApply(result -> { log.info("bootstrapNewNode: New node bootstrapped.", endpoint); return true; }); }