auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean assertCapacity() { if (capacity == null) { return true; } long currCapacity; do { currCapacity = capacity.get(); if (currCapacity <= 0) { boolean hasCapacity = false; <START> switch (overflowStrategy) { <END> case DROP_LATEST: break; case ERROR: if (saturated.compareAndSet(false, true)) { unsubscribe(); child.onError(new MissingBackpressureException( "Overflowed buffer of " + baseCapacity)); } break; case DROP_OLDEST: hasCapacity = poll() != null; break; } if (onOverflow != null) { onOverflow.call(); } if (!hasCapacity) { return false; } } } while (!capacity.compareAndSet(currCapacity, currCapacity - 1)); return true; }</code><technical_language>This is awesome</technical_language>

Target:
private boolean assertCapacity() { if (capacity == null) { return true; } long currCapacity; do { currCapacity = capacity.get(); if (currCapacity <= 0) { boolean hasCapacity = false; try { hasCapacity = overflowStrategy.mayAttemptDrop() && poll() != null; } catch (MissingBackpressureException e) { if (saturated.compareAndSet(false, true)) { unsubscribe(); child.onError(e); } } if (onOverflow != null) { try { onOverflow.call(); } catch (Throwable e) { Exceptions.throwIfFatal(e); manager.terminateAndDrain(e); return false; } } if (!hasCapacity) { return false; } } } while (!capacity.compareAndSet(currCapacity, currCapacity - 1)); return true; }
Source:
<code>public void get(PageModel model, @RequestParam("app") AppDescriptor app, UiSessionContext sessionContext, UiUtils ui) { model.addAttribute("afterSelectedUrl", app.getConfig().get("afterSelectedUrl").getTextValue()); model.addAttribute("heading", app.getConfig().get("heading").getTextValue()); model.addAttribute("label", app.getConfig().get("label").getTextValue()); model.addAttribute("showLastViewedPatients", app.getConfig().get("showLastViewedPatients").getBooleanValue()); <START> model.addAttribute("showRegistrationLink", app.getConfig().get("showRegistrationLink").getTextValue()); <END> BreadcrumbHelper.addBreadcrumbsIfDefinedInApp(app, model, ui); }</code><technical_language>I this is a boolean value, so</technical_language>

Target:
public void get(PageModel model, @RequestParam("app") AppDescriptor app, UiSessionContext sessionContext, UiUtils ui) { model.addAttribute("afterSelectedUrl", app.getConfig().get("afterSelectedUrl").getTextValue()); model.addAttribute("heading", app.getConfig().get("heading").getTextValue()); model.addAttribute("label", app.getConfig().get("label").getTextValue()); model.addAttribute("showLastViewedPatients", app.getConfig().get("showLastViewedPatients").getBooleanValue()); model.addAttribute("registrationAppId", app.getConfig().get("registrationAppId").getTextValue()); BreadcrumbHelper.addBreadcrumbsIfDefinedInApp(app, model, ui); }
Source:
<code>private void eraseArrowMoveFeedback(MoveArrowRequest request) { <START> arrowPositionDelta = null; <END> }</code><technical_language>I call getHost().refreshArrowDelta() (or refresh(), public) here, refresh is done if request is canceled (e.g. pressing Escape arrow-move)</technical_language>

Target:
private void eraseArrowMoveFeedback(MoveArrowRequest request) { arrowPositionDelta = null; getHost().refresh(); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(getName()); sb.append('='); <START> sb.append(formatNumber(getValue(), base)); <END> return sb.toString(); }</code><technical_language>return getName + '=' + formatNumber(getValue(), base); // trailing space nicer</technical_language>

Target:
public String toString() { return getName() + '=' + formatNumber(getValue(), base); }
Source:
<code>private void verifyRespondentInSessionRespondentsList(FeedbackSessionAttributes session, String respondentEmail, boolean isInstructor) { FeedbackSessionAttributes sessionInDb = logic.getFeedbackSession(session.getFeedbackSessionName(), session.getCourseId()); Set<String> respondingStudentList = sessionInDb.getRespondingStudentList(); <START> Set<String> respondingInstructorList = sessionInDb.getRespondingInstructorList(); <END> if (isInstructor) { assertFalse(respondingStudentList.contains(respondentEmail)); assertTrue(respondingInstructorList.contains(respondentEmail)); } else { assertTrue(respondingStudentList.contains(respondentEmail)); assertFalse(respondingInstructorList.contains(respondentEmail)); } }</code><technical_language>variable naming consistent underlying data structure, respondingStudentSet</technical_language>

Target:
private void verifyRespondentInSessionRespondentsList(FeedbackSessionAttributes session, String respondentEmail, boolean isInstructor) throws EntityDoesNotExistException { FeedbackSessionResponseStatus responseStatus = fsLogic.getFeedbackSessionResponseStatus(session.getFeedbackSessionName(), session.getCourseId()); assertFalse(responseStatus.getStudentsWhoDidNotRespond().contains(respondentEmail)); if (!isInstructor) { assertTrue(responseStatus.getStudentsWhoResponded().contains(respondentEmail)); } }
Source:
<code>public void downloadPackage(@RepositoryMapping Repository repository, @PathVariable(name = "packageName") String packageName, @PathVariable(name = "packageNameWithVersion") String packageNameWithVersion, @PathVariable(name = "packageExtension") String packageExtension, @RequestHeader HttpHeaders httpHeaders, HttpServletRequest request, HttpServletResponse response) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); if (!packageNameWithVersion.startsWith(packageName + "-")) { <START> response.setStatus(HttpServletResponse.SC_BAD_REQUEST); <END> } final String packageVersion = packageNameWithVersion.substring(packageName.length() + 1, packageNameWithVersion.length()); NpmArtifactCoordinates coordinates; try { coordinates = NpmArtifactCoordinates.of(packageName, packageVersion); } catch (IllegalArgumentException e) { response.setStatus(HttpStatus.BAD_REQUEST.value()); response.getWriter().write(e.getMessage()); return; } RepositoryPath path = artifactResolutionService.resolvePath(storageId, repositoryId, coordinates.toPath()); provideArtifactDownloadResponse(request, response, httpHeaders, path); }</code><technical_language>return;</technical_language>

Target:
public void downloadPackage(@RepositoryMapping Repository repository, @PathVariable(name = "packageName") String packageName, @PathVariable(name = "packageNameWithVersion") String packageNameWithVersion, @PathVariable(name = "packageExtension") String packageExtension, @RequestHeader HttpHeaders httpHeaders, HttpServletRequest request, HttpServletResponse response) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); if (!packageNameWithVersion.startsWith(packageName + "-")) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return; } final String packageVersion = getPackageVersion(packageNameWithVersion, packageName); NpmArtifactCoordinates coordinates; try { coordinates = NpmArtifactCoordinates.of(packageName, packageVersion); } catch (IllegalArgumentException e) { response.setStatus(HttpStatus.BAD_REQUEST.value()); response.getWriter().write(e.getMessage()); return; } RepositoryPath path = artifactResolutionService.resolvePath(storageId, repositoryId, coordinates.toPath()); provideArtifactDownloadResponse(request, response, httpHeaders, path); }
Source:
<code>public EntrezGeneIdResolver(CanonicalTranscriptResolver canonicalTranscriptResolver, EnsemblService ensemblService) { this.canonicalTranscriptResolver = canonicalTranscriptResolver; this.ensemblService = ensemblService; <START> this.hugoSymbolToEntrezGeneIdMap = ensemblService.getHugoSymbolToEntrezGeneIdMap(); <END> }</code><technical_language>remove this</technical_language>

Target:
public EntrezGeneIdResolver(CanonicalTranscriptResolver canonicalTranscriptResolver, EnsemblService ensemblService) { this.canonicalTranscriptResolver = canonicalTranscriptResolver; this.ensemblService = ensemblService; }
Source:
<code>public void updateDependentPhenotypesStatusByGeolocation(final Integer geolocation, final List<Integer> variableIds) { final List<Formula> formulaList = this.daoFactory.getFormulaDAO().getByInputIds(variableIds); if (!formulaList.isEmpty()) { final List<Integer> targetVariableIds = Lists.transform(formulaList, new Function<Formula, Integer>() { @Override public Integer apply(final Formula formula) { return formula.getTargetCVTerm().getCvTermId(); } }); <START> if (!targetVariableIds.isEmpty()) { <END> this.daoFactory.getPhenotypeDAO() .updateOutOfSyncPhenotypesByGeolocation(geolocation, Sets.newHashSet(targetVariableIds)); } } }</code><technical_language>unnecessary empty checking for targetVariableIds checked formulaList</technical_language>

Target:
public void updateDependentPhenotypesStatusByGeolocation(final Integer geolocation, final List<Integer> variableIds) { final List<Formula> formulaList = this.daoFactory.getFormulaDAO().getByInputIds(variableIds); if (!formulaList.isEmpty()) { final List<Integer> targetVariableIds = Lists.transform(formulaList, new Function<Formula, Integer>() { @Override public Integer apply(final Formula formula) { return formula.getTargetCVTerm().getCvTermId(); } }); this.daoFactory.getPhenotypeDAO() .updateOutOfSyncPhenotypesByGeolocation(geolocation, Sets.newHashSet(targetVariableIds)); } }
Source:
<code>public SafeHtml getTooltip(T object) { VmNetworkInterface vnic = null; if (object instanceof VmNetworkInterface) { vnic = (VmNetworkInterface) object; } else if (object instanceof PairQueryable && ((PairQueryable) object).getFirst() instanceof VmNetworkInterface) { vnic = ((PairQueryable<VmNetworkInterface, VM>) object).getFirst(); } StringBuilder tooltip = new StringBuilder(""); if (vnic != null && vnic.isPlugged()) { tooltip = tooltip.append(templates.cardStatus(constants.pluggedNetworkInteface()).asString()); } else { tooltip = tooltip.append(templates.cardStatus(constants.unpluggedNetworkInteface()).asString()); } <START> tooltip = tooltip.append("<BR>"); END> if (vnic.isLinked()) { tooltip = tooltip.append(templates.linkState(constants.linkedNetworkInteface()) .asString()); } else { tooltip = tooltip.append(templates.linkState(constants.unlinkedNetworkInteface()) .asString()); } return SafeHtmlUtils.fromTrustedString(tooltip.toString()); }</code><technical_language>error popped for this condition</technical_language>

Target:
public SafeHtml getTooltip(T object) { VmNetworkInterface vnic = null; if (object instanceof VmNetworkInterface) { vnic = (VmNetworkInterface) object; } else if (object instanceof PairQueryable && ((PairQueryable) object).getFirst() instanceof VmNetworkInterface) { vnic = ((PairQueryable<VmNetworkInterface, VM>) object).getFirst(); } StringBuilder tooltip = new StringBuilder(""); if (vnic != null && vnic.isPlugged()) { tooltip = tooltip.append(templates.cardStatus(constants.pluggedNetworkInteface()).asString()); } else { tooltip = tooltip.append(templates.cardStatus(constants.unpluggedNetworkInteface()).asString()); } tooltip = tooltip.append("<BR>"); if (vnic != null && vnic.isLinked()) { tooltip = tooltip.append(templates.linkState(constants.linkedNetworkInteface()) .asString()); } else { tooltip = tooltip.append(templates.linkState(constants.unlinkedNetworkInteface()) .asString()); } return SafeHtmlUtils.fromTrustedString(tooltip.toString()); }
Source:
<code>public List<String> list(String bucket, String prefix) throws IOException { if (prefix.length() > 0 && !prefix.endsWith("/")) prefix += "/"; final ListParser lp = new ListParser(bucket, prefix); do { lp.list(); } while (lp.truncated); Comparator<KeyInfo> comparator = <START> (k1, k2) -> Long.compare(k1.getLastModifiedSecs(), k2.getLastModifiedSecs()); <END> return lp.entries.stream().sorted(comparator.reversed()) .map(e -> e.getName()).collect(Collectors.toList()); }</code><technical_language>This is Comparator.comparingLong(KeyInfo::getLastModifiedSecs)</technical_language>

Target:
public List<String> list(String bucket, String prefix) throws IOException { if (prefix.length() > 0 && !prefix.endsWith("/")) prefix += "/"; final ListParser lp = new ListParser(bucket, prefix); do { lp.list(); } while (lp.truncated); Comparator<KeyInfo> comparator = Comparator.comparingLong(KeyInfo::getLastModifiedSecs); return lp.entries.stream().sorted(comparator.reversed()) .map(KeyInfo::getName).collect(Collectors.toList()); }
Source:
<code>static ScenarioResult<CurveCurrencyParameterSensitivities> bucketedPv01( TermDepositTrade trade, ExpandedTermDeposit product, CalculationMarketData marketData) { <START> return FxConvertibleList.of( <END> marketData.getScenarioCount(), i -> calculateBucketedPv01(product, marketData.scenario(i))); }</code><technical_language>explicitly calling FxConvertibleList.of, a step in usability. Previously consider currencies in result automatically converted. called toScenarioResult system checked of results wrapped in FxConvertibleList if implemented FxConvertible, a DefaultScenarioResult. a method ScenarioResult.of thing. I consider a step automatically CurrencyValuesArray values CurrencyAmount MultiCurrencyValuesArray for MultiCurrencyAmount. honest I remember I decided that, changed consider now</technical_language>

Target:
static ScenarioResult<CurveCurrencyParameterSensitivities> bucketedPv01( TermDepositTrade trade, ExpandedTermDeposit product, CalculationMarketData marketData) { return ScenarioResult.of( marketData.getScenarioCount(), i -> calculateBucketedPv01(product, marketData.scenario(i))); }
Source:
<code>public void testPostProcessing() throws Exception{ StartupProperties.get().setProperty("falcon.postprocessing.enable", "false"); OozieEntityBuilder builder = OozieEntityBuilder.get(postFeed); Path bundlePath = new Path("/projects/falcon/"); builder.build(trgCluster, bundlePath); BUNDLEAPP bundle = getBundle(trgMiniDFS.getFileSystem(), bundlePath); List<COORDINATOR> coords = bundle.getCoordinator(); COORDINATORAPP coord = getCoordinator(trgMiniDFS, coords.get(0).getAppPath()); WORKFLOWAPP workflow = getWorkflowapp(trgMiniDFS.getFileSystem(), coord); Boolean userAction = false; Boolean postProcessing = true; coord = getCoordinator(trgMiniDFS, coords.get(1).getAppPath()); for(Object action : workflow.getDecisionOrForkOrJoin()){ if (action instanceof ACTION && ((ACTION)action).getName().equals("eviction")){ userAction = true; } if (action instanceof ACTION && ((ACTION)action).getName().contains("post")){ postProcessing = false; } } assertTrue(userAction); assertTrue(postProcessing); workflow = getWorkflowapp(trgMiniDFS.getFileSystem(), coord); userAction = false; postProcessing = true; <START> for(Object action : workflow.getDecisionOrForkOrJoin()){ <END> if (action instanceof ACTION && ((ACTION)action).getName().equals("replication")){ userAction = true; } if (action instanceof ACTION && ((ACTION)action).getName().contains("post")){ postProcessing = false; } } assertTrue(userAction); assertTrue(postProcessing); StartupProperties.get().setProperty("falcon.postprocessing.enable", "true"); }</code><technical_language>iterate coords in a loop repeat this code. for eviction replication inside</technical_language>

Target:
public void testPostProcessing() throws Exception{ StartupProperties.get().setProperty("falcon.postprocessing.enable", "false"); OozieEntityBuilder builder = OozieEntityBuilder.get(feed); Path bundlePath = new Path("/projects/falcon/"); builder.build(trgCluster, bundlePath); BUNDLEAPP bundle = getBundle(trgMiniDFS.getFileSystem(), bundlePath); List<COORDINATOR> coords = bundle.getCoordinator(); COORDINATORAPP coord = getCoordinator(trgMiniDFS, coords.get(0).getAppPath()); WORKFLOWAPP workflow = getWorkflowapp(trgMiniDFS.getFileSystem(), coord); Boolean foundUserAction = false; Boolean foundPostProcessing = false; Iterator<COORDINATOR> coordIterator = coords.iterator(); while(coordIterator.hasNext()){ COORDINATORAPP coord1 = getCoordinator(trgMiniDFS, coordIterator.next().getAppPath()); WORKFLOWAPP workflow1 = getWorkflowapp(trgMiniDFS.getFileSystem(), coord1); Iterator<Object> workflowIterator = workflow1.getDecisionOrForkOrJoin().iterator(); while (workflowIterator.hasNext()){ Object object = workflowIterator.next(); if (ACTION.class.isAssignableFrom(object.getClass())){ ACTION action = (ACTION) object; if (action.getName().equals("eviction") || action.getName().equals("replication")){ foundUserAction = true; } if (action.getName().contains("post")){ foundPostProcessing = true; } } } } assertTrue(foundUserAction); assertFalse(foundPostProcessing); StartupProperties.get().setProperty("falcon.postprocessing.enable", "true"); }
Source:
<code>public void testHashMethod() { Pair<Integer,String> pair1 = new Pair<>(25, "twenty-five"); Pair<Integer,String> pair2 = new Pair<>(25, "twenty-five"); <START> Pair<Integer,String> pair3 = new Pair<>(null, null); <END> assertNotSame(pair1, pair2); assertEquals(pair1.hashCode(), pair2.hashCode()); assertNotSame(pair2, pair3); assertNotEquals(pair2.hashCode(), pair3.hashCode()); }</code><technical_language>add check case "first" is equal, "second" is vice-versa</technical_language>

Target:
public void testHashMethod() { Pair<Integer,String> pair1 = new Pair<>(25, "twenty-five"); Pair<Integer,String> pair2 = new Pair<>(25, "twenty-five"); Pair<Integer,String> pair3 = new Pair<>(null, null); Pair<Integer,String> pair4 = new Pair<>(25, "twentyfive"); Pair<Integer,String> pair5 = new Pair<>(225, "twenty-five"); assertNotSame(pair1, pair2); assertEquals(pair1.hashCode(), pair2.hashCode()); assertNotSame(pair2, pair3); assertNotEquals(pair1.hashCode(), pair4.hashCode()); assertNotEquals(pair1.hashCode(), pair5.hashCode()); }
Source:
<code>public static int reportDRConflict(int partitionId, int remoteClusterId, long remoteTimestamp, String tableName, int action, int deleteConflict, ByteBuffer existingMetaTableForDelete, ByteBuffer existingTupleTableForDelete, ByteBuffer expectedMetaTableForDelete, ByteBuffer expectedTupleTableForDelete, int insertConflict, ByteBuffer existingMetaTableForInsert, ByteBuffer existingTupleTableForInsert, ByteBuffer newMetaTableForInsert, ByteBuffer newTupleTableForInsert) { <START> if (m_conflictManager != null) { <END> return m_conflictManager.resolveConflict(partitionId, remoteClusterId, remoteTimestamp, tableName, DRRecordType.values()[action], DRConflictType.values()[deleteConflict], existingMetaTableForDelete, existingTupleTableForDelete, expectedMetaTableForDelete, expectedTupleTableForDelete, DRConflictType.values()[insertConflict], existingMetaTableForInsert, existingTupleTableForInsert, newMetaTableForInsert, newTupleTableForInsert); } else { assert false : "Community edition should not have any conflicts"; return 0; } }</code><technical_language>I this assert pushDRBuffer called if DR is active is marked active in PRO</technical_language>

Target:
public static int reportDRConflict(int partitionId, int remoteClusterId, long remoteTimestamp, String tableName, int action, int deleteConflict, ByteBuffer existingMetaTableForDelete, ByteBuffer existingTupleTableForDelete, ByteBuffer expectedMetaTableForDelete, ByteBuffer expectedTupleTableForDelete, int insertConflict, ByteBuffer existingMetaTableForInsert, ByteBuffer existingTupleTableForInsert, ByteBuffer newMetaTableForInsert, ByteBuffer newTupleTableForInsert) { assert m_conflictManager != null : "Community edition should not have any conflicts"; return m_conflictManager.resolveConflict(partitionId, remoteClusterId, remoteTimestamp, tableName, DRRecordType.values()[action], DRConflictType.values()[deleteConflict], existingMetaTableForDelete, existingTupleTableForDelete, expectedMetaTableForDelete, expectedTupleTableForDelete, DRConflictType.values()[insertConflict], existingMetaTableForInsert, existingTupleTableForInsert, newMetaTableForInsert, newTupleTableForInsert); }
Source:
<code>public Serializable execute(TaskResult... results) throws Throwable { CookieBasedProcessTreeKiller processTreeKiller = null; Process process = null; org.apache.log4j.Logger.getLogger(ProcessTree.class).setLevel(Level.DEBUG); try { ProcessBuilder builder = new ProcessBuilder(getNativeExecLauncher(false)); builder.directory(getExecutablePath(launchersDir).getParentFile().getCanonicalFile()); <START> Map<String, String> environment = builder.environment(); <END> String cookieSuffix = "JavaExecutable_Job" + getVariables().get(SchedulerVars.PA_JOB_ID) + "Task" + getVariables().get(SchedulerVars.PA_TASK_ID); if (!forkMode) { processTreeKiller = CookieBasedProcessTreeKiller.createProcessChildrenKiller(cookieSuffix, environment); } process = builder.start(); BufferedReader sout = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedReader serr = new BufferedReader(new InputStreamReader(process.getErrorStream())); Thread tsout = new Thread(new ThreadReader(sout, getOut())); Thread tserr = new Thread(new ThreadReader(serr, getErr())); tsout.setDaemon(true); tserr.setDaemon(true); tsout.start(); tserr.start(); process.waitFor(); Thread.sleep(sleep * 1000); } catch (InterruptedException e) { getOut().println("Process Interrupted"); } finally { if (processTreeKiller != null) { processTreeKiller.kill(); } } return true; }</code><technical_language>u create a private method this : private void startStream(InputStream processInput, PrintSteam printStream){ BufferedReader sout = new BufferedReader(new InputStreamReader(processInput)); Thread ts = new Thread(new ThreadReader(sout, printStream)); ts.setDaemon(true); ts.start(); } call 2 times : startStream(process.getInputStream(),System.out ); startStream(process.getErrorStream(),System.err );</technical_language>

Target:
public Serializable execute(TaskResult... results) throws Throwable { CookieBasedProcessTreeKiller processTreeKiller = null; Process process = null; org.apache.log4j.Logger.getLogger(ProcessTree.class).setLevel(Level.DEBUG); try { ProcessBuilder builder = new ProcessBuilder(getNativeExecLauncher(false)); builder.directory(getExecutablePath(launchersDir).getParentFile().getCanonicalFile()); Map<String, String> environment = builder.environment(); String cookieSuffix = "JavaExecutable_Job" + getVariables().get(SchedulerVars.PA_JOB_ID) + "Task" + getVariables().get(SchedulerVars.PA_TASK_ID); if (!forkMode) { processTreeKiller = CookieBasedProcessTreeKiller.createProcessChildrenKiller(cookieSuffix, environment); } process = builder.start(); redirectStream(process.getInputStream(), getOut()); redirectStream(process.getErrorStream(), getErr()); process.waitFor(); Thread.sleep(sleep * 1000); } catch (InterruptedException e) { getOut().println("Process Interrupted"); } finally { if (processTreeKiller != null) { processTreeKiller.kill(); } } return true; }
Source:
<code>public OvfUpdateProcessHelper(VmDeviceUtils vmDeviceUtils) { <START> Objects.requireNonNull(vmDeviceUtils); <END> this.vmDeviceUtils = vmDeviceUtils; this.ovfManager = new OvfManager(); }</code><technical_language>control clients call this class, I this validation here. If do is necessary check null validate in client calls this helper</technical_language>

Target:
public OvfUpdateProcessHelper(VmDeviceUtils vmDeviceUtils) { this.vmDeviceUtils = vmDeviceUtils; this.ovfManager = new OvfManager(); }
Source:
<code>public void onExecute() { String text = scriptPanel.getText().trim(); try { <START> groovyShell.evaluate(text); <END> infoLogger.flush(); } catch (CompilationFailedException e) { LOGGER_POPUP.error(I18N.tr("Cannot execute the script"), e); } catch (IOException e) { LOGGER_POPUP.error(I18N.tr("Cannot display the output of the console"), e); } }</code><technical_language>Catch Exception run this a SwingWorker, swing thread</technical_language>

Target:
public void onExecute() { String text = scriptPanel.getText().trim(); new GroovyExecutor(text, groovyShell, infoLogger).execute(); }
Source:
<code>public List<String> describeDatabases() { <START> QueryResult result = execute( <END> this.influxDBService.query(this.username, this.password, SHOW_DATABASE_COMMAND_ENCODED)); List<List<Object>> databaseNames = result.getResults().get(0).getSeries().get(0).getValues(); List<String> databases = new ArrayList<>(); if (databaseNames != null) { for (List<Object> database : databaseNames) { databases.add(database.get(0).toString()); } } return databases; }</code><technical_language>formatting</technical_language>

Target:
public List<String> describeDatabases() { QueryResult result = executeQuery(this.influxDBService.query(this.username, this.password, SHOW_DATABASE_COMMAND_ENCODED)); List<List<Object>> databaseNames = result.getResults().get(0).getSeries().get(0).getValues(); List<String> databases = new ArrayList<>(); if (databaseNames != null) { for (List<Object> database : databaseNames) { databases.add(database.get(0).toString()); } } return databases; }
Source:
<code>private TimedRenderer getCurrentFrame() { <START> if (frames.get(currentFrame) != null) <END> return frames.get(currentFrame); else { return new TimedRenderer() { @Override public void draw(Batch batch) { } @Override public float getHeight() { return 0; } @Override public float getWidth() { return 0; } @Override public void initialize(Object schemaObject) { } public float surplusTime() { return 0; } }; } }</code><technical_language>Frames null frames</technical_language>

Target:
private TimedRenderer getCurrentFrame() { return frames.get(currentFrame); }
Source:
<code>public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } String message = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); String commandSender = sender.getName(); if (!args[0].equalsIgnoreCase(commandSender) && !plugin.al.isSeniorAdmin(sender)) { msg("You don't have permission to assign another users login message!"); return true; } if (args[1].equalsIgnoreCase("delete")) { <START> admin.setLoginMssgae(null); <END> msg("You have deleted your login message!"); return true; } if (args[1].equalsIgnoreCase("set")) { Admin admin = plugin.al.getAdmin(sender); if (message.equalsIgnoreCase(admin.getLoginMessage())) { msg(ChatColor.RED + "The login message can't be the same as its the same as the current login message"); return true; } admin.setLoginMessage(message); msg(FUtil.colorize("The newly set login message is now " + message), ChatColor.GREEN); return true; } return false; }</code><technical_language>some typos right I believe</technical_language>

Target:
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } String message = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); String commandSender = sender.getName(); if (!args[0].equalsIgnoreCase(commandSender) && !plugin.al.isSeniorAdmin(sender)) { msg("You don't have permission to assign another users login message!"); return true; } if (args[1].equalsIgnoreCase("delete")) { admin.setLoginMessage(null); msg("You have deleted your login message!"); return true; } if (args[1].equalsIgnoreCase("set")) { Admin admin = plugin.al.getAdmin(sender); if (message.equalsIgnoreCase(admin.getLoginMessage())) { msg(ChatColor.RED + "The login message can't be the same as its the same as the current login message"); return true; } admin.setLoginMessage(message); msg(FUtil.colorize("The newly set login message is now " + message), ChatColor.GREEN); return true; } return false; }
Source:
<code>private RollingOperation getLastRollingOperation(final ZooKeeperClient client, final String groupName) throws DeploymentGroupDoesNotExistException { <START> for (final String rollingOpId : getRollingOperationIds(client, groupName)) { <END> try { final RollingOperation rolling = getRollingOperation(client, rollingOpId); return rolling; } catch (RollingOperationDoesNotExistException e) { log.warn("Rolling operation associated with deployment group does not exist", rollingOpId, groupName, e); } } return null; }</code><technical_language>Check if list is empty .get(0) instead</technical_language>

Target:
RollingOperation getLastRollingOperation(final ZooKeeperClient client, final String groupName) throws DeploymentGroupDoesNotExistException { final List<String> rollingOpIds = getRollingOperationIds(client, groupName); if (!rollingOpIds.isEmpty()) { try { return getRollingOperation(client, rollingOpIds.get(0)); } catch (RollingOperationDoesNotExistException e) { log.warn("Rolling operation associated with deployment group does not exist", rollingOpIds.get(0), groupName, e); } } return null; }
Source:
<code>public void deleteFragment(UUID fragmentId) { <START> m_db.deleteStoryFragment(fragmentId.toString()); <END> }</code><technical_language>Remove local cache. Publish</technical_language>

Target:
public void deleteFragment(UUID fragmentId) { m_db.deleteStoryFragment(fragmentId.toString()); m_fragmentList.remove(fragmentId.toString()); PublishAllFragmentsChanged(); }
Source:
<code>public static boolean equalAsMapSansNullability( RelDataTypeFactory factory, RelDataType type1, RelDataType type2) { assert isMap(type1) && isMap(type2); if (type1.equals(type2)) { return true; <START> } <END> if (isMap(type1) && isMap(type2)) { MapSqlType mType1 = (MapSqlType) type1; MapSqlType mType2 = (MapSqlType) type2; return equalSansNullability(factory, mType1.getKeyType(), mType2.getKeyType()) && equalSansNullability(factory, mType1.getValueType(), mType2.getValueType()); } else { return false; } }</code><technical_language>Remove it</technical_language>

Target:
public static boolean equalAsMapSansNullability( RelDataTypeFactory factory, RelDataType type1, RelDataType type2) { Preconditions.checkArgument(isMap(type1)); Preconditions.checkArgument(isMap(type2)); MapSqlType mType1 = (MapSqlType) type1; MapSqlType mType2 = (MapSqlType) type2; return (type1 == type2) || (equalSansNullability(factory, mType1.getKeyType(), mType2.getKeyType()) && equalSansNullability(factory, mType1.getValueType(), mType2.getValueType())); }
Source:
<code>public Collection<Class<?>> extractServiceInterfaces(Object serviceObject) { Class<?>[] interfaces = serviceObject.getClass().getInterfaces(); <START> List<Class<?>> serviceInterfaces = new ArrayList<>(); <END> for (Class<?> interfaceClass : interfaces) { if (interfaceClass.isAnnotationPresent(Service.class)) { serviceInterfaces.add(interfaceClass); } } return serviceInterfaces; }</code><technical_language>More functional variant: java Class<?>[] interfaces = serviceObject.getClass().getInterfaces(); return Arrays.stream(interfaces) .filter(interfaceClass -> interfaceClass.isAnnotationPresent(Service.class)) .collect(Collectors.toList());</technical_language>

Target:
public Collection<Class<?>> extractServiceInterfaces(Object serviceObject) { Class<?>[] interfaces = serviceObject.getClass().getInterfaces(); return Arrays.stream(interfaces) .filter(interfaceClass -> interfaceClass.isAnnotationPresent(Service.class)) .collect(Collectors.toList()); }
Source:
<code>void construct(MWindow window, MToolControl toolControl, Composite composite) { IConfigurationElement configurationElement = ControlContributionRegistry.get(toolControl .getElementId()); if (configurationElement != null) { contribution = (WorkbenchWindowControlContribution) Util.safeLoadExecutableExtension( configurationElement, IWorkbenchRegistryConstants.ATT_CLASS, WorkbenchWindowControlContribution.class); if (contribution != null) { IWorkbenchWindow workbenchWindow = window.getContext().get(IWorkbenchWindow.class); contribution.setWorkbenchWindow(workbenchWindow); if (contribution instanceof IWorkbenchContribution) { ((IWorkbenchContribution) contribution).initialize(workbenchWindow); } MUIElement parent = toolControl.getParent(); <START> while (!(parent instanceof MTrimBar)) { <END> parent = parent.getParent(); } contribution.setCurSide(SWT.TOP); if (parent instanceof MTrimBar) { switch (((MTrimBar) parent).getSide()) { case BOTTOM: contribution.setCurSide(SWT.BOTTOM); break; case LEFT: contribution.setCurSide(SWT.LEFT); break; case RIGHT: contribution.setCurSide(SWT.RIGHT); break; case TOP: contribution.setCurSide(SWT.TOP); break; } } contribution.delegateCreateControl(composite); } } }</code><technical_language>Missing parent != null check</technical_language>

Target:
void construct(MWindow window, MToolControl toolControl, Composite composite) { IConfigurationElement configurationElement = ControlContributionRegistry.get(toolControl .getElementId()); if (configurationElement != null) { contribution = (WorkbenchWindowControlContribution) Util.safeLoadExecutableExtension( configurationElement, IWorkbenchRegistryConstants.ATT_CLASS, WorkbenchWindowControlContribution.class); if (contribution != null) { IWorkbenchWindow workbenchWindow = window.getContext().get(IWorkbenchWindow.class); contribution.setWorkbenchWindow(workbenchWindow); if (contribution instanceof IWorkbenchContribution) { ((IWorkbenchContribution) contribution).initialize(workbenchWindow); } MUIElement parent = toolControl.getParent(); while (!(parent instanceof MTrimBar) && parent != null) { parent = parent.getParent(); } if (parent instanceof MTrimBar) { switch (((MTrimBar) parent).getSide()) { case BOTTOM: contribution.setCurSide(SWT.BOTTOM); break; case LEFT: contribution.setCurSide(SWT.LEFT); break; case RIGHT: contribution.setCurSide(SWT.RIGHT); break; case TOP: contribution.setCurSide(SWT.TOP); break; } } else { contribution.setCurSide(SWT.TOP); } contribution.delegateCreateControl(composite); } } }
Source:
<code>public ExpressionTree PREFIXED_BINARY_CAST() { <START> return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.PREFIXED_BINARY_CAST).is( <END> f.prefixedCastExpression( b.firstOf( b.token(PHPPunctuator.LOWER_BINARY_CAST_PREFIX), b.token(PHPPunctuator.UPPER_BINARY_CAST_PREFIX)), b.firstOf( STRING_LITERAL(), NOWDOC_STRING_LITERAL(), HEREDOC_STRING_LITERAL()))); }</code><technical_language>kind directly</technical_language>

Target:
public ExpressionTree PREFIXED_BINARY_CAST() { return b.<ExpressionTree>nonterminal(Kind.PREFIXED_CAST_EXPRESSION).is( f.prefixedCastExpression( b.firstOf( b.token(PHPPunctuator.LOWER_BINARY_CAST_PREFIX), b.token(PHPPunctuator.UPPER_BINARY_CAST_PREFIX)), b.firstOf( STRING_LITERAL(), NOWDOC_STRING_LITERAL(), HEREDOC_STRING_LITERAL()))); }
Source:
<code>public void savePersonAttributeType_shouldNotResultIntoNonUniqueObjectExceptionWithOtherOpenmrsObjects() throws Exception { PatientIdentifierType type = ps.getPatientIdentifierType(1); Person anotherOpemrsObject = personService.getPerson(1); PersonService service = Context.getPersonService(); PersonAttributeType pat = service.getPersonAttributeType(1); service.savePersonAttributeType(pat); try { ps.savePatientIdentifierType(type); personService.savePerson(anotherOpemrsObject); <START> <END> } catch(NonUniqueObjectException e) { fail("Should not throw NonUniqueObjectException"); } }</code><technical_language>need test for another openmrs object understand insisting</technical_language>

Target:
public void savePersonAttributeType_shouldNotResultIntoNonUniqueObjectExceptionWithOtherOpenmrsObjects() throws Exception { PatientIdentifierType type = ps.getPatientIdentifierType(1); ConceptService conceptService = Context.getConceptService(); ConceptClass anotherOpemrsObject = conceptService.getConceptClass(1); PersonService service = Context.getPersonService(); PersonAttributeType pat = service.getPersonAttributeType(1); service.savePersonAttributeType(pat); try { ps.savePatientIdentifierType(type); conceptService.saveConceptClass(anotherOpemrsObject); } catch(NonUniqueObjectException e) { fail("Should not throw NonUniqueObjectException"); } }
Source:
<code>public void onError(JSONObject error) { if (error != null) { <START> System.err.println("Default error handler invoked: " + error.toString()); <END> } else { new Throwable().printStackTrace(System.err); } }</code><technical_language>fact I a good idea for onError stay abstract force implementation of it, android system System.err Log.e(TAG, MESSAGE);</technical_language>

Target:
public void onError(JSONObject error) { if (error != null) { Log.e(ResponseListener.LOG_TAG, "Default error handler invoked: " + error.toString()); } }
Source:
<code>public void testReplaceIllegalChars() { String str = null; <START> assertEquals(null, StringHelper.replaceIllegalChars(str, FieldValidator.REGEX_COURSE_ID, '_')); <END> str = ""; assertEquals("", StringHelper.replaceIllegalChars(str, FieldValidator.REGEX_COURSE_ID, '_')); str = "abc"; assertEquals("abc", StringHelper.replaceIllegalChars(str, FieldValidator.REGEX_COURSE_ID, '_')); str = "illegal!?Chars+1"; assertEquals("illegal__Chars_1", StringHelper.replaceIllegalChars(str, FieldValidator.REGEX_COURSE_ID, '_')); assertEquals("illegal..Chars.1", StringHelper.replaceIllegalChars(str, FieldValidator.REGEX_COURSE_ID, '.')); }</code><technical_language>this is a unit test, hard-code some regex variable instead of FieldValidator? idea is reduce unnecessary coupling. java String regex = "..."; // perfectly fine if this is copy-pasted FieldValidator.REGEX_COURSE_ID String str = null; assertEquals(null, ...); ..</technical_language>

Target:
public void testReplaceIllegalChars() { String regex = "[a-zA-Z0-9_.$-]+"; String str = null; assertEquals(null, StringHelper.replaceIllegalChars(str, regex, '_')); str = ""; assertEquals("", StringHelper.replaceIllegalChars(str, regex, '_')); str = "abc"; assertEquals("abc", StringHelper.replaceIllegalChars(str, regex, '_')); str = "illegal!?Chars+1"; assertEquals("illegal__Chars_1", StringHelper.replaceIllegalChars(str, regex, '_')); assertEquals("illegal..Chars.1", StringHelper.replaceIllegalChars(str, regex, '.')); }
Source:
<code>private void setClipboard() { <START> clipboard.registerPasteListener(Scene.class, new ScenePasteListener( <END> this)); clipboard.registerPasteListener(SceneElement.class, new SceneElementPasteListener(this)); }</code><technical_language>I gonna happen scene metadata. this is implemented, time copy a scene need copy scenemetadata object (See #132)</technical_language>

Target:
private void setClipboard() { clipboard.registerPasteListener(EditorScene.class, new ScenePasteListener(this)); clipboard.registerPasteListener(SceneElement.class, new SceneElementPasteListener(this)); }
Source:
<code>public Function<List<String>, List<String>> finisher() { <START> return null; <END> }</code><technical_language>null? a () -> {}</technical_language>

Target:
public Function<List<String>, List<String>> finisher() { return (inputList) -> inputList; }
Source:
<code>public FieldSort(String field) { this.field = field; <START> this.sort = Direction.ASCENDING; <END> }</code><technical_language>This call args constructor</technical_language>

Target:
public FieldSort(String field) { this(field, Direction.ASCENDING); }
Source:
<code>public int getLevel() { <START> return data.optInt("toclevel"); <END> }</code><technical_language>code this "level" "toclevel"? causing failure of getLevel() calls compared in SectionsFetchTask.processResult</technical_language>

Target:
public int getLevel() { return data.optInt("toclevel", 1); }
Source:
<code>private VolumeType getType() { if <START> ((getStorageDomain().getStorageType().isBlockDomain() || getStorageDomain().getStorageType().isFileDomain()) && <END> getParameters().getVolumeFormat() == VolumeFormat.RAW) { return VolumeType.Preallocated; } return VolumeType.Sparse; }</code><technical_language>user getStorageDomain().getStorageType().isInternal()</technical_language>

Target:
private VolumeType getType() { if (getStorageDomain().getStorageType().isInternal() && getParameters().getVolumeFormat() == VolumeFormat.RAW) { return VolumeType.Preallocated; } return VolumeType.Sparse; }
Source:
<code>public Integer getReadTimeoutOrDefault() { <START> if (Objects.isNull(readTimeout)) { <END> return defaultReadTimeout; } return readTimeout; }</code><technical_language>suggestion if (null == readTimeout) {</technical_language>

Target:
public Integer getReadTimeoutOrDefault() { if (null == readTimeout) { return defaultReadTimeout; } return readTimeout; }
Source:
<code><START> public void prepare() throws Exception { <END> super.init(userMode); }</code><technical_language>Throwing generic Exception</technical_language>

Target:
public void prepare() throws XPathExpressionException { super.init(userMode); }
Source:
<code>public void visitNode(Tree tree) { CatchTree catchTree = (CatchTree) tree; boolean isRethrowing = false; boolean isLogging = false; List<Location> secondaryLocations = new ArrayList<>(); for (StatementTree statementTree : catchTree.block().body()) { if (statementTree.is(Tree.Kind.THROW_STATEMENT)) { secondaryLocations.add(new Location("", ((ThrowStatementTree) statementTree).expression())); <START> isRethrowing = true; <END> } else if (isLoggingMethod(statementTree, catchTree.parameter().simpleName().name())) { secondaryLocations.add(new Location("", statementTree)); isLogging = true; } } if (isLogging && isRethrowing) { reportIssue(catchTree.parameter(), "Either log this exception and handle it, or rethrow it with some contextual information.", secondaryLocations, 0); } }</code><technical_language>I report issue if error logged return, statements a throw is valid java code</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } CatchTree catchTree = (CatchTree) tree; boolean isLogging = false; List<Location> secondaryLocations = new ArrayList<>(); for (StatementTree statementTree : catchTree.block().body()) { IdentifierTree exceptionIdentifier = catchTree.parameter().simpleName(); if (isLogging && statementTree.is(Tree.Kind.THROW_STATEMENT) && isExceptionUsed(exceptionIdentifier, ((ThrowStatementTree) statementTree).expression())) { secondaryLocations.add(new Location("", ((ThrowStatementTree) statementTree).expression())); reportIssue(catchTree.parameter(), "Either log this exception and handle it, or rethrow it with some contextual information.", secondaryLocations, 0); return; } else if (isLoggingMethod(statementTree, exceptionIdentifier)) { secondaryLocations.add(new Location("", statementTree)); isLogging = true; } } }
Source:
<code>public DataContainer toContainer() { final DataContainer container = new MemoryDataContainer(); container.set(Queries.CONTENT_VERSION, getContentVersion()) <START> .set(DataQuery.of("ColorIndex"), this.colorIndex); <END> return container; }</code><technical_language>before, store this a static final field, preferably in DataConstants DataQueries class is</technical_language>

Target:
public DataContainer toContainer() { final DataContainer container = DataContainer.createNew(); container.set(Queries.CONTENT_VERSION, getContentVersion()) .set(DataQueries.MAP_COLOR_INDEX, this.colorIndex); return container; }
Source:
<code>public boolean correspondsTo(AttributeType attribute) { <START> return Objects.equals(this.uri, attribute.getName()) || Objects.equals(this.friendlyName, attribute.getFriendlyName()); <END> }</code><technical_language>ensure attribute is null prevent NPE</technical_language>

Target:
public boolean correspondsTo(AttributeType attribute) { return attribute != null ? Objects.equals(this.uri, attribute.getName()) || Objects.equals(this.friendlyName, attribute.getFriendlyName()) : false; }
Source:
<code>public Object executeInTransaction(DataStore dataStore, Transactional action) { log.debug("executeInTransaction"); Object result = null; try (DataStoreTransaction tx = dataStore.beginTransaction()) { <START> JsonApiDocument jsonApiDoc = new JsonApiDocument(); <END> MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); RequestScope scope = new RequestScope("query", jsonApiDoc, tx, null, queryParams, elide.getElideSettings()); result = action.execute(tx, scope); tx.commit(scope); tx.flush(scope); } catch (IOException e) { log.error("IOException: {}", e); } catch (Exception e) { log.error("Exception: {}", e); } return result; }</code><technical_language>Spacing is off</technical_language>

Target:
protected Object executeInTransaction(DataStore dataStore, Transactional action) { log.debug("executeInTransaction"); Object result = null; try (DataStoreTransaction tx = dataStore.beginTransaction()) { JsonApiDocument jsonApiDoc = new JsonApiDocument(); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); RequestScope scope = new RequestScope("query", jsonApiDoc, tx, null, queryParams, elide.getElideSettings()); result = action.execute(tx, scope); tx.commit(scope); tx.flush(scope); } catch (IOException e) { log.error("IOException: {}", e); } catch (Exception e) { log.error("Exception: {}", e); } return result; }
Source:
<code>public Session build() { return new Session( queryId, Optional.ofNullable(transactionId), clientTransactionSupport, identity, Optional.ofNullable(source), Optional.ofNullable(catalog), Optional.ofNullable(schema), <START> this.traceToken, <END> timeZoneKey, locale, Optional.ofNullable(remoteUserAddress), Optional.ofNullable(userAgent), Optional.ofNullable(clientInfo), clientTags, Optional.ofNullable(resourceEstimates).orElse(new ResourceEstimateBuilder().build()), startTime, systemProperties, ImmutableMap.of(), catalogSessionProperties, sessionPropertyManager, preparedStatements); }</code><technical_language>need for this</technical_language>

Target:
public Session build() { return new Session( queryId, Optional.ofNullable(transactionId), clientTransactionSupport, identity, Optional.ofNullable(source), Optional.ofNullable(catalog), Optional.ofNullable(schema), traceToken, timeZoneKey, locale, Optional.ofNullable(remoteUserAddress), Optional.ofNullable(userAgent), Optional.ofNullable(clientInfo), clientTags, Optional.ofNullable(resourceEstimates).orElse(new ResourceEstimateBuilder().build()), startTime, systemProperties, ImmutableMap.of(), catalogSessionProperties, sessionPropertyManager, preparedStatements); }