auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<Item> findAllByCrfVersionId(Integer crfVersionId) { <START> String query = "select distinct i.* from item i, item_form_metadata ifm " + "where i.item_id= ifm.item_id " <END> + "and ifm.crf_version_id=?"; org.hibernate.Query q = getCurrentSession().createSQLQuery(query).addEntity(Item.class); q.setParameter(0, crfVersionId.intValue()); return (List<Item>) q.list(); }</code><technical_language>this static</technical_language>

Target:
public List<Item> findAllByCrfVersionId(Integer crfVersionId) { Query q = getCurrentSession().createSQLQuery(findAllByCrfVersionIdQuery).addEntity(Item.class); q.setInteger("crfversionid", crfVersionId.intValue()); return (List<Item>) q.list(); }
Source:
<code>private void verifyCheckpoint(Set<Container> containers) { <START> <END> }</code><technical_language>Please add TODO lines for incomplete methods</technical_language>

Target:
private void verifyCheckpoint(Set<Container> containers) throws CloudStorageException { long maxDeleteTimestamp = containers.stream().max(Comparator.comparing(Container::getDeleteTriggerTime)).get().getDeleteTriggerTime(); Assert.assertEquals(azureContainerCompactor.getLatestContainerDeletionTime(), maxDeleteTimestamp); }
Source:
<code>public void init(boolean waitTillFinished) throws SiteContextInitializationException { if (state == State.CREATED) { publishEvent(new SiteContextCreatedEvent(this)); Runnable initTask = () -> { SiteContext.setCurrent(this); try { logger.info("--------------------------------------------------"); logger.info("<Initializing context site: " + siteName + ">"); logger.info("--------------------------------------------------"); if (cacheWarmer != null) { cacheWarmer.warmUpCache(this, false); } buildGraphQLSchema(); executeInitScript(); state = State.INITIALIZED; logger.info("--------------------------------------------------"); logger.info("</Initializing context site: " + siteName + ">"); logger.info("--------------------------------------------------"); publishEvent(new SiteContextInitializedEvent(this)); <START> initializationLatch.countDown(); <END> } finally { SiteContext.clear(); } }; if (waitTillFinished) { Future<?> future = maintenanceTaskExecutor.submit(initTask); try { future.get(); } catch (InterruptedException | ExecutionException e) { throw new SiteContextInitializationException("Error while waiting for context init", e); } } else { maintenanceTaskExecutor.execute(initTask); } } }</code><technical_language>if init fails? this in finally? if fails get other threads stuck</technical_language>

Target:
public void init(boolean waitTillFinished) throws SiteContextInitializationException { if (state == State.CREATED) { publishEvent(new SiteContextCreatedEvent(this)); Runnable initTask = () -> { SiteContext.setCurrent(this); try { logger.info("--------------------------------------------------"); logger.info("<Initializing context site: " + siteName + ">"); logger.info("--------------------------------------------------"); if (cacheWarmer != null) { cacheWarmer.warmUpCache(this, false); } buildGraphQLSchema(); executeInitScript(); state = State.INITIALIZED; logger.info("--------------------------------------------------"); logger.info("</Initializing context site: " + siteName + ">"); logger.info("--------------------------------------------------"); publishEvent(new SiteContextInitializedEvent(this)); } finally { initializationLatch.countDown(); SiteContext.clear(); } }; if (waitTillFinished) { Future<?> future = maintenanceTaskExecutor.submit(initTask); try { future.get(); } catch (InterruptedException | ExecutionException e) { throw new SiteContextInitializationException("Error while waiting for context init", e); } } else { maintenanceTaskExecutor.execute(initTask); } } }
Source:
<code>public void testSameInstanceForSameForceReturnValues() { RemoteCache<String, String> rcDontForceReturn = remoteCacheManager.getCache(false); RemoteCache<String, String> rcDontForceReturn2 = remoteCacheManager.getCache(false); <START> assert rcDontForceReturn == rcDontForceReturn2; <END> RemoteCache<String, String> rcForceReturn = remoteCacheManager.getCache(true); RemoteCache<String, String> rcForceReturn2 = remoteCacheManager.getCache(true); assert rcForceReturn == rcForceReturn2; }</code><technical_language>change new asserts org.testng.AssertJUnit.\* instead. Thanks</technical_language>

Target:
public void testSameInstanceForSameForceReturnValues() { RemoteCache<String, String> rcDontForceReturn = remoteCacheManager.getCache(false); RemoteCache<String, String> rcDontForceReturn2 = remoteCacheManager.getCache(false); assertSame("RemoteCache instances should be the same", rcDontForceReturn, rcDontForceReturn2); RemoteCache<String, String> rcForceReturn = remoteCacheManager.getCache(true); RemoteCache<String, String> rcForceReturn2 = remoteCacheManager.getCache(true); assertSame("RemoteCache instances should be the same", rcForceReturn, rcForceReturn2); }
Source:
<code>public BlobStore createInstance(TileLayerDispatcher layers, LockProvider lockProvider) throws StorageException { checkNotNull(layers); checkState(getName() != null); checkState( isEnabled(), <START> "Can't call S3BlobStoreConfig.createInstance() is blob store is not enabled"); <END> return new AzureBlobStore(this, layers, lockProvider); }</code><technical_language>"S3" in message</technical_language>

Target:
public BlobStore createInstance(TileLayerDispatcher layers, LockProvider lockProvider) throws StorageException { checkNotNull(layers); checkState(getName() != null); checkState( isEnabled(), "Can't call AzureBlobStoreConfig.createInstance() is blob store is not enabled"); return new AzureBlobStore(this, layers, lockProvider); }
Source:
<code>public ClusterParticipant getClusterParticipant() throws IOException { <START> if (clusterParticipant == null) { <END> clusterParticipant = helixClusterAgentsFactory.getClusterParticipant(); } return clusterParticipant; }</code><technical_language>if this method called more once, clusterParticipant volatile AtomicReference</technical_language>

Target:
public ClusterParticipant getClusterParticipant() throws IOException { if (clusterParticipantRef.get() == null) { ClusterParticipant clusterParticipant = new ClusterParticipant() { @Override public void participate(List<AmbryHealthReport> ambryHealthReports) { } @Override public void close() { } @Override public boolean setReplicaSealedState(ReplicaId replicaId, boolean isSealed) { return false; } @Override public boolean setReplicaStoppedState(List<ReplicaId> replicaIds, boolean markStop) { return false; } @Override public List<String> getSealedReplicas() { return Collections.emptyList(); } @Override public List<String> getStoppedReplicas() { return Collections.emptyList(); } @Override public void registerPartitionStateChangeListener(StateModelListenerType listenerType, PartitionStateChangeListener partitionStateChangeListener) { } @Override public ReplicaSyncUpManager getReplicaSyncUpManager() { return null; } @Override public boolean updateDataNodeInfoInCluster(ReplicaId replicaId, boolean shouldExist) { return false; } }; clusterParticipantRef.compareAndSet(null, clusterParticipant); } return clusterParticipantRef.get(); }
Source:
<code>public boolean isDeprecated() { AttributeDefinition def = StyleResolver.getAttributeDefinition(mySourceTheme.getConfiguration(), myItemResourceValue); String doc = (def == null) ? null : def.getDocValue(null); return (doc != null && StringUtil.containsIgnoreCase(doc, <START> "deprecated")); <END> }</code><technical_language>this a constant</technical_language>

Target:
public boolean isDeprecated() { AttributeDefinition def = StyleResolver.getAttributeDefinition(mySourceTheme.getConfiguration(), myItemResourceValue); String doc = (def == null) ? null : def.getDocValue(null); return (doc != null && StringUtil.containsIgnoreCase(doc, DEPRECATED)); }
Source:
<code>public List<WellKnownImage> get() { Iterable<StandardDrive> standardDrives = filter(api.listStandardDriveInfo(), new Predicate<StandardDrive>() { @Override public boolean apply(StandardDrive input) { return MediaType.DISK == input.getMedia(); } }); <START> return newArrayList(transform(standardDrives, standardDriveToWellKnownImage)); <END> }</code><technical_language>I awful imperative all, this easier? ImmutableList.Builder images = ImmutableList.builder(); for (StandardDrive drive : api.listStandardDriveInfo()) { if (drive.getMedia() == MediaType.DISK) { images.add(standardDriveToWellKnownImage.apply(drive)); } } return images.build(); ? In case, ImmutableList</technical_language>

Target:
public List<WellKnownImage> get() { ImmutableList.Builder<WellKnownImage> images = ImmutableList.builder(); for (StandardDrive drive : api.listStandardDriveInfo()) { if (drive.getMedia() == MediaType.DISK) { images.add(standardDriveToWellKnownImage.apply(drive)); } } return images.build(); }
Source:
<code>FileStream open(final String path) throws IOException { final URL base = httpObjectsUrl; final URL u = new URL(base, path); final HttpConnection c = httpOpen(u); switch (HttpSupport.response(c)) { case HttpConnection.HTTP_OK: final InputStream in = openInputStream(c); <START> if (!ENCODING_GZIP.equals(c.getHeaderField(HDR_CONTENT_ENCODING))) { <END> final int len = c.getContentLength(); return new FileStream(in, len); } return new FileStream(in); case HttpConnection.HTTP_NOT_FOUND: throw new FileNotFoundException(u.toString()); default: throw new IOException(u.toString() + ": " + HttpSupport.response(c) + " " + c.getResponseMessage()); } }</code><technical_language>this check factored out a separate function? risk of openInputStream open out of sync</technical_language>

Target:
FileStream open(final String path) throws IOException { final URL base = httpObjectsUrl; final URL u = new URL(base, path); final HttpConnection c = httpOpen(u); switch (HttpSupport.response(c)) { case HttpConnection.HTTP_OK: final InputStream in = openInputStream(c); if (!isGzipContent(c)) { final int len = c.getContentLength(); return new FileStream(in, len); } return new FileStream(in); case HttpConnection.HTTP_NOT_FOUND: throw new FileNotFoundException(u.toString()); default: throw new IOException(u.toString() + ": " + HttpSupport.response(c) + " " + c.getResponseMessage()); } }
Source:
<code>public String toString() { <START> ImmutableList.Builder<String> listBuilder = ImmutableList.builder(); <END> listBuilder.add("StartpointKey") .add(systemStreamPartition.getSystem()) .add(systemStreamPartition.getStream()) .add(Integer.toString(systemStreamPartition.getPartition().getPartitionId())); if (taskName != null && StringUtils.isNotBlank(taskName.getTaskName())) { listBuilder.add(taskName.getTaskName()); } return String.join(":", listBuilder.build()); }</code><technical_language>Intellij able auto-generate a toString for (Code -> Generate). manage pulling fields out of objects SSP. SSP a toString anyways, auto-generated toString that</technical_language>

Target:
public String toString() { return Objects.toStringHelper(this).toString(); }
Source:
<code>public Map<String, Object> toMap() { Map<String, Object> map = super.toMap(); map.put("pid", getPid()); map.put("hostAddress", getHostAddress()); map.put("name", getName()); map.put("logicalConnectionUid", getLogicalConnectionUid()); map.put("vmId", getVmId()); map.put("clientId", getClientId()); map.put("hostName", getHostName()); map.put("clientReportedAddress", this.clientReportedAddress != null ? this.clientReportedAddress : "UNKNOWN"); map.put("tags", getTags()); <START> map.put("version", version != null ? version : "UNKNOWN"); <END> map.put("connections", connectionStream().sorted(Comparator.comparing(AbstractNode::getId)).map(Connection::toMap).collect(Collectors.toList())); map.put("managementRegistry", getManagementRegistry().map(ManagementRegistry::toMap).orElse(null)); return map; }</code><technical_language>left null put in map map is meant a friendly output for user (TMC that) => TMC place a missing translate MISSING. In backend (and json), valueshould there. other optional fields in topology</technical_language>

Target:
public Map<String, Object> toMap() { Map<String, Object> map = super.toMap(); map.put("pid", getPid()); map.put("hostAddress", getHostAddress()); map.put("name", getName()); map.put("logicalConnectionUid", getLogicalConnectionUid()); map.put("vmId", getVmId()); map.put("clientId", getClientId()); map.put("hostName", getHostName()); map.put("tags", getTags()); map.put("properties", getProperties()); map.put("connections", connectionStream().sorted(Comparator.comparing(AbstractNode::getId)).map(Connection::toMap).collect(Collectors.toList())); map.put("managementRegistry", getManagementRegistry().map(ManagementRegistry::toMap).orElse(null)); return map; }
Source:
<code>public boolean onLogin() throws LoginException { byte[] token = getToken(); GSSContext gssContext = acceptToken(token); <START> validateAccess(gssContext); <END> try { _name = gssContext.getSrcName().toString(); } catch (GSSException e) { throw new FailedLoginException("Failed to get a name. " + e.getMessage()); } return true; }</code><technical_language>I rename method a more descriptive name wrap skipRole condition. E.g. java if (! isSkipRole()) { addGroupSidsFromMsPac(token); }</technical_language>

Target:
public boolean onLogin() throws LoginException { byte[] token = getToken(); GSSContext gssContext = acceptToken(token); registerRoles(gssContext); try { _name = gssContext.getSrcName().toString(); } catch (GSSException e) { throw new FailedLoginException("Failed to get a name. " + e.getMessage()); } return true; }
Source:
<code>protected ToStringHelper string() { return Objects.toStringHelper(this) <START> .add("addr", addr).add("version", version).add("macAddr", macAddr).add("type", type); <END> }</code><technical_language>macAddr.or("") type.or("") (or another default), a string representation</technical_language>

Target:
protected ToStringHelper string() { return Objects.toStringHelper(this) .add("addr", addr).add("version", version).add("macAddr", macAddr.or("")).add("type", type.or("")); }
Source:
<code>void translate(final TableScan tableScan, final TranslatorContext context) { StreamGraph streamGraph = context.getStreamGraph(); List<String> tableNameParts = tableScan.getTable().getQualifiedName(); String sourceName = SqlIOConfig.getSourceFromSourceParts(tableNameParts); Validate.isTrue(relMsgConverters.containsKey(sourceName), String.format("Unknown source %s", sourceName)); SqlIOConfig sqlIOConfig = systemStreamConfig.get(sourceName); final String systemName = sqlIOConfig.getSystemName(); final String streamName = sqlIOConfig.getStreamName(); <START> KVSerde<Object, Object> noOpKVSerde = KVSerde.of(new NoOpSerde<>(), new NoOpSerde<>()); <END> GenericInputDescriptor<KV<Object, Object>> inputStreamDescriptor = GenericInputDescriptor.from(streamName, systemName, noOpKVSerde); MessageStream<KV<Object, Object>> inputStream = streamGraph.getInputStream(inputStreamDescriptor); MessageStream<SamzaSqlRelMessage> samzaSqlRelMessageStream = inputStream.map(new ScanMapFunction(sourceName)); context.registerMessageStream(tableScan.getId(), samzaSqlRelMessageStream); }</code><technical_language>above. Is this final implementation</technical_language>

Target:
void translate(final TableScan tableScan, final TranslatorContext context) { StreamGraph streamGraph = context.getStreamGraph(); List<String> tableNameParts = tableScan.getTable().getQualifiedName(); String sourceName = SqlIOConfig.getSourceFromSourceParts(tableNameParts); Validate.isTrue(relMsgConverters.containsKey(sourceName), String.format("Unknown source %s", sourceName)); SqlIOConfig sqlIOConfig = systemStreamConfig.get(sourceName); final String systemName = sqlIOConfig.getSystemName(); final String streamName = sqlIOConfig.getStreamName(); KVSerde<Object, Object> noOpKVSerde = KVSerde.of(new NoOpSerde<>(), new NoOpSerde<>()); DelegatingSystemDescriptor sd = context.getSystemDescriptors().computeIfAbsent(systemName, DelegatingSystemDescriptor::new); GenericInputDescriptor<KV<Object, Object>> isd = sd.getInputDescriptor(streamName, noOpKVSerde); MessageStream<KV<Object, Object>> inputStream = streamGraph.getInputStream(isd); MessageStream<SamzaSqlRelMessage> samzaSqlRelMessageStream = inputStream.map(new ScanMapFunction(sourceName)); context.registerMessageStream(tableScan.getId(), samzaSqlRelMessageStream); }
Source:
<code>public void synchronizeGroupsStructures() { if(perunBl.isPerunReadOnly()) { log.debug("This instance is just read only so skip synchronization of groups structures."); return; } if (synchronizeGroupsStructuresRunning.compareAndSet(false, true)) { try { log.debug("Synchronizer starting synchronizing the groups structures"); this.perunBl.getGroupsManagerBl().synchronizeGroupsStructures(this.sess); <START> if (!synchronizeGroupsStructuresRunning.compareAndSet(true, false)) { <END> log.error("Synchronizer: group structure synchronization out of sync, resetting."); synchronizeGroupsStructuresRunning.set(false); } } catch (InternalErrorException e) { log.error("Cannot synchronize groups structures:", e); synchronizeGroupsStructuresRunning.set(false); } } else { log.debug("Synchronizer: group structure synchronization currently running."); } }</code><technical_language>I this check is unnecessary this situation happen. I synchronizeGroupsStructuresRunning.setValue(false)</technical_language>

Target:
public void synchronizeGroupsStructures() { if(perunBl.isPerunReadOnly()) { log.warn("This instance is just read only so skip synchronization of groups structures."); return; } if (synchronizeGroupsStructuresRunning.compareAndSet(false, true)) { try { log.debug("Synchronizer starting synchronizing the groups structures"); this.perunBl.getGroupsManagerBl().synchronizeGroupsStructures(this.sess); synchronizeGroupsStructuresRunning.set(false); } catch (InternalErrorException e) { log.error("Cannot synchronize groups structures:", e); synchronizeGroupsStructuresRunning.set(false); } } else { log.debug("Synchronizer: group structure synchronization currently running."); } }
Source:
<code>public void setInput(IEditorInput input) { super.setInput(input); if (getGraphicalViewer() != null) { getGraphicalViewer().setSelection(new StructuredSelection()); } DRepresentation representation = getRepresentation(); if (representation instanceof DSemanticDecorator) { DSemanticDecorator dSemanticDecorator = (DSemanticDecorator) representation; DRepresentationPermissionStatusQuery dRepresentationPermissionStatusQuery = new DRepresentationPermissionStatusQuery(dSemanticDecorator); IPermissionAuthority permissionAuthority = getPermissionAuthority(); LockStatus lockStatus = LockStatus.NOT_LOCKED; LockStatus dSemanticDecoratorLockStatus = permissionAuthority.getLockStatus(dSemanticDecorator); if (dSemanticDecoratorLockStatus != LockStatus.NOT_LOCKED) { lockStatus = dSemanticDecoratorLockStatus; } int associatedSessionListenerEvent = dRepresentationPermissionStatusQuery.getAssociatedSessionListenerEvent(lockStatus); notify(associatedSessionListenerEvent); } if (diagramHeaderComposite != null && !diagramHeaderComposite.isDisposed()) { diagramHeaderComposite.rebuildHeaderSection(); } if (gmfDiagramUpdater != null) { gmfDiagramUpdater.dispose(); } <START> EObject element = getDiagram().getElement(); <END> if (element instanceof DDiagram) { gmfDiagramUpdater = new GMFDiagramUpdater(getSession(), (DDiagram) element); } }</code><technical_language>I element duplicates representation. reuse representation here</technical_language>

Target:
public void setInput(IEditorInput input) { super.setInput(input); if (getGraphicalViewer() != null) { getGraphicalViewer().setSelection(new StructuredSelection()); } DRepresentation representation = getRepresentation(); if (representation instanceof DSemanticDecorator) { DSemanticDecorator dSemanticDecorator = (DSemanticDecorator) representation; DRepresentationPermissionStatusQuery dRepresentationPermissionStatusQuery = new DRepresentationPermissionStatusQuery(dSemanticDecorator); IPermissionAuthority permissionAuthority = getPermissionAuthority(); LockStatus lockStatus = LockStatus.NOT_LOCKED; LockStatus dSemanticDecoratorLockStatus = permissionAuthority.getLockStatus(dSemanticDecorator); if (dSemanticDecoratorLockStatus != LockStatus.NOT_LOCKED) { lockStatus = dSemanticDecoratorLockStatus; } int associatedSessionListenerEvent = dRepresentationPermissionStatusQuery.getAssociatedSessionListenerEvent(lockStatus); notify(associatedSessionListenerEvent); } if (diagramHeaderComposite != null && !diagramHeaderComposite.isDisposed()) { diagramHeaderComposite.rebuildHeaderSection(); } if (gmfDiagramUpdater != null) { gmfDiagramUpdater.dispose(); } if (representation instanceof DDiagram) { gmfDiagramUpdater = new GMFDiagramUpdater(getSession(), (DDiagram) representation); } }
Source:
<code>public void test() throws Exception { Study study = Study.create(); study.setName("Name"); study.setShortName("ShortName"); study.setIdentifier("id"); study.setSponsorName("SponsorName"); study.setSupportEmail("support@email.com"); study.setTechnicalEmail("tech@email.com"); study.setConsentNotificationEmail("consent@email.com,consent2@email.com"); SmsTemplate template = new SmsTemplate("${studyShortName} ${url} ${supportEmail}"); SmsMessageProvider provider = new SmsMessageProvider.Builder() .withStudy(study) .withPhone(TestConstants.PHONE) .withSmsTemplate(template) <START> .withToken("url", "some-url").build(); <END> PublishRequest request = provider.getSmsRequest(); assertEquals("ShortName some-url support@email.com", request.getMessage()); assertEquals(study.getShortName(), request.getMessageAttributes().get(BridgeConstants.SENDER_ID).getStringValue()); assertEquals(BridgeConstants.SMS_TYPE_TRANSACTIONAL, request.getMessageAttributes().get(BridgeConstants.SMS_TYPE).getStringValue()); }</code><technical_language>this include withExpirationPeriod()</technical_language>

Target:
public void test() throws Exception { Study study = Study.create(); study.setName("Name"); study.setShortName("ShortName"); study.setIdentifier("id"); study.setSponsorName("SponsorName"); study.setSupportEmail("support@email.com"); study.setTechnicalEmail("tech@email.com"); study.setConsentNotificationEmail("consent@email.com,consent2@email.com"); SmsTemplate template = new SmsTemplate("${studyShortName} ${url} ${supportEmail} ${expirationPeriod}"); SmsMessageProvider provider = new SmsMessageProvider.Builder() .withStudy(study) .withPhone(TestConstants.PHONE) .withSmsTemplate(template) .withExpirationPeriod("expirationPeriod", 60*60*4) .withToken("url", "some-url").build(); PublishRequest request = provider.getSmsRequest(); assertEquals("ShortName some-url support@email.com 4 hours", request.getMessage()); assertEquals(study.getShortName(), request.getMessageAttributes().get(BridgeConstants.SENDER_ID).getStringValue()); assertEquals(BridgeConstants.SMS_TYPE_TRANSACTIONAL, request.getMessageAttributes().get(BridgeConstants.SMS_TYPE).getStringValue()); assertEquals("some-url", provider.getTokenMap().get("url")); assertEquals("4 hours", provider.getTokenMap().get("expirationPeriod")); assertEquals("Name", provider.getTokenMap().get("studyName")); assertEquals("ShortName", provider.getTokenMap().get("studyShortName")); assertEquals("id", provider.getTokenMap().get("studyId")); assertEquals("SponsorName", provider.getTokenMap().get("sponsorName")); assertEquals("support@email.com", provider.getTokenMap().get("supportEmail")); assertEquals("tech@email.com", provider.getTokenMap().get("technicalEmail")); assertEquals("consent@email.com", provider.getTokenMap().get("consentEmail")); }
Source:
<code>private String decodeAlarm(int value) { switch (value) { <START> case 0: return Position.ALARM_OIL_CUT; <END> case 1: return Position.ALARM_ACCIDENT; case 2: return Position.ALARM_SOS; case 3: return Position.ALARM_VIBRATION; case 4: return Position.ALARM_LOW_SPEED; case 5: return Position.ALARM_OVERSPEED; case 6: return Position.ALARM_GEOFENCE_EXIT; default: return null; } }</code><technical_language>Return next line</technical_language>

Target:
private String decodeAlarm(int value) { switch (value) { case 1: return Position.ALARM_ACCIDENT; case 2: return Position.ALARM_SOS; case 3: return Position.ALARM_VIBRATION; case 4: return Position.ALARM_LOW_SPEED; case 5: return Position.ALARM_OVERSPEED; case 6: return Position.ALARM_GEOFENCE_EXIT; default: return null; } }
Source:
<code>void pushSubmissionAndAttachments(Path submissionFile, List<Path> attachments, RunnerStatus runnerStatus, PushToAggregateTracker tracker, int submissionNumber, int totalSubmissions, int part, int parts) { if (runnerStatus.isCancelled()) { tracker.trackCancellation("Sending submissions " + submissionNumber + " of " + totalSubmissions); return; } tracker.trackStartSendingSubmissionAndAttachments(submissionNumber, totalSubmissions, part, parts); Response<XmlElement> response = http.execute(server.getPushSubmissionRequest( submissionFile, attachments )); <START> for (InputStream stream : server.getFileStreams()) { closeInputStream(stream); } <END> server.getFileStreams().clear(); if (response.isSuccess()) tracker.trackEndSendingSubmissionAndAttachments(submissionNumber, totalSubmissions, part, parts); else tracker.trackErrorSendingSubmissionAndAttachments(submissionNumber, totalSubmissions, part, parts, response); }</code><technical_language>suggestion server.getFileStreams().forEach(UncheckedFiles::closeInputStream);</technical_language>

Target:
void pushSubmissionAndAttachments(Path submissionFile, List<Path> attachments, RunnerStatus runnerStatus, PushToAggregateTracker tracker, int submissionNumber, int totalSubmissions, int part, int parts) { if (runnerStatus.isCancelled()) { tracker.trackCancellation("Sending submissions " + submissionNumber + " of " + totalSubmissions); return; } tracker.trackStartSendingSubmissionAndAttachments(submissionNumber, totalSubmissions, part, parts); Response<XmlElement> response = http.execute(server.getPushSubmissionRequest( submissionFile, attachments )); if (response.isSuccess()) tracker.trackEndSendingSubmissionAndAttachments(submissionNumber, totalSubmissions, part, parts); else tracker.trackErrorSendingSubmissionAndAttachments(submissionNumber, totalSubmissions, part, parts, response); }
Source:
<code>private void releaseClassLoader() { Set<Map.Entry<String, Runnable>> hooks = releaseHooks.entrySet(); if (!hooks.isEmpty()) { LOG.debug("Running class loader shutdown hook(s): {}.", hooks.size(), releaseHooks.keySet()); for (Map.Entry<String, Runnable> hookEntry : hooks) { try { hookEntry.getValue().run(); } catch (Throwable t) { LOG.debug("Failed to run release hook '{}' for user code class loader.", hookEntry.getValue(), t); } } releaseHooks.clear(); } <START> try { <END> classLoader.close(); } catch (IOException e) { LOG.warn("Failed to release user code class loader for " + Arrays.toString(libraries.toArray())); } }</code><technical_language>is log hook run? I consider moving loop runHooks method</technical_language>

Target:
private void releaseClassLoader() { runReleaseHooks(); try { classLoader.close(); } catch (IOException e) { LOG.warn("Failed to release user code class loader for " + Arrays.toString(libraries.toArray())); } }
Source:
<code>private void remove(final IResource path) throws CoreException { final IProject proj = path.getProject(); if (proj == null) { return; } final GitProjectData pd = GitProjectData.get(proj); <START> if (pd == null) { <END> return; } final RepositoryMapping rm = pd.getRepositoryMapping(path); if (rm == null) { return; } final Repository db = rm.getRepository(); DirCacheEditor e = edits.get(db); if (e == null) { try { e = db.lockDirCache().editor(); } catch (IOException err) { throw new CoreException(Activator.error(CoreText.UntrackOperation_failed, err)); } edits.put(db, e); } if (path instanceof IContainer) { e.add(new DirCacheEditor.DeleteTree(rm.getRepoRelativePath(path))); } else { e.add(new DirCacheEditor.DeletePath(rm.getRepoRelativePath(path))); } }</code><technical_language>unrelated changes</technical_language>

Target:
private void remove(final IResource path) throws CoreException { final IProject proj = path.getProject(); if (proj == null) { return; } final GitProjectData pd = GitProjectData.get(proj); if (pd == null) return; final RepositoryMapping rm = pd.getRepositoryMapping(path); if (rm == null) return; final Repository db = rm.getRepository(); DirCacheEditor e = edits.get(db); if (e == null) { try { e = db.lockDirCache().editor(); } catch (IOException err) { throw new CoreException(Activator.error(CoreText.UntrackOperation_failed, err)); } edits.put(db, e); mappings.put(rm, rm); } if (path instanceof IContainer) e.add(new DirCacheEditor.DeleteTree(rm.getRepoRelativePath(path))); else e.add(new DirCacheEditor.DeletePath(rm.getRepoRelativePath(path))); }
Source:
<code>private char getChar() { int rndNum = baseProducer.randomBetween(0, 35); <START> if (rndNum < 10) <END> return (char)(49 + rndNum); else return (char)(65 + rndNum - 10); }</code><technical_language>Plase add improve readability</technical_language>

Target:
private char getChar() { int rndNum = baseProducer.randomBetween(0, 35); if (rndNum < 10) { return (char) (49 + rndNum); } else { return (char) (65 + rndNum - 10); } }
Source:
<code>public void channelRegistered(ChannelHandlerContext ctx) throws Exception { super.channelRegistered(ctx); LOG.info("channelRegistered {}", ctx); <START> } <END></code><technical_language>for debugging. debug logs instead</technical_language>

Target:
public void channelRegistered(ChannelHandlerContext ctx) throws Exception { super.channelRegistered(ctx); LOG.debug("channelRegistered {}", ctx); }
Source:
<code>public void testSingleServer() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clientIntelligence(ClientIntelligence.BASIC); RemoteCache<String, String> cache = SERVER_TEST.hotrod().withClientConfiguration(builder).withCacheMode(CacheMode.DIST_SYNC).create(); <START> cache.put("k1", "v1"); <END> assertEquals(1, cache.size()); assertEquals("v1", cache.get("k1")); }</code><technical_language>Wrong indent, previous line wrapped</technical_language>

Target:
public void testSingleServer() { RemoteCache<String, String> cache = SERVER_TEST .hotrod() .withCacheMode(CacheMode.DIST_SYNC).create(); cache.put("k1", "v1"); assertEquals(1, cache.size()); assertEquals("v1", cache.get("k1")); }
Source:
<code>public void handleMediaPacket(@NotNull OctoPacketInfo packetInfo) { if (!running.get()) { ByteBufferPool.returnBuffer(packetInfo.getPacket().getBuffer()); return; } stats.packetReceived(packetInfo.getPacket().length, clock.instant()); IncomingOctoEpPacketHandler handler = incomingPacketHandlers.get(packetInfo.getEndpointId()); if (handler != null) { handler.handleIncomingPacket(packetInfo); } else { <START> stats.incomingPacketDropped(); <END> } }</code><technical_language>Return buffer pool</technical_language>

Target:
public void handleMediaPacket(@NotNull OctoPacketInfo packetInfo) { if (!running.get()) { ByteBufferPool.returnBuffer(packetInfo.getPacket().getBuffer()); return; } stats.packetReceived(packetInfo.getPacket().length, clock.instant()); IncomingOctoEpPacketHandler handler = incomingPacketHandlers.get(packetInfo.getEndpointId()); if (handler != null) { handler.handleIncomingPacket(packetInfo); } else { stats.incomingPacketDropped(); ByteBufferPool.returnBuffer(packetInfo.getPacket().getBuffer()); } }
Source:
<code>public void addressCloneTest() throws Exception { Address address = new Address("172.16.16.1", 4223); AddressConstructor constructor = new AddressConstructor(Address.class); Address clonedAddress = (Address) constructor.createNew(address); <START> assertEquals(clonedAddress.getHost(), address.getHost()); <END> assertEquals(clonedAddress.getPort(), address.getPort()); assertEquals(clonedAddress.getInetAddress(), address.getInetAddress()); assertEquals(clonedAddress.getInetSocketAddress(), address.getInetSocketAddress()); }</code><technical_language>order of parameters other way? argument is "expected", this mislead assertion error</technical_language>

Target:
public void addressCloneTest() throws Exception { Address address = new Address("172.16.16.1", 4223); AddressConstructor constructor = new AddressConstructor(Address.class); Address clonedAddress = (Address) constructor.createNew(address); assertEquals(address.getHost(), clonedAddress.getHost()); assertEquals(address.getPort(), clonedAddress.getPort()); assertEquals(address.getInetAddress(), clonedAddress.getInetAddress()); assertEquals(address.getInetSocketAddress(), clonedAddress.getInetSocketAddress()); }
Source:
<code>private static void getPackageFragmentRootContainers(IRuntimeClasspathEntry entry, List<ISourceContainer> containers) { IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); IPath entryPath = entry.getPath(); boolean found = false; try { IJavaProject[] jps = model.getJavaProjects(); for (int i = 0; i < jps.length; i++) { IJavaProject jp = jps[i]; IProject p = jp.getProject(); if (p.isOpen()) { IPackageFragmentRoot[] allRoots = jp.getPackageFragmentRoots(); for (int j = 0; j < allRoots.length; j++) { IPackageFragmentRoot root = allRoots[j]; if (root.getPath().equals(entryPath) && isSourceAttachmentEqual(root, entry)) { PackageFragmentRootSourceContainer container = new PackageFragmentRootSourceContainer(root); if (!containers.contains(container)) { containers.add(container); found = true; <START> break; <END> } } } } } } catch (JavaModelException e) { LaunchingPlugin.log(e); } if (!found) { tryToAddSourceAttachment(entry, containers); } }</code><technical_language>I add break a performance problem here</technical_language>

Target:
private static void getPackageFragmentRootContainers(IRuntimeClasspathEntry entry, List<ISourceContainer> containers) { IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); IPath entryPath = entry.getPath(); boolean found = false; try { IJavaProject[] jps = model.getJavaProjects(); for (int i = 0; i < jps.length; i++) { IJavaProject jp = jps[i]; IProject p = jp.getProject(); if (p.isOpen()) { IPackageFragmentRoot[] allRoots = jp.getPackageFragmentRoots(); for (int j = 0; j < allRoots.length; j++) { IPackageFragmentRoot root = allRoots[j]; if (root.getPath().equals(entryPath) && isSourceAttachmentEqual(root, entry)) { PackageFragmentRootSourceContainer container = new PackageFragmentRootSourceContainer(root); if (!containers.contains(container)) { containers.add(container); found = true; } } } } } } catch (JavaModelException e) { LaunchingPlugin.log(e); } if (!found) { tryToAddSourceAttachment(entry, containers); } }
Source:
<code>private SymbolStatsEstimate normalizeSymbolStats(Symbol symbol, SymbolStatsEstimate symbolStats, PlanNodeStatsEstimate stats, TypeProvider types) { if (symbolStats.isUnknown()) { return SymbolStatsEstimate.unknown(); } double outputRowCount = stats.getOutputRowCount(); double distinctValuesCount = symbolStats.getDistinctValuesCount(); double nullsFraction = symbolStats.getNullsFraction(); double averageRowSize = symbolStats.getAverageRowSize(); double lowValue = symbolStats.getLowValue(); double highValue = symbolStats.getHighValue(); if (!isNaN(distinctValuesCount)) { Type type = requireNonNull(types.get(symbol), () -> "No stats for symbol " + symbol); double maxDistinctValuesByLowHigh = maxDistinctValuesByLowHigh(symbolStats, type); if (distinctValuesCount > maxDistinctValuesByLowHigh) { distinctValuesCount = maxDistinctValuesByLowHigh; } if (distinctValuesCount > outputRowCount) { distinctValuesCount = outputRowCount; } double nonNullValues = outputRowCount * (1 - nullsFraction); if (distinctValuesCount > nonNullValues) { double difference = distinctValuesCount - nonNullValues; distinctValuesCount -= difference / 2; nonNullValues += difference / 2; nullsFraction = 1 - nonNullValues / outputRowCount; } } if (distinctValuesCount == 0.0) { nullsFraction = 1.0; averageRowSize = 0.0; lowValue = NaN; highValue = NaN; } <START> return SymbolStatsEstimate.builder() <END> .setDistinctValuesCount(distinctValuesCount) .setNullsFraction(nullsFraction) .setAverageRowSize(averageRowSize) .setLowValue(lowValue) .setHighValue(highValue) .build(); }</code><technical_language>this buildFrom. intent is improve existing stats, retaining new fields OK. If, however, insist setting fields explicitly, ctor cleaner</technical_language>

Target:
private SymbolStatsEstimate normalizeSymbolStats(Symbol symbol, SymbolStatsEstimate symbolStats, PlanNodeStatsEstimate stats, TypeProvider types) { if (symbolStats.isUnknown()) { return SymbolStatsEstimate.unknown(); } double outputRowCount = stats.getOutputRowCount(); double distinctValuesCount = symbolStats.getDistinctValuesCount(); double nullsFraction = symbolStats.getNullsFraction(); if (!isNaN(distinctValuesCount)) { Type type = requireNonNull(types.get(symbol), () -> "No stats for symbol " + symbol); double maxDistinctValuesByLowHigh = maxDistinctValuesByLowHigh(symbolStats, type); if (distinctValuesCount > maxDistinctValuesByLowHigh) { distinctValuesCount = maxDistinctValuesByLowHigh; } if (distinctValuesCount > outputRowCount) { distinctValuesCount = outputRowCount; } double nonNullValues = outputRowCount * (1 - nullsFraction); if (distinctValuesCount > nonNullValues) { double difference = distinctValuesCount - nonNullValues; distinctValuesCount -= difference / 2; nonNullValues += difference / 2; nullsFraction = 1 - nonNullValues / outputRowCount; } } if (distinctValuesCount == 0.0) { return SymbolStatsEstimate.zero(); } return SymbolStatsEstimate.buildFrom(symbolStats) .setDistinctValuesCount(distinctValuesCount) .setNullsFraction(nullsFraction) .build(); }
Source:
<code>private void waitForOperation(BigtableClusterAdminClient client, String operationName, int maxSeconds) { GetOperationRequest request = GetOperationRequest.newBuilder().setName(operationName).build(); for (int i = 0; i < maxSeconds; i++) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } Operation response = client.getOperation(request); System.out.println(response); if (response.getDone()) { <START> if (response.hasField(ERROR_DESCRIPTOR)) { <END> throw new RuntimeException("Operation not complete: " + response.getError()); } return; } } throw new IllegalStateException(String.format( "Waited %d seconds and operation was not complete", maxSeconds)); }</code><technical_language>Shoudlnt a hasError() method</technical_language>

Target:
private void waitForOperation(BigtableClusterAdminClient client, String operationName, int maxSeconds) throws InterruptedException { GetOperationRequest request = GetOperationRequest.newBuilder().setName(operationName).build(); for (int i = 0; i < maxSeconds; i++) { Thread.sleep(1000); Operation response = client.getOperation(request); if (response.getDone()) { switch (response.getResultCase()) { case ERROR: throw new RuntimeException("Cluster could not be created: " + response.getError()); case RESPONSE: return; case RESULT_NOT_SET: throw new IllegalStateException( "System returned invalid response for Operation check: " + response); } } } throw new IllegalStateException(String.format( "Waited %d seconds and operation was not complete", maxSeconds)); }
Source:
<code>public static boolean remove(String prfx, String prvdr) { <START> if(prvdr == null || prvdr.isEmpty()) { <END> prvdr = UNKNOWN_PROVIDER; } return remove(new IsolationMethod(prfx, prvdr)); }</code><technical_language>logic line 81: StringUtils.isNotBlank(prvdr)? prvdr : UNKNOWN_PROVIDER;</technical_language>

Target:
public static boolean remove(String prfx, String prvdr) { prvdr = StringUtils.isNotBlank(prvdr)? prvdr : UNKNOWN_PROVIDER; try { return remove(getIsolationMethod(prfx, prvdr)); } catch (IsolationMethodNotRegistered isolationMethodNotRegistered) { return false; } }
Source:
<code>private void doGcEntryLogs() throws EntryLogMetadataMapException { AtomicLong totalEntryLogSizeAcc = new AtomicLong(0L); entryLogMetaMap.forEach((entryLogId, meta) -> { try { <START> removeIfLedgerNotExists(entryLogId, meta, true); <END> } catch (EntryLogMetadataMapException e) { LOG.warn("Failed to remove ledger from entry-log metadata {}", entryLogId, e); } if (meta.isEmpty()) { LOG.info("Deleting entryLogId " + entryLogId + " as it has no active ledgers!"); removeEntryLog(entryLogId); gcStats.getReclaimedSpaceViaDeletes().add(meta.getTotalSize()); } totalEntryLogSizeAcc.getAndAdd(meta.getRemainingSize()); }); this.totalEntryLogSize = totalEntryLogSizeAcc.get(); this.numActiveEntryLogs = entryLogMetaMap.size(); }</code><technical_language>i guess with, this call 'removeIfLedgerNotExists' is redundant here. 'removeIfLedgerNotExists' care "entryLogMetaMap = extractMetaFromEntryLogs(entryLogMetaMap);" in 'runWithFlags' method. 'removeIfLedgerNotExists' call removed here</technical_language>

Target:
private void doGcEntryLogs() throws EntryLogMetadataMapException { AtomicLong totalEntryLogSizeAcc = new AtomicLong(0L); entryLogMetaMap.forEach((entryLogId, meta) -> { try { removeIfLedgerNotExists(meta); entryLogMetaMap.put(meta.getEntryLogId(), meta); if (meta.isEmpty()) { LOG.info("Deleting entryLogId as it has no active ledgers!", entryLogId); removeEntryLog(entryLogId); gcStats.getReclaimedSpaceViaDeletes().add(meta.getTotalSize()); } } catch (EntryLogMetadataMapException e) { LOG.warn("Failed to remove ledger from entry-log metadata {}", entryLogId, e); } totalEntryLogSizeAcc.getAndAdd(meta.getRemainingSize()); }); this.totalEntryLogSize = totalEntryLogSizeAcc.get(); this.numActiveEntryLogs = entryLogMetaMap.size(); }
Source:
<code>public static FileSnapshot save(File path) { <START> final long read = System.currentTimeMillis(); <END> final long modified = path.lastModified(); return new FileSnapshot(read, modified); }</code><technical_language>SystemReader</technical_language>

Target:
public static FileSnapshot save(File path) { final long read = SystemReader.getInstance().getCurrentTime(); final long modified = path.lastModified(); return new FileSnapshot(read, modified); }
Source:
<code>private void generateStructReaderSource(StructType type) { JavaClassName readerName = javaTypes.getXmlReaderName(type); javaBuffer.addLine("public class %1$s {", readerName.getSimpleName()); javaBuffer.addLine(); generateStructReadOne(type); generateStructReadMany(type); <START> generateParseLink(type); <END> javaBuffer.addLine("}"); javaBuffer.addLine(); }</code><technical_language>"generateReadLink", name generated method "readLink", consistent "readOne" "readMany" methods</technical_language>

Target:
private void generateStructReaderSource(StructType type) { JavaClassName readerName = javaTypes.getXmlReaderName(type); javaBuffer.addLine("public class %1$s {", readerName.getSimpleName()); javaBuffer.addLine(); generateStructReadOne(type); generateStructReadMany(type); generateReadLink(type); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
<code><START> public BindingDetails(Set<String> freeVariables, Set<String> scalarVariables, Set<String> arrayVariables) <END> { this.freeVariables = freeVariables; this.scalarVariables = scalarVariables; this.arrayVariables = arrayVariables; }</code><technical_language>is Set.union(scalarVariables, arrayVariables) = freeVariables ? If is expected I add a check for true catch potential bugs</technical_language>

Target:
public BindingDetails(Set<String> freeVariables, Set<String> scalarVariables, Set<String> arrayVariables) { this.freeVariables = ImmutableSet.copyOf(freeVariables); this.scalarVariables = ImmutableSet.copyOf(scalarVariables); this.arrayVariables = ImmutableSet.copyOf(arrayVariables); }
Source:
<code>public RepositoryFile internalGetFile( File f ) { RepositoryFile file = null; if ( f.exists() ) { String jcrPath = f.getAbsolutePath().substring( rootDir.getAbsolutePath().length() ); if ( jcrPath.length() == 0 ) { jcrPath = "/"; } else if ( IS_WINDOWS ) { jcrPath = jcrPath.replaceAll( "\\\\", "/" ); <START> } <END> file = new RepositoryFile.Builder( f.getAbsolutePath(), f.getName() ).createdDate( new Date( f.lastModified() ) ) .lastModificationDate( new Date( f.lastModified() ) ).folder( f.isDirectory() ).versioned( false ).path( jcrPath ).versionId( f.getName() ).locked( false ).lockDate( null ).lockMessage( null ).lockOwner( null ).title( f.getName() ).description( f.getName() ).locale( null ).fileSize( f.length() ).build(); } return file; }</code><technical_language>want consider <LINK_0> instead of string "/"</technical_language>

Target:
public RepositoryFile internalGetFile( File f ) { RepositoryFile file = null; if ( f.exists() ) { String jcrPath = f.getAbsolutePath().substring( rootDir.getAbsolutePath().length() ); if ( jcrPath.length() == 0 ) { jcrPath = "/"; } else if ( IS_WINDOWS ) { jcrPath = FilenameUtils.separatorsToUnix( jcrPath ); } file = new RepositoryFile.Builder( f.getAbsolutePath(), f.getName() ).createdDate( new Date( f.lastModified() ) ) .lastModificationDate( new Date( f.lastModified() ) ).folder( f.isDirectory() ).versioned( false ).path( jcrPath ).versionId( f.getName() ).locked( false ).lockDate( null ).lockMessage( null ).lockOwner( null ).title( f.getName() ).description( f.getName() ).locale( null ).fileSize( f.length() ).build(); } return file; }
Source:
<code>public void testCFData() { String deadBug = "The only good bug is a dead bug."; Memory bugBytes = new Memory(deadBug.length() + 1); bugBytes.clear(); <START> bugBytes.setString(0, deadBug); <END> CFDataRef cfBug = CF.CFDataCreate(null, bugBytes, bugBytes.size()); assertEquals(bugBytes.size(), CF.CFDataGetLength(cfBug)); Pointer bytes = CF.CFDataGetBytePtr(cfBug); assertEquals(deadBug, bytes.getString(0)); cfBug.release(); }</code><technical_language>Beware - if String contains multibyte characters, this blow (a german umlaut encoded 2 bytes if native encoding is UTF-8). I create a byte array java side</technical_language>

Target:
public void testCFData() { int size = 128; byte[] randomBytes = new byte[size]; new Random().nextBytes(randomBytes); Memory nativeBytes = new Memory(size); nativeBytes.write(0, randomBytes, 0, randomBytes.length); CFDataRef cfData = CF.CFDataCreate(null, nativeBytes, new CFIndex(size)); assertEquals(CoreFoundation.DATA_TYPE_ID, cfData.getTypeID()); int dataSize = cfData.getLength(); assertEquals(size, dataSize); Pointer bytes = cfData.getBytePtr(); byte[] dataBytes = bytes.getByteArray(0, dataSize); assertArrayEquals(randomBytes, dataBytes); cfData.release(); }
Source:
<code>protected void provideNewSessionAttributes( AttributeSharingSessionDataStore callingDataStore, String id, Map<String, Object> sessionAttributes) { if (!sessionAttributes.equals(getLatestSessionAttributes(id))) { LOGGER.debug("Pushing new session attributes to all web contexts for session {}", id); latestSessionAttributes.put(id, sessionAttributes); <START> dataStores.forEach( <END> ds -> { if (ds != callingDataStore) { ds.updateSessionAttributes(id, sessionAttributes); } }); } }</code><technical_language>Cleaner if do dataStores.stream().filter(ds -> ds != callingDataStore).forEach(ds -> ds.updateSessionAttributes(id, sessionAttribute)</technical_language>

Target:
protected void provideNewSessionAttributes( AttributeSharingSessionDataStore callingDataStore, String id, Map<String, Object> sessionAttributes) { if (sessionAttributes != null && !sessionAttributes.equals(getLatestSessionAttributes(id))) { LOGGER.trace("Pushing new session attributes to all web contexts for session {}", id); latestSessionAttributes.put(id, sessionAttributes); dataStores .stream() .filter(ds -> ds != callingDataStore) .forEach(ds -> ds.updateSessionAttributes(id, sessionAttributes)); } }