auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void setBehaviour(PathOutageStatusProvider statusProvider) { Mockito.when(statusProvider.getStatusForSingleVertex(Matchers.any(PathOutageProvider.class), Matchers.any(VertexRef.class))). thenReturn(new Status() { @Override public String computeStatus() { return OnmsSeverity.NORMAL.getLabel(); } @Override public Map<String, String> getStatusProperties() { return null; } @Override public Map<String, String> getStyleProperties() { return null; } }); }

Target:
private void setBehaviour(PathOutageStatusProvider statusProvider) { Mockito.when(statusProvider.getStatusForVertices( Matchers.any(PathOutageProvider.class), Matchers.anyCollection(), Matchers.any())) .thenReturn(new HashMap()); }
Source:
private void updateMatchSystemThemeSwitch() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { matchSystemSwitch.setVisibility(View.VISIBLE); matchSystemSwitch.setChecked(Prefs.shouldMatchSystemTheme()); conditionallyDisableThemeButtons(); } }

Target:
private void updateMatchSystemThemeSwitch() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { matchSystemThemeSwitch.setVisibility(View.VISIBLE); matchSystemThemeSwitch.setChecked(Prefs.shouldMatchSystemTheme()); conditionallyDisableThemeButtons(); } else { matchSystemThemeSwitch.setVisibility(View.GONE); } }
Source:
protected void updateQuota(DiskImage diskImage) { if (isDiskImage() || isCinderDisk()) { DiskImage oldDisk = (DiskImage) getOldDisk(); if (!Objects.equals(oldDisk.getQuotaId(), diskImage.getQuotaId())) { getImageStorageDomainMapDao().updateQuotaForImageAndSnapshots(diskImage.getId(), diskImage.getStorageIds().get(0), diskImage.getQuotaId()); } } }

Target:
protected void updateQuota(DiskImage diskImage) { if (isInternalManagedDisk()) { DiskImage oldDisk = (DiskImage) getOldDisk(); if (!Objects.equals(oldDisk.getQuotaId(), diskImage.getQuotaId())) { getImageStorageDomainMapDao().updateQuotaForImageAndSnapshots(diskImage.getId(), diskImage.getStorageIds().get(0), diskImage.getQuotaId()); } } }
Source:
public static boolean isSudoAccessNeededForHostCertRotation(ClouderaManagerRepo clouderaManagerRepoDetails) { LOGGER.info("ClouderaManagerRepo is compared for Host certs rotation Sudo access"); return isVersionOlderThanLimited(clouderaManagerRepoDetails::getVersion, CLOUDERAMANAGER_VERSION_7_2_3) || isVersionNewerOrEqualThanLimited(clouderaManagerRepoDetails::getVersion, CLOUDERAMANAGER_VERSION_7_1_0); }

Target:
public static boolean isSudoAccessNeededForHostCertRotation(ClouderaManagerRepo clouderaManagerRepoDetails) { LOGGER.info("ClouderaManagerRepo is compared for Host certs rotation Sudo access"); return isVersionOlderThanLimited(clouderaManagerRepoDetails::getVersion, CLOUDERAMANAGER_VERSION_7_2_3); }
Source:
private void printAnyOperator(Function function, SymbolPrinterContext context) { List<Symbol> args = function.arguments(); assert args.size() == 2 || args.size() == 3 : "function's number of arguments must be 2"; context.builder.append(PAREN_OPEN); args.get(0).accept(this, context); boolean ignoreCase = extractIgnoreCase(function); String functionName = function.info().ident().name(); String operatorName = caseSensitiveOperatorName(anyOperatorName(functionName), ignoreCase); context.builder .append(WS) .append(operatorName) .append(WS); context.builder.append(ANY).append(PAREN_OPEN); args.get(1).accept(this, context); context.builder.append(PAREN_CLOSE) .append(PAREN_CLOSE); }

Target:
private void printAnyOperator(Function function, SymbolPrinterContext context) { List<Symbol> args = function.arguments(); assert args.size() == 2 || args.size() == 3 : "function's number of arguments must be 2, or 3"; context.builder.append(PAREN_OPEN); args.get(0).accept(this, context); boolean ignoreCase = extractIgnoreCase(function); String functionName = function.info().ident().name(); String operatorName = caseSensitiveOperatorName(anyOperatorName(functionName), ignoreCase); context.builder .append(WS) .append(operatorName) .append(WS); context.builder.append(ANY).append(PAREN_OPEN); args.get(1).accept(this, context); context.builder.append(PAREN_CLOSE) .append(PAREN_CLOSE); }
Source:
protected List<Resolver<Account>> getResolvers(Config config) throws ServletException { List<String> locations = null; String val = config.get(ACCOUNT_RESOLVER_LOCATIONS); if (Strings.hasText(val)) { String[] locs = Strings.split(val); locations = Arrays.asList(locs); } Assert.notEmpty(locations, "At least one " + ACCOUNT_RESOLVER_LOCATIONS + " must be specified."); assert locations != null; Map<String, Resolver> resolverMap = config.getInstances(ACCOUNT_RESOLVER_PROPERTY_PREFIX, Resolver.class); List<Resolver<Account>> resolvers = new ArrayList<Resolver<Account>>(resolverMap.size()); for (String location : locations) { Resolver resolver = resolverMap.get(location); Assert.notNull(resolver, "There is no configured Account Resolver named " + location); Resolver<Account> accountResolver = (Resolver<Account>) resolver; resolvers.add(accountResolver); } return java.util.Collections.unmodifiableList(resolvers); }

Target:
protected List<Resolver<Account>> getResolvers(Config config) throws ServletException { List<String> locations = null; String val = config.get(ACCOUNT_RESOLVER_LOCATIONS); if (Strings.hasText(val)) { String[] locs = Strings.split(val); locations = Arrays.asList(locs); } Assert.notEmpty(locations, "At least one " + ACCOUNT_RESOLVER_LOCATIONS + " must be specified."); assert locations != null; Map<String, Resolver> resolverMap = config.getInstances(ACCOUNT_RESOLVER_PROPERTY_PREFIX, Resolver.class); List<Resolver<Account>> resolvers = new ArrayList<Resolver<Account>>(resolverMap.size()); for (String location : locations) { Resolver resolver = resolverMap.get(location); Assert.notNull(resolver, "There is no configured Account Resolver named " + location); Resolver<Account> accountResolver = (Resolver<Account>) resolver; resolvers.add(accountResolver); } return Collections.unmodifiableList(resolvers); }
Source:
public MobilePreviewEditModePageObject openMobilePreview(String articleName) { EditMode editMode = new ArticlePageObject().open(articleName).navigateToArticleEditPage(); editMode.mobilePreviewArticle(); wait.forElementVisible(previewModal); driver.switchTo().frame(mobilePreviewIframe); return this; }

Target:
public MobilePreviewEditModePageObject openMobilePreview(String articleName) { new ArticlePageObject() .open(articleName) .navigateToArticleEditPage() .openMobilePreviewArticle(); wait.forElementVisible(previewModal); driver.switchTo().frame(mobilePreviewIframe); return this; }
Source:
public void setup() { MockitoAnnotations.initMocks(this); msgUtil = Mockito.mock(ErrorMessageUtil.class); Mockito.when(msgUtil.getMessage(ArgumentMatchers.eq("listing.duplicateIcsSource"), ArgumentMatchers.anyString())) .thenAnswer(i -> String.format(ERR_MSG, i.getArgument(1), "")); reviewer = new IcsSourceDuplicateReviewer(msgUtil); }

Target:
public void setup() { msgUtil = Mockito.mock(ErrorMessageUtil.class); Mockito.when(msgUtil.getMessage(ArgumentMatchers.eq("listing.duplicateIcsSource"), ArgumentMatchers.anyString())) .thenAnswer(i -> String.format(ERR_MSG, i.getArgument(1), "")); reviewer = new IcsSourceDuplicateReviewer(msgUtil); }
Source:
public void dispose() { for (Entry<Integer, ImageMosaicReader> element : readers.entrySet()) { element.getValue().dispose(); } readers.clear(); }

Target:
public void dispose() { for (Entry<Integer, ImageMosaicReader> element : readers.entrySet()) { try { element.getValue().dispose(); } catch (Exception e) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.log(Level.FINE, e.getLocalizedMessage(), e); } } readers.clear(); }
Source:
void unpark() { if (unsafe.compareAndSwapInt(this, parkedOffset, 0, 2)) { return; } LockSupport.unpark(thread); }

Target:
void unpark() { if (unsafe.compareAndSwapInt(this, parkedOffset, STATE_NORMAL, STATE_UNPARKED)) { return; } LockSupport.unpark(thread); }
Source:
public String runTask(StressBenchConfig config, ArrayList<String> args, RunTaskContext runTaskContext) throws Exception { LOG.info("Args: {}", args); System.out.println("Running here "+ args); List<String> command = new ArrayList<>(3 + config.getArgs().size()); command.add(ServerConfiguration.get(PropertyKey.HOME) + "/bin/alluxio"); command.add("runClass"); command.add(config.getClassName()); command.addAll(config.getArgs()); command.add(BaseParameters.DISTRIBUTED_FLAG); command.add(BaseParameters.IN_PROCESS_FLAG); if (config.getArgs().stream().noneMatch((s) -> s.equals(BaseParameters.START_MS_FLAG))) { command.add(BaseParameters.START_MS_FLAG); command.add(Long.toString((System.currentTimeMillis() + 5000))); } command.addAll(args); LOG.info("running command: " + String.join(" ", command)); System.out.println("Commands here "+ command); String output = ShellUtils.execCommand(command.toArray(new String[0])); return output; }

Target:
public String runTask(StressBenchConfig config, ArrayList<String> args, RunTaskContext runTaskContext) throws Exception { List<String> command = new ArrayList<>(3 + config.getArgs().size()); command.add(ServerConfiguration.get(PropertyKey.HOME) + "/bin/alluxio"); command.add("runClass"); command.add(config.getClassName()); command.addAll(config.getArgs()); command.add(BaseParameters.DISTRIBUTED_FLAG); command.add(BaseParameters.IN_PROCESS_FLAG); if (config.getArgs().stream().noneMatch((s) -> s.equals(BaseParameters.START_MS_FLAG))) { command.add(BaseParameters.START_MS_FLAG); command.add(Long.toString((System.currentTimeMillis() + config.getStartDelayMs()))); } command.addAll(args); LOG.info("running command: " + String.join(" ", command)); String output = ShellUtils.execCommand(command.toArray(new String[0])); return output; }
Source:
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ContextRefreshedEvent) { this.applicationContext = ((ContextRefreshedEvent) event).getApplicationContext(); if (this.zkConnection.isConnected()) { requestLeadership(this.zkConnection.getClient()); if (this.applicationContext.equals(((ContextRefreshedEvent) event).getApplicationContext())) { registerWithZooKeeper(zkConnection.getClient()); } } this.zkConnection.addListener(connectionListener); } else if (event instanceof ContextStoppedEvent) { if (this.leaderSelector != null) { this.leaderSelector.close(); } } else if (event instanceof EmbeddedServletContainerInitializedEvent) { String namespace = ((EmbeddedServletContainerInitializedEvent) event).getApplicationContext().getNamespace(); int port = ((EmbeddedServletContainerInitializedEvent) event).getEmbeddedServletContainer().getPort(); if (MGMT_CONTEXT_NAMESPACE.equals(namespace)) { runtimeAttributes.setManagementPort(port); } else { runtimeAttributes.setPort(port); } if (zkConnection.isConnected() && runtimeRepository.exists(runtimeAttributes.getId())) { runtimeRepository.update(new ContainerRuntime(runtimeAttributes.getId(), runtimeAttributes)); } } }

Target:
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ContextRefreshedEvent) { this.applicationContext = ((ContextRefreshedEvent) event).getApplicationContext(); if (this.zkConnection.isConnected()) { if (this.applicationContext.equals(((ContextRefreshedEvent) event).getApplicationContext())) { registerWithZooKeeper(zkConnection.getClient()); } requestLeadership(this.zkConnection.getClient()); } this.zkConnection.addListener(connectionListener); } else if (event instanceof ContextStoppedEvent) { if (this.leaderSelector != null) { this.leaderSelector.close(); } } else if (event instanceof EmbeddedServletContainerInitializedEvent) { String namespace = ((EmbeddedServletContainerInitializedEvent) event).getApplicationContext().getNamespace(); int port = ((EmbeddedServletContainerInitializedEvent) event).getEmbeddedServletContainer().getPort(); synchronized (adminAttributes) { if (MGMT_CONTEXT_NAMESPACE.equals(namespace)) { adminAttributes.setManagementPort(port); } else { adminAttributes.setPort(port); } if (zkConnection.isConnected() && adminRepository.exists(adminAttributes.getId())) { adminRepository.update(new Admin(adminAttributes.getId(), adminAttributes)); } } } }
Source:
public void setRestoreToRemoteUser(String username, String password) { this.username = username; this.password = password; String domain = PropertyManager.instance().getSingularProperty("cc_user_domain"); this.qualifiedUsername = username + "@" + domain; mRestoreStrategySet = true; }

Target:
public void setRestoreToRemoteUser(String username, String password) { this.username = username; this.password = password; String domain = mPlatform.getPropertyManager().getSingularProperty("cc_user_domain"); this.qualifiedUsername = username + "@" + domain; mRestoreStrategySet = true; }
Source:
public boolean runForSingleConnectionInHost(storage_domains storageDomain, Guid storagePoolId, int type) { storage_pool pool = DbFacade.getInstance().getStoragePoolDao().get(storagePoolId); if (pool.getspm_vds_id() != null) { return runConnectionStorageToDomain(storageDomain, pool.getspm_vds_id().getValue(), type); } else { log.errorFormat("Pool {0} does not have spm vds id to connect storage to domain.", pool.getname()); return false; } }

Target:
public boolean runForSingleConnectionInHost(storage_domains storageDomain, Guid storagePoolId, int type) { storage_pool pool = DbFacade.getInstance().getStoragePoolDao().get(storagePoolId); if (pool.getspm_vds_id() == null) { log.errorFormat("Pool {0} does not have spm vds id to connect storage to domain.", pool.getname()); return false; } return runConnectionStorageToDomain(storageDomain, pool.getspm_vds_id().getValue(), type); }
Source:
public String putBlob(final String containerName, final Blob blob) throws IOException { String blobKey = blob.getMetadata().getName(); Payload payload = blob.getPayload(); filesystemContainerNameValidator.validate(containerName); filesystemBlobKeyValidator.validate(blobKey); File outputFile = getFileForBlobKey(containerName, blobKey); HashingInputStream his = null; try { Files.createParentDirs(outputFile); his = new HashingInputStream(Hashing.md5(), payload.openStream()); Files.asByteSink(outputFile).writeFrom(his); HashCode actualHashCode = his.hash(); byte[] expectedHashCodeBytes = payload.getContentMetadata().getContentMD5(); if (expectedHashCodeBytes != null) { HashCode expectedHashCode = HashCode.fromBytes(expectedHashCodeBytes); if (!actualHashCode.equals(expectedHashCode)) { throw new IOException("MD5 hash code mismatch, actual: " + actualHashCode + " expected: " + expectedHashCode); } } byte[] actualHashCodeBytes = actualHashCode.asBytes(); payload.getContentMetadata().setContentMD5(actualHashCodeBytes); return base16().lowerCase().encode(actualHashCodeBytes); } catch (IOException ex) { if (outputFile != null) { if (!outputFile.delete()) { logger.debug("Could not delete %s", outputFile); } } throw ex; } finally { Closeables.closeQuietly(his); payload.release(); } }

Target:
public String putBlob(final String containerName, final Blob blob) throws IOException { String blobKey = blob.getMetadata().getName(); Payload payload = blob.getPayload(); filesystemContainerNameValidator.validate(containerName); filesystemBlobKeyValidator.validate(blobKey); File outputFile = getFileForBlobKey(containerName, blobKey); HashingInputStream his = null; try { Files.createParentDirs(outputFile); his = new HashingInputStream(Hashing.md5(), payload.openStream()); Files.asByteSink(outputFile).writeFrom(his); HashCode actualHashCode = his.hash(); HashCode expectedHashCode = payload.getContentMetadata().getContentMD5AsHashCode(); if (expectedHashCode != null && !actualHashCode.equals(expectedHashCode)) { throw new IOException("MD5 hash code mismatch, actual: " + actualHashCode + " expected: " + expectedHashCode); } payload.getContentMetadata().setContentMD5(actualHashCode); return base16().lowerCase().encode(actualHashCode.asBytes()); } catch (IOException ex) { if (outputFile != null) { if (!outputFile.delete()) { logger.debug("Could not delete %s", outputFile); } } throw ex; } finally { Closeables.closeQuietly(his); payload.release(); } }
Source:
public void addValue(@Nullable Long value) { fValues.add(value); }

Target:
public void addValue(@Nullable Long value) { fValues.add(value); fLabel = null; }
Source:
public void onMythicMobSpawns(MythicMobSpawnEvent event) { mob = new MythicMobsMobTag(event.getMob()); entity = new EntityTag(event.getEntity()); location = new LocationTag(event.getLocation()); EntityTag.rememberEntity(entity.getBukkitEntity()); this.event = event; fire(event); EntityTag.forgetEntity(entity.getBukkitEntity()); }

Target:
public void onMythicMobSpawns(MythicMobSpawnEvent event) { mythicmob = new MythicMobsMobTag(event.getMob()); location = new LocationTag(event.getLocation()); this.event = event; EntityTag.rememberEntity(event.getEntity()); fire(event); EntityTag.forgetEntity(event.getEntity()); }
Source:
public VisualizationObject(final String title, final String visualizationClassUri) { this(new Content(visualizationClassUri, emptyList()), new Meta(title)); }

Target:
public VisualizationObject(final String title, final String visualizationClassUri) { this(new Content(notEmpty(visualizationClassUri), emptyList()), new Meta(notEmpty(title))); }
Source:
private void doPut() throws Exception { requestParallelism = 3; successTarget = 2; mockSelectorState.set(MockSelectorState.Good); VerifiableProperties vprops = new VerifiableProperties(getNonBlockingRouterProperties()); routerConfig = new RouterConfig(vprops); mockClusterMap = new MockClusterMap(); routerMetrics = new NonBlockingRouterMetrics(mockClusterMap.getMetricRegistry()); mockServerLayout = new MockServerLayout(mockClusterMap); replicasCount = mockClusterMap.getWritablePartitionIds().get(0).getReplicaIds().size(); responseHandler = new ResponseHandler(mockClusterMap); networkClientFactory = new MockNetworkClientFactory(vprops, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, mockServerLayout, time); router = new NonBlockingRouter(routerConfig, new NonBlockingRouterMetrics(new MetricRegistry()), networkClientFactory, new LoggingNotificationSystem(), mockClusterMap, time); blobProperties = new BlobProperties(blobSize, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); userMetadata = new byte[BLOB_USER_METADATA_SIZE]; random.nextBytes(userMetadata); putContent = new byte[blobSize]; random.nextBytes(putContent); ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); blobIdStr = router.putBlob(blobProperties, userMetadata, putChannel).get(); router.close(); networkClient = networkClientFactory.getNetworkClient(); resetConfigsForGet(); }

Target:
private void doPut() throws Exception { BlobProperties blobProperties = new BlobProperties(blobSize, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); byte[] userMetadata = new byte[10]; random.nextBytes(userMetadata); putContent = new byte[blobSize]; random.nextBytes(putContent); ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); blobIdStr = router.putBlob(blobProperties, userMetadata, putChannel).get(); }
Source:
public Map<String, ExtensionVariableType> variableTypeMap(){ Map<String, ExtensionVariableType> variableTypeMap = new HashMap<>(); variableTypeMap.put("boolean", new JavaObjectExtensionVariableType(Boolean.class)); variableTypeMap.put("string", new JavaObjectExtensionVariableType(String.class)); variableTypeMap.put("integer", new JavaObjectExtensionVariableType(Integer.class)); variableTypeMap.put("date", new DateExtensionVariableType(Date.class,new SimpleDateFormat(DateExtensionVariableType.defaultFormat))); return variableTypeMap; }

Target:
public Map<String, VariableType> variableTypeMap(){ Map<String, VariableType> variableTypeMap = new HashMap<>(); variableTypeMap.put("boolean", new JavaObjectVariableType(Boolean.class)); variableTypeMap.put("string", new JavaObjectVariableType(String.class)); variableTypeMap.put("integer", new JavaObjectVariableType(Integer.class)); variableTypeMap.put("date", new DateVariableType(Date.class, new SimpleDateFormat(DateVariableType.defaultFormat))); return variableTypeMap; }
Source:
public TaskActivity(String message, Long task, TaskActivityType activityType) { this(message, new ArrayList<>(), task, activityType, 0); }

Target:
public TaskActivity(String message, Long task, TaskActivityType activityType) { this(message, new ArrayList<>(), task, activityType, (TaskExecutionProgress) null); }
Source:
public default void close() throws Exception { for (AutoCloseable closeableStep : TraversalHelper.getStepsOfAssignableClassRecursively(AutoCloseable.class, asAdmin())) { closeableStep.close(); } }

Target:
public default void close() throws Exception { for(final Step<?,?> step : this.asAdmin().getSteps()) { if(step instanceof AutoCloseable) ((AutoCloseable) step).close(); } }
Source:
static void tintResources(MainActivity mainActivity) { String primaryColorOverride = getPrimaryColorForDisplay(mainActivity); if (primaryColorOverride.equals("#4caf50")) { return; } int primaryColor = Color.parseColor(primaryColorOverride); ImageView launcherButton = (ImageView) mainActivity.findViewById(R.id.launcherButton); launcherButton.setColorFilter(primaryColor); mainActivity.findViewById(R.id.main_kissbar).setBackgroundColor(primaryColor); }

Target:
static void tintResources(MainActivity mainActivity) { String primaryColorOverride = getPrimaryColor(mainActivity); if (primaryColorOverride.equals(DEFAULT_GREEN)) { return; } int primaryColor = Color.parseColor(primaryColorOverride); ImageView launcherButton = (ImageView) mainActivity.findViewById(R.id.launcherButton); launcherButton.setColorFilter(primaryColor); mainActivity.findViewById(R.id.main_kissbar).setBackgroundColor(primaryColor); }
Source:
private void logoutIfNeeded() throws InterruptedException { if (isViewDisplayed(getViewById(R.id.list_root)) == false) { return; } loadSettingsFromNotesList(); onView(withId(R.id.preferences_container)).perform(swipeUp()); selectSettingsOption(R.string.log_out, logoutPosition); waitForViewMatching(withId(R.id.button_login), 1000); }

Target:
private void logoutIfNeeded() { if (!isViewDisplayed(getViewById(R.id.list_root))) { return; } loadSettingsFromNotesList(); onView(withId(R.id.preferences_container)).perform(swipeUp()); selectSettingsOption(R.string.log_out, logoutPosition); waitForViewMatching(withId(R.id.button_login), 1000); }
Source:
public void testGettingImagesFromDockerHub() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); final io.dockstore.openapi.client.ApiClient openAPIClient = getOpenAPIWebClient(USER_2_USERNAME, testingPostgres); Ga4Ghv20Api ga4Ghv20Api = new Ga4Ghv20Api(openAPIClient); WorkflowVersion version = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/broad-prod-wgs-germline-snps-indels", DescriptorType.WDL.toString(), "/JointGenotypingWf.wdl", "1.1.2"); WorkflowVersion version2 = snapshotWorkflowVersion(workflowsApi, "NatalieEO/broad-prod-wgs-germline-snps-indels", DescriptorType.WDL.toString(), "/JointGenotypingWf.wdl", "1.1.2"); version.getImages(); assertEquals("Should 10 images in this workflow", 10, version.getImages().size()); verifyImageChecksumsAreSaved(version); List<ToolVersion> versions = ga4Ghv20Api.toolsIdVersionsGet("#workflow/github.com/dockstore-testing/broad-prod-wgs-germline-snps-indels"); verifyTRSImageConversion(versions, "1.1.2", 10); }

Target:
public void testGettingImagesFromDockerHub() { final ApiClient webClient = getWebClient(USER_2_USERNAME, testingPostgres); WorkflowsApi workflowsApi = new WorkflowsApi(webClient); final io.dockstore.openapi.client.ApiClient openAPIClient = getOpenAPIWebClient(USER_2_USERNAME, testingPostgres); Ga4Ghv20Api ga4Ghv20Api = new Ga4Ghv20Api(openAPIClient); WorkflowVersion version = snapshotWorkflowVersion(workflowsApi, "dockstore-testing/broad-prod-wgs-germline-snps-indels", DescriptorType.WDL.toString(), "/JointGenotypingWf.wdl", "1.1.2"); assertEquals("Should 10 images in this workflow", 10, version.getImages().size()); verifyImageChecksumsAreSaved(version); List<ToolVersion> versions = ga4Ghv20Api.toolsIdVersionsGet("#workflow/github.com/dockstore-testing/broad-prod-wgs-germline-snps-indels"); verifyTRSImageConversion(versions, "1.1.2", 10); }
Source:
public void rollback() { if (connection == null) { throw new IllegalStateException(); } try { connection.commit(); } finally { connection.close(); } }

Target:
public void rollback() { endTransaction(false); }
Source:
private static <T extends EntityResponse> T waitFor(InvokeFuture<T> future) throws EntityException { boolean interrupted = false; try { while (true) { try { return future.get(); } catch (InterruptedException e) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }

Target:
private static <T extends EntityResponse> T waitFor(InvokeFuture<T> future) throws EntityException { boolean interrupted = Thread.interrupted(); try { while (true) { try { return future.get(); } catch (InterruptedException e) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
Source:
public void endTaskStep(Guid stepId, JobExecutionStatus exitStatus) { try { if (stepId != null) { Step step = jobRepository.getStep(stepId); if (step != null) { step.setProgress(100); step.markStepEnded(exitStatus); jobRepository.updateStep(step); } } } catch (Exception e) { log.error("Failed to terminate step '{}' with status '{}': {}", stepId, exitStatus, e.getMessage()); log.debug("Exception", e); } }

Target:
public void endTaskStep(Guid stepId, JobExecutionStatus exitStatus) { try { if (stepId != null) { Step step = jobRepository.getStep(stepId); if (step != null) { step.markStepEnded(exitStatus); jobRepository.updateStep(step); } } } catch (Exception e) { log.error("Failed to terminate step '{}' with status '{}': {}", stepId, exitStatus, e.getMessage()); log.debug("Exception", e); } }
Source:
public boolean checkAccess(OzoneObj ozObject, RequestContext context) throws OMException { Objects.requireNonNull(ozObject); Objects.requireNonNull(context); Objects.requireNonNull(context.getClientUgi()); String volume = ozObject.getVolumeName(); String bucket = ozObject.getBucketName(); String keyName = ozObject.getKeyName(); metadataManager.getLock().acquireBucketLock(volume, bucket); try { validateBucket(volume, bucket); String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName); OmKeyInfo keyInfo = metadataManager.getKeyTable().get(objectKey); if (keyInfo == null) { objectKey = OzoneFSUtils.addTrailingSlashIfNeeded(objectKey); keyInfo = metadataManager.getKeyTable().get(objectKey); if(keyInfo == null) { keyInfo = metadataManager.getOpenKeyTable().get(objectKey); if (keyInfo == null) { throw new OMException("Key not found, checkAccess failed. Key:" + objectKey, KEY_NOT_FOUND); } } } boolean hasAccess = OzoneUtils.checkAclRight(keyInfo.getAcls(), context); LOG.debug("user:{} has access rights for key:{} :{} ", context.getClientUgi(), ozObject.getKeyName(), hasAccess); return hasAccess; } catch (IOException ex) { if(ex instanceof OMException) { throw (OMException) ex; } LOG.error("CheckAccess operation failed for key:{}/{}/{}", volume, bucket, keyName, ex); throw new OMException("Check access operation failed for " + "key:" + keyName, ex, INTERNAL_ERROR); } finally { metadataManager.getLock().releaseBucketLock(volume, bucket); } }

Target:
public boolean checkAccess(OzoneObj ozObject, RequestContext context) throws OMException { Objects.requireNonNull(ozObject); Objects.requireNonNull(context); Objects.requireNonNull(context.getClientUgi()); String volume = ozObject.getVolumeName(); String bucket = ozObject.getBucketName(); String keyName = ozObject.getKeyName(); metadataManager.getLock().acquireLock(BUCKET_LOCK, volume, bucket); try { validateBucket(volume, bucket); String objectKey = metadataManager.getOzoneKey(volume, bucket, keyName); OmKeyInfo keyInfo = metadataManager.getKeyTable().get(objectKey); if (keyInfo == null) { objectKey = OzoneFSUtils.addTrailingSlashIfNeeded(objectKey); keyInfo = metadataManager.getKeyTable().get(objectKey); if(keyInfo == null) { keyInfo = metadataManager.getOpenKeyTable().get(objectKey); if (keyInfo == null) { throw new OMException("Key not found, checkAccess failed. Key:" + objectKey, KEY_NOT_FOUND); } } } boolean hasAccess = OzoneUtils.checkAclRight(keyInfo.getAcls(), context); LOG.debug("user:{} has access rights for key:{} :{} ", context.getClientUgi(), ozObject.getKeyName(), hasAccess); return hasAccess; } catch (IOException ex) { if(ex instanceof OMException) { throw (OMException) ex; } LOG.error("CheckAccess operation failed for key:{}/{}/{}", volume, bucket, keyName, ex); throw new OMException("Check access operation failed for " + "key:" + keyName, ex, INTERNAL_ERROR); } finally { metadataManager.getLock().releaseLock(BUCKET_LOCK, volume, bucket); } }
Source:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException { final RevFlag advertised = walk.newFlag("ADVERTISED"); adv.init(walk, advertised); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); refs = new HashMap<String, Ref>(db.getAllRefs()); final Ref head = refs.remove(Constants.HEAD); adv.send(refs.values()); if (head instanceof ObjectIdRef) adv.advertiseHave(head.getObjectId()); adv.includeAdditionalHaves(); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }

Target:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException { final RevFlag advertised = walk.newFlag("ADVERTISED"); adv.init(walk, advertised); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); refs = db.getAllRefs(); final Ref head = refs.remove(Constants.HEAD); adv.send(refs.values()); if (!head.isSymbolic()) adv.advertiseHave(head.getObjectId()); adv.includeAdditionalHaves(); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("NetworkCluster {id=") .append(getId()) .append(", status=") .append(getstatus()) .append(", isDisplay=") .append(isDisplay()) .append(", required=") .append(isRequired()) .append("}"); return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("NetworkCluster {id=") .append(getId()) .append(", status=") .append(getStatus()) .append(", display=") .append(isDisplay()) .append(", required=") .append(isRequired()) .append("}"); return builder.toString(); }
Source:
private NettyServer getNettyServer(Properties properties) throws InstantiationException, IOException { if (properties == null) { properties = new Properties(); } VerifiableProperties verifiableProperties = new VerifiableProperties(properties); NettyConfig nettyConfig = new NettyConfig(verifiableProperties); NettyMetrics nettyMetrics = new NettyMetrics(new MetricRegistry()); RestRequestHandler requestHandler = new MockRestRequestResponseHandler(); PublicAccessLogger publicAccessLogger = new PublicAccessLogger(new String[]{}, new String[]{}); VIPHealthCheckService vipHealthCheckService = new VIPHealthCheckService("/ambry-frontend/admin"); return new NettyServer(nettyConfig, nettyMetrics, requestHandler, publicAccessLogger, vipHealthCheckService); }

Target:
private NettyServer getNettyServer(Properties properties) throws InstantiationException, IOException { if (properties == null) { properties = new Properties(); } VerifiableProperties verifiableProperties = new VerifiableProperties(properties); NettyConfig nettyConfig = new NettyConfig(verifiableProperties); NettyMetrics nettyMetrics = new NettyMetrics(new MetricRegistry()); RestRequestHandler requestHandler = new MockRestRequestResponseHandler(); PublicAccessLogger publicAccessLogger = new PublicAccessLogger(new String[]{}, new String[]{}); RestServerState restServerState = new RestServerState("/healthCheck"); return new NettyServer(nettyConfig, nettyMetrics, requestHandler, publicAccessLogger, restServerState); }
Source:
public void setContextService(ContextCurrentService contextService) { this.contextService = contextService; }

Target:
public static void setContextService(ContextCurrentService contextService) { OsgiHelper.contextService = contextService; }
Source:
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter) { XStream xstream = persister.getXStream(); xstream.alias( "keyword", KeywordInfo.class); xstream.addDefaultImplementation(Keyword.class, KeywordInfo.class); persister.setCallback(new XStreamPersister.Callback() { @Override protected Class<LayerGroupInfo> getObjectClass() { return LayerGroupInfo.class; } @Override protected CatalogInfo getCatalogObject() { Map<String, String> uriTemplateVars = (Map<String, String>) RequestContextHolder.getRequestAttributes().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); String workspace = uriTemplateVars.get("workspaceName"); String layerGroup = uriTemplateVars.get("layerGroupName"); if (layerGroup == null) { return null; } return catalog.getLayerGroupByName(workspace, layerGroup); } @Override protected void postEncodeReference(Object obj, String ref, String prefix, HierarchicalStreamWriter writer, MarshallingContext context) { if ( obj instanceof StyleInfo ) { StringBuilder link = new StringBuilder(); if (prefix != null) { link.append("/workspaces/").append(converter.encode(prefix)); } link.append("/styles/").append(converter.encode(ref)); converter.encodeLink(link.toString(), writer); } if ( obj instanceof LayerInfo ) { converter.encodeLink("/layers/" + converter.encode(ref), writer); } } }); }

Target:
public void configurePersister(XStreamPersister persister, XStreamMessageConverter converter) { persister.setCallback(new XStreamPersister.Callback() { @Override protected Class<LayerGroupInfo> getObjectClass() { return LayerGroupInfo.class; } @Override protected CatalogInfo getCatalogObject() { Map<String, String> uriTemplateVars = (Map<String, String>) RequestContextHolder.getRequestAttributes().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); String workspace = uriTemplateVars.get("workspaceName"); String layerGroup = uriTemplateVars.get("layerGroupName"); if (layerGroup == null) { return null; } return catalog.getLayerGroupByName(workspace, layerGroup); } @Override protected void postEncodeReference(Object obj, String ref, String prefix, HierarchicalStreamWriter writer, MarshallingContext context) { if ( obj instanceof StyleInfo ) { StringBuilder link = new StringBuilder(); if (prefix != null) { link.append("/workspaces/").append(converter.encode(prefix)); } link.append("/styles/").append(converter.encode(ref)); converter.encodeLink(link.toString(), writer); } if ( obj instanceof LayerInfo ) { converter.encodeLink("/layers/" + converter.encode(ref), writer); } } }); }
Source:
public void finish() { String workingSetName = fWorkingSetName.getText(); ArrayList<IBreakpoint> elements = new ArrayList<>(); for (Object element : fTViewer.getCheckedElements()) { IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class); if(breakpoint != null) { elements.add(breakpoint); } } if (fWorkingSet == null) { IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager(); fWorkingSet = workingSetManager.createWorkingSet(workingSetName, elements.toArray(new IAdaptable[elements.size()])); } else { fWorkingSet.setName(workingSetName); fWorkingSet.setElements(elements.toArray(new IAdaptable[elements.size()])); } }

Target:
public void finish() { String workingSetName = fWorkingSetName.getText(); ArrayList<IBreakpoint> elements = new ArrayList<>(); for (Object adaptableElement : fTViewer.getCheckedElements()) { IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(adaptableElement, IBreakpoint.class); if(breakpoint != null) { elements.add(breakpoint); } } if (fWorkingSet == null) { IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager(); fWorkingSet = workingSetManager.createWorkingSet(workingSetName, elements.toArray(new IAdaptable[elements.size()])); } else { fWorkingSet.setName(workingSetName); fWorkingSet.setElements(elements.toArray(new IAdaptable[elements.size()])); } }
Source:
Response status(URI lraId, URI parentId) { if (participantStatusMap.containsKey(lraId)) { Optional<?> optional = participantStatusMap.get(lraId); if (optional.isPresent()) { participantStatusMap.remove(lraId); Object result = optional.get(); if (shouldInvokeStatusMethod(result)) { return invokeParticipantMethod(statusMethod, lraId, parentId, STATUS); } return processResult(optional.get(), lraId, statusMethod, STATUS); } else { return Response.accepted().build(); } } return invokeParticipantMethod(statusMethod, lraId, parentId, STATUS); }

Target:
synchronized Response status(URI lraId, URI parentId) { if (participantStatusMap.containsKey(lraId)) { return processCompletionStageResult(statusMethod, lraId, parentId, STATUS); } return invokeParticipantMethod(statusMethod, lraId, parentId, STATUS); }
Source:
public static ValueMatcher makeValueMatcher( final ColumnSelectorFactory columnSelectorFactory, final String columnName, final String value ) { final ColumnCapabilities capabilities = columnSelectorFactory.getColumnCapabilities(columnName); if (capabilities != null && capabilities.getType() == ValueType.LONG) { return getLongValueMatcher( columnSelectorFactory.makeLongColumnSelector(columnName), value ); } final ColumnSelectorPlus<ValueMatcherColumnSelectorStrategy> selector = DimensionHandlerUtils.createColumnSelectorPluses( ValueMatcherColumnSelectorStrategyFactory.instance(), ImmutableList.<DimensionSpec>of(DefaultDimensionSpec.of(columnName)), columnSelectorFactory )[0]; return selector.getColumnSelectorStrategy().makeValueMatcher(columnName, columnSelectorFactory, value); }

Target:
public static ValueMatcher makeValueMatcher( final ColumnSelectorFactory columnSelectorFactory, final String columnName, final String value ) { final ColumnCapabilities capabilities = columnSelectorFactory.getColumnCapabilities(columnName); if (capabilities != null && capabilities.getType() == ValueType.LONG) { return getLongValueMatcher( columnSelectorFactory.makeLongColumnSelector(columnName), value ); } final ColumnSelectorPlus<ValueMatcherColumnSelectorStrategy> selector = DimensionHandlerUtils.createColumnSelectorPlus( ValueMatcherColumnSelectorStrategyFactory.instance(), DefaultDimensionSpec.of(columnName), columnSelectorFactory ); return selector.getColumnSelectorStrategy().makeValueMatcher(selector.getSelector(), value); }
Source:
public ConfigSaveState updateConfig(UpdateConfigCommand command) { ConfigSaveState configSaveState = null; LOGGER.info("Config update request by is in queue - {}", UserHelper.getUserName().getUsername(), command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update request by is being processed", command, UserHelper.getUserName().getUsername()); if (command instanceof CheckedUpdateCommand) { CheckedUpdateCommand checkedCommand = (CheckedUpdateCommand) command; if (!checkedCommand.canContinue(cachedConfigService.currentConfig())) { throw new ConfigUpdateCheckFailedException(); } } configSaveState = cachedConfigService.writeWithLock(command); } catch (Exception e) { LOGGER.info("Config update failed.", e); throw e; } finally { if (command instanceof ConfigAwareUpdate) { ((ConfigAwareUpdate) command).afterUpdate(clonedConfig()); } LOGGER.info("Config update request by is completed", UserHelper.getUserName().getUsername()); } } return configSaveState; }

Target:
public ConfigSaveState updateConfig(UpdateConfigCommand command) { ConfigSaveState configSaveState = null; LOGGER.info("Config update request by is in queue - {}", UserHelper.getUserName().getUsername(), command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update request by is being processed", command, UserHelper.getUserName().getUsername()); if (command instanceof CheckedUpdateCommand) { CheckedUpdateCommand checkedCommand = (CheckedUpdateCommand) command; if (!checkedCommand.canContinue(cachedConfigService.currentConfig())) { throw new ConfigUpdateCheckFailedException(); } } configSaveState = cachedConfigService.writeWithLock(command); } catch (Exception e) { LOGGER.error("Config update failed.", e); throw e; } finally { if (command instanceof ConfigAwareUpdate) { ((ConfigAwareUpdate) command).afterUpdate(clonedConfig()); } LOGGER.info("Config update request by is completed", UserHelper.getUserName().getUsername()); } } return configSaveState; }
Source:
protected void validateMigration(SupportSQLiteDatabase db) { final Map<String, EntityBundle> tables = mDatabaseBundle.getEntitiesByTableName(); for (EntityBundle entity : tables.values()) { if (entity instanceof FtsEntityBundle) { final FtsTableInfo expected = toFtsTableInfo((FtsEntityBundle) entity); final FtsTableInfo found = FtsTableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + "\nFound:" + found); } } else { final TableInfo expected = toTableInfo(entity); final TableInfo found = TableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + " \nfound:" + found); } } } if (mVerifyDroppedTables) { List<String> excludeList = new ArrayList<>(); excludeList.add(Room.MASTER_TABLE_NAME); excludeList.add("android_metadata"); excludeList.add("sqlite_sequence"); for (EntityBundle entity : mDatabaseBundle.getEntities()) { if (entity instanceof FtsEntityBundle) { excludeList.addAll(((FtsEntityBundle) entity).getShadowTableNames()); } } StringBuilder query = new StringBuilder("SELECT name FROM sqlite_master " + "WHERE type='table' AND name NOT IN ("); for (int i = 0; i < excludeList.size(); i++) { if (i == 0) { query.append("?"); } else { query.append(",?"); } } query.append(")"); Cursor cursor = db.query(query.toString(), excludeList.toArray(new String[0])); try { while (cursor.moveToNext()) { final String tableName = cursor.getString(0); if (!tables.containsKey(tableName)) { throw new IllegalStateException("Migration failed. Unexpected table " + tableName); } } } finally { cursor.close(); } } }

Target:
protected void validateMigration(SupportSQLiteDatabase db) { final Map<String, EntityBundle> tables = mDatabaseBundle.getEntitiesByTableName(); for (EntityBundle entity : tables.values()) { if (entity instanceof FtsEntityBundle) { final FtsTableInfo expected = toFtsTableInfo((FtsEntityBundle) entity); final FtsTableInfo found = FtsTableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + "\nFound:" + found); } } else { final TableInfo expected = toTableInfo(entity); final TableInfo found = TableInfo.read(db, entity.getTableName()); if (!expected.equals(found)) { throw new IllegalStateException( "Migration failed.\nExpected:" + expected + " \nfound:" + found); } } } if (mVerifyDroppedTables) { Set<String> expectedTables = new HashSet<>(); for (EntityBundle entity : tables.values()) { expectedTables.add(entity.getTableName()); if (entity instanceof FtsEntityBundle) { expectedTables.addAll(((FtsEntityBundle) entity).getShadowTableNames()); } } Cursor cursor = db.query("SELECT name FROM sqlite_master WHERE type='table'" + " AND name NOT IN(?, ?, ?)", new String[]{Room.MASTER_TABLE_NAME, "android_metadata", "sqlite_sequence"}); try { while (cursor.moveToNext()) { final String tableName = cursor.getString(0); if (!expectedTables.contains(tableName)) { throw new IllegalStateException("Migration failed. Unexpected table " + tableName); } } } finally { cursor.close(); } } }
Source:
public boolean validate() { getName().validateEntity(new IValidation[] { new NotEmptyValidation(), new AsciiNameValidation() }); boolean ipv4 = getIpVersion().getSelectedItem() == IpVersion.IPV4; getCidr().validateEntity(new IValidation[] { ipv4 ? new CidrValidation() : new NotEmptyValidation() }); getIpVersion().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); if (getGateway().getEntity() != null && !getGateway().getEntity().isEmpty() && ipv4) { getGateway().validateEntity(new IValidation[] { new IpAddressValidation() }); } boolean dnsServersValid = true; for (EntityModel<String> dnsServer : getDnsServers().getItems()) { if (dnsServer.getEntity() != null && !dnsServer.getEntity().isEmpty() && ipv4) { dnsServer.validateEntity(new IValidation[] { new IpAddressValidation() }); } dnsServersValid &= dnsServer.getIsValid(); } return getName().getIsValid() && getCidr().getIsValid() && getIpVersion().getIsValid() && getGateway().getIsValid() && dnsServersValid; }

Target:
public boolean validate() { getName().validateEntity(new IValidation[] { new AsciiNameValidation() }); boolean ipv4 = getIpVersion().getSelectedItem() == IpVersion.IPV4; getCidr().validateEntity(new IValidation[] { ipv4 ? new CidrValidation() : new NotEmptyValidation() }); getIpVersion().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); if (StringUtils.isNotEmpty(getGateway().getEntity()) && ipv4) { getGateway().validateEntity(new IValidation[] { new IpAddressValidation() }); } boolean dnsServersValid = true; for (EntityModel<String> dnsServer : getDnsServers().getItems()) { if (StringUtils.isNotEmpty(dnsServer.getEntity()) && ipv4) { dnsServer.validateEntity(new IValidation[] { new IpAddressValidation() }); } dnsServersValid &= dnsServer.getIsValid(); } return getName().getIsValid() && getCidr().getIsValid() && getIpVersion().getIsValid() && getGateway().getIsValid() && dnsServersValid; }
Source:
void emit(long previousRequested) { if (requested == Long.MAX_VALUE) { if (previousRequested == 0) { try { for (Object value : deque) { notification.accept(subscriber, value); } } catch (Throwable e) { subscriber.onError(e); } finally { deque.clear(); } } else { } } else { if (previousRequested == 0) { while (true) { long numToEmit = requested; int emitted = 0; Object o; while (--numToEmit >= 0 && (o = deque.poll()) != null) { if (subscriber.isUnsubscribed()) { return; } if (notification.accept(subscriber, o)) { return; } else { emitted++; } } if (REQUESTED_UPDATER.addAndGet(this, -emitted) == 0) { return; } } } } }

Target:
void emit(long previousRequested) { if (requested == Long.MAX_VALUE) { if (previousRequested == 0) { try { for (Object value : deque) { notification.accept(subscriber, value); } } catch (Throwable e) { subscriber.onError(e); } finally { deque.clear(); } } else { } } else { if (previousRequested == 0) { while (true) { long numToEmit = requested; int emitted = 0; Object o; while (--numToEmit >= 0 && (o = deque.poll()) != null) { if (subscriber.isUnsubscribed()) { return; } if (notification.accept(subscriber, o)) { return; } else { emitted++; } } for (;;) { long oldRequested = requested; long newRequested = oldRequested - emitted; if (oldRequested == Long.MAX_VALUE) { break; } if (REQUESTED_UPDATER.compareAndSet(this, oldRequested, newRequested)) { if (newRequested == 0) { return; } break; } } } } } }