auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String getPid() { try { StreamTokenizer toks = new StreamTokenizer(new FileReader("/proc/self/stat")); toks.parseNumbers(); if (toks.nextToken() != StreamTokenizer.TT_NUMBER) { System.out.println("Failed to tokenize /proc/self/stat correctly. First token isn't a number"); return "-1"; } return Integer.toString((int)toks.nval); } catch (Exception e) { System.out.println("Failed to get pid! " + e); e.printStackTrace(System.out); return "-1"; } }

Target:
public String getPid() { try { StreamTokenizer toks = new StreamTokenizer(new FileReader("/proc/self/stat")); toks.parseNumbers(); if (toks.nextToken() != StreamTokenizer.TT_NUMBER) { System.out.println("Failed to tokenize /proc/self/stat correctly. " + "First token isn't a number"); return "-1"; } return Integer.toString((int)toks.nval); } catch (Exception e) { System.out.println("Failed to get pid! " + e); e.printStackTrace(System.out); return "-1"; } }
Source:
public void run() { Executor executor = ExecutorService.getSingleton().getExecutor(RecurringTasksExecutor.class, 1); SaneAsyncTask<Void> task = new SaneAsyncTask<Void>(executor) { @Override public Void performTask() throws Throwable { RecurringTask[] allTasks = new RecurringTask[] { new RemoteConfigRefreshTask(app), new SharedImageCleanupTask(app), new DailyEventTask(app) }; for (RecurringTask task: allTasks) { task.runIfNecessary(); } if (WikipediaApp.getInstance().getReleaseType() == RELEASE_ALPHA) { new AlphaUpdateChecker(app).runIfNecessary(); } return null; } }; task.execute(); }

Target:
public void run() { Executor executor = ExecutorService.getSingleton().getExecutor(RecurringTasksExecutor.class, 1); SaneAsyncTask<Void> task = new SaneAsyncTask<Void>(executor) { @Override public Void performTask() throws Throwable { RecurringTask[] allTasks = new RecurringTask[] { new RemoteConfigRefreshTask(app), new SharedImageCleanupTask(app), new DailyEventTask(app) }; for (RecurringTask task: allTasks) { task.runIfNecessary(); } if (WikipediaApp.getInstance().isAlphaRelease()) { new AlphaUpdateChecker(app).runIfNecessary(); } return null; } }; task.execute(); }
Source:
void onTrackDeselected(@NonNull PlayerWrapper player, @NonNull TrackInfo trackInfo) { if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE) { for (int i = 0; i < mSubtitleTracks.size(); i++) { if (mSubtitleTracks.get(i).equals(trackInfo)) { mSelectedSubtitleTrackIndex = -1; continue; } } if (mSettingsMode == SETTINGS_MODE_SUBTITLE_TRACK) { mSubSettingsAdapter.setCheckPosition(mSelectedSubtitleTrackIndex + 1); } mSubtitleButton.setImageDrawable( mResources.getDrawable(R.drawable.ic_subtitle_off)); mSubtitleButton.setContentDescription( mResources.getString(R.string.mcv2_cc_is_off)); } }

Target:
void onTrackDeselected(@NonNull PlayerWrapper player, @NonNull TrackInfo trackInfo) { if (player != mPlayer) return; if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE) { for (int i = 0; i < mSubtitleTracks.size(); i++) { if (mSubtitleTracks.get(i).equals(trackInfo)) { mSelectedSubtitleTrackIndex = -1; if (mSettingsMode == SETTINGS_MODE_SUBTITLE_TRACK) { mSubSettingsAdapter.setCheckPosition(mSelectedSubtitleTrackIndex + 1); } mSubtitleButton.setImageDrawable( mResources.getDrawable(R.drawable.ic_subtitle_off)); mSubtitleButton.setContentDescription( mResources.getString(R.string.mcv2_cc_is_off)); break; } } } }
Source:
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); if (orgNameChanged || repoNameChanged || orgIsConfigured != oldBranch.isActive()) { GitInfo updatedBranch = updateBranch(oldBranch, newRepoOrg, newRepoName, orgIsConfigured); LOG.info("Branch has changed updating to {}", oldBranch, updatedBranch); branchService.upsert(updatedBranch); } }

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:
PinotErrorCode(int code, ErrorType type) { errorCode = new ErrorCode(code + 0x0505_0000, name(), type); }

Target:
PinotErrorCode(int code, ErrorType type) { errorCode = new ErrorCode(code + 0x0106_0000, name(), type); }
Source:
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; } return false; }

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:
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; }

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:
private Set<GhprbTrigger> getTriggers(String repoName, String body, String signature) { final Set<GhprbTrigger> triggers = new HashSet<GhprbTrigger>(5); 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; }

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:
public void creationOf${bindingIdCamelCase}Handler() { assertThat(bridge.getHandler(), is(nullValue())); managedThingProvider.add(bridge); waitForAssert(() -> assertThat(bridge.getHandler(), notNullValue())); }

Target:
public void creationOf${bindingIdCamelCase}Handler() { assertThat(bridge.getHandler(), is(nullValue())); managedThingProvider.add(bridge); waitForAssert(() -> assertThat(bridge.getHandler(), is(notNullValue()))); }
Source:
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); } serverTaskStatusOutstanding = false; serverTask = null; }

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:
public void testQueryCpuLimit() throws Exception { ImmutableMap<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()); } }

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:
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" + " documentation if Check is standard."); } }

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:
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); } return lst; }

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:
private CallInformation(Tuple actualParameters, PQuery referredQuery, final Set<Integer> bindings, Map<PVariable, Integer> variableMapping) { this.referredQuery = referredQuery; int keySize = actualParameters.getSize(); List<Integer> parameterMaskIndices = new ArrayList<>(); int[] fullParameterMaskIndices = new int[keySize]; for (int i = 0; i < keySize; i++) { PParameter symbolicParameter = referredQuery.getParameters().get(i); PVariable parameter = (PVariable) actualParameters.get(i); Integer originalFrameIndex = variableMapping.get(parameter); mapping.put(symbolicParameter, originalFrameIndex); fullParameterMaskIndices[i] = originalFrameIndex; if (bindings.contains(originalFrameIndex)) { parameterMaskIndices.add(originalFrameIndex); adornment.add(symbolicParameter); } } thinFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), parameterMaskIndices); fullFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), fullParameterMaskIndices); int[] boundParameterIndices = new int[adornment.size()]; int boundIndex = 0; freeParameterIndices = new int[keySize - adornment.size()]; int freeIndex = 0; for (int i = 0; i < keySize; i++) { if (bindings.contains(variableMapping.get(actualParameters.get(i)))) { boundParameterIndices[boundIndex] = i; boundIndex++; } else { freeParameterIndices[freeIndex] = i; freeIndex++; } } parameterMask = TupleMask.fromSelectedIndices(thinFrameMask.getSize(), boundParameterIndices); matcherReference = new MatcherReference(referredQuery, adornment); }

Target:
private CallInformation(Tuple actualParameters, PQuery referredQuery, final Set<Integer> bindings, Map<PVariable, Integer> variableMapping) { this.referredQuery = referredQuery; int keySize = actualParameters.getSize(); List<Integer> parameterMaskIndices = new ArrayList<>(); int[] fullParameterMaskIndices = new int[keySize]; for (int i = 0; i < keySize; i++) { PParameter symbolicParameter = referredQuery.getParameters().get(i); PVariable parameter = (PVariable) actualParameters.get(i); Integer originalFrameIndex = variableMapping.get(parameter); mapping.put(symbolicParameter, originalFrameIndex); fullParameterMaskIndices[i] = originalFrameIndex; if (bindings.contains(originalFrameIndex)) { parameterMaskIndices.add(originalFrameIndex); adornment.add(symbolicParameter); } } thinFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), parameterMaskIndices); fullFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), fullParameterMaskIndices); int[] boundParameterIndices = new int[adornment.size()]; int boundIndex = 0; freeParameterIndices = new int[keySize - adornment.size()]; int freeIndex = 0; for (int i = 0; i < keySize; i++) { if (bindings.contains(variableMapping.get(actualParameters.get(i)))) { boundParameterIndices[boundIndex] = i; boundIndex++; } else { freeParameterIndices[freeIndex] = i; freeIndex++; } } parameterMask = TupleMask.fromSelectedIndices(keySize, boundParameterIndices); matcherReference = new MatcherReference(referredQuery, adornment); }
Source:
public void commit() throws TransactionException { final MessagingTransaction transaction = getCurrentTransaction(); logger.trace("Committing transaction: " + transaction.transactionId()); transaction.applyActions(messageSender); currentTransaction.remove(); logger.trace("Transaction successfully commit: " + transaction.transactionId()); }

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:
public long getNextId() { long timestamp = timeProvider.getTimeInMillis(); synchronized(syncObject) { if (lastTimestamp < timestamp) { 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); } }

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:
private List<Project> getVisibleProjects(IProgressMonitor monitor, GerritConfig gerritConfig) throws GerritException { List<Project> result = new ArrayList<Project>(); try { getProjectDetails(monitor, gerritConfig, result); } catch (GerritException e) { if (isNoSuchServiceError(e)) { addProjectsWhenNoSuchService(monitor, gerritConfig, result); } else { throw e; } } Collections.sort(result, new ProjectByNameComparator()); return result; }

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:
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); }

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:
protected void addJAROption(Composite comp) { fJarButton = new Button(comp, SWT.CHECK); fJarButton.setText(getJarButtonText()); fJarButton.addSelectionListener(widgetSelectedAdapter(e -> { })); }

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

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:
public boolean equals(Object obj) { if (obj == null) { return false; } return super.equals(obj); }

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:
public 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); }

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:
public OptionalInt getCooldown(final ItemType type) { checkNotNull(type, "Item type cannot be null!"); 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(); }

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:
private void afterPutStackInSlots(CallbackInfoReturnable<Boolean> cir, IInventory iInventory, EnumFacing enumFacing, int i, ItemStack itemStack, ItemStack itemStack1) { itemStack1 = EventUtil.handleTransferPost(((TileEntityHopper)(Object) this), i, itemStack, iInventory, itemStack1); }

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:
public BatchBuilder<K, T> add(K key, BatchEntry<T> entry) { 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; }

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:
@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()); assertEquals(2018, resultSet.getInt(1)); assertEquals(0, resultSet.getInt(2)); assertEquals(14, resultSet.getInt(3)); } }

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:
public Repository call() throws JGitInternalException { 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); } }

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:
public void testNestedColumn() { final String sql = "select HOME_ADDRESS.ZIP from SALES.EMP_ADDRESS where HOME_ADDRESS.CITY = 'abc'"; sql(sql).ok(); }

Target:
public void testNestedColumn() { final String sql = "select home_address.zip from sales.emp_address where home_address.city = 'abc'"; sql(sql).ok(); }
Source:
protected synchronized void preTrackingEventMethod() { }

Target:
protected void preTrackingEventMethod() { }
Source:
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(new NetworkCapabilities()), TEST_CAPABILITIES.satisfiedByNetworkCapabilities(new NetworkCapabilities())); }

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:
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); final Serializable response = this.retrieveConfigurationObjectsCommandExecutor.execute(conn, device, null); return response; } finally { if (conn != null) { conn.close(); } } }

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:
public double getY1() { return y1; }

Target:
public double getY1() { return this.y1; }
Source:
public ICPPExecution getExecution() { if(retValue instanceof ICPPASTInitializerClause) { ICPPASTInitializerClause initClause = (ICPPASTInitializerClause)retValue; return new ExecReturn(initClause.getEvaluation()); } return ExecIncomplete.INSTANCE; }

Target:
public ICPPExecution getExecution() { if(retValue instanceof ICPPEvaluationOwner) { ICPPEvaluationOwner evalOwner = (ICPPEvaluationOwner)retValue; return new ExecReturn(evalOwner.getEvaluation()); } return ExecIncomplete.INSTANCE; }
Source:
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); } Map<String, Object> file = new HashMap<>(); 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()); }

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:
@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", "RequestHeadersEnd", "ResponseHeadersStart", "ResponseHeadersEnd", "CacheMiss", "ResponseBodyStart", "ResponseBodyEnd", "ConnectionReleased", "CallEnd"); }

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:
@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); ListBoxModel options = r.jenkins.getDescriptorByType(MercurialSCM.DescriptorImpl.class).doFillCredentialsIdItems(null, "<LINK_0>"); assertEquals(CredentialsNameProvider.name(c), options.get(1).name); }

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:
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; } return status; }

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:
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 ((oldUserValue != null && !oldUserValue.equals(username)) || (oldUserValue == null && username != null)) { 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); } }

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:
private static String getModuleTags(final Module module) { if (module == null) { throw new IllegalArgumentException("ModuleMarkupScraper:getModuleTags() - Module must be valid."); } return StandardModuleExtension.booleanPropertySet().stream() .filter(ext -> ext.isProvidedBy(module)) .map(StandardModuleExtension::getKey) .collect(Collectors.joining(", ")); }

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:
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, 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; }

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:
protected ToolSection findParentSection(Collection<EObject> selection) { Option<EObject> toolsection; for (EObject tool : selection) { toolsection = new EObjectQuery(tool).getFirstAncestorOfType(ToolPackage.eINSTANCE.getToolSection()); if (toolsection.get() instanceof ToolSection) { return (ToolSection) toolsection.get(); } } return null; }

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; }