auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String sendQrCode() throws SocketException { people = userFacade.findByEmail(this.uname); HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext. getCurrentInstance().getExternalContext().getRequest(); try { if (people != null && authController.checkPasswordAndStatus(people, passwd, httpServletRequest)) { String random = SecurityUtils.getRandomPassword(passwordLength); usersController.updateSecret(people.getUid(), random); String message = UserAccountsEmailMessages.buildTempResetMessage(random); email.sendEmail(people.getEmail(), RecipientType.TO,UserAccountsEmailMessages.ACCOUNT_PASSWORD_RESET, message); am.registerAccountChange(people, AccountsAuditActions.RECOVERY.name(), AccountsAuditActions.SUCCESS.name(), "Reset QR code.", people, httpServletRequest); return "validate_code"; } else { MessagesController.addSecurityErrorMessage(AccountStatusErrorMessages.INCCORCT_CREDENTIALS); if (people != null) { am.registerAccountChange(people, AccountsAuditActions.RECOVERY.name(), AccountsAuditActions.FAILED.name(), "", people, httpServletRequest); } return ""; } } catch (MessagingException ex) { am.registerAccountChange(people, AccountsAuditActions.RECOVERY.name(), AccountsAuditActions.FAILED.name(), "", people, httpServletRequest); } catch (AppException ex) { Logger.getLogger(RecoverySelector.class.getName()).log(Level.SEVERE, null, ex); } MessagesController.addSecurityErrorMessage(AccountStatusErrorMessages.INTERNAL_ERROR); return ""; }

Target:
public String sendQrCode() throws SocketException { people = userFacade.findByEmail(this.uname); HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext. getCurrentInstance().getExternalContext().getRequest(); try { if (people != null && authController.checkPasswordAndStatus(people, passwd, httpServletRequest)) { String random = SecurityUtils.getRandomPassword(passwordLength); usersController.updateSecret(people.getUid(), random); String message = UserAccountsEmailMessages.buildTempResetMessage(random); email.sendEmail(people.getEmail(), RecipientType.TO,UserAccountsEmailMessages.ACCOUNT_PASSWORD_RESET, message); am.registerAccountChange(people, AccountsAuditActions.RECOVERY.name(), AccountsAuditActions.SUCCESS.name(), "Reset QR code.", people, httpServletRequest); return "validate_code"; } else { MessagesController.addSecurityErrorMessage(AccountStatusErrorMessages.INCORRECT_CREDENTIALS); if (people != null) { am.registerAccountChange(people, AccountsAuditActions.RECOVERY.name(), AccountsAuditActions.FAILED.name(), "", people, httpServletRequest); } return ""; } } catch (MessagingException ex) { am.registerAccountChange(people, AccountsAuditActions.RECOVERY.name(), AccountsAuditActions.FAILED.name(), "", people, httpServletRequest); } catch (AppException ex) { Logger.getLogger(RecoverySelector.class.getName()).log(Level.SEVERE, null, ex); } MessagesController.addSecurityErrorMessage(AccountStatusErrorMessages.INTERNAL_ERROR); return ""; }
Source:
public final String getStatusCounts() { String buckets = new String(); for (Map.Entry<Status, AtomicInteger> entry : returncodes.entrySet()) { buckets += ", Return(" + entry.getKey().getName() + ")=" + entry.getValue().get(); } return buckets; }

Target:
public final String getStatusCounts() { StringBuilder buckets = new StringBuilder(); for (Map.Entry<Status, AtomicInteger> entry : returncodes.entrySet()) { buckets.append(", Return(" + entry.getKey().getName() + ")=" + entry.getValue().get()); } return buckets.toString(); }
Source:
public void merge(ProjectInfo projectInfo) { getLibraries().putAll(projectInfo.getLibraries()); getTargets().putAll(projectInfo.getTargets()); if (getPythonSetup() == null && projectInfo.getPythonSetup() != null) { python_setup = projectInfo.getPythonSetup(); } }

Target:
public void merge(ProjectInfo projectInfo) { libraries.putAll(projectInfo.getLibraries()); targets.putAll(projectInfo.getTargets()); if (python_setup == null && projectInfo.getPythonSetup() != null) { python_setup = projectInfo.getPythonSetup(); } }
Source:
public F.Promise<Result> show(final String languageTag) { final UserContext userContext = userContext(languageTag); final F.Promise<Cart> cartPromise = getOrCreateCart(userContext, session()); return cartPromise.map(cart -> { final CheckoutConfirmationPageContent content = new CheckoutConfirmationPageContent(cart, userContext, productDataConfig, i18nResolver(), reverseRouter()); final SunrisePageData pageData = pageData(userContext, content, ctx()); return ok(templateService().renderToHtml("checkout-confirmation", pageData, userContext.locales())); }); }

Target:
public CompletionStage<Result> show(final String languageTag) { final UserContext userContext = userContext(languageTag); return getOrCreateCart(userContext, session()) .thenApplyAsync(cart -> renderCheckoutConfirmationPage(cart, userContext), HttpExecution.defaultContext()); }
Source:
public void onPlayerConsumePotion(PlayerItemConsumeEvent event) { if (event.getItem().getType() == Material.POTION) { Collection<PotionEffect> fx = Potion.fromItemStack(event.getItem()).getEffects(); for (PotionEffect effect : fx) { if (effect.getType() == PotionEffectType.INVISIBILITY && !TFM_AdminList.isSuperAdmin(event.getPlayer())) { event.getPlayer().sendMessage(ChatColor.RED + "Invisibility is not allowed."); event.setCancelled(true); } } } }

Target:
public void onPlayerConsumePotion(PlayerItemConsumeEvent event) { Collection<PotionEffect> fx = Potion.fromItemStack(event.getItem()).getEffects(); for (PotionEffect effect : fx) { if (effect.getType() == PotionEffectType.INVISIBILITY && !TFM_AdminList.isSuperAdmin(event.getPlayer()) && && event.getItem().getType() == Material.POTION) { event.getPlayer().sendMessage(ChatColor.RED + "Invisibility is not allowed."); event.setCancelled(true); } } }
Source:
public JsonLdConfiguration(GeoServerDataDirectory dd) { this.dd = dd; templateCache = CacheBuilder.newBuilder() .maximumSize(10) .initialCapacity(1) .expireAfterAccess(120, TimeUnit.MINUTES) .build( new CacheLoader<CacheKey, JsonLdTemplate>() { @Override public JsonLdTemplate load(CacheKey key) { Resource resource = dd.get(key.getResource(), key.getPath()); JsonLdTemplate template = new JsonLdTemplate(resource); return template; } }); }

Target:
public JsonLdConfiguration(GeoServerDataDirectory dd) { this.dd = dd; templateCache = CacheBuilder.newBuilder() .maximumSize(100) .initialCapacity(1) .expireAfterAccess(120, TimeUnit.MINUTES) .build( new CacheLoader<CacheKey, JsonLdTemplate>() { @Override public JsonLdTemplate load(CacheKey key) { Resource resource = dd.get(key.getResource(), key.getPath()); JsonLdTemplate template = new JsonLdTemplate(resource); return template; } }); }
Source:
public void fileStatusArraySortingWithEventDumpDirComparator() { FileStatus[] dirList = new FileStatus[30]; for (int i = 0; i < 30; i+=2){ dirList[i] = new FileStatus(5, true, 1, 64, 100, new Path("hdfs://tmp/"+Integer.toString(i+1))); } for (int i = 1; i < 30; i+=2){ dirList[i] = new FileStatus(5, true, 1, 64, 100, new Path("hdfs://tmp/"+Integer.toString(i-1))); } Arrays.sort(dirList, new EventDumpDirComparator()); for (int i = 0; i < 30; i++){ assertTrue(dirList[i].getPath().getName().equalsIgnoreCase(Integer.toString(i))); } }

Target:
public void fileStatusArraySortingWithEventDumpDirComparator() { int size = 30; FileStatus[] dirList = new FileStatus[size]; for (int i = 0; i < size; i++){ dirList[i] = new FileStatus(5, true, 1, 64, 100, new Path("hdfs://tmp/"+Integer.toString(size-i))); } Arrays.sort(dirList, new EventDumpDirComparator()); for (int i = 0; i < 30; i++){ assertTrue(dirList[i].getPath().getName().equalsIgnoreCase(Integer.toString(i+1))); } }
Source:
protected void doSend(String destination, Message<?> message) { try { if (message.getHeaders().get(AmqpHeaders.PUBLISH_CONFIRM_CORRELATION) instanceof CorrelationData) { this.rabbitTemplate.send(destination, createMessage(message), message.getHeaders().get(AmqpHeaders.PUBLISH_CONFIRM_CORRELATION, CorrelationData.class)); } else { this.rabbitTemplate.send(destination, createMessage(message)); } } catch (RuntimeException ex) { throw convertAmqpException(ex); } }

Target:
protected void doSend(String destination, Message<?> message) { try { Object correlation = message.getHeaders().get(AmqpHeaders.PUBLISH_CONFIRM_CORRELATION); if (correlation instanceof CorrelationData) { this.rabbitTemplate.send(destination, createMessage(message), (CorrelationData) correlation); } else { this.rabbitTemplate.send(destination, createMessage(message)); } } catch (RuntimeException ex) { throw convertAmqpException(ex); } }
Source:
void intBoxingAndUnboxing(int int1, Integer integer1, String string, Double double1) { new Integer(int1).intValue(); new Integer(1 + 2).intValue(); Integer.valueOf(int1).intValue(); Integer.valueOf(1 + 2).intValue(); processInt(string, new Integer(int1)); new Integer(int1).toString(); integer1.intValue(); Integer.valueOf(integer1); Integer.valueOf(double1); int int2 = new Integer(1); int2 = new Integer(1); int2 = new Integer(string); Integer integer2 = new Integer(1); integer2 = new Integer(1); int2 = new Unknown(); int2 = unknownMethod(1); }

Target:
void intBoxingAndUnboxing(int int1, Integer integer1, String string, Double double1) { new Integer(int1).intValue(); new Integer(1 + 2).intValue(); Integer.valueOf(int1).intValue(); Integer.valueOf(1 + 2).intValue(); processInt(string, new Integer(int1)); new Integer(int1).toString(); integer1.intValue(); Integer.valueOf(integer1); Double.valueOf(double1); Integer.valueOf(double1); Long.valueOf(integer1); int int2 = new Integer(1); int2 = new Integer(1); int2 = new Integer(string); Integer integer2 = new Integer(1); integer2 = new Integer(1); int2 = new Unknown(); int2 = unknownMethod(1); }
Source:
public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1_FIELD1), ImmutableSet.of(EVENT1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), ImmutableSet.of(EVENT1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2), ImmutableSet.of(EVENT1, EVENT2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(Collections.EMPTY_LIST, Collections.EMPTY_LIST); assertFalse(req.isFulfilled(trace)); }

Target:
public void testOptionalRequirements() { TmfAnalysisRequirement req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(ImmutableSet.of(EVENT1, EVENT2), ImmutableSet.of(EVENT1_FIELD1, EVENT1_FIELD2)); assertTrue(req.isFulfilled(trace)); req = new TmfAnalysisEventFieldRequirement(checkNotNull(Collections.EMPTY_LIST), checkNotNull(Collections.EMPTY_LIST)); assertTrue(req.isFulfilled(trace)); }
Source:
public final void delegatesSubList() throws Exception { final int fridx = 3; final int toidx = 5; this.list.subList(fridx, toidx); Mockito.verify(this.origin).subList(fridx, toidx); }

Target:
public final void delegatesSubList() throws Exception { final int from = 3; final int toidx = 5; this.list.subList(from, toidx); Mockito.verify(this.origin).subList(from, toidx); }
Source:
protected Segment getSegment( WorkspaceCache cache ) { ChildReference self = parentReferenceToSelf(cache); if (self == null) { self = parentReferenceToSelf(cache); } return self.getSegment(); }

Target:
protected Segment getSegment( WorkspaceCache cache ) { return parentReferenceToSelf(cache).getSegment(); }
Source:
private CharSequence getMediaXML() { XmlStringBuilder mediaXML = new XmlStringBuilder(); for (URINode node : uriNodeList) { mediaXML.element(node); } return mediaXML; }

Target:
private XmlStringBuilder getMediaXML() { XmlStringBuilder mediaXML = new XmlStringBuilder(); for (URINode node : uriNodeList) { mediaXML.element(node); } return mediaXML; }
Source:
@Override public void setCard(@NonNull final MainPageCard card) { super.setCard(card); setLayoutDirectionByWikiSite(card.wikiSite(), containerView); headerView.setTitle(L10nUtil.getStringForArticleLanguage(getCard().wikiSite().languageCode(), R.string.view_main_page_card_title)) .setLangCode(getCard().wikiSite().languageCode()) .setCard(getCard()) .setCallback(getCallback()); footerView.setCallback(this::goToMainPage); footerView.setFooterActionText(L10nUtil.getStringForArticleLanguage(getCard().wikiSite().languageCode(), R.string.view_main_page_card_action)); }

Target:
@Override public void setCard(@NonNull final MainPageCard card) { super.setCard(card); setLayoutDirectionByWikiSite(card.wikiSite(), containerView); headerView.setTitle(L10nUtil.getStringForArticleLanguage(getCard().wikiSite().languageCode(), R.string.view_main_page_card_title)) .setLangCode(getCard().wikiSite().languageCode()) .setCard(getCard()) .setCallback(getCallback()); footerView.setCallback(this::goToMainPage); footerView.setFooterActionText(getContext().getString(R.string.view_main_page_card_action)); }
Source:
public static void main(String[] args) { KeyVaultBackupClient backupClient = new KeyVaultBackupClientBuilder() .vaultUrl("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); String blobStorageUrl = "<blob-storage-url>"; String sasToken = "<sas-token>"; SyncPoller<KeyVaultBackupOperation, String> backupPoller = backupClient.beginBackup(blobStorageUrl, sasToken); backupPoller.waitForCompletion(); String backupUri = backupPoller.getFinalResult(); String[] segments = backupUri.split("/"); String folderName = segments[segments.length - 1]; SyncPoller<KeyVaultRestoreOperation, Void> restorePoller = backupClient.beginRestore(blobStorageUrl, sasToken, folderName); restorePoller.waitForCompletion(); }

Target:
public static void main(String[] args) { KeyVaultBackupClient backupClient = new KeyVaultBackupClientBuilder() .vaultUrl("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); String blobStorageUrl = "<blob-storage-url>"; String sasToken = "<sas-token>"; SyncPoller<KeyVaultBackupOperation, String> backupPoller = backupClient.beginBackup(blobStorageUrl, sasToken); backupPoller.waitForCompletion(); String backupFolderUrl = backupPoller.getFinalResult(); SyncPoller<KeyVaultRestoreOperation, Void> restorePoller = backupClient.beginRestore(backupFolderUrl, sasToken); restorePoller.waitForCompletion(); }
Source:
public void receiveAll() { ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() .connectionString("fake-string") .buildReceiverClientBuilder() .buildAsyncClient(); Disposable subscription = receiver.receive().subscribe(receivedMessage -> { String messageId = receivedMessage.getMessageId(); System.out.printf("Received message messageId %s%n", messageId); System.out.printf("Contents of message as string: %s%n", new String(receivedMessage.getBody(), UTF_8)); }); subscription.dispose(); END: com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#all }

Target:
public void receiveAll() { ServiceBusReceiverAsyncClient receiver = new ServiceBusClientBuilder() .connectionString("fake-string") .buildReceiverClientBuilder() .queueName("<QUEUE-NAME>") .buildAsyncClient(); Disposable subscription = receiver.receive().subscribe(receivedMessage -> { String messageId = receivedMessage.getMessageId(); System.out.printf("Received message messageId %s%n", messageId); System.out.printf("Contents of message as string: %s%n", new String(receivedMessage.getBody(), UTF_8)); }); receiver.close(); subscription.dispose(); END: com.azure.messaging.servicebus.servicebusasyncreceiverclient.receive#all }
Source:
public Optional<String> resolveTestQueryFailure(ErrorCodeSupplier errorCode, QueryStats controlQueryStats, QueryStats testQueryStats, Optional<QueryBundle> test) { if (errorCode != HIVE_TOO_MANY_OPEN_PARTITIONS || !test.isPresent()) { return Optional.empty(); } try { ShowCreate showCreate = new ShowCreate(TABLE, test.get().getTableName()); String showCreateResult = getOnlyElement(prestoAction.execute(showCreate, DESCRIBE, resultSet -> resultSet.getString(1)).getResults()); CreateTable createTable = (CreateTable) sqlParser.createStatement(showCreateResult, ParsingOptions.builder().setDecimalLiteralTreatment(AS_DOUBLE).build()); List<Property> bucketCountProperty = createTable.getProperties().stream() .filter(property -> property.getName().getValue().equals(BUCKET_COUNT_PROPERTY)) .collect(toImmutableList()); if (bucketCountProperty.size() != 1) { return Optional.empty(); } long bucketCount = ((LongLiteral) getOnlyElement(bucketCountProperty).getValue()).getValue(); int testClusterSize = testResourceClient.getJsonResponse(NODE_RESOURCE_PATH, listJsonCodec(HeartbeatFailureDetector.Stats.class)).size(); if (testClusterSize * maxBucketPerWriter < bucketCount) { return Optional.of("Auto Resolved: No enough worker on test cluster"); } return Optional.empty(); } catch (Throwable t) { log.warn(t, "Exception when resolving HIVE_TOO_MANY_OPEN_PARTITIONS"); return Optional.empty(); } }

Target:
public Optional<String> resolveTestQueryFailure(ErrorCodeSupplier errorCode, QueryStats controlQueryStats, QueryStats testQueryStats, Optional<QueryBundle> test) { if (errorCode != HIVE_TOO_MANY_OPEN_PARTITIONS || !test.isPresent()) { return Optional.empty(); } try { ShowCreate showCreate = new ShowCreate(TABLE, test.get().getTableName()); String showCreateResult = getOnlyElement(prestoAction.execute(showCreate, DESCRIBE, resultSet -> resultSet.getString(1)).getResults()); CreateTable createTable = (CreateTable) sqlParser.createStatement(showCreateResult, ParsingOptions.builder().setDecimalLiteralTreatment(AS_DOUBLE).build()); List<Property> bucketCountProperty = createTable.getProperties().stream() .filter(property -> property.getName().getValue().equals(BUCKET_COUNT_PROPERTY)) .collect(toImmutableList()); if (bucketCountProperty.size() != 1) { return Optional.empty(); } long bucketCount = ((LongLiteral) getOnlyElement(bucketCountProperty).getValue()).getValue(); int testClusterSize = testClusterSizeSupplier.get(); if (testClusterSize * maxBucketPerWriter < bucketCount) { return Optional.of("Auto Resolved: No enough worker on test cluster"); } return Optional.empty(); } catch (Throwable t) { log.warn(t, "Exception when resolving HIVE_TOO_MANY_OPEN_PARTITIONS"); return Optional.empty(); } }
Source:
public void disconnect() { if (winrm != null && shellSelector != null) { try { winrmCallRetryConnFailure(new CallableFunction<DeleteResponse>() { @Override public DeleteResponse call() { setActionToContext((BindingProvider) winrm, "<LINK_1>"); return winrm.delete(null, RESOURCE_URI, MAX_ENVELOPER_SIZE, operationTimeout, locale, shellSelector); } }); } catch (SOAPFaultException soapFault) { assertFaultCode(soapFault, WSMAN_FAULT_CODE_SHELL_WAS_NOT_FOUND); } } if (bus != null) { bus.shutdown(true); } }

Target:
public void disconnect() { if (context == null) return; boolean isBusRunning = context.getBus().getState() != BusState.SHUTDOWN; if (!isBusRunning) return; try { if (winrm != null && shellSelector != null) { try { winrmCallRetryConnFailure(new CallableFunction<DeleteResponse>() { @Override public DeleteResponse call() { setActionToContext((BindingProvider) winrm, "<LINK_1>"); return winrm.delete(null, RESOURCE_URI, MAX_ENVELOPER_SIZE, operationTimeout, locale, shellSelector); } }); } catch (SOAPFaultException soapFault) { assertFaultCode(soapFault, WSMAN_FAULT_CODE_SHELL_WAS_NOT_FOUND); } } } finally { if (cleanupContext) { context.getBus().shutdown(true); context = null; } } }
Source:
private void setUsingDocs(RenderRequest request, User user, ComponentService.Iface client, Set<String> releaseIds) { Set<Project> usingProjects = null; Set<Component> usingComponentsForComponent = null; int allUsingProjectsCount = -1; if (releaseIds != null && releaseIds.size() > 0) { try { ProjectService.Iface projectClient = thriftClients.makeProjectClient(); usingProjects = projectClient.searchByReleaseIds(releaseIds, user); allUsingProjectsCount = projectClient.getProjectCountByReleaseIds(releaseIds); usingComponentsForComponent = client.getUsingComponentsForComponent(releaseIds); } catch (TException e) { log.error("Problem filling using docs", e); } } request.setAttribute(USING_PROJECTS, nullToEmptySet(usingProjects)); request.setAttribute(USING_COMPONENTS, nullToEmptySet(usingComponentsForComponent)); request.setAttribute(ALL_USING_PROJECTS_COUNT, allUsingProjectsCount); }

Target:
private void setUsingDocs(RenderRequest request, User user, ComponentService.Iface client, Set<String> releaseIds) { Set<Project> usingProjects = null; Set<Component> usingComponentsForComponent = null; int allUsingProjectsCount = 0; if (releaseIds != null && releaseIds.size() > 0) { try { ProjectService.Iface projectClient = thriftClients.makeProjectClient(); usingProjects = projectClient.searchByReleaseIds(releaseIds, user); allUsingProjectsCount = projectClient.getCountByReleaseIds(releaseIds); usingComponentsForComponent = client.getUsingComponentsForComponent(releaseIds); } catch (TException e) { log.error("Problem filling using docs", e); } } request.setAttribute(USING_PROJECTS, nullToEmptySet(usingProjects)); request.setAttribute(USING_COMPONENTS, nullToEmptySet(usingComponentsForComponent)); request.setAttribute(ALL_USING_PROJECTS_COUNT, allUsingProjectsCount); }
Source:
public CompletableFuture<Void> visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) throws Throwable { ctx.onReturn((ctx1, command1, rv, throwable) -> { if (throwable != null) throw throwable; Object key; if (shouldUpdateOnWriteCommand(command) && command.isSuccessful() && cdl.localNodeIsOwner((key = command.getKey()))) { if (trace) { log.trace("Sending additional invalidation for requestors if necessary."); } blockOnL1FutureIfNeeded(l1Manager .flushCache(Collections.singleton(key), ctx1.getOrigin(), assumeOriginKeptEntryInL1)); } return null; }); return ctx.continueInvocation(); }

Target:
public CompletableFuture<Void> visitDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) throws Throwable { return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { if (throwable != null) throw throwable; Object key; DataWriteCommand writeCommand = (DataWriteCommand) rCommand; if (shouldUpdateOnWriteCommand(writeCommand) && writeCommand.isSuccessful() && cdl.localNodeIsOwner((key = writeCommand.getKey()))) { if (trace) { log.trace("Sending additional invalidation for requestors if necessary."); } blockOnL1FutureIfNeeded(l1Manager .flushCache(Collections.singleton(key), rCtx.getOrigin(), assumeOriginKeptEntryInL1)); } return null; }); }
Source:
public void getLocation(String url) { if (NetworkUtils.hasNetwork()) { String locationEndPoint = url + ApplicationConstants.API.REST_ENDPOINT + "LocationEntity"; Call<Results<LocationEntity>> call = restApi.getLocations(locationEndPoint, "Admission LocationEntity", "full"); call.enqueue(new Callback<Results<LocationEntity>>() { @Override public void onResponse(Call<Results<LocationEntity>> call, Response<Results<LocationEntity>> response) { if (response.isSuccessful()) { view.updateLocationAdapter(response.body().getResults()); } else { view.showToast(mContext.getResources().getString(R.string.error_occurred)); view.enableSubmitButton(false); } } @Override public void onFailure(Call<Results<LocationEntity>> call, Throwable t) { view.showToast(t.getMessage()); view.enableSubmitButton(false); } }); } else { view.showToast(mContext.getResources().getString(R.string.offline_error_message)); } }

Target:
public void getLocation(String url) { if (NetworkUtils.hasNetwork()) { String locationEndPoint = url + ApplicationConstants.API.REST_ENDPOINT + "location"; Call<Results<LocationEntity>> call = restApi.getLocations(locationEndPoint, "Admission Location", "full"); call.enqueue(new Callback<Results<LocationEntity>>() { @Override public void onResponse(Call<Results<LocationEntity>> call, Response<Results<LocationEntity>> response) { if (response.isSuccessful()) { view.updateLocationAdapter(response.body().getResults()); } else { view.showToast(mContext.getResources().getString(R.string.error_occurred)); view.enableSubmitButton(false); } } @Override public void onFailure(Call<Results<LocationEntity>> call, Throwable t) { view.showToast(t.getMessage()); view.enableSubmitButton(false); } }); } else { view.showToast(mContext.getResources().getString(R.string.offline_error_message)); } }
Source:
private Action onFixMessage( final DirectBuffer buffer, final int offset, final int blockLength, final int version, final long position) { messageFrame.wrap(buffer, offset, blockLength, version); final int messageLength = messageFrame.bodyLength(); final long messageType = messageFrame.sbeSchemaVersion() > 2 ? messageFrame.messageType() : messageFrame.deprecatedMessageType(); return protocolHandler.onMessage( buffer, offset + FRAME_SIZE, messageLength, messageFrame.libraryId(), messageFrame.connection(), messageFrame.session(), messageFrame.sequenceIndex(), messageType, messageFrame.timestamp(), messageFrame.status(), messageFrame.sequenceNumber(), position); }

Target:
private Action onFixMessage( final DirectBuffer buffer, final int offset, final int blockLength, final int version, final long position) { messageFrame.wrap(buffer, offset, blockLength, version); final int messageLength = messageFrame.bodyLength(); final long messageType = MessageTypeExtractor.getMessageType(messageFrame); return protocolHandler.onMessage( buffer, offset + FRAME_SIZE, messageLength, messageFrame.libraryId(), messageFrame.connection(), messageFrame.session(), messageFrame.sequenceIndex(), messageType, messageFrame.timestamp(), messageFrame.status(), messageFrame.sequenceNumber(), position); }
Source:
public String toString(String indent) { StringBuilder result = new StringBuilder(); int i = 0; for (Type field : schema.getFields()) { String name = field.getName(); List<Object> values = data[i]; ++i; if (values != null && !values.isEmpty()) { for (Object value : values) { result.append(indent); result.append(name); if (value == null) { result.append(": NULL\n"); } else if (value instanceof Group) { result.append("\n"); result.append(((SimpleGroup)value).toString(indent+" ")); } else { result.append(": " ); result.append(value.toString()); result.append("\n"); } } } } return result.toString(); }

Target:
public String toString(String indent) { StringBuilder builder = new StringBuilder(); appendToString(builder, indent); return builder.toString(); }
Source:
private void defineMetadataConceptsForFilters(){ metaDataObservations = Arrays.asList(1473,163161,162724); }

Target:
private void defineMetadataConceptsForFilters(){ metaDataObservations = Arrays.asList(Constants.Shr.KenyaEmr.CONCEPTS.HIV_TESTS.PROVIDER_DETAILS.NAME.concept_id, Constants.Shr.KenyaEmr.CONCEPTS.HIV_TESTS.PROVIDER_DETAILS.ID.concept_id, Constants.Shr.KenyaEmr.CONCEPTS.HIV_TESTS.TEST_FACILITY.concept_id); }
Source:
private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); if (replicaCount > volume.getBricks().size()) { throw new EngineException(EngineError.GlusterVolumeGeoRepSyncFailed, "Not all bricks are available for this volume"); } for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }

Target:
private void updateGeoRepStatus(GlusterVolumeEntity volume, GlusterGeoRepSession session) { List<Set<GeoRepSessionStatus>> list = new ArrayList<>(); int replicaCount = volume.getReplicaCount() == 0 ? 1 : volume.getReplicaCount(); if (replicaCount > volume.getBricks().size()) { session.setStatus(GeoRepSessionStatus.UNKNOWN); log.info("Not all bricks are available for this volume. replicaCount : , volumeBrickCount: {}", replicaCount, volume.getBricks().size()); return; } for (int i = 0; i < volume.getBricks().size(); i = i + replicaCount) { Set<GeoRepSessionStatus> subVolumeStatusSet = new HashSet<>(); int j = 0; while (j < replicaCount) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusSet.add(getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusSet); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (Set<GeoRepSessionStatus> subVolumeStatusValues : list) { if (subVolumeStatusValues.contains(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusValues.contains(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (subVolumeStatusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) subVolumeStatusValues.toArray()[0]); } else { log.info("Multiple status values found in volume '{}'", session.getMasterVolumeName()); } } } }
Source:
public URL execute( @DescribeParameter(name = "coverage", description = "Input raster") GridCoverage2D coverage) throws IOException { String fileName = coverage.getName().toString() + ".tif"; final Resource resource = resources.getOutputResource(null, fileName); OutputStream os = resource.out(); GeoTiffWriter writer = new GeoTiffWriter(os); final ParameterValueGroup params = new GeoTiffFormat().getWriteParameters(); params.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue( DEFAULT_WRITE_PARAMS); final GeneralParameterValue[] wps = params.values().toArray( new GeneralParameterValue[1]); try { writer.write(coverage, wps); } finally { try { writer.dispose(); } catch (Exception e) { } os.close(); } return new URL(resources.getOutputResourceUrl(fileName, "image/tiff")); }

Target:
public URL execute( @DescribeParameter(name = "coverage", description = "Input raster") GridCoverage2D coverage) throws IOException { String fileName = coverage.getName().toString() + ".tif"; final Resource resource = resources.getOutputResource(null, fileName); final ParameterValueGroup params = new GeoTiffFormat().getWriteParameters(); params.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue( DEFAULT_WRITE_PARAMS); final GeneralParameterValue[] wps = params.values().toArray( new GeneralParameterValue[1]); try (OutputStream os = resource.out()) { GeoTiffWriter writer = new GeoTiffWriter(os); try { writer.write(coverage, wps); } finally { writer.dispose(); } } return new URL(resources.getOutputResourceUrl(fileName, "image/tiff")); }
Source:
private void attachedFile() throws ApiError { this.deliveriesBackend.attach(delivery, fileName, in); assertEquals(1, delivery.getAttachments().size()); assertEquals(1, delivery.getAttachments().stream() .map((attachment) -> attachment.getFileName().equals(fileName) ).count()); }

Target:
private void attachedFile() throws ApiError { this.deliveriesBackend.attach(delivery, fileName, in); assertEquals(1, delivery.getAttachments().size()); assertEquals(fileName, delivery.getAttachments().iterator().next().getFileName()); }
Source:
public List<String> getGroupMembers(byte[] groupId) { return new ArrayList<String>(getGroup(groupId).members); }

Target:
public List<String> getGroupMembers(byte[] groupId) { GroupInfo group = getGroup(groupId); if (group == null) { return new ArrayList<String>(); } else { return new ArrayList<String>(group.members); } }
Source:
protected MockHandler createMockHandlerForTestClass(Class<?> testClass, Class<? extends MockHandler> defaultMockHandler) { final Annotation annotation = testClass.getAnnotation(ModulesForTesting.class); if (annotation != null) { Class<? extends MockHandler> mockHandlerClass = ((ModulesForTesting) annotation).mockHandler(); try { return mockHandlerClass != MockHandler.class ? mockHandlerClass.newInstance() : defaultMockHandler.newInstance(); } catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("Failed to instantiate MockHandler " + mockHandlerClass.getName() + ". Ensure that is has an accessible no-arg constructor.", e); } } else { throw new IllegalStateException("No MockHandler specified!"); } }

Target:
protected MockHandler createMockHandlerForTestClass(Class<?> testClass, Class<? extends MockHandler> defaultMockHandler) { Class<? extends MockHandler> mockHandlerClass = defaultMockHandler; for(Class<?> superClass : getAllSuperClassesInReverseOrder(testClass)) { ModulesForTesting annotation = superClass.getAnnotation(ModulesForTesting.class); if(annotation != null && !annotation.mockHandler().equals(MockHandler.class)) { mockHandlerClass = annotation.mockHandler(); } } ModulesForTesting annotation = testClass.getAnnotation(ModulesForTesting.class); if(annotation != null && !annotation.mockHandler().equals(MockHandler.class)) { mockHandlerClass = annotation.mockHandler(); } if (mockHandlerClass != null) { try { return mockHandlerClass != MockHandler.class ? mockHandlerClass.newInstance() : defaultMockHandler.newInstance(); } catch (SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalArgumentException("Failed to instantiate MockHandler " + mockHandlerClass.getName() + ". Ensure that is has an accessible no-arg constructor.", e); } } else { throw new IllegalStateException("No MockHandler specified!"); } }
Source:
public static QueryExecuteOperationFragmentMapping getById(final int id) { for (QueryExecuteOperationFragmentMapping type : values()) { if (type.id == id) { return type; } } return null; }

Target:
public static QueryExecuteOperationFragmentMapping getById(final int id) { for (QueryExecuteOperationFragmentMapping type : VALUES) { if (type.id == id) { return type; } } return null; }
Source:
private synchronized void onFailure(final ConnectionManager manager, final Throwable ex) { if (connectionManager.isPresent() && connectionManager.get() == manager) { logger.debug("Unrecoverable failure, forcing disconnect: {}", ex); try { if (connectionManager.isPresent()) { this.disconnect(); } } catch (ConnectionException e) { logger.warn("Unable to Disconnect..."); } } else { logger.debug("Ignoring failure from old connection: {}", ex); } }

Target:
private synchronized void onFailure(final ConnectionManager manager, final Throwable ex) { if (connectionManager.isPresent() && connectionManager.get() == manager) { logger.debug("Unrecoverable failure, forcing disconnect", ex); try { this.disconnect(); } catch (ConnectionException e) { logger.warn("Unable to Disconnect..."); } } else { logger.debug("Ignoring failure from old connection", ex); } }
Source:
private void handshakeFinished() throws IOException { if (handshakeResult.getHandshakeStatus() == HandshakeStatus.FINISHED) { if (netWriteBuffer.hasRemaining()) key.interestOps(key.interestOps() | SelectionKey.OP_WRITE); else { state = State.READY; key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE); SSLSession session = sslEngine.getSession(); log.debug("SSL handshake completed successfully with peerHost '{}' peerPort peerPrincipal '{}' cipherSuite '{}'", session.getPeerHost(), session.getPeerPort(), peerPrincipal(), session.getCipherSuite()); if (sslInformation == null) { String cipherSuiteName = session.getCipherSuite(); if ((cipherSuiteName == null) || cipherSuiteName.isEmpty()) { cipherSuiteName = "unknown"; } String protocolName = session.getProtocol(); if ((protocolName == null) || protocolName.isEmpty()) { protocolName = "unknown"; } sslInformation = new SslInformation(cipherSuiteName, protocolName); } } log.trace("SSLHandshake FINISHED channelId {}, appReadBuffer pos {}, netReadBuffer pos {}, netWriteBuffer pos ", channelId, appReadBuffer.position(), netReadBuffer.position(), netWriteBuffer.position()); } else { throw new IOException("NOT_HANDSHAKING during handshake"); } }

Target:
private void handshakeFinished() throws IOException { if (handshakeResult.getHandshakeStatus() == HandshakeStatus.FINISHED) { if (netWriteBuffer.hasRemaining()) key.interestOps(key.interestOps() | SelectionKey.OP_WRITE); else { state = State.READY; key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE); SSLSession session = sslEngine.getSession(); log.debug("SSL handshake completed successfully with peerHost '{}' peerPort peerPrincipal '{}' cipherSuite '{}'", session.getPeerHost(), session.getPeerPort(), peerPrincipal(), session.getCipherSuite()); if (cipherInformation == null) { String cipherSuiteName = session.getCipherSuite(); if (cipherSuiteName == null || cipherSuiteName.isEmpty()) { cipherSuiteName = "unknown"; } String protocolName = session.getProtocol(); if (protocolName == null || protocolName.isEmpty()) { protocolName = "unknown"; } cipherInformation = new CipherInformation(cipherSuiteName, protocolName); } } log.trace("SSLHandshake FINISHED channelId {}, appReadBuffer pos {}, netReadBuffer pos {}, netWriteBuffer pos ", channelId, appReadBuffer.position(), netReadBuffer.position(), netWriteBuffer.position()); } else { throw new IOException("NOT_HANDSHAKING during handshake"); } }
Source:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { 5, 1000 }, { 100, 2000 }, { 200, 1000 }, { 300, 3000 } }); }

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { 5, 1000 }, { 100, 2000 }, { 200, 2000 } }); }
Source:
public int hashCode() { return Objects.hash(sourceId, destinationIds); }

Target:
public int hashCode() { return Objects.hash(sourceId, Arrays.hashCode(destinationIds)); }
Source:
public void setUp() throws Exception { vlanNetwork = createNetworkWithId(); vlanNetwork.setVlanId(1); vmNetwork1 = createNetworkWithId(); vmNetwork1.setVmNetwork(true); vmNetwork2 = createNetworkWithId(); vmNetwork2.setVmNetwork(true); nonVmNetwork1 = createNetworkWithId(); nonVmNetwork1.setVmNetwork(false); nonVmNetwork2 = createNetworkWithId(); nonVmNetwork2.setVmNetwork(false); networkMap = new BusinessEntityMap<>( Arrays.asList(vlanNetwork, vmNetwork1, vmNetwork2, nonVmNetwork1, nonVmNetwork2)); Mockito.when(networkExclusivenessValidator.getViolationMessage()) .thenReturn(NETWORK_INTERFACES_NOT_EXCLUSIVELY_USED_BY_NETWORK); }

Target:
public void setUp() throws Exception { vlanNetwork = createNetworkWithId(); vlanNetwork.setVlanId(1); vmNetwork1 = createNetworkWithId(); vmNetwork1.setVmNetwork(true); vmNetwork2 = createNetworkWithId(); vmNetwork2.setVmNetwork(true); nonVmNetwork1 = createNetworkWithId(); nonVmNetwork1.setVmNetwork(false); nonVmNetwork2 = createNetworkWithId(); nonVmNetwork2.setVmNetwork(false); networkMap = new BusinessEntityMap<>( Arrays.asList(vlanNetwork, vmNetwork1, vmNetwork2, nonVmNetwork1, nonVmNetwork2)); when(networkExclusivenessValidator.getViolationMessage()) .thenReturn(NETWORK_INTERFACES_NOT_EXCLUSIVELY_USED_BY_NETWORK); }
Source:
final void clearEpollIn() { final EventLoop loop = isRegistered() ? eventLoop() : null; final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe(); if (loop == null || loop.inEventLoop()) { unsafe.clearEpollIn0(); return; } loop.execute(new Runnable() { @Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { unsafe.clearEpollIn0(); } } }); }

Target:
final void clearEpollIn() { final EventLoop loop = isRegistered() ? eventLoop() : null; final AbstractEpollUnsafe unsafe = (AbstractEpollUnsafe) unsafe(); if (loop == null || loop.inEventLoop()) { unsafe.clearEpollIn0(); return; } Runnable clearFlagTask = clearEpollInTask; if (clearFlagTask == null) { clearEpollInTask = clearFlagTask = new Runnable() { @Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { unsafe.clearEpollIn0(); } } }; } loop.execute(clearFlagTask); }
Source:
public static Map<Guid, List<DiskImage>> getImagesLeaf(List<DiskImage> images) { Map<Guid, List<DiskImage>> retVal = new HashMap<>(); images.stream().forEach(image -> MultiValueMapUtils.addToMap(image.getId(), image, retVal)); retVal.values().forEach(ImagesHandler::sortImageList); return retVal; }

Target:
public static Map<Guid, List<DiskImage>> getImagesLeaf(List<DiskImage> images) { Map<Guid, List<DiskImage>> retVal = new HashMap<>(); images.forEach(image -> MultiValueMapUtils.addToMap(image.getId(), image, retVal)); retVal.values().forEach(ImagesHandler::sortImageList); return retVal; }
Source:
public abstract ErlangEntryPoint getEntryPoint() throws ExecutionException; public abstract String getWorkDirectory(); public ErlangEntryPoint getDebugEntryPoint() throws ExecutionException { return getEntryPoint(); }

Target:
public abstract ErlangEntryPoint getEntryPoint() throws ExecutionException; @Nullable public abstract String getWorkDirectory(); public ErlangEntryPoint getDebugEntryPoint() throws ExecutionException { return getEntryPoint(); }
Source:
public void setup(OperatorContext context) { operatorId = context.getId(); globalProcessedFileCount.setValue(processedFiles.size()); LOG.debug("Setup processed file count: {}", globalProcessedFileCount); this.context = context; try { filePath = new Path(directory); configuration = new Configuration(); fs = getFSInstance(); } catch (IOException ex) { failureHandling(ex); } fileCounters.setCounter(FileCounters.GLOBAL_PROCESSED_FILES, globalProcessedFileCount); fileCounters.setCounter(FileCounters.LOCAL_PROCESSED_FILES, localProcessedFileCount); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_FAILURES, globalNumberOfFailures); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_FAILURES, localNumberOfFailures); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_RETRIES, globalNumberOfRetries); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_RETRIES, localNumberOfRetries); fileCounters.setCounter(FileCounters.PENDING_FILES, pendingFileCount); windowDataManager.setup(context); if (context.getValue(OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) { currentFile = null; offset = 0; } fileQueue = new ArrayBlockingQueue<Path>(queueCapacity); scanDirService = Executors.newScheduledThreadPool(1); }

Target:
public void setup(OperatorContext context) { operatorId = context.getId(); globalProcessedFileCount.setValue(processedFiles.size()); LOG.debug("Setup processed file count: {}", globalProcessedFileCount); this.context = context; try { filePath = new Path(directory); configuration = new Configuration(); fs = getFSInstance(); } catch (IOException ex) { failureHandling(ex); } fileCounters.setCounter(FileCounters.GLOBAL_PROCESSED_FILES, globalProcessedFileCount); fileCounters.setCounter(FileCounters.LOCAL_PROCESSED_FILES, localProcessedFileCount); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_FAILURES, globalNumberOfFailures); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_FAILURES, localNumberOfFailures); fileCounters.setCounter(FileCounters.GLOBAL_NUMBER_OF_RETRIES, globalNumberOfRetries); fileCounters.setCounter(FileCounters.LOCAL_NUMBER_OF_RETRIES, localNumberOfRetries); fileCounters.setCounter(FileCounters.PENDING_FILES, pendingFileCount); windowDataManager.setup(context); if (context.getValue(OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) { currentFile = null; offset = 0; } fileQueue = new ArrayBlockingQueue<Path>(queueCapacity); scanDirService = Executors.newSingleThreadScheduledExecutor(); }
Source:
public VmDevice() { alias = alias == null ? "" : alias; }

Target:
public VmDevice() { alias = ""; }
Source:
private void fixSize() { perspSwitcherToolbar.pack(); perspSwitcherToolbar.getParent().pack(); perspSwitcherToolbar.getShell().requestLayout(); }

Target:
private void fixSize() { perspSwitcherToolbar.pack(); perspSwitcherToolbar.getParent().pack(); perspSwitcherToolbar.requestLayout(); }
Source:
private List<Topic> listTopics(String groupName) { return topicRepository.listTopics(groupName); }

Target:
public List<Topic> listTopics(String groupName) { return topicRepository.listTopics(groupName); }
Source:
public void shouldThrowIllegalStateExceptionOnCallingNextAfterClose() throws Exception { try ( GBPTree<MutableLong,MutableLong> tree = index().build() ) { try ( Writer<MutableLong,MutableLong> writer = tree.writer() ) { MutableLong value = new MutableLong(); for ( int i = 0; i < 10; i++ ) { value.setValue( i ); writer.put( value, value ); } } RawCursor<Hit<MutableLong,MutableLong>,IOException> seek = tree.seek( new MutableLong( 0 ), new MutableLong( Long.MAX_VALUE ) ); assertTrue( seek.next() ); assertTrue( seek.next() ); seek.close(); try { while ( seek.next() ) { } fail( "Should have failed" ); } catch ( IllegalStateException e ) { } } }

Target:
public void shouldThrowIllegalStateExceptionOnCallingNextAfterClose() throws Exception { try ( GBPTree<MutableLong,MutableLong> tree = index().build() ) { try ( Writer<MutableLong,MutableLong> writer = tree.writer() ) { MutableLong value = new MutableLong(); for ( int i = 0; i < 10; i++ ) { value.setValue( i ); writer.put( value, value ); } } RawCursor<Hit<MutableLong,MutableLong>,IOException> seek = tree.seek( new MutableLong( 0 ), new MutableLong( Long.MAX_VALUE ) ); assertTrue( seek.next() ); assertTrue( seek.next() ); seek.close(); for ( int i = 0; i < 2; i++ ) { try { seek.next(); fail( "Should have failed" ); } catch ( IllegalStateException e ) { } } } }
Source:
protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getActiveInstance(); final HashSet<String> hs = new HashSet<String>(nodes); List<String> names = null; for (String node_s : hs) { Computer computer = null; try { computer = jenkins.getComputer(node_s); if (computer == null) { if (names == null) { names = new ArrayList<String>(); for (Computer c : jenkins.getComputers()) { if (!c.getName().isEmpty()) { names.add(c.getName()); } } } String adv = EditDistance.findNearest(node_s, names); throw new IllegalArgumentException(adv == null ? hudson.model.Messages.Computer_NoSuchSlaveExistsWithoutAdvice(node_s) : hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv)); } computer.cliOffline(cause); } catch (Exception e) { if (hs.size() == 1) { throw e; } final String errorMsg = node_s + ": " + e.getMessage(); stderr.println(errorMsg); errorOccurred = true; continue; } } if (errorOccurred) { throw new AbortException("Error occured while performing this command, see previous stderr output."); } return 0; }

Target:
protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getInstance(); final HashSet<String> hs = new HashSet<String>(nodes); List<String> names = null; for (String node_s : hs) { try { Computer computer = jenkins.getComputer(node_s); if (computer == null) { if (names == null) { names = ComputerSet.getComputerNames(); } String adv = EditDistance.findNearest(node_s, names); throw new IllegalArgumentException(adv == null ? hudson.model.Messages.Computer_NoSuchSlaveExistsWithoutAdvice(node_s) : hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv)); } computer.cliOffline(cause); } catch (Exception e) { if (hs.size() == 1) { throw e; } stderr.println(node_s + ": " + e.getMessage()); errorOccurred = true; continue; } } if (errorOccurred) { throw new AbortException("Error occured while performing this command, see previous stderr output."); } return 0; }