auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<Attribute> getAttributes(PerunSession sess, Facility facility) throws InternalErrorException { List<Attribute> attributesCache = null; if(!CacheManager.isCacheDisabled() && !perun.getCacheManager().wasCacheUpdatedInTransaction()) { List<Attribute> attrs = perun.getCacheManager().getAllNonEmptyAttributes(new Holder(facility.getId(), Holder.HolderType.FACILITY)); attributesCache = this.setValuesOfAttributes(sess, attrs, facility, null); } try { List<Attribute> attributesDB = jdbc.query("select " + getAttributeMappingSelectQuery("fac") + " from attr_names " + "left join facility_attr_values fac on id=fac.attr_id and fac.facility_id=? " + "where namespace=? or (namespace in (?,?) and (attr_value is not null or attr_value_text is not null))", new SingleBeanAttributeRowMapper<>(sess, this, facility), facility.getId(), AttributesManager.NS_FACILITY_ATTR_CORE, AttributesManager.NS_FACILITY_ATTR_DEF, AttributesManager.NS_FACILITY_ATTR_OPT); <START> if (attributesCache != null) { <END> Collections.sort(attributesDB); Collections.sort(attributesCache); if (!attributesDB.equals(attributesCache)) { log.error("The attributes do not match, attributes from cache are: " + attributesCache + " while attributes from db are: " + attributesDB + " the attributes belong to " + facility); } } return attributesDB; } catch (EmptyResultDataAccessException ex) { log.debug("No attribute for facility exists."); return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }</code><technical_language>I this some private method. is repeated times. initialize attributesCache empty list, I looked, cache methods return empty list if is null. generally Objects.equals(a,b) care null in of variables</technical_language>

Target:
public List<Attribute> getAttributes(PerunSession sess, Facility facility) throws InternalErrorException { try { return jdbc.query("select " + getAttributeMappingSelectQuery("fac") + " from attr_names " + "left join facility_attr_values fac on id=fac.attr_id and fac.facility_id=? " + "where namespace=? or (namespace in (?,?) and (attr_value is not null or attr_value_text is not null))", new SingleBeanAttributeRowMapper<>(sess, this, facility), facility.getId(), AttributesManager.NS_FACILITY_ATTR_CORE, AttributesManager.NS_FACILITY_ATTR_DEF, AttributesManager.NS_FACILITY_ATTR_OPT); } catch (EmptyResultDataAccessException ex) { log.debug("No attribute for facility exists."); return new ArrayList<>(); } catch (RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
<code>private void validate() { if (format == null) { if (delimiter != null && delimiter != 0) { throw new IllegalArgumentException("Custom delimiter can only be used for format option 'Custom'."); } return; } if (!format.equalsIgnoreCase("DEFAULT") && !format.equalsIgnoreCase("EXCEL") && !format.equalsIgnoreCase("MYSQL") && !format.equalsIgnoreCase("RFC4180") && !format.equalsIgnoreCase("Tab Delimited") && !format.equalsIgnoreCase("Pipe Delimited") <START> && !format.equalsIgnoreCase("Custom") && !format.equalsIgnoreCase("PDL") && <END> !format.equalsIgnoreCase("TDF")) { throw new IllegalArgumentException(String.format("Format %s is not one of the allowed values. Allowed values " + "are DEFAULT, EXCEL, MYSQL, RFC4180, Pipe Delimited, Tab " + "Delimited or Custom", format)); } if (format.equalsIgnoreCase("Custom") && (delimiter == null || delimiter == 0)) { throw new IllegalArgumentException("Please specify the delimiter for format option 'Custom'."); } if (!format.equalsIgnoreCase("Custom") && delimiter != null && delimiter != 0) { throw new IllegalArgumentException("Custom delimiter can only be used for format option 'Custom'."); } }</code><technical_language>style nit: leading && end of previous line</technical_language>

Target:
private void validate() { if (!format.equalsIgnoreCase("DEFAULT") && !format.equalsIgnoreCase("EXCEL") && !format.equalsIgnoreCase("MYSQL") && !format.equalsIgnoreCase("RFC4180") && !format.equalsIgnoreCase("Tab Delimited") && !format.equalsIgnoreCase("Pipe Delimited") && !format.equalsIgnoreCase("Custom") && !format.equalsIgnoreCase("PDL") && !format.equalsIgnoreCase("TDF")) { throw new IllegalArgumentException(String.format("Format %s is not one of the allowed values. Allowed values " + "are %s", format, Joiner.on(", ").join(FORMATS))); } if (format.equalsIgnoreCase("Custom") && (delimiter == null || delimiter == 0)) { throw new IllegalArgumentException("Please specify the delimiter for format option 'Custom'."); } if (!format.equalsIgnoreCase("Custom") && delimiter != null && delimiter != 0) { throw new IllegalArgumentException("Custom delimiter can only be used for format option 'Custom'."); } }
Source:
<code>public void trendVisible(){ FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "simple-job"); job.configure(); <START> LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class); <END> lpp.setShowGraphs(true); lpp.setRule(LogParserPublisher.RuleType.GLOBAL, rules.get("sampleRule")); job.save(); job.startBuild().waitUntilFinished(); job.startBuild().waitUntilFinished(); job.open(); WebElement trend = driver.findElement(By.className("test-trend-caption")); assertThat(trend.getText(), containsString("Log Parser Trend")); WebElement img = driver.findElement(By.xpath(" assertThat(img.getAttribute("alt"), containsString("[Log Parser Chart]")); }</code><technical_language>Or: job.configure(() -> {lambda})</technical_language>

Target:
public void trendVisible(){ FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "simple-job"); job.configure(() -> { LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class); lpp.setShowGraphs(true); lpp.setRule(LogParserPublisher.RuleType.GLOBAL, rules.get("sampleRule")); }); job.startBuild().waitUntilFinished(); job.startBuild().waitUntilFinished(); job.open(); WebElement trend = driver.findElement(By.className("test-trend-caption")); assertThat(trend.getText(), containsString("Log Parser Trend")); WebElement img = driver.findElement(By.xpath(" assertThat(img.getAttribute("alt"), containsString("[Log Parser Chart]")); }
Source:
<code>private Map<Long, MetricPlotDTOs> createFromTree() { Map<Long, MetricPlotDTOs> taskPlots = Maps.newTreeMap(); try { RootNode rootNode = databaseService.getControlTreeForSessions(new HashSet<String>(Arrays.asList(sessionId))); DetailsNode detailsNode = rootNode.getDetailsNode(); for (AbstractIdentifyNode tDNode : detailsNode.getChildren()) { <START> TestDetailsNode testDetailsNode = (TestDetailsNode) tDNode; <END> for (AbstractIdentifyNode mGNode : testDetailsNode.getChildren()) { MetricGroupNode metricGroupNode = (MetricGroupNode) mGNode; Map<MetricNode, PlotSeriesDto> plots = databaseService.getPlotData(new HashSet<MetricNode>(metricGroupNode.getMetrics())); String groupTitle = metricGroupNode.getDisplayName(); for (MetricNode metricNode : plots.keySet()) { XYSeriesCollection plotCollection = new XYSeriesCollection(); for (PlotDatasetDto datasetDto : plots.get(metricNode).getPlotSeries()) { XYSeries plotEntry = new XYSeries(datasetDto.getLegend()); for (PointDto point : datasetDto.getPlotData()){ plotEntry.add(point.getX(),point.getY()); } plotCollection.addSeries(plotEntry); } Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(plotCollection, null); plotCollection = pair.getSecond(); JFreeChart chartMetric = ChartHelper.createXYChart(null, plotCollection, "Time, sec", null, 2, 2, ChartHelper.ColorTheme.LIGHT); String title = metricNode.getDisplayName(); Long id = testDetailsNode.getTaskDataDto().getId(); if (!taskPlots.containsKey(id)) taskPlots.put(id, new MetricPlotDTOs()); taskPlots.get(id).getMetricPlotDTOs().add(new MetricPlotDTO(metricNode.getDisplayName(), title, groupTitle, new JCommonDrawableRenderer(chartMetric))); groupTitle = ""; } } } } catch (Exception e) { log.error("Failed to the get metrics for the report"); } return taskPlots; }</code><technical_language>if tDNode TestDetailsNode, MetricGroupNode</technical_language>

Target:
private void createFromTree() { plots = new HashMap<Long, MetricPlotDTOs>(); Set<MetricNode> allMetrics = new HashSet<MetricNode>(); RootNode rootNode = databaseService.getControlTreeForSessions(new HashSet<String>(Arrays.asList(sessionId))); DetailsNode detailsNode = rootNode.getDetailsNode(); if (detailsNode.getTests().isEmpty() && detailsNode.getChildren().isEmpty()) return; for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { allMetrics.addAll(testDetailsNode.getMetrics()); } try { plotsReal = databaseService.getPlotData(allMetrics); } catch (Exception e) { log.error("Unable to get plots information for metrics"); } for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { getReport(testDetailsNode, testDetailsNode.getTaskDataDto().getId()); } }
Source:
<code>public RowKind getRowKind() { byte header = segments[0].get(offset); <START> return RowKind.values()[header]; <END> }</code><technical_language>IMHO, enum's values ordinal is elegant. adding a field explicitly meaning is byte encoding for enum</technical_language>

Target:
public RowKind getRowKind() { byte kindValue = segments[0].get(offset); return RowKind.fromByteValue(kindValue); }
Source:
<code>public void loadPageShouldRespondCandidateCollectionWhenOrderByNameAscWithFilterByEmailAndPhone() throws Exception { final SearchOptions searchOptions = SearchOptions.builder().name(EMPTY_STRING).email(CANDIDATE_EMAIL).phone(CANDIDATE_PHONE).build(); final FilterRequest filterRequest = FilterRequest.builder().order(SortingRequest.Order.ASC) .fieldName(SortingRequest.Field.NAME).searchOptions(searchOptions).build(); <START> val filterRequestArgumentCaptor = ArgumentCaptor.forClass(FilterRequest.class); <END> this.mockMvc.perform(get(REQUEST_URL) .param("filter", JSON_CANDIDATE_EMAIL_AND_PHONE).param("sort", NAME).param("order", ASC)) .andExpect(status().isOk()); then(candidateService).should().getAllCandidate(filterRequestArgumentCaptor.capture()); assertThat(filterRequestArgumentCaptor.getValue(), equalTo(filterRequest)); verifyNoMoreInteractions(candidateService); }</code><technical_language>Please remain consistent val, if is widely in project</technical_language>

Target:
public void loadPageShouldRespondCandidateCollectionWhenOrderByNameAscWithFilterByEmailAndPhone() throws Exception { final SearchOptions searchOptions = SearchOptions.builder().name(StringUtils.EMPTY).email(CANDIDATE_EMAIL).phone(CANDIDATE_PHONE).build(); final FilterRequest filterRequest = FilterRequest.builder().order(SortingRequest.Order.ASC) .fieldName(SortingRequest.Field.NAME).searchOptions(searchOptions).build(); ArgumentCaptor<FilterRequest> filterRequestArgumentCaptor = ArgumentCaptor.forClass(FilterRequest.class); this.mockMvc.perform(get(REQUEST_URL) .param(FILTER, JSON_CANDIDATE_EMAIL_AND_PHONE).param(SORT, NAME).param(ORDER, ASC)) .andExpect(status().isOk()); then(candidateService).should().getAllCandidate(filterRequestArgumentCaptor.capture()); assertThat(filterRequestArgumentCaptor.getValue(), equalTo(filterRequest)); verifyNoMoreInteractions(candidateService); }
Source:
<code>public WorkspaceMetacardImpl() { super(TYPE); <START> Set<String> setOfTags = new HashSet<>(); <END> setTags(Collections.singleton(WorkspaceAttributes.WORKSPACE_TAG)); }</code><technical_language>This unneeded</technical_language>

Target:
public WorkspaceMetacardImpl() { super(TYPE); setTags(Collections.singleton(WorkspaceAttributes.WORKSPACE_TAG)); }
Source:
<code>public Mono<AccessToken> authenticateWithClientSecret(String clientSecret, TokenRequestContext request) { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.createFromSecret(clientSecret)) .authority(authorityUrl); if (options.getHttpPipeline() != null) { applicationBuilder.httpClient(new HttpPipelineAdapter(options.getHttpPipeline())); <START> } else { if (options.getHttpClient() != null) { HttpPipeline pipeline = setupPipeline(options.getHttpClient()); applicationBuilder.httpClient(new HttpPipelineAdapter(pipeline)); } else if (options.getProxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } <END> } ConfidentialClientApplication application = applicationBuilder.build(); return Mono.fromFuture(application.acquireToken( ClientCredentialParameters.builder(new HashSet<>(request.getScopes())) .build())) .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); } catch (MalformedURLException e) { return Mono.error(e); } }</code><technical_language>pipeline create for publicApplicationClient in constructor create a new pipeline for call authenticate confidential client</technical_language>

Target:
public Mono<AccessToken> authenticateWithClientSecret(String clientSecret, TokenRequestContext request) { String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.createFromSecret(clientSecret)) .authority(authorityUrl); if (httpPipelineAdapter != null) { applicationBuilder.httpClient(httpPipelineAdapter); } else if (options.getProxyOptions() != null) { applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } ConfidentialClientApplication application = applicationBuilder.build(); return Mono.fromFuture(application.acquireToken( ClientCredentialParameters.builder(new HashSet<>(request.getScopes())) .build())) .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); } catch (MalformedURLException e) { return Mono.error(e); } }
Source:
<code>public void close() throws IOException, InterruptedException { try { m_outstandingWriteTasksLock.lock(); try { while (m_outstandingWriteTasks.get() > 0) { m_noMoreOutstandingWriteTasksCondition.await(); } } finally { m_outstandingWriteTasksLock.unlock(); } m_syncTask.cancel(false); ListenableFuture<?> task = m_syncService.submit(new Runnable() { @Override public void run() { } }); try { task.get(); } catch (ExecutionException e) { SNAP_LOG.error("Error waiting on snapshot sync task cancellation", e); } m_channel.force(false); } finally { m_bytesAllowedBeforeSync.release(m_bytesWrittenSinceLastSync.getAndSet(0)); } m_channel.position(8); ByteBuffer completed = ByteBuffer.allocate(1); if (m_writeFailed) { completed.put((byte)0).flip(); } else { completed.put((byte)1).flip(); } m_channel.write(completed); m_channel.force(false); m_channel.close(); if (m_onCloseHandler != null) { m_onCloseHandler.run(); } <START> if (m_reportedSerializationFailure != null) { <END> throw m_reportedSerializationFailure; } }</code><technical_language>11 lines completed flag is written file, need check for serialization failure. file incorrectly marked completed</technical_language>

Target:
public void close() throws IOException, InterruptedException { try { m_outstandingWriteTasksLock.lock(); try { while (m_outstandingWriteTasks.get() > 0) { m_noMoreOutstandingWriteTasksCondition.await(); } } finally { m_outstandingWriteTasksLock.unlock(); } m_syncTask.cancel(false); ListenableFuture<?> task = m_syncService.submit(new Runnable() { @Override public void run() { } }); try { task.get(); } catch (ExecutionException e) { SNAP_LOG.error("Error waiting on snapshot sync task cancellation", e); } m_channel.force(false); } finally { m_bytesAllowedBeforeSync.release(m_bytesWrittenSinceLastSync.getAndSet(0)); } m_channel.position(8); ByteBuffer completed = ByteBuffer.allocate(1); if (m_writeFailed || m_reportedSerializationFailure != null) { completed.put((byte)0).flip(); } else { completed.put((byte)1).flip(); } m_channel.write(completed); m_channel.force(false); m_channel.close(); if (m_onCloseHandler != null) { m_onCloseHandler.run(); } if (m_reportedSerializationFailure != null) { throw m_reportedSerializationFailure; } }
Source:
<code>public static RpcConnectionEventNotifier createLocalEventLogger(final Logger log) { final RpcConnectionEventNotifier rpcEventNotifier = new RpcConnectionEventNotifier(); @SuppressWarnings("PMD.CommentRequired") final RpcConnectionEventListener listener = new RpcConnectionEventListener() { @Override public void connectionReestablished(final RpcClientChannel clientChannel) { <START> log.info("connectionReestablished " + clientChannel); <END> } @Override public void connectionOpened(final RpcClientChannel clientChannel) { log.info("connectionOpened " + clientChannel); } @Override public void connectionLost(final RpcClientChannel clientChannel) { log.info("connectionLost " + clientChannel); } @Override public void connectionChanged(final RpcClientChannel clientChannel) { log.info("connectionChanged " + clientChannel); } }; rpcEventNotifier.setEventListener(listener); return rpcEventNotifier; }</code><technical_language>Colon channel name? "connectionReestablished: " If so, do this next 3</technical_language>

Target:
public static RpcConnectionEventNotifier createLocalEventLogger(final Logger log) { final RpcConnectionEventNotifier rpcEventNotifier = new RpcConnectionEventNotifier(); @SuppressWarnings("PMD.CommentRequired") final RpcConnectionEventListener listener = new RpcConnectionEventListener() { @Override public void connectionReestablished(final RpcClientChannel clientChannel) { log.info("connectionReestablished: " + clientChannel); } @Override public void connectionOpened(final RpcClientChannel clientChannel) { log.info("connectionOpened: " + clientChannel); } @Override public void connectionLost(final RpcClientChannel clientChannel) { log.info("connectionLost: " + clientChannel); } @Override public void connectionChanged(final RpcClientChannel clientChannel) { log.info("connectionChanged: " + clientChannel); } }; rpcEventNotifier.setEventListener(listener); return rpcEventNotifier; }
Source:
<code>private void fillTagDialog() { IStructuredSelection selection = (IStructuredSelection) tagViewer .getSelection(); Object firstSelected = selection.getFirstElement(); if (firstSelected instanceof Tag) { tag = (Tag) firstSelected; if (!overwriteButton.isEnabled()) { String tagMessageValue = tag.getMessage(); if (tagMessageValue != null <START> && !tagMessageValue.trim().isEmpty()) <END> overwriteButton.setEnabled(true); tagNameText.setEnabled(false); commitCombo.setEnabled(false); tagMessageText.setEnabled(false); } setTagImpl(); } }</code><technical_language>isEmpty is in Java 1.5</technical_language>

Target:
private void fillTagDialog() { IStructuredSelection selection = (IStructuredSelection) tagViewer .getSelection(); Object firstSelected = selection.getFirstElement(); if (firstSelected instanceof Tag) { tag = (Tag) firstSelected; if (!overwriteButton.isEnabled()) { String tagMessageValue = tag.getMessage(); if (tagMessageValue != null && tagMessageValue.trim().length() != 0) overwriteButton.setEnabled(true); tagNameText.setEnabled(false); commitCombo.setEnabled(false); tagMessageText.setEnabled(false); } setTagImpl(); } }
Source:
<code>protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { <START> if (getVds().getClusterSupportsGlusterService()) { <END> boolean returnValue = resourceManager.runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(getVdsId())).getSucceeded(); if (returnValue) { isStopGluster = true; } } Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }</code><technical_language>do need check gluster service status here? this checked in MaintenanceVdsCommand HostMaintenanceCallback itself</technical_language>

Target:
protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { boolean stopGlusterService = false; if (getVds().getClusterSupportsGlusterService()) { boolean returnValue = resourceManager.runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(getVdsId())).getSucceeded(); if (returnValue) { stopGlusterService = true; } } Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(stopGlusterService), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }
Source:
<code>public void onCommitClicked() { DevMachine devMachine = appContext.getDevMachine(); Path location = project.getLocation(); Path[] filesToCommitArray = new Path[filesToCommit.size()]; <START> filesToCommit.forEach(file -> filesToCommitArray[filesToCommit.indexOf(file)] = Path.valueOf(file)); <END> service.add(devMachine, location, false, filesToCommitArray) .then(arg -> { service.commit(devMachine, location, view.getMessage(), false, filesToCommitArray, view.isAmend()) .then(revision -> { onCommitSuccess(revision); if (view.isPushAfterCommit()) { String remoteBranch = view.getRemoteBranch(); String remote = remoteBranch.split("/")[0]; String branch = remoteBranch.split("/")[1]; service.push(devMachine, location, singletonList(branch), remote, false) .then(result -> { notificationManager.notify(constant.pushSuccess(remote), SUCCESS, FLOAT_MODE); }) .catchError(error -> { notificationManager.notify(constant.pushFail(), FAIL, FLOAT_MODE); }); } view.close(); }) .catchError(error -> { handleError(error.getCause()); }); }) .catchError(error -> { notificationManager.notify(constant.addFailed(), FAIL, FLOAT_MODE); }); }</code><technical_language>simple for cycle</technical_language>

Target:
public void onCommitClicked() { DevMachine devMachine = appContext.getDevMachine(); Path location = project.getLocation(); Path[] filesToCommitArray = getFilesToCommitArray(); service.add(devMachine, location, false, filesToCommitArray) .then(arg -> { service.commit(devMachine, location, view.getMessage(), false, filesToCommitArray, view.isAmend()) .then(revision -> { onCommitSuccess(revision); if (view.isPushAfterCommit()) { push(devMachine, location); } view.close(); }) .catchError(error -> { handleError(error.getCause()); }); }) .catchError(error -> { notificationManager.notify(constant.addFailed(), FAIL, FLOAT_MODE); }); }
Source:
<code>private <ID extends Serializable> ResourceSupport findRelEntryInternal(HttpServletRequest request, String apiCategory, String model, String id, String rel, String relid, Pageable page, PagedResourcesAssembler assembler, String projection) { checkModelPluralForm(apiCategory, model); <START> DSpaceRestRepository<DirectlyAddressableRestModel, ID> repository = utils.getResourceRepository(apiCategory, model); <END> Class<DirectlyAddressableRestModel> domainClass = repository.getDomainClass(); LinkRest linkRest = utils.getLinkRest(rel, domainClass); if (linkRest != null) { LinkRestRepository linkRepository = utils.getLinkResourceRepository(apiCategory, model, linkRest.name()); Method linkMethod = repositoryUtils.getLinkMethod("getResource", linkRepository); try { Object object = linkMethod.invoke(linkRepository, request, id, relid, page, projection); Link link = linkTo(this.getClass(), apiCategory, English.plural(model)).slash(id) .slash(rel).withSelfRel(); List result = new ArrayList(); result.add(object); PageImpl<DirectlyAddressableRestModel> pageResult = new PageImpl(result, page, 1); return assembler.toResource(pageResult.map(linkRepository::wrapResource),link); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } return null; }</code><technical_language>noted in #1889, a fan of calling this class DirectlyAddressableRestModel, DirectlyAddressable portion meaning me. of a name yet</technical_language>

Target:
private <ID extends Serializable> ResourceSupport findRelEntryInternal(HttpServletRequest request, String apiCategory, String model, String id, String rel, String relid, Pageable page, PagedResourcesAssembler assembler, String projection) { checkModelPluralForm(apiCategory, model); DSpaceRestRepository<RestAddressableModel, ID> repository = utils.getResourceRepository(apiCategory, model); Class<RestAddressableModel> domainClass = repository.getDomainClass(); LinkRest linkRest = utils.getLinkRest(rel, domainClass); if (linkRest != null) { LinkRestRepository linkRepository = utils.getLinkResourceRepository(apiCategory, model, linkRest.name()); Method linkMethod = repositoryUtils.getLinkMethod("getResource", linkRepository); try { Object object = linkMethod.invoke(linkRepository, request, id, relid, page, projection); Link link = linkTo(this.getClass(), apiCategory, English.plural(model)).slash(id) .slash(rel).withSelfRel(); List result = new ArrayList(); result.add(object); PageImpl<RestAddressableModel> pageResult = new PageImpl(result, page, 1); Page<HALResource> halResources = pageResult.map(linkRepository::wrapResource); halResources.forEach(linkService::addLinks); return assembler.toResource(halResources, link); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException(e.getMessage(), e); } } return null; }
Source:
<code>private long getMemoryMb(String key) { <START> long memoryMb = 1536L; <END> memoryMb = this.jobConf.getLong(key, 1536L); if (memoryMb == 0L) { throw new ProcessingException( "While correcting slot millis, " + key + " was found to be 0 "); } return memoryMb; }</code><technical_language>Setting a default constant a private function is invoked keys places in code is a good idea. set in Constants.java similar DEFAULT_YARN_SCHEDULER_MIN_MB . next if for memoryMb == 0L needs updated/removed accordingly</technical_language>

Target:
private long getMemoryMb(String key) { long memoryMb = 0L; if (Constants.MAP_MEMORY_MB_CONF_KEY.equals(key)){ memoryMb = this.jobConf.getLong(key, Constants.DEFAULT_MAP_MEMORY_MB); }else if (Constants.REDUCE_MEMORY_MB_CONF_KEY.equals(key)){ memoryMb = this.jobConf.getLong(key, Constants.DEFAULT_REDUCE_MEMORY_MB); } if (memoryMb == 0L) { throw new ProcessingException( "While correcting slot millis, " + key + " was found to be 0 "); } return memoryMb; }
Source:
<code>private AuthenticationResult getTokenWithRefreshTokenAndUpdateCache( final AuthenticationRequest request, final RefreshItem refreshItem) throws AuthenticationException { AuthenticationResult result = getTokenWithRefreshToken(request, refreshItem.mRefreshToken); if (result == null || StringExtensions.IsNullOrBlank(result.getAccessToken())) { String errLogInfo = result == null ? "" : result.getErrorLogInfo(); Logger.e(TAG, "Refresh token did not return accesstoken.", request.getLogInfo() + errLogInfo, ADALError.AUTH_FAILED_NO_TOKEN); if (AuthenticationConstants.OAuth2ErrorCode.INVALID_GRANT.equals(result.getErrorCode())) { Logger.v(TAG, "Removing token cache for invalid_grant error returned from server."); removeItemFromCache(refreshItem); } return result; } else { Logger.v(TAG, "It finished refresh token request:" + request.getLogInfo()); if (result.getUserInfo() == null && refreshItem.mUserInfo != null) { Logger.v(TAG, "UserInfo is updated from cached result:" + request.getLogInfo()); result.setUserInfo(refreshItem.mUserInfo); result.setIdToken(refreshItem.mRawIdToken); result.setTenantId(refreshItem.mTenantId); } Logger.v(TAG, "Cache is used. It will set item to cache" + request.getLogInfo()); setItemToCacheFromRefresh(refreshItem, request, result); <START> return result; <END> } }</code><technical_language>nit: prefer return. early return right now, while</technical_language>

Target:
private AuthenticationResult getTokenWithRefreshTokenAndUpdateCache( final AuthenticationRequest request, final RefreshItem refreshItem) throws AuthenticationException { final AuthenticationResult result = getTokenWithRefreshToken(request, refreshItem.mRefreshToken); if (result == null || StringExtensions.IsNullOrBlank(result.getAccessToken())) { String errLogInfo = result == null ? "" : result.getErrorLogInfo(); Logger.e(TAG, "Refresh token did not return accesstoken.", request.getLogInfo() + errLogInfo, ADALError.AUTH_FAILED_NO_TOKEN); if (result != null && AuthenticationConstants.OAuth2ErrorCode.INVALID_GRANT.equalsIgnoreCase(result.getErrorCode())) { Logger.v(TAG, "Removing token cache for invalid_grant error returned from server."); removeItemFromCache(refreshItem); } } else { if (result.getUserInfo() == null && refreshItem.mUserInfo != null) { Logger.v(TAG, "UserInfo is updated from cached result:" + request.getLogInfo()); result.setUserInfo(refreshItem.mUserInfo); result.setIdToken(refreshItem.mRawIdToken); result.setTenantId(refreshItem.mTenantId); } Logger.v(TAG, "Saving item into the cache." + request.getLogInfo()); setItemToCacheFromRefresh(refreshItem, request, result); } return result; }
Source:
<code>protected ImmutableSet<Path> getWritableDirs(Path sandboxExecRoot, Map<String, String> env) throws IOException { ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.add(sandboxExecRoot); String testTmpdir = env.get("TEST_TMPDIR"); if (testTmpdir != null) { addWritablePath( sandboxExecRoot, writablePaths, testTmpdir, "Cannot resolve symlinks in TEST_TMPDIR because it doesn't exist: \"%s\""); } if (OS.getCurrent() == OS.WINDOWS) { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TEMP")), <START> "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); <END> addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMP")), "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); } else { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMPDIR")), "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); } FileSystem fileSystem = sandboxExecRoot.getFileSystem(); for (String writablePath : sandboxOptions.sandboxWritablePath) { Path path = fileSystem.getPath(writablePath); writablePaths.add(path); if (path.isSymbolicLink()) { writablePaths.add(path.resolveSymbolicLinks()); } } return writablePaths.build(); }</code><technical_language>nit: s/TMPDIR/TEMP/</technical_language>

Target:
protected ImmutableSet<Path> getWritableDirs(Path sandboxExecRoot, Map<String, String> env) throws IOException { ImmutableSet.Builder<Path> writablePaths = ImmutableSet.builder(); writablePaths.add(sandboxExecRoot); String testTmpdir = env.get("TEST_TMPDIR"); if (testTmpdir != null) { addWritablePath( sandboxExecRoot, writablePaths, testTmpdir, "Cannot resolve symlinks in TEST_TMPDIR because it doesn't exist: \"%s\""); } if (OS.getCurrent() == OS.WINDOWS) { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TEMP")), "Cannot resolve symlinks in TEMP because it doesn't exist: \"%s\""); addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMP")), "Cannot resolve symlinks in TMP because it doesn't exist: \"%s\""); } else { addWritablePath( sandboxExecRoot, writablePaths, Preconditions.checkNotNull(env.get("TMPDIR")), "Cannot resolve symlinks in TMPDIR because it doesn't exist: \"%s\""); } FileSystem fileSystem = sandboxExecRoot.getFileSystem(); for (String writablePath : sandboxOptions.sandboxWritablePath) { Path path = fileSystem.getPath(writablePath); writablePaths.add(path); if (OS.getCurrent() != OS.WINDOWS || path.isSymbolicLink()) { writablePaths.add(path.resolveSymbolicLinks()); } } return writablePaths.build(); }
Source:
<code>public RedisAssociationRowAccessor(String[] prefixedColumns, String prefix) { this.prefix = prefix; if ( prefix != null ) { this.prefixedColumns = Arrays.asList( prefixedColumns ); } else { <START> this.prefixedColumns = new ArrayList<String>( 0 ); <END> } }</code><technical_language>Collections.emptyList</technical_language>

Target:
public RedisAssociationRowAccessor(String[] prefixedColumns, String prefix) { this.prefix = prefix; if ( prefix != null ) { this.prefixedColumns = Arrays.asList( prefixedColumns ); } else { this.prefixedColumns = Collections.emptyList(); } }
Source:
<code>public static String extractDigestFromAssertion(AssertionType assertion) { <START> return assertion != null && !StringUtils.isBlank(assertion.getDigestAlgorithm()) ? assertion.getDigestAlgorithm() : getDigestAlgorithm(); <END> }</code><technical_language>Try StringUtils.isNotBlank</technical_language>

Target:
public static String extractDigestFromAssertion(AssertionType assertion) { return assertion != null && StringUtils.isNotBlank(assertion.getDigestAlgorithm()) ? assertion.getDigestAlgorithm() : getDigestAlgorithm(); }
Source:
<code>private List<GlusterHostEntity> getGlusterPeers(Guid upServerId) { VDSReturnValue returnValue = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterHostsList, new VdsIdVDSCommandParametersBase(upServerId)); <START> if (!returnValue.getSucceeded()) { <END> getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_HOST_LIST_FAILED); } return (List<GlusterHostEntity>) returnValue.getReturnValue(); }</code><technical_language>is a problem, if this succeed, hostExists method get null result, no? command succeed succeeded is set true end</technical_language>

Target:
private List<GlusterServerInfo> getGlusterPeers(Guid upServerId) { List<GlusterServerInfo> glusterServers = new ArrayList<GlusterServerInfo>(); VDSReturnValue returnValue = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServerId)); if (!returnValue.getSucceeded()) { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_SERVERS_LIST_FAILED); } else { glusterServers = (List<GlusterServerInfo>) returnValue.getReturnValue(); } return glusterServers; }
Source:
<code>protected NuxeoGroup readEntity(JsonNode jn) throws IOException { GroupConfig groupConfig = userManager.getGroupConfig(); String id = getStringField(jn, "id"); String groupName = getStringField(jn, "groupname"); <START> if (StringUtils.isBlank(id) || ((StringUtils.isNotBlank(groupName)) && !id.equals(groupName))) { <END> id = groupName; } DocumentModel groupModel = null; if (StringUtils.isNotBlank(id)) { groupModel = userManager.getGroupModel(id); } if (groupModel == null) { groupModel = userManager.getBareGroupModel(); groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } String beforeReadLabel = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); readProperties(groupModel, groupConfig, jn); readMemberUsers(groupModel, groupConfig, jn); readMemberGroups(groupModel, groupConfig, jn); readParentGroups(groupModel, groupConfig, jn); if (StringUtils.isNotBlank(id)) { groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } if (jn.has("grouplabel")) { String compatLabel = getStringField(jn, "grouplabel"); String label = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); if (!Objects.equals(label, compatLabel) && (beforeReadLabel == null || Objects.equals(beforeReadLabel, label))) { groupModel.setProperty(groupConfig.schemaName, groupConfig.labelField, getStringField(jn, "grouplabel")); } } return new NuxeoGroupImpl(groupModel, groupConfig); }</code><technical_language>Remove extra parentheses (StringUtils.isNotBlank(groupName)) -> StringUtils.isNotBlank(groupName)</technical_language>

Target:
protected NuxeoGroup readEntity(JsonNode jn) throws IOException { GroupConfig groupConfig = userManager.getGroupConfig(); String id = getStringField(jn, "id"); String groupName = getStringField(jn, GROUP_NAME_COMPATIBILITY_FIELD); if (StringUtils.isBlank(id) || (StringUtils.isNotBlank(groupName) && !id.equals(groupName))) { id = groupName; } DocumentModel groupModel = null; if (StringUtils.isNotBlank(id)) { groupModel = userManager.getGroupModel(id); } if (groupModel == null) { groupModel = userManager.getBareGroupModel(); groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } String beforeReadLabel = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); readProperties(groupModel, groupConfig, jn); readMemberUsers(groupModel, groupConfig, jn); readMemberGroups(groupModel, groupConfig, jn); readParentGroups(groupModel, groupConfig, jn); if (StringUtils.isNotBlank(id)) { groupModel.setProperty(groupConfig.schemaName, groupConfig.idField, id); } if (jn.has(GROUP_LABEL_COMPATIBILITY_FIELD)) { String compatLabel = getStringField(jn, GROUP_LABEL_COMPATIBILITY_FIELD); String label = (String) groupModel.getProperty(groupConfig.schemaName, groupConfig.labelField); if (!Objects.equals(label, compatLabel) && (beforeReadLabel == null || Objects.equals(beforeReadLabel, label))) { groupModel.setProperty(groupConfig.schemaName, groupConfig.labelField, compatLabel); } } return new NuxeoGroupImpl(groupModel, groupConfig); }
Source:
<code>public String getIdentifierQuoteString() throws SQLException { <START> HPCCJDBCUtils.traceoutln(TraceLevel.VERBOSE, "HPCCDatabaseMetaData getIdentifierQuoteString"); <END> return ""; }</code><technical_language>Bad formatting (need insert spaces)</technical_language>

Target:
public String getIdentifierQuoteString() throws SQLException { HPCCJDBCUtils.traceoutln(Level.FINEST, "HPCCDatabaseMetaData getIdentifierQuoteString"); return ""; }
Source:
<code>private static Point drawArrowHead(int x0, int y0, int x1, int y1, float scale, GC gc) { double factor = 10 + 2.0 * scale; double cos = 0.9510; double sin = 0.3090; long lenx = x1 - x0; long leny = y1 - y0; double len = Math.sqrt(lenx * lenx + leny * leny); double dx = factor * lenx / len; double dy = factor * leny / len; int end1X = (int) Math.round((x1 - (dx * cos + dy * -sin))); int end1Y = (int) Math.round((y1 - (dx * sin + dy * cos))); int end2X = (int) Math.round((x1 - (dx * cos + dy * sin))); int end2Y = (int) Math.round((y1 - (dx * -sin + dy * cos))); <START> gc.toString(); <END> int[] arrow = new int[] { x1, y1, end1X, end1Y, end2X, end2Y, x1, y1 }; gc.fillPolygon(arrow); return new Point((3 * ((end1X + end2X) / 2) + x1) / 4, (3 * ((end1Y + end2Y) / 2) + y1) / 4); }</code><technical_language>Remove</technical_language>

Target:
private static Point drawArrowHead(int x0, int y0, int x1, int y1, float scale, GC gc) { double factor = 10 + 2.0 * scale; double cos = 0.9510; double sin = 0.3090; long lenx = x1 - x0; long leny = y1 - y0; double len = Math.sqrt(lenx * lenx + leny * leny); double dx = factor * lenx / len; double dy = factor * leny / len; int end1X = (int) Math.round((x1 - (dx * cos + dy * -sin))); int end1Y = (int) Math.round((y1 - (dx * sin + dy * cos))); int end2X = (int) Math.round((x1 - (dx * cos + dy * sin))); int end2Y = (int) Math.round((y1 - (dx * -sin + dy * cos))); int[] arrow = new int[] { x1, y1, end1X, end1Y, end2X, end2Y, x1, y1 }; gc.fillPolygon(arrow); return new Point((3 * ((end1X + end2X) / 2) + x1) / 4, (3 * ((end1Y + end2Y) / 2) + y1) / 4); }
Source:
<code>public void testGetScript() throws Exception { School.SrlBankProblem.Builder bankProblem = School.SrlBankProblem.newBuilder(); bankProblem.setId(FAKE_ID); <START> bankProblem.setScript("Fake Script"); <END> bankProblem.setQuestionText(FAKE_QUESTION_TEXT); Util.SrlPermission.Builder permissionBuilder = Util.SrlPermission.newBuilder(); permissionBuilder.addAdminPermission(ADMIN_USER); permissionBuilder.addUserPermission(USER_USER); bankProblem.setAccessPermission(permissionBuilder); String problemBankId = mongoInsertBankProblem(db, bankProblem.build()); SrlBankProblem getProblem = mongoGetBankProblem(fauth, db, problemBankId, ADMIN_USER); String testString = getProblem.getScript().toString(); Assert.assertEquals("Fake Script", testString); }</code><technical_language>this a variable</technical_language>

Target:
public void testGetScript() throws Exception { School.SrlBankProblem.Builder bankProblem = School.SrlBankProblem.newBuilder(); bankProblem.setId(FAKE_ID); bankProblem.setScript(FAKE_SCRIPT); bankProblem.setQuestionText(FAKE_QUESTION_TEXT); Util.SrlPermission.Builder permissionBuilder = Util.SrlPermission.newBuilder(); permissionBuilder.addAdminPermission(ADMIN_USER); permissionBuilder.addUserPermission(USER_USER); bankProblem.setAccessPermission(permissionBuilder); String problemBankId = mongoInsertBankProblem(db, bankProblem.build()); SrlBankProblem getProblem = mongoGetBankProblem(fauth, db, problemBankId, ADMIN_USER); String testString = getProblem.getScript().toString(); Assert.assertEquals(FAKE_SCRIPT, testString); }
Source:
<code><START> public void init() throws Exception { <END> deviceTypePluginDeployer = Mockito.mock(DeviceTypePluginDeployer.class, Mockito.CALLS_REAL_METHODS); serviceRegistration = Mockito.mock(ServiceRegistration.class, Mockito.CALLS_REAL_METHODS); Mockito.doReturn(serviceRegistration).when(deviceTypePluginDeployer).registerDeviceType(Mockito.any(), Mockito.any()); deviceTypeServiceRegistrations = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeServiceRegistrations"); deviceTypeServiceRegistrations.setAccessible(true); deviceTypeServiceRegistrations.set(deviceTypePluginDeployer, new ConcurrentHashMap()); deviceTypeConfigurationDataMap = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeConfigurationDataMap"); deviceTypeConfigurationDataMap.setAccessible(true); deviceTypeConfigurationDataMap.set(deviceTypePluginDeployer, new ConcurrentHashMap()); this.initializeCarbonContext(); }</code><technical_language>throwing generic exceptions? Is part throw generic exception? If throw specific exceptions</technical_language>

Target:
public void init() throws NoSuchFieldException, IllegalAccessException, IOException, RegistryException { deviceTypePluginDeployer = Mockito.mock(DeviceTypePluginDeployer.class, Mockito.CALLS_REAL_METHODS); serviceRegistration = Mockito.mock(ServiceRegistration.class, Mockito.CALLS_REAL_METHODS); Mockito.doReturn(serviceRegistration).when(deviceTypePluginDeployer).registerDeviceType(Mockito.any(), Mockito.any()); deviceTypeServiceRegistrations = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeServiceRegistrations"); deviceTypeServiceRegistrations.setAccessible(true); deviceTypeServiceRegistrations.set(deviceTypePluginDeployer, new ConcurrentHashMap()); deviceTypeConfigurationDataMap = DeviceTypePluginDeployer.class.getDeclaredField ("deviceTypeConfigurationDataMap"); deviceTypeConfigurationDataMap.setAccessible(true); deviceTypeConfigurationDataMap.set(deviceTypePluginDeployer, new ConcurrentHashMap()); this.initializeCarbonContext(); }
Source:
<code>public void setSort(SortOrder sort) { <START> this.mySort = sort; <END> }</code><technical_language>this</technical_language>

Target:
public void setSort(SortOrder sort) { mySort = sort; }
Source:
<code>protected void requestFileName(){ String name = "Enter File Name"; Builder builder = new AlertDialog.Builder(mapActivity); builder.setTitle(name); FrameLayout parent = new FrameLayout(mapActivity); final EditText editText = new EditText(mapActivity); editText.setId(R.id.TextView); parent.setPadding(15, 0, 15, 0); parent.addView(editText); builder.setView(parent); builder.setNegativeButton(R.string.default_buttons_cancel, null); builder.setPositiveButton(R.string.default_buttons_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String fileName = editText.getText().toString(); requestedName = fileName; } }); <START> builder.show(); <END> }</code><technical_language>this dialog face problem of incorrect handling</technical_language>

Target:
protected void requestFileName(){ mapActivity.showDialog(DIALOG_REQUEST_FILENAME_ID); }
Source:
<code>public void initialise() { uiTitle = find("title", UILabel.class); if (uiTitle != null) { <START> uiTitle.setText(title); <END> } uiSubtitle = find("subtitle", UILabel.class); if (uiSubtitle != null) { uiSubtitle.setText(subtitle); } }</code><technical_language>So, called Bindings need here. Essentially a method is run time UI wants display. In case java uiTitle.bindText( new ReadOnlyBinding<String>() { @Override public String get() { return title } } ); do similar for subtitle</technical_language>

Target:
public void initialise() { uiTitle = find("title", UILabel.class); if (uiTitle != null) { uiTitle.bindText(new ReadOnlyBinding<String>() { @Override public String get() { return title; } }); } uiSubtitle = find("subtitle", UILabel.class); if (uiSubtitle != null) { uiSubtitle.bindText(new ReadOnlyBinding<String>() { @Override public String get() { return subtitle; } }); } }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == EMAIL_CREDENTIALS) { if (resultCode == RESULT_OK) { Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); mEmailInput.getEditText().setText(credential.getId()); next(getCleanedEmail()); } else { hasDismissedEmailHints = true; <START> EditTextUtils.showSoftInput(mEmailInput.getEditText()); <END> } isDisplayingEmailHints = false; } }</code><technical_language>issue keyboard showing end. a timing so, I managed work delay-posting call this: mEmailInput.getEditText().postDelayed(new Runnable() { @Override public void run() { if (isAdded()) { EditTextUtils.showSoftInput(mEmailInput.getEditText()); } } }, 400); add that? WDYT</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == EMAIL_CREDENTIALS) { if (resultCode == RESULT_OK) { Credential credential = data.getParcelableExtra(Credential.EXTRA_KEY); mEmailInput.getEditText().setText(credential.getId()); next(getCleanedEmail()); } else { hasDismissedEmailHints = true; mEmailInput.getEditText().postDelayed(new Runnable() { @Override public void run() { if (isAdded()) { EditTextUtils.showSoftInput(mEmailInput.getEditText()); } } }, getResources().getInteger(android.R.integer.config_mediumAnimTime)); } isDisplayingEmailHints = false; } }