auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void shutDownNodeSourceIfDeployed(String nodeSourceName, boolean preempt) { if (this.deployedNodeSources.containsKey(nodeSourceName)) { NodeSource nodeSourceToRemove = this.deployedNodeSources.get(nodeSourceName); this.removeAllNodes(nodeSourceName, preempt); NodeSourceStatus status = nodeSourceToRemove.getStatus(); this.nodeSourceUnregister(nodeSourceName, nodeSourceToRemove.getStatus(), new RMNodeSourceEvent(RMEventType.NODESOURCE_SHUTDOWN, this.caller.getName(), <START> nodeSourceName, <END> nodeSourceToRemove.getDescription(), nodeSourceToRemove.getAdministrator().getName(), status.toString())); nodeSourceToRemove.shutdown(this.caller); } }</code><technical_language>duplicate call getStatus()</technical_language>

Target:
private void shutDownNodeSourceIfDeployed(String nodeSourceName, boolean preempt) { if (this.deployedNodeSources.containsKey(nodeSourceName)) { NodeSource nodeSourceToRemove = this.deployedNodeSources.get(nodeSourceName); this.removeAllNodes(nodeSourceName, preempt); NodeSourceStatus status = nodeSourceToRemove.getStatus(); this.nodeSourceUnregister(nodeSourceName, status, new RMNodeSourceEvent(RMEventType.NODESOURCE_SHUTDOWN, this.caller.getName(), nodeSourceName, nodeSourceToRemove.getDescription(), nodeSourceToRemove.getAdministrator().getName(), status.toString())); nodeSourceToRemove.shutdown(this.caller); } }
Source:
<code>public void should_return_true_when_connectorEvent_isOnFinish(){ Connector connector = ProcessFactory.eINSTANCE.createConnector(); <START> connector.setEvent(ConnectorEvent.ON_FINISH.toString()); <END> assertTrue(onFinishFilter.select(viewer, null, connector)); }</code><technical_language>org.bonitasoft.studio.model.process.builders.ConnectorBuilder. write a one-liner for test: assertTrue(onFinishFilter.select(viewer, null, aConnector().onEvent(ConnectorEvent.ON_FINISH.name()).build()));</technical_language>

Target:
public void should_return_true_when_connectorEvent_isOnFinish() { final ConnectorEventFilter onFinishFilter = createConnectorEventFilter(); assertTrue(onFinishFilter.select(viewer, null, aConnector().onEvent(ConnectorEvent.ON_FINISH.name()).build())); }
Source:
<code><START> public Response remove(String id, Action action) { <END> return performAction(VdcActionType.RemoveVds, new RemoveVdsParameters(asGuid(id), action != null && action.isSetForce() ? action.isForce() : false)); }</code><technical_language>do "getEntity(id);" throw 404 if this is existent entity</technical_language>

Target:
public Response remove(String id, Action action) { getEntity(id); return performAction(VdcActionType.RemoveVds, new RemoveVdsParameters(asGuid(id), action != null && action.isSetForce() ? action.isForce() : false)); }
Source:
<code>public boolean apply(String networkDomainId) { checkNotNull(networkDomainId, "networkDomainId"); logger.trace("looking for state on network domain %s", networkDomainId); final NetworkDomain networkDomain = networkApi.getNetworkDomain(networkDomainId); if (networkDomain == null && state == State.DELETED) { return true; } if (networkDomain.state().isFailed()) { throw new IllegalStateException( <START> MessageFormat.format("Network Domain {0} is in FAILED state", networkDomain.id())); <END> } else { return networkDomain.state().equals(state); } }</code><technical_language>This more a check for caller? if expected state passed constructor is a "failed" one? I mean, is want individual classes meaningful complete method signatures</technical_language>

Target:
public boolean apply(String networkDomainId) { checkNotNull(networkDomainId, "networkDomainId"); logger.trace("looking for state on network domain %s", networkDomainId); final NetworkDomain networkDomain = networkApi.getNetworkDomain(networkDomainId); final boolean isDeleted = networkDomain == null && state == State.DELETED; return isDeleted || (networkDomain != null && networkDomain.state() == state); }
Source:
<code>public BindingProperties getBindingProperties(String channelName) { BindingProperties bindingProperties = new BindingProperties(); if (applicationContext != null) { RelaxedDataBinder defaultsDataBinder = new RelaxedDataBinder(bindingProperties, "spring.cloud.stream.default"); defaultsDataBinder.setDisallowedFields("destination"); defaultsDataBinder .bind(new PropertySourcesPropertyValues(applicationContext.getEnvironment().getPropertySources())); } if (this.bindings.containsKey(channelName)) { <START> BeanUtils.copyProperties(this.bindings.get(channelName), bindingProperties); <END> } if (bindingProperties.getDestination() == null) { bindingProperties.setDestination(channelName); } return bindingProperties; }</code><technical_language>this reset values set dataBinder (with spring.cloud.stream.default prefix) above? While this is need override spring.cloud.stream.default values binding properties provided explicitly (via cmdline for instance), spring.cloud.stream.default values get overridden application default values here. For instance, if application spring.cloud.stream.default.producer.partitionCount=5 set eventually of BeanUtils.copyProperties line:192</technical_language>

Target:
public BindingProperties getBindingProperties(String channelName) { BindingProperties bindingProperties = new BindingProperties(); if (this.bindings.containsKey(channelName)) { BeanUtils.copyProperties(this.bindings.get(channelName), bindingProperties); } if (bindingProperties.getDestination() == null) { bindingProperties.setDestination(channelName); } return bindingProperties; }
Source:
<code>public void commit() { try { <START> client.flush(name()); <END> } catch (IOException e) { throw new EsIndexException(e); } }</code><technical_language>Again, I understand Java API, IIUC client.flush(...) is explicitly telling ES flush memory index storage, ES do this automatically. If do this, commit() is place do it. is required? Do want force a flush get durability of write disk</technical_language>

Target:
public void commit() { try { client.refresh(name()); } catch (IOException e) { throw new EsIndexException(e); } }
Source:
<code>private void recursePath(final Path path, final Path resultPath) throws IOException { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { String relativePath = StringUtils.substringAfter(file.toString(), path.toString()); <START> if (relativePath.startsWith("/") && File.separatorChar == '\\') { <END> relativePath = relativePath.replace('/', '\\'); } relativePath = StringUtils.removeStart(relativePath, File.separator); Path resultFile = resultPath.resolve(relativePath); FileUtils.forceMkdir(resultFile.getParent().toFile()); Files.copy(file, resultFile, StandardCopyOption.REPLACE_EXISTING); return FileVisitResult.CONTINUE; } }); }</code><technical_language>Apache CommonsIO FilenameUtils.separatorsToSystem(String path) safe & cut verbosity. Also, utility a lot of other useful methods leveraging throughout: A few: normalize(String filename) //normalize unneeded relative paths simplify path. ex: a/b/../b a/b getExtension(String filename) //gets extension wildcardMatch(String filename, String wildcardMatcher) //allows compare extensions file names easily wildcard</technical_language>

Target:
private void recursePath(final Path path, final Path resultPath) throws IOException { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { String relativePath = StringUtils.substringAfter(file.toString(), path.toString()); relativePath = FilenameUtils.separatorsToSystem(relativePath); relativePath = StringUtils.removeStart(relativePath, File.separator); Path resultFile = resultPath.resolve(relativePath); FileUtils.forceMkdir(resultFile.getParent().toFile()); Files.copy(file, resultFile, StandardCopyOption.REPLACE_EXISTING); return FileVisitResult.CONTINUE; } }); }
Source:
<code>private String[] alterCipherList(String[] defaultCiphers) { ArrayList<String> preferredSuits = new ArrayList<>(); for (int i = 0; i < defaultCiphers.length; i++) { if (defaultCiphers[i].contains("_GCM_")) { LOG.debug("Removed Cipher - " + defaultCiphers[i] + " from list of " + <START> "enabled SSLSocket ciphers"); <END> } else { preferredSuits.add(defaultCiphers[i]); } } ciphers = preferredSuits.toArray(new String[0]); return ciphers; }</code><technical_language>SLF4J expansion inline; a lot of commons-logging era log statements, changing a line is time upgrade</technical_language>

Target:
private String[] alterCipherList(String[] defaultCiphers) { ArrayList<String> preferredSuits = new ArrayList<>(); for (int i = 0; i < defaultCiphers.length; i++) { if (defaultCiphers[i].contains("_GCM_")) { LOG.debug("Removed Cipher - from list of enabled SSLSocket ciphers", defaultCiphers[i]); } else { preferredSuits.add(defaultCiphers[i]); } } ciphers = preferredSuits.toArray(new String[0]); return ciphers; }
Source:
<code>public void realmListener_realmResultShouldBeSynced() { final AtomicBoolean changedOnce = new AtomicBoolean(false); final Realm realm = looperThread.realm; realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { realm.createObject(AllTypes.class); } }); final RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll(); assertEquals(1, results.size()); realm.addChangeListener(new RealmChangeListener<Realm>() { @Override public void onChange(Realm element) { if (!changedOnce.get()) { assertEquals(1, realm.where(AllTypes.class).count()); assertEquals(1, results.size()); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { AllTypes allTypes = realm.where(AllTypes.class).findFirst(); assertNotNull(allTypes); allTypes.deleteFromRealm(); <START> final RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll(); <END> assertEquals(0, results.size()); } }); changedOnce.set(true); } else { assertEquals(0, realm.where(AllTypes.class).count()); assertEquals(0, results.size()); realm.close(); looperThread.testComplete(); } } }); }</code><technical_language>realm.where(AllTypes.class).count() instead</technical_language>

Target:
public void realmListener_realmResultShouldBeSynced() { final AtomicInteger changeCounter = new AtomicInteger(0); final Realm realm = looperThread.realm; realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { realm.createObject(AllTypes.class); } }); final RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll(); assertEquals(1, results.size()); realm.addChangeListener(new RealmChangeListener<Realm>() { @Override public void onChange(Realm element) { switch (changeCounter.getAndIncrement()) { case 0: assertEquals(1, realm.where(AllTypes.class).count()); assertEquals(1, results.size()); realm.executeTransactionAsync(new Realm.Transaction() { @Override public void execute(Realm realm) { AllTypes allTypes = realm.where(AllTypes.class).findFirst(); assertNotNull(allTypes); allTypes.deleteFromRealm(); assertEquals(0, realm.where(AllTypes.class).count()); } }); break; case 1: assertEquals(0, realm.where(AllTypes.class).count()); assertEquals(0, results.size()); realm.close(); looperThread.testComplete(); break; default: break; } } }); }
Source:
<code><START> protected org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense buildNonEmployeeExpense() { <END> org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense expense = Mockito.spy(new org.kuali.kfs.fp.businessobject.DisbursementVoucherNonEmployeeExpense()); Mockito.doNothing().when(expense).refreshNonUpdateableReferences(); return expense; }</code><technical_language>import this Class method cleaner</technical_language>

Target:
protected DisbursementVoucherNonEmployeeExpense buildNonEmployeeExpense() { DisbursementVoucherNonEmployeeExpense expense = Mockito.spy(new DisbursementVoucherNonEmployeeExpense()); Mockito.doNothing().when(expense).refreshNonUpdateableReferences(); return expense; }
Source:
<code>public String getSearchPath() { StringBuilder tehPath = new StringBuilder(super.getSearchPath()); tehPath.append(File.pathSeparator); String androidJarPath = sdk.getSdkFolder().getAbsolutePath() + "/platforms/" + "android-" + AndroidBuild.sdkVersion + "/android.jar"; <START> System.out.println("androidJarPath = " + androidJarPath); <END> tehPath.append(androidJarPath); return tehPath.toString(); }</code><technical_language>Accidental debug string</technical_language>

Target:
public String getSearchPath() { String androidJarPath = sdk.getSdkFolder().getAbsolutePath() + "/platforms/" + "android-" + AndroidBuild.sdkVersion + "/android.jar"; return super.getSearchPath() + androidJarPath; }
Source:
<code><START> public static String getRegistriesSortByField(String sortBy) { <END> String updatedSortBy = EndpointRegistryConstants.COLUMN_ID; if (RestApiConstants.SORT_BY_ENDPOINT_REG_NAME.equals(sortBy)) { updatedSortBy = EndpointRegistryConstants.COLUMN_REG_NAME; } return updatedSortBy; }</code><technical_language>this work for other sortBy fields ID regName</technical_language>

Target:
public static String getRegistriesSortByField(String sortBy) { String updatedSortBy = EndpointRegistryConstants.COLUMN_ID; if (RestApiConstants.ENDPOINT_REG_NAME.equals(sortBy)) { updatedSortBy = EndpointRegistryConstants.COLUMN_REG_NAME; } return updatedSortBy; }
Source:
<code>public static Connection getTracingConnection() throws Exception { <START> return getTracingConnection(new HashMap<String, String>(0)); <END> }</code><technical_language>Collections.emptyMap()</technical_language>

Target:
public static Connection getTracingConnection() throws Exception { return getTracingConnection(Collections.<String, String>emptyMap(), null); }
Source:
<code>public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); <START> description.addProperty("allergen", rep); <END> description.addProperty("severity", rep); description.addProperty("comment", rep); description.addProperty("reactions", rep); description.addProperty("patient", rep); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); description.addProperty("allergen", rep); description.addProperty("severity", rep); description.addProperty("comment", rep); description.addProperty("reactions", rep); description.addProperty("patient", rep); description.addProperty("voided"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }</code><technical_language>allergen, severity, reactions patient Representation.REF</technical_language>

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); description.addProperty("allergen", Representation.REF); description.addProperty("severity", Representation.REF); description.addProperty("comment"); description.addProperty("reactions", Representation.REF); description.addProperty("patient", Representation.REF); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); description.addProperty("allergen", Representation.DEFAULT); description.addProperty("severity", Representation.DEFAULT); description.addProperty("comment"); description.addProperty("reactions", Representation.DEFAULT); description.addProperty("patient", Representation.DEFAULT); description.addProperty("voided"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }
Source:
<code>protected String getTempTableName(final String endpointId) { <START> return getTempTableName(endpointId, ""); <END> }</code><technical_language>StringUtils.EMPTY StringPool</technical_language>

Target:
protected String getTempTableName(final String endpointId) { return getTempTableName(endpointId, StringUtils.EMPTY); }
Source:
<code>protected void executeIrsBrokerCommand() { if (getParameters().getForce()) { try { Guid storagePoolId = getParameters().getStoragePoolId(); if (getParameters().isDetachFromOldStoragePool()) { storagePoolId = Guid.Empty; } status = getIrsProxy().forcedDetachStorageDomain(getParameters().getStorageDomainId().toString(), storagePoolId.toString()); proceedProxyReturnValue(); } catch (RuntimeException ex) { printReturnValue(); log.error("Could not force detach domain '{}' on pool '{}'. error: {}", getParameters().getStorageDomainId(), getParameters().getStoragePoolId(), ex.getMessage()); log.debug("Exception", ex); <START> if (ex instanceof VDSExceptionBase) { <END> getVDSReturnValue().setVdsError(((VDSExceptionBase) ex).getVdsError()); } getVDSReturnValue().setSucceeded(false); } } else { status = getIrsProxy().detachStorageDomain(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getMasterStorageDomainId().toString(), getParameters().getMasterVersion()); proceedProxyReturnValue(); } }</code><technical_language>try call proceedProxyReturnValue instead</technical_language>

Target:
protected void executeIrsBrokerCommand() { if (getParameters().getForce()) { Guid storagePoolId = getParameters().getStoragePoolId(); if (getParameters().isDetachFromOldStoragePool()) { storagePoolId = Guid.Empty; } status = getIrsProxy().forcedDetachStorageDomain(getParameters().getStorageDomainId().toString(), storagePoolId.toString()); proceedProxyReturnValue(); } else { status = getIrsProxy().detachStorageDomain(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getMasterStorageDomainId().toString(), getParameters().getMasterVersion()); proceedProxyReturnValue(); } }
Source:
<code>public void validate(FailureCollector collector) { IdUtils.validateReferenceName(referenceName, collector); if (suffix != null && !containsMacro(NAME_SUFFIX)) { try { new SimpleDateFormat(suffix); } catch (IllegalArgumentException e) { collector.addFailure("Invalid suffix.", "Ensure provided suffix is valid.") .withConfigProperty(NAME_SUFFIX).withStacktrace(e.getStackTrace()); } } <START> FileFormat format = FileFormat.CSV; <END> try { format = getFormat(); } catch (IllegalArgumentException e) { collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_FORMAT).withStacktrace(e.getStackTrace()); } try { Schema schema = getSchema(); if (format == FileFormat.CSV || format == FileFormat.DELIMITED || format == FileFormat.TSV) { boolean simpleFields = true; for (Schema.Field field : schema.getFields()) { if (!field.getSchema().isSimpleOrNullableSimple()) { simpleFields = false; break; } } collector.addFailure( String.format("Input has multi-level structure that cannot be represented appropriately in %s.", format.name()), "Consider using json, avro or parquet to write data." ).withConfigProperty(NAME_FORMAT); } } catch (IllegalArgumentException e) { collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_SCHEMA).withStacktrace(e.getStackTrace()); } if (collector.getValidationFailures().isEmpty()) { try { validate(); } catch (Exception e) { collector.addFailure(e.getMessage(), null).withStacktrace(e.getStackTrace()); } } }</code><technical_language>default CSV? changing CSV</technical_language>

Target:
public void validate(FailureCollector collector) { IdUtils.validateReferenceName(referenceName, collector); if (suffix != null && !containsMacro(NAME_SUFFIX)) { try { new SimpleDateFormat(suffix); } catch (IllegalArgumentException e) { collector.addFailure("Invalid suffix.", "Ensure provided suffix is valid.") .withConfigProperty(NAME_SUFFIX).withStacktrace(e.getStackTrace()); } } FileFormat format = FileFormat.JSON; try { format = getFormat(); } catch (IllegalArgumentException e) { collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_FORMAT).withStacktrace(e.getStackTrace()); } try { Schema schema = getSchema(); if (format == FileFormat.CSV || format == FileFormat.DELIMITED || format == FileFormat.TSV) { boolean allSimpleFields = schema.getFields().stream() .map(Schema.Field::getSchema) .allMatch(Schema::isSimpleOrNullableSimple); if (allSimpleFields == false) { collector.addFailure( String.format("Input has multi-level structure that cannot be represented appropriately in %s.", format.name()), "Consider using json, avro or parquet to write data." ).withConfigProperty(NAME_FORMAT); } } } catch (IllegalArgumentException e) { collector.addFailure(e.getMessage(), null).withConfigProperty(NAME_SCHEMA).withStacktrace(e.getStackTrace()); } if (collector.getValidationFailures().isEmpty()) { try { validate(); } catch (Exception e) { collector.addFailure(e.getMessage(), null).withStacktrace(e.getStackTrace()); } } }
Source:
<code>public List<InputRow> parseBatch(ByteBuffer input) { <START> return ImmutableList.of(parseMap(buildStringKeyMap(input))); <END> }</code><technical_language>Throws NPE if parseMap returns a null. in general prefer Utils.nullableListOf() instead of ImmutableList.of() - for example NoopInputRowParser throw NPE if input is null is behavior previously</technical_language>

Target:
public List<InputRow> parseBatch(ByteBuffer input) { return Utils.nullableListOf(parseMap(buildStringKeyMap(input))); }
Source:
<code><START> private Map<String, String> convertHeadersToMap(String headersString) { <END> Map<String, String> headersMap = new HashMap<>(); if (!Strings.isNullOrEmpty(headersString)) { List<String> headerChunks = Arrays.asList(headersString.split(DELIMITER)); for (String chunk : headerChunks) { String[] keyValue = chunk.split(KV_DELIMITER); headersMap.put(keyValue[0], keyValue[1]); } } return headersMap; }</code><technical_language>discussed a bit more, key-values, split colon</technical_language>

Target:
private Map<String, String> convertHeadersToMap(String headersString) { Map<String, String> headersMap = new HashMap<>(); if (!Strings.isNullOrEmpty(headersString)) { for (String chunk : headersString.split(DELIMITER)) { String[] keyValue = chunk.split(KV_DELIMITER, 2); if (keyValue.length == 2) { headersMap.put(keyValue[0], keyValue[1]); } else { throw new IllegalArgumentException(String.format("Unable to parse key-value pair '%s'.", chunk)); } } } return headersMap; }
Source:
<code>public void enterVolumePath(String path) { <START> seleniumWebDriverHelper.waitVisibility(newVolumePath).clear(); <END> seleniumWebDriverHelper.waitVisibility(newVolumePath).sendKeys(path); }</code><technical_language>This shorten command: seleniumWebDriverHelper.setValue(newVolumePath, path);</technical_language>

Target:
public void enterVolumePath(String path) { seleniumWebDriverHelper.setValue(newVolumePathElement, path); }
Source:
<code><START> public static String getCaseFileVariableName(Property p) { <END> String name = p.getName(); return name == null ? p.getId() : name; }</code><technical_language>this private, is other classes</technical_language>

Target:
private static String getCaseFileVariableName(Property p) { String name = p.getName(); return name == null ? p.getId() : name; }
Source:
<code>public @Nullable View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { <START> View v = inflater.inflate(R.layout.list_view_with_spinner_2, null); <END> mListView = (ListView) v.findViewById(R.id.list); ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.progress); if (mAdapter != null) { mListView.setAdapter(mAdapter); mListView.onRestoreInstanceState(mListState); progressBar.setVisibility(View.GONE); } mBinder.mListView = mListView; mBinder.mProgressBar = progressBar; mBinder.setNoDataView((NoDataView) v.findViewById(R.id.no_data)); return v; }</code><technical_language>More descriptive name</technical_language>

Target:
public @Nullable View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.list_view_with_spinner, null); mListView = (ListView) v.findViewById(R.id.list); ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.progress); if (mAdapter != null) { mListView.setAdapter(mAdapter); mListView.onRestoreInstanceState(mListState); progressBar.setVisibility(View.GONE); } mBinder.listView = mListView; mBinder.progressBar = progressBar; mBinder.setNoDataView((NoDataView) v.findViewById(R.id.no_data)); return v; }
Source:
<code>private <C extends Content> C createContent(C content, LoveFilmDataRow row, String resourceType, String curieType) { String sku = SKU.valueFrom(row); content.setPublisher(LOVEFILM); content.setCanonicalUri(uri(sku, resourceType)); content.setCurie(curie(sku, curieType)); <START> content.setLastUpdated(new DateTime()); <END> return content; }</code><technical_language>timezone</technical_language>

Target:
private <C extends Content> C createContent(C content, LoveFilmDataRow row, String resourceType, String curieType) { String sku = SKU.valueFrom(row); content.setPublisher(LOVEFILM); content.setCanonicalUri(uri(sku, resourceType)); content.setCurie(curie(sku, curieType)); content.setLastUpdated(new DateTime().withZone(DateTimeZone.UTC)); return content; }
Source:
<code>protected boolean isDetachAllowed(final boolean isRemoveLast) { boolean returnValue = true; if (getStoragePoolIsoMap() == null) { returnValue = false; addCanDoActionMessage(EngineMessage.STORAGE_DOMAIN_NOT_ATTACHED_TO_STORAGE_POOL); } else if (!isRemoveLast && isMaster()) { boolean isLastActive = getStorageDomainDao().getAllForStoragePool(getStorageDomain().getStoragePoolId()). stream().anyMatch (a <START> -> a.getId().equals(getStorageDomain().getId()) <END> && a.getStatus() == StorageDomainStatus.Active); if (!isLastActive) { returnValue = false; addCanDoActionMessage(EngineMessage.ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN); } } return returnValue; }</code><technical_language>change good- I this hole scope detach a domain if is in maintenance mode- a master domain if is in maintenance... this is function for checking if domain is attached (which checkStorageDomainStatus is in this flow's context), I is remove this function code</technical_language>

Target:
protected boolean isDetachAllowed(final boolean isRemoveLast) { boolean returnValue = true; if (getStoragePoolIsoMap() == null) { returnValue = false; addCanDoActionMessage(EngineMessage.STORAGE_DOMAIN_NOT_ATTACHED_TO_STORAGE_POOL); } else if (!isRemoveLast && isMaster()) { returnValue = false; addCanDoActionMessage(EngineMessage.ERROR_CANNOT_DETACH_LAST_STORAGE_DOMAIN); } return returnValue; }
Source:
<code>private void configureJob() throws Exception { <START> job = Job.getInstance(getConf(), "Update statistics for " + tableName); <END> PhoenixMapReduceUtil.setInput(job, NullDBWritable.class, snapshotName, tableName, restoreDir); PhoenixConfigurationUtil.setMRJobType(job.getConfiguration(), MRJobType.UPDATE_STATS); PhoenixConfigurationUtil.setSplitByStats(job.getConfiguration(), false); job.setJarByClass(UpdateStatisticsTool.class); job.setMapperClass(TableSnapshotMapper.class); job.setMapOutputKeyClass(NullWritable.class); job.setMapOutputValueClass(NullWritable.class); job.setOutputFormatClass(NullOutputFormat.class); job.setNumReduceTasks(0); TableMapReduceUtil.addDependencyJars(job); TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(), PhoenixConnection.class, Chronology.class, CharStream.class, TransactionSystemClient.class, TransactionNotInProgressException.class, ZKClient.class, DiscoveryServiceClient.class, ZKDiscoveryService.class, Cancellable.class, TTransportException.class, SpanReceiver.class, TransactionProcessor.class, Gauge.class, MetricRegistriesImpl.class); LOG.info("UpdateStatisticsTool running for: " + tableName + " on snapshot: " + snapshotName + " with restore dir: " + restoreDir); }</code><technical_language>Is benefit UI add some of options set job name</technical_language>

Target:
private void configureJob() throws Exception { job = Job.getInstance(getConf(), "UpdateStatistics-" + tableName + "-" + snapshotName); PhoenixMapReduceUtil.setInput(job, NullDBWritable.class, snapshotName, tableName, restoreDir); PhoenixConfigurationUtil.setMRJobType(job.getConfiguration(), MRJobType.UPDATE_STATS); PhoenixConfigurationUtil.setSplitByStats(job.getConfiguration(), false); job.setJarByClass(UpdateStatisticsTool.class); job.setMapperClass(TableSnapshotMapper.class); job.setMapOutputKeyClass(NullWritable.class); job.setMapOutputValueClass(NullWritable.class); job.setOutputFormatClass(NullOutputFormat.class); job.setNumReduceTasks(0); TableMapReduceUtil.addDependencyJars(job); TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(), PhoenixConnection.class, Chronology.class, CharStream.class, TransactionSystemClient.class, TransactionNotInProgressException.class, ZKClient.class, DiscoveryServiceClient.class, ZKDiscoveryService.class, Cancellable.class, TTransportException.class, SpanReceiver.class, TransactionProcessor.class, Gauge.class, MetricRegistriesImpl.class); LOG.info("UpdateStatisticsTool running for: " + tableName + " on snapshot: " + snapshotName + " with restore dir: " + restoreDir); }
Source:
<code>public synchronized void reset() { count = 0; <START> min = 0; <END> max = 0; samples.clear(); }</code><technical_language>If initial is Double.MAX_VALUE, this reset</technical_language>

Target:
public synchronized void reset() { count = 0; min = Double.MAX_VALUE; max = 0; samples.clear(); }
Source:
<code>private static void applySupportedClasses(SpannableStringBuilder text, String[] classes, int start, int end) { for (String className : classes) { if (ColorParser.isNamedColor(className)) { <START> int color = ColorParser.parseCssColor(className); <END> text.setSpan(new ForegroundColorSpan(color), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } }</code><technical_language>This is neat code re-use, WebVTT list is shorter list of CSS colors I clearer explicitly list WebVTT default colors. if defines a custom class called [papayawhip](<LINK_0> in style section do color, color cue (which is in-line WebVTT spec). I a private static final Map<String, Integer> DEFAULT_COLORS WebvttCueParser approach here. populate in a static initializer block in ColorParser. adding background color support 'different' - add a DEFAULT_BACKGROUND_COLORS map alongside. If time/inclination, feel free add in this PR! :)</technical_language>

Target:
private static void applySupportedClasses(SpannableStringBuilder text, String[] classes, int start, int end) { for (String className : classes) { if (DEFAULT_COLORS.containsKey(className)) { int color = DEFAULT_COLORS.get(className); text.setSpan(new ForegroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } if (DEFAULT_BACKGROUND_COLORS.containsKey(className)) { int color = DEFAULT_BACKGROUND_COLORS.get(className); text.setSpan(new BackgroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } }
Source:
<code>private ResolvedChannelGroup resolveAnnotationData( QueryContext ctxt, ChannelGroup<?> channelGroup ) { ResolvedChannelGroup.Builder resolvedChannelGroupBuilder = ResolvedChannelGroup.builder(channelGroup); resolvedChannelGroupBuilder.withRegionChannelGroups( contextHasAnnotation(ctxt, Annotation.REGIONS) ? resolveRegionChannelGroups(channelGroup) : Optional.absent() ); resolvedChannelGroupBuilder.withPlatformChannelGroup( contextHasAnnotation(ctxt, Annotation.PLATFORM) ? resolvePlatformChannelGroup(channelGroup) : Optional.absent() ); <START> if (contextHasAnnotation(ctxt, Annotation.CHANNEL_GROUPS_SUMMARY)) { <END> resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannelsWithAllChannelGroups(channelGroup) ); } else if (contextHasAnnotation(ctxt, Annotation.GENERIC_CHANNEL_GROUPS_SUMMARY)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannelsWithWhitelistedChannelGroups(channelGroup) ); } else if (contextHasAnnotation(ctxt, Annotation.ADVERTISED_CHANNELS) || contextHasAnnotation(ctxt, Annotation.CHANNELS)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannels(channelGroup) ); } else { resolvedChannelGroupBuilder.withAdvertisedChannels(Optional.absent()); } return resolvedChannelGroupBuilder.build(); }</code><technical_language>Ditto, if GENERIC_CHANNEL_GROUPS_SUMMARY is present get CHANNEL_GROUPS_SUMMARY hit branch miss added</technical_language>

Target:
private ResolvedChannelGroup resolveAnnotationData( QueryContext ctxt, ChannelGroup<?> channelGroup ) { ResolvedChannelGroup.Builder resolvedChannelGroupBuilder = ResolvedChannelGroup.builder(channelGroup); resolvedChannelGroupBuilder.withRegionChannelGroups( contextHasAnnotation(ctxt, Annotation.REGIONS) ? resolveRegionChannelGroups(channelGroup) : Optional.absent() ); resolvedChannelGroupBuilder.withPlatformChannelGroup( contextHasAnnotation(ctxt, Annotation.PLATFORM) ? resolvePlatformChannelGroup(channelGroup) : Optional.absent() ); if (contextHasAnnotation(ctxt, Annotation.CHANNEL_GROUPS_SUMMARY)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveChannelsWithChannelGroups( channelGroup, contextHasAnnotation( ctxt, Annotation.GENERIC_CHANNEL_GROUPS_SUMMARY ) ? this::idIsWhitelisted : id -> true ) ); } else if (contextHasAnnotation(ctxt, Annotation.ADVERTISED_CHANNELS) || contextHasAnnotation(ctxt, Annotation.CHANNELS)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannels(channelGroup) ); } else { resolvedChannelGroupBuilder.withAdvertisedChannels(Optional.absent()); } return resolvedChannelGroupBuilder.build(); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_circle_layer_clustering); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; map.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng( 12.099, -79.045), 3)); addClusteredGeoJsonSource(); <START> mapboxMap.getStyle().addImage("cross-icon-id", BitmapUtils.getBitmapFromDrawable( <END> getResources().getDrawable(R.drawable.ic_cross))); Toast.makeText(CircleLayerClusteringActivity.this, R.string.zoom_map_in_and_out_instruction, Toast.LENGTH_SHORT).show(); } }); } }); }</code><technical_language>style provided in callback</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_circle_layer_clustering); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; map.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng( 12.099, -79.045), 3)); addClusteredGeoJsonSource(style); style.addImage("cross-icon-id", BitmapUtils.getBitmapFromDrawable( getResources().getDrawable(R.drawable.ic_cross))); Toast.makeText(CircleLayerClusteringActivity.this, R.string.zoom_map_in_and_out_instruction, Toast.LENGTH_SHORT).show(); } }); } }); }
Source:
<code>private void uploadFiles(String container, List<BlobDetail> blobDetails) throws InterruptedException, ExecutionException { ListeningExecutorService executor = null; try { executor = MoreExecutors.listeningDecorator(newFixedThreadPool(THREADS)); List<ListenableFuture<BlobDetail>> blobUploaderFutures = Lists.newArrayList(); <START> BlobUploaderCallback blobUploaderCallback = new BlobUploaderCallback(); <END> for (BlobDetail blobDetail: blobDetails) { BlobUploader blobUploader = new BlobUploader(container, blobDetail); ListenableFuture<BlobDetail> blobDetailFuture = executor.submit(blobUploader); blobUploaderFutures.add(blobDetailFuture); Futures.addCallback(blobDetailFuture, blobUploaderCallback); } ListenableFuture<List<BlobDetail>> future = Futures.successfulAsList(blobUploaderFutures); List<BlobDetail> uploadedBlobDetails = future.get(); System.out.println(); for (int i = 0; i < uploadedBlobDetails.size(); i++) { if (uploadedBlobDetails.get(i) != null) { BlobDetail blobDetail = uploadedBlobDetails.get(i); System.out.format(" %s (eTag: %s)\n", blobDetail.getRemoteBlobName(), blobDetail.getETag()); } else { System.out.format(" %s (ERROR)\n", blobDetails.get(i).getLocalFile().getAbsolutePath()); } } } finally { if (executor != null) { executor.shutdown(); } } }</code><technical_language>of calls throw exception (since [THREADS > 0](<LINK_0>, move this out of try block? need if (executor != null)... check in finally below..</technical_language>

Target:
private void uploadFiles(String container, List<BlobDetail> blobDetails) throws InterruptedException, ExecutionException { ListeningExecutorService executor = MoreExecutors.listeningDecorator(newFixedThreadPool(THREADS)); List<ListenableFuture<BlobDetail>> blobUploaderFutures = Lists.newArrayList(); BlobUploaderCallback blobUploaderCallback = new BlobUploaderCallback(); try { for (BlobDetail blobDetail: blobDetails) { BlobUploader blobUploader = new BlobUploader(container, blobDetail); ListenableFuture<BlobDetail> blobDetailFuture = executor.submit(blobUploader); blobUploaderFutures.add(blobDetailFuture); Futures.addCallback(blobDetailFuture, blobUploaderCallback); } ListenableFuture<List<BlobDetail>> future = Futures.successfulAsList(blobUploaderFutures); List<BlobDetail> uploadedBlobDetails = future.get(); System.out.println(); for (int i = 0; i < uploadedBlobDetails.size(); i++) { if (uploadedBlobDetails.get(i) != null) { BlobDetail blobDetail = uploadedBlobDetails.get(i); System.out.format(" %s (eTag: %s)\n", blobDetail.getRemoteBlobName(), blobDetail.getETag()); } else { System.out.format(" %s (ERROR)\n", blobDetails.get(i).getLocalFile().getAbsolutePath()); } } } finally { executor.shutdown(); } }
Source:
<code>public boolean matches(NameKey name) { <START> boolean isMatch; <END> if (projectPatterns.isEmpty()) { isMatch = true; } else { isMatch = false; String projectName = name.get(); for (String pattern : projectPatterns) { isMatch = matchesPattern(projectName, pattern); if (isMatch) { break; } } } return isMatch; }</code><technical_language>optional: isMatch variable removed, below..</technical_language>

Target:
public boolean matches(NameKey name) { if (projectPatterns.isEmpty()) { return true; } else { String projectName = name.get(); for (String pattern : projectPatterns) { if (matchesPattern(projectName, pattern)) { return true; } } } return false; }
Source:
<code><START> public static EventSubscriberMethod forMessage(Class<?> cls, Message eventMessage) { <END> final Class<? extends Message> eventClass = eventMessage.getClass(); final MethodRegistry registry = MethodRegistry.getInstance(); final EventSubscriberMethod method = registry.get(cls, eventClass, factory()); if (method == null) { throw missingEventHandler(cls, eventClass); } return method; }</code><technical_language>ensure parameters nulls</technical_language>

Target:
public static EventSubscriberMethod forMessage(Class<?> cls, Message eventMessage) { checkNotNull(cls); checkNotNull(eventMessage); final Class<? extends Message> eventClass = eventMessage.getClass(); final MethodRegistry registry = MethodRegistry.getInstance(); final EventSubscriberMethod method = registry.get(cls, eventClass, factory()); if (method == null) { throw missingEventHandler(cls, eventClass); } return method; }
Source:
<code>public static <C extends Comparable<?>> Renderer<Range<C>> range(String rangeResourceKeyPrefix, Renderer<C> renderer) { <START> return range(rangeResourceKeyPrefix, renderer, renderer).nullsAsNull(); <END> }</code><technical_language>I call .nullsAsNull() is useless called in range method called</technical_language>

Target:
public static <C extends Comparable<?>> Renderer<Range<C>> range(String rangeResourceKeyPrefix, Renderer<C> renderer) { return range(rangeResourceKeyPrefix, renderer, renderer); }
Source:
<code>public void build(@NotNull ElixirTarget target, @NotNull DirtyFilesHolder<ElixirSourceRootDescriptor, ElixirTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException { LOG.info(target.getPresentableName()); final Set<File> filesToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY); holder.processDirtyFiles(new FileProcessor<ElixirSourceRootDescriptor, ElixirTarget>() { @Override public boolean apply(ElixirTarget target, File file, ElixirSourceRootDescriptor root) throws IOException { boolean isAcceptFile = target.isTests() ? ELIXIR_TEST_SOURCE_FILTER.accept(file) : ELIXIR_SOURCE_FILTER.accept(file); if(isAcceptFile && ourCompilableModuleTypes.contains(target.getModule().getModuleType())){ filesToCompile.add(file); } return true; } }); if(filesToCompile.isEmpty() && !holder.hasRemovedFiles()) return; JpsModule module = target.getModule(); JpsProject project = module.getProject(); ElixirCompilerOptions compilerOptions = JpsElixirCompilerOptionsExtension.getOrCreateExtension(project).getOptions(); if(compilerOptions.myUseMixCompiler){ doBuildWithMix(target, context, module, compilerOptions); } else { if(!target.isTests()){ <START> doBuildWithElixic(target, context, module, compilerOptions, filesToCompile); <END> } } }</code><technical_language>[x] If doBuildWithElixic is a typo [fix it](<LINK_0>, need update this doBuildWithElixirc</technical_language>

Target:
public void build(@NotNull ElixirTarget target, @NotNull DirtyFilesHolder<ElixirSourceRootDescriptor, ElixirTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException { LOG.info(target.getPresentableName()); final Set<File> filesToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY); holder.processDirtyFiles(new FileProcessor<ElixirSourceRootDescriptor, ElixirTarget>() { @Override public boolean apply(ElixirTarget target, File file, ElixirSourceRootDescriptor root) throws IOException { boolean isAcceptFile = target.isTests() ? ELIXIR_TEST_SOURCE_FILTER.accept(file) : ELIXIR_SOURCE_FILTER.accept(file); if(isAcceptFile && ourCompilableModuleTypes.contains(target.getModule().getModuleType())){ filesToCompile.add(file); } return true; } }); if(filesToCompile.isEmpty() && !holder.hasRemovedFiles()) return; JpsModule module = target.getModule(); JpsProject project = module.getProject(); ElixirCompilerOptions compilerOptions = JpsElixirCompilerOptionsExtension.getOrCreateExtension(project).getOptions(); if(compilerOptions.myUseMixCompiler){ doBuildWithMix(target, context, module, compilerOptions); } else { if(!target.isTests()){ doBuildWithElixirc(target, context, module, compilerOptions, filesToCompile); } } }
Source:
<code>public ResourceReference parse(String rawReference) { ResourceReference resourceReference = parseURILinks(rawReference); if (resourceReference != null) { return resourceReference; } StringBuilder content = new StringBuilder(rawReference); resourceReference = parseInterWikiLinks(content); if (resourceReference != null) { return resourceReference; } else{ resourceReference = new ResourceReference(rawReference, ResourceType.URL); resourceReference.setTyped(false); return resourceReference; } <START> <END> }</code><technical_language>unnecessary ? I understand step 4 is happen of time (we interwiki links in context of a running XWiki instance wiki mode). thinking this. supposed modify logic of method, improve codestyle</technical_language>

Target:
public ResourceReference parse(String rawReference) { ResourceReference resourceReference = parseURILinks(rawReference); if (resourceReference == null) { StringBuilder content = new StringBuilder(rawReference); resourceReference = parseInterWikiLinks(content); } if(resourceRefernece != null) { return resourceReference; } if (!isInWikiMode()) { resourceReference = new ResourceReference(rawReference, ResourceType.URL); resourceReference.setTyped(false); return resourceReference; } return parseDocumentLink(content); }
Source:
<code>public TrainingConfig build(){ if(!skipValidation) { Preconditions.checkState(updater != null, "Updater (optimizer) must not be null. Use updater(IUpdater) to set an updater"); Preconditions.checkState(dataSetFeatureMapping != null, "No DataSet feature mapping has been provided. A " + "mapping between DataSet array positions and variables/placeholders must be provided - use dateSetFeatureMapping(...) to set this"); Preconditions.checkState(markLabelsUnused || dataSetLabelMapping != null, "No DataSet label mapping has been provided. A " + <START> "mapping between DataSet array positions and variables/placeholders must be provided - use dateSetLabelMapping(...) to set this," + <END> " or markLabelsUnused() to mark labels as unused (for example, for unsupervised learning)"); } return new TrainingConfig(updater, regularization, minimize, dataSetFeatureMapping, dataSetLabelMapping, dataSetFeatureMaskMapping, dataSetLabelMaskMapping, trainableParams, lossVariables); }</code><technical_language>typo: dateSetFeatureMapping dateSetLabelMapping dataSetFeatureMapping dataSetLabelMapping</technical_language>

Target:
public TrainingConfig build(){ if(!skipValidation) { Preconditions.checkState(updater != null, "Updater (optimizer) must not be null. Use updater(IUpdater) to set an updater"); Preconditions.checkState(dataSetFeatureMapping != null, "No DataSet feature mapping has been provided. A " + "mapping between DataSet array positions and variables/placeholders must be provided - use dateSetFeatureMapping(...) to set this"); Preconditions.checkState(markLabelsUnused || dataSetLabelMapping != null, "No DataSet label mapping has been provided. A " + "mapping between DataSet array positions and variables/placeholders must be provided - use dataSetLabelMapping(...) to set this," + " or use markLabelsUnused() to mark labels as unused (for example, for unsupervised learning)"); } return new TrainingConfig(updater, regularization, minimize, dataSetFeatureMapping, dataSetLabelMapping, dataSetFeatureMaskMapping, dataSetLabelMaskMapping, trainableParams, lossVariables); }
Source:
<code>public void stop(Throwable cause) throws Exception { <START> if (body != null) <END> body.cancel(cause); Run<?, ?> r = getContext().get(Run.class); TaskListener listener = getContext().get(TaskListener.class); ThrottleJobProperty.DescriptorImpl descriptor = Jenkins.getActiveInstance().getDescriptorByType(ThrottleJobProperty.DescriptorImpl.class); descriptor.removeThrottledPipelineForCategory(r.getExternalizableId(), getCategory(), listener); }</code><technical_language>This method left blank-will called for a block-scoped step anyway, is returning start BodyInvoker.start</technical_language>

Target:
public void stop(Throwable cause) throws Exception { }