auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateUIOnSocialLoginToEdxFailure(SocialFactory.SOCIAL_SOURCE_TYPE socialType, String accessToken) { View signupWith = findViewById(R.id.signup_with_row); signupWith.setVisibility(View.GONE); View socialPanel = findViewById(R.id.panel_social_layout); socialPanel.setVisibility(View.GONE); DividerWithTextView signupWithEmailTitle = (DividerWithTextView) findViewById(R.id.or_signup_with_email_title); signupWithEmailTitle.setText(getString(R.string.complete_registration)); showRegularMessage(socialType); populateEmailFromSocialSite(socialType, accessToken); List<IRegistrationFieldView> extraFields = new ArrayList<>(); for (IRegistrationFieldView field : this.mFieldViews) { String fieldName = field.getField().getName(); <START> if (RegistrationFieldType.CONFIRM_EMAIL.name().equalsIgnoreCase(fieldName)) { field.getView().setVisibility(View.GONE); extraFields.add(field); } <END> if (RegistrationFieldType.PASSWORD.name().equalsIgnoreCase(fieldName)) { field.getView().setVisibility(View.GONE); extraFields.add(field); } } this.mFieldViews.removeAll(extraFields); }</code><technical_language>IMO, merge conditions, java if (RegistrationFieldType.CONFIRM_EMAIL.name().equalsIgnoreCase(fieldName) || RegistrationFieldType.PASSWORD.name().equalsIgnoreCase(fieldName)) { field.getView().setVisibility(View.GONE); extraFields.add(field); }</technical_language>

Target:
private void updateUIOnSocialLoginToEdxFailure(SocialFactory.SOCIAL_SOURCE_TYPE socialType, String accessToken) { View signupWith = findViewById(R.id.signup_with_row); signupWith.setVisibility(View.GONE); View socialPanel = findViewById(R.id.panel_social_layout); socialPanel.setVisibility(View.GONE); DividerWithTextView signupWithEmailTitle = (DividerWithTextView) findViewById(R.id.or_signup_with_email_title); signupWithEmailTitle.setText(getString(R.string.complete_registration)); showRegularMessage(socialType); populateEmailFromSocialSite(socialType, accessToken); List<IRegistrationFieldView> extraFields = new ArrayList<>(); for (IRegistrationFieldView field : this.mFieldViews) { String fieldName = field.getField().getName(); if (RegistrationFieldType.CONFIRM_EMAIL.name().equalsIgnoreCase(fieldName) || RegistrationFieldType.PASSWORD.name().equalsIgnoreCase(fieldName)) { field.getView().setVisibility(View.GONE); extraFields.add(field); } } this.mFieldViews.removeAll(extraFields); }
Source:
<code><START> public void testJoinGroupUnknownMemberResponseWithOldGeneration() { <END> setupCoordinator(); mockClient.prepareResponse(groupCoordinatorResponse(node, Errors.NONE)); final int generation = 1; mockClient.prepareResponse(joinGroupFollowerResponse(generation, memberId, JoinGroupRequest.UNKNOWN_MEMBER_ID, Errors.NONE)); mockClient.prepareResponse(syncGroupResponse(Errors.NONE)); coordinator.ensureActiveGroup(); final AbstractCoordinator.Generation currGen = coordinator.generation(); RequestFuture<ByteBuffer> future = coordinator.sendJoinGroupRequest(); final AbstractCoordinator.Generation newGen = new AbstractCoordinator.Generation( currGen.generationId, currGen.memberId + "-new", currGen.protocolName); coordinator.setNewGeneration(newGen); mockClient.prepareResponse(joinGroupFollowerResponse(generation + 1, memberId, JoinGroupRequest.UNKNOWN_MEMBER_ID, Errors.UNKNOWN_MEMBER_ID)); assertTrue(consumerClient.poll(future, mockTime.timer(REQUEST_TIMEOUT_MS))); assertTrue(future.exception().getClass().isInstance(Errors.UNKNOWN_MEMBER_ID.exception())); assertEquals(newGen, coordinator.generation()); }</code><technical_language>extract group setup logics coordinator.ensureActiveGroup();, redundant repeat a couple of times</technical_language>

Target:
public void testJoinGroupUnknownMemberResponseWithOldGeneration() throws InterruptedException { setupCoordinator(); joinGroup(); final AbstractCoordinator.Generation currGen = coordinator.generation(); RequestFuture<ByteBuffer> future = coordinator.sendJoinGroupRequest(); TestUtils.waitForCondition(() -> !mockClient.requests().isEmpty(), 2000, "The join-group request was not sent"); final AbstractCoordinator.Generation newGen = new AbstractCoordinator.Generation( currGen.generationId, currGen.memberId + "-new", currGen.protocolName); coordinator.setNewGeneration(newGen); mockClient.respond(joinGroupFollowerResponse(currGen.generationId + 1, memberId, JoinGroupRequest.UNKNOWN_MEMBER_ID, Errors.UNKNOWN_MEMBER_ID)); assertTrue(consumerClient.poll(future, mockTime.timer(REQUEST_TIMEOUT_MS))); assertTrue(future.exception().getClass().isInstance(Errors.UNKNOWN_MEMBER_ID.exception())); assertEquals(newGen, coordinator.generation()); }
Source:
<code><START> private void notifyLeaderLoss() { if (lastLeaderAddress != null || lastLeaderSessionID != null) { LOG.debug( "No leader information could be retrieved. Any listeners will be notified."); lastLeaderAddress = null; lastLeaderSessionID = null; leaderListener.notifyLeaderAddress(null, null); } } <END></code><technical_language>This method is duplicating logic is contained in ZooKeeperLeaderRetrievalService.nodeChanged. I suggest factor out a method notifyIfNewLeaderAddress(String newLeaderAddress, UUID newLeaderSessionID). notifyLeaderLoss call this method notifyIfNewLeaderAddress(null, null)</technical_language>

Target:
private void notifyLeaderLoss() { notifyIfNewLeaderAddress(null, null); }
Source:
<code>protected boolean syncClock() throws KuraException { boolean ret = false; try { int ntpTimeout = this.ntpTimeout / 1000; Command command = new Command("ntpdate -t " + ntpTimeout + " " + this.ntpHost); command.setTimeout(60); CommandStatus status = this.executorService.execute(command); <START> if ((Integer) status.getExitStatus().getExitValue() == 0) { <END> logger.info("System Clock Synchronized with {}", this.ntpHost); this.lastSync = new Date(); this.listener.onClockUpdate(0); ret = true; } else { logger.warn( "Error while synchronizing System Clock with NTP host {}. Please verify network connectivity ...", this.ntpHost); } } catch (Exception e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } return ret; }</code><technical_language>do need cast Integer</technical_language>

Target:
protected boolean syncClock() throws KuraException { boolean ret = false; try { int ntpTimeout = this.ntpTimeout / 1000; Command command = new Command(new String[] { "ntpdate", "-t", Integer.toString(ntpTimeout), this.ntpHost }); command.setTimeout(60); CommandStatus status = this.executorService.execute(command); if ((Integer) status.getExitStatus().getExitValue() == 0) { logger.info("System Clock Synchronized with {}", this.ntpHost); this.lastSync = new Date(); this.listener.onClockUpdate(0); ret = true; } else { logger.warn( "Error while synchronizing System Clock with NTP host {}. Please verify network connectivity ...", this.ntpHost); } } catch (Exception e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } return ret; }
Source:
<code>public String toString() { StringBuilder str = new StringBuilder(); <START> Iterator<RemoteConnectionEndpointLookupFailure> iterator = lookupFailures.iterator(); <END> while (iterator.hasNext()) { str.append("\n" + iterator.next().toString()); } return str.toString(); }</code><technical_language>This StringUtils.appendTo(Collection, String, StringBuilder), StringUtils.appendto(Collection, StringBuilder). is atypical '\n' delimiter. if '\n' delimiter, resulting String end '\n' (but please '\n' delimiter in toString()</technical_language>

Target:
public String toString() { StringBuilder str = new StringBuilder(); StringUtils.appendTo(lookupFailures, str); return str.toString(); }
Source:
<code>public void testValidSingleQuotedQuerySpecificChars() { String query = "repository: 'releases#1'"; AqlQueryParser aqlParser = new AqlQueryParser(query); <START> Map<Pair<Integer, Integer>, String> errorMap = null; <END> aqlParser.parseQuery(); logger.info(String.format("Query [%s] parse tree:\n[%s]", query, aqlParser)); assertFalse(aqlParser.hasErrors()); }</code><technical_language>@timur27 please completely remove this errorMap variable requested thanks :)</technical_language>

Target:
public void testValidSingleQuotedQuerySpecificChars() { String query = "repository: 'releases#1'"; AqlQueryParser aqlParser = new AqlQueryParser(query); aqlParser.parseQuery(); logger.info(String.format("Query [%s] parse tree:\n[%s]", query, aqlParser)); assertFalse(aqlParser.hasErrors()); }
Source:
<code>public Iterator<Path> iterator() { HashSet<Path> sourceFiles = new HashSet<>(); for (Path srcFile : rawSrcFiles) { <START> if (filterSteps.get(srcFile.getParent()).getSourceFiles().contains(srcFile)) { <END> sourceFiles.add(srcFile); } } sourceFiles.addAll(extraSrcFiles); return sourceFiles.iterator(); }</code><technical_language>add a check filterSteps.get return a null? this: Preconditions.checkNotNull(filterSteps.get()) code analysis check is complaining</technical_language>

Target:
public Iterator<Path> iterator() { HashSet<Path> sourceFiles = new HashSet<>(); for (Path srcFile : rawSrcFiles) { GoListStep step = filterSteps.get(srcFile.getParent()); Preconditions.checkNotNull(step, "No GoListStep is found for " + srcFile.toString()); if (step.getSourceFiles().contains(srcFile)) { sourceFiles.add(srcFile); } } sourceFiles.addAll(extraSrcFiles); return sourceFiles.iterator(); }
Source:
<code>public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = convertView; if (rowView == null) { rowView = inflater.inflate(mResourceId, parent, false); ViewHolder viewHolder = new ViewHolder(rowView); rowView.setTag(viewHolder); } ViewHolder viewHolder = (ViewHolder) rowView.getTag(); CategoryNode node = getItem(position); if (node != null) { viewHolder.mCategoryRowText.setText(StringEscapeUtils.unescapeHtml4(node.getName())); ViewCompat.setPaddingRelative(viewHolder.mCategoryRowText, <START> DisplayUtils.dpToPx(getContext(), 16) * node.getLevel(), 0, DisplayUtils.dpToPx(getContext(), 16), 0); <END> } return rowView; }</code><technical_language>changes necessary related this pull request. revert them</technical_language>

Target:
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = convertView; if (rowView == null) { rowView = inflater.inflate(mResourceId, parent, false); ViewHolder viewHolder = new ViewHolder(rowView); rowView.setTag(viewHolder); } ViewHolder viewHolder = (ViewHolder) rowView.getTag(); CategoryNode node = getItem(position); if (node != null) { viewHolder.mCategoryRowText.setText(StringEscapeUtils.unescapeHtml4(node.getName())); if (node.getLevel() > 1) { ViewCompat.setPaddingRelative(viewHolder.mCategoryRowLayout, getContext().getResources().getDimensionPixelSize(R.dimen.margin_medium) * node.getLevel(), 0, 0, 0); } } return rowView; }
Source:
<code>private Runnable createPoller() throws Exception { <START> List<Advice> receiveOnlyAdviceChain = new ArrayList<>(); <END> if (!CollectionUtils.isEmpty(this.adviceChain)) { receiveOnlyAdviceChain.addAll(this.adviceChain.stream() .filter(this::isReceiveOnlyAdvice) .collect(Collectors.toList())); } Callable<Boolean> pollingTask = this::doPoll; List<Advice> adviceChain = this.adviceChain; if (!CollectionUtils.isEmpty(adviceChain)) { ProxyFactory proxyFactory = new ProxyFactory(pollingTask); if (!CollectionUtils.isEmpty(adviceChain)) { adviceChain.stream() .filter(advice -> !isReceiveOnlyAdvice(advice)) .forEach(proxyFactory::addAdvice); } pollingTask = (Callable<Boolean>) proxyFactory.getProxy(this.beanClassLoader); } if (receiveOnlyAdviceChain.size() > 0) { applyReceiveOnlyAdviceChain(receiveOnlyAdviceChain); } return new Poller(pollingTask); }</code><technical_language>.. = null assign result of collect() add else clause set ArrayList<>()</technical_language>

Target:
private Runnable createPoller() throws Exception { List<Advice> receiveOnlyAdviceChain = null; if (!CollectionUtils.isEmpty(this.adviceChain)) { receiveOnlyAdviceChain = this.adviceChain.stream() .filter(this::isReceiveOnlyAdvice) .collect(Collectors.toList()); } Callable<Boolean> pollingTask = this::doPoll; List<Advice> adviceChain = this.adviceChain; if (!CollectionUtils.isEmpty(adviceChain)) { ProxyFactory proxyFactory = new ProxyFactory(pollingTask); if (!CollectionUtils.isEmpty(adviceChain)) { adviceChain.stream() .filter(advice -> !isReceiveOnlyAdvice(advice)) .forEach(proxyFactory::addAdvice); } pollingTask = (Callable<Boolean>) proxyFactory.getProxy(this.beanClassLoader); } if (receiveOnlyAdviceChain != null) { applyReceiveOnlyAdviceChain(receiveOnlyAdviceChain); } return new Poller(pollingTask); }
Source:
<code>public AggregationPolicy<TrapInformationWrapper, TrapLogDTO, TrapLogDTO> getAggregationPolicy() { return new AggregationPolicy<TrapInformationWrapper, TrapLogDTO, TrapLogDTO>() { @Override public int getCompletionSize() { return config.getBatchSize(); } @Override public int getCompletionIntervalMs() { return config.getBatchIntervalMs(); } @Override public Object key(TrapInformationWrapper message) { if (message.getTrapInformation() != null) { return message.getTrapInformation().getTrapAddress(); } else { <START> return message.getTrapDTO().getTrapAddress(); <END> } } @Override public TrapLogDTO aggregate(TrapLogDTO accumulator, TrapInformationWrapper newMessage) { final TrapInformation trapInfo = newMessage.getTrapInformation(); TrapDTO trapDTO; if(trapInfo != null) { trapDTO = transformTrapInfo(trapInfo); } else { trapDTO = newMessage.getTrapDTO(); } if (accumulator == null) { accumulator = new TrapLogDTO(distPoller.getId(), distPoller.getLocation(), trapDTO.getTrapAddress()); } accumulator.addMessage(trapDTO); return accumulator; } @Override public TrapLogDTO build(TrapLogDTO accumulator) { return accumulator; } }; }</code><technical_language>call message.getTrapAddress() instead, hide this logic in TrapInformationWrapper itself</technical_language>

Target:
public AggregationPolicy<TrapInformationWrapper, TrapLogDTO, TrapLogDTO> getAggregationPolicy() { return new AggregationPolicy<TrapInformationWrapper, TrapLogDTO, TrapLogDTO>() { @Override public int getCompletionSize() { return config.getBatchSize(); } @Override public int getCompletionIntervalMs() { return config.getBatchIntervalMs(); } @Override public Object key(TrapInformationWrapper message) { return message.getTrapAddress(); } @Override public TrapLogDTO aggregate(TrapLogDTO accumulator, TrapInformationWrapper newMessage) { final TrapInformation trapInfo = newMessage.getTrapInformation(); TrapDTO trapDTO; InetAddress trapAddress; if(trapInfo != null) { trapDTO = transformTrapInfo(trapInfo); trapAddress = TrapUtils.getEffectiveTrapAddress(trapInfo, config.shouldUseAddressFromVarbind()); } else { trapDTO = newMessage.getTrapDTO(); trapAddress = newMessage.getTrapAddress(); } if (accumulator == null) { accumulator = new TrapLogDTO(distPoller.getId(), distPoller.getLocation(), trapAddress); } accumulator.addMessage(trapDTO); return accumulator; } @Override public TrapLogDTO build(TrapLogDTO accumulator) { return accumulator; } }; }
Source:
<code>public void testPatch() throws IOException, InterruptedException { <START> thrown.expectCause(isA(ProtocolException.class)); <END> TestInterface api = Feign.builder().target(TestInterface.class, "http://localhost:" + server.getPort()); api.patch("foo"); }</code><technical_language>please thrown.. ex. thrown.expect(ProtocolException.class); super.testPatch();</technical_language>

Target:
public void testPatch() throws Exception { thrown.expect(RetryableException.class); thrown.expectCause(isA(ProtocolException.class)); super.testPatch(); }
Source:
<code>public void loadRemoteStartPage() { assert !bootconfig.isLocal(); String startPage = bootconfig.getStartPage(); Log.i("SalesforceDroidGapActivity.loadRemoteStartPage", "loading: " + startPage); <START> refresh(startPage); <END> webAppLoaded = true; }</code><technical_language>is this case triggering SalesforceGapViewClient.shouldOverrideUrlLoading(), handle this redirect scenario</technical_language>

Target:
public void loadRemoteStartPage() { assert !bootconfig.isLocal(); String startPage = bootconfig.getStartPage(); Log.i("SalesforceDroidGapActivity.loadRemoteStartPage", "loading: " + startPage); String url = getFrontDoorUrl(startPage); loadUrl(url); webAppLoaded = true; }
Source:
<code>public Alert(PrincipalUser creator, PrincipalUser owner, String name, String expression, String cronEntry) { super(creator); setOwner(owner); setName(name); setExpression(expression); setCronEntry(cronEntry); setEnabled(false); <START> setMissingDataNotificationEnabled(false); <END> }</code><technical_language>want set setShared(false)</technical_language>

Target:
public Alert(PrincipalUser creator, PrincipalUser owner, String name, String expression, String cronEntry) { super(creator); setOwner(owner); setName(name); setExpression(expression); setCronEntry(cronEntry); setEnabled(false); setMissingDataNotificationEnabled(false); setShared(false); }
Source:
<code>public void testGetThemeStyleSheet() { assertEquals("User portal style sheet: 'user_portal.css'", "user_portal.css", testTheme.getThemeStylesheets("userportal").get(0)); <START> assertEquals("User portal style sheet: 'user_portal.css'", "abc.css", END> testTheme.getThemeStylesheets("userportal").get(1)); assertEquals("Wedadmin style sheet: 'web_admin.css'", "web_admin.css", testTheme.getThemeStylesheets("webadmin").get(0)); assertEquals("Wedadmin style sheet: 'web_admin.css'", "123.css", testTheme.getThemeStylesheets("webadmin").get(1)); }</code><technical_language>failure message be: "User portal style sheet: 'abc.css'"</technical_language>

Target:
public void testGetThemeStyleSheet() { assertEquals("User portal style sheet: 'user_portal.css'", "user_portal.css", testTheme.getThemeStylesheets("userportal").get(0)); assertEquals("User portal style sheet: 'abc.css'", "abc.css", testTheme.getThemeStylesheets("userportal").get(1)); assertEquals("Wedadmin style sheet: 'web_admin.css'", "web_admin.css", testTheme.getThemeStylesheets("webadmin").get(0)); assertEquals("Wedadmin style sheet: '123.css'", "123.css", testTheme.getThemeStylesheets("webadmin").get(1)); }
Source:
<code>public String getWelcomePageUrl() throws GetWelcomePageURLException { String welcomePageUrl = null; Connection connection = OpenShiftServerUtils.getConnection(server); if(connection == null || !connection.connect()) { throw new GetWelcomePageURLException("Connection is not established."); } IService service = OpenShiftServerUtils.getService(server, connection); if(service == null) { throw new GetWelcomePageURLException("Service is missing."); } <START> IProject project = service.getProject(); <END> if (project != null) { List<IRoute> routes = project.getResources(ResourceKind.ROUTE); IRoute route = getRoute(routes); if (route != null) { welcomePageUrl = route.getURL(); } } else { throw new GetWelcomePageURLException("Project is missing."); } return welcomePageUrl; }</code><technical_language>specific pull, is need get a project get routes. accomplish this call connection retrieving required project information service#getNamespace(). This additionally saves a REST call load project resource, remove throw null project together</technical_language>

Target:
public String getWelcomePageUrl() throws GetWelcomePageURLException { String welcomePageUrl = null; try { Connection connection = OpenShiftServerUtils.getConnection(server); if(connection == null || !connection.connect()) { throw new GetWelcomePageURLException("Connection is not established."); } IService service = OpenShiftServerUtils.getService(server, connection); if(service == null) { throw new GetWelcomePageURLException("Service is missing."); } IProject project = service.getProject(); if (project != null) { List<IRoute> routes = project.getResources(ResourceKind.ROUTE); IRoute route = getRoute(OpenShiftServerUtils.getRouteURL(server), routes); if (route == null) { route = getRoute(routes); } if (route != null) { welcomePageUrl = route.getURL(); } } } catch (OpenShiftException e) { throw new GetWelcomePageURLException(e.getMessage(), e); } return welcomePageUrl; }
Source:
<code>public void setUp() throws URISyntaxException { testObj = new Transactions(); mockTransaction.setShortLived(false); when(mockTxManager.create()).thenReturn(mockTransaction); when(mockTxManager.get(VALID_TX_ID)).thenReturn(mockTransaction); when(mockTxManager.get(AdditionalMatchers.not(ArgumentMatchers.eq(VALID_TX_ID)))) .thenThrow(new TransactionNotFoundException("No Transaction found with transactionId")); when(mockTransaction.getId()).thenReturn("123"); when(mockTransaction.getExpires()).thenReturn(now().plusSeconds(100)); <START> when(mockUriInfo.getBaseUri()).thenReturn(new URI("http://localhost/rest")); <END> setField(testObj, "txManager", mockTxManager); setField(testObj, "uriInfo", mockUriInfo); }</code><technical_language>URI.create() - need throws clause. above. a suggestion</technical_language>

Target:
public void setUp() { testObj = new Transactions(); mockTransaction.setShortLived(false); when(mockTxManager.create()).thenReturn(mockTransaction); when(mockTxManager.get(VALID_TX_ID)).thenReturn(mockTransaction); when(mockTxManager.get(AdditionalMatchers.not(ArgumentMatchers.eq(VALID_TX_ID)))) .thenThrow(new TransactionNotFoundException("No Transaction found with transactionId")); when(mockTransaction.getId()).thenReturn("123"); when(mockTransaction.getExpires()).thenReturn(now().plusSeconds(100)); when(mockUriInfo.getBaseUri()).thenReturn(URI.create("http://localhost/rest")); setField(testObj, "txManager", mockTxManager); setField(testObj, "uriInfo", mockUriInfo); }
Source:
<code>public String maskSensitiveElements( final Message message, final String originalLogString) { <START> if (replacementsXML.isEmpty() && replacementsJSON.isEmpty() <END> || originalLogString == null) { return originalLogString; } final Optional<String> contentType = Optional.ofNullable(message) .map(m -> (String) m.get(Message.CONTENT_TYPE)); if (!contentType.isPresent()) { return originalLogString; } final String lowerCaseContentType = contentType.get().toLowerCase(); if (lowerCaseContentType.contains(XML_CONTENT) || lowerCaseContentType.contains(HTML_CONTENT)) { return applyMasks(originalLogString, replacementsXML); } else if (lowerCaseContentType.contains(JSON_CONTENT)) { return applyMasks(originalLogString, replacementsJSON); } return originalLogString; }</code><technical_language>this condition removed? is returned line <LINK_0> unnecessary of Optional::ofNullable(message)</technical_language>

Target:
public String maskSensitiveElements( final Message message, final String originalLogString) { if (replacementsXML.isEmpty() && replacementsJSON.isEmpty() || originalLogString == null || message == null) { return originalLogString; } final String contentType = (String) message.get(Message.CONTENT_TYPE); if (contentType == null) { return originalLogString; } final String lowerCaseContentType = contentType.toLowerCase(); if (lowerCaseContentType.contains(XML_CONTENT) || lowerCaseContentType.contains(HTML_CONTENT)) { return applyMasks(originalLogString, replacementsXML); } else if (lowerCaseContentType.contains(JSON_CONTENT)) { return applyMasks(originalLogString, replacementsJSON); } return originalLogString; }
Source:
<code>public void executeVmCommand() { addAuditLogForPartialVMs(); super.executeVmCommand(); if (getSucceeded()) { if (isImagesAlreadyOnTarget()) { <START> for (DiskImage diskImage : getImages()) { initQcowVersionForDisks(diskImage.getId()); } <END> unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); auditLogDirector.log(this, AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY); } else if (!vmDisksToAttach.isEmpty()) { auditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } } setActionReturnValue(getVm().getId()); }</code><technical_language>forEach</technical_language>

Target:
public void executeVmCommand() { addAuditLogForPartialVMs(); super.executeVmCommand(); if (getSucceeded()) { if (isImagesAlreadyOnTarget()) { getImages().stream().forEach(diskImage -> { initQcowVersionForDisks(diskImage.getId()); }); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); auditLogDirector.log(this, AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY); } else if (!vmDisksToAttach.isEmpty()) { auditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } } setActionReturnValue(getVm().getId()); }
Source:
<code>public void testNoEntryInL1PutReplacedNullValueConcurrently() throws InterruptedException, ExecutionException, TimeoutException { final Cache<Object, String> nonOwnerCache = getFirstNonOwner(key); final Cache<Object, String> ownerCache = getFirstOwner(key); RpcManager rm = TestingUtil.extractComponent(nonOwnerCache, RpcManager.class); ControlledRpcManager crm = new ControlledRpcManager(rm); crm.blockAfter(PutKeyValueCommand.class); TestingUtil.replaceComponent(nonOwnerCache, RpcManager.class, crm, true); try { Future<String> future = nonOwnerCache.putIfAbsentAsync(key, firstValue); <START> crm.waitForCommandToBlock(1, TimeUnit.SECONDS); <END> assertEquals(firstValue, ownerCache.remove(key)); asyncWait(key, RemoveCommand.class, ownerCache); crm.stopBlocking(); assertNull(future.get(1, TimeUnit.SECONDS)); removeAllBlockingInterceptorsFromCache(nonOwnerCache); assertIsNotInL1(nonOwnerCache, key); assertNull(nonOwnerCache.get(key)); assertIsNotInL1(nonOwnerCache, key); } finally { TestingUtil.replaceComponent(nonOwnerCache, RpcManager.class, rm, true); } }</code><technical_language>timeout small CI machine</technical_language>

Target:
public void testNoEntryInL1PutReplacedNullValueConcurrently() throws InterruptedException, ExecutionException, TimeoutException { final Cache<Object, String> nonOwnerCache = getFirstNonOwner(key); final Cache<Object, String> ownerCache = getFirstOwner(key); RpcManager rm = TestingUtil.extractComponent(nonOwnerCache, RpcManager.class); ControlledRpcManager crm = new ControlledRpcManager(rm); crm.blockAfter(PutKeyValueCommand.class); TestingUtil.replaceComponent(nonOwnerCache, RpcManager.class, crm, true); try { Future<String> future = nonOwnerCache.putIfAbsentAsync(key, firstValue); crm.waitForCommandToBlock(5, TimeUnit.SECONDS); assertEquals(firstValue, ownerCache.remove(key)); crm.stopBlocking(); assertNull(future.get(5, TimeUnit.SECONDS)); removeAllBlockingInterceptorsFromCache(nonOwnerCache); assertIsNotInL1(nonOwnerCache, key); assertNull(nonOwnerCache.get(key)); assertIsNotInL1(nonOwnerCache, key); } finally { TestingUtil.replaceComponent(nonOwnerCache, RpcManager.class, rm, true); } }
Source:
<code>public static boolean getBooleanForKey(Map<String, String> map, String key) { String value = map.get(key); <START> return ("true".equals(value) || "yes".equals(value) || "1".equals(value)); <END> }</code><technical_language>do values "true", "yes" "1" equal true</technical_language>

Target:
public static boolean getBooleanForKey(Map<String, String> map, String key) { String value = map.get(key); return ("true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value) || "1".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value)); }
Source:
<code>private List<Map<String, List<String>>> executeVarQuery(Map<String, Object> vars, String varName) throws LDAPException { List<Map<String, List<String>>> ret = new ArrayList<>(); List<String> queryVars = new ArrayList<>(); for (String var : vars.keySet()) { if (var.startsWith(varName)) { queryVars.add(var); } } if (queryVars.size() > 0) { try { ExecutorService executor = Executors.newFixedThreadPool(queryVars.size()); List<Future<List<Map<String, List<String>>>>> list = new ArrayList<>(); for (String var : queryVars) { log.debug("Resolving query var '{}'", var); Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { Callable<List<Map<String, List<String>>>> searchExecute = framework.new SearchExecute(instance, 0); Future<List<Map<String, List<String>>>> submit = executor.submit(searchExecute); list.add(submit); } } for (Future<List<Map<String, List<String>>>> future : list) { try { ret.addAll(future.get()); } catch (InterruptedException | ExecutionException e) { log.error("Failed to execute search: {}", e.getMessage()); <START> log.debug("Exception", e); <END> throw new RuntimeException(e); } } executor.shutdown(); } finally { for (String var : queryVars) { Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { vars.remove(var); try { framework.searchClose(instance); } catch (Exception e) { log.error("Cannot close search of var '{}'", var); log.debug("Cannot close search of var '{}', search: {}", var, instance); log.debug("Exception", e); } } } } } return ret; }</code><technical_language>I need log throw RuntimeException original exception included in</technical_language>

Target:
private List<Map<String, List<String>>> executeVarQuery(Map<String, Object> vars, String varName) throws LDAPException { List<Map<String, List<String>>> ret = new ArrayList<>(); List<String> queryVars = new ArrayList<>(); for (String var : vars.keySet()) { if (var.startsWith(varName)) { queryVars.add(var); } } if (queryVars.size() > 0) { try { ExecutorService executor = Executors.newFixedThreadPool(queryVars.size()); List<Future<List<Map<String, List<String>>>>> list = new ArrayList<>(); for (String var : queryVars) { log.debug("Resolving query var '{}'", var); Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { Callable<List<Map<String, List<String>>>> searchExecute = framework.new SearchExecute(instance, 0); Future<List<Map<String, List<String>>>> submit = executor.submit(searchExecute); list.add(submit); } } for (Future<List<Map<String, List<String>>>> future : list) { try { ret.addAll(future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } executor.shutdown(); } finally { for (String var : queryVars) { Framework.SearchInstance instance = (Framework.SearchInstance) vars.get(var); if (instance != null) { vars.remove(var); try { framework.searchClose(instance); } catch (Exception e) { log.error("Cannot close search of var '{}': {}", var, e.getMessage()); log.debug("Search: {}", instance); log.debug("Exception", e); } } } } } return ret; }
Source:
<code>public List<URI> getDependencies(URI uri) { Set<URI> dependencies = new LinkedHashSet<URI>(); for (String fileExtension : fileExtensions) { URI dependencyURI = uri.trimFileExtension().appendFileExtension(fileExtension); <START> if (URIConverter.INSTANCE.exists(dependencyURI, null)) { <END> dependencies.add(dependencyURI); } } return new ArrayList<URI>(dependencies); }</code><technical_language>want rely URIConverter's "exists" test. URI exist locally, exist remote side</technical_language>

Target:
public Set<URI> getDependencies(URI uri) { final Set<URI> dependencies = new LinkedHashSet<URI>(); for (String fileExtension : fileExtensions) { URI dependencyURI = uri.trimFileExtension().appendFileExtension(fileExtension); if (URIConverter.INSTANCE.exists(dependencyURI, null)) { dependencies.add(dependencyURI); } } return dependencies; }
Source:
<code>public void appendStepEnd() { CommandAction[] aA = new CommandAction[commandInProgress.size()]; aA = commandInProgress.toArray( aA ); SolutionCommand newCmd = new SolutionCommand( aA ); int prevCmdIndex = solutionInProgress.size() - 1; SolutionCommand prevCmd = prevCmdIndex >= 0 ? solutionInProgress.get( prevCmdIndex ) : null ; SolutionCommand combCmd = SolutionCommand.tryToSimplify( prevCmd, newCmd ); if( null == combCmd) { solutionInProgress.add( newCmd ); } else { solutionInProgress.set( prevCmdIndex, combCmd ); } commandInProgress = new ArrayList<CommandAction>(); <START> } <END></code><technical_language>Is similar logic in InputHandler combined</technical_language>

Target:
public void appendStepEnd() { CommandAction[] aA = new CommandAction[commandInProgress.size()]; aA = commandInProgress.toArray( aA ); append( new SolutionCommand( aA ) ); commandInProgress = new ArrayList<CommandAction>(); }
Source:
<code>VolcanoRuleMatch popMatch(VolcanoPlannerPhase phase) { dumpPlannerState(); PhaseMatchList phaseMatchList = matchListMap.get(phase); if (phaseMatchList == null) { throw new AssertionError("Used match list for phase " + phase + " after phase complete"); } VolcanoRuleMatch match; for (;;) { if (phaseMatchList.size() == 0) { return null; } dumpRuleQueue(phaseMatchList); match = phaseMatchList.poll(); if (skipMatch(match)) { LOGGER.trace("Skip match: {}", match); } else { break; } } phaseMatchList.matchMap.remove( planner.getSubset(match.rels[0]), match); LOGGER.trace("Pop match: {}", match); <START> return match; <END> }</code><technical_language>strong reason switch DEBUG TRACE</technical_language>

Target:
VolcanoRuleMatch popMatch(VolcanoPlannerPhase phase) { dumpPlannerState(); PhaseMatchList phaseMatchList = matchListMap.get(phase); if (phaseMatchList == null) { throw new AssertionError("Used match list for phase " + phase + " after phase complete"); } VolcanoRuleMatch match; for (;;) { if (phaseMatchList.size() == 0) { return null; } dumpRuleQueue(phaseMatchList); match = phaseMatchList.poll(); if (skipMatch(match)) { LOGGER.debug("Skip match: {}", match); } else { break; } } phaseMatchList.matchMap.remove( planner.getSubset(match.rels[0]), match); LOGGER.debug("Pop match: {}", match); return match; }
Source:
<code>public void shouldConstructANewEntity() { ChargeEntity chargeEntity = aValidChargeEntity().build(); Long amount = 100L; RefundEntity refundEntity = new RefundEntity(chargeEntity, amount, userExternalId); refundEntity.setStatus(CREATED); assertNotNull(refundEntity.getExternalId()); assertThat(refundEntity.getChargeEntity(), is(chargeEntity)); assertThat(refundEntity.getReference(), is(nullValue())); assertThat(refundEntity.getAmount(), is(amount)); <START> assertThat(refundEntity.getStatus(), is(CREATED)); <END> assertThat(refundEntity.getUserExternalId(), is(userExternalId)); assertNotNull(refundEntity.getCreatedDate()); }</code><technical_language>is benefit asserting this is created set in test itself? Potentially this assertion a test for createRefundEntity created entity transitions status CREATED</technical_language>

Target:
public void shouldConstructANewEntity() { ChargeEntity chargeEntity = aValidChargeEntity().build(); Long amount = 100L; RefundEntity refundEntity = new RefundEntity(chargeEntity, amount, userExternalId); assertNotNull(refundEntity.getExternalId()); assertThat(refundEntity.getChargeEntity(), is(chargeEntity)); assertThat(refundEntity.getReference(), is(nullValue())); assertThat(refundEntity.getAmount(), is(amount)); assertThat(refundEntity.getUserExternalId(), is(userExternalId)); assertNotNull(refundEntity.getCreatedDate()); }
Source:
<code>private void initializePermission(Workflow workflow, User user) { ResourcesApi resourcesApi = getResourcesApi(user); String encodedPath = encodedWorkflowResource(workflow, resourcesApi.getApiClient()); try { resourcesApi.createResourceWithDefaults(SamConstants.RESOURCE_TYPE, encodedPath); addPolicy(resourcesApi, encodedPath, SamConstants.WRITE_POLICY); addPolicy(resourcesApi, encodedPath, SamConstants.READ_POLICY); } catch (ApiException e) { if (e.getCode() == HttpStatus.SC_CONFLICT) { <START> handleConflict(encodedPath); <END> } else { throw new CustomWebApplicationException("Error initializing permissions", e.getCode()); } } }</code><technical_language>clear me, is a conflict: 1) A user re-requesting initialization of permissions (i.e. foo@gmail.com initialized permissions, foo@gmail.com self-destructed, foo@gmail.com re-created wants re-initialize) 2) A user requesting initialization of permissions another user previously initialized (foo@gmail.com is initialize goop@gmail.com it) both? more point, this re-initialize ignore correctly in 1) show message for 2) both</technical_language>

Target:
private void initializePermission(Workflow workflow, User user) { ResourcesApi resourcesApi = getResourcesApi(user); String encodedPath = encodedWorkflowResource(workflow, resourcesApi.getApiClient()); try { resourcesApi.createResourceWithDefaults(SamConstants.RESOURCE_TYPE, encodedPath); addPolicy(resourcesApi, encodedPath, SamConstants.WRITE_POLICY); addPolicy(resourcesApi, encodedPath, SamConstants.READ_POLICY); } catch (ApiException e) { if (e.getCode() == HttpStatus.SC_CONFLICT) { final String message = MessageFormat.format( "An unexpected error occurred. Please send a private message to \"admins\" at <LINK_0> and mention \"SAM {0}\"", encodedPath); throw new CustomWebApplicationException(message, HttpStatus.SC_CONFLICT); } else { throw new CustomWebApplicationException("Error initializing permissions", e.getCode()); } } }
Source:
<code>private void sendToSocket(byte[] chunk) { DatagramPacket packet = new DatagramPacket(chunk, chunk.length, address, port); try { <START> log.debug("Sending to UDP port {}", chunk, port); <END> socket.send(packet); } catch (IOException e) { socket.close(); openSocket(); } }</code><technical_language>this is potentially verbose. trace instead</technical_language>

Target:
private void sendToSocket(byte[] chunk) { DatagramPacket packet = new DatagramPacket(chunk, chunk.length, address, port); try { log.trace("Sending to UDP port {}", chunk, port); socket.send(packet); } catch (IOException e) { log.error("Error sending packet!", e); socket.close(); openSocket(); } }
Source:
<code>public void randomField() { <START> for (int i = 0; i < width; i++) for (int j = 0; j < height; j++) { currentGeneration[i][j] = (int) (Math.random() * 2) == 0 ? (byte) 1 : (byte) 0; } <END> }</code><technical_language>braces</technical_language>

Target:
public void randomField() { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { currentGeneration[i][j] = (int) (Math.random() * 2) == 0 ? (byte) 1 : (byte) 0; } } }
Source:
<code>public void testRecordSubmoduleLabels() throws Exception { try ( Repository remoteDb = createBareRepository(); Repository tempDb = createWorkRepository()) { StringBuilder xmlContent = new StringBuilder(); xmlContent .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"test\" ") .append("revision=\"master\" ") .append("name=\"").append(notDefaultUri).append("\" ") .append("groups=\"a1,a2\" />") .append("</manifest>"); JGitTestUtil.writeTrashFile(tempDb, "manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(remoteDb); command.setPath(tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(rootUri) .setRecordSubmoduleLabels(true) .call(); File directory = createTempDirectory("testBareRepo"); try (Repository localDb = Git.cloneRepository() .setDirectory(directory) .setURI(remoteDb.getDirectory().toURI().toString()).call() .getRepository();) { File gitattributes = new File(localDb.getWorkTree(), ".gitattributes"); assertTrue("The .gitattributes file should exist", gitattributes.exists()); <START> BufferedReader reader = new BufferedReader( <END> new FileReader(gitattributes)); String content = reader.readLine(); reader.close(); assertEquals(".gitattributes content should be as expected", "/test a1 a2", content); } } }</code><technical_language>try-with-resources for BufferedReader too</technical_language>

Target:
public void testRecordSubmoduleLabels() throws Exception { try ( Repository remoteDb = createBareRepository(); Repository tempDb = createWorkRepository()) { StringBuilder xmlContent = new StringBuilder(); xmlContent .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"test\" ") .append("revision=\"master\" ") .append("name=\"").append(notDefaultUri).append("\" ") .append("groups=\"a1,a2\" />") .append("</manifest>"); JGitTestUtil.writeTrashFile(tempDb, "manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(remoteDb); command.setPath(tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(rootUri) .setRecordSubmoduleLabels(true) .call(); File directory = createTempDirectory("testBareRepo"); try (Repository localDb = Git.cloneRepository() .setDirectory(directory) .setURI(remoteDb.getDirectory().toURI().toString()).call() .getRepository();) { File gitattributes = new File(localDb.getWorkTree(), ".gitattributes"); assertTrue("The .gitattributes file should exist", gitattributes.exists()); try (BufferedReader reader = new BufferedReader( new FileReader(gitattributes));) { String content = reader.readLine(); assertEquals(".gitattributes content should be as expected", "/test a1 a2", content); } } } }
Source:
<code>private void restart() { quit_.prepareForQuit( "Restarting RStudio", new QuitContext() { @Override public void onReadyToQuit(boolean saveChanges) { String project = session_.getSessionInfo().getActiveProjectFile(); if (project == null) project = Projects.NONE; events_.fireEvent(new OpenProjectNewWindowEvent(project, null)); <START> quit_.performQuit(null, saveChanges); <END> } }); }</code><technical_language>If reading this correctly, new instance of project opened *before* current is closed -- late commit changes in performQuit; new copy of RStudio consumed state. In addition of lose currently open tabs other per-session state, happen a manual restart. this is worth investing in settings touched a day-to-day basis, if want work I suspect need do Qt side</technical_language>

Target:
private void restart() { quit_.prepareForQuit( "Restarting RStudio", new QuitContext() { @Override public void onReadyToQuit(boolean saveChanges) { String project = session_.getSessionInfo().getActiveProjectFile(); if (project == null) project = Projects.NONE; final String finalProject = project; quit_.performQuit(null, saveChanges, () -> { events_.fireEvent(new OpenProjectNewWindowEvent(finalProject, null)); }); } }); }
Source:
<code>public void testTableTables() { createTablesWithRetry(dbi); long tableId = dao.insertTable("schema1", "table1", true, false, null, 0, false); <START> assertNotNull(tableId); <END> }</code><technical_language>long type null. assertGreaterThan(tableId, 0L);</technical_language>

Target:
public void testTableTables() { createTablesWithRetry(dbi); long tableId = dao.insertTable("schema1", "table1", true, false, null, 0, false); assertGreaterThan(tableId, 0L); }
Source:
<code>public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { PolicyUnitType policyUnitType = null; <START> switch (model.getType().toUpperCase()) { <END> case FILTER: policyUnitType = PolicyUnitType.FILTER; break; case WEIGHT: policyUnitType = PolicyUnitType.WEIGHT; break; case LOAD_BALANCING: policyUnitType = PolicyUnitType.LOAD_BALANCING; break; default: assert (false) : "unknown Policy Unit Type value: " + model.toString(); return null; } entity.setPolicyUnitType(policyUnitType); } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetPropertiesMetaData()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getPropertiesMetaData())); } return entity; }</code><technical_language>right thing, a bit simpler more consistent other 'mappers', please write methods, maps API enum Engine enum, maps Engine enum API enum. mappers full of examples of this, if need a reference</technical_language>

Target:
public static PolicyUnit map(SchedulingPolicyUnit model, PolicyUnit template) { PolicyUnit entity = template != null ? template : new PolicyUnit(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetType()) { entity.setPolicyUnitType(map(org.ovirt.engine.api.model.PolicyUnitType.valueOf(model.getType() .toUpperCase()), null)); } if (model.isSetEnabled()) { entity.setEnabled(model.isEnabled()); } if (model.isSetInternal()) { entity.setInternal(model.isInternal()); } if (model.isSetPropertiesMetaData()) { entity.setParameterRegExMap(CustomPropertiesParser.toMap(model.getPropertiesMetaData())); } return entity; }
Source:
<code>public void reduceHealth(Actor oreon, String cause) { OreonAttributeComponent oreonAttributeComponent = oreon.getComponent(OreonAttributeComponent.class); switch (cause) { case "hunger" : float lastHungerCheck = oreonAttributeComponent.lastHungerCheck; if (lastHungerCheck != 0 && time.getGameTime() - lastHungerCheck < MAX_DELAY) { return; } oreonAttributeComponent.health -= 10; <START> String message = "We are losing health due to hunger."; <END> delayedNotificationSystem.sendNotificationNow(message, notificationMessageEntity); oreonAttributeComponent.lastHungerCheck = time.getGameTime(); } oreon.save(oreonAttributeComponent); checkOreonHealth(oreon); }</code><technical_language>message state oreon is losing health? if "We hungry. Build a Diner!" is message style below</technical_language>

Target:
public void reduceHealth(Actor oreon, String cause) { OreonAttributeComponent oreonAttributeComponent = oreon.getComponent(OreonAttributeComponent.class); switch (cause) { case "hunger" : float lastHungerCheck = oreonAttributeComponent.lastHungerCheck; if (lastHungerCheck != 0 && time.getGameTime() - lastHungerCheck < MAX_DELAY) { return; } oreonAttributeComponent.health -= 10; String message = "We are losing health due to hunger."; DisplayNameComponent displayNameComponent = notificationMessageEntity.getComponent(DisplayNameComponent.class); displayNameComponent.name = oreon.getComponent(NameTagComponent.class).text; notificationMessageEntity.saveComponent(displayNameComponent); delayedNotificationSystem.sendNotificationNow(message, notificationMessageEntity); oreonAttributeComponent.lastHungerCheck = time.getGameTime(); } oreon.save(oreonAttributeComponent); checkOreonHealth(oreon); }
Source:
<code>public void undeleteShare() { ShareServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); ListSharesOptions listSharesOptions = new ListSharesOptions(); listSharesOptions.setIncludeDeleted(true); fileServiceAsyncClient.listShares(listSharesOptions).flatMap( deletedShare -> { Mono<ShareAsyncClient> shareAsyncClient = fileServiceAsyncClient.undeleteShare( deletedShare.getName(), deletedShare.getVersion()); return shareAsyncClient; } <START> ).then().block(); <END> END: com.azure.storage.file.share.ShareServiceAsyncClient.undeleteShare#String-String }</code><technical_language>need for .then(). suggestion ).block();</technical_language>

Target:
public void undeleteShare() { ShareServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); ListSharesOptions listSharesOptions = new ListSharesOptions(); listSharesOptions.setIncludeDeleted(true); fileServiceAsyncClient.listShares(listSharesOptions).flatMap( deletedShare -> { Mono<ShareAsyncClient> shareAsyncClient = fileServiceAsyncClient.undeleteShare( deletedShare.getName(), deletedShare.getVersion()); return shareAsyncClient; } ).blockFirst(); END: com.azure.storage.file.share.ShareServiceAsyncClient.undeleteShare#String-String }