auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public synchronized String nextToken() { if (pos >= path.length) { return null; } StringBuilder tokenBuilder = new StringBuilder(path.length - pos); boolean inSingleQuote = false; boolean escaped = false; while (pos < path.length) { final char c = path[pos]; pos++; if (escaped) { tokenBuilder.append(c); escaped = false; } else { if (c == '\\') { escaped = true; } else if (c == '\'') { inSingleQuote = !inSingleQuote; } else if (c == '.' && !inSingleQuote) { break; } else { tokenBuilder.append(c); } } } final String token = tokenBuilder.toString(); if (token.length() > 0) { return token; } else { return null; } }

Target:
public synchronized String nextToken() { if (pos >= path.length) { return null; } tokenBuilder.setLength(0); boolean inSingleQuote = false; boolean escaped = false; while (pos < path.length) { final char c = path[pos]; pos++; if (escaped) { tokenBuilder.append(c); escaped = false; } else { if (c == '\\') { escaped = true; } else if (c == '\'') { inSingleQuote = !inSingleQuote; } else if (c == '.' && !inSingleQuote) { break; } else { tokenBuilder.append(c); } } } if (tokenBuilder.length() > 0) { return tokenBuilder.toString(); } else { return null; } }
Source:
public BinaryData getBody() { final AmqpBodyType type = amqpAnnotatedMessage.getBody().getBodyType(); switch (type) { case DATA: return BinaryData.fromBytes(((AmqpDataBody) amqpAnnotatedMessage.getBody()) .getData().stream().findFirst().get()); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException("Not supported AmqpBodyType: " + type.toString())); default: throw logger.logExceptionAsError(new IllegalArgumentException("Unknown AmqpBodyType: " + type.toString())); } }

Target:
public BinaryData getBody() { final AmqpBodyType type = amqpAnnotatedMessage.getBody().getBodyType(); switch (type) { case DATA: Optional<byte[]> byteArrayData = ((AmqpDataBody) amqpAnnotatedMessage.getBody()).getData().stream() .findFirst(); final byte[] bytes; if (byteArrayData.isPresent()) { bytes = byteArrayData.get(); } else { logger.warning("Data not present."); bytes = new byte[0]; } return BinaryData.fromBytes(bytes); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException("Not supported AmqpBodyType: " + type.toString())); default: throw logger.logExceptionAsError(new IllegalArgumentException("Unknown AmqpBodyType: " + type.toString())); } }
Source:
public Map<String, Object> destroy(@RequestParam String token) { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { String siteName = SiteContext.getCurrent().getSiteName(); contextManager.destroyContext(siteName); return createResponseMessage("Site context for '" + siteName + "' destroyed. Will be recreated on next " + "request"); } else { throw new InvalidMonitoringTokenException("Monitoring authorization failed, invalid token."); } }

Target:
public Map<String, Object> destroy(@RequestParam String token) throws InvalidManagementTokenException { if (StringUtils.isNotEmpty(token) && StringUtils.equals(token, getConfiguredToken())) { String siteName = SiteContext.getCurrent().getSiteName(); contextManager.destroyContext(siteName); return createResponseMessage("Site context for '" + siteName + "' destroyed. Will be recreated on next " + "request"); } else { throw new InvalidManagementTokenException("Monitoring authorization failed, invalid token."); } }
Source:
public YouViewResult upload(Payload payload) { final String queryUrl = urlBase + TRANSACTION_URL_STEM; final String payloadString = payload.payload(); log.trace("POSTing YouView output xml to {}", queryUrl); Retryer<HttpResponse> retryer = getHttpRequestRetryer(); Callable<HttpResponse> uploadCall = new Callable<HttpResponse>() { @Override public HttpResponse call() throws Exception { uploadRetryCount++; log.trace("YouView upload retry count - {}", uploadRetryCount); return httpClient.post(queryUrl, new StringPayload(payloadString)); } }; try { HttpResponse response = retryer.call(uploadCall); uploadRetryCount = 0; if (response.statusCode() == HttpServletResponse.SC_ACCEPTED) { String transactionUrl = parseIdFrom(response.header("Location")); log.trace("Upload successful. Transaction url: " + transactionUrl); return success(transactionUrl, clock.now(), response.statusCode()); } else { return failure(response.body(), clock.now(), response.statusCode()); } } catch (ExecutionException e) { throw new YouViewClientException("Error uploading " + payload, e); } catch (RetryException e) { throw new YouViewClientException("Error uploading " + payload, e); } }

Target:
public YouViewResult upload(Payload payload) { final String queryUrl = urlBase + TRANSACTION_URL_STEM; final String payloadString = payload.payload(); log.trace("POSTing YouView output xml to {}", queryUrl); Retryer<HttpResponse> retryer = getHttpRequestRetryer(); Callable<HttpResponse> uploadCall = new Callable<HttpResponse>() { @Override public HttpResponse call() throws Exception { uploadRetryCount++; if (uploadRetryCount > 1) { log.warn("YouView upload retry count - {}", uploadRetryCount); } return httpClient.post(queryUrl, new StringPayload(payloadString)); } }; try { HttpResponse response = retryer.call(uploadCall); uploadRetryCount = 0; if (response.statusCode() == HttpServletResponse.SC_ACCEPTED) { String transactionUrl = parseIdFrom(response.header("Location")); log.trace("Upload successful. Transaction url: " + transactionUrl); return success(transactionUrl, clock.now(), response.statusCode()); } else { return failure(response.body(), clock.now(), response.statusCode()); } } catch (ExecutionException e) { throw new YouViewClientException("Error uploading " + payload, e); } catch (RetryException e) { throw new YouViewClientException("Error uploading " + payload, e); } }
Source:
public static BatchSizeRecorder create(String safeLoggerIdentifier) { Histogram meter = SharedTaggedMetricRegistries.getSingleton().histogram(MetricName.builder() .safeName(AUTOBATCHER_METER) .putSafeTags("safeIdentifier", safeLoggerIdentifier) .build()); return new BatchSizeRecorder(meter); }

Target:
public static BatchSizeRecorder create(String safeLoggerIdentifier) { Histogram histogram = SharedTaggedMetricRegistries.getSingleton().histogram(MetricName.builder() .safeName(AUTOBATCHER_METER) .putSafeTags("identifier", safeLoggerIdentifier) .build()); return new BatchSizeRecorder(histogram); }
Source:
public ComparisonExecutor(AliasResolver aliasResolver) { asyncComparisonExecutor = newAsyncComparisonExecutor(); this.aliasResolver = aliasResolver; }

Target:
public ComparisonExecutor(AliasResolver aliasResolver) { this(newAsyncComparisonExecutor(), aliasResolver); }
Source:
public SortField customType() { BytesRef byteRefMissingValue = new BytesRef( missingValue.toString() ); return new SortField( absoluteFieldPath, new LuceneMissingValueComparatorSource( byteRefMissingValue ), order == SortOrder.DESC ); }

Target:
public SortField customType() { return new SortField( absoluteFieldPath, new LuceneMissingValueComparatorSource( (BytesRef) missingValue ), order == SortOrder.DESC ); }
Source:
public void testPercentilesWithRandomNumbersAndLinearBucketing() { long seed = new Random().nextLong(); int sizeInBytes = 1000 * 1000; long maximumValue = 1000 * 24 * 60 * 60 * 1000L; try { Random prng = new Random(seed); int numberOfValues = 5000 + prng.nextInt(10_000); Percentiles percs = new Percentiles(sizeInBytes, maximumValue, BucketSizing.LINEAR, new Percentile(metrics.metricName("test.p90", "grp1"), 90), new Percentile(metrics.metricName("test.p99", "grp1"), 99)); MetricConfig config = new MetricConfig().eventWindow(50).samples(2); Sensor sensor = metrics.sensor("test", config); sensor.add(percs); Metric p90 = this.metrics.metrics().get(metrics.metricName("test.p90", "grp1")); Metric p99 = this.metrics.metrics().get(metrics.metricName("test.p99", "grp1")); final List<Long> values = new ArrayList<>(numberOfValues); for (int i = 0; i < numberOfValues; ++i) { long value = Math.abs(prng.nextLong()) % maximumValue; values.add(value); sensor.record(value); } Collections.sort(values); int p90Index = (int)Math.ceil(((double)(90 * numberOfValues)) / 100); int p99Index = (int)Math.ceil(((double)(99 * numberOfValues)) / 100); double expectedP90 = values.get(p90Index - 1); double expectedP99 = values.get(p99Index - 1); assertEquals(expectedP90, (Double) p90.metricValue(), expectedP90 / 10); assertEquals(expectedP99, (Double) p99.metricValue(), expectedP99 / 10); } catch (AssertionError e) { throw new AssertionError("Assertion failed in randomized test. Reproduce with seed = " + seed + " .", e); } }

Target:
public void testPercentilesWithRandomNumbersAndLinearBucketing() { long seed = new Random().nextLong(); int sizeInBytes = 1000 * 1000; long maximumValue = 1000 * 24 * 60 * 60 * 1000L; try { Random prng = new Random(seed); int numberOfValues = 5000 + prng.nextInt(10_000); Percentiles percs = new Percentiles(sizeInBytes, maximumValue, BucketSizing.LINEAR, new Percentile(metrics.metricName("test.p90", "grp1"), 90), new Percentile(metrics.metricName("test.p99", "grp1"), 99)); MetricConfig config = new MetricConfig().eventWindow(50).samples(2); Sensor sensor = metrics.sensor("test", config); sensor.add(percs); Metric p90 = this.metrics.metrics().get(metrics.metricName("test.p90", "grp1")); Metric p99 = this.metrics.metrics().get(metrics.metricName("test.p99", "grp1")); final List<Long> values = new ArrayList<>(numberOfValues); for (int i = 0; i < numberOfValues; ++i) { long value = (Math.abs(prng.nextLong()) - 1) % maximumValue; values.add(value); sensor.record(value); } Collections.sort(values); int p90Index = (int) Math.ceil(((double) (90 * numberOfValues)) / 100); int p99Index = (int) Math.ceil(((double) (99 * numberOfValues)) / 100); double expectedP90 = values.get(p90Index - 1); double expectedP99 = values.get(p99Index - 1); assertEquals(expectedP90, (Double) p90.metricValue(), expectedP90 / 10); assertEquals(expectedP99, (Double) p99.metricValue(), expectedP99 / 10); } catch (AssertionError e) { throw new AssertionError("Assertion failed in randomized test. Reproduce with seed = " + seed + " .", e); } }
Source:
private CompletionStage<Void> closeClientResources(long quietPeriod, long timeout, TimeUnit timeUnit) { List<CompletableFuture<Void>> groupCloseFutures = new ArrayList<>(); if (!sharedResources) { Future<?> groupCloseFuture = clientResources.shutdown(quietPeriod, timeout, timeUnit); groupCloseFutures.add(toCompletableFuture(groupCloseFuture)); } else { for (EventLoopGroup eventExecutors : eventLoopGroups.values()) { Future<?> groupCloseFuture = clientResources.eventLoopGroupProvider().release(eventExecutors, quietPeriod, timeout, timeUnit); groupCloseFutures.add(toCompletableFuture(groupCloseFuture)); } } return Futures.allOf(groupCloseFutures); }

Target:
private CompletableFuture<Void> closeClientResources(long quietPeriod, long timeout, TimeUnit timeUnit) { List<CompletableFuture<Void>> groupCloseFutures = new ArrayList<>(); if (!sharedResources) { Future<?> groupCloseFuture = clientResources.shutdown(quietPeriod, timeout, timeUnit); groupCloseFutures.add(toCompletableFuture(groupCloseFuture)); } else { for (EventLoopGroup eventExecutors : eventLoopGroups.values()) { Future<?> groupCloseFuture = clientResources.eventLoopGroupProvider().release(eventExecutors, quietPeriod, timeout, timeUnit); groupCloseFutures.add(toCompletableFuture(groupCloseFuture)); } } return Futures.allOf(groupCloseFutures); }
Source:
List<Municipality> GetMunicipalityByCourtId(@PathVariable("courtId") Long courtId) throws NotFoundException { List<Municipality> municipalities = municipalityManager.GetMunicipalitiesByCourtId(courtId); return municipalities; }

Target:
List<Municipality> GetMunicipalityByCourtId(@PathVariable("courtId") Long courtId) throws NotFoundException { return municipalityManager.GetMunicipalitiesByCourtId(courtId); }
Source:
public static <T> Iterable<T> servicesOfType(Class<T> serviceType) { if (SafeOsgi.inOSGi()) { return OsgiServiceLoader.load(serviceType); } else { return ServiceLoader.load(serviceType, ClassLoading.class.getClassLoader()); } }

Target:
public static <T> Iterable<T> servicesOfType(Class<T> serviceType) { if (SafeOsgi.useOSGiServiceLoading()) { return OsgiServiceLoader.load(serviceType); } else { return ServiceLoader.load(serviceType, ClassLoading.class.getClassLoader()); } }
Source:
public void repositoryUrl() throws Exception { GitHubSCMSource instance = load(); assertThat(instance.getId(), is("e4d8c11a-0d24-472f-b86b-4b017c160e9a")); assertThat(instance.getApiUri(), is("<LINK_0>")); assertThat(instance.getRepoOwner(), is("joseblas")); assertThat(instance.getRepository(), is("jx")); assertThat(instance.getCredentialsId(), is("abcd")); assertThat(instance.getRepositoryUrl(), is("<LINK_1>")); assertThat(instance.getTraits(), is(Collections.<SCMSourceTrait>emptyList())); assertThat(instance.getCheckoutCredentialsId(), is(GitHubSCMSource.DescriptorImpl.SAME)); assertThat(instance.getIncludes(), is("*")); assertThat(instance.getExcludes(), is("")); assertThat(instance.getBuildOriginBranch(), is(false)); assertThat(instance.getBuildOriginBranchWithPR(), is(false)); assertThat(instance.getBuildOriginPRHead(), is(false)); assertThat(instance.getBuildOriginPRMerge(), is(false)); assertThat(instance.getBuildForkPRHead(), is(false)); assertThat(instance.getBuildForkPRMerge(), is(false)); }

Target:
public void repositoryUrl() throws Exception { GitHubSCMSource instance = load(); assertThat(instance.getId(), is("e4d8c11a-0d24-472f-b86b-4b017c160e9a")); assertThat(instance.getApiUri(), is(GitHubSCMSource.GITHUB_URL)); assertThat(instance.getRepoOwner(), is("joseblas")); assertThat(instance.getRepository(), is("jx")); assertThat(instance.getCredentialsId(), is("abcd")); assertThat(instance.getRepositoryUrl(), is("<LINK_1>")); assertThat(instance.getTraits(), is(Collections.<SCMSourceTrait>emptyList())); assertThat(instance.getCheckoutCredentialsId(), is(GitHubSCMSource.DescriptorImpl.SAME)); assertThat(instance.getIncludes(), is("*")); assertThat(instance.getExcludes(), is("")); assertThat(instance.getBuildOriginBranch(), is(false)); assertThat(instance.getBuildOriginBranchWithPR(), is(false)); assertThat(instance.getBuildOriginPRHead(), is(false)); assertThat(instance.getBuildOriginPRMerge(), is(false)); assertThat(instance.getBuildForkPRHead(), is(false)); assertThat(instance.getBuildForkPRMerge(), is(false)); }
Source:
public BikeFlagEncoder() { this(new PMap()); }

Target:
public BikeFlagEncoder() { this(4, 2, 0); }
Source:
private Module[] getModules(Guice guice, Injector parentInjector, Class<?> testClass) { List<Module> result = Lists.newArrayList(); for (Class<? extends Module> moduleClass : guice.modules()) { List<Module> modules = context.getGuiceModules(moduleClass); if (modules != null && !modules.isEmpty()) { result.addAll(modules); } else { Module instance = parentInjector.getInstance(moduleClass); result.add(instance); context.getGuiceModules(moduleClass).add(instance); } } Class<? extends IModuleFactory> factory = guice.moduleFactory(); if (factory != IModuleFactory.class) { IModuleFactory factoryInstance = parentInjector.getInstance(factory); Module moduleClass = factoryInstance.createModule(context, testClass); if (moduleClass != null) { result.add(moduleClass); } } return result.toArray(new Module[result.size()]); }

Target:
private List<Module> getModules(Guice guice, Injector parentInjector, Class<?> testClass) { List<Module> result = Lists.newArrayList(); for (Class<? extends Module> moduleClass : guice.modules()) { List<Module> modules = context.getGuiceModules(moduleClass); if (modules != null && !modules.isEmpty()) { result.addAll(modules); } else { Module instance = parentInjector.getInstance(moduleClass); result.add(instance); context.getGuiceModules(moduleClass).add(instance); } } Class<? extends IModuleFactory> factory = guice.moduleFactory(); if (factory != IModuleFactory.class) { IModuleFactory factoryInstance = parentInjector.getInstance(factory); Module moduleClass = factoryInstance.createModule(context, testClass); if (moduleClass != null) { result.add(moduleClass); } } return result; }
Source:
public String getPeerUserAgent() { return UserAgent.getAgent(currentRequest.getOptions(), userAgent); }

Target:
public String getPeerUserAgent() { Set<String> clientCapabilities = currentRequest == null ? null : currentRequest.getClientCapabilities(); return UserAgent.getAgent(clientCapabilities, userAgent); }
Source:
protected String[] getDisallowedNameExpressions() { return new String[] { "^(?!private-encrypted).*" }; }

Target:
protected String[] getDisallowedNameExpressions() { return new String[] { "^(?!private-encrypted-).*" }; }
Source:
public void testGetMediaBytes() { byte[] testBytes = {}; when(urlService.fetchUrlConnection(any(String.class))).thenReturn(urlConnection); when(urlService.fetchInputStreamFromConnection(urlConnection)).thenReturn(inputStream); when(urlService.inputStreamToByteArray(any(InputStream.class))).thenReturn(testBytes); Response response = resource.getMediaBytes(key, "Test"); byte[] userResponse = (byte[]) response.getEntity(); assertEquals(response.getStatusInfo(), Response.Status.OK); assertEquals(userResponse, testBytes); }

Target:
public void testGetMediaBytes() { byte[] testBytes = {}; when(urlService.fetchUrlConnection(any(String.class))).thenReturn(urlConnection); when(urlService.fetchInputStreamFromConnection(urlConnection)).thenReturn(inputStream); when(urlService.inputStreamToByteArray(inputStream)).thenReturn(testBytes); Response response = resource.getMediaBytes(key, "Test"); byte[] userResponse = (byte[]) response.getEntity(); assertEquals(response.getStatusInfo(), Response.Status.OK); assertEquals(userResponse, testBytes); }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { writePermission= true; asked = true; } embedCode = getIntent().getExtras().getString("embed_code"); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { writePermission= true; asked = true; } }
Source:
private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { String diskAlias = descriptionFields.get(DISK_ALIAS).toString(); Map<String, Object> descriptionMap = new TreeMap<>(); int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { if (descriptionAvailableLength == 0) { String[] descriptionFieldsLeft = Arrays.copyOfRange(descriptionFieldsPriority, priority, descriptionFieldsPriority.length); auditLogNoSpaceToStoreDiskFields(diskAlias, StringUtils.join(descriptionFieldsLeft, ", ", 0, descriptionFieldsLeft.length)); break; } descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, diskAlias, descriptionFieldsPriority[priority], descriptionFields.get(descriptionFieldsPriority[priority]).toString(), descriptionAvailableLength); } return descriptionMap; }

Target:
private Map<String, Object> generateJsonDiskDescription(Map<String, Object> descriptionFields, String... descriptionFieldsPriority) { String diskAlias = descriptionFields.get(DISK_ALIAS).toString(); Map<String, Object> descriptionMap = new TreeMap<>(); int descriptionAvailableLength = METADATA_DESCRIPTION_MAX_LENGTH; for (int priority = 0; priority < descriptionFieldsPriority.length; ++priority) { String fieldName = descriptionFieldsPriority[priority]; String fieldValue = descriptionFields.get(fieldName).toString(); descriptionAvailableLength = addFieldToDescriptionMap(descriptionMap, diskAlias, fieldName, fieldValue, descriptionAvailableLength); if (descriptionAvailableLength <= 0) { String storedFieldValue = (String) descriptionMap.get(fieldName); String[] descriptionFieldsLeft = Arrays.copyOfRange(descriptionFieldsPriority, priority, descriptionFieldsPriority.length); String diskFieldsNames = StringUtils.join(descriptionFieldsLeft, ", ", 0, descriptionFieldsLeft.length); if (storedFieldValue == null) { auditLogFailedToStoreDiskFields(diskAlias, diskFieldsNames); } else if (storedFieldValue.length() < fieldValue.length()) { auditLogFailedToStoreEntireDiskField(diskAlias, fieldName, storedFieldValue, diskFieldsNames); } break; } } return descriptionMap; }
Source:
protected boolean canDoAction() { initializeObjectState(); getVmDAO().get(getVmId()); if (!validateVmNotDuringSnapshot()) { handleCanDoActionFailure(); return false; } if (!validateSnapshotExists()) { handleCanDoActionFailure(); return false; } if (!validateImages()) { handleCanDoActionFailure(); return false; } if (!validateImageNotInTemplate()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE); handleCanDoActionFailure(); return false; } if (!validateImageNotActive()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE); handleCanDoActionFailure(); return false; } getReturnValue().setCanDoAction(true); return true; }

Target:
protected boolean canDoAction() { initializeObjectState(); if (!validateVmNotDuringSnapshot()) { handleCanDoActionFailure(); return false; } if (!validateSnapshotExists()) { handleCanDoActionFailure(); return false; } if (!validateImages()) { handleCanDoActionFailure(); return false; } if (!validateImageNotInTemplate()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE); handleCanDoActionFailure(); return false; } if (!validateImageNotActive()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE); handleCanDoActionFailure(); return false; } getReturnValue().setCanDoAction(true); return true; }
Source:
void mapActionItemsToSelection(ISelection selection) { setMoveItemsEnabled(false); if (selection == null || selection.isEmpty()) return; if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; Object obj = structured.getFirstElement(); if (!(obj instanceof PlanElement)) return; PlanElement firstSelectedEntry = (PlanElement) obj; PlanElement lastSelectedEntry = firstSelectedEntry; ElementAction type = firstSelectedEntry.getPlanElementAction(); boolean singleTypeSelected = true; if (structured.size() > 1) { for (Iterator iterator = structured.iterator(); iterator .hasNext();) { Object selectedObj = iterator.next(); if (!(selectedObj instanceof PlanElement)) continue; PlanElement entry = lastSelectedEntry = (PlanElement) selectedObj; if (type != entry.getPlanElementAction()) { singleTypeSelected = false; break; } } } if (singleTypeSelected) unselectAllActionItemsExecpt(getItemFor(type)); else unselectAllActionItemsExecpt(null); enableMoveButtons(firstSelectedEntry, lastSelectedEntry); } }

Target:
void mapActionItemsToSelection(ISelection selection) { setMoveItemsEnabled(false); if (selection == null || selection.isEmpty()) return; if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; Object obj = structured.getFirstElement(); if (!(obj instanceof PlanElement)) return; PlanElement firstSelectedEntry = (PlanElement) obj; PlanElement lastSelectedEntry = firstSelectedEntry; ElementAction type = firstSelectedEntry.getPlanElementAction(); boolean singleTypeSelected = true; if (structured.size() > 1) { for (Object selectedObj : structured.toList()) { if (!(selectedObj instanceof PlanElement)) continue; PlanElement entry = (PlanElement) selectedObj; lastSelectedEntry = entry; if (type != entry.getPlanElementAction()) { singleTypeSelected = false; } } } if (singleTypeSelected) unselectAllActionItemsExecpt(getItemFor(type)); else unselectAllActionItemsExecpt(null); enableMoveButtons(firstSelectedEntry, lastSelectedEntry); } }
Source:
public Image loadPreview(String mapName, PreviewSize previewSize) { if (mapGeneratorService.isGeneratedMap(mapName)) { try { BufferedImage image = ImageIO.read(forgedAlliancePreferences.getCustomMapsDirectory().resolve(mapName).resolve(mapName + "_preview.png").toFile()); return SwingFXUtils.toFXImage(image, null); } catch (IOException e) { return mapGeneratorService.getGeneratedMapPreviewImage(); } } return loadPreview(getPreviewUrl(mapName, mapPreviewUrlFormat, previewSize), previewSize); }

Target:
public Image loadPreview(String mapName, PreviewSize previewSize) { if (mapGeneratorService.isGeneratedMap(mapName)) { Path previewPath = forgedAlliancePreferences.getCustomMapsDirectory().resolve(mapName).resolve(mapName + "_preview.png"); if (Files.exists(previewPath)) { return new Image(Files.newInputStream(previewPath)); } else { return mapGeneratorService.getGeneratedMapPreviewImage(); } } return loadPreview(getPreviewUrl(mapName, mapPreviewUrlFormat, previewSize), previewSize); }
Source:
public void fillMenu() { if (descriptionFileChanged || dRepresentationChanged) { descriptionFileChanged = false; dRepresentationChanged = false; final Map<TableMapping, DeleteTargetColumnAction> mappingToDeleteActions = Maps.newHashMap(); final Map<TableMapping, List<AbstractToolAction>> mappingToCreateActions = Maps.newHashMap(); final List<AbstractToolAction> createActionsForTable = Lists.newArrayList(); calculateAvailableMenus(mappingToDeleteActions, mappingToCreateActions, createActionsForTable); mgr.setRemoveAllWhenShown(true); if (dRepresentationChanged || actualMenuListener == null) { if (dRepresentationChanged) { mgr.removeMenuListener(actualMenuListener); } actualMenuListener = new DTableMenuListener((DTable) dRepresentation, this, mappingToCreateActions, mappingToDeleteActions, createActionsForTable); mgr.addMenuListener(actualMenuListener); final Menu menu = mgr.createContextMenu(treeViewer.getControl()); treeViewer.getControl().setMenu(menu); treeEditor.getSite().registerContextMenu(mgr, treeViewer); } else { mgr.removeAll(); actualMenuListener.setMappingToCreateActions(mappingToCreateActions); actualMenuListener.setMappingToDeleteActions(mappingToDeleteActions); actualMenuListener.setCreateActionsForTable(createActionsForTable); } getCreateLineMenu().update(createActionsForTable); getCreateTargetColumnMenu().update(createActionsForTable); } }

Target:
public void fillMenu() { if (descriptionFileChanged || dRepresentationReplaced) { descriptionFileChanged = false; final Map<TableMapping, DeleteTargetColumnAction> mappingToDeleteActions = Maps.newHashMap(); final Map<TableMapping, List<AbstractToolAction>> mappingToCreateActions = Maps.newHashMap(); final List<AbstractToolAction> createActionsForTable = Lists.newArrayList(); calculateAvailableMenus(mappingToDeleteActions, mappingToCreateActions, createActionsForTable); mgr.setRemoveAllWhenShown(true); if (dRepresentationReplaced || actualMenuListener == null) { if (dRepresentationReplaced) { mgr.removeMenuListener(actualMenuListener); } actualMenuListener = new DTableMenuListener((DTable) dRepresentation, this, mappingToCreateActions, mappingToDeleteActions, createActionsForTable); mgr.addMenuListener(actualMenuListener); final Menu menu = mgr.createContextMenu(treeViewer.getControl()); treeViewer.getControl().setMenu(menu); treeEditor.getSite().registerContextMenu(mgr, treeViewer); } else { mgr.removeAll(); actualMenuListener.setMappingToCreateActions(mappingToCreateActions); actualMenuListener.setMappingToDeleteActions(mappingToDeleteActions); actualMenuListener.setCreateActionsForTable(createActionsForTable); } getCreateLineMenu().update(createActionsForTable); getCreateTargetColumnMenu().update(createActionsForTable); dRepresentationReplaced = false; } }
Source:
public PMML4Result evaluate(String modelName, PMMLContext context) { logger.debug("evaluate {}", modelName, context); KiePMMLModel toEvaluate = getModel(modelName).orElseThrow(() -> new KiePMMLException("Failed to retrieve model with name " + modelName)); return evaluate(toEvaluate, context); }

Target:
public PMML4Result evaluate(String modelName, PMMLContext context) { if (logger.isDebugEnabled()) { logger.debug("evaluate {}", modelName, context); } KiePMMLModel toEvaluate = getModel(modelName).orElseThrow(() -> new KiePMMLException("Failed to retrieve model with name " + modelName)); return evaluate(toEvaluate, context); }
Source:
private static <T> List<T> loadFixtures(List<FixtureConfiguration> configurations, Class<T> clazz, String fixtureType, boolean defaultOnly) { List<T> result = new ArrayList<T>(); String defaultOverwrite = System.getProperty("defaultOverwrite", ""); for (FixtureConfiguration configuration : configurations) { if (configuration != null && fixtureType.equals(configuration.getType()) && (!defaultOnly || (defaultOverwrite.equals("") && (configuration.isDefault())) || (configuration.url.equals(defaultOverwrite)))) { try { Constructor<T> constructor = clazz.getConstructor(FixtureConfiguration.class); result.add(constructor.newInstance(configuration)); } catch (Exception e) { throw new RuntimeException("Unexpected error creating test fixture", e); } } } return result; }

Target:
private static <T> List<T> loadFixtures(List<FixtureConfiguration> configurations, Class<T> clazz, String fixtureType, boolean defaultOnly) { List<T> result = new ArrayList<T>(); String defaultOverwriteUrl = System.getProperty("mylyn.tests.configuration.url", ""); for (FixtureConfiguration configuration : configurations) { if (configuration != null && fixtureType.equals(configuration.getType()) && (!defaultOnly || (defaultOverwriteUrl.equals("") && configuration.isDefault()) || (configuration.url.equals(defaultOverwriteUrl)))) { try { Constructor<T> constructor = clazz.getConstructor(FixtureConfiguration.class); result.add(constructor.newInstance(configuration)); } catch (Exception e) { throw new RuntimeException("Unexpected error creating test fixture", e); } } } return result; }
Source:
public void close() throws IOException { try { super.close(); } finally { is.close(); } }

Target:
public void close() throws IOException { is.close(); }
Source:
public RntbdRequestRecord request(final RntbdRequestArgs args) { this.throwIfClosed(); int concurrentRequestSnapshot = this.concurrentRequests.incrementAndGet(); if (concurrentRequestSnapshot > this.maxConcurrentRequests) { return FailFastRntbdRequestRecord.createAndFailFast( args, concurrentRequestSnapshot, concurrentRequests, metrics, remoteAddress); } this.lastRequestNanoTime.set(args.nanoTimeCreated()); final RntbdRequestRecord record = this.write(args); record.whenComplete((response, error) -> { this.concurrentRequests.decrementAndGet(); this.metrics.markComplete(record); }); return record; }

Target:
public RntbdRequestRecord request(final RntbdRequestArgs args) { this.throwIfClosed(); int concurrentRequestSnapshot = this.concurrentRequests.incrementAndGet(); if (concurrentRequestSnapshot > this.maxConcurrentRequests) { try { return FailFastRntbdRequestRecord.createAndFailFast( args, concurrentRequestSnapshot, metrics, remoteAddress); } finally { concurrentRequests.decrementAndGet(); } } this.lastRequestNanoTime.set(args.nanoTimeCreated()); final RntbdRequestRecord record = this.write(args); record.whenComplete((response, error) -> { this.concurrentRequests.decrementAndGet(); this.metrics.markComplete(record); }); return record; }
Source:
public synchronized void checkWorkersTobeReadyForServerDelete(final String serverId, final EventHandler<Void> callback) { if (activeWorkerIds.isEmpty()) { LOG.log(Level.SEVERE, "No existing workers"); callback.onNext(null); return; } if (ongoingSyncs.containsKey(serverId)) { LOG.log(Level.WARNING, "Sync for {0} is already ongoing", serverId); return; } final Set<String> workersToCheck = (Set<String>) activeWorkerIds.clone(); ongoingSyncs.put(serverId, new Tuple<>(workersToCheck, callback)); LOG.log(Level.INFO, "Send sync msg for {0} to workers: {1}", new Object[]{serverId, workersToCheck}); broadcastSyncMsg(serverId, workersToCheck); }

Target:
public synchronized void checkWorkersTobeReadyForServerDelete(final String serverId, final EventHandler<Void> callback) { if (activeWorkerIds.isEmpty()) { LOG.log(Level.SEVERE, "No existing workers"); callback.onNext(null); return; } if (ongoingSyncs.containsKey(serverId)) { LOG.log(Level.WARNING, "Sync for {0} is already ongoing", serverId); return; } final Set<String> workersToCheck = new HashSet<>(activeWorkerIds); ongoingSyncs.put(serverId, new Tuple<>(workersToCheck, callback)); LOG.log(Level.INFO, "Send sync msg for {0} to workers: {1}", new Object[]{serverId, workersToCheck}); broadcastSyncMsg(serverId, workersToCheck); }
Source:
public void onInstall() { final VDS host = getSelectedItem(); InstallModel model = (InstallModel) getWindow(); final UpdateVdsActionParameters param = new UpdateVdsActionParameters(); param.setvds(host); param.setVdsId(host.getId()); param.setPassword(model.getUserPassword().getEntity()); param.setReinstallOrUpgrade(true); param.setInstallHost(true); param.setoVirtIsoFile(null); param.setOverrideFirewall(model.getOverrideIpTables().getEntity()); param.setActivateHost(model.getActivateHostAfterInstall().getEntity()); param.setReconfigureGluster(model.getActivateHostAfterInstall().getEntity()); param.setAuthMethod(model.getAuthenticationMethod()); param.setFenceAgents(null); param.setHostedEngineDeployConfiguration( new HostedEngineDeployConfiguration(model.getHostedEngineHostModel().getSelectedItem())); AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(returnValue -> Frontend.getInstance().runAction( ActionType.InstallVds, param, result -> { ActionReturnValue returnValue1 = result.getReturnValue(); if (returnValue1 != null && returnValue1.getSucceeded()) { cancel(); } } )), host.getClusterId()); }

Target:
public void onInstall() { final VDS host = getSelectedItem(); InstallModel model = (InstallModel) getWindow(); final UpdateVdsActionParameters param = new UpdateVdsActionParameters(); param.setvds(host); param.setVdsId(host.getId()); param.setPassword(model.getUserPassword().getEntity()); param.setReinstallOrUpgrade(true); param.setInstallHost(true); param.setoVirtIsoFile(null); param.setOverrideFirewall(model.getOverrideIpTables().getEntity()); param.setActivateHost(model.getActivateHostAfterInstall().getEntity()); param.setReconfigureGluster(model.getReconfigureGluster().getEntity()); param.setAuthMethod(model.getAuthenticationMethod()); param.setFenceAgents(null); param.setHostedEngineDeployConfiguration( new HostedEngineDeployConfiguration(model.getHostedEngineHostModel().getSelectedItem())); AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(returnValue -> Frontend.getInstance().runAction( ActionType.InstallVds, param, result -> { ActionReturnValue returnValue1 = result.getReturnValue(); if (returnValue1 != null && returnValue1.getSucceeded()) { cancel(); } } )), host.getClusterId()); }
Source:
ConcurrentHashMap<List<StackTraceElement>, MissingClassEvent> getEventsAndClean() { ConcurrentHashMap<List<StackTraceElement>, MissingClassEvent> currentEvents = events; events = new ConcurrentHashMap<>(MAX_EVENTS_PER_SEND); return currentEvents; }

Target:
synchronized @Nonnull ConcurrentHashMap<List<StackTraceElement>, MissingClassEvent> getEventsAndClean() { ConcurrentHashMap<List<StackTraceElement>, MissingClassEvent> currentEvents = events; events = new ConcurrentHashMap<>(MAX_EVENTS_PER_SEND); return currentEvents; }
Source:
private CreateInfo parseAttachment(Part contentPart) { CreateInfo createInfo = new CreateInfo(); InputStream stream; String filename; String contentType = null; try { stream = contentPart.getInputStream(); if (stream != null && stream.available() == 0) { stream.reset(); } createInfo.setStream(stream); } catch (IOException e) { LOGGER.info("IOException reading stream from file attachment in multipart body", e); } if (contentPart.getContentType() != null) { contentType = contentPart.getContentType(); } filename = contentPart.getSubmittedFileName(); if (StringUtils.isEmpty(filename)) { LOGGER.debug("No filename parameter provided - generating default filename"); String fileExtension = DEFAULT_FILE_EXTENSION; try { fileExtension = mimeTypeMapper.getFileExtensionForMimeType(contentType); if (StringUtils.isEmpty(fileExtension)) { fileExtension = DEFAULT_FILE_EXTENSION; } } catch (MimeTypeResolutionException e) { LOGGER.debug("Exception getting file extension for contentType = {}", contentType); } filename = DEFAULT_FILE_NAME + "." + fileExtension; LOGGER.debug("No filename parameter provided - default to {}", filename); } else { filename = FilenameUtils.getName(filename); if (StringUtils.isEmpty(contentType) || REFINEABLE_MIME_TYPES.contains(contentType)) { contentType = contentTypeFromFilename(filename); } } createInfo.setContentType(contentType); createInfo.setFilename(filename); return createInfo; }

Target:
private AttachmentInfo parseAttachment(Part contentPart) { InputStream stream = null; try { stream = contentPart.getInputStream(); } catch (IOException e) { LOGGER.info("IOException reading stream from file attachment in multipart body", e); } return attachmentParser.generateAttachmentInfo( stream, contentPart.getContentType(), contentPart.getSubmittedFileName()); }
Source:
public void activate(final Map<Object, Object> config) { runtimeConfiguration = new ISYActiveBindingConfig(config); setProperlyConfigured(true); this.insteonClient = new InsteonClient(runtimeConfiguration.getUser(), runtimeConfiguration.getPassword(), this); Errors.addErrorListener(new ErrorHandler()); if (runtimeConfiguration.isUseUpnp()) { this.logger.info("ISY: using UPNP to communicate with ISY"); this.insteonClient.start(); } else { this.logger.info("ISY: using URL to communicate with ISY"); try { this.insteonClient.start(runtimeConfiguration.getUuid(), String.format("http://%s:%s", runtimeConfiguration.getIpAddress(), runtimeConfiguration.getPort())); } catch (Exception e) { throw new RuntimeException(e); } } }

Target:
public void activate(final Map<Object, Object> config) { runtimeConfiguration = new ISYActiveBindingConfig(config); this.insteonClient = new InsteonClient(runtimeConfiguration.getUser(), runtimeConfiguration.getPassword(), this); Errors.addErrorListener(new ErrorHandler()); if (runtimeConfiguration.isUseUpnp()) { this.logger.info("ISY: using UPNP to communicate with ISY"); this.insteonClient.start(); } else { this.logger.info("ISY: using URL to communicate with ISY"); try { this.insteonClient.start(runtimeConfiguration.getUuid(), String.format("http://%s:%s", runtimeConfiguration.getIpAddress(), runtimeConfiguration.getPort())); } catch (Exception e) { throw new RuntimeException(e); } } setProperlyConfigured(true); }
Source:
public int hashCode() { return id; }

Target:
public int hashCode() { return id != null ? id.hashCode() : 0; }
Source:
private Set<IProjectAdapter> getOrCreateEntry(String key) { Set<IProjectAdapter> adapters = cache.get(key); if (adapters == null) { adapters = createEntry(key); } return adapters; }

Target:
private Set<IProjectAdapter> getOrCreateEntry(String key) { synchronized (cache) { Set<IProjectAdapter> adapters = getEntry(key); if (adapters == null) { adapters = createEntry(key); } return adapters; } }
Source:
public boolean isSubtypeOf(ValueType t, TypeContext ctx) { t = t.getCanonicalType(ctx); if (t instanceof DynamicType) return true; if (t instanceof NominalType) { StructuralType st = ((NominalType) t).getStructuralType(ctx, null); if (st == null) return true; else return isSubtypeOf(st, ctx); } if (!(t instanceof StructuralType)) return false; StructuralType st = (StructuralType) t; st = (StructuralType) st.adapt(new ReceiverView(new Variable(st.selfName), new Variable(selfName))); TypeContext extendedCtx = ctx.extend(selfName, this); for (DeclType dt : st.getDeclTypes()) { DeclType candidateDT = findDecl(dt.getName(), ctx); if (candidateDT == null || !candidateDT.isSubtypeOf(dt, extendedCtx)) { return false; } } if (isResource(GenContext.empty()) && !st.isResource(GenContext.empty())) return false; return true; }

Target:
public boolean isSubtypeOf(ValueType t, TypeContext ctx) { t = t.getCanonicalType(ctx); if (t instanceof DynamicType) return true; if (t instanceof NominalType) { StructuralType st = ((NominalType) t).getStructuralType(ctx, null); if (st == null) return false; else return isSubtypeOf(st, ctx); } if (!(t instanceof StructuralType)) return false; StructuralType st = (StructuralType) t; st = (StructuralType) st.adapt(new ReceiverView(new Variable(st.selfName), new Variable(selfName))); TypeContext extendedCtx = ctx.extend(selfName, this); for (DeclType dt : st.getDeclTypes()) { DeclType candidateDT = findDecl(dt.getName(), ctx); if (candidateDT == null || !candidateDT.isSubtypeOf(dt, extendedCtx)) { return false; } } if (isResource(GenContext.empty()) && !st.isResource(GenContext.empty())) return false; return true; }
Source:
public RubyGemParser(IFile file) throws IOException, CoreException { mSetupDefinitions = new HashMap<String, ArrayList<Object>>(); mSetupDependencies = new HashMap<String, ArrayList<Object>>(); if (file.getContents().available() <= 0) return; this.file = file; gemVariable = ""; parse(); }

Target:
public RubyGemParser(IFile file) throws IOException, CoreException { mSetupDefinitions = new HashMap<String, ArrayList<String>>(); mSetupDependencies = new HashMap<String, ArrayList<String>>(); if (file.getContents().available() <= 0) { return; } this.file = file; gemVariable = ""; parse(); }
Source:
public void setOrganizers(IBreakpointOrganizer[] organizers) { if (fOrganizers != null) { for (IBreakpointOrganizer fOrganizer : fOrganizers) { fOrganizer.removePropertyChangeListener(this); } } fOrganizers = organizers; if (organizers != null && organizers.length == 0) { fOrganizers = null; } if (fOrganizers != null) { for (IBreakpointOrganizer fOrganizer : fOrganizers) { fOrganizer.addPropertyChangeListener(this); } } if (!fDisposed) { fViewer.getControl().setRedraw(false); IBreakpoint[] breakpoints = null; if (isShowingGroups()) { breakpoints = fViewer.getVisibleBreakpoints(); } reorganize(); if (isShowingGroups() && breakpoints != null) { for (Object fElement : fElements) { BreakpointContainer container = (BreakpointContainer) fElement; for (IBreakpoint breakpoint : breakpoints) { if (container.contains(breakpoint)) { fViewer.expandToLevel(container, AbstractTreeViewer.ALL_LEVELS); fViewer.updateCheckedState(container); break; } } } } fViewer.getControl().setRedraw(true); } }

Target:
public void setOrganizers(IBreakpointOrganizer[] organizers) { if (fOrganizers != null) { for (IBreakpointOrganizer organizer : fOrganizers) { organizer.removePropertyChangeListener(this); } } fOrganizers = organizers; if (organizers != null && organizers.length == 0) { fOrganizers = null; } if (fOrganizers != null) { for (IBreakpointOrganizer organizer : fOrganizers) { organizer.addPropertyChangeListener(this); } } if (!fDisposed) { fViewer.getControl().setRedraw(false); IBreakpoint[] breakpoints = null; if (isShowingGroups()) { breakpoints = fViewer.getVisibleBreakpoints(); } reorganize(); if (isShowingGroups() && breakpoints != null) { for (Object element : fElements) { BreakpointContainer container = (BreakpointContainer) element; for (IBreakpoint breakpoint : breakpoints) { if (container.contains(breakpoint)) { fViewer.expandToLevel(container, AbstractTreeViewer.ALL_LEVELS); fViewer.updateCheckedState(container); break; } } } } fViewer.getControl().setRedraw(true); } }
Source:
public <U, V1> FutureCompletionStage<V1> thenCombineAsync( CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn, Executor executor) { requireNonNull(other, "other"); requireNonNull(fn, "fn"); requireNonNull(executor, "executor"); Promise<V1> promise = executor().newPromise(); AtomicReference<Object> reference = new AtomicReference<>(Marker.EMPTY); abstract class CombineBiConsumer<T1, T2, T> implements BiConsumer<T, Throwable> { @SuppressWarnings("unchecked") @Override public void accept(T v, Throwable error) { if (error == null) { if (!reference.compareAndSet(Marker.EMPTY, v)) { Object rawValue = reference.get(); if (rawValue == Marker.ERROR) { return; } try { applyAndNotify0(promise, (T1) v, (T2) rawValue, fn); } catch (Throwable e) { e.printStackTrace(); } } } else { if (reference.getAndSet(Marker.ERROR) != Marker.ERROR) { promise.setFailure(error); } } } abstract void applyAndNotify0( Promise<V1> promise, T1 value1, T2 value2, BiFunction<? super V, ? super U, ? extends V1> fn); } whenCompleteAsync(new CombineBiConsumer<V, U, V>() { @Override void applyAndNotify0( Promise<V1> promise, V value1, U value2, BiFunction<? super V, ? super U, ? extends V1> fn) { applyAndNotify(promise, value1, value2, fn); } }, executor); other.whenCompleteAsync(new CombineBiConsumer<U, V, U>() { @Override void applyAndNotify0( Promise<V1> promise, U value1, V value2, BiFunction<? super V, ? super U, ? extends V1> fn) { applyAndNotify(promise, value2, value1, fn); } }, otherExecutor(executor)); return promise.asStage(); }

Target:
public <U, V1> FutureCompletionStage<V1> thenCombineAsync( CompletionStage<? extends U> other, BiFunction<? super V, ? super U, ? extends V1> fn, Executor executor) { requireNonNull(other, "other"); requireNonNull(fn, "fn"); requireNonNull(executor, "executor"); Promise<V1> promise = executor().newPromise(); AtomicReference<Object> reference = new AtomicReference<>(Marker.EMPTY); abstract class CombineBiConsumer<T1, T2, T> implements BiConsumer<T, Throwable> { @SuppressWarnings("unchecked") @Override public void accept(T v, Throwable error) { if (error == null) { if (!reference.compareAndSet(Marker.EMPTY, v)) { Object rawValue = reference.get(); if (rawValue == Marker.ERROR) { return; } applyAndNotify0(promise, (T1) v, (T2) rawValue, fn); } } else { if (reference.getAndSet(Marker.ERROR) != Marker.ERROR) { promise.setFailure(error); } } } abstract void applyAndNotify0( Promise<V1> promise, T1 value1, T2 value2, BiFunction<? super V, ? super U, ? extends V1> fn); } whenCompleteAsync(new CombineBiConsumer<V, U, V>() { @Override void applyAndNotify0( Promise<V1> promise, V value1, U value2, BiFunction<? super V, ? super U, ? extends V1> fn) { applyAndNotify(promise, value1, value2, fn); } }, executor); other.whenCompleteAsync(new CombineBiConsumer<U, V, U>() { @Override void applyAndNotify0( Promise<V1> promise, U value1, V value2, BiFunction<? super V, ? super U, ? extends V1> fn) { applyAndNotify(promise, value2, value1, fn); } }, otherExecutor(executor)); return promise.asStage(); }
Source:
public void normalDrop() { Flowable.fromAsync(source, AsyncEmitter.BackpressureMode.DROP).subscribe(ts); source.onNext(1); ts.request(1); source.onNext(2); source.onComplete(); ts.assertValues(2); ts.assertNoErrors(); ts.assertComplete(); }

Target:
public void normalDrop() { Flowable.fromAsync(source, AsyncEmitter.BackpressureMode.DROP).subscribe(ts); source.onNext(1); ts.request(1); ts.assertNoValues(); source.onNext(2); source.onComplete(); ts.assertValues(2); ts.assertNoErrors(); ts.assertComplete(); }