auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { if (!configuration.getGitHubConfiguration().containsKey(oldBranch.getHost())) { LOG.warn("No git host configured for {}/{}/{}#{} marking as inactive", oldBranch.getHost(), oldBranch.getOrganization(), oldBranch.getRepository(), oldBranch.getBranch()); branchService.delete(oldBranch); return; } GitHubConfiguration githubConfiguration = configuration.getGitHubConfiguration().get(oldBranch.getHost()); GHRepository ghRepository; try { ghRepository = gitHubHelper.repositoryFor(oldBranch); } catch (IOException e) { LOG.error("Caught exception while trying to find in github", oldBranch, e); throw new RuntimeException(e); } String oldRepoOrg = oldBranch.getOrganization(); String oldRepoName = oldBranch.getRepository(); String newRepoName = ghRepository.getName(); String newRepoOrg = ghRepository.getOwnerName(); boolean orgIsConfigured = githubConfiguration.getOrganizations().contains(newRepoOrg); boolean orgNameChanged = !oldRepoOrg.equals(newRepoOrg); boolean repoNameChanged = !oldRepoName.equals(newRepoName); <START> if (orgNameChanged || repoNameChanged || orgIsConfigured != oldBranch.isActive()) { <END> GitInfo updatedBranch = updateBranch(oldBranch, newRepoOrg, newRepoName, orgIsConfigured); LOG.info("Branch has changed updating to {}", oldBranch, updatedBranch); branchService.upsert(updatedBranch); } }</code><technical_language>if (orgNameChanged || repoNameChanged || !orgIsConfigured) { boolean active = orgIsConfigured; GitInfo updatedBranch = updateBranch(oldBranch, newRepoOrg, newRepoName, active);</technical_language>

Target:
public void run() { if (!configuration.getGitHubConfiguration().containsKey(oldBranch.getHost())) { LOG.warn("No git host configured for {}/{}#{} marking as inactive", oldBranch.getHost(), oldBranch.getFullRepositoryName(), oldBranch.getBranch()); branchService.delete(oldBranch); return; } GitHubConfiguration githubConfiguration = configuration.getGitHubConfiguration().get(oldBranch.getHost()); GHRepository ghRepository; try { ghRepository = gitHubHelper.repositoryFor(oldBranch); } catch (IOException e) { LOG.error("Caught exception while trying to find in github", oldBranch, e); throw new RuntimeException(e); } if (ghRepository.getId() != oldBranch.getRepositoryId()) { LOG.warn("A repository with a different github id has replaced {}. Considering {}#{} as deleted ", ghRepository.getId(), oldBranch, oldBranch.getFullRepositoryName(), oldBranch.getBranch()); branchService.delete(oldBranch); return; } String oldRepoOrg = oldBranch.getOrganization(); String oldRepoName = oldBranch.getRepository(); String newRepoName = ghRepository.getName(); String newRepoOrg = ghRepository.getOwnerName(); boolean orgIsConfigured = githubConfiguration.getOrganizations().contains(newRepoOrg); boolean orgNameChanged = !oldRepoOrg.equals(newRepoOrg); boolean repoNameChanged = !oldRepoName.equals(newRepoName); if (orgNameChanged || repoNameChanged || !orgIsConfigured) { boolean active = orgIsConfigured; GitInfo updatedBranch = updateBranch(oldBranch, newRepoOrg, newRepoName, active); LOG.info("Branch has changed updating to {}", oldBranch, updatedBranch); branchService.upsert(updatedBranch); } }
Source:
<code>PinotErrorCode(int code, ErrorType type) { <START> errorCode = new ErrorCode(code + 0x0505_0000, name(), type); <END> }</code><technical_language>find next seq number in 1XX range (<LINK_0></technical_language>

Target:
PinotErrorCode(int code, ErrorType type) { errorCode = new ErrorCode(code + 0x0106_0000, name(), type); }
Source:
<code>private boolean causeIsPleaseHold(Throwable e) { if (e instanceof PleaseHoldException) return true; if (e instanceof TableNotEnabledException) return true; if (e instanceof RegionOfflineException) return true; if (e instanceof RetriesExhaustedException || e instanceof SocketTimeoutException) { if (e.getCause() instanceof RemoteException) { RemoteException re = (RemoteException) e.getCause(); if (PleaseHoldException.class.getName().equals(re.getClassName())) return true; } return (e.getCause() instanceof IOException && e.getCause().getCause() instanceof CallTimeoutException) || <START> e.getCause() instanceof RemoteWithExtrasException; <END> } return false; }</code><technical_language>condition general, if is RemoteWithExtrasException assume Master is initialized inspect caused RemoteWithExtrasException. case is condition handling</technical_language>

Target:
private boolean causeIsPleaseHold(Throwable e) { if (e instanceof PleaseHoldException) return true; if (e instanceof TableNotEnabledException) return true; if (e instanceof RegionOfflineException) return true; if (e instanceof RetriesExhaustedException || e instanceof SocketTimeoutException) { if (e.getCause() instanceof RemoteException) { RemoteException re = (RemoteException) e.getCause(); if (PleaseHoldException.class.getName().equals(re.getClassName())) return true; } return (e.getCause() instanceof IOException && e.getCause().getCause() instanceof CallTimeoutException) || (e.getCause() instanceof RemoteWithExtrasException && e.getMessage().equals( "Table Namespace Manager not fully initialized, try again later")); } return false; }
Source:
<code>protected List<MovePath> GenerateAllPaths(MovePath mp) { List<MovePath> altitudePaths = AeroPathUtil.generateValidAltitudeChanges(mp); List<MovePath> fullMovePaths = new ArrayList<>(); for(MovePath altitudePath : altitudePaths) { fullMovePaths.addAll(super.GenerateAllPaths(altitudePath.clone())); } List<MovePath> fullMovePathsWithTurns = new ArrayList<>(); <START> for(MovePath movePath : fullMovePaths) { <END> fullMovePathsWithTurns.add(movePath); MoveStep lastStep = movePath.getLastStep(); if(lastStep != null && lastStep.canAeroTurn(game)) { MovePath left = movePath.clone(); left.addStep(MoveStepType.TURN_LEFT); fullMovePathsWithTurns.add(left); MovePath right = movePath.clone(); right.addStep(MoveStepType.TURN_RIGHT); fullMovePathsWithTurns.add(right); } } return fullMovePathsWithTurns; }</code><technical_language>suggestion for (MovePath movePath : fullMovePaths) {</technical_language>

Target:
protected List<MovePath> GenerateAllPaths(MovePath mp) { List<MovePath> altitudePaths = AeroPathUtil.generateValidAltitudeChanges(mp); List<MovePath> fullMovePaths = new ArrayList<>(); for(MovePath altitudePath : altitudePaths) { fullMovePaths.addAll(super.GenerateAllPaths(altitudePath.clone())); } List<MovePath> fullMovePathsWithTurns = new ArrayList<>(); for (MovePath movePath : fullMovePaths) { fullMovePathsWithTurns.add(movePath); MoveStep lastStep = movePath.getLastStep(); if ((lastStep != null) && lastStep.canAeroTurn(game)) { MovePath left = movePath.clone(); left.addStep(MoveStepType.TURN_LEFT); fullMovePathsWithTurns.add(left); MovePath right = movePath.clone(); right.addStep(MoveStepType.TURN_RIGHT); fullMovePathsWithTurns.add(right); } } return fullMovePathsWithTurns; }
Source:
<code>private Set<GhprbTrigger> getTriggers(String repoName, String body, String signature) { <START> final Set<GhprbTrigger> triggers = new HashSet<GhprbTrigger>(5); <END> Authentication old = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM); try { for (AbstractProject<?, ?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) { GhprbTrigger trigger = job.getTrigger(GhprbTrigger.class); if (trigger == null || !(trigger.matchRepo(repoName) && trigger.matchSignature(body, signature))) { continue; } triggers.add(trigger); } } finally { SecurityContextHolder.getContext().setAuthentication(old); } if (triggers.isEmpty()) { logger.log(Level.WARNING, "No projects found using GitHub pull request trigger"); } return triggers; }</code><technical_language>fantastic. implications threading, addition removal of triggers jobs, etc.? is map date? I want a multi hash map repo name -> triggers</technical_language>

Target:
private Set<GhprbTrigger> getTriggers(String repoName, String body, String signature) { Set<GhprbTrigger> triggers = new HashSet<GhprbTrigger>(); Set<AbstractProject<?, ?>> projects = GhprbTrigger.getDscp().getRepoTriggers(repoName); if (projects != null) { for (AbstractProject<?, ?> project : projects) { GhprbTrigger trigger = Ghprb.extractTrigger(project); if (trigger.matchSignature(body, signature)) { triggers.add(trigger); } } } return triggers; }
Source:
<code>public void creationOf${bindingIdCamelCase}Handler() { assertThat(bridge.getHandler(), is(nullValue())); managedThingProvider.add(bridge); <START> waitForAssert(() -> assertThat(bridge.getHandler(), notNullValue())); <END> }</code><technical_language>wrote is(nullValue()) above, is(notNullValue()) here? if _is_ required, imho symmetrical least</technical_language>

Target:
public void creationOf${bindingIdCamelCase}Handler() { assertThat(bridge.getHandler(), is(nullValue())); managedThingProvider.add(bridge); waitForAssert(() -> assertThat(bridge.getHandler(), is(notNullValue()))); }
Source:
<code>private void safeShutdown(ExecutorDriver driver) { if (jmxConnect != null) { try { jmxConnect.close(); } catch (Exception ignores) { } jmxConnect = null; } if (process != null) { try { process.destroy(); } catch (Exception ignores) { } process = null; <START> healthCheck(driver); <END> } serverTaskStatusOutstanding = false; serverTask = null; }</code><technical_language>is motivation for sending a healthcheck message shutting server. "shut down" "unhealthy" in scenario scheduler asked process shut down</technical_language>

Target:
private void safeShutdown(ExecutorDriver driver) { if (jmxConnect != null) { try { jmxConnect.close(); } catch (Exception ignores) { } jmxConnect = null; } if (process != null) { try { process.destroy(); } catch (Exception ignores) { } process = null; healthCheck(driver); } serverTask = null; }
Source:
<code>public void testQueryCpuLimit() throws Exception { <START> ImmutableMap<String, String> properties = ImmutableMap.of("query.max-cpu-time", "1ms"); <END> try (DistributedQueryRunner queryRunner = createQueryRunner(properties)) { QueryId queryId = createQuery(queryRunner, TEST_SESSION, "SELECT COUNT(*) FROM lineitem"); waitForQueryState(queryRunner, queryId, FAILED); QueryManager queryManager = queryRunner.getCoordinator().getQueryManager(); QueryInfo queryInfo = queryManager.getQueryInfo(queryId); assertEquals(queryInfo.getState(), FAILED); assertEquals(queryInfo.getErrorCode(), EXCEEDED_CPU_LIMIT.toErrorCode()); } }</code><technical_language>nit: Map</technical_language>

Target:
public void testQueryCpuLimit() throws Exception { Map<String, String> properties = ImmutableMap.of("query.max-cpu-time", "1ms"); try (DistributedQueryRunner queryRunner = createQueryRunner(properties)) { QueryId queryId = createQuery(queryRunner, TEST_SESSION, "SELECT COUNT(*) FROM lineitem"); waitForQueryState(queryRunner, queryId, FAILED); QueryManager queryManager = queryRunner.getCoordinator().getQueryManager(); QueryInfo queryInfo = queryManager.getQueryInfo(queryId); assertEquals(queryInfo.getState(), FAILED); assertEquals(queryInfo.getErrorCode(), EXCEEDED_CPU_LIMIT.toErrorCode()); } }
Source:
<code>public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (module instanceof AbstractCheck || module instanceof AstFilter) { final AutomaticBean bean = (AutomaticBean) module; bean.contextualize(childContext); bean.configure(childConf); if (module instanceof AbstractCheck) { final AbstractCheck check = (AbstractCheck) module; check.init(); registerCheck(check); } else { final AstFilter filter = (AstFilter) module; filters.add(filter); } } else { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" <START> + " documentation if Check is standard."); <END> } }</code><technical_language>restore empty line</technical_language>

Target:
public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (module instanceof AutomaticBean) { final AutomaticBean bean = (AutomaticBean) module; bean.contextualize(childContext); bean.configure(childConf); } if (module instanceof AbstractCheck) { final AbstractCheck check = (AbstractCheck) module; check.init(); registerCheck(check); } else if (module instanceof TreeWalkerFilter) { final TreeWalkerFilter filter = (TreeWalkerFilter) module; filters.add(filter); } else { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Check is standard."); } }
Source:
<code>public List<? extends Action> visit(final Image img) { List<Action> lst = new ArrayList<>(); try { lst.add(new ExtractUnallocAction( NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.action.extUnallocToSingleFiles"), img)); } catch (NoCurrentCaseException ex) { Logger.getLogger(ExplorerNodeActionVisitor.class.getName()).log(Level.WARNING, "Exception while getting open case.", ex); <START> } <END> return lst; }</code><technical_language>This a SEVERE error, a WARNING. If traversing a tree of nodes is open case, is a programming error. reserve of WARNING for inability read of a file due image corruption, etc. related database current case is SEVERE</technical_language>

Target:
public List<? extends Action> visit(final Image img) { List<Action> lst = new ArrayList<>(); try { lst.add(new ExtractUnallocAction( NbBundle.getMessage(this.getClass(), "ExplorerNodeActionVisitor.action.extUnallocToSingleFiles"), img)); } catch (NoCurrentCaseException ex) { Logger.getLogger(ExplorerNodeActionVisitor.class.getName()).log(Level.SEVERE, "Exception while getting open case.", ex); } return lst; }
Source:
<code>public void commit() throws TransactionException { final MessagingTransaction transaction = getCurrentTransaction(); logger.trace("Committing transaction: " + transaction.transactionId()); transaction.applyActions(messageSender); currentTransaction.remove(); <START> logger.trace("Transaction successfully commit: " + transaction.transactionId()); <END> }</code><technical_language>Replace 'commit' 'committed'</technical_language>

Target:
public void commit() throws TransactionException { final MessagingTransaction transaction = getCurrentTransaction(); logger.trace("Committing transaction: " + transaction.transactionId()); transaction.applyActions(messageSender); currentTransaction.remove(); logger.trace("Transaction successfully committed: " + transaction.transactionId()); }
Source:
<code>public long getNextId() { long timestamp = timeProvider.getTimeInMillis(); synchronized(syncObject) { <START> if (lastTimestamp < timestamp) { <END> sequence = 0L; lastTimestamp = timestamp; return buildKey(timestamp, workerId, sequence); } timestamp = lastTimestamp; sequence = ((sequence + 1) & sequenceBitMask); if (0L == sequence) { log.info("Requesting unique IDs faster than we can make them; busy-waiting. workerId = " + workerId); while (lastTimestamp >= timestamp) { timestamp = timeProvider.getTimeInMillis(); if ((lastTimestamp - timestamp) > maxWaitForClockCatchupInMilliseconds) { throw new IllegalStateException("Clock too far behind, not bothering to catch up " + (lastTimestamp - timestamp) + "ms"); } } lastTimestamp = timestamp; } return buildKey(timestamp, workerId, sequence); } }</code><technical_language>I 'prevTimestamp' a name. "Last" is ambiguous - wrong interpretations possible</technical_language>

Target:
public long getNextId() { long timestamp = timeProvider.getTimeInMillis(); synchronized(syncObject) { if (prevTimestamp < timestamp) { sequence = 0L; prevTimestamp = timestamp; return buildKey(timestamp, workerId, sequence); } timestamp = prevTimestamp; sequence = ((sequence + 1) & sequenceBitMask); if (0L == sequence) { timestamp++; log.info("Cheating, advancing timestamp by 1ms. workerId = " + workerId); prevTimestamp = timestamp; } return buildKey(timestamp, workerId, sequence); } }
Source:
<code>private List<Project> getVisibleProjects(IProgressMonitor monitor, GerritConfig gerritConfig) throws GerritException { List<Project> result = new ArrayList<Project>(); try { <START> getProjectDetails(monitor, gerritConfig, result); <END> } catch (GerritException e) { if (isNoSuchServiceError(e)) { addProjectsWhenNoSuchService(monitor, gerritConfig, result); } else { throw e; } } Collections.sort(result, new ProjectByNameComparator()); return result; }</code><technical_language>consider making getProjectDetails return List <ProjectDetailsX>, keeping lines 361-365 of original file in this method. This way, avoid code duplication</technical_language>

Target:
private List<Project> getVisibleProjects(IProgressMonitor monitor, GerritConfig gerritConfig) throws GerritException { List<Project> result = new ArrayList<Project>(); try { for (ProjectDetailX projectDetail : getProjectDetails(monitor, gerritConfig, result)) { if (!GerritUtil.isPermissionOnlyProject(projectDetail, gerritConfig)) { result.add(projectDetail.project); } } } catch (GerritException e) { if (isNoSuchServiceError(e)) { addProjectsWhenNoSuchService(monitor, gerritConfig, result); } else { throw e; } } Collections.sort(result, new ProjectByNameComparator()); return result; }
Source:
<code>public void testParceling() { LinkAddress l; l = new LinkAddress(V6_ADDRESS, 64, 123, 456); assertParcelingIsLossless(l); l = new LinkAddress(V4 + "/28", IFA_F_PERMANENT, RT_SCOPE_LINK); assertParcelingIsLossless(l); <START> } <END></code><technical_language>do want assertFieldCountEquals here</technical_language>

Target:
public void testParceling() { LinkAddress l; l = new LinkAddress(V6_ADDRESS, 64, 123, 456); assertParcelingIsLossless(l); l = new LinkAddress(V4 + "/28", IFA_F_PERMANENT, RT_SCOPE_LINK); assertParcelingIsLossless(l); assertFieldCountEquals(4, LinkAddress.class); }
Source:
<code>protected void addJAROption(Composite comp) { fJarButton = new Button(comp, SWT.CHECK); fJarButton.setText(getJarButtonText()); <START> fJarButton.addSelectionListener(widgetSelectedAdapter(e -> { <END> })); }</code><technical_language>This do anything. removed</technical_language>

Target:
protected void addJAROption(Composite comp) { fJarButton = new Button(comp, SWT.CHECK); fJarButton.setText(getJarButtonText()); }
Source:
<code>public void validate_catchAllViolationErrorsAndThrowAnMrrtReportTemplateException() throws Exception { String templateContent = getFileContent( "mrrttemplates/ihe/connectathon/2015/invalidMrrtReportTemplate-missingCharsetTitleTemplateAttributesBodyElements.html"); try { <START> validator.validate(templateContent); <END> } catch (MrrtReportTemplateValidationException e) { assertThat(e.getValidationResult() .getErrors() .size(), is(4)); } }</code><technical_language>necessary. idiom is ok. add fail()</technical_language>

Target:
public void validate_catchAllViolationErrorsAndThrowAnMrrtReportTemplateException() throws Exception { String templateContent = getFileContent( "mrrttemplates/ihe/connectathon/2015/invalidMrrtReportTemplate-missingCharsetTitleTemplateAttributesBodyElements.html"); try { validator.validate(templateContent); fail("Expected an MrrtReportTemplateValidationException to be thrown"); } catch (MrrtReportTemplateValidationException e) { assertThat(e.getValidationResult() .getErrors() .size(), is(4)); } }
Source:
<code>public boolean equals(Object obj) <START> { <END> if (obj == null) { return false; } return super.equals(obj); }</code><technical_language>U want consider id in equals hashCode</technical_language>

Target:
public boolean equals(Object obj) { if (obj == null || !(obj instanceof GlusterGeoRepSessionConfiguration)) { return false; } if (!super.equals(obj)) { return false; } return ObjectUtils.objectsEqual(getId(), ((GlusterGeoRepSessionConfiguration) obj).getId()); }
Source:
<code><START> public void testStereotypeLabelDepth(View label) { <END> Assert.assertTrue("Label is a decoration Node", label instanceof DecorationNode); String depth = helper.getDepth((DecorationNode) label); Assert.assertEquals("The Depth is not the one expected", "none", depth); String minDepth = helper.getMinimumDepthName(stereotype.getQualifiedName()); Assert.assertEquals("The minimum depth is not the one expected ", "stereoA", minDepth); String fullName = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "full"); Assert.assertEquals("Label with depth full is not the one expected", PROFILE_NAME + "::" + STEREO_A, fullName); String noneDepthName = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "none"); Assert.assertEquals("Label with depth none is not the one expected", "stereoA", noneDepthName); String minusName = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "-1"); Assert.assertEquals("Label with depth -1 is not the one expected", STEREO_A, minusName); String outOfBoundsDepth = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "25"); Assert.assertEquals("Label with depth 25 is not the one expected", PROFILE_NAME + "::" + STEREO_A, outOfBoundsDepth); String outOfBoundsDepth2 = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "-17"); Assert.assertEquals("Label with depth -17 is not the one expected", STEREO_A, outOfBoundsDepth2); }</code><technical_language>Rename this method (Or set visibility protected/private) avoid confusion actual test methods In Junit < 4.0, convention is public methods named "testX" actual test methods</technical_language>

Target:
private void testStereotypeLabelDepth(View label) { Assert.assertTrue("Label is a decoration Node", label instanceof DecorationNode); String depth = helper.getDepth((DecorationNode) label); Assert.assertEquals("The Depth is not the one expected", "none", depth); String minDepth = helper.getMinimumDepthName(stereotype.getQualifiedName()); Assert.assertEquals("The minimum depth is not the one expected ", "stereoA", minDepth); String fullName = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "full"); Assert.assertEquals("Label with depth full is not the one expected", PROFILE_NAME + "::" + STEREO_A, fullName); String noneDepthName = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "none"); Assert.assertEquals("Label with depth none is not the one expected", "stereoA", noneDepthName); String minusName = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "-1"); Assert.assertEquals("Label with depth -1 is not the one expected", STEREO_A, minusName); String outOfBoundsDepth = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "25"); Assert.assertEquals("Label with depth 25 is not the one expected", PROFILE_NAME + "::" + STEREO_A, outOfBoundsDepth); String outOfBoundsDepth2 = helper.getStereotypeNameWithDepth(stereotype.getQualifiedName(), "-17"); Assert.assertEquals("Label with depth -17 is not the one expected", STEREO_A, outOfBoundsDepth2); }
Source:
<code>public OptionalInt getCooldown(final ItemType type) { <START> checkNotNull(type, "Item type cannot be null!"); <END> final CooldownTracker.Cooldown cooldown = this.cooldowns.get((Item) type); if (cooldown != null) { final int remainingCooldown = cooldown.expireTicks - this.ticks; if (remainingCooldown > 0) { return OptionalInt.of(remainingCooldown); } } return OptionalInt.empty(); }</code><technical_language>sanity checking ItemType is instanceof Item. some corner cases ItemType in ItemTypes properly mapped. point, safely properly return proper description instead of a ClassCastException</technical_language>

Target:
public OptionalInt getCooldown(final ItemType type) { checkNotNull(type, "Item type cannot be null!"); isItem(type); final CooldownTracker.Cooldown cooldown = this.cooldowns.get((Item) type); if (cooldown != null) { final int remainingCooldown = cooldown.expireTicks - this.ticks; if (remainingCooldown > 0) { return OptionalInt.of(remainingCooldown); } } return OptionalInt.empty(); }
Source:
<code>private void afterPutStackInSlots(CallbackInfoReturnable<Boolean> cir, IInventory iInventory, EnumFacing enumFacing, int i, ItemStack itemStack, ItemStack itemStack1) { <START> itemStack1 = EventUtil.handleTransferPost(((TileEntityHopper)(Object) this), i, itemStack, iInventory, itemStack1); <END> }</code><technical_language>variable assignment matter?\</technical_language>

Target:
private void afterPutStackInSlots(CallbackInfoReturnable<Boolean> cir, IInventory iInventory, EnumFacing enumFacing, int i, ItemStack itemStack, ItemStack itemStack1) { if (itemStack1.isEmpty()) { IMixinInventory capture = forCapture(this); Inventory source = toInventory(this); SpongeCommonEventFactory.captureTransaction(capture, source, i, itemStack); if (SpongeCommonEventFactory.callTransferPost(capture, source, toInventory(iInventory))) { itemStack1 = itemStack; } } }
Source:
<code>public BatchBuilder<K, T> add(K key, BatchEntry<T> entry) { <START> BatchEntry<T> duplicate = _map.get(key); <END> if (duplicate != null) { Promises.propagateResult(duplicate.getPromise(), entry.getPromise()); duplicate.addShallowTraceBuilders(entry.getShallowTraceBuilders()); } else { _map.put(key, entry); } return this; }</code><technical_language>_map.put(key)</technical_language>

Target:
BatchBuilder<K, T> add(K key, BatchEntry<T> entry) { if (_batch != null) { throw new IllegalStateException("BatchBuilder has already been used to build a batch"); } BatchEntry<T> duplicate = _map.get(key); if (duplicate != null) { Promises.propagateResult(duplicate.getPromise(), entry.getPromise()); duplicate.addShallowTraceBuilders(entry.getShallowTraceBuilders()); } else { _map.put(key, entry); } return this; }
Source:
<code>@Test public void testJavaSqlDateColumnReference() throws SQLException { try ( Connection connection = DriverManager.getConnection("jdbc:calcite:"); CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class) ) { final SchemaPlus rootSchema = calciteConnection.getRootSchema(); final JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType rowType = typeFactory.createStructType( Arrays.asList( typeFactory.createJavaType(java.sql.Date.class), typeFactory.createJavaType(java.sql.Time.class), typeFactory.createJavaType(java.sql.Timestamp.class) ), Arrays.asList("dt", "tm", "ts") ); final Enumerable<Object[]> enumerable = Linq4j.asEnumerable( Collections.singletonList(new Object[]{ java.sql.Date.valueOf("2018-12-14"), java.sql.Time.valueOf("18:29:34"), java.sql.Timestamp.valueOf("2018-12-14 18:29:34.123")})); final Table table = new AbstractQueryableTable(Object[].class) { @SuppressWarnings({"unchecked", "rawtypes"}) @Override public Queryable<Object[]> asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) { return EnumerableDefaults.asOrderedQueryable(enumerable); } @Override public RelDataType getRowType(RelDataTypeFactory typeFactory) { return rowType; } }; rootSchema.add("java_sql_date_types", table); final Statement statement = connection.createStatement(); String sql = "select extract(year from \"dt\")," + " extract(hour from \"tm\")," + " extract(day from \"ts\") from \"java_sql_date_types\""; ResultSet resultSet = statement.executeQuery(sql); assertTrue(resultSet.next()); <START> assertEquals(2018, resultSet.getInt(1)); <END> assertEquals(0, resultSet.getInt(2)); assertEquals(14, resultSet.getInt(3)); } }</code><technical_language>please add a message assertEquals? Assert failure a decent bug report, current assertEquals(2018, resultSet.getInt(1)); produce expected 2018 0. other "message" parameter: able nature of bug error message+stacktrace only</technical_language>

Target:
@Test public void testJavaSqlDateColumnReference() throws SQLException { withJavaSqlDateTypes(connection -> { final Statement statement = connection.createStatement(); String sql = "select extract(year from \"dt\")," + " extract(hour from \"tm\")," + " extract(day from \"ts\")" + " from \"java_sql_date_types\""; ResultSet resultSet = statement.executeQuery(sql); assertTrue(resultSet.next()); assertEquals("extract(year from java.sql.Date.valueOf(\"2018-12-14\"))", 2018, resultSet.getInt(1)); assertEquals("extract(hour from java.sql.Time.valueOf(\"18:29:34\"))", 18, resultSet.getInt(2)); assertEquals("extract(day from" + " java.sql.Timestamp.valueOf(\"2018-12-14 18:29:34.123\"))", 14, resultSet.getInt(3)); }); }
Source:
<code><START> public Repository call() throws JGitInternalException { <END> try { File file; if (directory == null) file = new File(bare ? "." : Constants.DOT_GIT); else file = new File(directory); RepositoryBuilder builder = new RepositoryBuilder(); builder.readEnvironment(); builder.setGitDir(file); if (bare) builder.setBare(); builder.findGitDir(); Repository repository = builder.build(); return repository; } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }</code><technical_language>Instead of returning Repository, return a Git. Git object is ready caller</technical_language>

Target:
public Git call() throws JGitInternalException { try { RepositoryBuilder builder = new RepositoryBuilder(); if (bare) builder.setBare(); builder.readEnvironment(); if (directory != null) { File d = new File(directory); if (!bare) d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } else if (builder.getGitDir() == null) { File d = new File("."); if (!bare) d = new File(d, Constants.DOT_GIT); builder.setGitDir(d); } builder.findGitDir(); Repository repository = builder.build(); repository.create(bare); return new Git(repository); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } }
Source:
<code><START> public void testNestedColumn() { <END> final String sql = "select HOME_ADDRESS.ZIP from SALES.EMP_ADDRESS where HOME_ADDRESS.CITY = 'abc'"; sql(sql).ok(); }</code><technical_language>SqlToRelConverterTest is a good place. move tests here. this new test bring significant in comparison previous I suggest remove it</technical_language>

Target:
public void testNestedColumn() { final String sql = "select home_address.zip from sales.emp_address where home_address.city = 'abc'"; sql(sql).ok(); }
Source:
<code>protected synchronized void preTrackingEventMethod() { <START> } <END></code><technical_language>do synchronized empty method</technical_language>

Target:
protected void preTrackingEventMethod() { }
Source:
<code>public void testCanBeSatisfiedBy() { final NetworkRequest request = new NetworkRequest.Builder() .setCapabilities(TEST_CAPABILITIES) .build(); assertFalse(request.canBeSatisfiedBy(null)); assertFalse(request.canBeSatisfiedBy(new NetworkCapabilities())); assertTrue(request.canBeSatisfiedBy(TEST_CAPABILITIES.addCapability(NET_CAPABILITY_MMS))); <START> assertEquals(request.canBeSatisfiedBy(new NetworkCapabilities()), TEST_CAPABILITIES.satisfiedByNetworkCapabilities(new NetworkCapabilities())); <END> }</code><technical_language>nit: test case return is true</technical_language>

Target:
public void testCanBeSatisfiedBy() { final NetworkRequest request = new NetworkRequest.Builder() .setCapabilities(TEST_CAPABILITIES) .build(); assertFalse(request.canBeSatisfiedBy(null)); assertFalse(request.canBeSatisfiedBy(new NetworkCapabilities())); assertTrue(request.canBeSatisfiedBy(TEST_CAPABILITIES.addCapability(NET_CAPABILITY_MMS))); assertEquals(request.canBeSatisfiedBy(TEST_CAPABILITIES), TEST_CAPABILITIES.satisfiedByNetworkCapabilities(TEST_CAPABILITIES)); }
Source:
<code><START> public Serializable retrieveConfigurationObjects(final DlmsDeviceMessageMetadata messageMetadata, <END> final RetrieveConfigurationObjectsRequest request) throws OsgpException, ProtocolAdapterException { LnClientConnection conn = null; try { final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata); conn = this.dlmsConnectionFactory.getConnection(device); final Serializable response = this.retrieveConfigurationObjectsCommandExecutor.execute(conn, device, null); return response; } finally { if (conn != null) { conn.close(); } } }</code><technical_language>![MAJOR](<LINK_1> Remove unused method parameter(s) "request". [![rule](<LINK_2>](<LINK_3> ![MAJOR](<LINK_1> Refactor this method throw checked exception instead of: com.alliander.osgp.shared.exceptionhandling.OsgpException, org.osgp.adapter.protocol.dlms.exceptions.ProtocolAdapterException [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public Serializable retrieveConfigurationObjects(final DlmsDeviceMessageMetadata messageMetadata, final RetrieveConfigurationObjectsRequest request) throws OsgpException, ProtocolAdapterException { LnClientConnection conn = null; try { final DlmsDevice device = this.domainHelperService.findDlmsDevice(messageMetadata); conn = this.dlmsConnectionFactory.getConnection(device); return this.retrieveConfigurationObjectsCommandExecutor.execute(conn, device, null); } finally { if (conn != null) { conn.close(); } } }
Source:
<code>public double getY1() { <START> return y1; <END> }</code><technical_language>This access attribute is forbidden coding rules. Compiler says: return x1; ^^ Unqualified access field BasicPathShadow2afp.CoordinatesParam.x1 add this. prefix</technical_language>

Target:
public double getY1() { return this.y1; }
Source:
<code>public ICPPExecution getExecution() { <START> if(retValue instanceof ICPPASTInitializerClause) { <END> ICPPASTInitializerClause initClause = (ICPPASTInitializerClause)retValue; return new ExecReturn(initClause.getEvaluation()); } return ExecIncomplete.INSTANCE; }</code><technical_language>ICPPEvaluationOwner</technical_language>

Target:
public ICPPExecution getExecution() { if(retValue instanceof ICPPEvaluationOwner) { ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)retValue; return new ExecReturn(evalOwner.getEvaluation()); } return ExecIncomplete.INSTANCE; }
Source:
<code>public void testJSONFormat() throws IOException { Format format = Format.JSON; final String[] command = new String[] { "--format", format.getName(), "--no-color", "--only=upper-camel-case", inputFile.getPath() }; List<Map<String, Object>> violations = new ArrayList<>(); for (ViolationMessage msg : getExpectedMsgs()) { Map<String, Object> violation = new HashMap<>(); Map<String, Object> location = new HashMap<>(); location.put(Messages.LINE_KEY, msg.getLineNumber()); location.put(Messages.COLUMN_KEY, msg.getColumnNumber()); violation.put(Messages.LOCATION_KEY, location); violation.put(Messages.SEVERITY_KEY, msg.getSeverity().toString()); violation.put(Messages.RULE_KEY, Rules.UPPER_CAMEL_CASE.getName()); violation.put(Messages.MESSAGE_KEY, msg.getMessage()); violations.add(violation); } <START> Map<String, Object> file = new HashMap<>(); <END> file.put(Messages.PATH_KEY, ""); file.put(Messages.PARSED_KEY, true); file.put(Messages.VIOLATIONS_KEY, violations); List<Object> files = new ArrayList<>(); files.add(file); Map<String, Object> expectedOutput = new LinkedHashMap<>(); expectedOutput.put(Messages.FILES_KEY, files); expectedOutput.put(Messages.SUMMARY_KEY, getJSONSummary(1, 0, 0, 22)); Tailor.main(command); String[] msgs = outContent.toString(Charset.defaultCharset().name()).split(NEWLINE_REGEX); List<String> expected = new ArrayList<>(); List<String> actual = new ArrayList<>(); expectedMessages.addAll( Arrays.asList((GSON.toJson(expectedOutput) + System.lineSeparator()).split(NEWLINE_REGEX))); for (String msg : expectedMessages) { String strippedMsg = msg.replaceAll(inputFile.getCanonicalPath(), ""); expected.add(strippedMsg); } for (String msg : msgs) { String strippedMsg = msg.replaceAll(inputFile.getCanonicalPath(), ""); actual.add(strippedMsg); } assertArrayEquals(outContent.toString(Charset.defaultCharset().name()), expected.toArray(), actual.toArray()); }</code><technical_language>break this block of code smaller sections adding newlines in - readability</technical_language>

Target:
public void testJSONFormat() throws IOException { Format format = Format.JSON; final String[] command = new String[] { "--format", format.getName(), "--no-color", "--only=upper-camel-case", inputFile.getPath() }; Map<String, Object> expectedOutput = getJSONMessages(); Tailor.main(command); String[] msgs = outContent.toString(Charset.defaultCharset().name()).split(NEWLINE_REGEX); List<String> expected = new ArrayList<>(); List<String> actual = new ArrayList<>(); expectedMessages.addAll( Arrays.asList((GSON.toJson(expectedOutput) + System.lineSeparator()).split(NEWLINE_REGEX))); for (String msg : expectedMessages) { String strippedMsg = msg.replaceAll(inputFile.getCanonicalPath(), ""); expected.add(strippedMsg); } for (String msg : msgs) { String strippedMsg = msg.replaceAll(inputFile.getCanonicalPath(), ""); actual.add(strippedMsg); } assertArrayEquals(outContent.toString(Charset.defaultCharset().name()), expected.toArray(), actual.toArray()); }
Source:
<code>@Test public void cacheMiss() throws IOException { enableCache(); server.enqueue(new MockResponse() .setBody("abc")); Call call = client.newCall(new Request.Builder() .url(server.url("/")) .build()); Response response = call.execute(); assertThat(response.code()).isEqualTo(200); assertThat(response.body().string()).isEqualTo("abc"); response.close(); assertThat(listener.recordedEventTypes()).containsExactly("CallStart", "ProxySelectStart", "ProxySelectEnd", "DnsStart", "DnsEnd", "ConnectStart", "ConnectEnd", "ConnectionAcquired", "RequestHeadersStart", <START> "RequestHeadersEnd", "ResponseHeadersStart", "ResponseHeadersEnd", "CacheMiss", <END> "ResponseBodyStart", "ResponseBodyEnd", "ConnectionReleased", "CallEnd"); }</code><technical_language>I cache miss in wrong place here? cache miss occurred proxy selection. (only a conditional miss occurs response headers?)</technical_language>

Target:
@Test public void cacheMiss() throws IOException { enableCache(); server.enqueue(new MockResponse() .setBody("abc")); Call call = client.newCall(new Request.Builder() .url(server.url("/")) .build()); Response response = call.execute(); assertThat(response.code()).isEqualTo(200); assertThat(response.body().string()).isEqualTo("abc"); response.close(); assertThat(listener.recordedEventTypes()).containsExactly("CallStart", "CacheMiss", "ProxySelectStart", "ProxySelectEnd", "DnsStart", "DnsEnd", "ConnectStart", "ConnectEnd", "ConnectionAcquired", "RequestHeadersStart", "RequestHeadersEnd", "ResponseHeadersStart", "ResponseHeadersEnd", "ResponseBodyStart", "ResponseBodyEnd", "ConnectionReleased", "CallEnd"); }
Source:
<code>@Test public void doFillCredentialsIdItemsWithoutJobWhenAdmin() throws Exception { r.jenkins.setSecurityRealm(r.createDummySecurityRealm()); MockAuthorizationStrategy as = new MockAuthorizationStrategy(); r.jenkins.setAuthorizationStrategy(as); UsernamePasswordCredentialsImpl c = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, null, "test", "bob", "s3cr3t"); CredentialsProvider.lookupStores(r.jenkins).iterator().next().addCredentials(Domain.global(), c); <START> ListBoxModel options = r.jenkins.getDescriptorByType(MercurialSCM.DescriptorImpl.class).doFillCredentialsIdItems(null, "<LINK_0>"); <END> assertEquals(CredentialsNameProvider.name(c), options.get(1).name); }</code><technical_language>need ACL.impersonate. checking SYSTEM, bypassing *all* permission checks</technical_language>

Target:
@Test public void doFillCredentialsIdItemsWithoutJobWhenAdmin() throws Exception { r.jenkins.setSecurityRealm(r.createDummySecurityRealm()); ProjectMatrixAuthorizationStrategy as = new ProjectMatrixAuthorizationStrategy(); as.add(Jenkins.ADMINISTER, "alice"); r.jenkins.setAuthorizationStrategy(as); final UsernamePasswordCredentialsImpl c = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, null, "test", "bob", "s3cr3t"); CredentialsProvider.lookupStores(r.jenkins).iterator().next().addCredentials(Domain.global(), c); ACL.impersonate(User.get("alice").impersonate(), new Runnable() { @Override public void run() { ListBoxModel options = r.jenkins.getDescriptorByType(MercurialSCM.DescriptorImpl.class).doFillCredentialsIdItems(null, "<LINK_0>"); assertEquals(CredentialsNameProvider.name(c), options.get(1).name); } }); }
Source:
<code>public static JobStatus postReplaceGeoFile(URI uri, SocrataConnectionInfo connectionInfo, UserPreferences userPrefs) { HttpUtility httpUtility = new HttpUtility(userPrefs, true, 3, 2); JobStatus status = JobStatus.SUCCESS; try { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpEntity empty = MultipartEntityBuilder.create().build(); HttpResponse response = httpUtility.post(uri,empty); HttpEntity resEntity = response.getEntity(); String result = EntityUtils.toString(resEntity); JSONParser parser = new JSONParser(); JSONObject resJson = (JSONObject) parser.parse(result); logging.log(Level.INFO, result); boolean error = (boolean) resJson.get("error"); if(error) { JobStatus s = JobStatus.PUBLISH_ERROR; String error_message = (String) resJson.get("message"); s.setMessage(error_message); return s; } ticket = resJson.get("ticket").toString(); try { logging.log(Level.INFO,"Polling for Status..."); status = pollForStatus(ticket, userPrefs,connectionInfo,false); } catch (InterruptedException e) { throw new RuntimeException(e); } } catch (IOException | ParseException e) { String message = e.getMessage(); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } <START> return status; <END> }</code><technical_language>re: returns</technical_language>

Target:
public static JobStatus postReplaceGeoFile(URI uri, SocrataConnectionInfo connectionInfo, UserPreferences userPrefs) { HttpUtility httpUtility = new HttpUtility(userPrefs, true, 3, 2); JobStatus status = JobStatus.SUCCESS; try { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpEntity empty = MultipartEntityBuilder.create().build(); HttpResponse response = httpUtility.post(uri,empty); HttpEntity resEntity = response.getEntity(); String result = EntityUtils.toString(resEntity); JSONParser parser = new JSONParser(); JSONObject resJson = (JSONObject) parser.parse(result); logging.log(Level.INFO, result); boolean error = (boolean) resJson.get("error"); if (error) { JobStatus s = JobStatus.PUBLISH_ERROR; String error_message = (String) resJson.get("message"); s.setMessage(error_message); return s; } ticket = resJson.get("ticket").toString(); try { logging.log(Level.INFO,"Polling for Status..."); status = pollForStatus(ticket, userPrefs,connectionInfo,false); return status; } catch (InterruptedException e) { throw new RuntimeException(e); } } catch (IOException | ParseException e) { String message = e.getMessage(); JobStatus s = JobStatus.PUBLISH_ERROR; s.setMessage(message); return s; } }
Source:
<code>private void addAuthInfo(String username, String password, String userProperty, String passwordProperty) { ICredentialsStore credentialsStore = getCredentialsStore(); if (userProperty.equals(getKeyPrefix(AuthenticationType.REPOSITORY) + USERNAME)) { this.setProperty(userProperty, username); } else { String oldUserValue = credentialsStore.get(userProperty, ""); credentialsStore.put(userProperty, username, false); <START> if ((oldUserValue != null && !oldUserValue.equals(username)) || (oldUserValue == null && username != null)) { <END> notifyChangeListeners(userProperty, oldUserValue, username); } } String oldPasswordValue = credentialsStore.get(passwordProperty, ""); credentialsStore.put(passwordProperty, password, true); if ((oldPasswordValue != null && !oldPasswordValue.equals(password)) || (oldPasswordValue == null && password != null)) { notifyChangeListeners(passwordProperty, oldPasswordValue, password); } }</code><technical_language>Objects.equals</technical_language>

Target:
private void addAuthInfo(String username, String password, String userProperty, String passwordProperty) { ICredentialsStore credentialsStore = getCredentialsStore(); if (userProperty.equals(getKeyPrefix(AuthenticationType.REPOSITORY) + USERNAME)) { this.setProperty(userProperty, username); } else { String oldUserValue = credentialsStore.get(userProperty, ""); credentialsStore.put(userProperty, username, false); if (!Objects.equal(oldUserValue, username)) { notifyChangeListeners(userProperty, oldUserValue, username); } } String oldPasswordValue = credentialsStore.get(passwordProperty, ""); credentialsStore.put(passwordProperty, password, true); if (!Objects.equal(oldPasswordValue, password)) { notifyChangeListeners(passwordProperty, "", ""); } }
Source:
<code>private static String getModuleTags(final Module module) { <START> if (module == null) { throw new IllegalArgumentException("ModuleMarkupScraper:getModuleTags() - Module must be valid."); } <END> return StandardModuleExtension.booleanPropertySet().stream() .filter(ext -> ext.isProvidedBy(module)) .map(StandardModuleExtension::getKey) .collect(Collectors.joining(", ")); }</code><technical_language>Making of Guava lib this simplified suggestion Preconditions.checkNotNull(module, "ModuleMarkupScraper:getModuleTags() - Module valid."); module name in stack trace if null check fails, enough do suggestion Preconditions.checkNotNull(module);</technical_language>

Target:
private static String getModuleTags(final Module module) { Preconditions.checkNotNull(module); return StandardModuleExtension.booleanPropertySet().stream() .filter(ext -> ext.isProvidedBy(module)) .map(StandardModuleExtension::getKey) .collect(Collectors.joining(", ")); }
Source:
<code>public List<CellWithTimestamp> getTimestamps( TableReference tableRef, List<byte[]> rowsAscending, int limit) { String preparedSelQuery = String.format("SELECT key, column1, column2 FROM %s WHERE key = ? LIMIT %d;", quotedTableName(tableRef).getValue(), limit); ByteBuffer queryBytes = ByteBuffer.wrap(preparedSelQuery.getBytes(StandardCharsets.UTF_8)); <START> CqlPreparedResult preparedResult = queryExecutor.prepare(queryBytes, Compression.NONE); <END> int queryId = preparedResult.getItemId(); List<CellWithTimestamp> result = Lists.newArrayList(); Iterator<byte[]> rows = rowsAscending.iterator(); while (result.size() < limit && rows.hasNext()) { CqlResult cqlResult = queryExecutor.executePrepared(queryId, ImmutableList.of(ByteBuffer.wrap(rows.next()))); result.addAll(CqlExecutorImpl.getCells(CqlExecutorImpl::getCellFromRow, cqlResult)); } return result; }</code><technical_language>prepare execute CassandraClient - Cassandra distribute prepared statements default. If Cassandra node restarts prepare execute statements, lose prepared statements. extreme scenario, this happen prepare execute statements. If a Cassandra node execute a statement about, I throw a InvalidRequestException (complete guess - test this). surround execute statement try-catch. retry prepare execute. some interesting knowledge prepared statements here: <LINK_0></technical_language>

Target:
public List<CellWithTimestamp> getTimestamps( TableReference tableRef, List<byte[]> rowsAscending, int limit) { String preparedSelQuery = String.format("SELECT key, column1, column2 FROM %s WHERE key = ? LIMIT %d;", quotedTableName(tableRef).getValue(), limit); ByteBuffer queryBytes = ByteBuffer.wrap(preparedSelQuery.getBytes(StandardCharsets.UTF_8)); CqlPreparedResult preparedResult = queryExecutor.prepare(queryBytes, rowsAscending.get(0), Compression.NONE); int queryId = preparedResult.getItemId(); List<CellWithTimestamp> result = Lists.newArrayList(); Iterator<byte[]> rows = rowsAscending.iterator(); while (result.size() < limit && rows.hasNext()) { CqlResult cqlResult = queryExecutor.executePrepared(queryId, ImmutableList.of(ByteBuffer.wrap(rows.next()))); result.addAll(CqlExecutorImpl.getCells(CqlExecutorImpl::getCellFromRow, cqlResult)); } return result; }
Source:
<code>protected ToolSection findParentSection(Collection<EObject> selection) { Option<EObject> toolsection; for (EObject tool : selection) { toolsection = new EObjectQuery(tool).getFirstAncestorOfType(ToolPackage.eINSTANCE.getToolSection()); <START> if (toolsection.get() instanceof ToolSection) { <END> return (ToolSection) toolsection.get(); } } return null; }</code><technical_language>do a toolSection.some() in test, EObjectQuery.getFirstAncestorOfTypeContract is give Option element of asked type inside</technical_language>

Target:
protected ToolSection findParentSection(Collection<EObject> selection) { Option<EObject> toolsection; for (EObject tool : selection) { toolsection = new EObjectQuery(tool).getFirstAncestorOfType(ToolPackage.eINSTANCE.getToolSection()); if (toolsection.some()) { return (ToolSection) toolsection.get(); } } return null; }