auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map<String, List<MessageReference>> getDeliveringMessages() { final Iterator<ConsumerHolder<? extends Consumer>> consumerHolderIterator; synchronized (this) { consumerHolderIterator = redistributor == null ? consumers.iterator() : SingletonIterator.newInstance(redistributor); } Map<String, List<MessageReference>> mapReturn = new HashMap<>(); while (consumerHolderIterator.hasNext()) { ConsumerHolder holder = consumerHolderIterator.next(); List<MessageReference> msgs = holder.consumer.getDeliveringMessages(); if (msgs != null && msgs.size() > 0) { mapReturn.put(holder.consumer.toManagementString(), msgs); } } for (String lingerSessionId : lingerSessionIds) { ServerSession serverSession = server.getSessionByID(lingerSessionId); if (serverSession != null) { List<MessageReference> refs = serverSession.getInTxLingerMessages(); if (!refs.isEmpty()) { mapReturn.put(serverSession.toManagementString(), refs); } } } return mapReturn; }

Target:
public Map<String, List<MessageReference>> getDeliveringMessages() { final Iterator<ConsumerHolder<? extends Consumer>> consumerHolderIterator; synchronized (this) { consumerHolderIterator = redistributor == null ? consumers.iterator() : SingletonIterator.newInstance(redistributor); } Map<String, List<MessageReference>> mapReturn = new HashMap<>(); while (consumerHolderIterator.hasNext()) { ConsumerHolder holder = consumerHolderIterator.next(); List<MessageReference> msgs = holder.consumer.getDeliveringMessages(); if (msgs != null && msgs.size() > 0) { mapReturn.put(holder.consumer.toManagementString(), msgs); } } for (String lingerSessionId : lingerSessionIds) { ServerSession serverSession = server.getSessionByID(lingerSessionId); List<MessageReference> refs = serverSession == null ? null : serverSession.getInTxLingerMessages(); if (refs != null && !refs.isEmpty()) { mapReturn.put(serverSession.toManagementString(), refs); } } return mapReturn; }
Source:
public List<String> filter(List<String> children) { List<String> filteredChildren = new ArrayList<>(); for (String child : children) { int separatorIndex = child.lastIndexOf('-'); if (separatorIndex < 0) { filteredChildren.add(child); continue; } String childPrefix = child.substring(0, separatorIndex); String ephemeralStorePrefix = _prefixGenerator.generatePrefix(); if (childPrefix.equals(ephemeralStorePrefix)) { filteredChildren.add(child); } else if (childPrefix.equals(ZooKeeperEphemeralStore.DEFAULT_PREFIX)) { filteredChildren.add(child); } } return filteredChildren; }

Target:
public List<String> filter(List<String> children) { if (children == null) { return null; } return children.stream().filter(child -> { int separatorIndex = child.lastIndexOf('-'); String childPrefix = separatorIndex > 0 ? child.substring(0, separatorIndex) : child; String ephemeralStorePrefix = _prefixGenerator.generatePrefix(); return StringUtils.isEmpty(ephemeralStorePrefix) || childPrefix.equals(ephemeralStorePrefix) || childPrefix.equals(ZooKeeperEphemeralStore.DEFAULT_PREFIX); }).collect(Collectors.toList()); }
Source:
public boolean init(Aphrodite aphrodite, AphroditeConfig config) throws NotFoundException { this.aphrodite = aphrodite; this.config = config; urlToStreamsMap.values(); return updateStreams(); }

Target:
public boolean init(Aphrodite aphrodite, AphroditeConfig config) throws NotFoundException { this.config = config; return updateStreams(); }
Source:
public String getModelId(String deviceId) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return null; } Object modelId = settingsData.node("lights").node(deviceId).value("modelid"); if(modelId instanceof String) { return (String) modelId; } else { return "unknown"; } }

Target:
public String getModelId(String deviceId) { if (settingsData == null) { logger.error("Hue bridge settings not initialized correctly."); return null; } Object modelId = settingsData.node("lights").node(deviceId).value("modelid"); return modelId != null ? modelId.toString() : null; }
Source:
public void loadGroupLoansAccountTemplate(int groupId, int productId) { checkViewAttached(); getMvpView().showProgressbar(true); if (mSubscription != null) mSubscription.unsubscribe(); mSubscription = mDataManager.getGroupLoansAccountTemplate(groupId, productId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<GroupLoanTemplate>() { @Override public void onCompleted() { getMvpView().showProgressbar(false); } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showFetchingError("Failed to load GroupLoan"); } @Override public void onNext(GroupLoanTemplate groupLoanTemplate) { getMvpView().showProgressbar(false); getMvpView().showGroupLoanTemplate( groupLoanTemplate); } }); }

Target:
public void loadGroupLoansAccountTemplate(int groupId, int productId) { checkViewAttached(); getMvpView().showProgressbar(true); mSubscriptions.add(mDataManager.getGroupLoansAccountTemplate(groupId, productId) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Subscriber<GroupLoanTemplate>() { @Override public void onCompleted() { getMvpView().showProgressbar(false); } @Override public void onError(Throwable e) { getMvpView().showProgressbar(false); getMvpView().showFetchingError("Failed to load GroupLoan"); } @Override public void onNext(GroupLoanTemplate groupLoanTemplate) { getMvpView().showProgressbar(false); getMvpView().showGroupLoanTemplate( groupLoanTemplate); } }) ); }
Source:
public ModelAndView getBrowseAllRssFeedView(@SiteParam Site site, @PathVariable String feedType) throws IOException { ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery("*:*") .setStart(0) .setRows(15) .setJournalKeys(ImmutableList.of(site.getJournalKey())) .setSortOrder(SolrSearchServiceImpl.SolrSortOrder.DATE_NEWEST_FIRST) .setDateRange(SolrSearchServiceImpl.SolrEnumeratedDateRange.ALL_TIME) .setSimple(false) .setIsRssSearch(true); ArticleSearchQuery queryObj = query.build(); Map<String, ?> searchResults = solrSearchService.search(queryObj); ModelAndView mav = new ModelAndView(); mav.addObject("site", site); mav.addObject("solrResults", searchResults.get("docs")); if (feedType.equalsIgnoreCase(FeedType.ATOM.name())) { mav.setView(articleFeedView.getArticleAtomView()); } else { mav.setView(articleFeedView.getArticleRssView()); } return mav; }

Target:
public ModelAndView getBrowseAllRssFeedView(@SiteParam Site site, @PathVariable String feedType) throws IOException { ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery("*:*") .setStart(0) .setRows(RSS_ARTICLE_COUNT) .setJournalKeys(ImmutableList.of(site.getJournalKey())) .setSortOrder(SolrSearchServiceImpl.SolrSortOrder.DATE_NEWEST_FIRST) .setDateRange(SolrSearchServiceImpl.SolrEnumeratedDateRange.ALL_TIME) .setSimple(false) .setIsRssSearch(true); ArticleSearchQuery queryObj = query.build(); Map<String, ?> searchResults = solrSearchService.search(queryObj); return getFeedModelAndView(site, feedType, searchResults); }
Source:
public V001() { super(); WikibaseUris uris = WikibaseUris.getURISystem(); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.reference(), 40)); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.value(), 40)); }

Target:
public V001() { super(); WikibaseUris uris = WikibaseUris.getURISystem(); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.reference(), 40)); addHandler(new InlineFixedWidthHexIntegerURIHandler(uris.value(), 32)); }
Source:
private String getBodyContentAsString() { if (body == null) { return null; } try { String contentType = (messageProperties != null) ? messageProperties.getContentType() : null; if (MessageProperties.CONTENT_TYPE_SERIALIZED_OBJECT.equals(contentType)) { return SerializationUtils.deserialize(body).toString(); } if (MessageProperties.CONTENT_TYPE_TEXT_PLAIN.equals(contentType)) { return new String(body, ENCODING); } if (MessageProperties.CONTENT_TYPE_JSON.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON_ALT.equals(contentType)) { return new String(body, ENCODING); } } catch (Exception e) { } return body.toString()+"(byte["+body.length+"])"; }

Target:
private String getBodyContentAsString() { if (body == null) { return null; } try { String contentType = (messageProperties != null) ? messageProperties.getContentType() : null; if (MessageProperties.CONTENT_TYPE_SERIALIZED_OBJECT.equals(contentType)) { return SerializationUtils.deserialize(body).toString(); } if (MessageProperties.CONTENT_TYPE_TEXT_PLAIN.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON.equals(contentType) || MessageProperties.CONTENT_TYPE_JSON_ALT.equals(contentType) || MessageProperties.CONTENT_TYPE_XML.equals(contentType)) { return new String(body, ENCODING); } } catch (Exception e) { } return body.toString()+"(byte["+body.length+"])"; }
Source:
public void enqueue(Callback callback) { ListenableFuture<Listener> listenerFuture = limiter.acquire(); Futures.addCallback(listenerFuture, new FutureCallback<Listener>() { @Override public void onSuccess(Listener listener) { enqueue(new RequestCompletion(schedulingExecutor, executionExecutor, callback, listener)); } @Override public void onFailure(Throwable t) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen", t))); } }, MoreExecutors.directExecutor()); }

Target:
public void enqueue(Callback callback) { super.enqueue(new Callback() { @Override public void onFailure(Call call, IOException exception) { urls.markAsFailed(request().url()); Optional<Duration> backoff = backoffStrategy.nextBackoff(); if (!backoff.isPresent()) { callback.onFailure(call, new IOException("Failed to complete the request due to an " + "IOException", exception)); return; } Optional<HttpUrl> redirectTo = urls.redirectToNext(request().url()); if (!redirectTo.isPresent()) { callback.onFailure(call, new IOException("Failed to determine valid failover URL" + "for '" + request().url() + "' and base URLs " + urls.getBaseUrls())); return; } Request redirectedRequest = request().newBuilder() .url(redirectTo.get()) .build(); RemotingOkHttpCall retryCall = client.newCallWithMutableState(redirectedRequest, backoffStrategy, maxNumRelocations - 1); log.debug("Rescheduling call after backoff", SafeArg.of("backoffMillis", backoff.get().toMillis()), exception); scheduleExecution(() -> retryCall.enqueue(callback), backoff.get()); } @Override public void onResponse(Call call, Response response) throws IOException { if (response.code() / 100 <= 2) { callback.onResponse(call, response); return; } Supplier<Response> errorResponseSupplier; try { byte[] body = response.body().bytes(); errorResponseSupplier = () -> buildFrom(response, body); } catch (IOException e) { onFailure(call, e); return; } Optional<QosException> qosError = qosHandler.handle(errorResponseSupplier.get()); if (qosError.isPresent()) { qosError.get().accept(createQosVisitor(callback, call)); return; } Optional<RemoteException> httpError = remoteExceptionHandler.handle(errorResponseSupplier.get()); if (httpError.isPresent()) { callback.onFailure(call, new IoRemoteException(httpError.get())); return; } Optional<IOException> ioException = ioExceptionHandler.handle(errorResponseSupplier.get()); if (ioException.isPresent()) { callback.onFailure(call, ioException.get()); return; } callback.onFailure(call, new IOException("Failed to handle request, this is an http-remoting bug.")); } }); }
Source:
public void sendLogoutRequest( @Context HttpServletRequest request, @Context HttpServletResponse response) { response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setContentType("text/html"); UriBuilder redirectPage = UriBuilder.fromUri(casServerLogoutUrl); HttpSession session = request.getSession(false); if (session != null) { SecurityTokenHolder savedToken = (SecurityTokenHolder) session.getAttribute(SecurityConstants.SAML_ASSERTION); if (savedToken != null) { Subject subject = ThreadContext.getSubject(); boolean hasSecurityAuditRole = Arrays.stream(System.getProperty("security.audit.roles", "").split(",")) .filter(subject::hasRole) .findFirst() .isPresent(); if (hasSecurityAuditRole) { SecurityLogger.audit("Subject with admin privileges has logged out", subject); } savedToken.removeAll(); } session.invalidate(); deleteJSessionId(response); } try { response.sendRedirect(redirectPage.build().toString()); } catch (IOException e) { LOGGER.warn("Failed to send redirect: ", e); } }

Target:
public void sendLogoutRequest( @Context HttpServletRequest request, @Context HttpServletResponse response) { response.setHeader("Cache-Control", "no-cache, no-store"); response.setHeader("Pragma", "no-cache"); response.setContentType("text/html"); UriBuilder redirectPage = UriBuilder.fromUri(casServerLogoutUrl); HttpSession session = request.getSession(false); if (session != null) { SecurityTokenHolder savedToken = (SecurityTokenHolder) session.getAttribute(SecurityConstants.SAML_ASSERTION); if (savedToken != null) { Subject subject = ThreadContext.getSubject(); if (subject != null) { boolean hasSecurityAuditRole = Arrays.stream(System.getProperty("security.audit.roles", "").split(",")) .filter(subject::hasRole) .findFirst() .isPresent(); if (hasSecurityAuditRole) { SecurityLogger.audit("Subject with admin privileges has logged out", subject); } } savedToken.removeAll(); } session.invalidate(); } try { response.sendRedirect(redirectPage.build().toString()); } catch (IOException e) { LOGGER.warn("Failed to send redirect: ", e); } }
Source:
public static FirmwareUpdateStore create(final OTAHistoryDAODynamoDB otaHistoryDAO, final AmazonS3 s3, final String bucketName, final AmazonS3 s3Signer, final Integer s3CacheExpireMinutes, final FirmwareVersionMappingDAO firmwareVersionMappingDAO, final FirmwareUpgradePathDAO firmwareUpgradePathDAO) { final Cache<String, Pair<Integer, List<OutputProtos.SyncResponse.FileDownload>>> s3Cache = CacheBuilder.newBuilder() .expireAfterWrite(s3CacheExpireMinutes, TimeUnit.MINUTES) .build(); final Cache<DeviceGroupFW, String> s3ObjectKeyCache = CacheBuilder.newBuilder() .expireAfterWrite(5, TimeUnit.MINUTES) .build(); return new FirmwareUpdateStore(otaHistoryDAO, s3, bucketName, s3Signer, s3Cache, firmwareVersionMappingDAO, firmwareUpgradePathDAO, s3ObjectKeyCache); }

Target:
public static FirmwareUpdateStore create(final OTAHistoryDAODynamoDB otaHistoryDAO, final AmazonS3 s3, final String bucketName, final AmazonS3 s3Signer, final Integer s3CacheExpireMinutes, final FirmwareVersionMappingDAO firmwareVersionMappingDAO, final FirmwareUpgradePathDAO firmwareUpgradePathDAO) { final Cache<String, Pair<Integer, List<OutputProtos.SyncResponse.FileDownload>>> s3Cache = CacheBuilder.newBuilder() .expireAfterWrite(s3CacheExpireMinutes, TimeUnit.MINUTES) .build(); final Cache<DeviceGroupFW, String> s3ObjectKeyCache = CacheBuilder.newBuilder() .expireAfterWrite(1, TimeUnit.MINUTES) .build(); return new FirmwareUpdateStore(otaHistoryDAO, s3, bucketName, s3Signer, s3Cache, firmwareVersionMappingDAO, firmwareUpgradePathDAO, s3ObjectKeyCache); }
Source:
private static int getIndex(MElementContainer<?> menuModel, String positionInParent) { String id = null; String modifier = null; if (positionInParent != null && positionInParent.length() > 0) { String[] array = positionInParent.split("="); modifier = array[0]; if (array.length > 1) { id = array[1]; } } if (id == null) { return menuModel.getChildren().size(); } int idx = 0; int size = menuModel.getChildren().size(); while (idx < size) { if (id.equals(menuModel.getChildren().get(idx).getElementId())) { if ("after".equals(modifier)) { idx++; } return idx; } idx++; } if (id.equals("additions")) { idx = menuModel.getChildren().size() - 1; while (idx > -1) { if ("PerspectiveSpacer".equals(menuModel.getChildren().get(idx).getElementId())) { break; } idx--; } } return idx; }

Target:
private static int getIndex(MElementContainer<?> menuModel, String positionInParent) { String id = null; String modifier = null; if (positionInParent != null && positionInParent.length() > 0) { String[] array = positionInParent.split("="); modifier = array[0]; if (array.length > 1) { id = array[1]; } } if (id == null) { return menuModel.getChildren().size(); } int idx = 0; int size = menuModel.getChildren().size(); while (idx < size) { if (id.equals(menuModel.getChildren().get(idx).getElementId())) { if ("after".equals(modifier)) { idx++; } return idx; } idx++; } return id.equals("additions") ? menuModel.getChildren().size() : -1; }
Source:
public static int compareVersion(String version, String value) { try { if (version == "1.8.4-SNAPSHOT" || value == "1.8.4") { return 0; } List<String> versions = new ArrayList<>(); List<String> values = new ArrayList<>(); String separator = "-"; int qualifierIndex = version.indexOf(separator); if (qualifierIndex != -1) { version = version.substring(0, qualifierIndex); } qualifierIndex = value.indexOf(separator); if (qualifierIndex != -1) { value = value.substring(0, qualifierIndex); } Collections.addAll(versions, version.split("\\.")); Collections.addAll(values, value.split("\\.")); while (versions.size() < values.size()) { versions.add("1.8.4-SNAPSHOT"); } while (values.size() < versions.size()) { values.add("1.8.4"); } for (int x = 0; x < versions.size(); x++) { String verNum = versions.get(x).trim(); String valNum = values.get(x).trim(); Long ver = NumberUtils.toLong(verNum, 0); Long val = NumberUtils.toLong(valNum, 0); int ret = ver.compareTo(val); if (ret != 0) { return ret; } } } catch (NumberFormatException e) { log.error("Error while converting a version/value to an integer: " + version + "/" + value, e); } return 0; }

Target:
public static int compareVersion(String version, String value) { try { if (version == null || value == null) { return 0; } List<String> versions = new ArrayList<>(); List<String> values = new ArrayList<>(); String separator = "-"; int qualifierIndex = version.indexOf(separator); if (qualifierIndex != -1) { version = version.substring(0, qualifierIndex); } qualifierIndex = value.indexOf(separator); if (qualifierIndex != -1) { value = value.substring(0, qualifierIndex); } Collections.addAll(versions, version.split("\\.")); Collections.addAll(values, value.split("\\.")); while (versions.size() < values.size()) { versions.add("0"); } while (values.size() < versions.size()) { values.add("0"); } for (int x = 0; x < versions.size(); x++) { String verNum = versions.get(x).trim(); String valNum = values.get(x).trim(); Long ver = NumberUtils.toLong(verNum, 0); Long val = NumberUtils.toLong(valNum, 0); int ret = val.compareTo(ver); if (ret != 0) { return ret; } } } catch (NumberFormatException e) { log.error("Error while converting a version/value to an integer: " + version + "/" + value, e); } return 0; }
Source:
void write(Error error) { if(path == null) return; String filename = String.format("%s%d.json", path, System.currentTimeMillis()); try { Writer out = new FileWriter(filename); JsonStream stream = new JsonStream(out); stream.value(error); stream.close(); Logger.info(String.format("Saved unsent error to disk (%s) ", filename)); } catch (Exception e) { Logger.warn(String.format("Couldn't save unsent error to disk (%s) ", filename), e); } }

Target:
void write(Error error) { if(path == null) return; String filename = String.format("%s%d.json", path, System.currentTimeMillis()); Writer out = null; try { out = new FileWriter(filename); JsonStream stream = new JsonStream(out); stream.value(error); stream.close(); Logger.info(String.format("Saved unsent error to disk (%s) ", filename)); } catch (Exception e) { Logger.warn(String.format("Couldn't save unsent error to disk (%s) ", filename), e); } finally { IOUtils.closeQuietly(out); } }
Source:
public static List<Entity> generateCivilianUnits(int num, Campaign campaign) { RandomUnitGenerator.getInstance().setChosenRAT("CivilianUnits"); ArrayList<MechSummary> msl = RandomUnitGenerator.getInstance().generate(num); List<Entity> entities = msl.stream().map(ms -> createEntityWithCrew("IND", RandomSkillsGenerator.L_GREEN, campaign, ms)).collect(Collectors.<Entity>toList()); return new ArrayList<>(entities); }

Target:
public static List<Entity> generateCivilianUnits(int num, Campaign campaign) { RandomUnitGenerator.getInstance().setChosenRAT("CivilianUnits"); ArrayList<MechSummary> msl = RandomUnitGenerator.getInstance().generate(num); return msl.stream().map(ms -> createEntityWithCrew("IND", RandomSkillsGenerator.L_GREEN, campaign, ms)).collect(Collectors.toCollection(ArrayList::new)); }
Source:
private void logUefiParameters(Map<VirtualMachineProfile.Param, Object> params) { StringBuffer msgBuf = new StringBuffer("Uefi params "); boolean log = false; if (params.get(VirtualMachineProfile.Param.UefiFlag) != null) { msgBuf.append(String.format("UefiFlag: %s ", params.get(VirtualMachineProfile.Param.UefiFlag))); log = true; } if (params.get(VirtualMachineProfile.Param.BootType) != null) { msgBuf.append(String.format("Boot Type: %s ", params.get(VirtualMachineProfile.Param.BootType))); log = true; } if (params.get(VirtualMachineProfile.Param.BootMode) != null) { msgBuf.append(String.format("Boot Mode: %s ", params.get(VirtualMachineProfile.Param.BootMode))); log = true; } if (log) { s_logger.info(msgBuf.toString()); } }

Target:
private void logUefiParameters(Map<VirtualMachineProfile.Param, Object> params) { if (params == null) { return; } StringBuffer msgBuf = new StringBuffer("Uefi params "); boolean log = false; if (params.get(VirtualMachineProfile.Param.UefiFlag) != null) { msgBuf.append(String.format("UefiFlag: %s ", params.get(VirtualMachineProfile.Param.UefiFlag))); log = true; } if (params.get(VirtualMachineProfile.Param.BootType) != null) { msgBuf.append(String.format("Boot Type: %s ", params.get(VirtualMachineProfile.Param.BootType))); log = true; } if (params.get(VirtualMachineProfile.Param.BootMode) != null) { msgBuf.append(String.format("Boot Mode: %s ", params.get(VirtualMachineProfile.Param.BootMode))); log = true; } if (log) { s_logger.info(msgBuf.toString()); } }
Source:
protected void readNewTopologyAndHash(Transport transport, AtomicInteger topologyId) { final Log localLog = getLog(); int newTopologyId = transport.readVInt(); topologyId.set(newTopologyId); int clusterSize = transport.readVInt(); SocketAddress[] addresses = new SocketAddress[clusterSize]; for (int i = 0; i < clusterSize; i++) { String host = transport.readString(); int port = transport.readUnsignedShort(); addresses[i] = new InetSocketAddress(host, port); } short hashFunctionVersion = transport.readByte(); int numSegments = transport.readVInt(); SocketAddress[][] segmentOwners = new SocketAddress[numSegments][]; for (int i = 0; i < numSegments; i++) { short numOwners = transport.readByte(); segmentOwners[i] = new SocketAddress[numOwners]; for (int j = 0; j < numOwners; j++) { int memberIndex = transport.readVInt(); segmentOwners[i][j] = addresses[memberIndex]; } } List<SocketAddress> addressList = Arrays.asList(addresses); if (localLog.isInfoEnabled()) { localLog.newTopology(transport.getRemoteSocketAddress(), newTopologyId, addresses.length, new HashSet<SocketAddress>(addressList)); } transport.getTransportFactory().updateServers(addressList); if (hashFunctionVersion == 0) { localLog.trace("Not using a consistent hash function (hash function version == 0)."); } else { transport.getTransportFactory().updateHashFunction(segmentOwners, numSegments, hashFunctionVersion); } }

Target:
protected void readNewTopologyAndHash(Transport transport, AtomicInteger topologyId) { final Log localLog = getLog(); int newTopologyId = transport.readVInt(); topologyId.set(newTopologyId); int clusterSize = transport.readVInt(); SocketAddress[] addresses = new SocketAddress[clusterSize]; for (int i = 0; i < clusterSize; i++) { String host = transport.readString(); int port = transport.readUnsignedShort(); addresses[i] = new InetSocketAddress(host, port); } short hashFunctionVersion = transport.readByte(); int numSegments = transport.readVInt(); SocketAddress[][] segmentOwners = new SocketAddress[numSegments][]; for (int i = 0; i < numSegments; i++) { short numOwners = transport.readByte(); segmentOwners[i] = new SocketAddress[numOwners]; for (int j = 0; j < numOwners; j++) { int memberIndex = transport.readVInt(); segmentOwners[i][j] = addresses[memberIndex]; } } List<SocketAddress> addressList = Arrays.asList(addresses); if (localLog.isInfoEnabled()) { localLog.newTopology(transport.getRemoteSocketAddress(), newTopologyId, addresses.length, new HashSet<SocketAddress>(addressList)); } transport.getTransportFactory().updateServers(addressList); if (hashFunctionVersion == 0) { if (trace) localLog.trace("Not using a consistent hash function (hash function version == 0)."); } else { transport.getTransportFactory().updateHashFunction(segmentOwners, numSegments, hashFunctionVersion); } }
Source:
public boolean equals( Object o ) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JournalRecord record = (JournalRecord)o; if (createdTimeMillisUTC != record.createdTimeMillisUTC) { return false; } if (content != null ? !content.getUUID().equals(record.content.getUUID()) : record.content != null) { return false; } return true; }

Target:
public boolean equals( Object o ) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JournalRecord record = (JournalRecord)o; return content.getUUID().equals(record.content.getUUID()); }
Source:
private ListenableFuture<? extends GeneratedMessage> issueRequest(final Mutation mutation) { try { if (mutation instanceof Put) { return client.mutateRowAsync(adapter.adapt((Put) mutation)); } else if (mutation instanceof Delete) { return client.mutateRowAsync(adapter.adapt((Delete) mutation)); } else if (mutation instanceof Increment) { return client.readModifyWriteRowAsync(adapter.adapt((Increment) mutation)); } else if (mutation instanceof Append) { return client.readModifyWriteRowAsync(adapter.adapt((Append) mutation)); } return Futures.immediateFailedFuture(new IllegalArgumentException( "Encountered unknown action type: " + mutation.getClass())); } catch (RuntimeException e) { return Futures.immediateFailedFuture(e); } }

Target:
private ListenableFuture<? extends GeneratedMessage> issueRequest(final Mutation mutation) { try { if (mutation == null) { return Futures.immediateFailedFuture(new IllegalArgumentException( "Cannot perform a mutation on a null object.")); } if (mutation instanceof Put) { return client.mutateRowAsync(adapter.adapt((Put) mutation)); } else if (mutation instanceof Delete) { return client.mutateRowAsync(adapter.adapt((Delete) mutation)); } else if (mutation instanceof Increment) { return client.readModifyWriteRowAsync(adapter.adapt((Increment) mutation)); } else if (mutation instanceof Append) { return client.readModifyWriteRowAsync(adapter.adapt((Append) mutation)); } return Futures.immediateFailedFuture(new IllegalArgumentException( "Encountered unknown mutation type: " + mutation.getClass())); } catch (RuntimeException e) { return Futures.immediateFailedFuture(e); } }
Source:
@Override public ICubeGenerator createCubeGenerator(ICubicWorldServer world) { CustomTerrainProcessor terrain = new CustomTerrainProcessor(world); CustomFeatureProcessor features = new CustomFeatureProcessor(); CustomPopulationProcessor population = new CustomPopulationProcessor(world); return new BasicCubeGenerator(world) { @Override public ICubePrimer generateCube(int cubeX, int cubeY, int cubeZ) { ICubePrimer primer = new CubePrimer(); terrain.calculate(primer, cubeX, cubeY, cubeZ); features.generate(world, primer, cubeX, cubeY, cubeZ); return primer; } @Override public void populate(Cube cube) { population.populate(cube); } @Override public Vec3i[] getPopRequirment(Cube cube) { return RECOMENDED_POPULATOR_REQUIRMENT; } }; }

Target:
@Override public ICubeGenerator createCubeGenerator(ICubicWorldServer world) { CustomTerrainProcessor terrain = new CustomTerrainProcessor(world); CustomFeatureProcessor features = new CustomFeatureProcessor(); CustomPopulationProcessor population = new CustomPopulationProcessor(world); return new BasicCubeGenerator(world) { @Override public ICubePrimer generateCube(int cubeX, int cubeY, int cubeZ) { ICubePrimer primer = new CubePrimer(); terrain.calculate(primer, cubeX, cubeY, cubeZ); features.generate(world, primer, cubeX, cubeY, cubeZ); return primer; } @Override public void populate(Cube cube) { population.populate(cube); } @Override public Box getPopulationRequirement(Cube cube) { return RECOMMENDED_POPULATOR_REQUIREMENT; } }; }
Source:
public Page<E> asPage() { Objects.requireNonNull(ctx); Watch w = Watch.start(); Page<E> result = new Page<E>().withStart(1).withPageSize(PAGE_SIZE); result.bindToRequest(ctx); if (advancedSearch) { QueryCompiler compiler = new QueryCompiler(baseQuery.getEntityDescriptor(), result.getQuery(), searchFields); Constraint constraint = compiler.compile(); if (constraint != null) { baseQuery.where(constraint); } } else { if (searchFields != null && searchFields.length > 0) { baseQuery.where(Like.allWordsInAnyField(result.getQuery(), searchFields)); } } for (Tuple<Facet, BiConsumer<Facet, SmartQuery<E>>> f : facets) { if (f.getSecond() != null) { f.getSecond().accept(f.getFirst(), baseQuery); } result.addFacet(f.getFirst()); } try { List<E> items = baseQuery.skip(result.getStart() - 1).limit(PAGE_SIZE + 1).queryList(); if (items.size() > PAGE_SIZE) { result.withHasMore(true); items.remove(items.size() - 1); } result.withDuration(w.duration()); result.withItems(items); } catch (Throwable e) { UserContext.handle(e); } return result; }

Target:
public Page<E> asPage() { Objects.requireNonNull(ctx); Watch w = Watch.start(); Page<E> result = new Page<E>().withStart(1).withPageSize(PAGE_SIZE); result.bindToRequest(ctx); if (advancedSearch) { QueryCompiler compiler = new QueryCompiler(baseQuery.getEntityDescriptor(), result.getQuery(), searchFields); Constraint constraint = compiler.compile(); if (constraint != null) { baseQuery.where(constraint); } } else { if (searchFields != null && searchFields.length > 0) { baseQuery.where(Like.allWordsInAnyField(result.getQuery(), searchFields)); } } for (Tuple<Facet, BiConsumer<Facet, SmartQuery<E>>> f : facets) { if (f.getSecond() != null) { f.getSecond().accept(f.getFirst(), baseQuery); } result.addFacet(f.getFirst()); } try { List<E> items = baseQuery.skip(result.getStart() - 1).limit(PAGE_SIZE + 1).queryList(); if (items.size() > PAGE_SIZE) { result.withHasMore(true); items.remove(items.size() - 1); } result.withDuration(w.duration()); result.withItems(items); } catch (Exception e) { UserContext.handle(e); } return result; }
Source:
public PageableResult search(RequestContext context) throws ResponseException { String patientUuid = context.getRequest().getParameter("patient"); String encounterTypeUuid = context.getRequest().getParameter("encounterType"); String dateFrom = context.getRequest().getParameter(DATE_FROM); String dateTo = context.getRequest().getParameter(DATE_TO); Date fromDate = dateFrom!=null ? isoParser.parseDateTime(dateFrom).toDate() : null; Date toDate = dateTo != null? isoParser.parseDateTime(dateTo).toDate() : null; Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class).getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); if (patient != null && encounterType != null) { List<Encounter> encounters = Context.getEncounterService() .getEncounters(patient, null, fromDate, toDate, null, Arrays.asList(encounterType), null, false); String order = context.getRequest().getParameter("order"); if ("desc".equals(order)) { Collections.reverse(encounters); } return new NeedsPaging<Encounter>(encounters, context); } return new EmptySearchResult(); }

Target:
public PageableResult search(RequestContext context) throws ResponseException { String patientUuid = context.getRequest().getParameter("patient"); String encounterTypeUuid = context.getRequest().getParameter("encounterType"); String dateFrom = context.getRequest().getParameter(DATE_FROM); String dateTo = context.getRequest().getParameter(DATE_TO); Date fromDate = dateFrom != null ? (Date)ConversionUtil.convert(dateFrom, Date.class) : null; Date toDate = dateTo != null? (Date)ConversionUtil.convert(dateTo, Date.class) : null; Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class).getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); if (patient != null && encounterType != null) { List<Encounter> encounters = Context.getEncounterService() .getEncounters(patient, null, fromDate, toDate, null, Arrays.asList(encounterType), null, false); String order = context.getRequest().getParameter("order"); if ("desc".equals(order)) { Collections.reverse(encounters); } return new NeedsPaging<Encounter>(encounters, context); } return new EmptySearchResult(); }
Source:
public AvroSchemaFactoryContext createContext() { AvroSchemaFactoryContext context = new AvroSchemaFactoryContext(replacements); for (Entry<Class<?>, Class<AvroSchemaFactory<?>>> entry : factories.entrySet()) { try { Class<AvroSchemaFactory<?>> clazz = entry.getValue(); Constructor<AvroSchemaFactory<?>> constructor = clazz.getConstructor(AvroSchemaFactoryContext.class); AvroSchemaFactory<?> factory = constructor.newInstance(context); context.register(entry.getKey(), factory); } catch (Exception e) { log.error(e); } } return context; }

Target:
public AvroSchemaFactoryContext createContext() { AvroSchemaFactoryContext context = new AvroSchemaFactoryContext(replacements); for (Entry<Class<?>, Class<AvroSchemaFactory<?>>> entry : factories.entrySet()) { try { Class<AvroSchemaFactory<?>> clazz = entry.getValue(); Constructor<AvroSchemaFactory<?>> constructor = clazz.getConstructor(AvroSchemaFactoryContext.class); AvroSchemaFactory<?> factory = constructor.newInstance(context); context.register(entry.getKey(), factory); } catch (ReflectiveOperationException e) { throw new RuntimeServiceException(e); } } return context; }
Source:
public CalledMethodsAnnotatedTypeFactory(BaseTypeChecker checker) { super( checker, CalledMethods.class, CalledMethodsBottom.class, CalledMethodsPredicate.class); Set<String> disabledFrameworks = new HashSet<>(); if (checker.hasOption(CalledMethodsChecker.DISABLE_BUILDER_FRAMEWORK_SUPPORTS)) { disabledFrameworks.addAll( Arrays.asList( checker.getOption( CalledMethodsChecker .DISABLE_BUILDER_FRAMEWORK_SUPPORTS) .split(",")) .stream() .map(String::toUpperCase) .collect(Collectors.toList())); } builderFrameworkSupports = new ArrayList<>(); enableFramework(CalledMethodsChecker.LOMBOK_SUPPORT, disabledFrameworks); enableFramework(CalledMethodsChecker.AUTOVALUE_SUPPORT, disabledFrameworks); if (!disabledFrameworks.isEmpty()) { StringJoiner sj = new StringJoiner(", "); disabledFrameworks.iterator().forEachRemaining(s -> sj.add(s)); String unrecognized = sj.toString(); throw new UserError( "The following argument(s) to the " + CalledMethodsChecker.DISABLE_BUILDER_FRAMEWORK_SUPPORTS + " command-line argument to the Called Methods Checker were unrecognized: " + unrecognized); } this.useValueChecker = checker.hasOption(CalledMethodsChecker.USE_VALUE_CHECKER); this.collectionsSingletonList = TreeUtils.getMethod( "java.util.Collections", "singletonList", 1, getProcessingEnv()); addAliasedAnnotation(OLD_CALLED_METHODS, CalledMethods.class, true); addAliasedAnnotation(OLD_NOT_CALLED_METHODS, this.top); this.postInit(); }

Target:
public CalledMethodsAnnotatedTypeFactory(BaseTypeChecker checker) { super( checker, CalledMethods.class, CalledMethodsBottom.class, CalledMethodsPredicate.class); this.builderFrameworkSupports = new ArrayList<>(); String[] disabledFrameworks; if (checker.hasOption(CalledMethodsChecker.DISABLE_BUILDER_FRAMEWORK_SUPPORTS)) { disabledFrameworks = checker.getOption(CalledMethodsChecker.DISABLE_BUILDER_FRAMEWORK_SUPPORTS) .split(","); } else { disabledFrameworks = new String[0]; } enableFrameworks(disabledFrameworks); this.useValueChecker = checker.hasOption(CalledMethodsChecker.USE_VALUE_CHECKER); this.collectionsSingletonList = TreeUtils.getMethod( "java.util.Collections", "singletonList", 1, getProcessingEnv()); addAliasedAnnotation( "org.checkerframework.checker.builder.qual.CalledMethods", CalledMethods.class, true); addAliasedAnnotation( "org.checkerframework.checker.builder.qual.NotCalledMethods", this.top); this.postInit(); }
Source:
public ValidationResult check(PageValidation pageValidation, String objectName, T spec) throws ValidationErrorException { PageElement mainObject = pageValidation.findPageElement(objectName); checkAvailability(mainObject, objectName); Rect area = mainObject.getArea(); String realText = mainObject.getText(); realText = new String(realText.getBytes(Charset.forName("utf-8"))); if (realText == null) { realText = ""; } realText = applyOperationsTo(realText, spec.getOperations()); checkValue(spec, objectName, realText, "text", area); return new ValidationResult(spec, asList(new ValidationObject(area, objectName))); }

Target:
public ValidationResult check(PageValidation pageValidation, String objectName, T spec) throws ValidationErrorException { PageElement mainObject = pageValidation.findPageElement(objectName); checkAvailability(mainObject, objectName); Rect area = mainObject.getArea(); String realText = mainObject.getText(); if (realText == null) { realText = ""; } realText = new String(realText.getBytes(Charset.forName("utf-8"))); realText = applyOperationsTo(realText, spec.getOperations()); checkValue(spec, objectName, realText, "text", area); return new ValidationResult(spec, asList(new ValidationObject(area, objectName))); }
Source:
public void clear() { log.warn("All in memory locks are going to be cleaned"); globalLock.lock(); try { locks.clear(); releasedLock.signalAll(); } finally { globalLock.unlock(); } }

Target:
public void clear() { log.warn("Cleaning all in memory locks"); globalLock.lock(); try { locks.clear(); releasedLock.signalAll(); } finally { globalLock.unlock(); } }
Source:
private void launchCheckSetupCDK(IServer s, CDKServer cdkServer, ControllableServerBehavior beh) throws CoreException { CDK3Server cdk3 = (CDK3Server)cdkServer; if( !cdk3.isCDKInitialized()) { int[] retmain = new int[1]; retmain[0] = -1; String home = cdk3.getMinishiftHome(); Display.getDefault().syncExec(() -> { MessageBox messageBox = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.ICON_WARNING | SWT.OK | SWT.CANCEL); String msgText = "Your CDK installation has not been properly initialized. Would you like us to run setup-cdk for you?"; String msg = NLS.bind(msgText, home); messageBox.setMessage(msg); messageBox.setText("Warning: CDK has not been properly initialized!"); retmain[0] = messageBox.open(); }); if( retmain[0] == SWT.OK) { Job j = new SetupCDKJob(s, null, true); j.schedule(); try { j.join(); } catch (InterruptedException e) { } } if( !cdk3.isCDKInitialized()) { beh.setServerStopped(); throw new CoreException(CDKCoreActivator.statusFactory().errorStatus( "The server cannot be started until the CDK has been initialized.")); } } }

Target:
private void launchCheckSetupCDK(IServer s, CDKServer cdkServer, ControllableServerBehavior beh) throws CoreException { CDK3Server cdk3 = (CDK3Server)cdkServer; if( !cdk3.isCDKInitialized()) { int[] retmain = new int[1]; retmain[0] = -1; String home = cdk3.getMinishiftHome(); Display.getDefault().syncExec(() -> { Shell sh = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); String msgText = "Your CDK installation has not been properly initialized. Would you like us to run setup-cdk for you?"; String msg = NLS.bind(msgText, home); MessageDialog messageDialog = new MessageDialog(sh, "Warning: CDK has not been properly initialized!", null, msg, MessageDialog.WARNING, new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0); retmain[0] = messageDialog.open(); }); if( retmain[0] == IDialogConstants.OK_ID) { Job j = new SetupCDKJob(s, null, true); j.schedule(); try { j.join(); } catch (InterruptedException e) { } } if( !cdk3.isCDKInitialized()) { beh.setServerStopped(); throw new CoreException(CDKCoreActivator.statusFactory().errorStatus( "The server cannot be started until the CDK has been initialized.")); } } }
Source:
public static File copyDirectoryIfNonExistent(final FileSystem fileSystem, final String localDirectory) { try { final String hadoopGremlinLibsRemote = "hadoop-gremlin-" + Gremlin.version() + "-libs"; File file = new File(localDirectory); if ((Boolean.valueOf(System.getProperty("is.testing", "false")) || !file.exists()) && fileSystem.exists(new Path(localDirectory)) && fileSystem.isDirectory(new Path(localDirectory))) { final File tempDirectory = new File(System.getProperty("java.io.tmpdir") + "/" + hadoopGremlinLibsRemote); if (!tempDirectory.exists()) assert tempDirectory.mkdir(); final String tempPath = tempDirectory.getAbsolutePath() + "/" + new File(localDirectory).getName(); final RemoteIterator<LocatedFileStatus> files = fileSystem.listFiles(new Path(localDirectory), false); while (files.hasNext()) { final LocatedFileStatus f = files.next(); fileSystem.copyToLocalFile(f.getPath(), new Path(tempPath + "/" + f.getPath().getName())); } return new File(tempPath); } else return file; } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } }

Target:
public static File copyDirectoryIfNonExistent(final FileSystem fileSystem, final String localDirectory) { try { final String hadoopGremlinLibsRemote = "hadoop-gremlin-" + Gremlin.version() + "-libs"; File file = new File(localDirectory); if ((Boolean.valueOf(System.getProperty("is.testing", "false")) || !file.exists()) && fileSystem.exists(new Path(localDirectory)) && fileSystem.isDirectory(new Path(localDirectory))) { final File tempDirectory = new File(System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + hadoopGremlinLibsRemote); if (!tempDirectory.exists()) assert tempDirectory.mkdirs(); final String tempPath = tempDirectory.getAbsolutePath() + System.getProperty("file.separator") + new File(localDirectory).getName(); final RemoteIterator<LocatedFileStatus> files = fileSystem.listFiles(new Path(localDirectory), false); while (files.hasNext()) { final LocatedFileStatus f = files.next(); fileSystem.copyToLocalFile(f.getPath(), new Path(tempPath + System.getProperty("file.separator") + f.getPath().getName())); } return new File(tempPath); } else return file; } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } }
Source:
public ResultSet<ContextualStatistics> execute() { Map<Context, ContextualStatistics> contextualStatistics = new LinkedHashMap<Context, ContextualStatistics>(contexts.size()); Collection<ManagementProvider<?>> managementProviders = capabilityManagement.getManagementProvidersByCapability(capabilityName); for (Context context : contexts) { Map<String, Number> statistics = new HashMap<String, Number>(); for (ManagementProvider<?> managementProvider : managementProviders) { if (managementProvider.supports(context)) { for (Map.Entry<String, Number> entry : managementProvider.collectStatistics(context, statisticNames).entrySet()) { if (entry.getValue().doubleValue() != -1.0d) { statistics.put(entry.getKey(), entry.getValue()); } } } } contextualStatistics.put(context, new ContextualStatistics(capabilityName, context, statistics)); } return new DefaultResultSet<ContextualStatistics>(contextualStatistics); }

Target:
public ResultSet<ContextualStatistics> execute() { Map<Context, ContextualStatistics> contextualStatistics = new LinkedHashMap<Context, ContextualStatistics>(contexts.size()); Collection<ManagementProvider<?>> managementProviders = capabilityManagement.getManagementProvidersByCapability(capabilityName); for (Context context : contexts) { Map<String, Number> statistics = new HashMap<String, Number>(); for (ManagementProvider<?> managementProvider : managementProviders) { if (managementProvider.supports(context)) { for (Map.Entry<String, Number> entry : managementProvider.collectStatistics(context, statisticNames).entrySet()) { if (entry.getValue().doubleValue() >= 0) { statistics.put(entry.getKey(), entry.getValue()); } } } } contextualStatistics.put(context, new ContextualStatistics(capabilityName, context, statistics)); } return new DefaultResultSet<ContextualStatistics>(contextualStatistics); }
Source:
public FilteredClassLoader(URL[] urls, ClassLoader parent) { super(urls, null); delegatedClasses.add("org.apache.hadoop.fs.ozone.OzoneClientAdapter"); delegatedClasses.add("org.apache.hadoop.security.token.Token"); delegatedClasses.add("org.apache.hadoop.fs.ozone.BasicKeyInfo"); delegatedClasses.add("org.apache.hadoop.fs.ozone.OzoneFSOutputStream"); delegatedClasses.add("org.apache.hadoop.fs.ozone.OzoneFSStorageStatistics"); delegatedClasses.add("org.apache.hadoop.fs.ozone.Statistic"); delegatedClasses.add("org.apache.hadoop.fs.Seekable"); String[] dynamicDelegatedClasses = System.getProperty("HADOOP_OZONE_DELEGATED_CLASSES").split(";"); for (String delegatedClass : dynamicDelegatedClasses) { delegatedClasses.add(delegatedClass); } this.delegate = parent; systemClassLoader = getSystemClassLoader(); }

Target:
public FilteredClassLoader(URL[] urls, ClassLoader parent) { super(urls, null); delegatedClasses.add("org.apache.hadoop.fs.ozone.OzoneClientAdapter"); delegatedClasses.add("org.apache.hadoop.security.token.Token"); delegatedClasses.add("org.apache.hadoop.fs.ozone.BasicKeyInfo"); delegatedClasses.add("org.apache.hadoop.fs.ozone.OzoneFSOutputStream"); delegatedClasses.add("org.apache.hadoop.fs.ozone.OzoneFSStorageStatistics"); delegatedClasses.add("org.apache.hadoop.fs.ozone.Statistic"); delegatedClasses.add("org.apache.hadoop.fs.Seekable"); delegatedClasses.addAll(StringUtils.getTrimmedStringCollection( System.getenv("HADOOP_OZONE_DELEGATED_CLASSES"))); this.delegate = parent; systemClassLoader = getSystemClassLoader(); }
Source:
public void testAddCatalogItem() throws Exception { assertEquals(countCatalogPolicies(), 0); String registeredTypeName = "my.catalog.app.id.load"; addCatalogOSGiPolicy(registeredTypeName, SIMPLE_POLICY_TYPE); CatalogItem<?, ?> item = mgmt().getCatalog().getCatalogItem(registeredTypeName); assertEquals(item.getRegisteredTypeName(), registeredTypeName); assertEquals(countCatalogPolicies(), 1); }

Target:
public void testAddCatalogItem() throws Exception { assertEquals(countCatalogPolicies(), 0); String registeredTypeName = "my.catalog.policy.id.load"; addCatalogOSGiPolicy(registeredTypeName, SIMPLE_POLICY_TYPE); CatalogItem<?, ?> item = mgmt().getCatalog().getCatalogItem(registeredTypeName); assertEquals(item.getRegisteredTypeName(), registeredTypeName); assertEquals(countCatalogPolicies(), 1); deleteCatalogEntity(registeredTypeName); }
Source:
private List<LookupBean> getLookupListFromCoordinator(String tier) { try { boolean[] firstAttempt = new boolean[] {true}; Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry( () -> { if (firstAttempt[0]) { firstAttempt[0] = false; } else { Thread.sleep(60_000); } return tryGetLookupListFromCoordinator(tier); }, e -> true, lookupConfig.getCoordinatorFetchRetries() ); if (lookupMap != null) { List<LookupBean> lookupBeanList = new ArrayList<>(); lookupMap.forEach((k, v) -> lookupBeanList.add(new LookupBean(k, null, v))); return lookupBeanList; } else { return null; } } catch (Exception e) { LOG.error(e, "Error while trying to get lookup list from coordinator for tier[%s]", tier); return null; } }

Target:
private List<LookupBean> getLookupListFromCoordinator(String tier) { try { MutableBoolean firstAttempt = new MutableBoolean(true); Map<String, LookupExtractorFactoryContainer> lookupMap = RetryUtils.retry( () -> { if (firstAttempt.isTrue()) { firstAttempt.setValue(false); } else { Thread.sleep(60_000); } return tryGetLookupListFromCoordinator(tier); }, e -> true, lookupConfig.getCoordinatorFetchRetries() ); if (lookupMap != null) { List<LookupBean> lookupBeanList = new ArrayList<>(); lookupMap.forEach((k, v) -> lookupBeanList.add(new LookupBean(k, null, v))); return lookupBeanList; } else { return null; } } catch (Exception e) { LOG.error(e, "Error while trying to get lookup list from coordinator for tier[%s]", tier); return null; } }