auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void applyStatus(Consumer c, SystemPurposeComplianceStatus status, boolean updateConsumer) { String newHash = getComplianceStatusHash(status, c); boolean complianceChanged = !newHash.equals(c.getComplianceStatusHash()); if (complianceChanged) { <START> log.debug("Compliance has changed, sending Compliance event."); <END> c.setComplianceStatusHash(newHash); eventSink.emitCompliance(c, status); } boolean statusChanged = !status.getStatus().equals(c.getSystemPurposeStatus()); if (statusChanged) { c.setSystemPurposeStatus(status.getStatus()); } if (updateConsumer && (complianceChanged || statusChanged)) { consumerCurator.update(c, false); } }</code><technical_language>change this string Syspurpose Compliance for a confusing debug line</technical_language>

Target:
public void applyStatus(Consumer c, SystemPurposeComplianceStatus status, boolean updateConsumer) { String newHash = getComplianceStatusHash(status, c); boolean complianceChanged = !newHash.equals(c.getComplianceStatusHash()); if (complianceChanged) { log.debug("System purpose compliance has changed, sending Compliance event."); c.setComplianceStatusHash(newHash); eventSink.emitCompliance(c, status); } boolean statusChanged = !status.getStatus().equals(c.getSystemPurposeStatus()); if (statusChanged) { c.setSystemPurposeStatus(status.getStatus()); } if (updateConsumer && (complianceChanged || statusChanged)) { consumerCurator.update(c, false); } }
Source:
<code>public ProbeStatus run() { <START> if (Framework.getRuntime().isStarted()) { <END> return ProbeStatus.newSuccess("Runtime started"); } return ProbeStatus.newFailure("Runtime not started"); }</code><technical_language>check Framework.getRuntime() != null in case</technical_language>

Target:
public ProbeStatus run() { if (Framework.getRuntime() != null && Framework.getRuntime().isStarted()) { return ProbeStatus.newSuccess("Runtime started"); } else { return ProbeStatus.newFailure("Runtime not started"); } }
Source:
<code>final protected List<AccountProjectWatch> getProjectWatches() throws OrmException { final List<AccountProjectWatch> projectWatches = new LinkedList<AccountProjectWatch>(); <START> final List<Account.Id> projectWatchers = new LinkedList<Account.Id>(); <END> final ProjectState ps = getProjectState(); if (ps != null) { for (final AccountProjectWatch w : db.accountProjectWatches().byProject(ps.getProject().getNameKey())) { projectWatches.add(w); projectWatchers.add(w.getAccountId()); } } for (final AccountProjectWatch w : db.accountProjectWatches().byProject(wildProject)) { if (!projectWatchers.contains(w.getAccountId())) { projectWatches.add(w); } } return Collections.unmodifiableList(projectWatches); }</code><technical_language>This a Set / HashSet. care membership wildProject loop below, hash perform LinkedList for lookup</technical_language>

Target:
final protected Set<AccountProjectWatch> getProjectWatches() throws OrmException { final Set<AccountProjectWatch> projectWatches = new HashSet<AccountProjectWatch>(); final Set<Account.Id> projectWatchers = new HashSet<Account.Id>(); final ProjectState ps = getProjectState(); if (ps != null) { for (final AccountProjectWatch w : db.accountProjectWatches().byProject(ps.getProject().getNameKey())) { projectWatches.add(w); projectWatchers.add(w.getAccountId()); } } for (final AccountProjectWatch w : db.accountProjectWatches().byProject(wildProject)) { if (!projectWatchers.contains(w.getAccountId())) { projectWatches.add(w); } } return Collections.unmodifiableSet(projectWatches); }
Source:
<code>public String getStatusMessage(HttpServletRequest request, String status) { <START> Set<String> validStatus = new LinkedHashSet<>(); <END> validStatus.add("unverified"); validStatus.add("verified"); validStatus.add("created"); validStatus.add("forgot"); validStatus.add("reset"); if (validStatus.contains(status)) { return messageSource.getMessage("stormpath.web.login.form.status." + status, request.getLocale(), verifyEmailUri); } else { throw new IllegalArgumentException("Status '" + status + "' is not valid."); } }</code><technical_language>Thinking this externalized buried here. enum? approved solution [here](<LINK_0> speaks checking if enum contains a string version</technical_language>

Target:
public String getStatusMessage(HttpServletRequest request, String status) { EnumSet<LoginStatus> validStatus = EnumSet.allOf(LoginStatus.class); if (validStatus.contains(LoginStatus.valueOf(status.toUpperCase()))) { return messageSource.getMessage("stormpath.web.login.form.status." + status, request.getLocale(), verifyEmailUri); } else { return ""; } }
Source:
<code>public Set<Integer> getUsedPorts(SupervisorDetails supervisor) { <START> return nodeToUsedPortsCache.computeIfAbsent(supervisor.getId(), (x) -> new HashSet<>()).stream().map(WorkerSlot::getPort).collect(Collectors.toSet()); <END> }</code><technical_language>updateScheduledResourcesCache() - called assign() - adds worker slots nodeToUsedPortsCache. This fine, nice add a Java doc note this this is a public method</technical_language>

Target:
public Set<Integer> getUsedPorts(SupervisorDetails supervisor) { return nodeToUsedSlotsCache.computeIfAbsent(supervisor.getId(), (x) -> new HashSet<>()).stream().map(WorkerSlot::getPort).collect(Collectors.toSet()); }
Source:
<code>public void runWithFlags(boolean force, boolean suspendMajor, boolean suspendMinor) { if (force) { LOG.info("Garbage collector thread forced to perform GC before expiry of wait time."); } <START> changeMajorCompactionThreshold(); <END> compactor.cleanUpAndRecover(); entryLogMetaMap = extractMetaFromEntryLogs(entryLogMetaMap); doGcLedgers(); doGcEntryLogs(); if (suspendMajor) { LOG.info("Disk almost full, suspend major compaction to slow down filling disk."); } if (suspendMinor) { LOG.info("Disk full, suspend minor compaction to slow down filling disk."); } long curTime = MathUtils.now(); if (enableMajorCompaction && (!suspendMajor) && (force || curTime - lastMajorCompactionTime > majorCompactionInterval)) { LOG.info("Enter major compaction, suspendMajor {}", suspendMajor); doCompactEntryLogs(majorCompactionThreshold); lastMajorCompactionTime = MathUtils.now(); lastMinorCompactionTime = lastMajorCompactionTime; return; } if (enableMinorCompaction && (!suspendMinor) && (force || curTime - lastMinorCompactionTime > minorCompactionInterval)) { LOG.info("Enter minor compaction, suspendMinor {}", suspendMinor); doCompactEntryLogs(minorCompactionThreshold); lastMinorCompactionTime = MathUtils.now(); } restoreThreshold(); }</code><technical_language>Based understanding this logic, crons for adjusting major compaction thresholds. means major compaction interval smaller interval cron runs, logic work here, right</technical_language>

Target:
public void runWithFlags(boolean force, boolean suspendMajor, boolean suspendMinor) { long threadStart = MathUtils.nowInNano(); if (force) { LOG.info("Garbage collector thread forced to perform GC before expiry of wait time."); } compactor.cleanUpAndRecover(); entryLogMetaMap = extractMetaFromEntryLogs(entryLogMetaMap); doGcLedgers(); doGcEntryLogs(); if (suspendMajor) { LOG.info("Disk almost full, suspend major compaction to slow down filling disk."); } if (suspendMinor) { LOG.info("Disk full, suspend minor compaction to slow down filling disk."); } long curTime = MathUtils.now(); if (enableMajorCompaction && (!suspendMajor) && (force || curTime - lastMajorCompactionTime > majorCompactionInterval)) { LOG.info("Enter major compaction, suspendMajor {}", suspendMajor); doCompactEntryLogs(majorCompactionThreshold); lastMajorCompactionTime = MathUtils.now(); lastMinorCompactionTime = lastMajorCompactionTime; majorCompactionCounter.inc(); } else if (enableMinorCompaction && (!suspendMinor) && (force || curTime - lastMinorCompactionTime > minorCompactionInterval)) { LOG.info("Enter minor compaction, suspendMinor {}", suspendMinor); doCompactEntryLogs(minorCompactionThreshold); lastMinorCompactionTime = MathUtils.now(); minorCompactionCounter.inc(); } this.gcThreadRuntime.registerSuccessfulEvent( MathUtils.nowInNano() - threadStart, TimeUnit.NANOSECONDS); }
Source:
<code>private IDeviceCertificate getWPJAPIInstance(Class<IDeviceCertificate> certClazz) throws AuthenticationException { <START> IDeviceCertificate deviceCertProxy; <END> Constructor<?> constructor; try { constructor = certClazz.getDeclaredConstructor(); deviceCertProxy = (IDeviceCertificate)constructor.newInstance((Object[])null); } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new AuthenticationException(ADALError.DEVICE_CERTIFICATE_API_EXCEPTION, "WPJ Api constructor is not defined", e); } return deviceCertProxy; }</code><technical_language>final</technical_language>

Target:
private IDeviceCertificate getWPJAPIInstance(Class<IDeviceCertificate> certClazz) throws AuthenticationException { final IDeviceCertificate deviceCertProxy; final Constructor<?> constructor; try { constructor = certClazz.getDeclaredConstructor(); deviceCertProxy = (IDeviceCertificate)constructor.newInstance((Object[])null); } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new AuthenticationException(ADALError.DEVICE_CERTIFICATE_API_EXCEPTION, "WPJ Api constructor is not defined", e); } return deviceCertProxy; }
Source:
<code><START> protected TreeNode buildTree(ArrayList<Record> records) throws InvalidRecordsException { <END> HashMap<Integer, Integer> parentMap = new HashMap<>(); HashMap<Integer, TreeNode> nodesMap = new HashMap<>(); records.sort(Comparator.comparing(Record::getRecordId)); ArrayList<Integer> orderedRecordIds = new ArrayList<>(); for (Record record : records) { orderedRecordIds.add(record.getRecordId()); } for (Record record : records) { validateRecord(record); parentMap.put(record.getRecordId(), record.getParentId()); nodesMap.put(record.getRecordId(), new TreeNode(record.getRecordId())); } int rootId = 0; for (int i = 0; i < records.size(); i++) { if (i != orderedRecordIds.get(i)) { throw new InvalidRecordsException("Invalid Records"); } if (orderedRecordIds.get(i) != rootId) { int parentId = parentMap.get(i); nodesMap.get(parentId).children.add(nodesMap.get(i)); } } return nodesMap.get(rootId); }</code><technical_language>is this set protected</technical_language>

Target:
TreeNode buildTree(ArrayList<Record> records) throws InvalidRecordsException { HashMap<Integer, Integer> parentMap = new HashMap<>(); HashMap<Integer, TreeNode> nodesMap = new HashMap<>(); records.sort(Comparator.comparing(Record::getRecordId)); ArrayList<Integer> orderedRecordIds = new ArrayList<>(); for (Record record : records) { orderedRecordIds.add(record.getRecordId()); } for (Record record : records) { validateRecord(record); parentMap.put(record.getRecordId(), record.getParentId()); nodesMap.put(record.getRecordId(), new TreeNode(record.getRecordId())); } int rootId = 0; for (int i = 0; i < records.size(); i++) { if (i != orderedRecordIds.get(i)) { throw new InvalidRecordsException("Invalid Records"); } if (orderedRecordIds.get(i) != rootId) { int parentId = parentMap.get(i); nodesMap.get(parentId).getChildren().add(nodesMap.get(i)); } } return nodesMap.get(rootId); }
Source:
<code>boolean disableCompactionForBlobStore(BlobStore store) { if (compactionExecutor == null) { return false; } <START> compactionExecutor.disableCompactionForBlobStore(store); <END> return true; }</code><technical_language>is disabling successful if blobstore is running</technical_language>

Target:
boolean disableCompactionForBlobStore(BlobStore store) { return compactionExecutor == null || compactionExecutor.disableCompactionForBlobStore(store); }
Source:
<code>protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, <START> UIText.PullResultDialog_closeButtonLabel, <END> true); }</code><technical_language>I recommend IDialogConstants.CLOSE_LABEL. define a mnemonic I is compare defining a new string constants (also I find a bit silly close mnemonic)</technical_language>

Target:
protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true); }
Source:
<code>public NeutronSecurityGroupExtensionLiveTest() { provider = "openstack-nova"; Properties overrides = setupProperties(); neutronApiContext = ContextBuilder.newBuilder("openstack-neutron") .endpoint(setIfTestSystemPropertyPresent(overrides, "openstack-neutron.endpoint")) .credentials(setIfTestSystemPropertyPresent(overrides, "openstack-neutron.identity"), <START> setIfTestSystemPropertyPresent(overrides, "openstack-neutron.credential")) <END> .modules(ImmutableSet.<Module>of( new SshjSshClientModule(), new SLF4JLoggingModule(), new BouncyCastleCryptoModule()) ) .build(new TypeToken<ApiContext<NeutronApi>>() {}); }</code><technical_language>able Nova properties. is a neutron is a keystone instance. endpoint credentials configured for Nova</technical_language>

Target:
public NeutronSecurityGroupExtensionLiveTest() { provider = "openstack-nova"; Properties overrides = setupProperties(); neutronApiContext = ContextBuilder.newBuilder("openstack-neutron") .endpoint(setIfTestSystemPropertyPresent(overrides, "openstack-nova.endpoint")) .credentials(setIfTestSystemPropertyPresent(overrides, "openstack-nova.identity"), setIfTestSystemPropertyPresent(overrides, "openstack-nova.credential")) .modules(ImmutableSet.<Module>of( new SshjSshClientModule(), new SLF4JLoggingModule()) ) .build(new TypeToken<ApiContext<NeutronApi>>() {}); }
Source:
<code>protected void executeCommand() { VdcActionType actionToExecute = getParameters().getAction(); VdcActionParametersBase actionParameters = getParameters().getActionParameters(); <START> actionParameters.setEndProcedure(VdcActionParametersBase.EndProcedure.COMMAND_MANAGED); <END> actionParameters.setParentCommand(VdcActionType.RunAsyncAction); actionParameters.setParentParameters(getParameters()); CommandCoordinatorUtil.executeAsyncCommand( actionToExecute, actionParameters, cloneContextAndDetachFromParent()); setSucceeded(true); }</code><technical_language>avoid setting parent command/parent parameters? preferred delete lines 34-35</technical_language>

Target:
protected void executeCommand() { CommandCoordinatorUtil.executeAsyncCommand( getParameters().getAction(), getParameters().getActionParameters(), cloneContextAndDetachFromParent()); setSucceeded(true); }
Source:
<code>public void removeAllCertsOfAProject(String projectname) { List<UserCerts> items = findUserCertsByProjectId(projectname); removeCerts(items); String[] tokens = projectname.split("__"); <START> if (tokens.length == 2) { <END> removeProjectGenericCertificates(tokens[0] + Settings.PROJECT_GENERIC_USER_SUFFIX); } }</code><technical_language>tokenizer is wrong. wrong change well. method encountered error</technical_language>

Target:
public void removeAllCertsOfAProject(String projectname) { List<UserCerts> items = findUserCertsByProjectId(projectname); removeCerts(items); removeProjectGenericCertificates(projectname + Settings.PROJECT_GENERIC_USER_SUFFIX); }
Source:
<code>public Map<String, byte[]> get(Set<String> keys) { Objects.requireNonNull(keys); <START> Map<String, byte[]> kvMap = new HashMap<>(keys.size()); <END> Block<Document> block = doc -> { String key = doc.getString(ID_KEY); Object value = doc.get(VALUE_KEY); byte[] bytesValue; if (value instanceof String) { bytesValue = ((String) value).getBytes(UTF_8); } else if (value instanceof Binary) { bytesValue = ((Binary) value).getData(); } else { throw new UnsupportedOperationException(value.getClass().getName()); } kvMap.put(key, bytesValue); }; findByKeys(keys, block); return kvMap; }</code><technical_language>I call this map (same in other methods)</technical_language>

Target:
public Map<String, byte[]> get(Set<String> keys) { Objects.requireNonNull(keys); Map<String, byte[]> map = new HashMap<>(keys.size()); Block<Document> block = doc -> { String key = doc.getString(ID_KEY); Object value = doc.get(VALUE_KEY); if (value != null) { byte[] bytesValue = null; if (value instanceof String) { bytesValue = ((String) value).getBytes(UTF_8); } else if (value instanceof Binary) { bytesValue = ((Binary) value).getData(); } else { throw new UnsupportedOperationException(String.format( "Value of class %s is not supported for key: %s", value.getClass().getName(), key)); } map.put(key, bytesValue); } }; findByKeys(keys, block); return map; }
Source:
<code>private void recover(TopicPartition topicPart) throws IOException { if (!recovered.contains(topicPart)) { WAL wal = new WAL(conf, url, topicsDir, topicPart); <START> wal.apply(); <END> wals.put(topicPart, wal); recovered.add(topicPart); readOffsets(topicPart); } }</code><technical_language>If of this fails throw exception bubble out of put() call. A couple of questions: 1. retrying all? transient problems resolve themselves. 2. other messages? fail grab apply WAL for this TopicPartition, if message in batch, exception throw other messages well</technical_language>

Target:
public void recover(TopicPartition topicPart) { try { switch (states.get(topicPart)) { case RECOVERY_STARTED: pause(topicPart); nextState(topicPart); case RECOVERY_PARTITION_PAUSED: createWAL(topicPart); nextState(topicPart); case WAL_CREATED: applyWAL(topicPart); nextState(topicPart); case WAL_APPLIED: truncateWAL(topicPart); nextState(topicPart); case WAL_TRUNCATED: resetOffsets(topicPart); nextState(topicPart); case OFFSET_RESET: resume(topicPart); nextState(topicPart); break; default: log.error("{} is not a valid state to perform recovery.", states.get(topicPart)); } } catch (CopycatException e) { log.error("Recovery failed."); recordFailureTime(topicPart); setRetryBackoff(backOffMs); } }
Source:
<code><START> public RedisFeatureStore(RedisFeatureStoreBuilder builder) { <END> if (builder.poolConfig == null) { this.pool = new JedisPool(getPoolConfig(), builder.uri, builder.connectTimeout, builder.socketTimeout); } else { this.pool = new JedisPool(builder.poolConfig, builder.uri, builder.connectTimeout, builder.socketTimeout); } setPrefix(builder.prefix); createCache(builder.cacheTimeSecs, builder.refreshStaleValues, builder.asyncRefresh); createInitCache(builder.cacheTimeSecs); }</code><technical_language>I this needs public-- called builder</technical_language>

Target:
protected RedisFeatureStore(RedisFeatureStoreBuilder builder) { if (builder.poolConfig == null) { this.pool = new JedisPool(getPoolConfig(), builder.uri, builder.connectTimeout, builder.socketTimeout); } else { this.pool = new JedisPool(builder.poolConfig, builder.uri, builder.connectTimeout, builder.socketTimeout); } setPrefix(builder.prefix); createCache(builder.cacheTimeSecs, builder.refreshStaleValues, builder.asyncRefresh); createInitCache(builder.cacheTimeSecs); }
Source:
<code>private AWSIotMqttManager( final Region region, final String mqttClientId, final String endpoint) { if (TextUtils.isEmpty(mqttClientId)) { throw new IllegalArgumentException("mqttClientId is null or empty"); } if (region == null) { throw new IllegalArgumentException("region is null"); } <START> if (endpoint == null) { throw new IllegalArgumentException("endpoint is null or an invalid domain."); <END> } this.topicListeners = new ConcurrentHashMap<String, AWSIotMqttTopic>(); this.mqttMessageQueue = new ConcurrentLinkedQueue<AWSIotMqttQueueMessage>(); this.endpoint = endpoint; this.mqttClientId = mqttClientId; this.region = region; this.accountEndpointPrefix = null; initDefaults(); }</code><technical_language>TextUtils.isEmpty(...) here, too, I guess. update error message, "or invalid domain." part is checked, right</technical_language>

Target:
private AWSIotMqttManager( final Region region, final String mqttClientId, final String endpoint) { if (TextUtils.isEmpty(mqttClientId)) { throw new IllegalArgumentException("mqttClientId is null or empty"); } if (region == null) { throw new IllegalArgumentException("region is null"); } if (TextUtils.isEmpty(endpoint)) { throw new IllegalArgumentException("endpoint is null or empty."); } this.topicListeners = new ConcurrentHashMap<String, AWSIotMqttTopic>(); this.mqttMessageQueue = new ConcurrentLinkedQueue<AWSIotMqttQueueMessage>(); this.endpoint = endpoint; this.mqttClientId = mqttClientId; this.region = region; this.accountEndpointPrefix = null; initDefaults(); }
Source:
<code>static final HashMap<String, String> getJsonResponse(HttpWebResponse webResponse) throws JSONException{ <START> HashMap<String, String> response = new HashMap<>(); <END> if(webResponse != null && !TextUtils.isEmpty(webResponse.getBody())) { JSONObject jsonObject = new JSONObject(webResponse.getBody()); Iterator<?> i = jsonObject.keys(); while (i.hasNext()) { String key = (String) i.next(); response.put(key, jsonObject.getString(key)); } } return response; }</code><technical_language>I touch this, wondering returning generic Map</technical_language>

Target:
static final Map<String, String> getJsonResponse(HttpWebResponse webResponse) throws JSONException{ Map<String, String> response = new HashMap<>(); if(webResponse != null && !TextUtils.isEmpty(webResponse.getBody())) { JSONObject jsonObject = new JSONObject(webResponse.getBody()); Iterator<?> i = jsonObject.keys(); while (i.hasNext()) { String key = (String) i.next(); response.put(key, jsonObject.getString(key)); } } return response; }
Source:
<code>protected CreateContainerCmd dockerCommand() { return dockerClient.createContainerCmd(config.getImageName() + ":" + config.getImageTag()) .withNetworkMode("host") .withBinds(Bind.parse("/var/run/docker.sock:/tmp/docker.sock")) .withCmd(String.format("consul://%s:8500", consulContainer.getIpAddress())) <START> .withName(getName()); <END> }</code><technical_language>Extract port constant</technical_language>

Target:
protected CreateContainerCmd dockerCommand() { return dockerClient.createContainerCmd(config.getImageName() + ":" + config.getImageTag()) .withNetworkMode("host") .withBinds(Bind.parse("/var/run/docker.sock:/tmp/docker.sock")) .withCmd("-internal", String.format("consul://%s:%d", consulContainer.getIpAddress(), ConsulConfig.CONSUL_HTTP_PORT)) .withName(getName()); }
Source:
<code>public String toString() { <START> final StringBuilder stringBuilder = new StringBuilder(); <END> for (final SubstitutionBase r : SubstitutionBase.values()) { stringBuilder.append((char) r.getBase()); stringBuilder.append(':'); for (int i = 0; i < CODES_PER_BASE; i++) { stringBuilder.append((char) baseByCode[r.getBase()][i]); } stringBuilder.append('\t'); } for (final SubstitutionBase r : SubstitutionBase.values()) { stringBuilder.append(Character.toLowerCase((char)r.getBase())); stringBuilder.append(':'); for (int i = 0; i < CODES_PER_BASE; i++) { stringBuilder.append((char) baseByCode[Character.toLowerCase((char)r.getBase())][i]); } stringBuilder.append('\t'); } return stringBuilder.toString(); }</code><technical_language>pass a final size estimate builder constructor</technical_language>

Target:
public String toString() { final int DISPLAY_SIZE = BASES_SIZE * (CODES_PER_BASE + 3) * 2; final StringBuilder stringBuilder = new StringBuilder(DISPLAY_SIZE); for (final SubstitutionBase r : BASES) { stringBuilder.append((char) r.getBase()); stringBuilder.append(':'); for (int i = 0; i < CODES_PER_BASE; i++) { stringBuilder.append((char) baseByCode[r.getBase()][i]); } stringBuilder.append('\t'); } for (final SubstitutionBase r : BASES) { char lowerCaseBase = Character.toLowerCase((char)r.getBase()); stringBuilder.append(lowerCaseBase); stringBuilder.append(':'); for (int i = 0; i < CODES_PER_BASE; i++) { stringBuilder.append((char) baseByCode[lowerCaseBase][i]); } stringBuilder.append('\t'); } return stringBuilder.toString(); }
Source:
<code>private List<Revision> getRevisions(String cloudId, String representationName) throws MCSException { <START> Representation representation = sourceRecordServiceClient.getRepresentation(cloudId, representationName); <END> return representation.getRevisions(); }</code><technical_language>need create representation variable</technical_language>

Target:
private List<Revision> getRevisions(String cloudId, String representationName) throws MCSException { return sourceRecordServiceClient.getRepresentation(cloudId, representationName).getRevisions(); }
Source:
<code>public Path renameWorkaround( final Path path, final String newName, final String newContent, final String comment ) { try { final org.uberfire.java.nio.file.Path _path = Paths.convert( path ); String originalFileName = _path.getFileName().toString(); final String extension = originalFileName.substring( originalFileName.lastIndexOf( "." ) ); final org.uberfire.java.nio.file.Path _target = _path.resolveSibling( newName + extension ); final Path targetPath = Paths.convert( _target ); try { if ( newContent != null ) { ioService.write( _path, newContent, serviceHelper.makeCommentedOption( comment ) ); } ioService.startBatch( new FileSystem[]{ _target.getFileSystem() } ); ioService.move( _path, _target, serviceHelper.makeCommentedOption( "File [" + path.toURI() + "] renamed to [" + targetPath.toURI() + "]." ) ); if ( renameHelperInstance != null ) { for ( DataModelerRenameWorkaroundHelper renameHelper : renameHelperInstance ) { <START> renameHelper.postProcess( Paths.convert( _path ), Paths.convert( _target ) ); <END> } } } catch ( final Exception e ) { throw e; } finally { ioService.endBatch(); } return Paths.convert( _target ); } catch ( Exception e ) { throw ExceptionUtilities.handleException( e ); } }</code><technical_language>hope Java compiler moves conversions loop...</technical_language>

Target:
public Path renameWorkaround( final Path path, final String newName, final String newContent, final String comment ) { try { final org.uberfire.java.nio.file.Path _path = Paths.convert( path ); String originalFileName = _path.getFileName().toString(); final String extension = originalFileName.substring( originalFileName.lastIndexOf( "." ) ); final org.uberfire.java.nio.file.Path _target = _path.resolveSibling( newName + extension ); final Path targetPath = Paths.convert( _target ); try { if ( newContent != null ) { ioService.write( _path, newContent, serviceHelper.makeCommentedOption( comment ) ); } ioService.startBatch( new FileSystem[]{ _target.getFileSystem() } ); ioService.move( _path, _target, serviceHelper.makeCommentedOption( "File [" + path.toURI() + "] renamed to [" + targetPath.toURI() + "]." ) ); if ( renameHelperInstance != null ) { for ( DataModelerRenameWorkaroundHelper renameHelper : renameHelperInstance ) { renameHelper.postProcess( path, targetPath ); } } } catch ( final Exception e ) { throw e; } finally { ioService.endBatch(); } return Paths.convert( _target ); } catch ( Exception e ) { throw ExceptionUtilities.handleException( e ); } }
Source:
<code>public void apply(final ClassModel model) { final List<FieldModel> resolvedFields = model.getFields(); for (final FieldModel field : resolvedFields) { if (field.isPrivate() && !field.isTransient() && !field.isFinal()) { final String name = field.getName(); <START> final String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1); <END> if (!validGetter(model, field, propertyName) || !validSetter(model, field, propertyName)) { field.setIncluded(getWeight(), false); } } else { field.setIncluded(getWeight(), false); } } }</code><technical_language>upper casing suffer cultural problems</technical_language>

Target:
public void apply(final ClassModel model) { final List<FieldModel> resolvedFields = model.getFields(); for (final FieldModel field : resolvedFields) { if (field.isPrivate() && !field.isTransient() && !field.isFinal()) { final String name = field.getFieldName(); final String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1); if (!validGetter(model, field, propertyName) || !validSetter(model, field, propertyName)) { field.setIncluded(getWeight(), false); } } else { field.setIncluded(getWeight(), false); } } }
Source:
<code>public void testIsComplexSimpleExpression() { <START> assertTrue(!isComplexTemplate("${value:default}")); <END> }</code><technical_language>assertFalse</technical_language>

Target:
public void testIsComplexSimpleExpression() { assertFalse(isComplexTemplate("${value:default}")); }
Source:
<code><START> private Session openSession() { <END> final Session currentSession = (Session) this.emProvider.get().getDelegate(); final SessionFactory factory = currentSession.getSessionFactory(); return factory.openSession(); }</code><technical_language>question above: change scope</technical_language>

Target:
protected Session openSession() { final Session currentSession = (Session) this.emProvider.get().getDelegate(); final SessionFactory factory = currentSession.getSessionFactory(); return factory.openSession(); }
Source:
<code>public double isApplicable(VDomainModelReference domainModelReference, EObject domainObject) { if (domainModelReference == null) { reportService.report(new AbstractReport("Warning: The given <START> VControl was <END> null.")); return NOT_APPLICABLE; } if (domainObject == null) { reportService.report(new AbstractReport("Warning: The given domain object was null.")); return NOT_APPLICABLE; } return 1d; }</code><technical_language>adjust log message</technical_language>

Target:
public double isApplicable(VDomainModelReference domainModelReference, EObject domainObject) { if (domainModelReference == null) { reportService.report(new AbstractReport("Warning: The given VDomainModelReference was null.")); return NOT_APPLICABLE; } if (domainObject == null) { reportService.report(new AbstractReport("Warning: The given domain object was null.")); return NOT_APPLICABLE; } return 1d; }
Source:
<code>public String eventSalesView(Model model, @PathVariable String key) throws EventNotFoundException{ Event event = eventService.getByKey(key); List<Order> orders = salesService.getAllOrdersByEvent(event); double moneyEarned = 0.0; int ticketsSold = 0; for(Product product: event.getProducts()){ moneyEarned += product.getCost() * product.getSold(); ticketsSold += product.getSold(); } model.addAttribute("orders", orders); model.addAttribute("moneyEarned", moneyEarned); model.addAttribute("ticketsSold", ticketsSold); model.addAttribute("event", event); model.addAttribute("key", key); <START> return "sales/stats/event/index"; <END> }</code><technical_language>remove replaced event.getKey() in frontend</technical_language>

Target:
public String eventSalesView(Model model, @PathVariable String key) throws EventNotFoundException { Event event = eventService.getByKey(key); List<Order> orders = salesService.getAllOrdersByEvent(event).stream().peek((Order order) -> { order.setOwner(null); order.setChPaymentsReference(null); order.setPaymentMethod(null); }).collect(Collectors.toList()); double moneyEarned = 0.0; int ticketsSold = 0; for (Product product : event.getProducts()) { moneyEarned += product.getCost() * product.getSold(); ticketsSold += product.getSold(); } model.addAttribute("orders", orders); model.addAttribute("moneyEarned", moneyEarned); model.addAttribute("ticketsSold", ticketsSold); model.addAttribute("event", event); model.addAttribute("key", event.getKey()); return "sales/stats/event/index"; }
Source:
<code>private String followTNTTrail(Entity initial){ String name = "tnt"; if (initial != null) { <START> if (initial.getType().equals(EntityType.PRIMED_TNT)) { <END> Entity source = ((TNTPrimed) initial).getSource(); if (source != null) { if (source.getType().equals(EntityType.PLAYER)) { Player player = (Player) source; name = player.getName(); } else if (source.getType().equals(EntityType.PRIMED_TNT)) { Entity newSource = ((TNTPrimed) source).getSource(); if (newSource != null) { name = followTNTTrail(newSource); } } else { name = source.getType().name(); } } else { name = "tnt"; } } else { if (initial.getType().equals(EntityType.PLAYER)) { Player player = (Player) initial; name = player.getName(); } else { name = initial.getType().name(); } } } return name; }</code><technical_language>a matter of preference, == for comparing enum's, is null-safe. instanceof for consistency, casting anyway</technical_language>

Target:
private String followTNTTrail(Entity initial) { int counter = 10000000; while (initial != null) { if (initial instanceof Player) { return ((Player) initial).getName(); } else if (initial instanceof TNTPrimed) { initial = (((TNTPrimed) initial).getSource()); if (counter < 0) { Location last = initial.getLocation(); plugin.getLogger().warning("TnT chain has exceeded one million, will not continue!"); plugin.getLogger().warning("Last Tnt was at " + last.getX() + ", " + last.getY() + ". " + last.getZ() + " in world " + last.getWorld()); return "tnt"; } counter--; } else { return initial.getType().name(); } } return "tnt"; }
Source:
<code>protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter printWriter = resp.getWriter(); String containerIdParam = req.getParameter(YARN_CONTAINER_ID); resp.setContentType(APPLICATION_JSON); boolean alive = false; ContainerId yarnContainerId; try { yarnContainerId = ContainerId.fromString(containerIdParam); <START> for (Map.Entry pair : yarnAppState.runningYarnContainers.entrySet()) { <END> YarnContainer yarnContainer = (YarnContainer) pair.getValue(); if (yarnContainer.id().compareTo(yarnContainerId) == 0) { alive = true; } } if (!alive) { heartbeatInvalidCount.inc(); } this.jsonResponse.put("alive", alive); printWriter.write(jsonResponse.toString()); } catch (IllegalArgumentException e) { log.error("Container ID passed is invalid", containerIdParam); resp.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); } catch (JSONException e) { log.error("Unable to serialize JSON heartbeat response for container ID with status {}", containerIdParam, alive); resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } }</code><technical_language>types for Map.Entry. If need is a list of values, re-write as: for (YarnContainer container : yarnAppState.values())</technical_language>

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ContainerId yarnContainerId; PrintWriter printWriter = resp.getWriter(); String containerIdParam = req.getParameter(YARN_CONTAINER_ID); ContainerHeartbeatResponse response; resp.setContentType(APPLICATION_JSON); boolean alive = false; try { yarnContainerId = ContainerId.fromString(containerIdParam); for (YarnContainer yarnContainer : yarnAppState.runningYarnContainers.values()) { if (yarnContainer.id().compareTo(yarnContainerId) == 0) { alive = true; break; } } if (!alive) { heartbeatsExpiredCount.inc(); } response = new ContainerHeartbeatResponse(alive); printWriter.write(mapper.writeValueAsString(response)); } catch (IllegalArgumentException e) { LOG.error("Container ID passed is invalid", containerIdParam); resp.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); } }
Source:
<code>public Savepoint setSavepoint() throws SQLException { checkClosed(); <START> if (strict) { <END> throw new SQLFeatureNotSupportedException("Savepoint is not supported."); } return null; }</code><technical_language>pls extract a method for throwing</technical_language>

Target:
public Savepoint setSavepoint() throws SQLException { checkClosed(); throwIfStrictMode("Savepoint is not supported."); return null; }
Source:
<code>private static WebDriverElement createWebDriverElement(Hook hook, WebElement element, WebDriver driver) throws CandybeanException { try { if ("select".equals(element.getTagName())) { return new WebDriverSelector(hook, driver); } return new WebDriverElement(hook, 0, driver, element); } catch (CandybeanException e) { <START> throw e; <END> } }</code><technical_language>do need catch if is re-throw exception</technical_language>

Target:
private static WebDriverElement createWebDriverElement(Hook hook, WebElement element, WebDriver driver) throws CandybeanException { if ("select".equals(element.getTagName())) { return new WebDriverSelector(hook, driver); } return new WebDriverElement(hook, 0, driver, element); }
Source:
<code>public final Duration toDuration() throws StringValueConversionException { try { return Duration.parse(text); } catch (Exception e) { <START> throw new StringValueConversionException("xxx", e); <END> } }</code><technical_language>xxx</technical_language>

Target:
public final Duration toDuration() throws StringValueConversionException { try { return Duration.parse(text); } catch (Exception e) { throw new StringValueConversionException("Unable to convert '" + text + "' to a Duration value", e); } }
Source:
<code><START> private int getReturnCode() { <END> int returnCode = CommandExecutorCodes.Kitchen.SUCCESS.getCode(); if ( getResult().getNrErrors() != 0 ) { getLog().logError( BaseMessages.getString( getPkgClazz(), "Kitchen.Error.FinishedWithErrors" ) ); } return getResult().getResult() ? returnCode : CommandExecutorCodes.Kitchen.ERRORS_DURING_PROCESSING.getCode(); }</code><technical_language>I unit tests for this new method</technical_language>

Target:
int getReturnCode() { int successCode = CommandExecutorCodes.Kitchen.SUCCESS.getCode(); if ( getResult().getNrErrors() != 0 ) { getLog().logError( BaseMessages.getString( getPkgClazz(), "Kitchen.Error.FinishedWithErrors" ) ); return CommandExecutorCodes.Kitchen.ERRORS_DURING_PROCESSING.getCode(); } return getResult().getResult() ? successCode : CommandExecutorCodes.Kitchen.ERRORS_DURING_PROCESSING.getCode(); }
Source:
<code>public void updateOrbit() { StellarBody parentStar = new StellarBody(); <START> this.orbitTheta = AstronomicalBodyHelper.getOrbitalTheta(orbitalDist, parentStar.getSize()); <END> }</code><technical_language>parent star's size, a brand new star default updates tick. Consider getStar()</technical_language>

Target:
public void updateOrbit() { this.orbitTheta = AstronomicalBodyHelper.getOrbitalTheta(orbitalDist, getStar().getSize()); }
Source:
<code>protected boolean isReference(Model model, JsonPointer pointer) { <START> TypeDefinition type = model.find(pointer).getType(); <END> if (type instanceof MultipleTypeDefinition) { for (TypeDefinition nestedType : ((MultipleTypeDefinition) type).getMultipleTypes()) { if (getReferencePointerString().equals(nestedType.getPointer().toString())) { return true; } } } JsonPointer pointerToType = type.getPointer(); if (pointerToType == null) { return false; } return getReferencePointerString().equals(pointerToType.toString()); }</code><technical_language>Model.find return null, in this case</technical_language>

Target:
protected boolean isReference(Model model, JsonPointer pointer) { AbstractNode contextNode = model.find(pointer); if (contextNode == null) { return false; } TypeDefinition type = contextNode.getType(); if (type instanceof MultipleTypeDefinition) { for (TypeDefinition nestedType : ((MultipleTypeDefinition) type).getMultipleTypes()) { if (getReferencePointerString().equals(nestedType.getPointer().toString())) { return true; } } } JsonPointer pointerToType = type.getPointer(); if (pointerToType == null) { return false; } return getReferencePointerString().equals(pointerToType.toString()); }
Source:
<code>private static List< Group > fuseCollection( final Collection< Group > c ) { final Deque< Group > champions = new ArrayDeque<>( c ); final List< Group > fused = new ArrayList<>(); <START> if ( champions.size() > 1 ) <END> { while ( !champions.isEmpty() ) { Group champion = champions.pop(); final Set< Group > challengers = new HashSet<>( champions ); challengers.remove( champion ); for ( final Group challenger : challengers ) { final Group fusion = champion.fuse( challenger ); if ( null == fusion ) { } else { champions.remove( challenger ); champion = fusion; } } fused.add( champion ); } } return fused; }</code><technical_language>If input contains 1 group, fuseCollection return empty list. Is this a bug</technical_language>

Target:
private static List< Group > fuseCollection( final Collection< Group > c ) { if ( c.size() <= 1 ) return new ArrayList<>( c ); final Deque< Group > champions = new ArrayDeque<>( c ); final List< Group > fused = new ArrayList<>(); while ( !champions.isEmpty() ) { Group champion = champions.pop(); final Set< Group > challengers = new HashSet<>( champions ); challengers.remove( champion ); for ( final Group challenger : challengers ) { final Group fusion = champion.fuse( challenger ); if ( null == fusion ) { } else { champions.remove( challenger ); champion = fusion; } } fused.add( champion ); } return fused; }
Source:
<code>private String getExtraClass(String giverEmail, String instructorEmail, boolean isPublic) { <START> return " giver-display-by-" <END> + (giverEmail.equals(instructorEmail) ? "you" : "others") + " status-display-" + (isPublic ? "public" : "private"); }</code><technical_language>touching this code, change return (giverEmail.equals(instructorEmail) ? "giver-display-by-you" : "giver-display-by-others") + (isPublic ? "status-display-public" : "status-display-private"); is easier detect/locate this class search</technical_language>

Target:
private String getExtraClass(String giverEmail, String instructorEmail, boolean isPublic) { return " giver_display-by-" + (giverEmail.equals(instructorEmail) ? "you" : "others") + " status_display-" + (isPublic ? "public" : "private"); }
Source:
<code>public void missingClassMethodTest() throws IOException, ReplacementFileException { Path file = Paths.get("build/resources/test/randoop/instrument/missingclassreplacement.txt"); thrown.expect(ReplacementFileException.class); String msg = <START> "missingclassreplacement.txt:2: Class not found: randoop.mock.Gamma for line: randoop.MethodReplacements.getAgentPath() randoop.mock.Gamma.delta(alpha.beta.Gamma)"; <END> thrown.expectMessage(msg); HashMap<MethodSignature, MethodSignature> map = ReplacementFileReader.readReplacements(file); }</code><technical_language>out of scope for this pull request, I find this easier read "Class randoop.mock.Gamma for line: ..." for methods</technical_language>

Target:
public void missingClassMethodTest() throws IOException, ReplacementFileException { Path file = Paths.get("build/resources/test/randoop/instrument/missingclassreplacement.txt"); thrown.expect(ReplacementFileException.class); String msg = "missingclassreplacement.txt:2: Class randoop.mock.Gamma not found for line: randoop.MethodReplacements.getAgentPath() randoop.mock.Gamma.delta(alpha.beta.Gamma)"; thrown.expectMessage(msg); HashMap<MethodSignature, MethodSignature> map = ReplacementFileReader.readReplacements(file); }
Source:
<code>private Resource getComponentResource(String resourceType, ResourceResolver resourceResolver) { String[] resolverSearchPaths = resourceResolver.getSearchPath(); for (String searchPath : resolverSearchPaths) { <START> String tempResourceType = searchPath + resourceType; if (resourceResolver.getResource(tempResourceType) != null) { resourceType = searchPath + resourceType; return resourceResolver.getResource(resourceType); <END> } } return null; }</code><technical_language>suggestion Resource resource = resourceResolver.getResource(searchPath + resourceType); if (resource != null) { return resource;</technical_language>

Target:
private Resource getComponentResource(String resourceType, ResourceResolver resourceResolver) { String[] resolverSearchPaths = resourceResolver.getSearchPath(); for (String searchPath : resolverSearchPaths) { Resource resource = resourceResolver.getResource(searchPath + resourceType); if (resource != null) { return resource; } } return null; }
Source:
<code>public SealVmTemplateCommand(T parameters, CommandContext cmdContext) { super(parameters, cmdContext); if (getParameters().getHostJobId() == null) <START> { <END> getParameters().setHostJobId(Guid.newGuid()); } setVmTemplateId(getParameters().getVmTemplateId()); }</code><technical_language>reason template id for job</technical_language>

Target:
public SealVmTemplateCommand(T parameters, CommandContext cmdContext) { super(parameters, cmdContext); if (getParameters().getHostJobId() == null) { getParameters().setHostJobId(Guid.newGuid()); } }
Source:
<code>private void recomputeContexts() { ArrayList<IUndoContext> allContexts = new ArrayList<>(); if (triggeringOperation != null) { IUndoContext[] contexts = triggeringOperation.getContexts(); allContexts.addAll(Arrays.asList(contexts)); } for (IUndoableOperation <START> element : <END> children) { for (IUndoContext context : element.getContexts()) { if (!allContexts.contains(context)) { allContexts.add(context); } } } contexts = allContexts; }</code><technical_language>rename operation</technical_language>

Target:
private void recomputeContexts() { ArrayList<IUndoContext> allContexts = new ArrayList<>(); if (triggeringOperation != null) { IUndoContext[] contexts = triggeringOperation.getContexts(); allContexts.addAll(Arrays.asList(contexts)); } for (IUndoableOperation operation : children) { for (IUndoContext context : operation.getContexts()) { if (!allContexts.contains(context)) { allContexts.add(context); } } } contexts = allContexts; }
Source:
<code>private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { <START> log.error("Failed to parse a given ovf configuration: '{}':\n{}", <END> e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception", e); } } }</code><technical_language>is need for ' in message</technical_language>

Target:
private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: {}:\n'{}'", e.getMessage(), ovfEntityData.getOvfData()); log.debug("Exception", e); } } }
Source:
<code>public String docs() { <START> return "string {entityID} retruns the persistent unique id of the entity"; <END> }</code><technical_language>"returns"</technical_language>

Target:
public String docs() { return "string {entityID} returns the persistent unique id of the entity"; }