auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public byte[] download(URI uri) throws Exception { byte[] data; try { HttpClient client = Central.getWorkspace() .getPlugin(HttpClient.class); if (client == null) <START> client = new HttpClient(); <END> Pair<String, byte[]> cachedTag = cache.get(uri); if (cachedTag == null) { TaggedData td = client.connectTagged(uri.toURL()); if (td == null || td.isNotFound()) throw new FileNotFoundException("Not found"); data = IO.read(td.getInputStream()); if (td.getTag() != null) cache.put(uri, new Pair<String, byte[]>(td.getTag(), data)); } else { TaggedData td = client.connectTagged(uri.toURL(), cachedTag.getFirst()); if (td == null || td.isNotFound()) throw new FileNotFoundException("Not found"); if (td.getResponseCode() == 304) { data = cachedTag.getSecond(); } else { data = IO.read(td.getInputStream()); if (td.getTag() == null) { cache.remove(uri); } else { cache.put(uri, new Pair<String, byte[]>(td.getTag(), data)); } } } return data; } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException(e); } }</code><technical_language>close this HttpClient. code this</technical_language>

Target:
public byte[] download(URI uri) throws Exception { byte[] data; try { HttpClient client = Central.getWorkspace() .getPlugin(HttpClient.class); Pair<String, byte[]> cachedTag = cache.get(uri); if (cachedTag == null) { TaggedData td = client.connectTagged(uri.toURL()); if (td == null || td.isNotFound()) throw new FileNotFoundException("Not found"); data = IO.read(td.getInputStream()); if (td.getTag() != null) cache.put(uri, new Pair<String, byte[]>(td.getTag(), data)); } else { TaggedData td = client.connectTagged(uri.toURL(), cachedTag.getFirst()); if (td == null || td.isNotFound()) throw new FileNotFoundException("Not found"); if (td.getResponseCode() == 304) { data = cachedTag.getSecond(); } else { data = IO.read(td.getInputStream()); if (td.getTag() == null) { cache.remove(uri); } else { cache.put(uri, new Pair<String, byte[]>(td.getTag(), data)); } } } return data; } catch (IOException e) { throw e; } catch (Exception e) { throw new IOException(e); } }
Source:
<code>public Long create(Sample sample) throws IOException { loadChildEntities(sample); authorizationManager.throwIfNotWritable(sample); setChangeDetails(sample); if (isDetailedSample(sample)) { if (!isIdentitySample(sample)) { DetailedSample detailed = (DetailedSample) sample; try { detailed.setParent(findOrCreateParent(detailed)); detailed.inheritPermissions(detailed.getParent()); if (detailed.getParent().hasNonStandardAlias()) { detailed.setNonStandardAlias(true); } } catch (MisoNamingException e) { throw new IOException(e.getMessage(), e); } validateHierarchy(detailed); <START> if (detailed.getDetailedQcStatus() != null) { <END> detailed.setQcPassed(detailed.getDetailedQcStatus().getStatus()); } } } sample.setName(generateTemporaryName()); if (isDetailedSample(sample) && ((DetailedSample) sample).hasNonStandardAlias()) { } else if (isStringEmptyOrNull(sample.getAlias()) && sampleNamingScheme.hasGeneratorFor("alias")) { sample.setAlias(generateTemporaryName()); } else { validateAliasUniqueness(sample.getAlias()); } if (isStockSample(sample) || isAliquotSample(sample) || isTissueProcessingSample(sample)) { DetailedSample detailed = (DetailedSample) sample; if (detailed.getParent() != null && detailed.getSiblingNumber() == null) { int siblingNumber = sampleDao.getNextSiblingNumber(detailed.getParent(), detailed.getSampleClass()); detailed.setSiblingNumber(siblingNumber); } } return save(sample).getId(); }</code><technical_language>This field is present Identities too, treated (outside of if (!isIdentitySample... block). Alternately, done in loadChildEntities instead, is called create update</technical_language>

Target:
public Long create(Sample sample) throws IOException { loadChildEntities(sample); authorizationManager.throwIfNotWritable(sample); setChangeDetails(sample); if (isDetailedSample(sample)) { if (!isIdentitySample(sample)) { DetailedSample detailed = (DetailedSample) sample; try { detailed.setParent(findOrCreateParent(detailed)); detailed.inheritPermissions(detailed.getParent()); if (detailed.getParent().hasNonStandardAlias()) { detailed.setNonStandardAlias(true); } } catch (MisoNamingException e) { throw new IOException(e.getMessage(), e); } validateHierarchy(detailed); } } sample.setName(generateTemporaryName()); if (isDetailedSample(sample) && ((DetailedSample) sample).hasNonStandardAlias()) { } else if (isStringEmptyOrNull(sample.getAlias()) && sampleNamingScheme.hasGeneratorFor("alias")) { sample.setAlias(generateTemporaryName()); } else { validateAliasUniqueness(sample.getAlias()); } if (isStockSample(sample) || isAliquotSample(sample) || isTissueProcessingSample(sample)) { DetailedSample detailed = (DetailedSample) sample; if (detailed.getParent() != null && detailed.getSiblingNumber() == null) { int siblingNumber = sampleDao.getNextSiblingNumber(detailed.getParent(), detailed.getSampleClass()); detailed.setSiblingNumber(siblingNumber); } } return save(sample).getId(); }
Source:
<code>public boolean hasNext() { if (maxPayloads > 0 && count >= maxPayloads) { return false; } <START> return randomOrder ? true : iterator.hasNext(); <END> }</code><technical_language>reason rely Iterator? require adding ifs in next, called more reset</technical_language>

Target:
public boolean hasNext() { if(randomOrder){ return count < maxPayloads; } if (maxPayloads > 0 && count >= maxPayloads) { return false; } return iterator.hasNext(); }
Source:
<code>public void deleteColumn(EntityId entityId, String family, String qualifier, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete column while KijiTableWriter %s is in state %s.", this, state); final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator() .toHBaseColumnName(new KijiColumnName(family, qualifier)); final DeleteRequest delete = new DeleteRequest( <START> Bytes.toBytes(mTable.getName()), entityId.getHBaseRowKey(), <END> hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), upToTimestamp); delete.setDeleteAtTimestampOnly(false); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }</code><technical_language>table name issue</technical_language>

Target:
public void deleteColumn(EntityId entityId, String family, String qualifier, long upToTimestamp) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot delete column while KijiTableWriter %s is in state %s.", this, state); final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator() .toHBaseColumnName(new KijiColumnName(family, qualifier)); final DeleteRequest delete = new DeleteRequest( mTableName, entityId.getHBaseRowKey(), hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), upToTimestamp); delete.setDeleteAtTimestampOnly(false); try { mHBClient.delete(delete).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }
Source:
<code>public PypiArtifactCoordinates() { this(DISTRIBUTION, VERSION, <START> "", <END> LANGUAGE_IMPLEMENTATION_VERSION, ABI, PLATFORM, WHEEL_EXTENSION); }</code><technical_language>Also, I wanted ask, is parameter a blank string? this: public PypiArtifactCoordinates() { this(DISTRIBUTION, VERSION, BUILD, LANGUAGE_IMPLEMENTATION_VERSION, ABI, PLATFORM, PACKAGING); } another cosmetic change, if mind, please move empty constructor other one? sort of a convention have. Thanks! :)</technical_language>

Target:
public PypiArtifactCoordinates() { resetCoordinates(DISTRIBUTION, VERSION, BUILD, LANGUAGE_IMPLEMENTATION_VERSION, ABI, PLATFORM, PACKAGING); }
Source:
<code>private void setDefaults() { IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore(); setInvertedColors(store.getBoolean(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS)); <START> int bufferSize = store.getInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES); <END> fTerminalControl.setBufferLineLimit(bufferSize); }</code><technical_language>Done in patchset 11</technical_language>

Target:
private void setDefaults() { IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore(); setInvertedColors(store.getBoolean(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS)); setBufferLineLimit(store.getInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES)); }
Source:
<code>private SynchronizationModel resolveModelsWithLocal(IStorageProviderAccessor storageAccessor, IFile left, IStorage right, IStorage origin, ThreadSafeProgressMonitor monitor) throws InterruptedException { if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet( new MonitoredProxyCreationListener(monitor, false)); updateDependencies(resourceSet, left, monitor); updateChangedResources(resourceSet, monitor); } while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } if (monitor.isCanceled()) { throw new OperationCanceledException(); } <START> addModelDependenciesFromCustomProviders(left); <END> final Set<IStorage> leftTraversal = resolveTraversal(left, Collections.<URI> emptySet()); return resolveRemoteTraversals(storageAccessor, leftTraversal, right, origin, monitor); }</code><technical_language>a lock that</technical_language>

Target:
private SynchronizationModel resolveModelsWithLocal(IStorageProviderAccessor storageAccessor, IFile left, IStorage right, IStorage origin, ThreadSafeProgressMonitor monitor) throws InterruptedException { if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet( new MonitoredProxyCreationListener(monitor, false)); updateDependencies(resourceSet, left, monitor); updateChangedResources(resourceSet, monitor); } while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } if (monitor.isCanceled()) { throw new OperationCanceledException(); } lock.lock(); try { addModelDependenciesFromCustomProviders(left); } finally { lock.unlock(); } final Set<IStorage> leftTraversal = resolveTraversal(left, Collections.<URI> emptySet()); return resolveRemoteTraversals(storageAccessor, leftTraversal, right, origin, monitor); }
Source:
<code>public void bootstrap(List<Task> tasks) { try { Map<String, ZkWorker> existingTasks = Maps.newHashMap(); <START> Set<String> existingWorkers = Sets.newHashSet(cf.getChildren().forPath(config.getIndexerAnnouncementPath())); <END> for (String existingWorker : existingWorkers) { Worker worker = jsonMapper.readValue( cf.getData() .forPath( JOINER.join( config.getIndexerAnnouncementPath(), existingWorker ) ), Worker.class ); ZkWorker zkWorker = addWorker(worker); List<String> runningTasks = cf.getChildren() .forPath(JOINER.join(config.getIndexerStatusPath(), existingWorker)); for (String runningTask : runningTasks) { existingTasks.put(runningTask, zkWorker); } } for (Task task : tasks) { TaskRunnerWorkItem taskRunnerWorkItem = new TaskRunnerWorkItem( task, SettableFuture.<TaskStatus>create(), new DateTime() ); ZkWorker zkWorker = existingTasks.remove(task.getId()); if (zkWorker != null) { runningTasks.put(task.getId(), taskRunnerWorkItem); zkWorker.addRunningTask(task); } else { addPendingTask(taskRunnerWorkItem); } } for (String existingTask : existingTasks.keySet()) { shutdown(existingTask); } } catch (Exception e) { throw Throwables.propagate(e); } init(); }</code><technical_language>I race conditions in this code. I in init(), I if worker nodes coming (due a temporary network partition work), this possibly a subset of actual nodes up. setting completely reactive existence of ZK error-prone, is a reason do (or is a reason thinking of means care this case?)</technical_language>

Target:
public void bootstrap(List<Task> tasks) { try { if (!started) { throw new ISE("Must start RTR first before calling bootstrap!"); } Set<String> existingTasks = Sets.newHashSet(); for (ZkWorker zkWorker : zkWorkers.values()) { existingTasks.addAll(zkWorker.getRunningTasks().keySet()); } for (Task task : tasks) { if (existingTasks.contains(task.getId())) { log.info("Bootstrap found %s running.", task.getId()); runningTasks.put( task.getId(), new RemoteTaskRunnerWorkItem(task, SettableFuture.<TaskStatus>create()) ); } else { log.info("Bootstrap didn't find %s running. Running it again", task.getId()); run(task); } } } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public TopologyDescriptor(long topologyConfigId, @NonNull List<ClusterDescriptor> activeClusters, @NonNull List<ClusterDescriptor> standbyClusters) { this.topologyConfigId = topologyConfigId; this.activeClusters = new HashMap<>(); this.standbyClusters = new HashMap<>(); if(activeClusters != null) { activeClusters.forEach(activeCluster -> this.activeClusters.put(activeCluster.getClusterId(), activeCluster)); } if(standbyClusters != null) { <START> standbyClusters.forEach(activeCluster -> this.standbyClusters.put(activeCluster.getClusterId(), activeCluster)); <END> } }</code><technical_language>I is 'standbyCluster' lambda parameter</technical_language>

Target:
public TopologyDescriptor(long topologyConfigId, @NonNull List<ClusterDescriptor> activeClusters, @NonNull List<ClusterDescriptor> standbyClusters) { this.topologyConfigId = topologyConfigId; this.activeClusters = new HashMap<>(); this.standbyClusters = new HashMap<>(); this.invalidClusters = new HashMap<>(); if(activeClusters != null) { activeClusters.forEach(activeCluster -> this.activeClusters.put(activeCluster.getClusterId(), activeCluster)); } if(standbyClusters != null) { standbyClusters.forEach(standbyCluster -> this.standbyClusters.put(standbyCluster.getClusterId(), standbyCluster)); } }
Source:
<code>RsWithBody(final Response res, final Body body) { super( new RsOf( <START> () -> RsWithBody.append(res, body.length()), <END> body::stream ) ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
RsWithBody(final Response res, final Body body) { super( new ResponseOf( () -> { final String header = "Content-Length"; return new RsWithHeader( new RsWithoutHeader(res, header), header, Integer.toString(body.length()) ).head(); }, body::stream ) ); }
Source:
<code>public void put(ThreadState state) { <START> cluster.add(state.randomKey(), Integer.MAX_VALUE, state.randomValue()); <END> }</code><technical_language>cluster.add return value, void? If returns value, return in method</technical_language>

Target:
public OperationFuture<Boolean> put(ThreadState state) { return client.add(state.randomKey(), ttl, state.randomValue(), state.transcoder()); }
Source:
<code>public GitInfo() { Resource resource = new ClassPathResource("/git.properties"); Properties props = new Properties(); try { props = PropertiesLoaderUtils.loadProperties(resource); } catch (Exception e) { <START> log.error("Could not get the git commit info", e); <END> } this.branch = getPropertyValue(props, "git.branch"); this.describe = getPropertyValue(props, "git.commit.id.describe"); this.commitId = getPropertyValue(props, "git.commit.id"); this.commitIdAbbrev = getPropertyValue(props, "git.commit.id.abbrev"); this.commitUserName = getPropertyValue(props, "git.commit.user.name"); this.commitUserEmail = getPropertyValue(props, "git.commit.user.email"); this.commitMessageFull = getPropertyValue(props, "git.commit.message.full"); this.commitMessageShort = getPropertyValue(props, "git.commit.message.short"); this.commitTime = getPropertyValue(props, "git.commit.time"); this.buildUserName = getPropertyValue(props, "git.build.user.name"); this.buildUserEmail = getPropertyValue(props, "git.build.user.email"); this.buildTime = getPropertyValue(props, "git.build.time"); }</code><technical_language>Please swallow exceptions! remove catch clause, wrap a RuntimeException</technical_language>

Target:
public GitInfo() { Resource resource = new ClassPathResource("/git.properties"); Properties props = new Properties(); try { props = PropertiesLoaderUtils.loadProperties(resource); } catch (Exception e) { log.warn("Could not get the git commit info", e); } this.branch = getPropertyValue(props, "git.branch"); this.describe = getPropertyValue(props, "git.commit.id.describe"); this.commitId = getPropertyValue(props, "git.commit.id"); this.commitIdAbbrev = getPropertyValue(props, "git.commit.id.abbrev"); this.commitUserName = getPropertyValue(props, "git.commit.user.name"); this.commitUserEmail = getPropertyValue(props, "git.commit.user.email"); this.commitMessageFull = getPropertyValue(props, "git.commit.message.full"); this.commitMessageShort = getPropertyValue(props, "git.commit.message.short"); this.commitTime = getPropertyValue(props, "git.commit.time"); this.buildUserName = getPropertyValue(props, "git.build.user.name"); this.buildUserEmail = getPropertyValue(props, "git.build.user.email"); this.buildTime = getPropertyValue(props, "git.build.time"); }
Source:
<code>public String[] getServiceCheckTags() { List<String> tags = new ArrayList<String>(); if (this.instanceMap.get("host") != null) { tags.add("jmx_server:" + this.instanceMap.get("host")); } if (this.tags != null) { for (Entry<String, String> e : this.tags.entrySet()) { if (e.getValue() != null) { tags.add(e.getKey() + ":" + e.getValue()); } else { tags.add(e.getKey()); } } } tags.add("instance:" + this.instanceName); <START> if (this.service != null && this.service != "") { <END> tags.add("service:" + this.service); } if (this.emptyDefaultHostname) { tags.add("host:"); } return tags.toArray(new String[tags.size()]); }</code><technical_language>this.service != null && !this.service.isEmpty()</technical_language>

Target:
public String[] getServiceCheckTags() { List<String> tags = new ArrayList<String>(); if (this.instanceMap.get("host") != null) { tags.add("jmx_server:" + this.instanceMap.get("host")); } if (this.tags != null) { for (Entry<String, String> e : this.tags.entrySet()) { if (e.getValue() != null) { tags.add(e.getKey() + ":" + e.getValue()); } else { tags.add(e.getKey()); } } } tags.add("instance:" + this.instanceName); if (this.service != null && !this.service.isEmpty()) { tags.add("service:" + this.service); } if (this.emptyDefaultHostname) { tags.add("host:"); } return tags.toArray(new String[tags.size()]); }
Source:
<code>public void validate() { super.validate(); if (Strings.isNullOrEmpty(username) ^ Strings.isNullOrEmpty(password)) { throw new IllegalArgumentException("You must either set both username and password or " + "neither username nor password."); } try { InternetAddress[] addresses = InternetAddress.parse(sender); if (addresses.length == 0) { throw new IllegalArgumentException("Must specify a sender email address."); } if (addresses.length > 1) { throw new IllegalArgumentException(String.format( "%s is an invalid sender email address. Only one sender is supported.", sender)); } } catch (AddressException e) { throw new IllegalArgumentException( String.format("%s is an invalid sender email address. Reason: %s", sender, e.getMessage())); } try { <START> InternetAddress.parse(sender); <END> } catch (AddressException e) { throw new IllegalArgumentException( String.format("%s is an invalid list of recipient email addresses. Reason: %s", recipients, e.getMessage())); } }</code><technical_language>this InternetAddress.parse(recipients)</technical_language>

Target:
public void validate() { super.validate(); if (Strings.isNullOrEmpty(username) ^ Strings.isNullOrEmpty(password)) { throw new IllegalArgumentException("You must either set both username and password or " + "neither username nor password."); } try { InternetAddress[] addresses = InternetAddress.parse(sender); if (addresses.length == 0) { throw new IllegalArgumentException("Must specify a sender email address."); } if (addresses.length > 1) { throw new IllegalArgumentException(String.format( "%s is an invalid sender email address. Only one sender is supported.", sender)); } } catch (AddressException e) { throw new IllegalArgumentException( String.format("%s is an invalid sender email address. Reason: %s", sender, e.getMessage())); } try { InternetAddress.parse(recipients); } catch (AddressException e) { throw new IllegalArgumentException( String.format("%s is an invalid list of recipient email addresses. Reason: %s", recipients, e.getMessage())); } }
Source:
<code>protected void readNativeField(JsonParser par, Native.Builder nativ, String fieldName) throws IOException { switch (fieldName) { case "request": <START> nativ.setRequest(par.getText()); <END> break; case "request_native": readNativeAsObject(nativ, par); break; case "ver": nativ.setVer(par.getText()); break; case "api": for (startArray(par); endArray(par); par.nextToken()) { APIFramework value = APIFramework.valueOf(par.getIntValue()); if (checkEnum(value)) { nativ.addApi(value); } } break; case "battr": for (startArray(par); endArray(par); par.nextToken()) { CreativeAttribute value = CreativeAttribute.valueOf(par.getIntValue()); if (checkEnum(value)) { nativ.addBattr(value); } } break; default: readOther(nativ, par, fieldName); } }</code><technical_language>I want parse Native.requestNative, matter if input is object a string, want resulting proto native request a JSON string needs parsing. string field is treated "write-only", useful in writer user set JSON text, reader is biased for object representation. acceptable parse Native.request, if input is a string, a non-default option set in factory, e.g. setForceReadNativeAsObject(false)</technical_language>

Target:
protected void readNativeField(JsonParser par, Native.Builder nativ, String fieldName) throws IOException { switch (fieldName) { case "request": { OpenRtbNativeJsonReader nativeReader = factory().newNativeReader(); if(par.getCurrentToken() == JsonToken.VALUE_STRING) { nativ.setRequestNative(nativeReader.readNativeRequest(new CharArrayReader( par.getTextCharacters(), par.getTextOffset(), par.getTextLength()))); } else { nativ.setRequestNative(nativeReader.readNativeRequest(par)); } } break; case "ver": nativ.setVer(par.getText()); break; case "api": for (startArray(par); endArray(par); par.nextToken()) { APIFramework value = APIFramework.valueOf(par.getIntValue()); if (checkEnum(value)) { nativ.addApi(value); } } break; case "battr": for (startArray(par); endArray(par); par.nextToken()) { CreativeAttribute value = CreativeAttribute.valueOf(par.getIntValue()); if (checkEnum(value)) { nativ.addBattr(value); } } break; default: readOther(nativ, par, fieldName); } }
Source:
<code>public void onPartitionsRevoked(Collection<TopicPartition> partitions) { LOG.debug("onPartitionsRevoked: from topic {}", threadId, topicName); StateRepository<String, String> offsetRepository = endpoint.getConfiguration().getOffsetRepository(); for (TopicPartition partition : partitions) { String offsetKey = serializeOffsetKey(partition); Long offset = lastProcessedOffset.get(offsetKey); if (offset == null) { offset = -1L; } LOG.debug("Saving offset repository state from offsetKey with offset: {}", threadId, offsetKey, offset); try { commitOffset(offsetRepository, partition, offset, true); } catch (java.lang.Exception e) { LOG.error("Error saving offset repository state from offsetKey with offset: {}", threadId, offsetKey, offset); throw e; } finally { <START> lastProcessedOffset.clear(); <END> } lastProcessedOffset.remove(offsetKey); } }</code><technical_language>This finally block code is exectued for success. Is this intended</technical_language>

Target:
public void onPartitionsRevoked(Collection<TopicPartition> partitions) { LOG.debug("onPartitionsRevoked: from topic {}", threadId, topicName); StateRepository<String, String> offsetRepository = endpoint.getConfiguration().getOffsetRepository(); for (TopicPartition partition : partitions) { String offsetKey = serializeOffsetKey(partition); Long offset = lastProcessedOffset.get(offsetKey); if (offset == null) { offset = -1L; } LOG.debug("Saving offset repository state from offsetKey with offset: {}", threadId, offsetKey, offset); try { commitOffset(offsetRepository, partition, offset, true); } catch (java.lang.Exception e) { LOG.error("Error saving offset repository state from offsetKey with offset: {}", threadId, offsetKey, offset); throw e; } finally { lastProcessedOffset.remove(offsetKey); } } }
Source:
<code>public AbstractGenericScanFilter() { this( <START> (filterData, value) -> { <END> return filterData.contains((Object) value); }); }</code><technical_language>braces return removed lambda in line</technical_language>

Target:
public AbstractGenericScanFilter() { this((filterData, value) -> filterData.contains((Object) value)); }
Source:
<code>public Builder<EvictionConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException { EvictionStrategy strategy = ModelNodes.asEnum(STRATEGY.getDefinition().resolveModelAttribute(context, model), EvictionStrategy.class); if (strategy.isEnabled()) { this.builder.type(EvictionType.COUNT).size(MAX_ENTRIES.getDefinition().resolveModelAttribute(context, model).asLong()); <START> } <END> return this; }</code><technical_language>This right, call org.infinispan.configuration.cache.EvictionConfigurationBuilder#strategy(org.infinispan.eviction.EvictionStrategy) is missing completely, default strategy NONE</technical_language>

Target:
public Builder<EvictionConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException { EvictionStrategy strategy = ModelNodes.asEnum(STRATEGY.getDefinition().resolveModelAttribute(context, model), EvictionStrategy.class); this.builder.strategy(strategy); if (strategy.isEnabled()) { this.builder.type(EvictionType.COUNT).size(MAX_ENTRIES.getDefinition().resolveModelAttribute(context, model).asLong()); } return this; }
Source:
<code>private void startHostsWithPMInReboot(List<VDS> hosts) { final List<VDS> hostsWithPMInReboot = hosts.stream() .filter(host -> host.isPmEnabled() && host.getStatus() == VDSStatus.Reboot).collect(Collectors.toList()); if (hostsWithPMInReboot.size() > 0) { Runnable task = () -> { waitUntilFencingAllowed(); startHosts(hostsWithPMInReboot); }; <START> ThreadPoolUtil.execute(task); <END> } }</code><technical_language>do need temp variable? ThreadPoolUtil.execute(() -> { waitUntilFencingAllowed(); startHosts(hostsWithPMInReboot); });</technical_language>

Target:
private void startHostsWithPMInReboot(List<VDS> hosts) { final List<VDS> hostsWithPMInReboot = hosts.stream() .filter(host -> host.isPmEnabled()) .filter(host -> host.getStatus() == VDSStatus.Reboot) .collect(Collectors.toList()); if (hostsWithPMInReboot.size() > 0) { ThreadPoolUtil.execute(() -> { waitUntilFencingAllowed(); startHosts(hostsWithPMInReboot); }); } }
Source:
<code>private ICPPASTCapture capture() throws EndOfFileException, BacktrackException { final int offset= LA().getOffset(); final ICPPASTCapture result = getNodeFactory().newCapture(); switch (LT(1)) { case IToken.t_this: return setRange(result, offset, consume().getEndOffset()); case IToken.tAMPER: consume(); result.setIsByReference(true); break; } final IASTName identifier= identifier(); result.setIdentifier(identifier); switch(LT(1)) { case IToken.tELLIPSIS: result.setIsPackExpansion(true); return setRange(result, offset, consume().getEndOffset()); case IToken.tASSIGN: { consume(); IASTDeclarator declarator = getNodeFactory().newDeclarator(identifier); IASTInitializerClause initClause = initClause(false); declarator.setInitializer(getNodeFactory().newEqualsInitializer(initClause)); ICPPASTInitCapture initResult = getNodeFactory().newInitCapture(declarator); <START> return setRange(initResult, offset, calculateEndOffset(initClause)); <END> } case IToken.tLBRACE: case IToken.tLPAREN: { IASTDeclarator declarator = getNodeFactory().newDeclarator(identifier); IASTInitializer initializer = bracedOrCtorStyleInitializer(); declarator.setInitializer(initializer); ICPPASTInitCapture initResult = getNodeFactory().newInitCapture(declarator); return setRange(initResult, offset, calculateEndOffset(initializer)); } } return setRange(result, offset, calculateEndOffset(identifier)); }</code><technical_language>declarator equals-initializer need setRange() called too</technical_language>

Target:
private ICPPASTCapture capture() throws EndOfFileException, BacktrackException { final int offset = LA().getOffset(); ICPPASTCapture result = getNodeFactory().newCapture(); boolean referenceCapture = false; switch (LT(1)) { case IToken.t_this: return setRange(result, offset, consume().getEndOffset()); case IToken.tAMPER: consume(); referenceCapture = true; break; } final IASTName identifier = identifier(); result.setIdentifier(identifier); setRange(result, offset, calculateEndOffset(identifier)); switch(LT(1)) { case IToken.tASSIGN: result = createInitCapture(identifier, equalsInitalizerClause(false), offset); break; case IToken.tLBRACE: case IToken.tLPAREN: result = createInitCapture(identifier, bracedOrCtorStyleInitializer(), offset); break; } result.setIsByReference(referenceCapture); if (LT(1) == IToken.tELLIPSIS) { result.setIsPackExpansion(true); return setRange(result, offset, consume().getEndOffset()); } return result; }
Source:
<code>public void onRemoval(RemovalNotification<Path, Long> notification) { Path path = notification.getKey(); CacheRange cacheRange = persistedRanges.remove(path); cacheScopeFiles.get(notification.getValue()).remove(path); <START> if (cacheScopeFiles.get(notification.getValue()).size() == 0) { <END> cacheScopeFiles.remove(notification.getValue()); } if (cacheRange == null) { return; } cacheRemovalExecutor.submit(() -> { Collection<LocalCacheFile> files; cacheRange.lock.readLock().lock(); try { files = cacheRange.getRange().asMapOfRanges().values(); } finally { cacheRange.lock.readLock().unlock(); } for (LocalCacheFile file : files) { try { Files.delete(new File(file.getPath().toUri()).toPath()); } catch (IOException e) { } } }); }</code><technical_language>isEmpty()</technical_language>

Target:
public void onRemoval(RemovalNotification<Path, Long> notification) { Path path = notification.getKey(); CacheRange cacheRange = persistedRanges.remove(path); cacheScopeFiles.get(notification.getValue()).remove(path); if (cacheScopeFiles.get(notification.getValue()).isEmpty()) { cacheScopeFiles.remove(notification.getValue()); } if (cacheRange == null) { return; } cacheRemovalExecutor.submit(() -> { Collection<LocalCacheFile> files; cacheRange.lock.readLock().lock(); try { files = cacheRange.getRange().asMapOfRanges().values(); } finally { cacheRange.lock.readLock().unlock(); } for (LocalCacheFile file : files) { try { Files.delete(new File(file.getPath().toUri()).toPath()); } catch (IOException e) { } } }); }
Source:
<code>public List<String> getValues() { <START> return values; <END> }</code><technical_language>constructor this method follow pattern ensuring internal values list mutable. Right constructor clone list, effectively a deep clone based Strings work, ensuring is immutable if original list changes this return a reference internal list mutated</technical_language>

Target:
public List<String> getValues() { return new ArrayList<>(values); }
Source:
<code><START> public void setUp() { <END> Context context = InstrumentationRegistry.getTargetContext(); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.clear(); editor.putBoolean(SettingsActivity.SETTINGS_CRASH_REPORTS, true); editor.commit(); CrashReporter.setIsCrashReportEnabled(true); CrashReporter.initialize(context); }</code><technical_language>java @Override protected void setUp() throws Exception { super.setUp();</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); Context context = InstrumentationRegistry.getTargetContext(); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); editor = sharedPreferences.edit(); editor.clear(); editor.putBoolean(SettingsActivity.SETTINGS_CRASH_REPORTS, true); editor.commit(); CrashReporter.setIsCrashReportEnabled(true); CrashReporter.initialize(context); }
Source:
<code>protected void buildTagList(File directory, boolean interactive) { <START> this.tagList = new TreeSet<>(); <END> ArrayList<String> argv = new ArrayList<>(); LinkedList<String> tagsList = new LinkedList<>(); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); argv.add(RepoCommand); argv.add("tag"); Executor executor = new Executor(argv, directory, RuntimeEnvironment.getInstance().getInteractiveCommandTimeout()); int status = executor.exec(); try { try (BufferedReader in = new BufferedReader(new InputStreamReader( executor.getOutputStream()))) { String line; while ((line = in.readLine()) != null) { tagsList.add(line); } } } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to read tag list: {0}", e.getMessage()); this.tagList = null; } if (status != 0) { LOGGER.log(Level.WARNING, "Failed to get tags for: \"{0}\" Exit code: {1}", new Object[]{directory.getAbsolutePath(), String.valueOf(status)}); this.tagList = null; } try { for (String tags : tagsList) { TagEntry tagEntry = buildTagEntry(directory, tags); this.tagList.add(tagEntry); } } catch (HistoryException e) { LOGGER.log(Level.WARNING, "Failed to parse tag list: {0}", e.getMessage()); this.tagList = null; } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to read tag list: {0}", e.getMessage()); this.tagList = null; } }</code><technical_language>Wondering new interactive parameter possibly in this method</technical_language>

Target:
protected void buildTagList(File directory, boolean interactive) { this.tagList = new TreeSet<>(); ArrayList<String> argv = new ArrayList<>(); LinkedList<String> tagsList = new LinkedList<>(); ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK); argv.add(RepoCommand); argv.add("tag"); Executor executor = new Executor(argv, directory, interactive ? RuntimeEnvironment.getInstance().getInteractiveCommandTimeout() : RuntimeEnvironment.getInstance().getCommandTimeout()); int status = executor.exec(); try { try (BufferedReader in = new BufferedReader(new InputStreamReader( executor.getOutputStream()))) { String line; while ((line = in.readLine()) != null) { tagsList.add(line); } } } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to read tag list: {0}", e.getMessage()); this.tagList = null; } if (status != 0) { LOGGER.log(Level.WARNING, "Failed to get tags for: \"{0}\" Exit code: {1}", new Object[]{directory.getAbsolutePath(), String.valueOf(status)}); this.tagList = null; } try { for (String tags : tagsList) { TagEntry tagEntry = buildTagEntry(directory, tags, interactive); this.tagList.add(tagEntry); } } catch (HistoryException e) { LOGGER.log(Level.WARNING, "Failed to parse tag list: {0}", e.getMessage()); this.tagList = null; } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to read tag list: {0}", e.getMessage()); this.tagList = null; } }
Source:
<code>public void addVideoDevices(VmBase vmBase, int numberOfVideoDevices) { if (vmBase.getDefaultDisplayType() != DisplayType.none <START> && vmBase.getDefaultDisplayType().getDefaultVmDeviceType() != null) { <END> for (int i = 0; i < numberOfVideoDevices; i++) { addManagedDevice( new VmDeviceId(Guid.newGuid(), vmBase.getId()), VmDeviceGeneralType.VIDEO, vmBase.getDefaultDisplayType().getDefaultVmDeviceType(), getVideoDeviceSpecParams(vmBase), true, false); } } }</code><technical_language>do need this part</technical_language>

Target:
public void addVideoDevices(VmBase vmBase, int numberOfVideoDevices) { if (vmBase.getDefaultDisplayType() != DisplayType.none) { for (int i = 0; i < numberOfVideoDevices; i++) { addManagedDevice( new VmDeviceId(Guid.newGuid(), vmBase.getId()), VmDeviceGeneralType.VIDEO, vmBase.getDefaultDisplayType().getDefaultVmDeviceType(), getVideoDeviceSpecParams(vmBase), true, false); } } }
Source:
<code>public void testSetPath() { assertStatement("SET PATH iLikeToEat.apples, andBananas", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.of(new Identifier("iLikeToEat")), new Identifier("apples")), new PathElement(Optional.empty(), new Identifier("andBananas")))))); assertStatement("SET PATH \"schemas,with\".\"grammar.in\", \"their!names\"", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.of(new Identifier("schemas,with")), new Identifier("grammar.in")), new PathElement(Optional.empty(), new Identifier("their!names")))))); assertStatement("SET PATH \"\"", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.empty(), new Identifier("")))))); try { assertStatement("SET PATH one.too.many, qualifiers", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.empty(), new Identifier("dummyValue")))))); fail(); } catch (RuntimeException e) { } try { SQL_PARSER.createStatement("SET PATH ", new ParsingOptions()); } <START> catch (RuntimeException e) { <END> } }</code><technical_language>need a fail(); right createStatement</technical_language>

Target:
public void testSetPath() { assertStatement("SET PATH iLikeToEat.apples, andBananas", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.of(new Identifier("iLikeToEat")), new Identifier("apples")), new PathElement(Optional.empty(), new Identifier("andBananas")))))); assertStatement("SET PATH \"schemas,with\".\"grammar.in\", \"their!names\"", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.of(new Identifier("schemas,with")), new Identifier("grammar.in")), new PathElement(Optional.empty(), new Identifier("their!names")))))); assertStatement("SET PATH \"\"", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.empty(), new Identifier("")))))); try { assertStatement("SET PATH one.too.many, qualifiers", new SetPath(new PathSpecification(Optional.empty(), ImmutableList.of( new PathElement(Optional.empty(), new Identifier("dummyValue")))))); fail(); } catch (RuntimeException e) { } try { SQL_PARSER.createStatement("SET PATH ", new ParsingOptions()); fail(); } catch (RuntimeException e) { } }
Source:
<code>public BulkheadEventsEndpointResponse getAllBulkheadEvents() { List<BulkheadEventDTO> response = eventConsumerRegistry.getAllEventConsumer().stream() .flatMap(bulkheadEventCircularEventConsumer -> bulkheadEventCircularEventConsumer .getBufferedEvents() .stream()) .sorted(Comparator.comparing(BulkheadEvent::getCreationTime)) .map(BulkheadEventDTOFactory::createBulkheadEventDTO) <START> .collect(Collectors.toUnmodifiableList()); <END> return new BulkheadEventsEndpointResponse(response); }</code><technical_language>is toUnmodifiableList called</technical_language>

Target:
public BulkheadEventsEndpointResponse getAllBulkheadEvents() { List<BulkheadEventDTO> response = eventConsumerRegistry.getAllEventConsumer().stream() .flatMap(CircularEventConsumer::getBufferedEventsStream) .sorted(Comparator.comparing(BulkheadEvent::getCreationTime)) .map(BulkheadEventDTOFactory::createBulkheadEventDTO) .collect(Collectors.toList()); return new BulkheadEventsEndpointResponse(response); }
Source:
<code>static String generateBoundary(String userAgent) { return new StringBuilder().append("=--") .append(nomaliseUserAgent(userAgent)).append("_") .append(Thread.currentThread().hashCode()).append("_") .append(System.currentTimeMillis()).append("_") .append(count.getAndIncrement()) <START> .toString(); <END> }</code><technical_language>I StringBuilder toString() is needed creating a string in a single statement this is done internally in optimized way, please a normal string expression simple</technical_language>

Target:
static String generateBoundary(String userAgent) { return "=--" + nomaliseUserAgent(userAgent) + "_" + Thread.currentThread().hashCode() + "_" + System.currentTimeMillis() + "_" + count.getAndIncrement(); }
Source:
<code>public FulfillerDetails save(FulfillerDetails delegate) { Context.getOrderService().updateOrderFulfillerStatus(delegate.getOrder(), delegate.getFulfillerStatus(), delegate.getFulfillerComment()); <START> return delegate; <END> }</code><technical_language>thinking this return null, need send data client nature of resource, framework sends http OK status user in case of a success 500 in case of exception sufficient</technical_language>

Target:
public FulfillerDetails save(FulfillerDetails delegate) { Context.getOrderService().updateOrderFulfillerStatus(delegate.getOrder(), delegate.getFulfillerStatus(), delegate.getFulfillerComment()); return null; }
Source:
<code>public void translate(final TableScan tableScan, final TranslatorContext context) { StreamGraph streamGraph = context.getStreamGraph(); List<String> tableNameParts = tableScan.getTable().getQualifiedName(); Validate.isTrue(tableNameParts.size() == 2, String.format("table name %s is not of the format <SystemName>.<StreamName>", Joiner.on(".").join(tableNameParts))); <START> String streamName = tableNameParts.get(1); <END> String systemName = tableNameParts.get(0); Validate.isTrue(relMsgConverters.containsKey(systemName), String.format("Unknown system %s", systemName)); SamzaRelConverter converter = relMsgConverters.get(systemName); MessageStream<SamzaSqlRelMessage> inputStream = streamGraph.getInputStream(streamName, (Object k, Object v) -> { RelDataType type = tableScan.getRowType(); return converter.convertToRelMessage(k, v, type); }); context.registerMessageStream(tableScan.getId(), inputStream); }</code><technical_language>realized in SQL, exposed system.stream format of names user. This is slightly Java fluent API changing logic streamId uniquely identify a source in program. discuss settle this one</technical_language>

Target:
public void translate(final TableScan tableScan, final TranslatorContext context) { StreamGraph streamGraph = context.getStreamGraph(); List<String> tableNameParts = tableScan.getTable().getQualifiedName(); Validate.isTrue(tableNameParts.size() == 2, String.format("table name %s is not of the format <SystemName>.<StreamName>", Joiner.on(".").join(tableNameParts))); String streamName = tableNameParts.get(1); String systemName = tableNameParts.get(0); SystemStream systemStream = new SystemStream(systemName, streamName); Validate.isTrue(relMsgConverters.containsKey(systemStream), String.format("Unknown system %s", systemName)); SamzaRelConverter converter = relMsgConverters.get(systemStream); MessageStream<KV<Object, Object>> inputStream = streamGraph.getInputStream(streamName); MessageStream<SamzaSqlRelMessage> samzaSqlRelMessageStream = inputStream.map(converter::convertToRelMessage); context.registerMessageStream(tableScan.getId(), samzaSqlRelMessageStream); }
Source:
<code>public Map<String, Object> getData() { <START> return Collections.unmodifiableMap(this.data); <END> }</code><technical_language>unneeded</technical_language>

Target:
public Map<String, Object> getData() { return this.data; }
Source:
<code>private void reportMetered(String name, Metered meter, long timestamp) throws IOException { <START> if (getDisabledMetricAttributes().contains(COUNT)) { <END> reportCounter(name, meter.getCount(), timestamp); } sendIfEnabled(M1_RATE, name, convertRate(meter.getOneMinuteRate()), timestamp); sendIfEnabled(M5_RATE, name, convertRate(meter.getFiveMinuteRate()), timestamp); sendIfEnabled(M15_RATE, name, convertRate(meter.getFifteenMinuteRate()), timestamp); sendIfEnabled(MEAN_RATE, name, convertRate(meter.getMeanRate()), timestamp); }</code><technical_language>If count is disabled reporting it</technical_language>

Target:
private void reportMetered(String name, Metered meter, long timestamp) throws IOException { if (!getDisabledMetricAttributes().contains(COUNT)) { reportCounter(name, meter.getCount(), timestamp); } sendIfEnabled(M1_RATE, name, convertRate(meter.getOneMinuteRate()), timestamp); sendIfEnabled(M5_RATE, name, convertRate(meter.getFiveMinuteRate()), timestamp); sendIfEnabled(M15_RATE, name, convertRate(meter.getFifteenMinuteRate()), timestamp); sendIfEnabled(MEAN_RATE, name, convertRate(meter.getMeanRate()), timestamp); }
Source:
<code>public FetchResult call() throws GitAPIException, InvalidRemoteException, org.eclipse.jgit.api.errors.TransportException { checkCallable(); try { <START> try (Transport transport = Transport.open(repo, remote)) <END> { transport.setCheckFetchedObjects(checkFetchedObjects); transport.setRemoveDeletedRefs(isRemoveDeletedRefs()); transport.setDryRun(dryRun); if (tagOption != null) transport.setTagOpt(tagOption); transport.setFetchThin(thin); configure(transport); FetchResult result = transport.fetch(monitor, refSpecs); return result; } } catch (NoRemoteRepositoryException e) { throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote), e); } catch (TransportException e) { throw new org.eclipse.jgit.api.errors.TransportException( e.getMessage(), e); } catch (URISyntaxException e) { throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (NotSupportedException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfFetchCommand, e); } }</code><technical_language>Move this outer try-block reduce a level of indentation</technical_language>

Target:
public FetchResult call() throws GitAPIException, InvalidRemoteException, org.eclipse.jgit.api.errors.TransportException { checkCallable(); try (Transport transport = Transport.open(repo, remote)) { transport.setCheckFetchedObjects(checkFetchedObjects); transport.setRemoveDeletedRefs(isRemoveDeletedRefs()); transport.setDryRun(dryRun); if (tagOption != null) transport.setTagOpt(tagOption); transport.setFetchThin(thin); configure(transport); FetchResult result = transport.fetch(monitor, refSpecs); return result; } catch (NoRemoteRepositoryException e) { throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote), e); } catch (TransportException e) { throw new org.eclipse.jgit.api.errors.TransportException( e.getMessage(), e); } catch (URISyntaxException e) { throw new InvalidRemoteException(MessageFormat.format( JGitText.get().invalidRemote, remote)); } catch (NotSupportedException e) { throw new JGitInternalException( JGitText.get().exceptionCaughtDuringExecutionOfFetchCommand, e); } }
Source:
<code>public void testSubstituteSystemPropertyPlaceholders() throws Exception { Map<Object, Object> testMapSystemProperties = new HashMap<>(); testMapSystemProperties.put("Java Home", "${java.home}"); <START> testMapSystemProperties.put("Java Version", "${java.version}"); <END> when(propertiesMock.entrySet()).thenReturn(testMapSystemProperties.entrySet()); Properties testProperties = PropertiesLoader.substituteSystemPropertyPlaceholders(propertiesMock); testMapSystemProperties.replace("Java Home", System.getProperty("java.home")); testMapSystemProperties.replace("Java Version", System.getProperty("java.version")); Assert.assertEquals( "Replaces the System Properties in the string", testMapSystemProperties.entrySet(), testProperties.entrySet()); }</code><technical_language>spaces in keys. of form org.codice.qualifier.qualifier.propertyname test such. test for system property expansions in keys well</technical_language>

Target:
public void testSubstituteSystemPropertyPlaceholders() throws Exception { Map<Object, Object> testMapSystemProperties = new HashMap<>(); testMapSystemProperties.put("Java_Home", "${java.home}"); testMapSystemProperties.put("Java_Version", "${java.version}"); Map<Object, Object> testMapSystemPropertiesAfter = new HashMap<>(); testMapSystemPropertiesAfter.put("Java_Home", System.getProperty("java.home")); testMapSystemPropertiesAfter.put("Java_Version", System.getProperty("java.version")); when(propertiesMock.entrySet()).thenReturn(testMapSystemProperties.entrySet()); Properties testProperties = PropertiesLoader.substituteSystemPropertyPlaceholders(propertiesMock); assertThat(testProperties.entrySet(), equalTo(testMapSystemPropertiesAfter.entrySet())); }