auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationContext context) { ConditionCohortDefinition cd = (ConditionCohortDefinition) cohortDefinition; HqlQueryBuilder query = new HqlQueryBuilder(); query.select("c.patient.patientId") .from(Condition.class, "c") .wherePatientIn("c.patient.patientId", context) .whereEqual("c.condition.coded", cd.getConditionCoded()) .whereEqual("c.condition.nonCoded", cd.getConditionNonCoded()) .whereGreaterOrEqualTo("c.dateCreated", cd.getOnOrAfter()) .whereLessOrEqualTo("c.dateCreated", cd.getOnOrBefore()); List<Integer> patientIds = evaluationService.evaluateToList(query, Integer.class, context); Cohort cohort = new Cohort(patientIds); return new EvaluatedCohort(cohort, cd, context); }

Target:
public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationContext context) { ConditionCohortDefinition cd = (ConditionCohortDefinition) cohortDefinition; HqlQueryBuilder query = new HqlQueryBuilder(); query.select("c.patient.patientId") .from(Condition.class, "c") .wherePatientIn("c.patient.patientId", context) .whereEqual("c.condition.coded", cd.getConditionCoded()) .whereEqual("c.condition.nonCoded", cd.getConditionNonCoded()) .whereGreaterOrEqualTo("c.dateCreated", cd.getCreatedOnOrAfter()) .whereLessOrEqualTo("c.dateCreated", cd.getCreatedOnOrBefore()) .whereGreaterOrEqualTo("c.onsetDate", cd.getOnsetDateOnOrAfter()) .whereLessOrEqualTo("c.onsetDate", cd.getOnsetDateOnOrBefore()) .whereGreaterOrEqualTo("c.endDate", cd.getEndDateOnOrAfter()) .whereLessOrEqualTo("c.endDate", cd.getEndDateOnOrBefore()) .whereGreater("c.endDate", cd.getActiveOnDate()) .whereLess("c.onsetDate", cd.getActiveOnDate()); List<Integer> patientIds = evaluationService.evaluateToList(query, Integer.class, context); Cohort cohort = new Cohort(patientIds); return new EvaluatedCohort(cohort, cd, context); }
Source:
private void downloadJsonFile(HttpServletRequest request, HttpServletResponse response) { try { response.setContentType("application/json"); String jsonContent = extractJsonStringFromRequest(request); String nodeSourceName = extractNodeSourceName(jsonContent); response.setHeader("Content-disposition", "attachment; filename=" + nodeSourceName + NODE_SOURCE_FILE_NAME_SUFFIX); response.setHeader("Location", nodeSourceName + NODE_SOURCE_FILE_NAME_SUFFIX); response.getWriter().write(jsonContent); } catch (Throwable t) { try { LOGGER.warn("Export node source failed", t); response.getWriter().write(t.getMessage()); } catch (IOException e) { LOGGER.warn("Failed to return node source export error to client, error was:" + t.getMessage(), e); } } }

Target:
private void downloadJsonFile(HttpServletRequest request, HttpServletResponse response) { try { response.setContentType("application/json"); String jsonContent = extractJsonStringFromRequest(request); String nodeSourceName = extractNodeSourceName(jsonContent); response.setHeader("Content-disposition", "attachment; filename=" + nodeSourceName + NODE_SOURCE_FILE_NAME_SUFFIX); response.setHeader("Location", nodeSourceName + NODE_SOURCE_FILE_NAME_SUFFIX); response.getWriter().write(jsonContent); } catch (Exception e) { try { LOGGER.warn("Export node source failed", e); response.getWriter().write(e.getMessage()); } catch (IOException ioe) { LOGGER.warn("Failed to return node source export error to client", ioe); } } }
Source:
public EEFTabbedPropertySheetPage(Object contributor, String contributorId) { if (contributor instanceof IEEFTabbedPropertySheetPageContributor) { this.contributor = (IEEFTabbedPropertySheetPageContributor) contributor; } else { this.contributor = new ContributorWrapper(contributor, contributorId); } this.registry = EEFTabbedPropertyRegistry.getDefault(this.contributor.getContributorId()); }

Target:
public EEFTabbedPropertySheetPage(Object contributor, String contributorId) { if (contributor instanceof IEEFTabbedPropertySheetPageContributor) { this.contributor = (IEEFTabbedPropertySheetPageContributor) contributor; } else { this.contributor = new ContributorWrapper(contributor, contributorId); } this.registry = EEFTabbedPropertyRegistry.getDefault(this.contributor); }
Source:
protected void notifyEvent(CoreSession session, Task task, List<DocumentModel> docs, String event, Map<String, Serializable> eventInfo, String comment, NuxeoPrincipal principal, List<String> actorIds) { Map<String, Serializable> eventProperties = new HashMap<>(); ArrayList<String> notificationRecipients = new ArrayList<>(actorIds); eventProperties.put(NotificationConstants.RECIPIENTS_KEY, notificationRecipients.toArray(new String[notificationRecipients.size()])); if (eventInfo != null) { eventProperties.putAll(eventInfo); } for (DocumentModel doc : docs) { TaskEventNotificationHelper.notifyEvent(session, doc, principal, task, event, eventProperties, comment, null); } }

Target:
protected void notifyEvent(CoreSession session, Task task, List<DocumentModel> docs, String event, Map<String, Serializable> eventInfo, String comment, NuxeoPrincipal principal, List<String> actorIds) { Map<String, Serializable> eventProperties = new HashMap<>(); List<String> notificationRecipients = new ArrayList<>(actorIds); eventProperties.put(NotificationConstants.RECIPIENTS_KEY, notificationRecipients.toArray(new String[notificationRecipients.size()])); if (eventInfo != null) { eventProperties.putAll(eventInfo); } for (DocumentModel doc : docs) { TaskEventNotificationHelper.notifyEvent(session, doc, principal, task, event, eventProperties, comment, null); } }
Source:
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xf, float yf, float zf) { TileEntityBoiler tileEntity = (TileEntityBoiler) world.getTileEntity(x, y, z); boolean isClient = !world.isRemote; if (tileEntity != null) { if (!FluidHelper.playerIsHoldingWaterContainer(player) && isClient && tileEntity != null) { player.openGui(Steamcraft.instance, 0, world, x, y, z); } else { FluidHelper.fillTankFromHeldItem(player, tileEntity.myTank); } } return true; }

Target:
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xf, float yf, float zf) { TileEntityBoiler tileEntity = (TileEntityBoiler) world.getTileEntity(x, y, z); boolean isClient = !world.isRemote; if (tileEntity != null) { if (!FluidHelper.playerIsHoldingWaterContainer(player) && isClient) { player.openGui(Steamcraft.instance, 0, world, x, y, z); } else { FluidHelper.fillTankFromHeldItem(player, tileEntity.myTank); } } return true; }
Source:
public void setActive(String name) { if (StringUtil.isNullOrEmpty(name)) { Debug.logWarning("Active column should be set to the main source window instead of null."); if (activeColumn_ != null) { activeColumn_.setActiveEditor(""); activeColumn_ = null; } return; } SourceColumn column = getByName(name); if (column == null) column = getByName(MAIN_SOURCE_NAME); setActive(column); }

Target:
public void setActive(String name) { if (StringUtil.isNullOrEmpty(name)) { if (activeColumn_ != null) { activeColumn_.setActiveEditor(""); activeColumn_ = null; } return; } SourceColumn column = getByName(name); if (column == null) column = getByName(MAIN_SOURCE_NAME); setActive(column); }
Source:
public void close() { closed = true; for (Grouper<KeyType> grouper : groupers) { grouper.close(); } }

Target:
public void close() { if (!closed) { closed = true; groupers.forEach(Grouper::close); } }
Source:
public void update(DownloadBatchStatus currentDownloadBatchStatus) { if (callback == null) { throw new IllegalStateException("A DownloadBatchStatusCallback must be set before an update is called."); } if (progressHasChanged(currentDownloadBatchStatus)) { currentProgress = currentDownloadBatchStatus.percentageDownloaded(); callback.onUpdate(currentDownloadBatchStatus); } }

Target:
public void update(DownloadBatchStatus currentDownloadBatchStatus) { if (callback == null) { Logger.w("A DownloadBatchStatusCallback must be set before an update is called."); return; } if (progressHasChanged(currentDownloadBatchStatus)) { currentProgress = currentDownloadBatchStatus.percentageDownloaded(); callback.onUpdate(currentDownloadBatchStatus); } }
Source:
public void clickOnAllStacksButton() { seleniumWebDriverHelper.waitAndClick(By.xpath(Locators.ALL_STACKS_BUTTON_XPATH)); WaitUtils.sleepQuietly(1); }

Target:
public void clickOnAllStacksButton() { seleniumWebDriverHelper.waitAndClick(By.xpath(Locators.ALL_STACKS_BUTTON_XPATH)); }
Source:
public void createWebProject(String name,String runtime, boolean webxml){ WebProjectWizard dw = new WebProjectWizard(); dw.open(); WebProjectFirstPage dfp = new WebProjectFirstPage(dw); dfp.setProjectName(name); if(runtime == null){ dfp.setTargetRuntime("<None>"); } else { dfp.setTargetRuntime(runtime); } if (getJavaVersion().equals("1.8")) { new PushButton("Modify...").click(); Tree tree = new DefaultTree(); tree.getItem("Java").select(); tree.getContextMenu().getItem("Change Version...").select(); new DefaultCombo(0).setSelection("1.8"); new PushButton("OK").click(); new PushButton("OK").click(); } dw.next(); dw.next(); WebProjectThirdPage dtp = new WebProjectThirdPage(dw); dtp.setGenerateWebXmlDeploymentDescriptor(webxml); dw.finish(); waitForAllScheduledJobs(); }

Target:
public void createWebProject(String name,String runtime, boolean webxml){ WebProjectWizard dw = new WebProjectWizard(); dw.open(); WebProjectFirstPage dfp = new WebProjectFirstPage(dw); dfp.setProjectName(name); if(runtime == null){ dfp.setTargetRuntime("<None>"); } else { dfp.setTargetRuntime(runtime); } if (!JavaVersionHelper.getJavaVersion().equals("1.8")) { new PushButton("Modify...").click(); Tree tree = new DefaultTree(); tree.getItem("Java").select(); tree.getContextMenu().getItem("Change Version...").select(); new DefaultCombo(0).setSelection("1.8"); new OkButton().click(); new OkButton().click(); } dw.next(); dw.next(); WebProjectThirdPage dtp = new WebProjectThirdPage(dw); dtp.setGenerateWebXmlDeploymentDescriptor(webxml); dw.finish(); waitForAllScheduledJobs(); }
Source:
private void createTagOptionGroup(Composite parent) { final Group tagsGroup = new Group(parent, SWT.NULL); tagsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); tagsGroup.setText(UIText.RefSpecPage_annotatedTagsGroup); tagsGroup.setLayout(new GridLayout()); createTagOptionButton(tagsGroup, TagOpt.AUTO_FOLLOW, UIText.RefSpecPage_annotatedTagsAutoFollow); createTagOptionButton(tagsGroup, TagOpt.FETCH_TAGS, UIText.RefSpecPage_annotatedTagsFetchTags); createTagOptionButton(tagsGroup, TagOpt.NO_TAGS, UIText.RefSpecPage_annotatedTagsNoTags); }

Target:
private void createTagOptionGroup(Composite parent) { final Group tagsGroup = new Group(parent, SWT.NULL); tagsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); tagsGroup.setText("tag fetching strategy" ); tagsGroup.setLayout(new GridLayout(3, false)); createTagOptionButton(tagsGroup, TagOpt.AUTO_FOLLOW, "Fetch tags on tracked branches", UIText.RefSpecPage_annotatedTagsAutoFollow); createTagOptionButton(tagsGroup, TagOpt.FETCH_TAGS, "Fetch all tags", UIText.RefSpecPage_annotatedTagsFetchTags); createTagOptionButton(tagsGroup, TagOpt.NO_TAGS, "Fetch no tags", UIText.RefSpecPage_annotatedTagsNoTags); }
Source:
public void runAll(){ for(TestCase test: testcases){ server.newGame(GridLoader.loadGrid("grid1.json")); test.run(); } }

Target:
public void runAll(){ for(TestCase test: testcases){ server.newGame(GridLoader.loadGrid("test/testGrid2.json")); test.run(); } }
Source:
public int emitBatches() { AtomicInteger numberOfBatches = new AtomicInteger(maxBatches); AtomicInteger scheduledTasks = new AtomicInteger(0); emitter.computeBatches(MongoReplicationTask.class, qry -> enhanceQuery(qry, true), batchSize, batch -> { distributedTasks.submitFIFOTask(ReplicationTaskExecutor.class, batch); scheduledTasks.addAndGet(batchSize); markTasksAsScheduled(batch); return numberOfBatches.decrementAndGet() > 0; }); return scheduledTasks.get(); }

Target:
public int emitBatches() { AtomicInteger numberOfBatches = new AtomicInteger(maxBatches); AtomicInteger scheduledTasks = new AtomicInteger(0); emitter.computeBatches(MongoReplicationTask.class, qry -> filterOnExecutableTasks(qry, true), batchSize, batch -> { distributedTasks.submitFIFOTask(ReplicationTaskExecutor.class, batch); scheduledTasks.addAndGet(batchSize); markTasksAsScheduled(batch); return numberOfBatches.decrementAndGet() > 0; }); return scheduledTasks.get(); }
Source:
public OAuthToken getToken(String oauthProviderName, String userId) throws IOException { if (!userId.isEmpty()) { try { UriBuilder ub = UriBuilder.fromUri(apiEndpoint) .path("/oauth/token/") .queryParam("oauth_provider", oauthProviderName); Link getTokenLink = DtoFactory.newDto(Link.class).withHref(ub.build().toString()).withMethod("GET"); OAuthToken token = HttpJsonHelper.request(OAuthToken.class, getTokenLink); if (token == null) { LOG.warn("Token not found for user {}", userId); return null; } return token; } catch (ServerException | NotFoundException | ForbiddenException | UnauthorizedException | ConflictException e) { LOG.error("Exception on token retrieval, message : {}", e.getLocalizedMessage()); return null; } } return null; }

Target:
public OAuthToken getToken(String oauthProviderName, String userId) throws IOException { if (userId.isEmpty()) { return null; } try { UriBuilder ub = UriBuilder.fromUri(apiEndpoint) .path(OAuthAuthenticationService.class, "token") .queryParam("oauth_provider", oauthProviderName); Link getTokenLink = DtoFactory.newDto(Link.class).withHref(ub.build().toString()).withMethod("GET"); OAuthToken token = HttpJsonHelper.request(OAuthToken.class, getTokenLink); if (token == null) { LOG.warn("Token not found for user {}", userId); return null; } return token; } catch (ServerException | NotFoundException | ForbiddenException | UnauthorizedException | ConflictException e) { LOG.error("Exception on token retrieval, message : {}", e.getLocalizedMessage()); return null; } }
Source:
public boolean areLoaded() { boolean result = true; String[] tags = getTags(); for (int i = 0; i < tags.length; i++) { if (!isWidgetVisible(i)) { result = false; PageObjectLogging.log(getTagName() + " #" + i, MercuryMessages.VISIBLE_MSG, result); break; } PageObjectLogging.log(getTagName() + " #" + i, MercuryMessages.VISIBLE_MSG, result); } PageObjectLogging.log("all " + getTagName() + " widgets", MercuryMessages.VISIBLE_MSG, result); return result; }

Target:
public boolean areLoaded() { boolean result = true; String[] tags = getTags(); for (int i = 0; i < tags.length; i++) { if (!isWidgetVisible(i)) { result = false; PageObjectLogging.log(getTagName() + " #" + i, MercuryMessages.INVISIBLE_MSG, result); return result; } PageObjectLogging.log(getTagName() + " #" + i, MercuryMessages.VISIBLE_MSG, result); } PageObjectLogging.log("all " + getTagName() + " widgets", MercuryMessages.VISIBLE_MSG, result); return result; }
Source:
public AlleleFractionInitializer(final AlleleFractionData data) { parameters = INITIAL_PARAMETERS; minorFractions = initialMinorFractions(data); double previousIterationLogLikelihood; double nextIterationLogLikelihood = Double.NEGATIVE_INFINITY; logger.info(String.format("Initializing allele-fraction model. Iterating until log likelihood converges to within %.3f.", LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD)); int iteration = 1; do { previousIterationLogLikelihood = nextIterationLogLikelihood; parameters = new AllelicBiasParameters(estimateMeanBias(data), estimateBiasVariance(data), estimateOutlierProbability(data)); minorFractions = estimateMinorFractions(data); nextIterationLogLikelihood = AlleleFractionLikelihoods.logLikelihood(parameters, minorFractions, data); logger.info(String.format("Iteration %d, model log likelihood = %.3f.", iteration, nextIterationLogLikelihood)); iteration++; } while (iteration < MAX_ITERATIONS && nextIterationLogLikelihood - previousIterationLogLikelihood > LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD); }

Target:
public AlleleFractionInitializer(final AlleleFractionData data) { globalParameters = INITIAL_GLOBAL_PARAMETERS; minorFractions = initialMinorFractions(data); double previousIterationLogLikelihood; double nextIterationLogLikelihood = Double.NEGATIVE_INFINITY; logger.info(String.format("Initializing allele-fraction model. Iterating until log likelihood converges to within %.3f.", LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD)); int iteration = 1; do { previousIterationLogLikelihood = nextIterationLogLikelihood; globalParameters = new AlleleFractionGlobalParameters(estimateMeanBias(data), estimateBiasVariance(data), estimateOutlierProbability(data)); minorFractions = estimateMinorFractions(data); nextIterationLogLikelihood = AlleleFractionLikelihoods.logLikelihood(globalParameters, minorFractions, data); logger.info(String.format("Iteration %d, model log likelihood = %.3f.", iteration, nextIterationLogLikelihood)); iteration++; } while (iteration < MAX_ITERATIONS && nextIterationLogLikelihood - previousIterationLogLikelihood > LOG_LIKELIHOOD_CONVERGENCE_THRESHOLD); }
Source:
protected void testAccessControl() throws Exception { String[] submissionParams = new String[] {}; verifyAccessibleForStudents(submissionParams); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); }

Target:
protected void testAccessControl() throws Exception { String[] submissionParams = new String[] {}; verifyAccessibleForStudents(submissionParams); }
Source:
public void newArticleShowsUpOnSpecialNewPages() { ArticleContent articleContent = new ArticleContent(); String articleTitle = articleContent.createUniqueArticle(); SpecialNewPages specialNewPages = new SpecialNewPages(); specialNewPages.openSpecialNewPages(wikiURL); specialNewPages.verifyContainsLinkToArticle(articleTitle); }

Target:
public void newArticleShowsUpOnSpecialNewPages() { ArticleContent articleContent = new ArticleContent(); String articleTitle = articleContent.createUniqueArticle(); SpecialNewPages specialNewPages = new SpecialNewPages().open(); Assert.assertTrue( specialNewPages.containsLinkToArticle(articleTitle), "Special:NewPages does not contain link to article named " + articleTitle ); }
Source:
public SingleKeyJWSKeySelector(JWSAlgorithm expectedJwsAlgorithm, Key key) { Assert.notNull(expectedJwsAlgorithm, "expectedJwsAlgorithm cannot be null"); Assert.notNull(key, "key cannot be null"); this.keySet = Arrays.asList(key); this.expectedJwsAlgorithm = expectedJwsAlgorithm; }

Target:
SingleKeyJWSKeySelector(JWSAlgorithm expectedJwsAlgorithm, Key key) { Assert.notNull(expectedJwsAlgorithm, "expectedJwsAlgorithm cannot be null"); Assert.notNull(key, "key cannot be null"); this.keySet = Arrays.asList(key); this.expectedJwsAlgorithm = expectedJwsAlgorithm; }
Source:
public int hashCode() { int hash = 7; final int prime = 31; for (Entry<VdcParameter, Object> entry : paramsMap.entrySet()) { hash = prime * hash + entry.getKey().hashCode(); hash = prime * hash + entry.getValue().hashCode(); } return hash; }

Target:
public int hashCode() { return paramsMap.hashCode(); }
Source:
public String setClearAlarmRegister(final DlmsConnectionHolder conn, final DlmsDevice device, final ClearAlarmRegisterRequestDto clearAlarmRegisterRequestDto) throws ProtocolAdapterException { this.clearAlarmRegisterCommandExecutor.execute(conn, device, clearAlarmRegisterRequestDto); return "Clear alarm register result is OK for device: " + device.getDeviceIdentification(); }

Target:
public void setClearAlarmRegister(final DlmsConnectionHolder conn, final DlmsDevice device, final ClearAlarmRegisterRequestDto clearAlarmRegisterRequestDto) throws ProtocolAdapterException { this.clearAlarmRegisterCommandExecutor.execute(conn, device, clearAlarmRegisterRequestDto); }
Source:
public void initialize(ConfigurableListableBeanFactory beanFactory) throws BeansException { beanFactory.addBeanPostProcessor(new ChannelSecurityInterceptorBeanPostProcessor(beanFactory.getBeansOfType(ChannelSecurityInterceptor.class).values())); }

Target:
public void initialize(ConfigurableListableBeanFactory beanFactory) throws BeansException { BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; if (!registry.containsBeanDefinition(CHANNEL_SECURITY_INTERCEPTOR_BPP_BEAN_NAME)) { registry.registerBeanDefinition(CHANNEL_SECURITY_INTERCEPTOR_BPP_BEAN_NAME, new RootBeanDefinition(ChannelSecurityInterceptorBeanPostProcessor.class)); } }
Source:
private synchronized static String bindSessionWithConfig(String sessionPath) { final SyncSession syncSession = sessions.get(sessionPath); if (syncSession == null) { throw new IllegalStateException("Matching Java SyncSession could not be found for: " + sessionPath); } else { return syncSession.accessToken(authServer); } }

Target:
private synchronized static String bindSessionWithConfig(String sessionPath) { final SyncSession syncSession = sessions.get(sessionPath); if (syncSession == null) { RealmLog.error("Matching Java SyncSession could not be found for: " + sessionPath); } else { try { return syncSession.accessToken(authServer); } catch (Exception exception) { RealmLog.error(exception); } } return null; }
Source:
public Shell getShell() { Display currentDisplay = Display.getCurrent(); IWorkbenchWindow workbenchWindow = getWorkbenchWindow(); if (currentDisplay == null) { return workbenchWindow != null ? workbenchWindow.getShell() : null; } Control control = (Control) model.getWidget(); if (control != null && !control.isDisposed()) { return control.getShell(); } if (e4Context == null) { WorkbenchPlugin.log(new IllegalStateException( "IWorkbenchSite.getShell() was called after part disposal: " + this)); return PlatformUI.getWorkbench().getDisplay().getActiveShell(); } MWindow window = e4Context.get(MWindow.class); return window == null ? workbenchWindow.getShell() : (Shell) window.getWidget(); }

Target:
public Shell getShell() { Display currentDisplay = Display.getCurrent(); if (currentDisplay == null) { return getWorkbenchWindow().getShell(); } Control control = (Control) model.getWidget(); if (control != null && !control.isDisposed()) { return control.getShell(); } if (e4Context == null) { WorkbenchPlugin.log(new IllegalStateException( "IWorkbenchSite.getShell() was called after part disposal: " + this)); return PlatformUI.getWorkbench().getDisplay().getActiveShell(); } MWindow window = e4Context.get(MWindow.class); return window == null ? getWorkbenchWindow().getShell() : (Shell) window.getWidget(); }
Source:
private void initButtons(){ bGrad = new JRadioButton(I18N.tr("")); bPal = new JRadioButton(""); bGrad.addActionListener( EventHandler.create(ActionListener.class, this, "onClickGrad")); bPal.addActionListener( EventHandler.create(ActionListener.class, this, "onClickPal")); bPal.setSelected(true); ButtonGroup bg = new ButtonGroup(); bg.add(bGrad); bg.add(bPal); onClickPal(); }

Target:
private void initButtons(){ bGrad = new JRadioButton(""); bPal = new JRadioButton(""); bGrad.addActionListener( EventHandler.create(ActionListener.class, this, "onClickGrad")); bPal.addActionListener( EventHandler.create(ActionListener.class, this, "onClickPal")); bPal.setSelected(true); ButtonGroup bg = new ButtonGroup(); bg.add(bGrad); bg.add(bPal); onClickPal(); }
Source:
private void tearDown() { try { processDestroyer.clean(); tmpDir.dispose(); } catch (IOException e) { throw new UncheckedIOException(e); } catch (InterruptedException e) { e.printStackTrace(System.err); } }

Target:
private void tearDown() throws IOException { try { processDestroyer.clean(); } catch (InterruptedException e) { e.printStackTrace(System.err); } }
Source:
private ComputeEngineCredentials( HttpTransportFactory transportFactory, Collection<String> scopes) { this.transportFactory = firstNonNull( transportFactory, getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); this.scopes = (scopes == null) ? ImmutableSet.<String>of() : ImmutableSet.copyOf(scopes); }

Target:
private ComputeEngineCredentials( HttpTransportFactory transportFactory, Collection<String> scopes) { this.transportFactory = firstNonNull( transportFactory, getFromServiceLoader(HttpTransportFactory.class, OAuth2Utils.HTTP_TRANSPORT_FACTORY)); this.transportFactoryClassName = this.transportFactory.getClass().getName(); if (scopes == null) { this.scopes = ImmutableSet.<String>of(); } else { List<String> scopeList = new ArrayList<String>(scopes); scopeList.removeAll(Arrays.asList("", null)); this.scopes = ImmutableSet.<String>copyOf(scopeList); } }
Source:
private long getMemoryAlreadyBeingRevoked(Collection<SqlTask> sqlTasks, MemoryPool memoryPool) { AtomicLong memoryAlreadyBeingRevoked = new AtomicLong(); sqlTasks.stream() .filter(task -> task.getTaskInfo().getTaskStatus().getState() == TaskState.RUNNING) .filter(task -> task.getQueryContext().getMemoryPool() == memoryPool) .forEach(task -> task.getQueryContext().accept(new TraversingQueryContextVisitor<Void, Void>() { @Override public Void visitOperatorContext(OperatorContext operatorContext, Void context) { if (operatorContext.isMemoryRevokingRequested()) { memoryAlreadyBeingRevoked.addAndGet(operatorContext.getReservedRevocableBytes()); } return null; } }, null)); return memoryAlreadyBeingRevoked.get(); }

Target:
private long getMemoryAlreadyBeingRevoked(Collection<SqlTask> sqlTasks, MemoryPool memoryPool) { return sqlTasks.stream() .filter(task -> task.getTaskInfo().getTaskStatus().getState() == TaskState.RUNNING) .filter(task -> task.getQueryContext().getMemoryPool() == memoryPool) .mapToLong(task -> task.getQueryContext().accept(new TraversingQueryContextVisitor<Void, Long>() { @Override public Long visitOperatorContext(OperatorContext operatorContext, Void context) { if (operatorContext.isMemoryRevokingRequested()) { return operatorContext.getReservedRevocableBytes(); } return 0L; } @Override public Long mergeResults(List<Long> childrenResults) { return childrenResults.stream() .mapToLong(i -> i).sum(); } }, null)) .sum(); }
Source:
private static void validateTableSource(ElideTableConfig elideTableConfig, String tableSource) { if (isNullOrEmpty(tableSource)) { return; } String[] split = tableSource.split("\\."); if (split.length != 2) { throw new IllegalStateException("Invalid tableSource: " + tableSource + ". tableSource must be in format: modelName.columnName"); } String modelName = split[0]; String fieldName = split[1]; if (!staticModelContainsField(modelName, NO_VERSION, fieldName) && !dynamicModelContainsField(elideTableConfig, modelName, fieldName)) { throw new IllegalStateException("Invalid tableSource : " + tableSource + " . Either model : " + modelName + " is undefined or field : " + fieldName + " is undefined for this model."); } }

Target:
private static void validateTableSource(ElideTableConfig elideTableConfig, String tableSource) { if (isNullOrEmpty(tableSource)) { return; } String[] split = tableSource.split("\\."); if (split.length != 2) { throw new IllegalStateException("Invalid tableSource : " + tableSource + " . " + "More than one dot(.) found, tableSource must be in format: modelName.logicalColumnName"); } String modelName = split[0]; String fieldName = split[1]; if (elideTableConfig.hasTable(modelName)) { Table table = elideTableConfig.getTable(modelName); if (!table.hasField(elideTableConfig, fieldName)) { throw new IllegalStateException("Invalid tableSource : " + tableSource + " . Field : " + fieldName + " is undefined for hjson model: " + modelName); } return; } if (isStaticModel(modelName, NO_VERSION)) { if (!staticModelHasField(modelName, NO_VERSION, fieldName)) { throw new IllegalStateException("Invalid tableSource : " + tableSource + " . Field : " + fieldName + " is undefined for non-hjson model: " + modelName); } return; } throw new IllegalStateException("Invalid tableSource : " + tableSource + " . Undefined model: " + modelName); }
Source:
public boolean equals(final Object other) { if (this == other) { return true; } if (other == null) { return false; } if (!(other instanceof ITmfTimestamp)) { return false; } final ITmfTimestamp ts = ((ITmfTimestamp) other); return (fValue == ts.getValue() && fScale == ts.getScale()); }

Target:
public boolean equals(final Object other) { if (this == other) { return true; } if (other == null) { return false; } if (!(other instanceof ITmfTimestamp)) { return false; } final ITmfTimestamp ts = (ITmfTimestamp) other; return (compareTo(ts) == 0); }
Source:
public void visitFunctionCall(FunctionCallTree tree) { String functionName = CheckUtils.getFunctionName(tree); List<ExpressionTree> arguments = tree.arguments(); if (CURL_SETOPT.equals(functionName) && arguments.size() > 2) { ExpressionTree optionArgument = arguments.get(1); if (optionArgument.is(Tree.Kind.NAMESPACE_NAME) && CURLOPT_SSL_VERIFYHOST.equals(((NamespaceNameTree) optionArgument).name().text())) { checkCURLSSLVerifyHost(getAssignedValue(arguments.get(2))); } else if (optionArgument.is(Tree.Kind.NAMESPACE_NAME) && CURLOPT_SSL_VERIFYPEER.equals(((NamespaceNameTree) optionArgument).name().text())) { checkCURLSSLVerifyPeer(getAssignedValue(arguments.get(2))); } } super.visitFunctionCall(tree); }

Target:
public void visitFunctionCall(FunctionCallTree tree) { String functionName = CheckUtils.getFunctionName(tree); List<ExpressionTree> arguments = tree.arguments(); if (CURL_SETOPT.equals(functionName) && arguments.size() > 2) { ExpressionTree optionArgument = arguments.get(1); ExpressionTree valueArgument = arguments.get(2); nameOf(optionArgument).ifPresent(name -> { if (name.equals(CURLOPT_SSL_VERIFYHOST)) { this.checkCURLSSLVerify(valueArgument, verifyHostCompliantValues); } else if (name.equals(CURLOPT_SSL_VERIFYPEER)) { this.checkCURLSSLVerify(valueArgument, verifyPeerCompliantValues); } }); } super.visitFunctionCall(tree); }
Source:
private String fetchAccessToken() { String token = StringUtils.EMPTY; try(CloseableHttpClient client = createDefault()) { HttpPost post = new HttpPost(jwtServiceConfig.getEndpoint()); post.addHeader("Cache-Control", "no-cache"); post.addHeader("Content-Type", "application/x-www-form-urlencoded"); List<BasicNameValuePair> params = Lists.newArrayList(); params.add(new BasicNameValuePair("client_id", jwtServiceConfig.getClientId())); params.add(new BasicNameValuePair("client_secret", jwtServiceConfig.getClientSecret())); params.add(new BasicNameValuePair("jwt_token", getJwtToken())); post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse response = client.execute(post); if (response.getStatusLine().getStatusCode() != 200) { LOGGER.info("response code ", response.getStatusLine().getStatusCode()); } String result = IOUtils.toString(response.getEntity().getContent()); LOGGER.info("JSON Response : {}", result); JsonParser parser = new JsonParser(); JsonObject json = parser.parse(result).getAsJsonObject(); if (json.has(JSON_ACCESS_TOKEN)) { token = json.get(JSON_ACCESS_TOKEN).getAsString(); } else { LOGGER.error("JSON does not contain an access_token"); } } catch (Exception e) { LOGGER.error(e.getMessage()); } LOGGER.info("JWT Access Token : {}", token); return token; }

Target:
private String fetchAccessToken() { String token = StringUtils.EMPTY; try(CloseableHttpClient client = helper.getHttpClient(getTimeoutinMilliSeconds())) { HttpPost post = new HttpPost(jwtServiceConfig.endpoint()); post.addHeader(CACHE_CONTRL, NO_CACHE); post.addHeader(CONTENT_TYPE, CONTENT_TYPE_URL_ENCODED); List<BasicNameValuePair> params = Lists.newArrayList(); params.add(new BasicNameValuePair(CLIENT_ID, jwtServiceConfig.clientId())); params.add(new BasicNameValuePair(CLIENT_SECRET, jwtServiceConfig.clientSecret())); params.add(new BasicNameValuePair(JWT_TOKEN, getJwtToken())); post.setEntity(new UrlEncodedFormEntity(params)); HttpResponse response = client.execute(post); if (response.getStatusLine().getStatusCode() != 200) { LOGGER.info("response code ", response.getStatusLine().getStatusCode()); } String result = IOUtils.toString(response.getEntity().getContent()); LOGGER.info("JSON Response : {}", result); JsonParser parser = new JsonParser(); JsonObject json = parser.parse(result).getAsJsonObject(); if (json.has(JSON_ACCESS_TOKEN)) { token = json.get(JSON_ACCESS_TOKEN).getAsString(); } else { LOGGER.error("JSON does not contain an access_token"); } } catch (Exception e) { LOGGER.error(e.getMessage()); } LOGGER.info("JWT Access Token : {}", token); return token; }
Source:
Korean() { NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder(); builder.add("\u00B7", "\u0020"); builder.add("\u318D", "\u0020"); builder.add("\u00AD", "\""); builder.add("\u200C", "\""); charMap = builder.build(); }

Target:
Korean() { NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder(); builder.add("\u00B7", "\u0020"); builder.add("\u318D", "\u0020"); builder.add("\u00AD", ""); builder.add("\u200C", ""); charMap = builder.build(); }
Source:
private static TimelockService getTimelockService(String client) { return RemoteTimelockServiceAdapter.create( getProxyForRootService(client, TimelockRpcClient.class), client); }

Target:
private static TimelockService getTimelockService(String client) { return RemoteTimelockServiceAdapter.create( new NamespacedTimelockRpcClient(getProxyForRootService(client, TimelockRpcClient.class), client)); }
Source:
public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNull String args, @CheckForNull String workdir, @Nonnull Map<String, String> volumes, @Nonnull Collection<String> volumesFromContainers, @Nonnull EnvVars containerEnv, @Nonnull String user, @Nonnull String... command) throws IOException, InterruptedException { ArgumentListBuilder argb = new ArgumentListBuilder("docker", "run", "-d", "-t"); if (args != null) { argb.addTokenized(args); } if (workdir != null) { argb.add("-w", workdir); } for (Map.Entry<String, String> volume : volumes.entrySet()) { argb.add("-v", volume.getKey() + ":" + volume.getValue()); } for (String containerId : volumesFromContainers) { argb.add("--volumes-from", containerId); } for (Map.Entry<String, String> variable : containerEnv.entrySet()) { argb.add("-e"); if (variable.getKey().contains("") || variable.getValue().contains(" ")) { argb.addMasked(WindowsUtil.quoteArgument(variable.getKey() + "=" + variable.getValue())); } else { argb.addMasked(variable.getKey() + "=" + variable.getValue()); } } argb.add(image).add(command); LaunchResult result = launch(launchEnv, false, null, argb); if (result.getStatus() == 0) { return result.getOut(); } else { throw new IOException(String.format("Failed to run image '%s'. Error: %s", image, result.getErr())); } }

Target:
public String run(@Nonnull EnvVars launchEnv, @Nonnull String image, @CheckForNull String args, @CheckForNull String workdir, @Nonnull Map<String, String> volumes, @Nonnull Collection<String> volumesFromContainers, @Nonnull EnvVars containerEnv, @Nonnull String user, @Nonnull String... command) throws IOException, InterruptedException { ArgumentListBuilder argb = new ArgumentListBuilder("docker", "run", "-d", "-t"); if (args != null) { argb.addTokenized(args); } if (workdir != null) { argb.add("-w", workdir); } for (Map.Entry<String, String> volume : volumes.entrySet()) { argb.add("-v", volume.getKey() + ":" + volume.getValue()); } for (String containerId : volumesFromContainers) { argb.add("--volumes-from", containerId); } for (Map.Entry<String, String> variable : containerEnv.entrySet()) { argb.add("-e"); argb.addMasked(WindowsUtil.quoteArgument(variable.getKey() + "=" + variable.getValue())); } argb.add(image).add(command); LaunchResult result = launch(launchEnv, false, null, argb); if (result.getStatus() == 0) { return result.getOut(); } else { throw new IOException(String.format("Failed to run image '%s'. Error: %s", image, result.getErr())); } }
Source:
protected void internalRefresh(E element) { Control list = getControl(); if (element == null || equals(element, getRoot())) { if (listMap != null) { listMap.clear(); } unmapAllElements(); List selection = getSelectionFromWidget(); int topIndex = -1; if (selection == null || selection.isEmpty()) { topIndex = listGetTopIndex(); } E[] children = null; list.setRedraw(false); try { listRemoveAll(); children = getSortedChildren(getRoot()); String[] items = new String[children.length]; ILabelProvider<E> labelProvider = (ILabelProvider<E>) getLabelProvider(); for (int i = 0; i < items.length; i++) { E el = children[i]; items[i] = getLabelProviderText(labelProvider, el); listMap.add(el); mapElement(el, list); } listSetItems(items); } finally { list.setRedraw(true); } if (topIndex == -1) { setSelectionToWidget(selection, false); } else { listSetTopIndex(Math.min(topIndex, children.length)); } } else { doUpdateItem(list, element, true); } }

Target:
protected void internalRefresh(E element) { Control list = getControl(); if (element == null || equals(element, getRoot())) { if (listMap != null) { listMap.clear(); } unmapAllElements(); List<E> selection = getSelectionFromWidget(); int topIndex = -1; if (selection == null || selection.isEmpty()) { topIndex = listGetTopIndex(); } E[] children = null; list.setRedraw(false); try { listRemoveAll(); children = getSortedChildren(getRoot()); String[] items = new String[children.length]; ILabelProvider<E> labelProvider = (ILabelProvider<E>) getLabelProvider(); for (int i = 0; i < items.length; i++) { E el = children[i]; items[i] = getLabelProviderText(labelProvider, el); listMap.add(el); mapElement(el, list); } listSetItems(items); } finally { list.setRedraw(true); } if (topIndex == -1) { setSelectionToWidget(selection, false); } else { listSetTopIndex(Math.min(topIndex, children.length)); } } else { doUpdateItem(list, element, true); } }
Source:
public EventDefinition(IEventDeclaration declaration, StreamInputReader streamInputReader) { this.fDeclaration = declaration; this.fStreamInputReader = streamInputReader; }

Target:
public EventDefinition(IEventDeclaration declaration, StreamInputReader streamInputReader) { fDeclaration = declaration; fStreamInputReader = streamInputReader; }
Source:
public void createContainerWithShmVolume() { try ( BrowserWebDriverContainer webDriverContainer = new BrowserWebDriverContainer() .withCapabilities(new FirefoxOptions()) ) { webDriverContainer.start(); assertEquals("Only one shm mount present", countCorrectlyConfiguredShmVolumes(webDriverContainer), 1L); assertEquals("No additional shm mounts present", countAnyShmVolumes(webDriverContainer), 1L); } }

Target:
public void createContainerWithShmVolume() { try ( BrowserWebDriverContainer webDriverContainer = new BrowserWebDriverContainer() .withCapabilities(new FirefoxOptions()) ) { webDriverContainer.start(); final List<InspectContainerResponse.Mount> shmVolumes = shmVolumes(webDriverContainer); assertEquals("Only one shm mount present", 1, shmVolumes.size()); assertEquals("Shm mount source is correct", "/dev/shm", shmVolumes.get(0).getSource()); assertEquals("Shm mount mode is correct", "rw", shmVolumes.get(0).getMode()); } }
Source:
private static boolean checkPortAvailability(int port) { boolean isAvailable; try (Socket socket = new Socket()) { socket.connect(new InetSocketAddress("localhost", port)); isAvailable = false; } catch (IOException e) { isAvailable = true; } return isAvailable; }

Target:
private boolean checkPortAvailability(int port) { boolean isPortAvailable; try (Socket socket = new Socket()) { socket.connect(new InetSocketAddress(synapseServer.getHost(), port)); isPortAvailable = false; } catch (IOException e) { isPortAvailable = true; } return isPortAvailable; }
Source:
public synchronized void start() { if (delayMs > 0) { handle = submit.create().startWithFixedDelay(delayMs, MILLISECONDS); } else { handle = submit.create().start(DEFAULT_DELAY_MS, MILLISECONDS); } }

Target:
public void start() { if (delay > 0) { handle = submit.create() .startWithFixedDelay(INITIAL_DELAY_S, delay, SECONDS); } else { handle = submit.create().start(INITIAL_DELAY_S, SECONDS); } }
Source:
public void clearPreferredReadReplica(TopicPartition tp) { assignedState(tp).preferredReadReplica = null; }

Target:
public Optional<Integer> clearPreferredReadReplica(TopicPartition tp) { return assignedState(tp).clearPreferredReadReplica(); }
Source:
private KafkaProducer createKafkaProducer() { Properties producerProperties = new Properties(); producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaHosts); producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, io.confluent.kafka.serializers.KafkaAvroSerializer.class); producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, io.confluent.kafka.serializers.KafkaAvroSerializer.class); producerProperties.put("schema.registry.url", schemaRegistries); kafkaProducer = new KafkaProducer(producerProperties); return kafkaProducer; }

Target:
private KafkaProducer createKafkaProducer() { Properties producerProperties = new Properties(); producerProperties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaHosts); producerProperties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, io.confluent.kafka.serializers.KafkaAvroSerializer.class); producerProperties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, io.confluent.kafka.serializers.KafkaAvroSerializer.class); producerProperties.put(KafkaAvroSerializerConfig.SCHEMA_REGISTRY_URL_CONFIG, schemaRegistries); return new KafkaProducer(producerProperties); }
Source:
public static List<MediaModel> getPendingMediaForPost(PostModel postModel) { for (UploadingPost uploadingPost : sPostsWithPendingMedia) { if (uploadingPost.postModel.getId() == postModel.getId()) { return uploadingPost.pendingMedia; } } return null; }

Target:
public static @NonNull List<MediaModel> getPendingMediaForPost(PostModel postModel) { for (UploadingPost uploadingPost : sPostsWithPendingMedia) { if (uploadingPost.postModel.getId() == postModel.getId()) { return uploadingPost.pendingMedia; } } return Collections.emptyList(); }
Source:
public Target getTarget() { return thingIfApi.getTarget(); }

Target:
public Target getTarget() { return this.thingIfApi.getTarget(); }
Source:
public FeedbackResponseCommentRow buildFeedbackResponseCommentFormForAdding(FeedbackQuestionAttributes question, String responseId, String giverName, String recipientName, ZoneId timezone, boolean isCommentFromFeedbackParticipant) { FeedbackResponseCommentAttributes frca = FeedbackResponseCommentAttributes .builder(question.courseId, question.feedbackSessionName, "", new Text("")) .withFeedbackResponseId(responseId) .withFeedbackQuestionId(question.getFeedbackQuestionId()) .withCommentFromFeedbackParticipant(isCommentFromFeedbackParticipant) .build(); if (isCommentFromFeedbackParticipant) { frca.commentGiverType = question.giverType; } else { frca.commentGiverType = FeedbackParticipantType.INSTRUCTORS; } frca.showCommentTo = new ArrayList<>(); frca.showGiverNameTo = new ArrayList<>(); FeedbackParticipantType[] relevantTypes = { FeedbackParticipantType.GIVER, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.OWN_TEAM_MEMBERS, FeedbackParticipantType.RECEIVER_TEAM_MEMBERS, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.INSTRUCTORS }; for (FeedbackParticipantType type : relevantTypes) { if (isResponseCommentVisibleTo(question, type)) { frca.showCommentTo.add(type); } if (isResponseCommentGiverNameVisibleTo(question, type)) { frca.showGiverNameTo.add(type); } } return new FeedbackResponseCommentRow(frca, giverName, recipientName, getResponseCommentVisibilityString(question), getResponseCommentGiverNameVisibilityString(question), getResponseVisibilityMap(question), timezone); }

Target:
public FeedbackResponseCommentRow buildFeedbackResponseCommentFormForAdding(FeedbackQuestionAttributes question, String responseId, String giverName, String recipientName, ZoneId timezone, boolean isCommentFromFeedbackParticipant) { FeedbackResponseCommentAttributes frca = FeedbackResponseCommentAttributes .builder(question.courseId, question.feedbackSessionName, "", new Text("")) .withFeedbackResponseId(responseId) .withFeedbackQuestionId(question.getFeedbackQuestionId()) .withCommentFromFeedbackParticipant(isCommentFromFeedbackParticipant) .build(); frca.showCommentTo = new ArrayList<>(); frca.showGiverNameTo = new ArrayList<>(); FeedbackParticipantType[] relevantTypes = { FeedbackParticipantType.GIVER, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.OWN_TEAM_MEMBERS, FeedbackParticipantType.RECEIVER_TEAM_MEMBERS, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.INSTRUCTORS }; for (FeedbackParticipantType type : relevantTypes) { if (isResponseCommentVisibleTo(question, type)) { frca.showCommentTo.add(type); } if (isResponseCommentGiverNameVisibleTo(question, type)) { frca.showGiverNameTo.add(type); } } return new FeedbackResponseCommentRow(frca, giverName, recipientName, getResponseCommentVisibilityString(question), getResponseCommentGiverNameVisibilityString(question), getResponseVisibilityMap(question), timezone); }
Source:
public SpaceBetweenAlphabeticalWordValidator() { super("forbidden", false, "skip_before_chars", "", "skip_after_chars", ""); }

Target:
public SpaceBetweenAlphabeticalWordValidator() { super("forbidden", false, "skip_before", "", "skip_after", ""); }
Source:
private BasicDocumentRevision updateDocument(SQLDatabase db,String docId, String prevRevId, final DocumentBody body, boolean validateBody, boolean copyAttachments) throws ConflictException, AttachmentException { Preconditions.checkState(this.isOpen(), "Database is closed"); Preconditions.checkArgument(!Strings.isNullOrEmpty(docId), "Input document id can not be empty"); Preconditions.checkArgument(!Strings.isNullOrEmpty(prevRevId), "Input previous revision id can not be empty"); Preconditions.checkNotNull(body, "Input document body can not be null"); if (validateBody) { this.validateDBBody(body); } CouchUtils.validateRevisionId(prevRevId); try { BasicDocumentRevision preRevision = this.getDocumentInQueue(db, docId, prevRevId); if (!preRevision.isCurrent()) { throw new ConflictException("Revision to be updated is not current revision."); } this.setCurrent(db, preRevision, false); String newRevisionId = this.insertNewWinnerRevision(db, body, preRevision, copyAttachments); return this.getDocumentInQueue(db, preRevision.getId(), newRevisionId); } catch (DocumentNotFoundException e){ throw new IllegalArgumentException("The document trying to update does not exist."); } }

Target:
private BasicDocumentRevision updateDocument(SQLDatabase db,String docId, String prevRevId, final DocumentBody body, boolean validateBody, boolean copyAttachments) throws ConflictException, AttachmentException, DocumentNotFoundException, DatastoreException { Preconditions.checkState(this.isOpen(), "Database is closed"); Preconditions.checkArgument(!Strings.isNullOrEmpty(docId), "Input document id can not be empty"); Preconditions.checkArgument(!Strings.isNullOrEmpty(prevRevId), "Input previous revision id can not be empty"); Preconditions.checkNotNull(body, "Input document body can not be null"); if (validateBody) { this.validateDBBody(body); } CouchUtils.validateRevisionId(prevRevId); BasicDocumentRevision preRevision = this.getDocumentInQueue(db, docId, prevRevId); if (!preRevision.isCurrent()) { throw new ConflictException("Revision to be updated is not current revision."); } this.setCurrent(db, preRevision, false); String newRevisionId = this.insertNewWinnerRevision(db, body, preRevision, copyAttachments); return this.getDocumentInQueue(db, preRevision.getId(), newRevisionId); }
Source:
private static List<FeedRange> toFeedRanges( Utils.ValueHolder<List<PartitionKeyRange>> partitionKeyRangeListValueHolder) { final List<PartitionKeyRange> partitionKeyRangeList = partitionKeyRangeListValueHolder.v; if (partitionKeyRangeList == null) { throw new IllegalStateException("PartitionKeyRange list cannot be null"); } List<FeedRange> feedRanges = new ArrayList<FeedRange>(); partitionKeyRangeList.forEach(pkRange -> { feedRanges.add(toFeedRange(pkRange)); }); return feedRanges; }

Target:
private static List<FeedRange> toFeedRanges( Utils.ValueHolder<List<PartitionKeyRange>> partitionKeyRangeListValueHolder) { final List<PartitionKeyRange> partitionKeyRangeList = partitionKeyRangeListValueHolder.v; if (partitionKeyRangeList == null) { throw new IllegalStateException("PartitionKeyRange list cannot be null"); } List<FeedRange> feedRanges = new ArrayList<FeedRange>(partitionKeyRangeList.size()); partitionKeyRangeList.forEach(pkRange -> { feedRanges.add(toFeedRange(pkRange)); }); return feedRanges; }