auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public TimingWindowSolver(List<TimingWindow> windows, boolean value) { <START> super(DateTimeUtils.MillisecondsPerHour() / 4, DateTimeUtils.MillisecondsPerMinute()); <END> this.windows = windows; this.value = value; }</code><technical_language>trick TimeUnit? TimeUnit.HOURS.toMillis(1)</technical_language>

Target:
public TimingWindowSolver(List<TimingWindow> windows, boolean value) { super(TimeUnit.HOURS.toMillis(1) / 4, TimeUnit.MINUTES.toMillis(1)); this.windows = windows; this.value = value; }
Source:
<code><START> private void extractMailExample (String orig) throws Exception { <END> File ex = new File(site.mail_dir, "/" + orig + ".example"); extract(ex, OutgoingEmail.class, orig); chmod(0444, ex); }</code><technical_language>Style-nit: space method name parameter list</technical_language>

Target:
private void extractMailExample(String orig) throws Exception { File ex = new File(site.mail_dir, orig + ".example"); extract(ex, OutgoingEmail.class, orig); chmod(0444, ex); }
Source:
<code>public void onSkipInWrite(S item, Throwable t) { if(skipWriteDelegate != null && t instanceof Exception) { try { <START> skipWriteDelegate.onSkipWriteItem(Collections.<Object>singletonList(item), (Exception) t); <END> } catch (Exception e) { throw new BatchRuntimeException(e); } } }</code><technical_language>This correct. "item" in this case is passed JSR-352 SkipListener is items in current chunk. Spring Batch, JSR provide facilities identify item a chunk caused error. section 9.2.7 of spec for more detail</technical_language>

Target:
public void onSkipInWrite(S item, Throwable t) { if(skipWriteDelegate != null && t instanceof Exception) { try { skipWriteDelegate.onSkipWriteItem((List<Object>) item, (Exception) t); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
Source:
<code>protected void setData(String key, Number value) { if (data == null) { data = new HashMap<>(); } if (value == null) { data.remove(key); } else if (value instanceof Number) { data.put(key, value); <START> } else { <END> throw new RuntimeException("unexpected value"); } }</code><technical_language>is number null</technical_language>

Target:
protected void setData(String key, Number value) { if (data == null) { data = new HashMap<>(); } data.put(key, value); }
Source:
<code><START> public static TraceLogLevel valueOfString(String name){ <END> if (name == null) { throw new NullPointerException(); } for (TraceLogLevel tllevel : TraceLogLevel.values()) { if (tllevel.getInName().equalsIgnoreCase(name)) { return tllevel; } } return LEVEL_UNKNOWN; }</code><technical_language>BaseEventInfo.setLogLevel(string) thing. So, new method instead remove setLogLevel() BaseEventInfo (IBaseEventInfo). If do need test case updated valueOfString() method is tested</technical_language>

Target:
public static TraceLogLevel valueOfString(String name) { if (name == null) { throw new InvalidParameterException(); } for (TraceLogLevel tllevel : TraceLogLevel.values()) { if (tllevel.getInName().equalsIgnoreCase(name)) { return tllevel; } } return LEVEL_UNKNOWN; }
Source:
<code>public boolean onStartJob(JobParameters params) { if (params.getExtras() != null && params.getExtras() != null) { int startId = params.getExtras().getInt(ARG_START_ID); AppLog.i(T.STATS, "stats job service > task: " + startId + " started"); mStatsServiceLogic.performTask( <START> StatsServiceStarter.passPersistableBundleExtrasToBundle(params.getExtras()), <END> params); } return true; }</code><technical_language>nice if skip code duplication in passPersistableBundleExtrasToBundle(). PersistableBundle implements Parcelable, create a Bundle a Parcelable, a bit of tweaking new Bundle(params.getExtras()) convert PersistentBundle a Bundle</technical_language>

Target:
public boolean onStartJob(JobParameters params) { if (params.getExtras() != null) { int startId = params.getExtras().getInt(ARG_START_ID); AppLog.i(T.STATS, "stats job service > task: " + startId + " started"); mStatsServiceLogic.performTask( new Bundle(params.getExtras()), params); return true; } return false; }
Source:
<code>protected String getCommandName() { return <START> Messages.InsertBlankSpace_cmdName; <END> }</code><technical_language>message adapted if command returned is a "remove blank space command"</technical_language>

Target:
protected String getCommandName() { if (startLocation > endLocation) { return Messages.RemoveBlankSpace_cmdName; } else { return Messages.InsertBlankSpace_cmdName; } }
Source:
<code>public DomainBundleProjectResourcesContentProcessor(Path targetFolder) { <START> this.targetFolder = targetFolder; <END> }</code><technical_language>check for null existence</technical_language>

Target:
public DomainBundleProjectResourcesContentProcessor(Path targetFolder) { domainFolderPath = targetFolder.resolve(DOMAIN.value()); applicationsFolderPath = targetFolder.resolve(APPLICATIONS.value()); }
Source:
<code>public boolean hitEntity(ItemStack itemstack, EntityLivingBase target, EntityLivingBase attacker) { double energy = getEnergy(itemstack); int energyCost = MekanismConfig.current().general.DISASSEMBLER_WEAPON_USAGE.val(); int minDamage = MekanismConfig.current().general.DISASSEMBLER_DAMAGE_MIN.val(); int damageDifference = MekanismConfig.current().general.DISASSEMBLER_DAMAGE_MAX.val() - minDamage; <START> double percent = energyCost == 0 ? 1 : energy / energyCost; <END> float damage = (float) (minDamage + damageDifference * percent); if (attacker instanceof EntityPlayer) { target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), damage); } else { target.attackEntityFrom(DamageSource.causeMobDamage(attacker), damage); } if (energy > 0) { setEnergy(itemstack, energy - energyCost); } return false; }</code><technical_language>energy / energyCost > 1 plenty of charge, no</technical_language>

Target:
public boolean hitEntity(ItemStack itemstack, EntityLivingBase target, EntityLivingBase attacker) { double energy = getEnergy(itemstack); int energyCost = MekanismConfig.current().general.disassemblerEnergyUsageWeapon.val(); int minDamage = MekanismConfig.current().general.disassemblerDamageMin.val(); int damageDifference = MekanismConfig.current().general.disassemblerDamageMax.val() - minDamage; double percent = 1; if (energy < energyCost && energyCost != 0) { percent = energy / energyCost; } float damage = (float) (minDamage + damageDifference * percent); if (attacker instanceof EntityPlayer) { target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), damage); } else { target.attackEntityFrom(DamageSource.causeMobDamage(attacker), damage); } if (energy > 0) { setEnergy(itemstack, energy - energyCost); } return false; }
Source:
<code>protected void executeQueryCommand() { String configuration = getConfigurationFromDb(getParameters().getSnapshotSourceId()); VM result = null; <START> if (configuration != null) { <END> result = new VM(); getSnapshotManager().updateVmFromConfiguration(result,configuration); markImagesIllegalIfNotInDb(result); VmHandler.updateDisksForVm(result, result.getImages()); } getQueryReturnValue().setReturnValue(result); }</code><technical_language>if configuration is empty</technical_language>

Target:
protected void executeQueryCommand() { String configuration = getConfigurationFromDb(getParameters().getSnapshotSourceId(), getUserID(), getParameters().isFiltered()); VM result = null; if (configuration != null) { result = getVmFromConfiguration(configuration); markImagesIllegalIfNotInDb(result); VmHandler.updateDisksForVm(result, result.getImages()); } getQueryReturnValue().setReturnValue(result); }
Source:
<code>public void nonMarkedMappingIsEvictable() { K key = factory.createKey(1); tier = factory.newStore(factory.newConfiguration(factory.getKeyType(), factory.getValueType(), 1L, null, null, Expirations.noExpiration())); try { tier.computeIfAbsent(key, new Function<K, V>() { @Override public V apply(final K k) { return factory.createValue(1L); } }); for (long seed = 2L; seed < 15000; seed++) { tier.put(factory.createKey(seed), factory.createValue(seed)); } assertThat(tier.get(key), is(nullValue())); } catch (CacheAccessException e) { <START> System.err.println("Warning, an exception is thrown due to the SPI test"); <END> e.printStackTrace(); } }</code><technical_language>a sad error handling. Is a reason test method marked "throws Exception"</technical_language>

Target:
public void nonMarkedMappingIsEvictable() throws CacheAccessException { K key = factory.createKey(1); tier = factory.newStore(factory.newConfiguration(factory.getKeyType(), factory.getValueType(), 1L, null, null, Expirations.noExpiration())); tier.computeIfAbsent(key, new Function<K, V>() { @Override public V apply(final K k) { return factory.createValue(1L); } }); fillTierOverCapacity(tier, factory); assertThat(tier.get(key), is(nullValue())); }
Source:
<code><START> public int getMode(File file) { <END> return 0664; }</code><technical_language>This need public, private</technical_language>

Target:
private int getMode(File file) { return 0664; }
Source:
<code>public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { if (!proxy.isRunning()) { stop(); if (proxy.getFailureCause() != null) { String message = "KafkaConsumerProxy has stopped"; throw new SamzaException(message, proxy.getFailureCause()); } else { <START> LOG.warn("Failure cause is not populated for KafkaConsumerProxy"); <END> throw new SamzaException("KafkaConsumerProxy has stopped"); } } Map<SystemStreamPartition, List<IncomingMessageEnvelope>> res = super.poll(systemStreamPartitions, timeout); return res; }</code><technical_language>need log this. This is useful for users</technical_language>

Target:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { if (!proxy.isRunning()) { stop(); String message = String.format("%s: KafkaConsumerProxy has stopped.", this); throw new SamzaException(message, proxy.getFailureCause()); } return super.poll(systemStreamPartitions, timeout); }
Source:
<code>private List<String> getJavaScriptExternalFilePaths(@Nullable XWikiDocument doc) { if (doc == null) { return Collections.emptyList(); } List<BaseObject> javaScriptFiles = doc.getXObjects( getOldCoreClasses().getJavaScriptExternalFilesClassRef( <START> doc.getDocumentReference().getWikiReference().getName())); <END> Vector<String> jsFiles = new Vector<>(); if (javaScriptFiles != null) { for (Object filepath : javaScriptFiles) { if ((filepath != null) && (filepath instanceof BaseObject)) { BaseObject filepathObj = (BaseObject) filepath; if (!"".equals(filepathObj.getStringValue("filepath"))) { jsFiles.add(filepathObj.getStringValue("filepath")); } } } } return jsFiles; }</code><technical_language>Please change jsFiles ArrayList. is need for type Vector in this single threaded situation</technical_language>

Target:
private List<String> getJavaScriptExternalFilePaths(@Nullable XWikiDocument doc) { if (doc == null) { return Collections.emptyList(); } List<BaseObject> javaScriptFiles = doc.getXObjects( getOldCoreClasses().getJavaScriptExternalFilesClassRef( doc.getDocumentReference().getWikiReference().getName())); List<String> jsFiles = new ArrayList<>(); if (javaScriptFiles != null) { for (Object filepath : javaScriptFiles) { if ((filepath != null) && (filepath instanceof BaseObject)) { BaseObject filepathObj = (BaseObject) filepath; if (!"".equals(filepathObj.getStringValue("filepath"))) { jsFiles.add(filepathObj.getStringValue("filepath")); } } } } return jsFiles; }
Source:
<code>private String capitalize(String str) { <START> if (str == null || str.isEmpty() || str.trim().isEmpty()) { <END> return str; } return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); }</code><technical_language>trimmed result is ignored</technical_language>

Target:
private String capitalize(String str) { if (str == null || str.isEmpty() || str.trim().isEmpty()) { return str; } str = str.trim(); return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); }
Source:
<code>public final Graph<SequenceSegment> parseFile(final String filename, final GraphFactory<SequenceSegment> gfact) { Calendar cal = Calendar.getInstance(); long startTime = cal.getTimeInMillis(); Graph<SequenceSegment> graph = gfact.getGraph(); parseVertices(filename, graph); parseEdges(filename, graph); Calendar cal2 = Calendar.getInstance(); <START> System.out.println("Graph parsed. Took " <END> + (cal2.getTimeInMillis() - startTime) + " ms."); return graph; }</code><technical_language>java.util.logging for this</technical_language>

Target:
public final Graph<SequenceSegment> parseFile(final String filename, final GraphFactory<SequenceSegment> gfact) { long startTime = Calendar.getInstance().getTimeInMillis(); Graph<SequenceSegment> graph = gfact.getGraph(); parseVertices(filename, graph); parseEdges(filename, graph); System.out.println("Graph parsed. Took " + (Calendar.getInstance().getTimeInMillis() - startTime) + " ms."); return graph; }
Source:
<code>public String toString() { <START> return "AliasedDiscoveryConfig{" + "enabled=" + enabled + ", usePublicIp=" + usePublicIp + ", properties=" + properties <END> + '}'; }</code><technical_language>add tag well</technical_language>

Target:
public String toString() { return "AliasedDiscoveryConfig{" + "tag='" + tag + '\'' + ", enabled=" + enabled + ", usePublicIp=" + usePublicIp + ", properties=" + properties + '}'; }
Source:
<code>public HttpResponse doFinishLogin(StaplerRequest request) throws IOException { String code = request.getParameter("code"); if (code == null || code.trim().length() == 0) { Log.info("doFinishLogin: missing code."); return HttpResponses.redirectToContextRoot(); } Log.info("test"); HttpPost httpost = new HttpPost(githubWebUri + "/login/oauth/access_token?" + "client_id=" + clientID + "&" + "client_secret=" + clientSecret + "&" + "code=" + code); DefaultHttpClient httpclient = new DefaultHttpClient(); org.apache.http.HttpResponse response = httpclient.execute(httpost); HttpEntity entity = response.getEntity(); String content = EntityUtils.toString(entity); httpclient.getConnectionManager().shutdown(); String accessToken = extractToken(content); if (accessToken != null && accessToken.trim().length() > 0) { GithubAuthenticationToken auth = new GithubAuthenticationToken(accessToken, getGithubApiUri()); SecurityContextHolder.getContext().setAuthentication(auth); GHUser self = auth.getGitHub().getMyself(); User u = User.current(); u.setFullName(self.getName()); } <START> else { <END> Log.info("Github did not return an access token."); } String referer = (String)request.getSession().getAttribute(REFERER_ATTRIBUTE); if (referer!=null) return HttpResponses.redirectTo(referer); return HttpResponses.redirectToContextRoot(); }</code><technical_language>hasExplicitlyConfiguredAddress() instead of getAddress() skip possibly expensive lookup while retaining feature set email address automatically</technical_language>

Target:
public HttpResponse doFinishLogin(StaplerRequest request) throws IOException { String code = request.getParameter("code"); if (code == null || code.trim().length() == 0) { Log.info("doFinishLogin: missing code."); return HttpResponses.redirectToContextRoot(); } Log.info("test"); HttpPost httpost = new HttpPost(githubWebUri + "/login/oauth/access_token?" + "client_id=" + clientID + "&" + "client_secret=" + clientSecret + "&" + "code=" + code); DefaultHttpClient httpclient = new DefaultHttpClient(); org.apache.http.HttpResponse response = httpclient.execute(httpost); HttpEntity entity = response.getEntity(); String content = EntityUtils.toString(entity); httpclient.getConnectionManager().shutdown(); String accessToken = extractToken(content); if (accessToken != null && accessToken.trim().length() > 0) { GithubAuthenticationToken auth = new GithubAuthenticationToken(accessToken, getGithubApiUri()); SecurityContextHolder.getContext().setAuthentication(auth); GHUser self = auth.getGitHub().getMyself(); User u = User.current(); u.setFullName(self.getName()); if (!u.getProperty(Mailer.UserProperty.class).hasExplicitlyConfiguredAddress()) { u.addProperty(new Mailer.UserProperty(self.getEmail())); } } else { Log.info("Github did not return an access token."); } String referer = (String)request.getSession().getAttribute(REFERER_ATTRIBUTE); if (referer!=null) return HttpResponses.redirectTo(referer); return HttpResponses.redirectToContextRoot(); }
Source:
<code>public void sendEventBundle(EventBundle events) { <START> if (events.size() == 0) { <END> return; } for (EventBundlePipe pipe : pipes) { pipe.sendEventBundle(events); } }</code><technical_language>isEmpty</technical_language>

Target:
public void sendEventBundle(EventBundle events) { if (events.isEmpty()) { return; } for (EventBundlePipe pipe : pipes) { pipe.sendEventBundle(events); } }
Source:
<code>public void init(FilterConfig filterConfig) throws ServletException { <START> additionalSchemes = filterConfig.getInitParameter("schemes"); END> }</code><technical_language>perform split if needed, set empty avoid null conditionals if none</technical_language>

Target:
public void init(FilterConfig filterConfig) throws ServletException { String schemes = filterConfig.getInitParameter("schemes"); if (schemes == null) { schemes = ""; } additionalSchemes = Arrays.asList(schemes.split(",")); realmInfo = filterConfig.getInitParameter("realmInfo"); }
Source:
<code>private Collection<AbstractPolicy> getPolicies(QName policyType, AbstractNodeTemplate nodeTemplate) { Collection<AbstractPolicy> policies = new ArrayList<AbstractPolicy>(); for (AbstractPolicy policy : nodeTemplate.getPolicies()) { if (policy.getType().getId().equals(policyType)) { policies.add(policy); } } <START> return policies; <END> }</code><technical_language>reformulated a filter operation a stream</technical_language>

Target:
private Collection<AbstractPolicy> getPolicies(QName policyType, AbstractNodeTemplate nodeTemplate) { return nodeTemplate.getPolicies().stream().filter(x -> x.getType().getId().equals(policyType)).collect(Collectors.toList()); }
Source:
<code>public CaptureProcessScheduler(ConnectorConfiguration configuration, Environment environment, CardCaptureProcess cardCaptureProcess, XrayUtils xrayUtils) { this.cardCaptureProcess = cardCaptureProcess; this.xrayUtils = xrayUtils; if ((configuration != null) && (configuration.getCaptureProcessConfig() != null)) { CaptureProcessConfig captureProcessConfig = configuration.getCaptureProcessConfig(); initialDelayInSeconds = captureProcessConfig.getSchedulerInitialDelayInSeconds(); randomIntervalMinimumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMinimumInSeconds(); randomIntervalMaximumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMaximumInSeconds(); schedulerThreads = captureProcessConfig.getSchedulerThreads(); } scheduledExecutorService = environment .lifecycle() .scheduledExecutorService(CAPTURE_PROCESS_SCHEDULER_NAME) <START> .threads(schedulerThreads + 1) <END> .build(); }</code><technical_language>is 1 added schedulerThreads here</technical_language>

Target:
public CaptureProcessScheduler(ConnectorConfiguration configuration, Environment environment, CardCaptureProcess cardCaptureProcess, XrayUtils xrayUtils) { this.cardCaptureProcess = cardCaptureProcess; this.xrayUtils = xrayUtils; if ((configuration != null) && (configuration.getCaptureProcessConfig() != null)) { CaptureProcessConfig captureProcessConfig = configuration.getCaptureProcessConfig(); initialDelayInSeconds = captureProcessConfig.getSchedulerInitialDelayInSeconds(); randomIntervalMinimumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMinimumInSeconds(); randomIntervalMaximumInSeconds = captureProcessConfig.getSchedulerRandomIntervalMaximumInSeconds(); schedulerThreads = captureProcessConfig.getSchedulerThreads(); } int totalThreads = schedulerThreads + 1; scheduledExecutorService = environment .lifecycle() .scheduledExecutorService(CAPTURE_PROCESS_SCHEDULER_NAME) .threads(totalThreads) .build(); }
Source:
<code>public WebElement getDisplayNameField(int instrNum) { return browser.driver.findElement(By.cssSelector("#instructorTable" + instrNum + " input[name='" + Const.ParamsNames.INSTRUCTOR_DISPLAY_NAME <START> + "']")); <END> }</code><technical_language>Extract string expression By.cssSelector(...) a variable for readability</technical_language>

Target:
public WebElement getDisplayNameField(int instrNum) { String displayNameFieldSelector = "#instructorTable" + instrNum + " input[name='" + Const.ParamsNames.INSTRUCTOR_DISPLAY_NAME + "']"; return browser.driver.findElement(By.cssSelector(displayNameFieldSelector)); }
Source:
<code>void synchronizeGroups() { boolean isParkingPluginEnable = OsmandPlugin.getEnabledPlugin(ParkingPositionPlugin.class) != null; favoriteGroups.clear(); groups.clear(); List<FavoriteGroup> disablesGroups = new ArrayList<>(); List<FavoriteGroup> gs = helper.getFavoriteGroups(); Set<?> flt = filter; for (FavoriteGroup key : gs) { boolean empty = true; if (flt == null || flt.contains(key)) { if (key.personal) { ArrayList<FavouritePoint> list = new ArrayList<>(); for (FavouritePoint p : key.points) { <START> if (p.getName().equals(FavouritePoint.PointType.PARKING.getName())) { <END> if (isParkingPluginEnable) { list.add(p); empty = false; } } else { if (p.getName().equals(FavouritePoint.PointType.PARKING.getName())) { if (isParkingPluginEnable) { list.add(p); empty = false; } } else { list.add(p); empty = false; } } } favoriteGroups.put(key, list); } else { empty = false; favoriteGroups.put(key, new ArrayList<>(key.points)); } } else { ArrayList<FavouritePoint> list = new ArrayList<>(); for (FavouritePoint p : key.points) { if (flt.contains(p)) { list.add(p); empty = false; } } favoriteGroups.put(key, list); } if (!empty) { if (key.visible) { groups.add(key); } else { disablesGroups.add(key); } } } groups.addAll(disablesGroups); notifyDataSetChanged(); }</code><technical_language>1. is wrong place customize "isParkingPluginEnable" in code 2. is need fofr this ifs , visible Code deleted</technical_language>

Target:
void synchronizeGroups() { favoriteGroups.clear(); groups.clear(); List<FavoriteGroup> disablesGroups = new ArrayList<>(); List<FavoriteGroup> gs = helper.getFavoriteGroups(); Set<?> flt = filter; for (FavoriteGroup key : gs) { boolean empty = true; if (flt == null || flt.contains(key)) { empty = false; favoriteGroups.put(key, new ArrayList<>(key.getPoints())); } else { ArrayList<FavouritePoint> list = new ArrayList<>(); for (FavouritePoint p : key.getPoints()) { if (flt.contains(p)) { list.add(p); empty = false; } } favoriteGroups.put(key, list); } if (!empty) { if (key.isVisible()) { groups.add(key); } else { disablesGroups.add(key); } } } groups.addAll(disablesGroups); notifyDataSetChanged(); }
Source:
<code>public static void init(ProcessingEnvironment processingEnv) { <START> OptionsHelper optionsHelper = new OptionsHelper(processingEnv); <END> GENERATION_SUFFIX = optionsHelper.getGenerationSuffix(); }</code><technical_language>validate suffix here, user pass a string is valid in Java identifiers</technical_language>

Target:
public static void init(ProcessingEnvironment processingEnv) { OptionsHelper optionsHelper = new OptionsHelper(processingEnv); classSuffix = optionsHelper.getClassSuffix().trim(); if (classSuffix.isEmpty()) { throw new IllegalArgumentException("'" + classSuffix + "' may not be an emtpy string."); } if (!SourceVersion.isName(classSuffix) || classSuffix.contains(".")) { throw new IllegalArgumentException("'" + classSuffix + "' is not a valid Java identifier."); } }
Source:
<code>@Override public long length() { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); <START> writeTo(out); <END> return out.size(); } catch (IOException ex) { throw new RuntimeException(ex); } }</code><technical_language>Some TypedOutput instances read consuming entire stream render unable write a time for actual body</technical_language>

Target:
@Override public long length() { return length; }
Source:
<code>private SymbolReference<? extends ResolvedValueDeclaration> solveSymbolForFQN(String symbolName, TypeSolver typeSolver, String fqn) { if (fqn == null) { return SymbolReference.unsolved(ResolvedValueDeclaration.class); } <START> ResolvedReferenceTypeDeclaration superClass = typeSolver.solveType(fqn); <END> return new SymbolSolver(typeSolver).solveSymbolInType(superClass, symbolName); }</code><technical_language>name superClass is a bit misleading</technical_language>

Target:
private SymbolReference<? extends ResolvedValueDeclaration> solveSymbolForFQN(String symbolName, TypeSolver typeSolver, String fqn) { if (fqn == null) { return SymbolReference.unsolved(ResolvedValueDeclaration.class); } ResolvedReferenceTypeDeclaration fqnTypeDeclaration = typeSolver.solveType(fqn); return new SymbolSolver(typeSolver).solveSymbolInType(fqnTypeDeclaration, symbolName); }
Source:
<code>public String exportSampleList(@RequestBody final Map<String, String> data, @PathVariable final int exportType, final HttpServletRequest req, final HttpServletResponse response) { ExportSampleListController.LOG.info("Entering Export exportSampleList"); <START> ExportSampleListController.LOG.info("Exiting Export exportSampleList"); <END> return this.doExport(response, exportType, data); }</code><technical_language>Move doExport. LOG.debug, provide useful information, remove</technical_language>

Target:
public String exportSampleList(@RequestBody final Map<String, String> data, @PathVariable final int exportType, final HttpServletRequest req, final HttpServletResponse response) { ExportSampleListController.LOG.debug("Entering Export exportSampleList"); final String export = this.doExport(response, exportType, data); ExportSampleListController.LOG.debug("Exiting Export exportSampleList"); return export; }
Source:
<code>Mono<BlobBatchOperationInfo> prepareBlobBatchSubmission() { if (batchOperationQueue.isEmpty()) { <START> return Mono.error(new UnsupportedOperationException("Empty batch requests aren't allowed.")); <END> } BlobBatchOperationInfo operationInfo = new BlobBatchOperationInfo(); Deque<BlobBatchOperation<?>> operations = batchOperationQueue; batchOperationQueue = new ConcurrentLinkedDeque<>(); return Flux.generate(sink -> { if (operations.isEmpty()) { operationInfo.finalizeBatchOperations(); sink.complete(); } else { BlobBatchOperation<?> batchOperation = operations.pop(); sink.next(batchOperation.getResponse() .subscriberContext(Context.of(BATCH_REQUEST_URL_PATH, batchOperation.getRequestUrlPath(), BATCH_OPERATION_RESPONSE, batchOperation.getBatchOperationResponse(), BATCH_OPERATION_INFO, operationInfo)) .subscribe()); } }).then(Mono.just(operationInfo)); }</code><technical_language>This logged well. monoError() helper method in FluxUtil instead</technical_language>

Target:
Mono<BlobBatchOperationInfo> prepareBlobBatchSubmission() { if (batchOperationQueue.isEmpty()) { return monoError(logger, new UnsupportedOperationException("Empty batch requests aren't allowed.")); } BlobBatchOperationInfo operationInfo = new BlobBatchOperationInfo(); Deque<BlobBatchOperation<?>> operations = batchOperationQueue; batchOperationQueue = new ConcurrentLinkedDeque<>(); return Flux.generate(sink -> { if (operations.isEmpty()) { operationInfo.finalizeBatchOperations(); sink.complete(); } else { BlobBatchOperation<?> batchOperation = operations.pop(); sink.next(batchOperation.getResponse() .subscriberContext(Context.of(BATCH_REQUEST_URL_PATH, batchOperation.getRequestUrlPath(), BATCH_OPERATION_RESPONSE, batchOperation.getBatchOperationResponse(), BATCH_OPERATION_INFO, operationInfo)) .subscribe()); } }).then(Mono.just(operationInfo)); }
Source:
<code>public FeedbackResponseRow(int fbIndex, int personIndex, String personType, FeedbackResponseAttributes response, FeedbackSessionResultsBundle results) { String questionId = response.feedbackQuestionId; FeedbackQuestionAttributes question = results.questions.get(questionId); FeedbackQuestionDetails questionDetails = question.getQuestionDetails(); this.questionNumber = question.questionNumber; this.questionText = results.getQuestionText(questionId); this.questionMoreInfo = questionDetails.getQuestionAdditionalInfoHtml(this.questionNumber, personType + "-" + personIndex + "-session-" + fbIndex); if (personType.equals("recipient")) { this.responseText = response.getResponseDetails().getAnswerHtml(questionDetails); } else if (personType.equals("giver")) { this.responseText = results.getResponseAnswerHtml(response, question); } this.responseComments = new ArrayList<FeedbackResponseComment>(); List<FeedbackResponseCommentAttributes> frcs = results.responseComments.get(response.getId()); <START> if (frcs != null && frcs.size() > 0) { <END> for (FeedbackResponseCommentAttributes frc : frcs) { this.responseComments.add(new FeedbackResponseComment(frc, frc.giverEmail)); } } }</code><technical_language>!frcs.isEmpty() here? is necessary check for size here? a for loop anyway</technical_language>

Target:
public FeedbackResponseRow(int fbIndex, int personIndex, String personType, FeedbackResponseAttributes response, FeedbackSessionResultsBundle results) { String questionId = response.feedbackQuestionId; FeedbackQuestionAttributes question = results.questions.get(questionId); FeedbackQuestionDetails questionDetails = question.getQuestionDetails(); this.questionNumber = question.questionNumber; this.questionText = results.getQuestionText(questionId); this.questionMoreInfo = questionDetails.getQuestionAdditionalInfoHtml(this.questionNumber, personType + "-" + personIndex + "-session-" + fbIndex); if (personType.equals("recipient")) { this.responseText = response.getResponseDetails().getAnswerHtml(questionDetails); } else if (personType.equals("giver")) { this.responseText = results.getResponseAnswerHtml(response, question); } this.responseComments = new ArrayList<FeedbackResponseComment>(); List<FeedbackResponseCommentAttributes> frcs = results.responseComments.get(response.getId()); if (frcs != null) { for (FeedbackResponseCommentAttributes frc : frcs) { this.responseComments.add(new FeedbackResponseComment(frc, frc.giverEmail)); } } }
Source:
<code>public void doHeartBeat() throws IOException { LocalState state = ConfigUtils.workerState(workerState.conf, workerState.workerId); LSWorkerHeartbeat lsWorkerHeartbeat = new LSWorkerHeartbeat(Time.currentTimeSecs(), workerState.topologyId, workerState.localExecutors.stream() .map(executor -> new ExecutorInfo( executor.get(0).intValue(), executor.get(1).intValue())) .collect(Collectors.toList()), workerState.port); state.setWorkerHeartBeat(lsWorkerHeartbeat); state.cleanup(60); if (!workerState.stormClusterState.isPacemakerStateStore()) { <START> LOG.debug("If pacemaker is not used, send supervisor"); <END> heartbeatToMasterIfLocalbeatFail(lsWorkerHeartbeat); } }</code><technical_language>delete If. if this message is logged, means pacemaker is used</technical_language>

Target:
public void doHeartBeat() throws IOException { LocalState state = ConfigUtils.workerState(workerState.conf, workerState.workerId); LSWorkerHeartbeat lsWorkerHeartbeat = new LSWorkerHeartbeat(Time.currentTimeSecs(), workerState.topologyId, workerState.localExecutors.stream() .map(executor -> new ExecutorInfo( executor.get(0).intValue(), executor.get(1).intValue())) .collect(Collectors.toList()), workerState.port); state.setWorkerHeartBeat(lsWorkerHeartbeat); state.cleanup(60); if (!workerState.stormClusterState.isPacemakerStateStore()) { LOG.debug("The pacemaker is not used, send heartbeat to master."); heartbeatToMasterIfLocalbeatFail(lsWorkerHeartbeat); } this.heatbeatMeter.mark(); }
Source:
<code>private void deleteLocks(CommitData cd, final long commitTs) { ArrayList<Mutation> mutations = new ArrayList<>(updates.size() + 1); for (Entry<Bytes, Map<Column, Bytes>> rowUpdates : updates.entrySet()) { Flutation m = new Flutation(env, rowUpdates.getKey()); boolean isTriggerRow = isTriggerRow(rowUpdates.getKey()); for (Entry<Column, Bytes> colUpdates : rowUpdates.getValue().entrySet()) { ColumnUtil.commitColumn(env, isTriggerRow && colUpdates.getKey().equals(notification.getColumn()), false, colUpdates.getKey(), isWrite(colUpdates.getValue()), isDelete(colUpdates.getValue()), isReadLock(colUpdates.getValue()), startTs, commitTs, observedColumns, m); } mutations.add(m); } CompletableFuture<Void> cfuture = env.getSharedResources().getBatchWriter().writeMutationsAsyncFuture(mutations); <START> addCallback(cfuture, cd, (cd2, result) -> finishCommit(cd, commitTs)); <END> }</code><technical_language>I noticed finishCommit is passed cd2. Of works fine because, cd cd2 same. This simplify code remove CommitData param OnSuccessInterface.onSuccess(). this code written : java addCallback(cfuture, cd, result -> finishCommit(cd, commitTs));</technical_language>

Target:
private void deleteLocks(CommitData cd, final long commitTs) { ArrayList<Mutation> mutations = new ArrayList<>(updates.size() + 1); for (Entry<Bytes, Map<Column, Bytes>> rowUpdates : updates.entrySet()) { Flutation m = new Flutation(env, rowUpdates.getKey()); boolean isTriggerRow = isTriggerRow(rowUpdates.getKey()); for (Entry<Column, Bytes> colUpdates : rowUpdates.getValue().entrySet()) { ColumnUtil.commitColumn(env, isTriggerRow && colUpdates.getKey().equals(notification.getColumn()), false, colUpdates.getKey(), isWrite(colUpdates.getValue()), isDelete(colUpdates.getValue()), isReadLock(colUpdates.getValue()), startTs, commitTs, observedColumns, m); } mutations.add(m); } CompletableFuture<Void> cfuture = env.getSharedResources().getBatchWriter().writeMutationsAsyncFuture(mutations); addCallback(cfuture, cd, result -> finishCommit(cd, commitTs)); }
Source:
<code><START> public void validateCommitCursor(final NakadiCursor position) throws InvalidCursorException { <END> validateCursorForNulls(position); KafkaCursor.fromNakadiCursor(position); }</code><technical_language>fix position? call validateCursorForNulls, call KafkaCursor.fromNakadiCursor, basically checks. other side is clear call KafkaCursor.fromNakadiCursor do work KafkaCursor</technical_language>

Target:
public void validateCommitCursor(final NakadiCursor position) throws InvalidCursorException { KafkaCursor.fromNakadiCursor(position); }
Source:
<code>public void testCreateDirectoryDialogAllowFolderNameModification() { final String directoryName = "mydir"; final DirectoryChooserFragment fragment = DirectoryChooserFragment.newInstance( directoryName, null, false, true); startFragment(fragment, DirectoryChooserActivityMock.class); fragment.onOptionsItemSelected(new TestMenuItem() { @Override public int getItemId() { return R.id.new_folder_item; } }); final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog(); final ShadowAlertDialog shadowAlertDialog = Robolectric.shadowOf(dialog); assertEquals(shadowAlertDialog.getTitle(), "Create folder"); assertTrue(shadowAlertDialog.isShowing()) <START> Button positiveBtn = shadowAlertDialog.getButton(DialogInterface.BUTTON_POSITIVE); <END> assertNotNull(positiveBtn); TextView msgView = (TextView) dialog.findViewById(R.id.msgText); assertEquals(msgView.getText().toString(), "Create new folder with name \"mydir\"?"); EditText editText = (EditText) dialog.findViewById(R.id.editText); assertTrue(editText.getVisibility() == View.VISIBLE) assertEquals(editText.getText().toString(), "mydir"); }</code><technical_language>final modifier else applicable</technical_language>

Target:
public void testCreateDirectoryDialogAllowFolderNameModification() { final String directoryName = "mydir"; final DirectoryChooserFragment fragment = DirectoryChooserFragment.newInstance( directoryName, null, false, true); startFragment(fragment, DirectoryChooserActivityMock.class); fragment.onOptionsItemSelected(new TestMenuItem() { @Override public int getItemId() { return R.id.new_folder_item; } }); final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog(); final ShadowAlertDialog shadowAlertDialog = Shadows.shadowOf(dialog); assertEquals(shadowAlertDialog.getTitle(), "Create folder"); assertTrue(shadowAlertDialog.isShowing()) final Button positiveBtn = shadowAlertDialog.getButton(DialogInterface.BUTTON_POSITIVE); assertNotNull(positiveBtn); final TextView msgView = (TextView) dialog.findViewById(R.id.msgText); assertEquals(msgView.getText().toString(), "Create new folder with name \"mydir\"?"); final EditText editText = (EditText) dialog.findViewById(R.id.editText); assertTrue(editText.getVisibility() == View.VISIBLE) assertEquals(editText.getText().toString(), "mydir"); }
Source:
<code><START> public Void delete(@PathParam(RestParameter.ID) Long id) { <END> ratingDao.delete(id); return null; }</code><technical_language>return void instead of Void, return null</technical_language>

Target:
public void delete(@PathParam(RestParameter.ID) Long id) { ratingDao.delete(id); }
Source:
<code>private void initialize() { try { CVSUIPlugin.runWithProgress(null, true , monitor -> { try { ILogEntry[] entries = file.getLogEntries(monitor); String revision = file.getRevision(); for (ILogEntry <START> entrie : <END> entries) { if (entrie.getRevision().equals(revision)) { entry = entrie; return; } } } catch (TeamException e) { throw new InvocationTargetException(e); } }); } catch (InterruptedException e) { } catch (InvocationTargetException e) { CVSUIPlugin.openError(null, null, null, e); } }</code><technical_language>entry (or else entry is a field)</technical_language>

Target:
private void initialize() { try { CVSUIPlugin.runWithProgress(null, true , monitor -> { try { ILogEntry[] entries = file.getLogEntries(monitor); String revision = file.getRevision(); for (ILogEntry e : entries) { if (e.getRevision().equals(revision)) { entry = e; return; } } } catch (TeamException e) { throw new InvocationTargetException(e); } }); } catch (InterruptedException e) { } catch (InvocationTargetException e) { CVSUIPlugin.openError(null, null, null, e); } }
Source:
<code>private AccountInfoMap(Map<String, String> accountMap) { nameToAccountMap = new HashMap<>(); idToAccountMap = new HashMap<>(); for (Map.Entry<String, String> entry : accountMap.entrySet()) { String idKey = entry.getKey(); String valueString = entry.getValue(); Account account; try { JSONObject accountJson = new JSONObject(valueString); if (idKey == null) { logger.error( "Invalid account record when reading accountMap in ZNRecord because either idKey={} or accountJson={}" + "is null", idKey, accountJson); continue; } account = Account.fromJson(accountJson); if (account.getId() != Short.valueOf(idKey)) { logger.error( "Invalid account record when reading accountMap in ZNRecord because idKey and accountId do not match." + "idKey={}, accountId={}", idKey, account.getId()); continue; } } catch (Exception e) { logger.error("Invalid account record when reading accountMap in ZNRecord. key={}, valueString={}", idKey, valueString, e); <START> continue; <END> } Account conflictingAccount = nameToAccountMap.get(account.getName()); if (conflictingAccount != null) { logger.error("Duplicate account name exists. id={} name={} conflicts with a previously added id={} name={}." + "Removing account with id={} name={}", account.getId(), account.getName(), conflictingAccount.getId(), conflictingAccount.getName(), conflictingAccount.getId(), conflictingAccount.getName()); idToAccountMap.remove(conflictingAccount.getId()); nameToAccountMap.remove(conflictingAccount.getName()); } idToAccountMap.put(account.getId(), account); nameToAccountMap.put(account.getName(), account); } }</code><technical_language>fail if read of a single account fails</technical_language>

Target:
private AccountInfoMap(Map<String, String> accountMap) throws JSONException { nameToAccountMap = new HashMap<>(); idToAccountMap = new HashMap<>(); for (Map.Entry<String, String> entry : accountMap.entrySet()) { String idKey = entry.getKey(); String valueString = entry.getValue(); Account account; JSONObject accountJson = new JSONObject(valueString); if (idKey == null) { accountServiceMetrics.remoteDataCorruptionErrorCount.inc(); throw new IllegalStateException( "Invalid account record when reading accountMap in ZNRecord because idKey=null"); } account = Account.fromJson(accountJson); if (account.getId() != Short.valueOf(idKey)) { accountServiceMetrics.remoteDataCorruptionErrorCount.inc(); throw new IllegalStateException( "Invalid account record when reading accountMap in ZNRecord because idKey and accountId do not match. idKey=" + idKey + " accountId=" + account.getId()); } if (idToAccountMap.containsKey(account.getId()) || nameToAccountMap.containsKey(account.getName())) { throw new IllegalStateException( "Duplicate account id or name exists. id=" + account.getId() + " name=" + account.getName()); } idToAccountMap.put(account.getId(), account); nameToAccountMap.put(account.getName(), account); } }
Source:
<code>private void initSwipeToRefreshHelper(View view) { if (view == null) { return; } mSwipeToRefreshHelper = new SwipeToRefreshHelper( this, (CustomSwipeRefreshLayout) view.findViewById(R.id.ptr_layout), new SwipeToRefreshHelper.RefreshListener() { @Override public void onRefreshStarted() { if (isFinishing()) { return; } if (!NetworkUtils.checkConnection(SitePickerActivity.this)) { mSwipeToRefreshHelper.setRefreshing(false); ToastUtils.showToast(SitePickerActivity.this, R.string.site_picker_no_network_refresh_error); return; } <START> mDispatcher.dispatch(SiteActionBuilder.newRemoveWpcomAndJetpackSitesAction()); <END> mSwipeToRefreshHelper.setRefreshing(true); mDispatcher.dispatch(SiteActionBuilder.newFetchSitesAction()); } }); }</code><technical_language>Hey @tonyr59h , say, this all-sites removal a bit uncomfortable. I assume reason added is "clean up" remotely-deleted sites, right? Is some reason that? though: unadvertised removal this possibly delete data synced backend yet, draft posts local changes. Fixing/catering for a case easily fall scope of this PR so, I suggest instead avoid removing local sites en-mass? remove local sites get updated remote list check site local drafts. WDYT</technical_language>

Target:
private void initSwipeToRefreshHelper(View view) { if (view == null) { return; } mSwipeToRefreshHelper = new SwipeToRefreshHelper( this, (CustomSwipeRefreshLayout) view.findViewById(R.id.ptr_layout), new SwipeToRefreshHelper.RefreshListener() { @Override public void onRefreshStarted() { if (isFinishing()) { return; } if (!NetworkUtils.checkConnection(SitePickerActivity.this)) { mSwipeToRefreshHelper.setRefreshing(false); return; } mDispatcher.dispatch(SiteActionBuilder.newFetchSitesAction()); } }); }
Source:
<code>public static FileMetadata lookup(Connection sql, int fid) throws ServiceException{ OMUtil.sqlCheck(sql); ResultSet result = FileMetadataTable.lookUpFile(sql, fid); try{ <START> if (!result.next()) { throw new ServiceException(ServiceStatus.APP_FILE_NOT_EXIST); } <END> FileMetadata fileData = new FileMetadata(result.getInt("fid"), result.getString("user"), result.getString("course"), result.getString("university"), result.getDate("creation_date"), result.getInt("rating")); result.close(); return fileData; } catch (SQLException ex) { throw new ServiceException(ServiceStatus.DATABASE_ERROR, ex); } }</code><technical_language>nit: throw next line</technical_language>

Target:
public static FileMetadata lookup(Connection sql, int fid) throws ServiceException{ OMUtil.sqlCheck(sql); ResultSet result = FileMetadataTable.lookUpFile(sql, fid); try{ if (!result.next()) { throw new ServiceException(ServiceStatus.APP_FILE_NOT_EXIST); } FileMetadata fileData = new FileMetadata(result.getInt("fid"), result.getInt("uid"), result.getInt("cid"), result.getDate("creation_date")); result.close(); return fileData; } catch (SQLException ex) { throw new ServiceException(ServiceStatus.DATABASE_ERROR, ex); } }
Source:
<code>private Ordering<Row> metricOrdering(final String column, final Comparator comparator) { return new Ordering<Row>() { @SuppressWarnings("unchecked") <START> @Override <END> public int compare(Row left, Row right) { if (left.getRaw(column) == null & right.getRaw(column) == null) { return 0; } else if (left.getRaw(column) == null) { return 1; } else if (right.getRaw(column) == null) { return -1; } return comparator.compare(left.getRaw(column), right.getRaw(column)); } }; }</code><technical_language>ordering is Comparator.comparing(row -> row.getRaw(column), Comparators.naturalNullsFirst())</technical_language>

Target:
private Ordering<Row> metricOrdering(final String column, final Comparator comparator) { return Ordering.from(Comparator.comparing((Row row) -> row.getRaw(column), Comparator.nullsLast(comparator))); }
Source:
<code>protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { boolean returnValue = resourceManager.runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(getVdsId())).getSucceeded(); if (returnValue) { stopGlusterServices(getVdsId()); <START> } <END> Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }</code><technical_language>set stopGlusterService true in createMaintenanceParams()? stopping gluster services managed MaintenanceNumberOfVdss command</technical_language>

Target:
protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { if (getVds().getClusterSupportsGlusterService()) { boolean returnValue = resourceManager.runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(getVdsId())).getSucceeded(); if (returnValue) { stopGlusterServices(getVdsId()); } } Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }
Source:
<code>protected String resolvePrincipalInternal(final X509Certificate certificate) { LOGGER.debug("Resolving principal from Subject Alternative Name UPN for [{}]", certificate); try { val upnString = X509UPNExtractor.extractUPNString(certificate); <START> return upnString != null ? upnString : getAlternatePrincipal(certificate); <END> } catch (final CertificateParsingException e) { LOGGER.error("Error is encountered while trying to retrieve subject alternative names collection from certificate", e); return getAlternatePrincipal(certificate); } }</code><technical_language>StringUtils.ifNotBlank()</technical_language>

Target:
protected String resolvePrincipalInternal(final X509Certificate certificate) { LOGGER.debug("Resolving principal from Subject Alternative Name UPN for [{}]", certificate); try { val upnString = X509UPNExtractorUtils.extractUPNString(certificate); return StringUtils.isNotBlank(upnString) ? upnString : getAlternatePrincipal(certificate); } catch (final CertificateParsingException e) { LOGGER.error("Error is encountered while trying to retrieve subject alternative names collection from certificate", e); return getAlternatePrincipal(certificate); } }