auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isChangedBy(ProductContentData dto) { if (dto == null) { throw new IllegalArgumentException("dto is null"); } if (dto.isEnabled() != null && !dto.isEnabled().equals(this.enabled)) { return true; } if (dto.getContent() != null) { ContentData dtoContent = dto.getContent(); if (this.content == null || (dtoContent.getUuid() != null && !dtoContent.getUuid().contentEquals(this.getContent().getUuid())) || (dtoContent.getId() != null && <START> !dtoContent.getId().contentEquals(this.getContent().getId())) || <END> this.content.isChangedBy(dto.getContent())) { return true; } } return false; }</code><technical_language>careful this comparison here. If caring UUID (which in this case -- a one-to-one comparison for differences in content), need compare UUIDs for identification, falling ID UUID is present. Also, in mind return non-String CharSequences of methods (on account of immutability is pretty handy), need contentEquals "normal" equals. In event, I drop instances here. This type of operation in DTO branch (identification comparison), ID check is done in nested isChangedBy call, UUID check break version comparison bits currently rely ignoring UUID checking for data changes</technical_language>

Target:
public boolean isChangedBy(ProductContentData dto) { if (dto == null) { throw new IllegalArgumentException("dto is null"); } if (dto.isEnabled() != null && !dto.isEnabled().equals(this.enabled)) { return true; } if (dto.getContent() != null) { if (this.content == null || this.content.isChangedBy(dto.getContent())) { return true; } } return false; }
Source:
<code>public static SAXParserFactory newSecureSAXParserFactory() { SAXParserFactory factory = SAXParserFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); <START> } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) { <END> LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Feature not supported", e)); } return factory; }</code><technical_language>Note in Oxygen this bundle updated java 8 yet</technical_language>

Target:
public static SAXParserFactory newSecureSAXParserFactory() { SAXParserFactory factory = SAXParserFactory.newInstance(); try { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); } catch (ParserConfigurationException e) { LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Feature not supported", e)); } catch (SAXException e) { LogHelper.log(new Status(IStatus.WARNING, Activator.ID, "Feature not supported", e)); } return factory; }
Source:
<code>public void progress() { if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) { this.remove(); return; <START> } else if (duration != 0 && System.currentTimeMillis() > this.getStartTime() + duration) { <END> remove(); return; } if (!this.player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 60, this.resistance, true)); } if (!this.player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, this.strength, true)); } }</code><technical_language>duration variable qualified this keyword</technical_language>

Target:
public void progress() { if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) { this.remove(); return; } else if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) { remove(); return; } if (!this.player.hasPotionEffect(PotionEffectType.DAMAGE_RESISTANCE)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 60, this.resistance, true)); } if (!this.player.hasPotionEffect(PotionEffectType.INCREASE_DAMAGE)) { this.player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, this.strength, true)); } }
Source:
<code>BundleBuilder(JUnitFramework ws) { <START> checkNonNullArgument(ws, "'ws' cannot be null"); <END> this.ws = ws; bundleSymbolicName("test-" + JUnitFrameworkBuilder.counter.incrementAndGet()); }</code><technical_language>Objects.requireNonNull</technical_language>

Target:
BundleBuilder(JUnitFramework ws) { requireNonNull(ws, "'ws' cannot be null"); this.ws = ws; bundleSymbolicName("test-" + JUnitFrameworkBuilder.counter.incrementAndGet()); }
Source:
<code>public AVideo(URL url) { if (url == null) <START> throw new IllegalArgumentException("null url"); <END> _name = getName(url); _url = url; _isdata = DYNAMIC_STREAM; _data = null; _file = null; }</code><technical_language>"url null"? a completed sentence</technical_language>

Target:
public AVideo(URL url) { if (url == null) throw new IllegalArgumentException("url cannot be null"); _name = getName(url); _url = url; _isdata = DYNAMIC_STREAM; _data = null; _file = null; }
Source:
<code>public Target(String targetUriAsString) { <START> super(); <END> Assert.hasText(targetUriAsString, "The provided targetUriAsString must neither be null nor empty."); this.targetUri = URI.create(targetUriAsString); }</code><technical_language>Do need super(), if class is inheriting a super class</technical_language>

Target:
public Target(String targetUriAsString) { Assert.hasText(targetUriAsString, "The provided targetUriAsString must neither be null nor empty."); this.targetUri = URI.create(targetUriAsString); }
Source:
<code>public RenameCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("i", "input", true, "load ontology from a file"); o.addOption("I", "input-iri", true, "load ontology from an IRI"); o.addOption("o", "output", true, "save ontology to a file"); o.addOption("m", "mappings", true, "table of mappings for renaming"); o.addOption("r", "prefix-mappings", true, "table of prefix mappings for renaming"); o.addOption("A", "add-prefix", true, "add a new prefix to ontology file header"); <START> o.addOption("f", "allow-duplicates", true, "allow two or more terms to be renamed to the same full IRI"); <END> options = o; }</code><technical_language>-allow-duplicates is a name, "f" is a good short name. "a" "d", short name</technical_language>

Target:
public RenameCommand() { Options o = CommandLineHelper.getCommonOptions(); o.addOption("i", "input", true, "load ontology from a file"); o.addOption("I", "input-iri", true, "load ontology from an IRI"); o.addOption("o", "output", true, "save ontology to a file"); o.addOption("m", "mappings", true, "table of mappings for renaming"); o.addOption("r", "prefix-mappings", true, "table of prefix mappings for renaming"); o.addOption("A", "add-prefix", true, "add a new prefix to ontology file header"); o.addOption("d", "allow-duplicates", true, "allow two or more terms to be renamed to the same full IRI"); options = o; }
Source:
<code>private void checkUserControllableLocationHeaderValue( HttpMessage msg, int id, Set<HtmlParameter> params, String responseLocation) { if (responseLocation.length() == 0) { return; } String requestDomain = null; try { requestDomain = msg.getRequestHeader().getURI().getAuthority(); } catch (URIException ex) { logger.error( "unable to get URI from Request. Ignoring and moving ahead with the scanning OpenRedirect", <START> ex); <END> } String protocol = null; String domain = null; String token = null; if (responseLocation.indexOf("://") > 0) { URL responseURL; try { responseURL = new URL(responseLocation); } catch (MalformedURLException e) { return; } protocol = responseURL.getProtocol(); domain = responseURL.getAuthority(); } else { if (responseLocation.indexOf("/") > 0) { token = responseLocation.substring(0, responseLocation.indexOf("/")); } else { token = responseLocation; } } for (HtmlParameter param : params) { String paramValue = param.getValue(); if (paramValue == null || paramValue.length() == 0) { continue; } if (paramValue.equalsIgnoreCase(protocol) || paramValue.equalsIgnoreCase(domain) || paramValue.equalsIgnoreCase(token) || (responseLocation.indexOf("://") > 0 && paramValue.indexOf(responseLocation) >= 0)) { if (token != null || requestDomain == null || !requestDomain.equalsIgnoreCase(domain)) { raiseAlert(msg, id, param.getName(), paramValue, responseLocation); } } } }</code><technical_language>Please change this a leading capital Unable. is worth continuing here? If getAuthority() fails requestDomain is null return</technical_language>

Target:
private void checkUserControllableLocationHeaderValue( HttpMessage msg, int id, Set<HtmlParameter> params, String responseLocation) { if (responseLocation.length() == 0) { return; } String requestDomain = null; try { requestDomain = msg.getRequestHeader().getURI().getAuthority(); } catch (URIException ex) { LOGGER.warn( "Unable to get authority from URI :" + msg.getRequestHeader().getURI() + ". Ignoring and moving ahead with the scanning OpenRedirect", ex); } String domain = null; if (responseLocation.indexOf("://") > 0) { URL responseURL; try { responseURL = new URL(responseLocation); } catch (MalformedURLException e) { return; } domain = responseURL.getAuthority(); } if (requestDomain != null && requestDomain.equalsIgnoreCase(domain)) { return; } for (HtmlParameter param : params) { String paramValue = param.getValue(); if (paramValue == null || paramValue.length() == 0) { continue; } if (paramValue.equalsIgnoreCase(domain) || (responseLocation.indexOf("://") > 0 && paramValue.indexOf(responseLocation) >= 0)) { raiseAlert(msg, id, param.getName(), paramValue, responseLocation); } } }
Source:
<code>public static Block stEnvelopeAsPts(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); <START> BlockBuilder blockBuilder = VARCHAR.createBlockBuilder(null, 2); <END> if (envelope == null) { VARCHAR.writeSlice(blockBuilder, EMPTY_MULTIPOINT); VARCHAR.writeSlice(blockBuilder, EMPTY_MULTIPOINT); } else { Point point1 = new Point(envelope.getXMin(), envelope.getYMin()); Point point2 = new Point(envelope.getXMax(), envelope.getYMax()); VARCHAR.writeSlice(blockBuilder, serialize(createFromEsriGeometry(point1, null, false))); VARCHAR.writeSlice(blockBuilder, serialize(createFromEsriGeometry(point2, null, false))); } return blockBuilder.build(); }</code><technical_language>VARCHAR? a GEOMETRY_TYPE</technical_language>

Target:
public static Block stEnvelopeAsPts(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { Envelope envelope = deserializeEnvelope(input); if (envelope == null) { return null; } BlockBuilder blockBuilder = GEOMETRY.createBlockBuilder(null, 2); Point lowerLeftCorner = new Point(envelope.getXMin(), envelope.getYMin()); Point upperRightCorner = new Point(envelope.getXMax(), envelope.getYMax()); GEOMETRY.writeSlice(blockBuilder, serialize(createFromEsriGeometry(lowerLeftCorner, null, false))); GEOMETRY.writeSlice(blockBuilder, serialize(createFromEsriGeometry(upperRightCorner, null, false))); return blockBuilder.build(); }
Source:
<code>public List<String> getResourcesTypes() { <START> return Lists.newArrayList("brooklyn.nodes.Compute"); <END> }</code><technical_language>Collections.singletonList fractionally more efficient</technical_language>

Target:
public List<String> getResourcesTypes() { return Collections.singletonList("brooklyn.nodes.Compute"); }
Source:
<code>public void testModuleGroups() throws Exception { Map<String, String> results = new HashMap<>(); results.put(QuboleConstant.BIGDATALAUNCHER_MODULE_GROUP.getModuleName(), null); results.put(QuboleConstant.HIVE_MODULE_GROUP.getModuleName(), null); Set<DistributionModuleGroup> moduleGroups = QuboleHiveModuleGroup.getModuleGroups(); assertEquals(2, moduleGroups.size()); for (DistributionModuleGroup module : moduleGroups) { assertTrue("Should contain module " + module.getModuleName(), results.containsKey(module.getModuleName())); if (results.get(module.getModuleName()) == null) { <START> assertTrue("The condition of the module " + module.getModuleName() + " is not null.", END> results.get(module.getModuleName()) == null); } else { assertTrue("The condition of the module " + module.getModuleName() + " is null, but it should be " + results.get(module.getModuleName()) + ".", results.get(module.getModuleName()) != null); assertEquals(results.get(module.getModuleName()), module.getRequiredIf().getConditionString()); } } }</code><technical_language>assert condition is if condition if useless</technical_language>

Target:
public void testModuleGroups() throws Exception { Set<DistributionModuleGroup> moduleGroups = QuboleHiveModuleGroup.getModuleGroups(); assertEquals(2, moduleGroups.size()); moduleGroups.contains(QuboleConstant.BIGDATALAUNCHER_MODULE_GROUP); moduleGroups.contains(QuboleConstant.HIVE_MODULE_GROUP); for (DistributionModuleGroup group : moduleGroups) { assertNull(group.getRequiredIf()); } }
Source:
<code><START> private ValueArray convertToKey(ValueArray r, Boolean minmax) { <END> if (r == null) { return null; } Value[] values = r.getList().clone(); ValueArray row = ValueArray.get(values); if (minmax != null) { values[values.length - 1] = ValueLong.get(minmax ? Long.MAX_VALUE : Long.MIN_VALUE); } return row; }</code><technical_language>This method static avoid a warning if warnings enabled</technical_language>

Target:
private static ValueArray convertToKey(ValueArray r, Boolean minmax) { if (r == null) { return null; } Value[] values = r.getList().clone(); ValueArray row = ValueArray.get(values); if (minmax != null) { values[values.length - 1] = ValueLong.get(minmax ? Long.MAX_VALUE : Long.MIN_VALUE); } return row; }
Source:
<code>static Method getPropertyGetter(Class<?> clazz, String propertyName) { final String upperPropertyName = Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); <START> final Pattern pattern = Pattern.compile("(get|has|is)(" + upperPropertyName + ")"); <END> for (Method method : clazz.getMethods()) { if ((pattern.matcher(method.getName()).matches() && Modifier.isPublic(method.getModifiers())) && method.getParameterTypes().length == 0) { return method; } } return null; }</code><technical_language>.. + Pattern.quote(upperPropertyName) + ..</technical_language>

Target:
static Method getPropertyGetter(Class<?> clazz, String propertyName) { final String upperPropertyName = Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); final Pattern pattern = Pattern.compile("(get|has|is)(" + Pattern.quote(upperPropertyName) + ")"); for (Method method : clazz.getMethods()) { if ((pattern.matcher(method.getName()).matches() && Modifier.isPublic(method.getModifiers())) && method.getParameterTypes().length == 0) { return method; } } return null; }
Source:
<code>private TTransport getTransport(ThriftTransportKey cacheKey) throws TTransportException { cacheKey.precomputeHashCode(); CachedConnections ccl = getCache().get(cacheKey); <START> if (ccl == null) { <END> ccl = new CachedConnections(); getCache().put(cacheKey, ccl); } CachedConnection cachedConnection = ccl.reserveAny(); if (cachedConnection != null) { log.trace("Using existing connection to {}", cacheKey.getServer()); return cachedConnection.transport; } return createNewTransport(cacheKey); }</code><technical_language>replace this if get : java CachedConnections ccl = getCache().computeIfAbsent(cacheKey, ck -> new CachedConnections); a concurrent map handle this correctly for multiple threads</technical_language>

Target:
private TTransport getTransport(ThriftTransportKey cacheKey) throws TTransportException { cacheKey.precomputeHashCode(); synchronized (this) { CachedConnection cachedConnection = getCache().computeIfAbsent(cacheKey, ck -> new CachedConnections()).reserveAny(); if (cachedConnection != null) { log.trace("Using existing connection to {}", cacheKey.getServer()); return cachedConnection.transport; } } return createNewTransport(cacheKey); }
Source:
<code>protected void validateCheckReconciliation(StaleCheckBatchRow staleCheckRow, CheckReconciliation checkReconciliation, List<String> validationErrors) { if (!StringUtils.equalsIgnoreCase(staleCheckRow.getBankCode(), checkReconciliation.getBankCode())) { validationErrors.add("The Bank Code in the file (" + staleCheckRow.getBankCode() + ") row does not match the bank on the Check (" + checkReconciliation.getBankCode() + ")."); } try { Double checkTotalAmountParsed = NumberFormat.getNumberInstance(java.util.Locale.US).parse(staleCheckRow.getCheckTotalAmount()).doubleValue(); <START> KualiDecimal checkTotalAmount = new KualiDecimal(checkTotalAmountParsed); <END> if (!checkTotalAmount.equals(checkReconciliation.getAmount())) { validationErrors.add("The Total Check Amount in the file row (" + checkTotalAmount.toString() + ") does not match the amount on the Check (" + checkReconciliation.getAmount().toString() + ")."); } } catch (java.text.ParseException ex) { validationErrors.add("Error converting total amount to decimal [" + staleCheckRow.getCheckTotalAmount() + "] " + ex.toString()); } if (StringUtils.equalsIgnoreCase(checkReconciliation.getStatus(), CRConstants.STALE)) { validationErrors.add("Check Status is already STALE."); } }</code><technical_language>KualiDecimal a constructor accepts a String input, need parse String NumberFormat explicitly</technical_language>

Target:
protected void validateCheckReconciliation(StaleCheckBatchRow staleCheckRow, CheckReconciliation checkReconciliation, List<String> validationErrors) { if (!StringUtils.equalsIgnoreCase(staleCheckRow.getBankCode(), checkReconciliation.getBankCode())) { validationErrors.add("The Bank Code in the file (" + staleCheckRow.getBankCode() + ") row does not match the bank on the Check (" + checkReconciliation.getBankCode() + ")."); } try { KualiDecimal checkTotalAmount = new KualiDecimal(staleCheckRow.getCheckTotalAmount()); if (!checkTotalAmount.equals(checkReconciliation.getAmount())) { validationErrors.add("The Total Check Amount in the file row (" + checkTotalAmount.toString() + ") does not match the amount on the Check (" + checkReconciliation.getAmount().toString() + ")."); } if (StringUtils.equalsIgnoreCase(checkReconciliation.getStatus(), CRConstants.STALE)) { validationErrors.add("Check Status is already STALE."); } } catch (NumberFormatException ex) { validationErrors.add("Error converting total amount to decimal [" + staleCheckRow.getCheckTotalAmount() + "] " + ex.toString()); } }
Source:
<code>private static void build(StringBuilder result, String name, String typeText, boolean isGetter) { <START> result.append("private function "); <END> result.append(isGetter ? HaxePresentableUtil.getterName(name) : HaxePresentableUtil.setterName(name)); result.append("("); if (!isGetter) { result.append("value"); if (!typeText.isEmpty()) { result.append(":"); result.append(typeText); } } result.append(")"); if (isGetter && !typeText.isEmpty()) { result.append(":"); result.append(typeText); } result.append("{\n"); if (isGetter) { result.append("return "); result.append(name); result.append(";"); } else { result.append("return "); result.append("this."); result.append(name); result.append("=value;"); } result.append("\n}"); }</code><technical_language>public is a default, though. point of a getter setter is expose variable class interface, it</technical_language>

Target:
private static void build(StringBuilder result, String name, String typeText, boolean isGetter) { result.append("function "); result.append(isGetter ? HaxePresentableUtil.getterName(name) : HaxePresentableUtil.setterName(name)); result.append("("); if (!isGetter) { result.append("value"); if (!typeText.isEmpty()) { result.append(":"); result.append(typeText); } } result.append(")"); if (isGetter && !typeText.isEmpty()) { result.append(":"); result.append(typeText); } result.append("{\n"); if (isGetter) { result.append("return "); result.append(name); result.append(";"); } else { result.append("return "); result.append("this."); result.append(name); result.append("=value;"); } result.append("\n}"); }
Source:
<code>protected boolean includeJavaEngineIndicator() { for (ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) { if (modelElementIndicator.containsAny(IndicatorEnum.getJavaIndicatorsEnum()) || modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) <START> && searchJUDI(modelElementIndicator, true)) { <END> return true; } } return false; }</code><technical_language>add brackets this expression more easy understand</technical_language>

Target:
protected boolean includeJavaEngineIndicator() { for (ModelElementIndicator modelElementIndicator : this.treeViewer.getModelElementIndicator()) { if (modelElementIndicator.containsAny(IndicatorEnum.getJavaIndicatorsEnum()) || (modelElementIndicator.contains(IndicatorEnum.UserDefinedIndicatorEnum) && searchJUDI( modelElementIndicator, true))) { return true; } } return false; }
Source:
<code>private void updateDeviceAddresses() { if (isEmulatedMachineChanged() || isChipsetChanged()) { log.info("Emulated machine or BIOS chipset type has changed for VM: ({}), clearing device addresses.", getVm().getName(), getVm().getId()); if (getParameters().isCompensationEnabled()) { List<VmDevice> allVmDevices = vmDeviceDao.getVmDeviceByVmId(getVmId()); <START> for (VmDevice device: allVmDevices) { getCompensationContext().snapshotEntityUpdated(device); } <END> } vmDeviceDao.clearAllDeviceAddressesByVmId(getVmId()); VmDevicesMonitoring.Change change = vmDevicesMonitoring.createChange(System.nanoTime()); change.updateVm(getVmId(), VmDevicesMonitoring.EMPTY_HASH); change.flush(); } }</code><technical_language>allVmDevices.forEach(getCompensationContext()::snapshotEntityUpdated)</technical_language>

Target:
private void updateDeviceAddresses() { if (isEmulatedMachineChanged() || isChipsetChanged()) { log.info("Emulated machine or BIOS chipset type has changed for VM: ({}), clearing device addresses.", getVm().getName(), getVm().getId()); if (getParameters().isCompensationEnabled()) { List<VmDevice> allVmDevices = vmDeviceDao.getVmDeviceByVmId(getVmId()); allVmDevices.forEach(device -> getCompensationContext().snapshotEntityUpdated(device)); } vmDeviceDao.clearAllDeviceAddressesByVmId(getVmId()); VmDevicesMonitoring.Change change = vmDevicesMonitoring.createChange(System.nanoTime()); change.updateVm(getVmId(), VmDevicesMonitoring.EMPTY_HASH); change.flush(); } }
Source:
<code>public void run(RestxShell shell) throws Exception { File mdFile = mdFile(shell); <START> if(!mdFile.exists()) { <END> throw new IllegalStateException( "md.restx.json file not found in " + shell.currentLocation() + "." + " It is required to perform deps management"); } installDepsFromModuleDescriptor(shell, mdFile); File md5File = md5File(shell); Files.write(Files.hash(mdFile, Hashing.md5()).toString(), md5File, Charsets.UTF_8); shell.println("DONE"); }</code><technical_language>I prefer code style space if parenthesis, is standard code convention: <LINK_0> offense if prefer this style</technical_language>

Target:
public void run(RestxShell shell) throws Exception { Optional<ModuleDescriptorType> moduleDescriptorTypeWithExistingFileOpt = ModuleDescriptorType.firstModuleDescriptorTypeWithExistingFile(shell.currentLocation()); if(!moduleDescriptorTypeWithExistingFileOpt.isPresent()) { throw new IllegalStateException( "md.restx.json file not found in " + shell.currentLocation() + "." + " It is required to perform deps management"); } ModuleDescriptorType moduleDescriptorTypeWithExistingFile = moduleDescriptorTypeWithExistingFileOpt.get(); if(ModuleDescriptorType.RESTX.equals(moduleDescriptorTypeWithExistingFile)) { shell.println("installing deps using restx module descriptor..."); installDepsFromModuleDescriptor(shell, ModuleDescriptorType.RESTX.resolveDescriptorFile(shell.currentLocation())); } else if(ModuleDescriptorType.MAVEN.equals(moduleDescriptorTypeWithExistingFile)) { shell.println("installing deps using maven descriptor..."); installDepsFromMavenDescriptor(shell, ModuleDescriptorType.MAVEN.resolveDescriptorFile(shell.currentLocation())); } else if(ModuleDescriptorType.IVY.equals(moduleDescriptorTypeWithExistingFile)) { shell.println("installing deps using ivy descriptor..."); installDepsFromIvyDescriptor(shell, ModuleDescriptorType.IVY.resolveDescriptorFile(shell.currentLocation())); } else { throw new IllegalArgumentException("Unsupported deps install for module type "+moduleDescriptorTypeWithExistingFile); } storeModuleDescriptorMD5File(shell, moduleDescriptorTypeWithExistingFile); shell.println("DONE"); }
Source:
<code>public PropertyEntry getShallowestProperty() { <START> if ( !propertyEntries.isEmpty() ) { <END> return first( propertyEntries ); } return null; }</code><technical_language>Is common rule? I invertring boolean condition? smart question :). I mean, is more readable? if ( propertyEntries.isEmpty() ) { return null; } return first( propertyEntries) ; }</technical_language>

Target:
public PropertyEntry getShallowestProperty() { if ( propertyEntries.isEmpty() ) { return null; } return first( propertyEntries ); }
Source:
<code>public void kill(Container container) throws Exception { log.info("waiting for byteman to kill server"); String jbossHome = System.getenv().get("JBOSS_HOME"); if(jbossHome == null) { jbossHome = container.getContainerConfiguration().getContainerProperties().get("jbossHome"); } killSequence = killSequence.replace("[jbossHome]", jbossHome); shutdownSequence = shutdownSequence.replace("[jbossHome]", jbossHome); String suffix; String os = System.getProperty("os.name").toLowerCase(); if(os.indexOf("windows") > -1) { suffix = "bat"; } else { suffix = "sh"; } killSequence = killSequence.replace("[suffix]", suffix); shutdownSequence = shutdownSequence.replace("[suffix]", suffix); int checkn = 0; boolean killed = false; do { if(checkJBossAlive()) { Thread.sleep(checkDurableTime * 1000); log.info("jboss-as is alive"); } else { killed = true; break; } checkn ++; } while(checkn < numofCheck); if(killed) { log.info("jboss-as killed by byteman scirpt"); } else { log.info("jboss-as not killed and shutdown"); Process p = Runtime.getRuntime().exec(shutdownSequence); p.waitFor(); p.destroy(); <START> Thread.sleep(5000); <END> throw new RuntimeException("jboss-as not killed and shutdown"); } }</code><technical_language>I this if polled for a shutdown server. times jboss-as takes longer 5 seconds shutdown</technical_language>

Target:
public void kill(Container container) throws Exception { log.info("waiting for byteman to kill server"); String jbossHome = System.getenv().get("JBOSS_HOME"); if(jbossHome == null) { jbossHome = container.getContainerConfiguration().getContainerProperties().get("jbossHome"); } killSequence = killSequence.replace("[jbossHome]", jbossHome); shutdownSequence = shutdownSequence.replace("[jbossHome]", jbossHome); String suffix; String os = System.getProperty("os.name").toLowerCase(); if(os.indexOf("windows") > -1) { suffix = "bat"; } else { suffix = "sh"; } killSequence = killSequence.replace("[suffix]", suffix); shutdownSequence = shutdownSequence.replace("[suffix]", suffix); int checkn = 0; boolean killed = false; do { if(checkJBossAlive()) { Thread.sleep(checkDurableTime * 1000); log.info("jboss-as is alive"); } else { killed = true; break; } checkn ++; } while(checkn < numofCheck); if(killed) { log.info("jboss-as killed by byteman scirpt"); } else { log.info("jboss-as not killed and shutdown"); Process p = Runtime.getRuntime().exec(shutdownSequence); p.waitFor(); p.destroy(); int checkn_s = 0; do { if(checkJBossAlive()) { Thread.sleep(5000); } else { log.info("jboss-as shutdown"); break; } checkn_s ++; } while (checkn_s < 60); throw new RuntimeException("jboss-as not killed and shutdown"); } }
Source:
<code>public boolean exists(StoreKey key, FileSpan fileSpan) throws StoreException { final Timer.Context context = metrics.findTime.time(); ConcurrentNavigableMap<Long, IndexSegment> interestedSegmentMap = new ConcurrentSkipListMap<Long, IndexSegment>() ; try { <START> ConcurrentNavigableMap<Long, IndexSegment> descendMap = indexes.descendingMap(); <END> for (Map.Entry<Long, IndexSegment> entry : descendMap.entrySet()) { if( entry.getKey() >= fileSpan.getStartOffset() && entry.getKey() <= fileSpan.getEndOffset()) interestedSegmentMap.put(entry.getKey(), entry.getValue()); } for (Map.Entry<Long, IndexSegment> entry : interestedSegmentMap.entrySet()) { logger.trace("Index : searching index with start offset {}", dataDir, entry.getKey()); IndexValue value = entry.getValue().find(key); if (value != null) { logger.trace("Index : found value offset size ttl {}", dataDir, value.getOffset(), value.getSize(), value.getTimeToLiveInMs()); return true; } } }finally { context.stop(); } return false; }</code><technical_language>need subMap remove this subsequent lines below</technical_language>

Target:
public boolean exists(StoreKey key, FileSpan fileSpan) throws StoreException { final Timer.Context context = metrics.findTime.time(); logger.trace("Searching for " + key + " in index with filespan ranging from " + fileSpan.getStartOffset() + " to " + fileSpan.getEndOffset()); try { Long floorIndexSegment = indexes.floorKey(fileSpan.getStartOffset()); Long ceilIndexSegment = indexes.floorKey(fileSpan.getEndOffset()); ConcurrentNavigableMap<Long, IndexSegment> interestedSegmentsMap = indexes.subMap(floorIndexSegment, true, ceilIndexSegment, true); metrics.segmentSizeForExists.update(interestedSegmentsMap.size()); boolean foundValue = false; for (Map.Entry<Long, IndexSegment> entry : interestedSegmentsMap.entrySet()) { logger.trace("Index : searching index with start offset {}", dataDir, entry.getKey()); IndexValue value = entry.getValue().find(key); if (value != null) { logger.trace("Index : found value offset size ttl {}", dataDir, value.getOffset(), value.getSize(), value.getTimeToLiveInMs()); foundValue = true; break; } } return foundValue; } finally { context.stop(); } }
Source:
<code>private void updateGroupMetrics() { <START> grp.metrics().onRebalanceKeyReceived(); <END> for (GridCacheContext cctx0 : grp.caches()) { if (cctx0.statisticsEnabled()) cctx0.cache().metrics0().onRebalanceKeyReceived(); } }</code><technical_language>I this is right place for incrementing of receiving keys. call this updateGroupMetrics this is a method-candidate remove</technical_language>

Target:
private void updateGroupMetrics() { for (GridCacheContext cctx0 : grp.caches()) { if (cctx0.statisticsEnabled()) cctx0.cache().metrics0().onRebalanceKeyReceived(); } }
Source:
<code>public TileFilteredBuffer() { invFilter = addInventory("blueprint", 9, ItemHandlerManager.EnumAccess.NONE);; <START> invMain = addInventory("materials", 9, ItemHandlerManager.EnumAccess.INSERT, EnumPipePart.VALUES); <END> }</code><technical_language>idea filtered buffer is allows items "main" inventory if item matches is in blueprint inventory. extract filtered buffer's main inventory</technical_language>

Target:
public TileFilteredBuffer() { invFilter = addInventory("filter", 9, ItemHandlerManager.EnumAccess.NONE); invMain = addInventory("main", new ItemHandlerSimple(9, this::onSlotChange) { @Override public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { if(invFilter.getStackInSlot(slot) != null && StackUtil.canMerge(invFilter.getStackInSlot(slot), stack)) { return super.insertItem(slot, stack, simulate); } return stack; } }, ItemHandlerManager.EnumAccess.INSERT, EnumPipePart.VALUES); }
Source:
<code>public long getLong(String key) throws NumberFormatException { String setting = items.get(key); if (setting == null) { throw new NumberFormatException( "There is no setting associated with the key \"" + key + "\""); } <START> return Long.valueOf(setting).longValue(); <END> }</code><technical_language>exception</technical_language>

Target:
public long getLong(String key) throws NumberFormatException { String setting = items.get(key); if (setting == null) { throw new NumberFormatException( "There is no setting associated with the key \"" + key + "\""); } return Long.parseLong(setting); }
Source:
<code>public InputPreProcessor getInputPreprocessor(InputType... inputType) throws InvalidKerasConfigurationException { if (inputType.length > 1) throw new InvalidKerasConfigurationException( "Keras SimpleRnn layer accepts only one input (received " + inputType.length + ")"); InputPreProcessor preprocessor = null; if (inputType[0] instanceof InputType.InputTypeFeedForward) { <START> preprocessor = new FeedForwardToRnnPreProcessor(); <END> } return preprocessor; }</code><technical_language>potentially use: <LINK_0></technical_language>

Target:
public InputPreProcessor getInputPreprocessor(InputType... inputType) throws InvalidKerasConfigurationException { if (inputType.length > 1) throw new InvalidKerasConfigurationException( "Keras SimpleRnn layer accepts only one input (received " + inputType.length + ")"); return InputTypeUtil.getPreprocessorForInputTypeRnnLayers(inputType[0], layerName); }
Source:
<code>public void deleteAsyncTaskPlaceHolder(String taskKey) { <START> if (!taskKeyToTaskIdMap.containsKey(taskKey)) { <END> return; } Guid taskId = taskKeyToTaskIdMap.remove(taskKey); AsyncTaskManager.removeTaskFromDbByTaskId(taskId); }</code><technical_language>This check is redundant. call taskKeyToTaskIdMap.remove(taskKey), check if returns null</technical_language>

Target:
public void deleteAsyncTaskPlaceHolder(String taskKey) { Guid taskId = taskKeyToTaskIdMap.remove(taskKey); if (!Guid.isNullOrEmpty(taskId)) { AsyncTaskManager.removeTaskFromDbByTaskId(taskId); } }
Source:
<code>private boolean canApplyH3Index(Predicate predicate, FunctionContext function) { if (function.getFunctionName().equalsIgnoreCase(StDistanceFunction.FUNCTION_NAME)) { Predicate.Type type = predicate.getType(); if (type != Predicate.Type.RANGE) { return false; } RangePredicate rangePredicate = (RangePredicate) predicate; if (rangePredicate.getUpperBound().equals(RangePredicate.UNBOUNDED) || !rangePredicate.getLowerBound() .equals(RangePredicate.UNBOUNDED)) { return false; } <START> String columnName = function.getArguments().get(0).getIdentifier(); <END> DataSource dataSource = _indexSegment.getDataSource(columnName); return dataSource.getH3Index() != null; } return false; }</code><technical_language>add a check argument is identifier</technical_language>

Target:
private boolean canApplyH3Index(Predicate predicate, FunctionContext function) { if (function.getFunctionName().equalsIgnoreCase(StDistanceFunction.FUNCTION_NAME)) { Predicate.Type type = predicate.getType(); if (type != Predicate.Type.RANGE) { return false; } RangePredicate rangePredicate = (RangePredicate) predicate; if (rangePredicate.getUpperBound().equals(RangePredicate.UNBOUNDED) || !rangePredicate.getLowerBound() .equals(RangePredicate.UNBOUNDED)) { return false; } if (function.getArguments().get(0).getType() != ExpressionContext.Type.IDENTIFIER) { return false; } String columnName = function.getArguments().get(0).getIdentifier(); DataSource dataSource = _indexSegment.getDataSource(columnName); return dataSource.getH3Index() != null; } return false; }
Source:
<code>public boolean matches(ExternalId otherId) { ArgChecker.notNull(otherId, "otherId"); switch (searchType) { case EXACT: return ImmutableSet.of(otherId).equals(externalIds); case ALL: return ImmutableSet.of(otherId).containsAll(externalIds); case ANY: return contains(otherId); case NONE: return contains(otherId) == false; } <START> return false; <END> }</code><technical_language>a default switch</technical_language>

Target:
public boolean matches(ExternalId otherId) { ArgChecker.notNull(otherId, "otherId"); switch (searchType) { case EXACT: return ImmutableSet.of(otherId).equals(externalIds); case ALL: return ImmutableSet.of(otherId).containsAll(externalIds); case ANY: return contains(otherId); case NONE: return contains(otherId) == false; default: return false; } }
Source:
<code>public static WebArchive getDeployment() { WebArchive war = ShrinkWrap.create(WebArchive.class, "run-in-pod.war"); war.setWebXML(new StringAsset("<web-app/>")); war.addAsLibraries( Maven.resolver() <START> .resolve("org.kie:kie-server-client:6.2.0.Final") <END> .withTransitivity() .asFile()); return war; }</code><technical_language>Do need version here? Afaik, grab version pom</technical_language>

Target:
public static WebArchive getDeployment() { WebArchive war = ShrinkWrap.create(WebArchive.class, "run-in-pod.war"); war.setWebXML("web.xml"); war.addAsLibraries( Maven.resolver().loadPomFromFile("pom.xml") .resolve("org.kie.server:kie-server-client") .withTransitivity() .asFile()); return war; }
Source:
<code><START> public void reset(MessageBufferInput in) throws IOException { <END> MessageBufferInput newIn = checkNotNull(in, "MessageBufferInput is null"); this.in = newIn; this.buffer = EMPTY_BUFFER; this.position = 0; this.totalReadBytes = 0; this.secondaryBuffer = null; this.reachedEOF = false; }</code><technical_language>above: returning previous MessageBufferInput</technical_language>

Target:
public MessageBufferInput reset(MessageBufferInput in) throws IOException { MessageBufferInput newIn = checkNotNull(in, "MessageBufferInput is null"); MessageBufferInput old = this.in; this.in = newIn; this.buffer = EMPTY_BUFFER; this.position = 0; this.totalReadBytes = 0; this.secondaryBuffer = null; this.reachedEOF = false; return old; }
Source:
<code>public DistributorVersionDTO populate(ModelTranslator modelTranslator, DistributorVersion source, DistributorVersionDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("dest is null"); } dest.id(source.getId()) .name(source.getName()) .displayName(source.getDisplayName()) .created(toDateTime(source::getCreated)) .updated(toDateTime(source::getUpdated)); <START> if (modelTranslator != null) { <END> Set<DistributorVersionCapability> sourceCapabilities = source.getCapabilities(); if (sourceCapabilities != null && !sourceCapabilities.isEmpty()) { List<DistributorVersionCapabilityDTO> capabilities = sourceCapabilities.stream() .filter(Objects::nonNull) .map(this::toDto) .collect(Collectors.toList()); dest.setCapabilities(capabilities); } } return dest; }</code><technical_language>@Januson modelTranslator in this code. specific reason for this null check</technical_language>

Target:
public DistributorVersionDTO populate(ModelTranslator modelTranslator, DistributorVersion source, DistributorVersionDTO dest) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (dest == null) { throw new IllegalArgumentException("dest is null"); } dest.id(source.getId()) .name(source.getName()) .displayName(source.getDisplayName()) .created(Util.toDateTime(source.getCreated())) .updated(Util.toDateTime(source.getUpdated())) .capabilities(toDto(source.getCapabilities())); return dest; }
Source:
<code><START> public void <END> setBuyOrders(HashMap<String, ArrayList<Order>> buyOrders) { this.buyOrders = buyOrders; }</code><technical_language>this method changed private</technical_language>

Target:
private void setBuyOrders(HashMap<String, ArrayList<Order>> buyOrders) { this.buyOrders = buyOrders; }
Source:
<code>public List<VisitType> getOrderedVisitTypes (List<VisitType> visitTypes, String propertyValue,VisitService visitService) { Map<Integer,String> order = null; List<VisitType> visitTypesOrdered = new ArrayList<VisitType>(); if (propertyValue != null) { try { order = new ObjectMapper().readValue(propertyValue, HashMap.class); } catch (JsonParseException e) { <START> VisitTypeHelper.log.error("Unable to parse global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); <END> e.printStackTrace(); } catch (JsonMappingException e) { VisitTypeHelper.log.error("Unable to map global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); e.printStackTrace(); } catch (APIException e) { VisitTypeHelper.log.error("Unable to load global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); e.printStackTrace(); } catch (IOException e) { VisitTypeHelper.log.error("Unable to load global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); e.printStackTrace(); } } if (order != null) { for (int i=1 ; i <= order.size() ; i++) { String typeUuid = order.get(Integer.toString(i)); VisitType type = visitService.getVisitTypeByUuid(typeUuid); if (visitTypes.contains(type)) { visitTypesOrdered.add(visitService.getVisitTypeByUuid(typeUuid)); } } for (VisitType type: visitTypes) { if (!order.containsValue(type.getUuid())) { visitTypesOrdered.add(type); } } } if (!(visitTypes.size()==visitTypesOrdered.size())) { VisitTypeHelper.log.warn("Visit Types order property is not used."); return visitTypes; } return visitTypesOrdered; }</code><technical_language>intend log print stack trace</technical_language>

Target:
public List<VisitType> getOrderedVisitTypes (List<VisitType> visitTypes, String propertyValue,VisitService visitService) { Map<Integer,String> order = null; List<VisitType> visitTypesOrdered = new ArrayList<VisitType>(); if (propertyValue != null) { try { order = new ObjectMapper().readValue(propertyValue, HashMap.class); } catch (JsonParseException e) { VisitTypeHelper.LOG.error("Unable to parse global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); } catch (JsonMappingException e) { VisitTypeHelper.LOG.error("Unable to map global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); } catch (APIException e) { VisitTypeHelper.LOG.error("Unable to load global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); } catch (IOException e) { VisitTypeHelper.LOG.error("Unable to read global property \"" + CoreAppsConstants.VISIT_TYPES_ORDER_PROPERTY + "\""); } } if (order != null) { for (int i=1 ; i <= order.size() ; i++) { String typeUuid = order.get(Integer.toString(i)); VisitType type = visitService.getVisitTypeByUuid(typeUuid); if (visitTypes.contains(type)) { visitTypesOrdered.add(visitService.getVisitTypeByUuid(typeUuid)); } } for (VisitType type: visitTypes) { if (!order.containsValue(type.getUuid())) { visitTypesOrdered.add(type); } } } if (!(visitTypes.size()==visitTypesOrdered.size())) { VisitTypeHelper.LOG.warn("Visit Types order property is not used."); return visitTypes; } return visitTypesOrdered; }
Source:
<code>public void beforeSetup(FeaturesRunner runner) throws Exception { if (granularity != Granularity.METHOD) { return; } allDirectoryData = new HashMap<>(); DirectoryService directoryService = Framework.getService(DirectoryService.class); loginStack = ClientLoginModule.getThreadLocalLogin(); loginStack.push(new SystemPrincipal(null), null, null); try { for (Directory dir : directoryService.getDirectories()) { if (dir.isReadOnly() || dir instanceof MultiDirectory) { continue; } try (Session session = dir.getSession()) { session.setReadAllColumns(true); List<DocumentModel> entries = session.query(Collections.emptyMap(), Collections.emptySet(), Collections.emptyMap(), true); Map<String, Map<String, Object>> data = entries.stream().collect( Collectors.toMap(DocumentModel::getId, entry -> entry.getProperties(dir.getSchema()))); allDirectoryData.put(dir.getName(), data); } } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } } catch (Exception e) { <START> loginStack.pop(); <END> } }</code><technical_language>this a finally instead of a catch</technical_language>

Target:
public void beforeSetup(FeaturesRunner runner) throws Exception { if (granularity != Granularity.METHOD) { return; } allDirectoryData = new HashMap<>(); DirectoryService directoryService = Framework.getService(DirectoryService.class); loginStack = ClientLoginModule.getThreadLocalLogin(); loginStack.push(new SystemPrincipal(null), null, null); try { for (Directory dir : directoryService.getDirectories()) { if (dir.isReadOnly() || dir instanceof MultiDirectory) { continue; } try (Session session = dir.getSession()) { session.setReadAllColumns(true); List<DocumentModel> entries = session.query(Collections.emptyMap(), Collections.emptySet(), Collections.emptyMap(), true); Map<String, Map<String, Object>> data = entries.stream().collect( Collectors.toMap(DocumentModel::getId, entry -> entry.getProperties(dir.getSchema()))); allDirectoryData.put(dir.getName(), data); } } if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); } } catch (Exception e) { loginStack.pop(); throw e; } }
Source:
<code>protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("url", url) .append("username", username) <START> .append("origintype", originType); <END> }</code><technical_language>while rebasing, please rename originType</technical_language>

Target:
protected ToStringBuilder appendAttributes(ToStringBuilder tsb) { return super.appendAttributes(tsb) .append("url", url) .append("username", username) .append("originType", originType); }
Source:
<code>public StatementMetadata() { <START> gson = new GsonBuilder().enableComplexMapKeySerialization() <END> .registerTypeHierarchyAdapter(RyaType.class, new RyaTypeAdapter()).create(); }</code><technical_language>resetting this static object repeatedly? a static initialization</technical_language>

Target:
public StatementMetadata()
Source:
<code>String getComparaDivisionName(DatabaseRegistryEntry compara_dbre) { Connection compara_con = compara_dbre.getConnection(); String sql_division = "SELECT meta_value FROM meta WHERE meta_key = 'division'"; String division = DBUtils.getRowColumnValue(compara_con, sql_division); if (division == null || division.isEmpty()) { Matcher m = EGC_DB.matcher(compara_dbre.getName()); if (m.matches()) { if (m.groupCount() > 1) { division = m.group(2); } else { division = m.group(1); } } else { m = EC_DB.matcher(compara_dbre.getName()); if (m.matches()) { <START> division = "ensembl"; <END> } else { ReportManager.problem(this, compara_dbre.getConnection(), "Cannot find the division name of this database: '" + compara_dbre.getName() + "'"); return null; } } } if (division.equals("ensembl")) { division = "vertebrates"; } return division; }</code><technical_language>Set "vertebrates" right</technical_language>

Target:
String getComparaDivisionName(DatabaseRegistryEntry compara_dbre) { Connection compara_con = compara_dbre.getConnection(); String sql_division = "SELECT meta_value FROM meta WHERE meta_key = 'division'"; String division = DBUtils.getRowColumnValue(compara_con, sql_division); if (! division.isEmpty()) { return division; } Matcher m = EGC_DB.matcher(compara_dbre.getName()); if (m.matches()) { if (m.groupCount() > 1) { return m.group(2); } else { return m.group(1); } } else { m = EC_DB.matcher(compara_dbre.getName()); if (m.matches()) { return "vertebrates"; } else { ReportManager.problem(this, compara_dbre.getConnection(), "Cannot find the division name of this database: '" + compara_dbre.getName() + "'"); return null; } } }
Source:
<code>EventJsonSerializer(NodeInfo nodeInfo, @Nullable TraceToken token, EventTypeMetadata<T> eventTypeMetadata) { if (token == null) { this.token = null; } else if (token.size() == 1) { <START> this.token = token.get("id"); <END> } else { try { this.token = new ObjectMapperProvider().get().writeValueAsString(token); } catch (JsonProcessingException e) { throw new RuntimeException(e); } } this.eventTypeMetadata = requireNonNull(eventTypeMetadata, "eventTypeMetadata is null"); if (eventTypeMetadata.getHostField() == null) { hostName = nodeInfo.getInternalHostname(); } else { hostName = null; } }</code><technical_language>This line means trace token is passed caller provided</technical_language>

Target:
EventJsonSerializer(NodeInfo nodeInfo, @Nullable TraceToken token, EventTypeMetadata<T> eventTypeMetadata) { if (token == null || eventTypeMetadata.getTraceTokenField() != null) { this.token = null; } else if (token.size() == 1) { this.token = token.get("id"); } else { this.token = TRACE_TOKEN_JSON_CODEC.toJson(token); } this.eventTypeMetadata = requireNonNull(eventTypeMetadata, "eventTypeMetadata is null"); if (eventTypeMetadata.getHostField() == null) { hostName = nodeInfo.getInternalHostname(); } else { hostName = null; } }