auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void validate(Schema inputSchema, List<String> groupByFields, List<GroupByConfig.FunctionInfo> aggregates, FailureCollector collector) { for (String groupByField : groupByFields) { Schema.Field field = inputSchema.getField(groupByField); if (field == null) { collector.addFailure(String.format("Cannot group by field '%s' because it does not exist in input schema.", groupByField), null) .withConfigElement("groupByFields", groupByField); } } for (GroupByConfig.FunctionInfo functionInfo : aggregates) { if (functionInfo.getField().equals("*")) { continue; } Schema.Field inputField = inputSchema.getField(functionInfo.getField()); String collectorFieldName = String.format("%s:%s(%s)", functionInfo.getName(), functionNameMap.get(functionInfo.getFunction().toString().toUpperCase()), functionInfo.getField()); if (inputField == null) { collector.addFailure( String.format("Invalid aggregate %s(%s): Field '%s' does not exist in input schema.", functionInfo.getFunction(), functionInfo.getField(), functionInfo.getField()), null) .withConfigElement("aggregates", collectorFieldName); } if (functionInfo.getField().equalsIgnoreCase(functionInfo.getName())) { collector.addFailure(String.format("Name '%s' should not be same as aggregate field '%s'", functionInfo.getName(), functionInfo.getField()), null) .withConfigElement("aggregates", collectorFieldName); } if (GroupByConfig.Function.COUNTDISTINCT == functionInfo.getFunction()) { <START> if (!conf.containsMacro("aggregates")) { <END> validateCountDistinct(inputField, collector, collectorFieldName); } } } }</code><technical_language>is for this false this point? be</technical_language>

Target:
public void validate(Schema inputSchema, List<String> groupByFields, List<GroupByConfig.FunctionInfo> aggregates, FailureCollector collector) { for (String groupByField : groupByFields) { Schema.Field field = inputSchema.getField(groupByField); if (field == null) { collector.addFailure(String.format("Cannot group by field '%s' because it does not exist in input schema.", groupByField), null) .withConfigElement("groupByFields", groupByField); } } for (GroupByConfig.FunctionInfo functionInfo : aggregates) { if (functionInfo.getField().equals("*")) { continue; } Schema.Field inputField = inputSchema.getField(functionInfo.getField()); String collectorFieldName = String.format("%s:%s(%s)", functionInfo.getName(), functionNameMap.get(functionInfo.getFunction().toString().toUpperCase()), functionInfo.getField()); if (inputField == null) { collector.addFailure( String.format("Invalid aggregate %s(%s): Field '%s' does not exist in input schema.", functionInfo.getFunction(), functionInfo.getField(), functionInfo.getField()), null) .withConfigElement("aggregates", collectorFieldName); } if (functionInfo.getField().equalsIgnoreCase(functionInfo.getName())) { collector.addFailure(String.format("Name '%s' should not be same as aggregate field '%s'", functionInfo.getName(), functionInfo.getField()), null) .withConfigElement("aggregates", collectorFieldName); } if (GroupByConfig.Function.COUNTDISTINCT == functionInfo.getFunction()) { validateCountDistinct(inputField, collector, collectorFieldName); } } }
Source:
<code>public void offerProducerCredit(final SimpleString address, final int credits, final int threshold, final Receiver receiver) { try { PagingManager pagingManager = manager.getServer().getPagingManager(); Runnable creditRunnable = () -> { connection.lock(); try { if (receiver.getCredit() <= threshold) { <START> receiver.flow(credits - receiver.getCredit()); <END> } } finally { connection.unlock(); } connection.flush(); }; if (address == null) { pagingManager.checkMemory(creditRunnable); } else { final PagingStore store = manager.getServer().getPagingManager().getPageStore(address); store.checkMemory(creditRunnable); } } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>I this protect flow <=0 calculation</technical_language>

Target:
public void offerProducerCredit(final SimpleString address, final int credits, final int threshold, final Receiver receiver) { try { PagingManager pagingManager = manager.getServer().getPagingManager(); Runnable creditRunnable = () -> { connection.lock(); try { if (receiver.getCredit() <= threshold) { int topUp = credits - receiver.getCredit(); if (topUp > 0) { receiver.flow(topUp); } } } finally { connection.unlock(); } connection.flush(); }; if (address == null) { pagingManager.checkMemory(creditRunnable); } else { final PagingStore store = manager.getServer().getPagingManager().getPageStore(address); store.checkMemory(creditRunnable); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>private void createModel() throws ModelMapException, ArrangeException, UnexpectedDiagramTypeException, UnexpectedEndException { for (Pair<String, DiagramExportationReport> report : layout.getReportsWithDiagramNames()) { String name = report.getFirst(); DiagramExportationReport der = report.getSecond(); LayoutVisualizerManager lvm = new LayoutVisualizerManager(der.getNodes(), der.getLinks(), der.getStatements()); lvm.arrange(); ModelMapProvider map = new ModelMapProvider(URI.createFileURI(genFolder), der.getModelName()); List<Statement> statements = lvm.getStatementsSet(); <START> double spacing = 0.8; END> Statement s = statements.stream().filter(statement -> statement.getType() == StatementType.corridorsize) .findFirst().orElse(null); if (s != null) { spacing = Double.parseDouble(s.getParameter(0)); } switch (der.getType()) { case Class: model.addClassDiagram(name, lvm.getObjects(), lvm.getAssociations(), map, spacing); break; case StateMachine: model.addStateMachine(name, lvm.getObjects(), lvm.getAssociations(), map, spacing); break; default: throw new UnexpectedDiagramTypeException(name, der.getType().name()); } } }</code><technical_language>A default spacing set programatically, is a user defined setting. A default is visualizer algoritm</technical_language>

Target:
private void createModel() throws ModelMapException, ArrangeException, UnexpectedDiagramTypeException, UnexpectedEndException, UnexpectedException { for (Pair<String, DiagramExportationReport> report : layout.getReportsWithDiagramNames()) { String name = report.getFirst(); DiagramExportationReport der = report.getSecond(); ModelMapProvider map = new ModelMapProvider(URI.createFileURI(genFolder), der.getModelName()); model.createDiagram(name, report.getSecond(), map); } }
Source:
<code>public void refresh() { <START> asyncNewSession(); <END> }</code><technical_language>I this synchronized</technical_language>

Target:
public void refresh() { sessionCredentials.set(null); blockingNewSession(); }
Source:
<code>public static ReportDesign createJSONTemplateDesign(String reportDesignUuid, ReportDefinition reportDefinition, String resourcePath) { <START> ReportDesign design = new ReportDesign(); design.setUuid(reportDesignUuid); design.setName("JSON"); <END> design.setReportDefinition(reportDefinition); design.setRendererType(JSONTemplateRenderer.class); ReportDesignResource resource = new ReportDesignResource(); resource.setName("template"); resource.setExtension("json"); resource.setContentType("application/json"); resource.setContents(ReportUtil.readByteArrayFromResource(resourcePath)); resource.setReportDesign(design); design.addResource(resource); return design; }</code><technical_language>replace this section createJSONReportDesign method created</technical_language>

Target:
public static ReportDesign createJSONTemplateDesign(String reportDesignUuid, ReportDefinition reportDefinition, String resourcePath) { ReportDesign design = createJSONReportDesign(reportDesignUuid,reportDefinition); design.setReportDefinition(reportDefinition); design.setRendererType(TextTemplateRenderer.class); ReportDesignResource resource = new ReportDesignResource(); resource.setName("template"); resource.setExtension("json"); resource.setContentType("application/json"); resource.setContents(ReportUtil.readByteArrayFromResource(resourcePath)); resource.setReportDesign(design); design.addResource(resource); return design; }
Source:
<code>public void switchAgentState(String agentName) { <START> loader.waitOnClosed(); <END> new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until( ExpectedConditions.visibilityOfElementLocated( By.xpath(format(Locators.AGENT_STATE, agentName)))) .click(); }</code><technical_language>IMHO link method preceding commands, is wait loader previous operation closes. **switchAgentState()** more universal, pull loader.waitOnClosed() caller method</technical_language>

Target:
public void switchAgentState(String agentName) { new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC) .until( ExpectedConditions.visibilityOfElementLocated( By.xpath(format(Locators.AGENT_STATE, agentName)))) .click(); }
Source:
<code>public int deletePendingSegments(String dataSource, Interval deleteInterval) { final Optional<DateTime> minCreatedDateOfActiveTasks = taskStorageQueryAdapter .getActiveTasks() .stream() .map(task -> taskStorageQueryAdapter.getCreatedTime(task.getId())) .min(Comparator.naturalOrder()); final Interval activeTaskInterval = new Interval( minCreatedDateOfActiveTasks.orElse(DateTimes.MAX), DateTimes.MAX ); Preconditions.checkArgument( !deleteInterval.overlaps(activeTaskInterval), <START> "Cannot delete pendingSegments because there is at least one running task created at %s", <END> activeTaskInterval.getStart() ); return indexerMetadataStorageCoordinator.deletePendingSegments(dataSource, deleteInterval); }</code><technical_language>hm, I if throwing exception is aggressive, if I understand correctly: - tasks a varying amount of time complete, uncommon a situation active tasks, created completed task, running - return 0 exception, minCreatedDateOfActiveTasks end of pending segment deletion interval</technical_language>

Target:
public int deletePendingSegments(String dataSource, Interval deleteInterval) { final Optional<DateTime> minCreatedDateOfActiveTasks = taskStorageQueryAdapter .getActiveTasks() .stream() .map(task -> Preconditions.checkNotNull( taskStorageQueryAdapter.getCreatedTime(task.getId()), "Can't find the createdTime for task[%s]", task.getId() )) .min(Comparator.naturalOrder()); final Interval activeTaskInterval = new Interval( minCreatedDateOfActiveTasks.orElse(DateTimes.MAX), DateTimes.MAX ); Preconditions.checkArgument( !deleteInterval.overlaps(activeTaskInterval), "Cannot delete pendingSegments because there is at least one active task created at %s", activeTaskInterval.getStart() ); return indexerMetadataStorageCoordinator.deletePendingSegments(dataSource, deleteInterval); }
Source:
<code>protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) { final BeanDefinitionBuilder jpaPollingChannelAdapterBuilder = BeanDefinitionBuilder .genericBeanDefinition(JpaPollingChannelAdapter.class); final BeanDefinitionBuilder jpaExecutorBuilder = JpaParserUtils.getJpaExecutorBuilder(element, parserContext); <START> if(element.hasAttribute("max-number-of-results")) { <END> String maxNumberOfResultsValue = element.getAttribute("max-number-of-results"); jpaExecutorBuilder.addPropertyValue("maxNumberOfResultsExpression", new LiteralExpression(maxNumberOfResultsValue)); } IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "delete-after-poll"); IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "delete-in-batch"); IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "expect-single-result"); final BeanDefinition jpaExecutorBuilderBeanDefinition = jpaExecutorBuilder.getBeanDefinition(); final String channelAdapterId = this.resolveId(element, jpaPollingChannelAdapterBuilder.getRawBeanDefinition(), parserContext); final String jpaExecutorBeanName = channelAdapterId + ".jpaExecutor"; parserContext.registerBeanComponent(new BeanComponentDefinition(jpaExecutorBuilderBeanDefinition, jpaExecutorBeanName)); jpaPollingChannelAdapterBuilder.addConstructorArgReference(jpaExecutorBeanName); return jpaPollingChannelAdapterBuilder.getBeanDefinition(); }</code><technical_language>need StringUtils.hasText(); hasAttribute allows empty String</technical_language>

Target:
protected BeanMetadataElement parseSource(Element element, ParserContext parserContext) { final BeanDefinitionBuilder jpaPollingChannelAdapterBuilder = BeanDefinitionBuilder .genericBeanDefinition(JpaPollingChannelAdapter.class); final BeanDefinitionBuilder jpaExecutorBuilder = JpaParserUtils.getJpaExecutorBuilder(element, parserContext); RootBeanDefinition definition = IntegrationNamespaceUtils .createExpressionDefinitionFromValueOrExpression("max-number-of-results", "max-results-expression", parserContext, element, false); if(definition != null) { jpaExecutorBuilder.addPropertyValue("maxResultsExpression", definition); } IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "delete-after-poll"); IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "delete-in-batch"); IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "expect-single-result"); final BeanDefinition jpaExecutorBuilderBeanDefinition = jpaExecutorBuilder.getBeanDefinition(); final String channelAdapterId = this.resolveId(element, jpaPollingChannelAdapterBuilder.getRawBeanDefinition(), parserContext); final String jpaExecutorBeanName = channelAdapterId + ".jpaExecutor"; parserContext.registerBeanComponent(new BeanComponentDefinition(jpaExecutorBuilderBeanDefinition, jpaExecutorBeanName)); jpaPollingChannelAdapterBuilder.addConstructorArgReference(jpaExecutorBeanName); return jpaPollingChannelAdapterBuilder.getBeanDefinition(); }
Source:
<code>public void setDataExporters(Collection<IDataExporter<? extends Object>> dataExporters) { final Map<String, IDataExporter<Object>> dataExportersMap = new LinkedHashMap<String, IDataExporter<Object>>(); final Set<IPortalDataType> portalDataTypes = new LinkedHashSet<IPortalDataType>(); for (final IDataExporter<?> dataExporter : dataExporters) { try { final IPortalDataType portalDataType = dataExporter.getPortalDataType(); final String typeId = portalDataType.getTypeId(); this.logger.debug("Registering IDataExporter for '{}' - {}", new Object[]{typeId, dataExporter}); final IDataExporter<Object> existing = dataExportersMap.put(typeId, (IDataExporter<Object>) dataExporter); if (existing != null) { this.logger.warn("Duplicate IDataExporter typeId for Replacing with {}", new Object[]{typeId, existing, dataExporter}); } portalDataTypes.add(portalDataType); <START> } catch (Exception exception) { <END> logger.error("Something bad happened provisioning exporter into JaxbPortalDataHandlerService;" + " ignoring that exporter.", dataExporter, exception); } } this.portalDataExporters = Collections.unmodifiableMap(dataExportersMap); this.exportPortalDataTypes = Collections.unmodifiableSet(portalDataTypes); }</code><technical_language>Is this code change masking underlying of problem? Is concern catching Exceptions swallowing them? is drawback if exception is thrown handled in this manner? For example, uPortal startup some features work</technical_language>

Target:
public void setDataExporters(Collection<IDataExporter<? extends Object>> dataExporters) { final Map<String, IDataExporter<Object>> dataExportersMap = new LinkedHashMap<String, IDataExporter<Object>>(); final Set<IPortalDataType> portalDataTypes = new LinkedHashSet<IPortalDataType>(); for (final IDataExporter<?> dataExporter : dataExporters) { try { final IPortalDataType portalDataType = dataExporter.getPortalDataType(); final String typeId = portalDataType.getTypeId(); this.logger.debug("Registering IDataExporter for '{}' - {}", new Object[]{typeId, dataExporter}); final IDataExporter<Object> existing = dataExportersMap.put(typeId, (IDataExporter<Object>) dataExporter); if (existing != null) { this.logger.warn("Duplicate IDataExporter typeId for Replacing with {}", new Object[]{typeId, existing, dataExporter}); } portalDataTypes.add(portalDataType); } catch (Exception exception) { logger.error("Failed to register data exporter {}.", dataExporter, exception); } } this.portalDataExporters = Collections.unmodifiableMap(dataExportersMap); this.exportPortalDataTypes = Collections.unmodifiableSet(portalDataTypes); }
Source:
<code>public IgniteInternalFuture<Void> stop() { synchronized (this) { if (!enabled) return new GridFinishedFuture<>(); enabled = false; } log.info("Stopping performance statistics writer."); FileWriter fileWriter = this.fileWriter; <START> if (fileWriter != null) <END> return fileWriter.shutdown(); return new GridFinishedFuture<>(); }</code><technical_language>rewrite flow a bit this code more readable. if (fileWriter == null) return new GridFinishedFuture<>(); return fileWriter.shutdown();</technical_language>

Target:
public synchronized void stop() { assert started; ringByteBuf.close(); U.awaitForWorkersStop(Collections.singleton(fileWriter), true, log); ringByteBuf.poll(); ringByteBuf.free(); try { fileIo.force(); } catch (IOException e) { log.warning("Failed to fsync the performance statistics file.", e); } U.closeQuiet(fileIo); knownStrs.clear(); started = false; }
Source:
<code>protected void executeCommand() { deviceSizeVisibilityError = <START> false; <END> changeStorageDomainStatusInTransaction(getStorageDomain().getStoragePoolIsoMapData(), StorageDomainStatus.Locked); List<String> lunsToRefresh = getParameters().getLunIds(); Map<String, List<Pair<VDS, Integer>>> lunToVds = getDeviceListAllVds(lunsToRefresh); Map<String, List<VDS>> lunToFailedVDS = getFailedLuns(lunToVds); if (!lunToFailedVDS.isEmpty()) { deviceSizeVisibilityError = true; List<String> failedVds = new ArrayList<>(); for (Map.Entry<String, List<VDS>> entry : lunToFailedVDS.entrySet()) { String lunId = entry.getKey(); List<VDS> vdsList = entry.getValue(); log.error("Failed to refresh device " + lunId + " Not all VDS are seeing the same size " + "VDS :" + vdsList); String vdsListString = StringUtils.join(Entities.objectNames(vdsList), ", "); failedVds.add("LUN : " + lunId + "VDS: " + vdsListString); } throw new VdcBLLException(VdcBllErrors.REFRESH_LUN_ERROR, "Failed to refresh LUNs. Not all VDS are seeing the same size: " + failedVds); } resizePVs(lunsToRefresh); updateStorageDomainData(); changeStorageDomainStatusInTransaction(getStorageDomain().getStoragePoolIsoMapData(), StorageDomainStatus.Active); setSucceeded(true); }</code><technical_language>need init here</technical_language>

Target:
protected void executeCommand() { changeStorageDomainStatusInTransaction(getStorageDomain().getStoragePoolIsoMapData(), StorageDomainStatus.Locked); List<String> lunsToRefresh = getParameters().getLunIds(); Map<String, List<Pair<VDS, Integer>>> lunToVds = getDeviceListAllVds(lunsToRefresh); Map<String, List<VDS>> lunToFailedVDS = getFailedLuns(lunToVds); if (!lunToFailedVDS.isEmpty()) { deviceSizeVisibilityError = true; List<String> failedVds = new ArrayList<>(); for (Map.Entry<String, List<VDS>> entry : lunToFailedVDS.entrySet()) { String lunId = entry.getKey(); List<VDS> vdsList = entry.getValue(); log.error("Failed to refresh device " + lunId + " Not all VDS are seeing the same size " + "VDS :" + vdsList); String vdsListString = StringUtils.join(Entities.objectNames(vdsList), ", "); failedVds.add("LUN : " + lunId + "VDS: " + vdsListString); } throw new VdcBLLException(VdcBllErrors.REFRESH_LUN_ERROR, "Failed to refresh LUNs. Not all VDS are seeing the same size: " + failedVds); } resizePVs(lunsToRefresh); updateStorageDomainData(); changeStorageDomainStatusInTransaction(getStorageDomain().getStoragePoolIsoMapData(), StorageDomainStatus.Active); setSucceeded(true); }
Source:
<code>protected void executeCommand() { List<String> errors = new ArrayList<String>(); entity = getGlusterHooksDao().getById(getParameters().getHookId()); List <VDS> servers = getAllUpServers(getParameters().getClusterId()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : servers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue = runVdsCommand( getStatusChangeVDSCommand(), new GlusterHookVDSParameters(upServer.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (retValue.getSucceeded()) { <START> updateServerHookStatusInDb(entity.getId(), pairResult.getFirst().getId(), getNewStatus()); <END> } else { errors.add(retValue.getVdsError().getMessage()); } } if (errors.size() > 0) { entity.addStatusConflict(); setSucceeded(false); } else { setSucceeded(true); } entity.setStatus(getNewStatus()); updateServerHookInDb(entity); }</code><technical_language>I entry in server_hooks if status is hooks entry (no conflict)</technical_language>

Target:
protected void executeCommand() { List<String> errors = new ArrayList<String>(); entity = getGlusterHooksDao().getById(getParameters().getHookId(),true); List <VDS> servers = getAllUpServers(getParameters().getClusterId()); List<GlusterServerHook> serverHooks = entity.getServerHooks(); if (serverHooks.size() != servers.size()) { errors.add(VdcBllMessages.CLUSTER_ALL_SERVERS_NOT_UP.toString()); } List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : servers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue = runVdsCommand( getStatusChangeVDSCommand(), new GlusterHookVDSParameters(upServer.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (retValue.getSucceeded()) { updateServerHookStatusInDb(entity.getId(), pairResult.getFirst().getId(), getNewStatus()); } else { if (!VdcBllErrors.GlusterHookAlreadyEnabled.equals(retValue.getVdsError().getCode())) { errors.add(retValue.getVdsError().getMessage()); } } } if (errors.size() > 0) { entity.addStatusConflict(); setSucceeded(false); } else { setSucceeded(true); } entity.setStatus(getNewStatus()); updateHookInDb(entity); }
Source:
<code>public boolean updateApplicationModule(String appModuleId, ApplicationModule applicationModule) throws RegistryServiceException, TException { try { <START> new ApplicationInterfaceRepository().updateApplicationModule(appModuleId, applicationModule); <END> logger.debug("Airavata updated application module with module id: " + appModuleId); return true; } catch (AppCatalogException e) { logger.error(appModuleId, "Error while updating application module...", e); RegistryServiceException exception = new RegistryServiceException(); exception.setMessage("Error while updating application module. More info : " + e.getMessage()); throw exception; } }</code><technical_language>@machristie @tilaks26, for knowledge, is this new do database operations? Is required create a new object of ApplicationInterfaceRepository for call? them</technical_language>

Target:
public boolean updateApplicationModule(String appModuleId, ApplicationModule applicationModule) throws RegistryServiceException, TException { try { applicationInterfaceRepository.updateApplicationModule(appModuleId, applicationModule); logger.debug("Airavata updated application module with module id: " + appModuleId); return true; } catch (AppCatalogException e) { logger.error(appModuleId, "Error while updating application module...", e); RegistryServiceException exception = new RegistryServiceException(); exception.setMessage("Error while updating application module. More info : " + e.getMessage()); throw exception; } }
Source:
<code>public int compareTo(ImmutablePassengerData o) { return ComparisonChain.start() .compare(o.vehicle().get().getType().getName(), this.vehicle.getType().getName()) .compare(o.baseVehicle().get().getType().getName(), this.vehicle.getType().getName()) <START> .result(); <END> }</code><technical_language>compareTo return 0 for equal objects. <LINK_0></technical_language>

Target:
public int compareTo(ImmutablePassengerData o) { return ComparisonChain.start().compare(o.vehicle().get().getType().getName(), this.vehicle.getType().getName()) .compare(o.baseVehicle().get().getType().getName(), this.baseVehicle.getType().getName()) .compare(o.vehicle().get().getUniqueId(), this.vehicle.getUniqueId()) .compare(o.baseVehicle().get().getUniqueId(), this.baseVehicle.getUniqueId()).result(); }
Source:
<code>public void setGroupIdHelpBock(String groupIdHelpBock) { <START> this.groupIdHelpBock.setText(groupIdHelpBock); <END> if (!"".equals(groupIdHelpBock)) { this.rootTR.className = "kie-tablelist__row has-error"; } else { this.rootTR.className = "kie-tablelist__row"; } }</code><technical_language>do groupIdHelpBock == null || groupIdHelpBock.isEmpty</technical_language>

Target:
public void setGroupIdHelpBock(String groupIdHelpBock) { this.groupIdHelpBock.setText(groupIdHelpBock); if (!groupIdHelpBock.isEmpty()) { this.groupIdTD.classList.add("has-error"); } else { this.groupIdTD.classList.remove("has-error"); } }
Source:
<code>public void start(BundleContext bundleContext) throws Exception { StacksCoreActivator.context = bundleContext; DEFAULT = this; <START> new StacksManager().getStacks(new NullProgressMonitor()); <END> }</code><technical_language>This do here. invoking blocking code plugin activation wasting this instance</technical_language>

Target:
public void start(BundleContext bundleContext) throws Exception { StacksCoreActivator.context = bundleContext; DEFAULT = this; }
Source:
<code>public void testBadNumberOfArguments() throws HiveException, IOException { ObjectInspector value1 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector value2 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector[] initArguments = new ObjectInspector[]{value1, value2}; GeocodedCountryUDF geocodedCountryUDF = new GeocodedCountryUDF(); geocodedCountryUDF.initialize(initArguments); <START> geocodedCountryUDF.close(); <END> }</code><technical_language>Yeah, meh. removing close()</technical_language>

Target:
public void testBadNumberOfArguments() throws HiveException, IOException { ObjectInspector value1 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector value2 = PrimitiveObjectInspectorFactory.javaStringObjectInspector; ObjectInspector[] initArguments = new ObjectInspector[]{value1, value2}; GeocodedCountryUDF geocodedCountryUDF = new GeocodedCountryUDF(); geocodedCountryUDF.initialize(initArguments); }
Source:
<code>public Column(final ColumnSize firstSize, final ColumnSize... otherSizes) { setSize(firstSize, otherSizes); <START> setStyleName(firstSize.getCssName()); <END> }</code><technical_language>is this required? handled setSize()</technical_language>

Target:
public Column(final ColumnSize firstSize, final ColumnSize... otherSizes) { setSize(firstSize, otherSizes); }
Source:
<code>private Class<?> getRawType(final Type type) { if (!Class.class.isInstance(type) && !ParameterizedType.class.isInstance(type)) { throw new IllegalStateException("Unsupported generic type " + type.getClass().getName()); } else if (Class.class.isInstance(type)) { return Class.class.cast(type); } else { <START> return getRawType(ParameterizedType.class.cast(type).getRawType()); <END> } }</code><technical_language>loop</technical_language>

Target:
private Class<?> getRawType(final Type type) { if (!Class.class.isInstance(type) && !ParameterizedType.class.isInstance(type)) { throw new IllegalStateException("Unsupported generic type " + type.getClass().getName()); } else if (Class.class.isInstance(type)) { return Class.class.cast(type); } else { return Class.class.cast(ParameterizedType.class.cast(type).getRawType()); } }
Source:
<code>public void disconnect(String message) { if (isOnline()) { <START> visit(""); <END> find(by.link("Disconnect")).click(); find(by.input("offlineMessage")).clear(); find(by.input("offlineMessage")).sendKeys(message); clickButton("Yes"); } }</code><technical_language>Note, open() instead</technical_language>

Target:
public void disconnect(String message) { if (isOnline()) { open(); find(by.link("Disconnect")).click(); find(by.input("offlineMessage")).clear(); find(by.input("offlineMessage")).sendKeys(message); clickButton("Yes"); } }
Source:
<code>public void showLinkPreview(PageTitle title, int entrySource) { final String linkPreviewFragmentTag = "link_preview_dialog"; if (getSupportFragmentManager().findFragmentByTag(linkPreviewFragmentTag) == null) { <START> linkPreview = LinkPreviewDialog.newInstance(title, entrySource); <END> linkPreview.show(getSupportFragmentManager(), linkPreviewFragmentTag); } }</code><technical_language>need a private variable for storing link preview. If line above, findFragmentByTag() function finds dialog tag name (also above). cast return of this function a LinkPreviewDialog, call dismiss() it</technical_language>

Target:
public void showLinkPreview(PageTitle title, int entrySource) { final String linkPreviewFragmentTag = "link_preview_dialog"; if (getSupportFragmentManager().findFragmentByTag(linkPreviewFragmentTag) == null) { LinkPreviewDialog linkPreview = LinkPreviewDialog.newInstance(title, entrySource); linkPreview.show(getSupportFragmentManager(), linkPreviewFragmentTag); } }
Source:
<code>public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertMessageEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); <END> assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertMessageEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>public SignedUploadRequest uploadSingleFile(final FileToSign toSign, final InputStream stream) throws EvrythngException, IOException { final List<FileToSign> toSignList = Collections.singletonList(toSign); final List<SignedUploadRequest> signedUploadRequests = fileUploadRequestsSigner(toSignList).execute(); final SignedUploadRequest signedUploadRequest = signedUploadRequests.get(0); final URL url = new URL(signedUploadRequest.getSignedUploadUrl()); <START> FileUtils.uploadPublicStream(url, toSign.getType(), stream); <END> return signedUploadRequest; }</code><technical_language>above, please revert avoid breaking changes</technical_language>

Target:
public SignedUploadRequest uploadSingleFile(final FileToSign toSign, final InputStream stream) throws EvrythngException, IOException { final List<FileToSign> toSignList = Collections.singletonList(toSign); final List<SignedUploadRequest> signedUploadRequests = fileUploadRequestsSigner(toSignList).execute(); final SignedUploadRequest signedUploadRequest = signedUploadRequests.get(0); final URL url = new URL(signedUploadRequest.getSignedUploadUrl()); FileUtils.uploadStream(url, toSign.getType(), stream); return signedUploadRequest; }
Source:
<code>public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException { Log log = helper.getLog(); try { MavenProject project = (MavenProject) helper.evaluate( "${project}" ); if (!project.getPackaging().equals("pom")) { List<License> licenses = getLicenses(project); if (licenses.size() == 0) { <START> throw new EnforcerRuleException("You must set a license for this project"); <END> } } else { log.info("Ignoring " + this.getClass().getSimpleName() + " in this project"); } } catch (ExpressionEvaluationException eee) { throw new EnforcerRuleException( "Unable to get project.", eee); } }</code><technical_language>"The license is set in this project in parents"</technical_language>

Target:
public void execute(EnforcerRuleHelper helper) throws EnforcerRuleException { Log log = helper.getLog(); try { MavenProject project = (MavenProject) helper.evaluate( "${project}" ); if (!"pom".equals(project.getPackaging())) { List<License> licenses = getLicenses(project); if (licenses.size() == 0) { if (hasLicenseFile(project)) { log.warn("License file found in the root of your project"); } throw new EnforcerRuleException("You must set a license for this project. Please read: <LINK_0>"); } } else { log.info("Ignoring " + this.getClass().getSimpleName() + " in this project"); } } catch (ExpressionEvaluationException eee) { throw new EnforcerRuleException("Unable to get project.", eee); } }
Source:
<code>private void cleanupLeftOverJobs(final long msid) { try { Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { _queueMgr.cleanupActiveQueueItems(msid, true); List<AsyncJobVO> jobs = _jobDao.getResetJobs(msid); for (AsyncJobVO job : jobs) { if (s_logger.isDebugEnabled()) { s_logger.debug("Cancel left-over job-" + job.getId()); } job.setStatus(JobInfo.Status.FAILED); job.setResultCode(ApiErrorCode.INTERNAL_ERROR.getHttpCode()); job.setResult("job cancelled because of management server restart or shutdown"); job.setCompleteMsid(msid); _jobDao.update(job.getId(), job); if (s_logger.isDebugEnabled()) { s_logger.debug("Purge queue item for cancelled job-" + job.getId()); } _queueMgr.purgeAsyncJobQueueItemId(job.getId()); if(job.getInstanceType().equals("Volume")) { try { <START> VolumeDetailVO volumeDetailVO = _volumeDetailsDao.findDetail(job.getInstanceId(), "SNAPSHOT_ID"); <END> if (volumeDetailVO != null) { _volumeDetailsDao.remove(volumeDetailVO.getId()); } } catch (Exception e) { s_logger.error("Unexpected exception while removing concurrent request meta data :" + e.getLocalizedMessage()); } } } } }); } catch (Throwable e) { s_logger.warn("Unexpected exception in cleaning up left over jobs for mamagement server node " + msid, e); } }</code><technical_language>this find delete replaced removeDetail()</technical_language>

Target:
private void cleanupLeftOverJobs(final long msid) { try { Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { _queueMgr.cleanupActiveQueueItems(msid, true); List<AsyncJobVO> jobs = _jobDao.getResetJobs(msid); for (AsyncJobVO job : jobs) { if (s_logger.isDebugEnabled()) { s_logger.debug("Cancel left-over job-" + job.getId()); } job.setStatus(JobInfo.Status.FAILED); job.setResultCode(ApiErrorCode.INTERNAL_ERROR.getHttpCode()); job.setResult("job cancelled because of management server restart or shutdown"); job.setCompleteMsid(msid); _jobDao.update(job.getId(), job); if (s_logger.isDebugEnabled()) { s_logger.debug("Purge queue item for cancelled job-" + job.getId()); } _queueMgr.purgeAsyncJobQueueItemId(job.getId()); if (job.getInstanceType().equals(ApiCommandJobType.Volume.toString())) { try { _volumeDetailsDao.removeDetail(job.getInstanceId(), "SNAPSHOT_ID"); } catch (Exception e) { s_logger.error("Unexpected exception while removing concurrent request meta data :" + e.getLocalizedMessage()); } } } } }); } catch (Throwable e) { s_logger.warn("Unexpected exception in cleaning up left over jobs for mamagement server node " + msid, e); } }
Source:
<code>protected Void createTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, TemplateOpContext<TemplateApiResult> context) { TemplateObject template = context.getTemplate(); AsyncCompletionCallback<TemplateApiResult> parentCallback = context.getParentCallback(); TemplateApiResult result = new TemplateApiResult(template); CreateCmdResult callbackResult = callback.getResult(); if (callbackResult.isFailed()) { template.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed); result.setResult(callbackResult.getResult()); if (parentCallback != null) { parentCallback.complete(result); } return null; } if (template.getFormat().equals(ImageFormat.OVA)) { if (!createDataDiskTemplates(template)) { template.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed); result.setResult(callbackResult.getResult()); <START> if (parentCallback != null) { <END> parentCallback.complete(result); } return null; } } try { template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed); } catch (Exception e) { result.setResult(e.toString()); if (parentCallback != null) { parentCallback.complete(result); } return null; } if (parentCallback != null) { parentCallback.complete(result); } return null; }</code><technical_language>is a for createDataDiskTemplates return false</technical_language>

Target:
protected Void createTemplateCallback(AsyncCallbackDispatcher<TemplateServiceImpl, CreateCmdResult> callback, TemplateOpContext<TemplateApiResult> context) { TemplateObject template = context.getTemplate(); AsyncCompletionCallback<TemplateApiResult> parentCallback = context.getParentCallback(); TemplateApiResult result = new TemplateApiResult(template); CreateCmdResult callbackResult = callback.getResult(); if (callbackResult.isFailed()) { template.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed); result.setResult(callbackResult.getResult()); if (parentCallback != null) { parentCallback.complete(result); } return null; } if (template.getFormat().equals(ImageFormat.OVA)) { if (!createOvaDataDiskTemplates(template)) { template.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed); result.setResult(callbackResult.getResult()); if (parentCallback != null) { parentCallback.complete(result); } return null; } } try { template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed); } catch (Exception e) { result.setResult(e.toString()); if (parentCallback != null) { parentCallback.complete(result); } return null; } if (parentCallback != null) { parentCallback.complete(result); } return null; }
Source:
<code>private void log(final List<LogEntry> logEntries) { final long start = System.currentTimeMillis(); <START> final boolean success = log(clientProvider.getClient(), logEntries); <END> final long end = System.currentTimeMillis(); notificationsHandler.onSpansSent(end - start, logEntries.size(), !success); processedSpans += logEntries.size(); if (success && LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Submitting " + logEntries.size() + " spans to service took " + (end - start) + "ms."); } }</code><technical_language>if System.currentTimeMillis() calculate this (which more expensive precise System.nanoTime()), want do conditionally, if a Noop notifier, creating overhead for reason</technical_language>

Target:
private void log(final List<LogEntry> logEntries) { final long start = System.currentTimeMillis(); final boolean success = log(clientProvider.getClient(), logEntries); processedSpans += logEntries.size(); if (success && LOGGER.isLoggable(Level.FINE)) { final long end = System.currentTimeMillis(); LOGGER.fine("Submitting " + logEntries.size() + " spans to service took " + (end - start) + "ms."); } }
Source:
<code>public void testGetWithEntityId() { <START> dao = dbFacade.getUnregisteredOVFDataDao(); <END> OvfEntityData ovfEntityData = dao.getByEntityIdAndStorageDomain(FixturesTool.VM_RHEL5_POOL_50, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertNotNull("VM should exists in the UnregisteredOVFData", ovfEntityData); }</code><technical_language>done in setup. Note this re-occurs in test methods</technical_language>

Target:
public void testGetWithEntityId() { OvfEntityData ovfEntityData = dao.getByEntityIdAndStorageDomain(FixturesTool.VM_RHEL5_POOL_50, FixturesTool.STORAGE_DOAMIN_NFS2_1); assertNotNull("VM should exists in the UnregisteredOVFData", ovfEntityData); }
Source:
<code><START> CacheMetrics(Cache cache) { <END> super(cache); registry = SharedMetricRegistries.getOrCreate(MetricsService.class.getName()); read = registry.counter(READ_NAME); read_hit = registry.counter(READ_HIT_NAME); read_miss = registry.counter(READ_MISS_NAME); registry.register(READ_HITRATIO_NAME, read_hit_ratio = new RatioGauge() { @Override protected Ratio getRatio() { Ratio ratio = Ratio.of(read_hit.getCount(), read.getCount()); return ratio; } }); write = registry.counter(WRITE_NAME); invalidation = registry.counter(INVALIDATE_ALL_NAME); registry.register(SIZE_NAME, size = new Gauge<Long>() { @Override public Long getValue() { return Long.valueOf(cache.getSize()); } }); }</code><technical_language>public</technical_language>

Target:
public CacheMetrics(Cache cache) { super(cache); registry = SharedMetricRegistries.getOrCreate(MetricsService.class.getName()); read = registry.counter(readName); read_hit = registry.counter(readHitName); read_miss = registry.counter(readMissName); registry.register(readHitRatio, read_hit_ratio = new RatioGauge() { @Override protected Ratio getRatio() { Ratio ratio = Ratio.of(read_hit.getCount(), read.getCount()); return ratio; } }); write = registry.counter(writeName); invalidation = registry.counter(invalidateAllName); registry.register(sizeName, size = new Gauge<Long>() { @Override public Long getValue() { return Long.valueOf(cache.getSize()); } }); }
Source:
<code>public TimeTZ value(Object value) { if (value == null) { return null; } if (value instanceof TimeTZ) { return (TimeTZ) value; } if (value instanceof String) { try { <START> return TimeTZParser.parse((String) value); <END> } catch (IllegalArgumentException e0) { try { return timeTZOf( TimeTZType.class.getSimpleName(), Long.valueOf((String) value)); } catch (NumberFormatException e1) { throw exceptionForInvalidLiteral(value); } } } throw exceptionForInvalidLiteral(value); }</code><technical_language>catch NumberFormatException thrown Long.valueOf, timeTZOf-> checkRange throw IllegalArgumentException is handled</technical_language>

Target:
public TimeTZ value(Object value) { if (value == null) { return null; } return (TimeTZ) value; }
Source:
<code>private void scrollToListSectionByOffset(int yOffset) { yOffset = DimenUtil.roundedPxToDp(yOffset); int itemToSelect = 0; for (int i = 1; i < adapter.getCount(); i++) { Section section = adapter.getItem(i); if (adapter.getYOffset(section.getId()) < yOffset) { itemToSelect = i; } else { break; } } if (itemToSelect != currentItemSelected) { adapter.setHighlightedSection(itemToSelect); currentItemSelected = itemToSelect; } <START> JavaScriptActionHandler.prepareToScrollTo(adapter.getItem(currentItemSelected).getAnchor(), "{ highlight: false }"); <END> tocList.smoothScrollToPositionFromTop(currentItemSelected, scrollerViewParams.topMargin - DimenUtil.roundedDpToPx(TOC_SECTION_TOP_OFFSET_ADJUST), 0); }</code><technical_language>Do need do this all? smooth thumb-scroller works fine it</technical_language>

Target:
private void scrollToListSectionByOffset(int yOffset) { yOffset = DimenUtil.roundedPxToDp(yOffset); int itemToSelect = 0; for (int i = 1; i < adapter.getCount(); i++) { Section section = adapter.getItem(i); if (adapter.getYOffset(section.getId()) < yOffset) { itemToSelect = i; } else { break; } } if (itemToSelect != currentItemSelected) { adapter.setHighlightedSection(itemToSelect); currentItemSelected = itemToSelect; } tocList.smoothScrollToPositionFromTop(currentItemSelected, scrollerViewParams.topMargin - DimenUtil.roundedDpToPx(TOC_SECTION_TOP_OFFSET_ADJUST), 0); }
Source:
<code>public InfoboxBuilderPage clickBuilderBackground() { <START> builderBackground.click(); <END> return this; }</code><technical_language>click, element is clickable</technical_language>

Target:
public InfoboxBuilderPage clickBuilderBackground() { wait.forElementClickable(builderBackground); builderBackground.click(); return this; }
Source:
<code>public RDTCommandLauncher(IProject project) { fProcess = null; fShowCommand = false; try { if (project.hasNature(SYNC_NATURE)) { IRemoteResource remoteRes = (IRemoteResource)project.getAdapter(IRemoteResource.class); uri = remoteRes.getActiveLocationURI(); } else{ uri = project.getLocationURI(); } lineSeparator = System.getProperty("line.separator", "\n"); } catch (CoreException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>Please print stack trace</technical_language>

Target:
public RDTCommandLauncher(IProject project) { fProcess = null; fShowCommand = false; try { if (project.hasNature(Messages.SYNC_NATURE)) { IRemoteResource remoteRes = (IRemoteResource)project.getAdapter(IRemoteResource.class); uri = remoteRes.getActiveLocationURI(); } else{ uri = project.getLocationURI(); } lineSeparator = System.getProperty("line.separator", "\n"); } catch (CoreException e) { uri = project.getLocationURI(); } }
Source:
<code>public synchronized Long getCommitTimestampIfPresent(Long startTimestamp) { Long firstCommitTimestamp = first.getCommitTimestampIfPresent(startTimestamp); Long secondCommitTimestamp = second.getCommitTimestampIfPresent(startTimestamp); if (firstCommitTimestamp == null || secondCommitTimestamp == null) { return Stream.of(firstCommitTimestamp, secondCommitTimestamp) .filter(Objects::nonNull) .findFirst() .orElse(null); } Preconditions.checkState(firstCommitTimestamp.equals(secondCommitTimestamp), <START> "There is a bug in cache implementation"); <END> return firstCommitTimestamp; }</code><technical_language>I include Args start timestamp commit timestamps reported of services in this case, for easier debugging</technical_language>

Target:
public synchronized Long getCommitTimestampIfPresent(Long startTimestamp) { Long firstCommitTimestamp = first.getCommitTimestampIfPresent(startTimestamp); Long secondCommitTimestamp = second.getCommitTimestampIfPresent(startTimestamp); if (firstCommitTimestamp == null || secondCommitTimestamp == null) { return Stream.of(firstCommitTimestamp, secondCommitTimestamp) .filter(Objects::nonNull) .findFirst() .orElse(null); } Preconditions.checkState( firstCommitTimestamp.equals(secondCommitTimestamp), "There is a bug in cache implementation", SafeArg.of("startTimestamp", startTimestamp), SafeArg.of("firstCommitTimestamp", firstCommitTimestamp), SafeArg.of("secondCommitTimestamp", secondCommitTimestamp)); return firstCommitTimestamp; }