auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Optional<String> uriForClip(Publisher publisher, Entry entry) { if (!entry.getAlternateLinks().isEmpty()) { Link link = (Link) entry.getAlternateLinks().get(0); return Optional.of(link.getHref()); } else { Element mediaGroup = C4AtomApi.mediaGroup(entry); if (mediaGroup == null) { return null; } Element player = mediaGroup.getChild("player", C4AtomApi.NS_MEDIA_RSS); if (player == null) { return null; } return Optional.of(player.getAttributeValue("url")); } }

Target:
public Optional<String> uriForClip(Publisher publisher, Entry entry) { List alternateLinks = entry.getAlternateLinks(); if (!alternateLinks.isEmpty()) { java.util.Optional<Link> odLink = ((List<Link>) alternateLinks).stream() .filter(link -> "4oD".equals(link.getTitle())) .findFirst(); if (odLink.isPresent()) { return Optional.of(odLink.get().getHref()); } } Element mediaGroup = C4AtomApi.mediaGroup(entry); if (mediaGroup == null) { return null; } Element player = mediaGroup.getChild("player", C4AtomApi.NS_MEDIA_RSS); if (player == null) { return null; } return Optional.of(player.getAttributeValue("url")); }
Source:
private void parse() throws IOException { stream.mark(0); try { byte[] curIdentifier = new byte[3]; for (int i = 0; i < curIdentifier.length; i++) { curIdentifier[i] = stream.readByte(); } setIdentifier(new String(curIdentifier)); setFileVersion(stream.readByte()); setNumberOfEntries(Integer.reverseBytes(stream.readInt())); for (InfiniumFileTOC toc : getTableOfContents()) { stream.reset(); readData(stream, toc); } if (numCalls == 0) { numCalls = aaCalls + abCalls + bbCalls; } } finally { stream.close(); } if ((normalizationManifest != null) && (normalizationManifest.getNormIds() != null)) { normalizeIntensities(); } }

Target:
private void parse() throws IOException { stream.mark(0); try { final byte[] curIdentifier = new byte[IDENTIFIER_LENGTH]; for (int i = 0; i < curIdentifier.length; i++) { curIdentifier[i] = stream.readByte(); } final String identifier = new String(curIdentifier); setIdentifier(identifier); if (!identifier.equals(GTC_IDENTIFIER)) { throw new PicardException("Invalid identifier '" + identifier + "' for GTC file"); } setFileVersion(stream.readByte()); setNumberOfEntries(Integer.reverseBytes(stream.readInt())); for (InfiniumFileTOC toc : getTableOfContents()) { stream.reset(); readData(stream, toc); } if (numCalls == 0) { numCalls = aaCalls + abCalls + bbCalls; } } finally { stream.close(); } if ((normalizationManifest != null) && (normalizationManifest.getNormIds() != null)) { normalizeIntensities(); } }
Source:
private void addAttribute(XMLExtendedStreamReader reader, ModelNode operation, SimpleAttributeDefinition attributeDefinition) throws XMLStreamException { String value = rawAttributeText(reader, attributeDefinition.getXmlName(), attributeDefinition.getDefaultValue().asString()); if (value != null) { attributeDefinition.parseAndSetParameter(value, operation, reader); } else { throw missingRequired(reader, attributeDefinition.getXmlName()); } }

Target:
private void addAttribute(XMLExtendedStreamReader reader, ModelNode operation, SimpleAttributeDefinition attributeDefinition) throws XMLStreamException { String value = rawAttributeText(reader, attributeDefinition.getXmlName(), null); if (value != null) { attributeDefinition.parseAndSetParameter(value, operation, reader); } }
Source:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); if (!getParameters().isDetailRequired() && StringUtils.isEmpty(volumeName)) { volumeName = getVolumeName(getParameters().getClusterId()); } if (StringUtils.isEmpty(volumeName)) { log.error("No volumes found in the cluster."); getQueryReturnValue().setReturnValue(new GlusterVolumeAdvancedDetails()); return; } try { VDSReturnValue returnValue = getBackendResourceManager().RunVdsCommand(VDSCommandType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsVDSParameters(getUpServerId(getParameters().getClusterId()), getParameters().getClusterId(), volumeName, getParameters().getBrickName(), getParameters().isDetailRequired())); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); } catch (RuntimeException e) { log.error(e.getMessage()); getQueryReturnValue().setReturnValue(new GlusterVolumeAdvancedDetails()); } }

Target:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); if (!getParameters().isDetailRequired() && StringUtils.isEmpty(volumeName)) { volumeName = getVolumeName(getParameters().getClusterId()); } if (StringUtils.isEmpty(volumeName)) { log.error("No volumes found in the cluster."); getQueryReturnValue().setReturnValue(new GlusterVolumeAdvancedDetails()); return; } VDSReturnValue returnValue = getBackendResourceManager().RunVdsCommand(VDSCommandType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsVDSParameters(getUpServerId(getParameters().getClusterId()), getParameters().getClusterId(), volumeName, getParameters().getBrickName(), getParameters().isDetailRequired())); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); }
Source:
public View getView(int position, View view, ViewGroup container) { final Photo current = photos.get(position); final ViewHolder viewHolder; if (view == null) { view = inflater.inflate(R.layout.flickr_photo_list_item, container, false); final ImageView imageView = (ImageView) view.findViewById(R.id.photo_view); TextView titleView = (TextView) view.findViewById(R.id.title_view); viewHolder = new ViewHolder(imageView, titleView); view.setTag(viewHolder); if (photoDimens == null) { photoDimens = new int[]{imageView.getWidth(), imageView.getHeight()}; } } else { viewHolder = (ViewHolder) view.getTag(); } fullRequest .thumbnail(thumbRequest.load(current)) .load(current) .into(viewHolder.imageView); viewHolder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = FullscreenActivity.getIntent(getActivity(), current); startActivity(intent); } }); viewHolder.titleText.setText(current.getTitle()); return view; }

Target:
public View getView(int position, View view, ViewGroup container) { final Photo current = photos.get(position); final ViewHolder viewHolder; if (view == null) { view = inflater.inflate(R.layout.flickr_photo_list_item, container, false); final ImageView imageView = (ImageView) view.findViewById(R.id.photo_view); TextView titleView = (TextView) view.findViewById(R.id.title_view); viewHolder = new ViewHolder(imageView, titleView); view.setTag(viewHolder); preloadSizeProvider.setView(imageView); } else { viewHolder = (ViewHolder) view.getTag(); } fullRequest .thumbnail(thumbRequest.load(current)) .load(current) .into(viewHolder.imageView); viewHolder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = FullscreenActivity.getIntent(getActivity(), current); startActivity(intent); } }); viewHolder.titleText.setText(current.getTitle()); return view; }
Source:
public StatusInfo getStatusInfo() { StatusInfo.Builder builder = StatusInfo.Builder.newBuilder(); int upReplicasCount = 0; StringBuilder upReplicas = new StringBuilder(); StringBuilder downReplicas = new StringBuilder(); StringBuilder replicaHostNames = new StringBuilder(); for (PeerEurekaNode node : peerEurekaNodes.getPeerEurekaNodes()) { if (replicaHostNames.length() > 0) { replicaHostNames.append(", "); } replicaHostNames.append(node.getServiceUrl()); if (isReplicaAvailable(node.getServiceUrl())) { upReplicas.append(node.getServiceUrl()).append(','); upReplicasCount++; } else { downReplicas.append(node.getServiceUrl()).append(','); } } builder.add("registered-replicas", replicaHostNames.toString()); builder.add("available-replicas", upReplicas.toString()); builder.add("unavailable-replicas", downReplicas.toString()); if (peerEurekaNodes.getMinNumberOfAvailablePeers() > 0) { builder.isHealthy(upReplicasCount >= peerEurekaNodes.getMinNumberOfAvailablePeers()); } return builder.build(); }

Target:
public StatusInfo getStatusInfo() { StatusInfo.Builder builder = StatusInfo.Builder.newBuilder(); int upReplicasCount = 0; StringBuilder upReplicas = new StringBuilder(); StringBuilder downReplicas = new StringBuilder(); StringBuilder replicaHostNames = new StringBuilder(); for (PeerEurekaNode node : peerEurekaNodes.getPeerEurekaNodes()) { if (replicaHostNames.length() > 0) { replicaHostNames.append(", "); } replicaHostNames.append(node.getServiceUrl()); if (isReplicaAvailable(node.getServiceUrl())) { upReplicas.append(node.getServiceUrl()).append(','); upReplicasCount++; } else { downReplicas.append(node.getServiceUrl()).append(','); } } builder.add("registered-replicas", replicaHostNames.toString()); builder.add("available-replicas", upReplicas.toString()); builder.add("unavailable-replicas", downReplicas.toString()); if (peerEurekaNodes.getMinNumberOfAvailablePeers() > -1) { builder.isHealthy(upReplicasCount >= peerEurekaNodes.getMinNumberOfAvailablePeers()); } return builder.build(); }
Source:
JMSContext getDelegate() { boolean inTx = isInTransaction(); AbstractJMSContext jmsContext = inTx ? transactedJMSContext.get() : requestedJMSContext; if(inTx) { Object alreadyRegistered = transactionSynchronizationRegistry.getResource(AfterCompletionSynchronization.class.getName()); if (alreadyRegistered == null) { transactionSynchronizationRegistry.registerInterposedSynchronization(new AfterCompletionSynchronization(jmsContext)); transactionSynchronizationRegistry.putResource(AfterCompletionSynchronization.class.getName(), true); } } ROOT_LOGGER.debugf("using %s to create the injected JMSContext", jmsContext, id); ConnectionFactory connectionFactory = getConnectionFactory(); return jmsContext.getContext(id, info, connectionFactory); }

Target:
JMSContext getDelegate() { boolean inTx = isInTransaction(); AbstractJMSContext jmsContext = inTx ? transactedJMSContext.get() : requestedJMSContext; ROOT_LOGGER.debugf("using %s to create the injected JMSContext", jmsContext, id); ConnectionFactory connectionFactory = getConnectionFactory(); JMSContext contextInstance = jmsContext.getContext(id, info, connectionFactory); if(inTx) { TransactedJMSContext transactedJMSContext = (TransactedJMSContext)jmsContext; transactedJMSContext.registerCleanUpListener(transactionSynchronizationRegistry, contextInstance); } return contextInstance; }
Source:
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark, long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException, AttributeNotFoundException, StateSystemDisposedException { if (isDisposed) { throw new StateSystemDisposedException(); } List<ITmfStateInterval> intervals = new LinkedList<>(); ITmfStateInterval currentInterval; long ts, tEnd; IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } if (t2 < t1 || resolution <= 0) { throw new TimeRangeException(); } if (t2 > this.getCurrentEndTime()) { tEnd = this.getCurrentEndTime(); } else { tEnd = t2; } for (ts = t1; ts <= tEnd; ts += ((currentInterval.getEndTime() - ts) / resolution + 1) * resolution) { if (mon.isCanceled()) { return intervals; } currentInterval = querySingleState(ts, attributeQuark); intervals.add(currentInterval); } return intervals; }

Target:
public List<ITmfStateInterval> queryHistoryRange(int attributeQuark, long t1, long t2, long resolution, IProgressMonitor monitor) throws TimeRangeException, AttributeNotFoundException, StateSystemDisposedException { if (isDisposed) { throw new StateSystemDisposedException(); } List<ITmfStateInterval> intervals = new LinkedList<>(); ITmfStateInterval currentInterval = null; long ts, tEnd; IProgressMonitor mon = monitor; if (mon == null) { mon = new NullProgressMonitor(); } if (t2 < t1 || resolution <= 0) { throw new TimeRangeException(); } if (t2 > this.getCurrentEndTime()) { tEnd = this.getCurrentEndTime(); } else { tEnd = t2; } for (ts = t1; ts <= tEnd; ts += ((currentInterval.getEndTime() - ts) / resolution + 1) * resolution) { if (mon.isCanceled()) { return intervals; } currentInterval = querySingleState(ts, attributeQuark); intervals.add(currentInterval); } if (currentInterval != null && currentInterval.getEndTime() < tEnd) { currentInterval = querySingleState(tEnd, attributeQuark); intervals.add(currentInterval); } return intervals; }
Source:
public static void blockChi(final Player player) { if (Suffocate.isChannelingSphere(player)) { Suffocate.remove(player); } final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { return; } bPlayer.blockChi(); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_HURT, 2, 0); long start = System.currentTimeMillis(); new BukkitRunnable() { @Override public void run() { ActionBar.sendActionBar(ChatColor.GOLD + "* Chiblocked *", player); if (System.currentTimeMillis() >= start + getDuration()) { bPlayer.unblockChi(); cancel(); } } }.runTaskTimer(ProjectKorra.plugin, 0, 1); }

Target:
public static void blockChi(final Player player) { if (Suffocate.isChannelingSphere(player)) { Suffocate.remove(player); } final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { return; } bPlayer.blockChi(); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ENDERDRAGON_HURT, 2, 0); long start = System.currentTimeMillis(); new BukkitRunnable() { @Override public void run() { ActionBar.sendActionBar(Element.CHI.getColor() + "* Chiblocked *", player); if (System.currentTimeMillis() >= start + getDuration()) { bPlayer.unblockChi(); cancel(); } } }.runTaskTimer(ProjectKorra.plugin, 0, 1); }
Source:
public Map<String, List<String>> parseHeader(String experimentAccession) { try (TsvStreamer sdrfStreamer = dataFileHub.getExperimentFiles(experimentAccession).sdrf.get()) { Pattern pattern = Pattern.compile("(.*?)(\\[)(.*?)(].*)"); Map<String, List<String>> headers = new HashMap<>(); Arrays.stream( sdrfStreamer .get() .findFirst() .orElse(new String[0])) .filter(x -> x.toLowerCase().contains("characteristic") || x.toLowerCase().contains("factor")) .forEach(header -> { Matcher matcher = pattern.matcher(header); if (matcher.matches()) { String headerType = matcher.group(1).trim().toLowerCase(); String headerValue = matcher.group(3); if (headers.containsKey(headerType)) { headers.get(headerType).add(headerValue); } else { List<String> headerValues = new ArrayList<>(); headerValues.add(headerValue); headers.put(headerType, headerValues); } } }); return headers; } }

Target:
public Map<String, Set<String>> parseHeader(String experimentAccession) { try (TsvStreamer sdrfStreamer = dataFileHub.getExperimentFiles(experimentAccession).sdrf.get()) { Pattern pattern = Pattern.compile("(.*?)(\\[)(.*?)(].*)"); return Arrays.stream( sdrfStreamer .get() .findFirst() .orElse(new String[0])) .filter(x -> x.toLowerCase().contains("characteristic") || x.toLowerCase().contains("factor")) .filter(x -> x.matches(pattern.toString())) .map(header -> { Matcher matcher = pattern.matcher(header); String headerType = ""; String headerValue = ""; if (matcher.matches()) { headerType = StringUtils.trimAllWhitespace(matcher.group(1)).toLowerCase(); headerValue = matcher.group(3).trim().toLowerCase(); } return new ImmutablePair<>(headerType, headerValue); }) .collect( Collectors.groupingBy( ImmutablePair::getLeft, Collectors.mapping( ImmutablePair::getRight, Collectors.toCollection(LinkedHashSet::new)))); } }
Source:
public static void setValue(DBObject entity, String column, Object value) { String[] path = column.split( "\\." ); Object field = entity; int size = path.length; for (int index = 0 ; index < size ; index++) { String node = path[index]; DBObject parent = (DBObject) field; field = parent.get( node ); if ( field == null ) { if ( index == size - 1 ) { field = value; } else { field = new BasicDBObject(); } parent.put( node, field ); } } }

Target:
public static void setValue(DBObject entity, String column, Object value) { String[] path = DOT_SEPARATOR_PATTERN.split( column ); Object field = entity; int size = path.length; for (int index = 0 ; index < size ; index++) { String node = path[index]; DBObject parent = (DBObject) field; field = parent.get( node ); if ( field == null ) { if ( index == size - 1 ) { field = value; } else { field = new BasicDBObject(); } parent.put( node, field ); } } }
Source:
public boolean handlesURI(URI uri) { return servers.containsKey(createKey(uri)); }

Target:
public boolean handlesURI(URI uri) { checkURI(uri); return SERVERS.containsKey(uri); }
Source:
private void loadProperties(String configFile) { ObjectMapper jsonMapper = new ObjectMapper(); try { props = jsonMapper.readValue( new File(configFile), new TypeReference<Map<String, String>>() { } ); } catch (IOException ex) { throw new RuntimeException(ex); } routerHost = props.get("router_host") + ":" + props.get("router_port"); brokerHost = props.get("broker_host") + ":" + props.get("broker_port"); historicalHost = props.get("historical_host") + ":" + props.get("historical_port"); coordinatorHost = props.get("coordinator_host") + ":" + props.get("coordinator_port"); indexerHost = props.get("indexer_host") + ":" + props.get("indexer_port"); middleManagerHost = props.get("middlemanager_host"); zookeeperHosts = props.get("zookeeper_hosts"); LOG.info ("router: " + routerHost); LOG.info ("broker: " + brokerHost); LOG.info ("coordinator: " + coordinatorHost); LOG.info ("overlord: " + indexerHost); LOG.info ("middle manager: " + middleManagerHost); LOG.info ("zookeepers: " + zookeeperHosts); }

Target:
private void loadProperties(String configFile) { ObjectMapper jsonMapper = new ObjectMapper(); try { props = jsonMapper.readValue( new File(configFile), new TypeReference<Map<String, String>>() { } ); } catch (IOException ex) { throw new RuntimeException(ex); } routerHost = props.get("router_host") + ":" + props.get("router_port"); brokerHost = props.get("broker_host") + ":" + props.get("broker_port"); historicalHost = props.get("historical_host") + ":" + props.get("historical_port"); coordinatorHost = props.get("coordinator_host") + ":" + props.get("coordinator_port"); indexerHost = props.get("indexer_host") + ":" + props.get("indexer_port"); middleManagerHost = props.get("middlemanager_host"); zookeeperHosts = props.get("zookeeper_hosts"); LOG.info ("router: [%s]", routerHost); LOG.info ("broker [%s]: ", brokerHost); LOG.info ("coordinator: [%s]", coordinatorHost); LOG.info ("overlord: [%s]", indexerHost); LOG.info ("middle manager: [%s]", middleManagerHost); LOG.info ("zookeepers: [%s]", zookeeperHosts); }
Source:
private Iterable<T> filter(Iterable<T> messages, StreamObserver<IsSent> observer) { checkNotNull(messages); checkNotNull(observer); final Collection<T> result = new LinkedList<>(); for (T message : messages) { final Optional<IsSent> response = preProcess(toEnvelope(message)); if (response.isPresent()) { observer.onNext(response.get()); } else { result.add(message); } } return result; }

Target:
private Iterable<T> filter(Iterable<T> messages, StreamObserver<IsSent> observer) { checkNotNull(messages); checkNotNull(observer); final Collection<T> result = newLinkedList(); for (T message : messages) { final Optional<IsSent> response = preProcess(toEnvelope(message)); if (response.isPresent()) { observer.onNext(response.get()); } else { result.add(message); } } return result; }
Source:
public void updateNetworks(final Guid vmId, final List<NicWithLogicalNetworks> nicsWithLogicalNetworks) { ArrayList<VdcActionParametersBase> parameters = createAddVmInterfaceParams(vmId, nicsWithLogicalNetworks); if (parameters.size() == 0) { callback.networkCreated(); return; } updateNetworksFromParams(vmId, parameters); }

Target:
public void updateNetworks(final Guid vmId, final List<NicWithLogicalNetworks> nicsWithLogicalNetworks) { updateNetworksFromParams(vmId, createAddVmInterfaceParams(vmId, nicsWithLogicalNetworks)); }
Source:
public JSONArray getPlatformPluginList() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); JSONArray initialPluginList = null; updateSiteList: for (UpdateSite updateSite : Jenkins.getInstance().getUpdateCenter().getSiteList()) { String updateCenterJsonUrl = updateSite.getUrl(); String suggestedPluginUrl = updateCenterJsonUrl.replace("/update-center.json", "/platform-plugins.json"); try { URLConnection connection = ProxyConfiguration.open(new URL(suggestedPluginUrl)); try { if(connection instanceof HttpURLConnection) { int responseCode = ((HttpURLConnection)connection).getResponseCode(); if(HttpURLConnection.HTTP_OK != responseCode) { throw new HttpRetryException("Invalid response code (" + responseCode + ") from URL: " + suggestedPluginUrl, responseCode); } } String initialPluginJson = IOUtils.toString(connection.getInputStream(), "utf-8"); initialPluginList = JSONArray.fromObject(initialPluginJson); break updateSiteList; } catch(Exception e) { LOGGER.log(Level.FINE, e.getMessage(), e); continue updateSiteList; } } catch(Exception e) { LOGGER.log(Level.FINE, e.getMessage(), e); } } if (initialPluginList == null) { try { ClassLoader cl = getClass().getClassLoader(); URL localPluginData = cl.getResource("jenkins/install/platform-plugins.json"); String initialPluginJson = IOUtils.toString(localPluginData.openStream(), "utf-8"); initialPluginList = JSONArray.fromObject(initialPluginJson); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } return initialPluginList; }

Target:
JSONArray getPlatformPluginList() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); JSONArray initialPluginList = null; updateSiteList: for (UpdateSite updateSite : Jenkins.getInstance().getUpdateCenter().getSiteList()) { String updateCenterJsonUrl = updateSite.getUrl(); String suggestedPluginUrl = updateCenterJsonUrl.replace("/update-center.json", "/platform-plugins.json"); try { URLConnection connection = ProxyConfiguration.open(new URL(suggestedPluginUrl)); try { if(connection instanceof HttpURLConnection) { int responseCode = ((HttpURLConnection)connection).getResponseCode(); if(HttpURLConnection.HTTP_OK != responseCode) { throw new HttpRetryException("Invalid response code (" + responseCode + ") from URL: " + suggestedPluginUrl, responseCode); } } String initialPluginJson = IOUtils.toString(connection.getInputStream(), "utf-8"); initialPluginList = JSONArray.fromObject(initialPluginJson); break updateSiteList; } catch(Exception e) { LOGGER.log(Level.FINE, e.getMessage(), e); continue updateSiteList; } } catch(Exception e) { LOGGER.log(Level.FINE, e.getMessage(), e); } } if (initialPluginList == null) { try { ClassLoader cl = getClass().getClassLoader(); URL localPluginData = cl.getResource("jenkins/install/platform-plugins.json"); String initialPluginJson = IOUtils.toString(localPluginData.openStream(), "utf-8"); initialPluginList = JSONArray.fromObject(initialPluginJson); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } return initialPluginList; }
Source:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } if (vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterPeerProcess()); } runVdsCommand(VDSCommandType.GetBiosInfo, new VdsIdAndVdsVDSCommandParametersBase(getVds())); }

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } if (vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterPeerProcess()); } }
Source:
private void populateCommands(final PatchSetDetail detail) { for (final UiCommandDetail cmd : detail.getCommands()) { final Button b = new Button(cmd.label); b.setEnabled(cmd.enabled); b.setTitle(cmd.title); b.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { b.setEnabled(false); AsyncCallback<NativeString> cb = new AsyncCallback<NativeString>() { @Override public void onFailure(Throwable caught) { b.setEnabled(true); new ErrorDialog(caught).center(); } @Override public void onSuccess(NativeString msg) { b.setEnabled(true); if (!msg.toString().isEmpty()) { Window.alert(msg.asString()); } } }; RestApi api = ChangeApi.revision(patchSet.getId()).view(cmd.id); if ("PUT".equalsIgnoreCase(cmd.method)) { api.put(JavaScriptObject.createObject(), cb); } else if ("DELETE".equalsIgnoreCase(cmd.method)) { api.delete(cb); } else { api.post(JavaScriptObject.createObject(), cb); } } }); actionsPanel.add(b); } }

Target:
private void populateCommands(final PatchSetDetail detail) { for (final UiCommandDetail cmd : detail.getCommands()) { final Button b = new Button(cmd.label); b.setEnabled(cmd.enabled); b.setTitle(cmd.title); b.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { b.setEnabled(false); AsyncCallback<NativeString> cb = new AsyncCallback<NativeString>() { @Override public void onFailure(Throwable caught) { b.setEnabled(true); new ErrorDialog(caught).center(); } @Override public void onSuccess(NativeString msg) { b.setEnabled(true); if (msg != null && !msg.asString().isEmpty()) { Window.alert(msg.asString()); } } }; RestApi api = ChangeApi.revision(patchSet.getId()).view(cmd.id); if ("PUT".equalsIgnoreCase(cmd.method)) { api.put(JavaScriptObject.createObject(), cb); } else if ("DELETE".equalsIgnoreCase(cmd.method)) { api.delete(cb); } else { api.post(JavaScriptObject.createObject(), cb); } } }); actionsPanel.add(b); } }
Source:
public static Builder fromEnv() throws DockerCertificateException { final DockerUtils dockerUtils = new DockerUtils(); final String endpoint = fromNullable(getenv("DOCKER_HOST")) .or(dockerUtils.defaultDockerEndpoint()); final Path dockerCertPath = Paths.get(fromNullable(getenv("DOCKER_CERT_PATH")) .or(dockerUtils.defaultCertPath())); final Builder builder = new Builder(); final Optional<DockerCertificates> certs = DockerCertificates.builder() .dockerCertPath(dockerCertPath).build(); if (endpoint.startsWith(UNIX_SCHEME + "://")) { builder.uri(endpoint); } else { final String stripped = endpoint.replaceAll(".*://", ""); final HostAndPort hostAndPort = HostAndPort.fromString(stripped); final String hostText = hostAndPort.getHostText(); final String scheme = certs.isPresent() ? "https" : "http"; final int port = hostAndPort.getPortOrDefault(DEFAULT_PORT); final String address = isNullOrEmpty(hostText) ? DEFAULT_HOST : hostText; builder.uri(scheme + "://" + address + ":" + port); } if (certs.isPresent()) { builder.dockerCertificates(certs.get()); } return builder; }

Target:
public static Builder fromEnv() throws DockerCertificateException { final String endpoint = DockerHost.endpointFromEnv(); final Path dockerCertPath = Paths.get(DockerHost.certPathFromEnv()); final Builder builder = new Builder(); final Optional<DockerCertificates> certs = DockerCertificates.builder() .dockerCertPath(dockerCertPath).build(); if (endpoint.startsWith(UNIX_SCHEME + "://")) { builder.uri(endpoint); } else { final String stripped = endpoint.replaceAll(".*://", ""); final HostAndPort hostAndPort = HostAndPort.fromString(stripped); final String hostText = hostAndPort.getHostText(); final String scheme = certs.isPresent() ? "https" : "http"; final int port = hostAndPort.getPortOrDefault(DockerHost.defaultPort()); final String address = isNullOrEmpty(hostText) ? DockerHost.defaultAddress() : hostText; builder.uri(scheme + "://" + address + ":" + port); } if (certs.isPresent()) { builder.dockerCertificates(certs.get()); } return builder; }
Source:
public void removeExpiredEntriesFromListing(long ttl, long now) { final Iterator<Map.Entry<Path, PathMetadata>> iterator = listMap.entrySet().iterator(); while(iterator.hasNext()) { final Map.Entry<Path, PathMetadata> entry = iterator.next(); if (entry.getValue().getLastUpdated() != 0 && (entry.getValue().getLastUpdated() + ttl) <= now) { iterator.remove(); } } }

Target:
public synchronized void removeExpiredEntriesFromListing(long ttl, long now) { final Iterator<Map.Entry<Path, PathMetadata>> iterator = listMap.entrySet().iterator(); while (iterator.hasNext()) { final Map.Entry<Path, PathMetadata> entry = iterator.next(); if (entry.getValue().getLastUpdated() != 0 && (entry.getValue().getLastUpdated() + ttl) <= now) { iterator.remove(); } } }
Source:
public final void handle(EventMessage<?> event) { if (isActive) { metaModel.findHandlerMethods(event).stream() .filter(h -> h.unwrap(SagaMethodMessageHandlingMember.class) .map(sh -> getAssociationValues().contains(sh.getAssociationValue(event))) .orElse(true)) .findFirst().ifPresent(h -> { try { executeWithResult(() -> h.handle(event, sagaInstance)); if (event instanceof TrackedEventMessage) { this.trackingToken.set(((TrackedEventMessage) event).trackingToken()); } } catch (RuntimeException | Error e) { throw e; } catch (Exception e) { throw new SagaExecutionException("Exception while handling an Event in a Saga", e); } finally { if (isEndingHandler(h)) { doEnd(); } } }); } }

Target:
public final void handle(EventMessage<?> event) { if (isActive) { metaModel.findHandlerMethods(event).stream() .filter(handler -> handler.unwrap(SagaMethodMessageHandlingMember.class) .map(sh -> getAssociationValues() .contains(sh.getAssociationValue(event))) .orElse(true)) .findFirst() .ifPresent(handler -> handle(handler, event)); } }
Source:
public void executeAction(final WorkflowProcessor processor, final Map<String, WorkflowActionClassParameter> params) throws WorkflowActionFailureException { try { final Contentlet contentlet = processor.getContentlet(); Logger.debug(this, "Saving the content of the contentlet: " + contentlet.getIdentifier()); final Contentlet checkoutContentlet = this.contentletAPI.checkout (contentlet.getInode(), processor.getUser(), false); checkoutContentlet.setProperty(Contentlet.WORKFLOW_IN_PROGRESS, Boolean.TRUE); this.contentletAPI.checkin( checkoutContentlet, processor.getUser(), false); Logger.debug(this, "content version already saved for the contentlet: " + contentlet.getIdentifier()); } catch (Exception e) { Logger.error(this.getClass(),e.getMessage(),e); throw new WorkflowActionFailureException(e.getMessage()); } }

Target:
public void executeAction(final WorkflowProcessor processor, final Map<String, WorkflowActionClassParameter> params) throws WorkflowActionFailureException { try { final Contentlet contentlet = processor.getContentlet(); Logger.debug(this, "Saving the content of the contentlet: " + contentlet.getIdentifier()); final Contentlet checkoutContentlet = this.contentletAPI.checkout (contentlet.getInode(), processor.getUser(), false); final String inode = checkoutContentlet.getInode(); this.contentletAPI.copyProperties(checkoutContentlet, contentlet.getMap()); checkoutContentlet.setInode(inode); checkoutContentlet.setProperty(Contentlet.WORKFLOW_IN_PROGRESS, Boolean.TRUE); final Contentlet contentletNew = this.contentletAPI.checkin( checkoutContentlet, processor.getUser(), false); processor.setContentlet(contentletNew); Logger.debug(this, "content version already saved for the contentlet: " + contentlet.getIdentifier()); } catch (Exception e) { Logger.error(this.getClass(),e.getMessage(),e); throw new WorkflowActionFailureException(e.getMessage()); } }
Source:
protected void onHandleIntent(Intent intent) { if (sWasRun) return; scheduleDeckReminder(); scheduleNotification(this); sWasRun = true; }

Target:
protected void onHandleIntent(Intent intent) { if (sWasRun) { return; } scheduleDeckReminder(); scheduleNotification(this); sWasRun = true; }
Source:
public void signInWithIntentToParticipate() throws Exception { account.setId(USER_ID); Account consentedAccount = new GenericAccount(); StudyParticipant consentedParticipant = new StudyParticipant.Builder().build(); doReturn(account).when(accountDao).authenticate(study, EMAIL_PASSWORD_SIGN_IN); doReturn(PARTICIPANT).when(participantService).getParticipant(study, account, false); doReturn(UNCONSENTED_STATUS_MAP).when(consentService).getConsentStatuses(any(), eq(account)); doReturn(consentedAccount).when(accountDao).getAccount(any()); doReturn(consentedParticipant).when(participantService).getParticipant(study, consentedAccount, false); doReturn(CONSENTED_STATUS_MAP).when(consentService).getConsentStatuses(any(), eq(consentedAccount)); when(intentService.registerIntentToParticipate(study, account)).thenReturn(true); service.signIn(study, CONTEXT, EMAIL_PASSWORD_SIGN_IN); }

Target:
public void signInWithIntentToParticipate() throws Exception { account.setId(USER_ID); Account consentedAccount = Account.create(); StudyParticipant consentedParticipant = new StudyParticipant.Builder().build(); doReturn(account).when(accountDao).authenticate(study, EMAIL_PASSWORD_SIGN_IN); doReturn(PARTICIPANT).when(participantService).getParticipant(study, account, false); doReturn(UNCONSENTED_STATUS_MAP).when(consentService).getConsentStatuses(any(), eq(account)); doReturn(consentedAccount).when(accountDao).getAccount(any()); doReturn(consentedParticipant).when(participantService).getParticipant(study, consentedAccount, false); doReturn(CONSENTED_STATUS_MAP).when(consentService).getConsentStatuses(any(), eq(consentedAccount)); when(intentService.registerIntentToParticipate(study, account)).thenReturn(true); service.signIn(study, CONTEXT, EMAIL_PASSWORD_SIGN_IN); }
Source:
protected Map<String, Object> getJMSProperties(Mail mail, long nextDelivery) throws MessagingException { Map<String, Object> props = new HashMap<>(); props.put(JAMES_NEXT_DELIVERY, nextDelivery); props.put(JAMES_MAIL_ERROR_MESSAGE, mail.getErrorMessage()); props.put(JAMES_MAIL_LAST_UPDATED, mail.getLastUpdated().getTime()); props.put(JAMES_MAIL_MESSAGE_SIZE, mail.getMessageSize()); props.put(JAMES_MAIL_NAME, mail.getName()); if (!mail.getPerRecipientSpecificHeaders().getHeadersByRecipient().isEmpty()) { byte[] serialize = SerializationUtils.serialize(mail.getPerRecipientSpecificHeaders()); props.put(JAMES_MAIL_PER_RECIPIENT_HEADERS, Hex.encodeHexString(serialize)); } String recipientsBuilder = Joiner.on(JAMES_MAIL_SEPARATOR).skipNulls().join(mail.getRecipients()); props.put(JAMES_MAIL_RECIPIENTS, recipientsBuilder); props.put(JAMES_MAIL_REMOTEADDR, mail.getRemoteAddr()); props.put(JAMES_MAIL_REMOTEHOST, mail.getRemoteHost()); String sender = Optional.ofNullable(mail.getSender()).map(MailAddress::toString).orElse(""); StringBuilder attrsBuilder = new StringBuilder(); Iterator<String> attrs = mail.getAttributeNames(); while (attrs.hasNext()) { String attrName = attrs.next(); attrsBuilder.append(attrName); Object value = convertAttributeValue(mail.getAttribute(attrName)); props.put(attrName, value); if (attrs.hasNext()) { attrsBuilder.append(JAMES_MAIL_SEPARATOR); } } props.put(JAMES_MAIL_ATTRIBUTE_NAMES, attrsBuilder.toString()); props.put(JAMES_MAIL_SENDER, sender); props.put(JAMES_MAIL_STATE, mail.getState()); return props; }

Target:
protected Map<String, Object> getJMSProperties(Mail mail, long nextDelivery) throws MessagingException { Map<String, Object> props = new HashMap<>(); props.put(JAMES_NEXT_DELIVERY, nextDelivery); props.put(JAMES_MAIL_ERROR_MESSAGE, mail.getErrorMessage()); props.put(JAMES_MAIL_LAST_UPDATED, mail.getLastUpdated().getTime()); props.put(JAMES_MAIL_MESSAGE_SIZE, mail.getMessageSize()); props.put(JAMES_MAIL_NAME, mail.getName()); if (!mail.getPerRecipientSpecificHeaders().getHeadersByRecipient().isEmpty()) { byte[] serialize = SerializationUtils.serialize(mail.getPerRecipientSpecificHeaders()); props.put(JAMES_MAIL_PER_RECIPIENT_HEADERS, Base64.encodeBase64String(serialize)); } String recipientsAsString = Joiner.on(JAMES_MAIL_SEPARATOR).skipNulls().join(mail.getRecipients()); props.put(JAMES_MAIL_RECIPIENTS, recipientsAsString); props.put(JAMES_MAIL_REMOTEADDR, mail.getRemoteAddr()); props.put(JAMES_MAIL_REMOTEHOST, mail.getRemoteHost()); String sender = Optional.ofNullable(mail.getSender()).map(MailAddress::asString).orElse(""); StringBuilder attrsBuilder = new StringBuilder(); Iterator<String> attrs = mail.getAttributeNames(); while (attrs.hasNext()) { String attrName = attrs.next(); attrsBuilder.append(attrName); Object value = convertAttributeValue(mail.getAttribute(attrName)); props.put(attrName, value); if (attrs.hasNext()) { attrsBuilder.append(JAMES_MAIL_SEPARATOR); } } props.put(JAMES_MAIL_ATTRIBUTE_NAMES, attrsBuilder.toString()); props.put(JAMES_MAIL_SENDER, sender); props.put(JAMES_MAIL_STATE, mail.getState()); return props; }
Source:
private Map<Integer, Question> getPreGeneratedQuestions(final Long accountId, final DateTime today) { final DateTime expiration = today.plusDays(1); final ImmutableList<AccountQuestion> questionIds = this.questionResponseDAO.getAccountQuestions(accountId, expiration); if (questionIds == null || questionIds.size() == 0) { return Collections.emptyMap(); } Map<Integer, Question> questions = new HashMap<>(); for (final AccountQuestion question : questionIds) { final Integer qid = question.questionId; if (!questions.containsKey(qid)) { final Long accountQId = question.id; questions.put(qid, Question.withAskTimeAccountQId(this.questionIdMap.get(qid), accountQId, today)); } } return questions; }

Target:
private Map<Integer, Question> getPreGeneratedQuestions(final Long accountId, final DateTime today) { final DateTime expiration = today.plusDays(1); final ImmutableList<AccountQuestion> questionIds = this.questionResponseDAO.getAccountQuestions(accountId, expiration); if (questionIds == null || questionIds.size() == 0) { return Collections.emptyMap(); } final Map<Integer, Question> questions = new HashMap<>(); for (final AccountQuestion question : questionIds) { final Integer qid = question.questionId; if (!questions.containsKey(qid)) { final Long accountQId = question.id; questions.put(qid, Question.withAskTimeAccountQId(this.questionIdMap.get(qid), accountQId, today)); } } return questions; }
Source:
public boolean hasCompatibleAnalyzer(ElasticsearchFieldPredicateBuilderFactory other) { if ( !getClass().equals( other.getClass() ) ) { return false; } ElasticsearchTextFieldPredicateBuilderFactory castedOther = (ElasticsearchTextFieldPredicateBuilderFactory) other; return Objects.equals( analyzer, castedOther.analyzer ) && Objects.equals( searchAnalyzer, castedOther.searchAnalyzer ) && Objects.equals( normalizer, castedOther.normalizer ); }

Target:
public boolean hasCompatibleAnalyzer(ElasticsearchFieldPredicateBuilderFactory other) { if ( !getClass().equals( other.getClass() ) ) { return false; } ElasticsearchTextFieldPredicateBuilderFactory castedOther = (ElasticsearchTextFieldPredicateBuilderFactory) other; return Objects.equals( analyzer, castedOther.analyzer ) && Objects.equals( normalizer, castedOther.normalizer ); }
Source:
private String getLabel(String mode) { String label = OpenShiftCoreMessages.RunOnOpenshift; if (ILaunchManager.PROFILE_MODE.equals(mode)) { label = OpenShiftCoreMessages.ProfileOnOpenshift; } else if (ILaunchManager.DEBUG_MODE.equals(mode)) { label = OpenShiftCoreMessages.DebugOnOpenshift; } return label; }

Target:
private String getLabel(String mode) { String label; switch (mode) { case ILaunchManager.DEBUG_MODE: label = OpenShiftCoreMessages.DebugOnOpenshift; break; case ILaunchManager.PROFILE_MODE: label = OpenShiftCoreMessages.ProfileOnOpenshift; break; default: label = OpenShiftCoreMessages.RunOnOpenshift; break; } return label; }
Source:
private void parseServiceSequence(final FBType type) throws TypeImportException, XMLStreamException { ServiceSequence serviceSequence = LibraryElementFactory.eINSTANCE.createServiceSequence(); readNameCommentAttributes(serviceSequence); processChildren(LibraryElementTags.SERVICE_SEQUENCE_ELEMENT, name -> { if (name.equals(LibraryElementTags.SERVICE_TRANSACTION_ELEMENT)) { parseServiceTransaction(serviceSequence, type); return true; } return false; }); type.getService().getServiceSequence().add(serviceSequence); }

Target:
private void parseServiceSequence(final FBType type) throws TypeImportException, XMLStreamException { ServiceSequence serviceSequence = LibraryElementFactory.eINSTANCE.createServiceSequence(); readNameCommentAttributes(serviceSequence); processChildren(LibraryElementTags.SERVICE_SEQUENCE_ELEMENT, name -> { if (LibraryElementTags.SERVICE_TRANSACTION_ELEMENT.equals(name)) { parseServiceTransaction(serviceSequence, type); return true; } return false; }); type.getService().getServiceSequence().add(serviceSequence); }
Source:
private void close(TableItem ti) { if (ti.getData() instanceof EditorReference) { int index = table.indexOf(ti); EditorReference ed = (EditorReference) ti.getData(); page.closeEditors(new IEditorReference[] { ed }, false); table.setFocus(); tableViewer.setInput(getInput(page)); if (table.getItemCount() == 0) { cancel(dialog); } if (table.isDisposed()) { return; } if (index > 0 && index <= table.getItemCount()) { index -= 1; } table.setSelection(index); } }

Target:
private void close(TableItem ti) { if (ti.getData() instanceof EditorReference) { int index = table.indexOf(ti); EditorReference ed = (EditorReference) ti.getData(); bypassFocusLost = true; page.closeEditors(new IEditorReference[] { ed }, true); bypassFocusLost = false; table.setFocus(); tableViewer.setInput(getInput(page)); if (table.getItemCount() == 0) { cancel(dialog); } if (table.isDisposed()) { return; } if (index > 0 && index <= table.getItemCount()) { index -= 1; } table.setSelection(index); } }
Source:
public JobHandle scheduleJob(Job job, JobContext ctx, Trigger trigger) { if (ctx instanceof ProcessJobContext && !(ctx instanceof StartProcessJobContext)) { ProcessJobContext processCtx = (ProcessJobContext) ctx; List<GlobalJobHandle> jobHandles = timerJobsPerSession.get(processCtx.getSessionId()); if (jobHandles == null) { jobHandles = new CopyOnWriteArrayList<GlobalJobHandle>(); timerJobsPerSession.put(processCtx.getSessionId(), jobHandles); } else { for (GlobalJobHandle handle : jobHandles) { long timerId = handle.getTimerId(); if (timerId == processCtx.getTimer().getId()) { return handle; } } } GlobalJobHandle jobHandle = (GlobalJobHandle) this.schedulerService.scheduleJob(job, ctx, trigger); if (jobHandle != null) { jobHandles.add(jobHandle); } return jobHandle; } GlobalJobHandle jobHandle = (GlobalJobHandle) this.schedulerService.scheduleJob(job, ctx, trigger); return jobHandle; }

Target:
public JobHandle scheduleJob(Job job, JobContext ctx, Trigger trigger) { if (ctx instanceof StartProcessJobContext) { GlobalJobHandle jobHandle = (GlobalJobHandle) this.schedulerService.scheduleJob(job, ctx, trigger); if (jobHandle != null) { startTimerJobs.add(jobHandle); } return jobHandle; } else if (ctx instanceof ProcessJobContext) { ProcessJobContext processCtx = (ProcessJobContext) ctx; List<GlobalJobHandle> jobHandles = timerJobsPerSession.get(processCtx.getSessionId()); if (jobHandles == null) { jobHandles = new CopyOnWriteArrayList<GlobalJobHandle>(); timerJobsPerSession.put(processCtx.getSessionId(), jobHandles); } else { for (GlobalJobHandle handle : jobHandles) { long timerId = handle.getTimerId(); if (timerId == processCtx.getTimer().getId()) { return handle; } } } GlobalJobHandle jobHandle = (GlobalJobHandle) this.schedulerService.scheduleJob(job, ctx, trigger); if (jobHandle != null) { jobHandles.add(jobHandle); } return jobHandle; } GlobalJobHandle jobHandle = (GlobalJobHandle) this.schedulerService.scheduleJob(job, ctx, trigger); return jobHandle; }
Source:
protected Pair<Q, E> pollNext() { final int timeout = 10; final TimeUnit timeUnit = TimeUnit.MINUTES; Pair<Q, E> next = null; try { next = getPairQueue().poll(timeout, timeUnit); } catch (InterruptedException ignored) { } if (next == null) { throw new IllegalStateException(String.format("Didn't manage to poll the next pair during %s %s", String.valueOf(timeout), timeUnit)); } return next; }

Target:
protected Pair<Q, E> pollNext() { Pair<Q, E> next = null; try { next = getPairQueue().poll(pollTimeout.getValue(), TimeUnit.MILLISECONDS); } catch (InterruptedException ignored) { } if (next == null) { throw new IllegalStateException(String.format("Didn't manage to poll the next pair. Timeout %s", pollTimeout)); } return next; }
Source:
private void runInHarvesterThread() { Buffer buf; DatagramPacket pkt = null; MySocket destinationSocket; InetSocketAddress remoteAddress; do { if (close) { break; } buf = getFreeBuffer(); if (pkt == null) pkt = new DatagramPacket(buf.buffer, 0, buf.buffer.length); else pkt.setData(buf.buffer, 0, buf.buffer.length); try { socket.receive(pkt); } catch (IOException ioe) { if (!close) { logger.severe("Failed to receive from socket: " + ioe); } break; } buf.len = pkt.getLength(); remoteAddress = (InetSocketAddress) pkt.getSocketAddress(); destinationSocket = sockets.get(remoteAddress); if (destinationSocket != null) { destinationSocket.addBuffer(buf); } else { String ufrag = getUfrag(buf.buffer, 0, buf.len); if (ufrag == null) { continue; } maybeAcceptNewSession(buf, remoteAddress, ufrag); } } while (true); for (MySocket candidateSocket : sockets.values()) { candidateSocket.close(); } socket.close(); }

Target:
private void runInHarvesterThread() { Buffer buf; DatagramPacket pkt = null; MySocket destinationSocket; InetSocketAddress remoteAddress; do { if (close) { break; } buf = getFreeBuffer(); if (pkt == null) pkt = new DatagramPacket(buf.buffer, 0, buf.buffer.length); else pkt.setData(buf.buffer, 0, buf.buffer.length); try { socket.receive(pkt); } catch (IOException ioe) { if (!close) { logger.severe("Failed to receive from socket: " + ioe); } break; } buf.len = pkt.getLength(); remoteAddress = (InetSocketAddress) pkt.getSocketAddress(); destinationSocket = sockets.get(remoteAddress); if (destinationSocket != null) { destinationSocket.addBuffer(buf); } else { String ufrag = getUfrag(buf.buffer, 0, buf.len); if (ufrag == null) { continue; } maybeAcceptNewSession(buf, remoteAddress, ufrag); } } while (true); for (MySocket candidateSocket : new ArrayList<>(sockets.values())) { candidateSocket.close(); } socket.close(); }
Source:
public final void addListener(TransactionCompletedListener listener) { notifier.thenRunAsync(listener::onCompletion); }

Target:
public final void addListener(TransactionCompletedListener listener) { notifier.thenRun(listener::onCompletion); }
Source:
public Object[] getFiniteSupport() { booldist.getFiniteSupport(); return finiteSupport; }

Target:
public Object[] getFiniteSupport() { return finiteSupport; }
Source:
public void testPick() throws Exception { EasyMock.expect(serviceProvider.getInstance()).andReturn(instance).anyTimes(); EasyMock.expect(instance.getAddress()).andReturn(ADDRESS).anyTimes(); EasyMock.expect(instance.getPort()).andReturn(PORT).anyTimes(); EasyMock.replay(instance, serviceProvider); Server server = serverDiscoverySelector.pick(); Assert.assertEquals(PORT, server.getPort()); Assert.assertEquals(ADDRESS, server.getAddress()); Assert.assertTrue(server.getHost().contains(new Integer(PORT).toString())); Assert.assertTrue(server.getHost().contains(ADDRESS)); Assert.assertEquals(new String("http"), server.getScheme()); EasyMock.verify(instance, serviceProvider); final URI uri = new URI(String.format("%s://%s%s", server.getScheme(), server.getHost(), "/druid/indexer/v1/action")); Assert.assertEquals(PORT, uri.getPort()); Assert.assertEquals(ADDRESS, uri.getHost()); Assert.assertEquals("http", uri.getScheme()); }

Target:
public void testPick() throws Exception { EasyMock.expect(serviceProvider.getInstance()).andReturn(instance).anyTimes(); EasyMock.expect(instance.getAddress()).andReturn(ADDRESS).anyTimes(); EasyMock.expect(instance.getPort()).andReturn(PORT).anyTimes(); EasyMock.replay(instance, serviceProvider); Server server = serverDiscoverySelector.pick(); Assert.assertEquals(PORT, server.getPort()); Assert.assertEquals(ADDRESS, server.getAddress()); Assert.assertTrue(server.getHost().contains(Integer.toString(PORT))); Assert.assertTrue(server.getHost().contains(ADDRESS)); Assert.assertEquals("http", server.getScheme()); EasyMock.verify(instance, serviceProvider); final URI uri = new URI( server.getScheme(), null, server.getAddress(), server.getPort(), "/druid/indexer/v1/action", null, null ); Assert.assertEquals(PORT, uri.getPort()); Assert.assertEquals(ADDRESS, uri.getHost()); Assert.assertEquals("http", uri.getScheme()); }
Source:
public void onNext(Map<String, Object> map) { try { refreshHost(); } finally { subscription.request(1); } }

Target:
public void onNext(Map<String, Object> map) { try { vdsManager.refreshHost(); } finally { subscription.request(1); } }
Source:
public int read() throws IOException { int outByte = inputStream.read(); if (cacheValidationEnabled) { verify(originInputStream.read() == outByte, "corrupted buffer at position " + getPos()); } return outByte; }

Target:
public int read() throws IOException { int outByte = inputStream.read(); if (cacheValidationEnabled) { verify(dataTierInputStream.get().read() == outByte, "corrupted buffer at position " + getPos()); } return outByte; }