auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<Quota> getAllQuotaIncludingConsumption() { MapSqlParameterSource parameterSource = new MapSqlParameterSource(); List<Quota> allThinQuota = getCallsHandler().executeReadList("GetAllThinQuota", getQuotaMetaDataFromResultSet(), parameterSource); if (allThinQuota != null && !allThinQuota.isEmpty()){ Map<Guid, Quota> allQuotaMap = new HashMap<Guid, Quota>(); for (Quota quota : allThinQuota) { allQuotaMap.put(quota.getId(), quota); } List<QuotaStorage> quotaStorageList = getAllQuotaStorageIncludingConsumption(); List<QuotaVdsGroup> quotaVdsGroupList = getALLQuotaVdsGroupIncludingConsumption(); if (quotaStorageList != null) { for (QuotaStorage quotaStorage : quotaStorageList) { Quota quota = allQuotaMap.get(quotaStorage.getQuotaId()); if (quota != null) { if (quotaStorage.getStorageId() == null) { quota.setGlobalQuotaStorage(quotaStorage); } else { if (quota.getQuotaStorages() == null) { quota.setQuotaStorages(new ArrayList<QuotaStorage>()); } quota.getQuotaStorages().add(quotaStorage); } } } } if (quotaVdsGroupList != null) { for (QuotaVdsGroup quotaVdsGroup : quotaVdsGroupList) { Quota quota = allQuotaMap.get(quotaVdsGroup.getQuotaId()); if (quota != null) { if (quotaVdsGroup.getVdsGroupId() == null) { quota.setGlobalQuotaVdsGroup(quotaVdsGroup); } else { if (quota.getQuotaVdsGroups() == null) { quota.setQuotaVdsGroups(new ArrayList<QuotaVdsGroup>()); } quota.getQuotaVdsGroups().add(quotaVdsGroup); } } } } } return allThinQuota; }

Target:
public List<Quota> getAllQuotaIncludingConsumption() { MapSqlParameterSource parameterSource = new MapSqlParameterSource(); List<Quota> allThinQuota = getCallsHandler().executeReadList("get_all_thin_quota", getQuotaMetaDataFromResultSet(), parameterSource); if (allThinQuota != null && !allThinQuota.isEmpty()){ Map<Guid, Quota> allQuotaMap = new HashMap<Guid, Quota>(); for (Quota quota : allThinQuota) { allQuotaMap.put(quota.getId(), quota); } List<QuotaStorage> quotaStorageList = getAllQuotaStorageIncludingConsumption(); List<QuotaVdsGroup> quotaVdsGroupList = getAllQuotaVdsGroupIncludingConsumption(); if (quotaStorageList != null) { for (QuotaStorage quotaStorage : quotaStorageList) { Quota quota = allQuotaMap.get(quotaStorage.getQuotaId()); if (quota != null) { if (quotaStorage.getStorageId() == null) { quota.setGlobalQuotaStorage(quotaStorage); } else { if (quota.getQuotaStorages() == null) { quota.setQuotaStorages(new ArrayList<QuotaStorage>()); } quota.getQuotaStorages().add(quotaStorage); } } } } if (quotaVdsGroupList != null) { for (QuotaVdsGroup quotaVdsGroup : quotaVdsGroupList) { Quota quota = allQuotaMap.get(quotaVdsGroup.getQuotaId()); if (quota != null) { if (quotaVdsGroup.getVdsGroupId() == null) { quota.setGlobalQuotaVdsGroup(quotaVdsGroup); } else { if (quota.getQuotaVdsGroups() == null) { quota.setQuotaVdsGroups(new ArrayList<QuotaVdsGroup>()); } quota.getQuotaVdsGroups().add(quotaVdsGroup); } } } } } return allThinQuota; }
Source:
private void openInNewTab(PageTitle title, HistoryEntry entry, int position) { Tab tab = new Tab(); tabList.add(position, tab); tab.getBackStack().add(new PageBackStackItem(title, entry)); if (position == tabList.size() - 1) { pageLoadStrategy.setBackStack(tabList.get(position).getBackStack()); } tabsProvider.showAndHideTabs(); }

Target:
private void openInNewTab(PageTitle title, HistoryEntry entry, int position) { Tab tab = new Tab(); if (position == getForegroundTabPosition()) { pageLoadStrategy.setBackStack(tab.getBackStack()); } tabList.add(position, tab); tab.getBackStack().add(new PageBackStackItem(title, entry)); tabsProvider.showAndHideTabs(); }
Source:
void attach(Action action) { if (actions == null) { if (action == null) { this.action = action; return; } actions = new ArrayList<Action>(3); actions.add(action); } }

Target:
void attach(Action action) { if (this.action == null) { this.action = action; return; } if (actions == null) { actions = new ArrayList<Action>(3); } actions.add(action); }
Source:
public CryptographyAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; if (jsonWebKey == null && Strings.isNullOrEmpty(keyId)) { throw logger.logExceptionAsError(new IllegalStateException("Json Web Key or jsonWebKey identifier are " + "required to create cryptography client")); } if (pipeline != null) { if (jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } } if (credential == null) { throw logger.logExceptionAsError(new IllegalStateException("Key Vault credentials " + "are required to " + "build the Cryptography async client")); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); if (jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } }

Target:
public CryptographyAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; if (jsonWebKey == null && Strings.isNullOrEmpty(keyId)) { throw logger.logExceptionAsError(new IllegalStateException( "Json Web Key or jsonWebKey identifier are required to create cryptography client")); } if (pipeline != null) { if (jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } } if (credential == null) { throw logger.logExceptionAsError(new IllegalStateException( "Key Vault credentials are required to build the Cryptography async client")); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); if (jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); } else { return new CryptographyAsyncClient(keyId, pipeline); } }
Source:
private void fireInvitationEvent(WorkgroupInvitation invitation) { for (Iterator<WorkgroupInvitationListener> i = invitationListeners.iterator(); i.hasNext();) { WorkgroupInvitationListener listener = i.next(); listener.invitationReceived(invitation); } }

Target:
private void fireInvitationEvent(WorkgroupInvitation invitation) { for (WorkgroupInvitationListener listener : invitationListeners ){ listener.invitationReceived(invitation); } }
Source:
public void runTest() { boolean hasRX = false; for (final String argument : this.getArgs()) { if (argument.startsWith(getTagName())) { hasRX = true; break; } } if (!hasRX) addArg(getTagName() + "=" + getTagValue()); super.runTest(); }

Target:
public void runTest() { boolean hasRX = false; for (final String argument : this.getArgs()) { if (argument.startsWith(getArgumentName())) { hasRX = true; break; } } if (!hasRX) addArg(getArgumentName() + "=" + getTagValue()); super.runTest(); }
Source:
private static String getPatientId(RegistryPackageType registryPackage) { for (int y = 0; y < registryPackage.getExternalIdentifier().size(); y++) { String test = registryPackage.getExternalIdentifier().get(y).getName().getLocalizedString().get(0) .getValue(); if ("XDSSubmissionSet.patientId".equals(test)) { return registryPackage.getExternalIdentifier().get(y).getValue(); } } return null; }

Target:
private static String getPatientId(RegistryPackageType registryPackage) { for (int y = 0; y < registryPackage.getExternalIdentifier().size(); y++) { String test = registryPackage.getExternalIdentifier().get(y).getName().getLocalizedString().get(0) .getValue(); if (XDS_PATIENT_ID.equals(test)) { return registryPackage.getExternalIdentifier().get(y).getValue(); } } return null; }
Source:
protected void executeCommand() { T params = getParameters(); String sessionId = params.getSessionId(); if (SessionDataContainer.getInstance().isSessionExists(sessionId)) { SessionDataContainer.getInstance().setSoftLimitInterval(sessionId, params.getSoftLimit()); setSucceeded(true); } else { setSucceeded(false); } }

Target:
protected void executeCommand() { if (SessionDataContainer.getInstance().isSessionExists(getParameters().getSessionId())) { SessionDataContainer.getInstance().setSoftLimitInterval(getParameters().getSessionId(), getParameters().getSoftLimit()); setSucceeded(true); } else { setSucceeded(false); } }
Source:
public void cleanIndex(boolean force) throws IOException, SQLException, SearchServiceException { if (force) { try { getSolr().deleteByQuery( "search.resourcetype:[" + Constants.ITEM + " TO " + Constants.CLAIMEDTASK + "]"); } catch (Exception e) { throw new SearchServiceException(e.getMessage(), e); } } else { cleanIndex(false, Constants.ITEM); cleanIndex(false, Constants.COLLECTION); cleanIndex(false, Constants.COMMUNITY); cleanIndex(false, Constants.WORKSPACEITEM); cleanIndex(false, Constants.POOLTASK); cleanIndex(false, Constants.CLAIMEDTASK); cleanIndex(false, Constants.WORKFLOWITEM); } }

Target:
public void cleanIndex(boolean force) throws IOException, SQLException, SearchServiceException { if (force) { try { getSolr().deleteByQuery( "search.resourcetype:[" + Constants.ITEM + " TO " + Constants.COMMUNITY + "]" + " AND " + "search.resourcetype:[" + Constants.WORKSPACEITEM + " TO " + Constants.CLAIMEDTASK + "]"); } catch (Exception e) { throw new SearchServiceException(e.getMessage(), e); } } else { cleanIndex(false, Constants.ITEM); cleanIndex(false, Constants.COLLECTION); cleanIndex(false, Constants.COMMUNITY); cleanIndex(false, Constants.WORKSPACEITEM); cleanIndex(false, Constants.POOLTASK); cleanIndex(false, Constants.CLAIMEDTASK); cleanIndex(false, Constants.WORKFLOWITEM); } }
Source:
private AuditLogType attemptToAttachDisksToImportedVm(Collection<Disk> disks) { List<String> failedDisks = new LinkedList<>(); for (Disk disk : disks) { DiskVmElement dve = disk.getDiskVmElements().iterator().next(); AttachDetachVmDiskParameters params = new AttachDetachVmDiskParameters( dve, disk.getPlugged()); ActionReturnValue returnVal = runInternalAction(ActionType.AttachDiskToVm, params, cloneContextAndDetachFromParent()); if (!returnVal.getSucceeded()) { failedDisks.add(disk.getDiskAlias()); } } if (!failedDisks.isEmpty()) { this.addCustomValue("DiskAliases", StringUtils.join(failedDisks, ",")); return AuditLogType.VM_IMPORT_FROM_CONFIGURATION_ATTACH_DISKS_FAILED; } return AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY; }

Target:
private AuditLogType attemptToAttachDisksToImportedVm(Collection<Disk> disks) { List<String> failedDisks = new LinkedList<>(); for (Disk disk : disks) { DiskVmElement dve = disk.getDiskVmElements().iterator().next(); AttachDetachVmDiskParameters params = new AttachDetachVmDiskParameters( dve, dve.isPlugged()); ActionReturnValue returnVal = runInternalAction(ActionType.AttachDiskToVm, params, cloneContextAndDetachFromParent()); if (!returnVal.getSucceeded()) { failedDisks.add(disk.getDiskAlias()); } } if (!failedDisks.isEmpty()) { this.addCustomValue("DiskAliases", StringUtils.join(failedDisks, ",")); return AuditLogType.VM_IMPORT_FROM_CONFIGURATION_ATTACH_DISKS_FAILED; } return AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY; }
Source:
protected void beforeCommit() { name = HunspellSpellChecker.DICTIONARY_BASE_NAME + "_" + getLocale().toString(); words = new HashSet<>(getWords()).stream().sorted().collect(Collectors.toList()); if (!StringUtils.isBlank(oldName) && !oldName.equals(name)) { HunspellSpellChecker.inValidateDictionary(oldName); } HunspellSpellChecker.inValidateDictionary(name); }

Target:
protected void beforeCommit() { words = new TreeSet<>(getWords()); }
Source:
public BuildOptions patch(BuildOptionsView options, EventHandler eventHandler) { if (executionPlatform == null || options.get(CoreOptions.class).isExec) { return options.underlying(); } return cache.applyTransition( options, executionPlatform, () -> { BuildOptionsView execOptions = new BuildOptionsView( options.underlying().createHostOptions(), requiresOptionFragments()); CoreOptions coreOptions = Preconditions.checkNotNull(execOptions.get(CoreOptions.class)); coreOptions.isHost = false; coreOptions.isExec = true; coreOptions.outputDirectoryName = null; coreOptions.platformSuffix = String.format("-exec-%X", executionPlatform.getCanonicalForm().hashCode()); if (execOptions.get(PlatformOptions.class) != null) { execOptions.get(PlatformOptions.class).platforms = ImmutableList.of(executionPlatform); } BuildOptions result = execOptions.underlying(); ImmutableList<Label> featureFlags = execOptions.underlying().getStarlarkOptions().entrySet().stream() .filter(entry -> entry.getValue() instanceof FeatureFlagValue) .map(Map.Entry::getKey) .collect(toImmutableList()); if (!featureFlags.isEmpty()) { BuildOptions.Builder resultBuilder = result.toBuilder(); featureFlags.stream().forEach(flag -> resultBuilder.removeStarlarkOption(flag)); result = resultBuilder.build(); } return result; }); }

Target:
public BuildOptions patch(BuildOptionsView options, EventHandler eventHandler) { if (executionPlatform == null) { return options.underlying(); } return cache.applyTransition( options, executionPlatform, () -> { BuildOptionsView execOptions = new BuildOptionsView( options.underlying().createHostOptions(), requiresOptionFragments()); CoreOptions coreOptions = Preconditions.checkNotNull(execOptions.get(CoreOptions.class)); coreOptions.isHost = false; coreOptions.isExec = true; coreOptions.outputDirectoryName = null; coreOptions.platformSuffix = String.format("-exec-%X", executionPlatform.getCanonicalForm().hashCode()); if (execOptions.get(PlatformOptions.class) != null) { execOptions.get(PlatformOptions.class).platforms = ImmutableList.of(executionPlatform); } BuildOptions result = execOptions.underlying(); ImmutableList<Label> featureFlags = execOptions.underlying().getStarlarkOptions().entrySet().stream() .filter(entry -> entry.getValue() instanceof FeatureFlagValue) .map(Map.Entry::getKey) .collect(toImmutableList()); if (!featureFlags.isEmpty()) { BuildOptions.Builder resultBuilder = result.toBuilder(); featureFlags.stream().forEach(flag -> resultBuilder.removeStarlarkOption(flag)); result = resultBuilder.build(); } return result; }); }
Source:
public static void updateTickBlock(IMixinWorldServer mixinWorld, Block block, BlockPos pos, IBlockState state, Random random) { final WorldServer world = WorldUtil.asNative(mixinWorld); final World apiWorld = WorldUtil.fromNative(world); if (ShouldFire.TICK_BLOCK_EVENT) { BlockSnapshot snapshot = mixinWorld.createSpongeBlockSnapshot(state, state, pos, BlockChangeFlags.NONE); final TickBlockEvent event = SpongeEventFactory.createTickBlockEventScheduled(Sponge.getCauseStackManager().getCurrentCause(), snapshot); SpongeImpl.postEvent(event); if (event.isCancelled()) { return; } } final LocatableBlock locatable = LocatableBlock.builder() .state((BlockState) state) .position(pos.getX(), pos.getY(), pos.getZ()) .world(apiWorld) .build(); final BlockTickContext phaseContext = TickPhase.Tick.BLOCK.createPhaseContext().source(locatable); final PhaseTracker phaseTracker = PhaseTracker.getInstance(); final PhaseData current = phaseTracker.getCurrentPhaseData(); final IPhaseState<?> currentState = current.state; ((IPhaseState) currentState).appendNotifierPreBlockTick(mixinWorld, pos, current.context, phaseContext); try (final PhaseContext<?> context = phaseContext; final Timing timing = BlockUtil.toMixin(state).getTimingsHandler()) { timing.startTiming(); context.buildAndSwitch(); block.updateTick(world, pos, state, random); } catch (Exception | NoClassDefFoundError e) { phaseTracker.printExceptionFromPhase(e, phaseContext); } }

Target:
public static void updateTickBlock(IMixinWorldServer mixinWorld, Block block, BlockPos pos, IBlockState state, Random random) { final WorldServer world = WorldUtil.asNative(mixinWorld); final World apiWorld = WorldUtil.fromNative(world); if (ShouldFire.TICK_BLOCK_EVENT) { BlockSnapshot snapshot = mixinWorld.createSpongeBlockSnapshot(state, state, pos, BlockChangeFlags.NONE); final TickBlockEvent event = SpongeEventFactory.createTickBlockEventScheduled(Sponge.getCauseStackManager().getCurrentCause(), snapshot); SpongeImpl.postEvent(event); if (event.isCancelled()) { return; } } final LocatableBlock locatable = new SpongeLocatableBlockBuilder().world(apiWorld).position(pos.getX(), pos.getY(), pos.getZ()).state((BlockState)state).build(); final BlockTickContext phaseContext = TickPhase.Tick.BLOCK.createPhaseContext().source(locatable); final PhaseTracker phaseTracker = PhaseTracker.getInstance(); final PhaseData current = phaseTracker.getCurrentPhaseData(); final IPhaseState<?> currentState = current.state; ((IPhaseState) currentState).appendNotifierPreBlockTick(mixinWorld, pos, current.context, phaseContext); try (final PhaseContext<?> context = phaseContext; final Timing timing = BlockUtil.toMixin(state).getTimingsHandler()) { timing.startTiming(); context.buildAndSwitch(); block.updateTick(world, pos, state, random); } catch (Exception | NoClassDefFoundError e) { phaseTracker.printExceptionFromPhase(e, phaseContext); } }
Source:
public Image getColumnImage(Object element, int columnIndex) { TaskReview reviewContainer = (TaskReview) element; switch (columnIndex) { case 0: return getIncomingChangesImage(reviewContainer); case 1: return getReviewStateImage(reviewContainer.getCodeReviewScore()); case 2: return getVerifiedStateImage(reviewContainer.getVerifiedScore()); } return null; }

Target:
public Image getColumnImage(Object element, int columnIndex) { TaskReview reviewContainer = (TaskReview) element; switch (columnIndex) { case DESCRIPTION_COLUMN: return getIncomingChangesImage(reviewContainer); case CODE_REVIEW_COLUMN: return getReviewStateImage(reviewContainer.getCodeReviewScore()); case VERIFIED_COLUMN: return getVerifiedStateImage(reviewContainer.getVerifiedScore()); } return null; }
Source:
public void shouldRetrieveLatestModificationWhenColoringIsSetToAlways() throws Exception { setColoring(); Modification mod = git.latestModification().get(0); assertThat(mod.getUserName(), is("Chris Turner <cturner@thoughtworks.com>")); assertThat(mod.getComment(), is("Added 'run-till-file-exists' ant target")); assertThat(mod.getModifiedTime(), is(parseRFC822("Fri, 12 Feb 2010 16:12:04 -0800"))); assertThat(mod.getRevision(), is("5def073a425dfe239aabd4bf8039ffe3b0e8856b")); List<ModifiedFile> files = mod.getModifiedFiles(); assertThat(files.size(), is(1)); assertThat(files.get(0).getFileName(), is("build.xml")); assertThat(files.get(0).getAction(), Matchers.is(ModifiedAction.modified)); unsetColoring(); }

Target:
public void shouldRetrieveLatestModificationWhenColoringIsSetToAlways() throws Exception { setColoring(); Modification mod = git.latestModification().get(0); assertThat(mod.getUserName(), is("Chris Turner <cturner@thoughtworks.com>")); assertThat(mod.getComment(), is("Added 'run-till-file-exists' ant target")); assertThat(mod.getModifiedTime(), is(parseRFC822("Fri, 12 Feb 2010 16:12:04 -0800"))); assertThat(mod.getRevision(), is("5def073a425dfe239aabd4bf8039ffe3b0e8856b")); List<ModifiedFile> files = mod.getModifiedFiles(); assertThat(files.size(), is(1)); assertThat(files.get(0).getFileName(), is("build.xml")); assertThat(files.get(0).getAction(), Matchers.is(ModifiedAction.modified)); }
Source:
public Map<String, String> buyCard(@RequestParam(value = "token", required = false) String token, @RequestParam("gameId") String gameId) throws AuthenticationException, GameException, PlayException { UserBean user = authenticationService.authenticateUserByToken(token); return playService.processAction(GameUserActionCode.BUY_CARD, user, gameId); }

Target:
public BoughtCardDetails buyCard(@RequestParam(value = "token", required = false) String token, @RequestParam("gameId") String gameId) throws AuthenticationException, GameException, PlayException { UserBean user = authenticationService.authenticateUserByToken(token); Map<String, String> returnedParams = playService.processAction(GameUserActionCode.BUY_CARD, user, gameId); String developmentCardCode = returnedParams.get("card"); return new BoughtCardDetails(developmentCardCode); }
Source:
void errorSourceOnReceiveMessage() { final String lockToken1 = UUID.randomUUID().toString(); final OffsetDateTime expiration = OffsetDateTime.now().plus(Duration.ofMinutes(5)); final MessageWithLockToken message = mock(MessageWithLockToken.class); when(messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)).thenReturn(receivedMessage); when(receivedMessage.getLockToken()).thenReturn(lockToken1); when(receivedMessage.getLockedUntil()).thenReturn(expiration); when(connection.createReceiveLink(anyString(), anyString(), any(ReceiveMode.class), any(), any(MessagingEntityType.class))).thenReturn(Mono.error(new AmqpException(false, "some receive link Error.", null))); StepVerifier.create(receiver.receiveMessages().take(1)) .verifyErrorMatches(throwable -> { Assertions.assertTrue(throwable instanceof ServiceBusAmqpException); final ServiceBusErrorSource actual = ((ServiceBusAmqpException) throwable).getErrorSource(); Assertions.assertEquals(ServiceBusErrorSource.RECEIVE, actual); return true; }); verify(amqpReceiveLink, never()).updateDisposition(eq(lockToken1), any(DeliveryState.class)); }

Target:
void errorSourceOnReceiveMessage() { final String lockToken = UUID.randomUUID().toString(); final OffsetDateTime expiration = OffsetDateTime.now().plus(Duration.ofMinutes(5)); final MessageWithLockToken message = mock(MessageWithLockToken.class); when(messageSerializer.deserialize(message, ServiceBusReceivedMessage.class)).thenReturn(receivedMessage); when(receivedMessage.getLockToken()).thenReturn(lockToken); when(receivedMessage.getLockedUntil()).thenReturn(expiration); when(connection.createReceiveLink(anyString(), anyString(), any(ReceiveMode.class), any(), any(MessagingEntityType.class))).thenReturn(Mono.error(new AmqpException(false, "some receive link Error.", null))); StepVerifier.create(receiver.receiveMessages().take(1)) .verifyErrorSatisfies(throwable -> { Assertions.assertTrue(throwable instanceof ServiceBusAmqpException); final ServiceBusErrorSource actual = ((ServiceBusAmqpException) throwable).getErrorSource(); Assertions.assertEquals(ServiceBusErrorSource.RECEIVE, actual); }); verify(amqpReceiveLink, never()).updateDisposition(eq(lockToken), any(DeliveryState.class)); }
Source:
public void setAttributes(Node node, String tagName, final Map<String, String> attributes) { if (node instanceof Image) { node.accept(new AbstractVisitor() { @Override public void visit(CustomNode node) { if (node instanceof ImageAttributes) { ImageAttributes imageAttributes = (ImageAttributes) node; Map<String, String> attributesMap = imageAttributes.getAttributes(); for (String key : attributesMap.keySet()) { attributes.put(key, attributesMap.get(key)); } imageAttributes.unlink(); } } }); } }

Target:
public void setAttributes(Node node, String tagName, final Map<String, String> attributes) { if (node instanceof Image) { node.accept(new AbstractVisitor() { @Override public void visit(CustomNode node) { if (node instanceof ImageAttributes) { ImageAttributes imageAttributes = (ImageAttributes) node; for (Map.Entry<String, String> entry : imageAttributes.getAttributes().entrySet()) { attributes.put(entry.getKey(), entry.getValue()); } imageAttributes.unlink(); } } }); } }
Source:
void submitCallback(final int rc) { if (LOG.isDebugEnabled()) { LOG.debug("Submit callback (lid:{}, eid: {}). rc:{}", lh.getId(), entryId, rc); } long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos); if (rc != BKException.Code.OK) { addOpLogger.registerFailedEvent(latencyNanos, TimeUnit.NANOSECONDS); LOG.error("Write of ledger entry to quorum failed: L{} E{}", lh.getId(), entryId); } else { addOpLogger.registerSuccessfulEvent(latencyNanos, TimeUnit.NANOSECONDS); } if (lh instanceof LedgerHandleAdv) { cb.addCompleteAdv(rc, lh, entryId, qwcLatency, ctx); } else { cb.addComplete(rc, lh, entryId, ctx); } callbackTriggered = true; maybeRecycle(); }

Target:
void submitCallback(final int rc) { if (LOG.isDebugEnabled()) { LOG.debug("Submit callback (lid:{}, eid: {}). rc:{}", lh.getId(), entryId, rc); } long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos); if (rc != BKException.Code.OK) { addOpLogger.registerFailedEvent(latencyNanos, TimeUnit.NANOSECONDS); LOG.error("Write of ledger entry to quorum failed: L{} E{}", lh.getId(), entryId); } else { addOpLogger.registerSuccessfulEvent(latencyNanos, TimeUnit.NANOSECONDS); } cb.addCompleteWithLatency(rc, lh, entryId, qwcLatency, ctx); callbackTriggered = true; maybeRecycle(); }
Source:
default <U> Seq<U> scanLeft(U zero, BiFunction<? super U, ? super Tuple2<K, V>, ? extends U> operation) { Objects.requireNonNull(operation, "operation is null"); return Collections.scanLeft(this, zero, operation, Stream.empty(), Stream::append, Function.identity()); }

Target:
default <U> Seq<U> scanLeft(U zero, BiFunction<? super U, ? super Tuple2<K, V>, ? extends U> operation) { Objects.requireNonNull(operation, "operation is null"); return iterator().scanLeft(zero, operation).toStream(); }
Source:
protected void onActivityResult(int requestCode,int resultCode,Intent capturedData){ if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) { new CheckAvailableSpaceTask(getCapturedImageFile().getAbsolutePath()).execute(); } else if (requestCode == REQUEST_DOCUMENT_SCAN && resultCode == RESULT_OK) { Intent cropScannedDocumentIntent = new Intent(getApplicationContext(), CropActivity.class); cropScannedDocumentIntent.putExtra(SCANNED_DOCUMENT_IMAGE, getCapturedImageFile().getAbsolutePath()); startActivityForResult(cropScannedDocumentIntent, REQUEST_SCANNED_DOCUMENT_CROP); } else if (requestCode == REQUEST_SCANNED_DOCUMENT_CROP && resultCode == RESULT_OK) { Bundle croppedDocumentData = capturedData.getExtras(); String croppedDocumentImagePath = (String) croppedDocumentData.get(CROPPED_SCANNED_DOCUMENT_IMAGE_PATH); new CheckAvailableSpaceTask(croppedDocumentImagePath).execute(); } else if((requestCode == REQUEST_IMAGE_CAPTURE || requestCode == REQUEST_DOCUMENT_SCAN) && resultCode == RESULT_CANCELED){ if(image != null){ image.delete(); Log_OC.d(TAG,"File deleted"); } setResult(RESULT_CANCELED); finish(); } else if (resultCode == RESULT_CANCELED) { setResult(RESULT_CANCELED); finish(); } }

Target:
protected void onActivityResult(int requestCode,int resultCode,Intent capturedData){ if(resultCode != RESULT_CANCELED) { mFilesUploadHelper.onActivityResult(this); } else { setResult(RESULT_CANCELED); } }
Source:
public void shouldReturn422ForInvalidPaymentOutcomeStatusAndCode() { HashMap<String, Object> postBody = new HashMap<>(); postBody.put("amount", 12000); postBody.put("reference", "MRPC12345"); postBody.put("description", "New passport application"); postBody.put("created_date", "2018-02-21T16:04:25Z"); postBody.put("authorised_date", "2018-02-21T16:05:33Z"); postBody.put("processor_id", "183f2j8923j8"); postBody.put("provider_id", "17498-8412u9-1273891239"); postBody.put("auth_code", "666"); postBody.put("payment_outcome", Map.of( "status", "success", "code", "P0010" ) ); postBody.put("card_type", "visa"); postBody.put("name_on_card", "Jane Doe"); postBody.put("email_address", "jane_doe@example.com"); postBody.put("card_expiry", "02/19"); postBody.put("last_four_digits", "1234"); postBody.put("first_six_digits", "123456"); postBody.put("telephone_number", "+447700900796"); String payload = toJson(postBody); connectorRestApiClient .postCreateTelephoneCharge(payload) .statusCode(422) .body("message[0]", is("Must include a valid status and error code")); }

Target:
public void shouldReturn422ForInvalidPaymentOutcomeStatusAndCode() { postBody.replace("payment_outcome", Map.of( "status", "success", "code", "P0010" ) ); connectorRestApiClient .postCreateTelephoneCharge(toJson(postBody)) .statusCode(422) .body("message[0]", is("Field [payment_outcome] must include a valid status and error code")); }
Source:
public void updateBlobProperty(DocumentModel doc, MimetypeRegistry mimetypeService, Property dirtyProperty) { String fieldPath = dirtyProperty.getXPath(); if (!fieldPath.contains(":")) { fieldPath = dirtyProperty.getSchema().getName() + ":" + fieldPath; } Blob blob = dirtyProperty.getValue(Blob.class); if (blob != null) { if (blob.getMimeType() == null || blob.getMimeType().equals(DEFAULT_MIMETYPE)) { blob = mimetypeService.updateMimetype(blob); doc.setPropertyValue(fieldPath, (Serializable) blob); } else if (!mimetypeService.isMimeTypeNormalized(blob.getMimeType())) { mimetypeService.getNormalizedMimeType(blob.getMimeType()).ifPresent(blob::setMimeType); } } }

Target:
public void updateBlobProperty(DocumentModel doc, MimetypeRegistry mimetypeService, Property dirtyProperty) { String fieldPath = dirtyProperty.getXPath(); if (!fieldPath.contains(":")) { fieldPath = dirtyProperty.getSchema().getName() + ":" + fieldPath; } Blob blob = dirtyProperty.getValue(Blob.class); if (blob == null) { return; } if (blob.getMimeType() == null || blob.getMimeType().equals(DEFAULT_MIMETYPE)) { blob = mimetypeService.updateMimetype(blob); doc.setPropertyValue(fieldPath, (Serializable) blob); } else if (!mimetypeService.isMimeTypeNormalized(blob.getMimeType())) { mimetypeService.getNormalizedMimeType(blob.getMimeType()).ifPresent(blob::setMimeType); } }
Source:
public void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> offsets, String consumerGroupId) throws ProducerFencedException { if (!cachedGroupMetadata.groupId().equals(consumerGroupId)) { log.warn("Cached consumer groupId changed from to {}. If the old group id is not empty, this indicates an abuse of this API", cachedGroupMetadata.groupId(), consumerGroupId); cachedGroupMetadata = new ConsumerGroupMetadata(consumerGroupId, JoinGroupRequest.UNKNOWN_GENERATION_ID, JoinGroupRequest.UNKNOWN_MEMBER_ID, Optional.empty()); } sendOffsetsToTransactionInternal(offsets, cachedGroupMetadata, false); }

Target:
public void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> offsets, String consumerGroupId) throws ProducerFencedException { sendOffsetsToTransaction(offsets, new ConsumerGroupMetadata(consumerGroupId)); }
Source:
public String toString() { return getClass() + "{evenType='" + getType() + "', serviceName='" + serviceName + "'}"; }

Target:
public String toString() { return getClass().getSimpleName() + "{eventType='" + getType() + "', serviceName=" + serviceName + "'}"; }
Source:
public void start() { Frontend.getInstance().runAction(ActionType.TransferDiskImage, null, result -> { if (result.getReturnValue().getSucceeded()) { Frontend.getInstance().runQuery(QueryType.GetImageTransferById, new IdQueryParameters(this.diskImageId), new AsyncQuery<QueryReturnValue>(returnValue -> { ImageTransfer imageTransfer = returnValue.getReturnValue(); initiateDownload(imageTransfer); })); } }, this); }

Target:
public void start() { Frontend.getInstance().runQuery(QueryType.GetImageTransferById, new IdQueryParameters(transferId), new AsyncQuery<QueryReturnValue>(returnValue -> { ImageTransfer imageTransfer = returnValue.getReturnValue(); initiateDownload(imageTransfer); })); }
Source:
private void callExportService(DataTransferExportModel dataTransferExportModel) { try { dataTransferServices.call((RemoteCallback<String>) path -> { view.exportOK(); view.download(path); }, (ErrorCallback<Exception>) (message, throwable) -> { view.exportError(throwable); return false; }).doExport(dataTransferExportModel); } catch (Exception e) { view.exportError(e); } }

Target:
private void callExportService(DataTransferExportModel dataTransferExportModel) { busyIndicatorView.showBusyIndicator(i18n.preparingExportDownload()); try { dataTransferServices.call((RemoteCallback<String>) path -> { busyIndicatorView.hideBusyIndicator(); view.exportOK(); view.download(path); }, (ErrorCallback<Exception>) (message, throwable) -> { busyIndicatorView.hideBusyIndicator(); view.exportError(throwable); return false; }).doExport(dataTransferExportModel); } catch (Exception e) { view.exportError(e); } }
Source:
public MoveOrCopyImageGroupParameters(Guid containerId, Guid imageGroupId, Guid imageId, Guid destImageGroupId, Guid destImageId, Guid storageDomainId, ImageOperation operation) { this(containerId, imageGroupId, imageId, storageDomainId, operation); setEntityId(destImageId); setDestImageGroupId(destImageGroupId); setDestinationImageId(destImageId); }

Target:
public MoveOrCopyImageGroupParameters(Guid containerId, Guid imageGroupId, Guid imageId, Guid destImageGroupId, Guid destImageId, Guid storageDomainId, ImageOperation operation) { this(containerId, imageGroupId, imageId, storageDomainId, operation); setDestImageGroupId(destImageGroupId); setDestinationImageId(destImageId); }
Source:
public void testWriteHeaderTwice() { final File fakeVCFFile = VariantBaseTest.createTempFile("testBasicWriteAndRead.", ".vcf"); final SAMSequenceDictionary sequenceDict = createArtificialSequenceDictionary(); final VCFHeader header = createFakeHeader(metaData, additionalColumns, sequenceDict); final VariantContextWriter writer1 = new VariantContextWriterBuilder() .setOutputFile(fakeVCFFile) .setReferenceDictionary(sequenceDict) .build(); writer1.writeHeader(header); writer1.writeHeader(header); writer1.close(); }

Target:
public void testWriteHeaderTwice() { final File fakeVCFFile = VariantBaseTest.createTempFile("testBasicWriteAndRead.", ".vcf"); fakeVCFFile.deleteOnExit(); final SAMSequenceDictionary sequenceDict = createArtificialSequenceDictionary(); final VCFHeader header = createFakeHeader(metaData, additionalColumns, sequenceDict); try (final VariantContextWriter writer1 = new VariantContextWriterBuilder() .setOutputFile(fakeVCFFile) .setReferenceDictionary(sequenceDict) .build()) { writer1.writeHeader(header); writer1.writeHeader(header); } }
Source:
public boolean extractQuestionDetails( Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { String numOfRubricChoicesString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_COLS); String numOfRubricSubQuestionsString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_ROWS); String hasAssignedWeightsString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHTS_ASSIGNED); if (numOfRubricChoicesString == null || numOfRubricSubQuestionsString == null) { return false; } boolean hasAssignedWeights = "on".equals(hasAssignedWeightsString); int numOfRubricChoices = Integer.parseInt(numOfRubricChoicesString); int numOfRubricSubQuestions = Integer.parseInt(numOfRubricSubQuestionsString); List<Double> rubricWeights = getRubricWeights(requestParameters, numOfRubricChoices, hasAssignedWeights); List<String> rubricChoices = getRubricChoices(requestParameters, numOfRubricChoices); List<String> rubricSubQuestions = getSubQuestions(requestParameters, numOfRubricSubQuestions); List<List<String>> rubricDescriptions = getRubricQuestionDescriptions(requestParameters, numOfRubricChoices, numOfRubricSubQuestions); setRubricQuestionDetails(hasAssignedWeights, rubricWeights, rubricChoices, rubricSubQuestions, rubricDescriptions); if (!this.isValidDescriptionSize()) { this.initializeRubricDescriptions(); } return true; }

Target:
public boolean extractQuestionDetails( Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { String numOfRubricChoicesString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_COLS); String numOfRubricSubQuestionsString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_ROWS); if (numOfRubricChoicesString == null || numOfRubricSubQuestionsString == null) { return false; } String hasAssignedWeightsString = HttpRequestHelper.getValueFromParamMap(requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHTS_ASSIGNED); boolean hasAssignedWeights = "on".equals(hasAssignedWeightsString); int numOfRubricChoices = Integer.parseInt(numOfRubricChoicesString); int numOfRubricSubQuestions = Integer.parseInt(numOfRubricSubQuestionsString); List<Double> rubricWeights = getRubricWeights(requestParameters, numOfRubricChoices, hasAssignedWeights); List<String> rubricChoices = getRubricChoices(requestParameters, numOfRubricChoices); List<String> rubricSubQuestions = getSubQuestions(requestParameters, numOfRubricSubQuestions); List<List<String>> rubricDescriptions = getRubricQuestionDescriptions(requestParameters, numOfRubricChoices, numOfRubricSubQuestions); setRubricQuestionDetails(hasAssignedWeights, rubricWeights, rubricChoices, rubricSubQuestions, rubricDescriptions); if (!this.isValidDescriptionSize()) { this.initializeRubricDescriptions(); } return true; }
Source:
public void testTableSinkWithMissingValueField() { Schema inputSchema = Schema.recordOf( "purchase", Schema.Field.of("rowKey", Schema.of(Schema.Type.STRING)), Schema.Field.of("userid", Schema.of(Schema.Type.STRING)) ); KVTableSink.KVTableConfig kvTableConfig = new KVTableSink.KVTableConfig("purchases", "rowKey", "user"); KVTableSink kvTableSink = new KVTableSink(kvTableConfig); MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema, ImmutableMap.<String, Object>of( CoreValidator.ID, new CoreValidator())); kvTableSink.configurePipeline(mockPipelineConfigurer); }

Target:
public void testTableSinkWithMissingValueField() { Schema inputSchema = Schema.recordOf( "purchase", Schema.Field.of("rowKey", Schema.of(Schema.Type.STRING)), Schema.Field.of("userid", Schema.of(Schema.Type.STRING)) ); KVTableSink.KVTableConfig kvTableConfig = new KVTableSink.KVTableConfig("purchases", "rowKey", "user"); KVTableSink kvTableSink = new KVTableSink(kvTableConfig); MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(inputSchema); kvTableSink.configurePipeline(mockPipelineConfigurer); }
Source:
protected void performSelection() { super.performSelection(); EditPart sourceEditPart = getSourceEditPart(); if (sourceEditPart instanceof SiriusNoteEditPart) { SiriusNoteEditPart siriusNoteEditPart = (SiriusNoteEditPart) sourceEditPart; EditPartViewer viewer = siriusNoteEditPart.getViewer(); Iterable<DescriptionCompartmentEditPart> descriptionCompartmentEditPartsfilter = Iterables.filter(sourceEditPart.getChildren(), DescriptionCompartmentEditPart.class); if (Iterables.size(descriptionCompartmentEditPartsfilter) == 1) { DescriptionCompartmentEditPart descriptionCompartmentEditPart = Iterables.getOnlyElement(descriptionCompartmentEditPartsfilter); if (getCurrentInput().isModKeyDown(SWT.MOD1) && viewer.getSelectedEditParts().contains(descriptionCompartmentEditPart)) { viewer.deselect(descriptionCompartmentEditPart); } else if (descriptionCompartmentEditPart.isSelectable()) { viewer.appendSelection(descriptionCompartmentEditPart); } } } }

Target:
protected void performSelection() { super.performSelection(); EditPart sourceEditPart = getSourceEditPart(); if (sourceEditPart instanceof SiriusNoteEditPart || sourceEditPart instanceof SiriusTextEditPart) { AbstractEditPart siriusNoteEditPart = (AbstractEditPart) sourceEditPart; EditPartViewer viewer = siriusNoteEditPart.getViewer(); Iterable<DescriptionCompartmentEditPart> descriptionCompartmentEditPartsfilter = Iterables.filter(sourceEditPart.getChildren(), DescriptionCompartmentEditPart.class); if (Iterables.size(descriptionCompartmentEditPartsfilter) == 1) { DescriptionCompartmentEditPart descriptionCompartmentEditPart = Iterables.getOnlyElement(descriptionCompartmentEditPartsfilter); if (getCurrentInput().isModKeyDown(SWT.MOD1) && viewer.getSelectedEditParts().contains(descriptionCompartmentEditPart)) { viewer.deselect(descriptionCompartmentEditPart); } else if (descriptionCompartmentEditPart.isSelectable()) { viewer.appendSelection(descriptionCompartmentEditPart); } } } }
Source:
public Observable<Void> shutdown(Throwable cause) { return delegateRegistry.shutdown(cause); }

Target:
public Observable<Void> shutdown(Throwable cause) { remoteBatchingRegistry.shutdown(); return delegateRegistry.shutdown(cause); }
Source:
public TimeWindowOperator(final String queryId, final String operatorId, final int windowSize, final int emitPeriod) { super(queryId, operatorId); this.windowSize = windowSize; this.emitPeriod = emitPeriod; this.windowQueue = new LinkedBlockingQueue<>(); firstTimestamp = Long.MIN_VALUE; windowCreationTime = 0L; if (emitPeriod <= windowSize) { windowEmissionTime = emitPeriod; } else { windowEmissionTime = windowSize; } }

Target:
public TimeWindowOperator(final String queryId, final String operatorId, final int windowSize, final int emitPeriod) { super(queryId, operatorId); this.windowSize = windowSize; this.emitPeriod = emitPeriod; this.windowQueue = new LinkedList<>(); this.firstTimestamp = Long.MIN_VALUE; this.windowCreationTime = Long.MIN_VALUE; }
Source:
public Response add(Disk disk) { validateEnums(Disk.class, disk); if (disk.isSetId()) { return attachDiskToVm(disk); }else { validateParameters(disk, "format", "interface"); if (!disk.isSetLunStorage()) { validateParameters(disk, "provisionedSize|size"); } return performCreation(addAction, getAddParameters(map(disk), disk), getEntityIdResolver(disk.getName())); } }

Target:
public Response add(Disk disk) { validateEnums(Disk.class, disk); if (disk.isSetId()) { return attachDiskToVm(disk); }else { validateParameters(disk, "format", "interface"); if (!disk.isSetLunStorage() || disk.getLunStorage().getLogicalUnits().isEmpty()) { validateParameters(disk, "provisionedSize|size"); } return performCreation(addAction, getAddParameters(map(disk), disk), getEntityIdResolver(disk.getName())); } }
Source:
public void queryIntentActivities_DisabledComponentExplicitIntent() throws Exception { Intent i = new Intent(); i.setClassName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); ComponentName componentToDisable = new ComponentName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); packageManager.setComponentEnabledSetting(componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(i, 0); assertThat(resolveInfos).isNotNull(); assertThat(resolveInfos).hasSize(0); }

Target:
public void queryIntentActivities_DisabledComponentExplicitIntent() throws Exception { Intent i = new Intent(); i.setClassName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); ComponentName componentToDisable = new ComponentName(RuntimeEnvironment.application, "org.robolectric.shadows.TestActivity"); packageManager.setComponentEnabledSetting( componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(i, 0); assertThat(resolveInfos).isEmpty(); }
Source:
public void onSucceeded(Guid cmdId, List<Guid> childCmdIds) { super.onSucceeded(cmdId, childCmdIds); }

Target:
public void onSucceeded(Guid cmdId, List<Guid> childCmdIds) { super.onSucceeded(cmdId, childCmdIds); CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); }
Source:
public DocumentModelList run(DocumentModelList docs) { return docs.stream().map(doc -> { return run(doc); }).collect(Collectors.toCollection(DocumentModelListImpl::new)); }

Target:
public DocumentModelList run(DocumentModelList docs) { return docs.stream().map(doc -> run(doc)).collect(Collectors.toCollection(DocumentModelListImpl::new)); }
Source:
private void replicateFragmentInternal(final LedgerHandle lh, final LedgerFragment lf, final AsyncCallback.VoidCallback ledgerFragmentMcb, final Set<BookieSocketAddress> newBookies) throws InterruptedException { if (!lf.isClosed()) { LOG.error("Trying to replicate an unclosed fragment;" + " This is not safe {}", lf); ledgerFragmentMcb.processResult(BKException.Code.UnclosedFragmentException, null, null); return; } Long startEntryId = lf.getFirstStoredEntryId(); Long endEntryId = lf.getLastStoredEntryId(); if (endEntryId == null) { LOG.warn("Dead bookie (" + lf.getAddresses() + ") is still part of the current" + " active ensemble for ledgerId: " + lh.getId()); ledgerFragmentMcb.processResult(BKException.Code.OK, null, null); return; } if (startEntryId > endEntryId || endEntryId <= -1L) { ledgerFragmentMcb.processResult(BKException.Code.OK, null, null); return; } List<Long> entriesToReplicate = new LinkedList<Long>(); long lastStoredEntryId = lf.getLastStoredEntryId(); for (long i = lf.getFirstStoredEntryId(); i <= lastStoredEntryId; i++) { entriesToReplicate.add(i); } MultiCallback ledgerFragmentEntryMcb = new MultiCallback( entriesToReplicate.size(), ledgerFragmentMcb, null, BKException.Code.OK, BKException.Code.LedgerRecoveryException); for (final Long entryId : entriesToReplicate) { recoverLedgerFragmentEntry(entryId, lh, ledgerFragmentEntryMcb, newBookies); } }

Target:
private void replicateFragmentInternal(final LedgerHandle lh, final LedgerFragment lf, final AsyncCallback.VoidCallback ledgerFragmentMcb, final Set<BookieSocketAddress> newBookies) throws InterruptedException { if (!lf.isClosed()) { LOG.error("Trying to replicate an unclosed fragment;" + " This is not safe {}", lf); ledgerFragmentMcb.processResult(BKException.Code.UnclosedFragmentException, null, null); return; } Long startEntryId = lf.getFirstStoredEntryId(); Long endEntryId = lf.getLastStoredEntryId(); if (endEntryId == null) { LOG.warn("Dead bookie (" + lf.getAddresses() + ") is still part of the current" + " active ensemble for ledgerId: " + lh.getId()); ledgerFragmentMcb.processResult(BKException.Code.OK, null, null); return; } if (startEntryId > endEntryId || endEntryId <= INVALID_ENTRY_ID) { ledgerFragmentMcb.processResult(BKException.Code.OK, null, null); return; } List<Long> entriesToReplicate = new LinkedList<Long>(); long lastStoredEntryId = lf.getLastStoredEntryId(); for (long i = lf.getFirstStoredEntryId(); i <= lastStoredEntryId; i++) { entriesToReplicate.add(i); } MultiCallback ledgerFragmentEntryMcb = new MultiCallback( entriesToReplicate.size(), ledgerFragmentMcb, null, BKException.Code.OK, BKException.Code.LedgerRecoveryException); for (final Long entryId : entriesToReplicate) { recoverLedgerFragmentEntry(entryId, lh, ledgerFragmentEntryMcb, newBookies); } }
Source:
public void onBackPressed() { if (depth != 0) { webView.goBack(); depth--; } else { super.onBackPressed(); } }

Target:
public void onBackPressed() { if (webView.canGoBack()) { webView.goBack(); } else { super.onBackPressed(); } }