auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public EntitySearchInfo(IAutoCompleter crossRefAutoCompleter, IConditionFieldAutoCompleter conditionFieldAutoCompleter, String relatedTableNameWithOutTags, String relatedTableName, String primeryKeyName, String defaultSort) { <START> super(); <END> this.crossRefAutoCompleter = crossRefAutoCompleter; this.conditionFieldAutoCompleter = conditionFieldAutoCompleter; this.relatedTableNameWithOutTags = relatedTableNameWithOutTags; this.relatedTableName = relatedTableName; this.primeryKeyName = primeryKeyName; this.defaultSort = defaultSort; }</code><technical_language>call super</technical_language>

Target:
public EntitySearchInfo(IAutoCompleter crossRefAutoCompleter, IConditionFieldAutoCompleter conditionFieldAutoCompleter, String relatedTableNameWithOutTags, String relatedTableName, String primeryKeyName, String defaultSort) { this.crossRefAutoCompleter = crossRefAutoCompleter; this.conditionFieldAutoCompleter = conditionFieldAutoCompleter; this.relatedTableNameWithOutTags = relatedTableNameWithOutTags; this.relatedTableName = relatedTableName; this.primeryKeyName = primeryKeyName; this.defaultSort = defaultSort; }
Source:
<code>private void handleLogReplicationQueryLeadership(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("******Log Replication Query Leadership Request received by Server."); <START> LogReplicationQueryLeaderShipResponse resp = new LogReplicationQueryLeaderShipResponse(0, getSinkManager().isLeader()); <END> r.sendResponse(ctx, msg, CorfuMsgType.LOG_REPLICATION_QUERY_LEADERSHIP_RESPONSE.payloadMsg(resp)); }</code><technical_language>fix epoch value. remote sink manager query server node finds leader? Also, do consider sink leader? source sink leaders different? leader is requested here</technical_language>

Target:
private void handleLogReplicationQueryLeadership(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { log.info("Log Replication Query Leadership Request received by Server."); LogReplicationQueryLeaderShipResponse resp = new LogReplicationQueryLeaderShipResponse(0, isLeader.get(), serverContext.getLocalEndpoint()); r.sendResponse(msg, CorfuMsgType.LOG_REPLICATION_QUERY_LEADERSHIP_RESPONSE.payloadMsg(resp)); }
Source:
<code>private static void registerClusteredLockManager(BasicComponentRegistry registry, GlobalConfiguration globalConfig, CompletableFuture<CacheHolder> future, ClusteredLockManagerConfiguration config) { <START> ClusteredLockManager clusteredLockManager = new EmbeddedClusteredLockManager(future, config); <END> registry.registerComponent(ClusteredLockManager.class, clusteredLockManager, true); if (globalConfig.globalJmxStatistics().enabled()) { CacheManagerJmxRegistration jmxRegistration = registry.getComponent(CacheManagerJmxRegistration.class).running(); jmxRegistration.registerMBean(clusteredLockManager); } }</code><technical_language>Do this synchronized before</technical_language>

Target:
private static void registerClusteredLockManager(BasicComponentRegistry registry, GlobalConfiguration globalConfig, CompletableFuture<CacheHolder> future, ClusteredLockManagerConfiguration config) { ClusteredLockManager clusteredLockManager = new EmbeddedClusteredLockManager(future, config); registry.registerComponent(ClusteredLockManager.class, clusteredLockManager, true); if (globalConfig.statistics()) { CacheManagerJmxRegistration jmxRegistration = registry.getComponent(CacheManagerJmxRegistration.class).running(); jmxRegistration.registerMBean(clusteredLockManager); } }
Source:
<code><START> public void setThingTypeRegistry(ThingTypeRegistry thingTypeRegistry) { <END> this.thingTypeRegistry = thingTypeRegistry; }</code><technical_language>is this change necessary (and other protected public changes, too)</technical_language>

Target:
protected void setThingTypeRegistry(ThingTypeRegistry thingTypeRegistry) { this.thingTypeRegistry = thingTypeRegistry; }
Source:
<code>public static VmPayload map(org.ovirt.engine.api.model.VmPayload entity, VmPayload template) { VmPayload model = template != null ? template : new VmPayload(); model.setType(VmDeviceType.valueOf(entity.getType().toUpperCase())); <START> model.setFileName(entity.getFile().getName()); <END> model.setContent(entity.getFile().getContent()); return model; }</code><technical_language>I need add a null validation too. This code crash if user supply <file> <vm_payload>. If <file> is mandaory validate for elsewhere, mapper in risk of NPE. entity.isSetFile() automatically generated jaxb</technical_language>

Target:
public static VmPayload map(org.ovirt.engine.api.model.VmPayload entity, VmPayload template) { VmPayload model = template != null ? template : new VmPayload(); model.setType(VmDeviceType.valueOf(entity.getType().toUpperCase())); if (entity.getFile() != null) { model.setFileName(entity.getFile().getName()); model.setContent(entity.getFile().getContent()); } return model; }
Source:
<code>public void setDefaultCapacityMap(ClusterConfigProperty capacityPropertyType, Map<String, Integer> capacityDataMap) throws IllegalArgumentException { if (capacityDataMap == null || capacityDataMap.size() == 0) { <START> throw new IllegalArgumentException("Default capacity data is empty"); <END> } Map<String, String> data = new HashMap<>(); capacityDataMap.entrySet().stream().forEach(entry -> { if (entry.getValue() < 0) { throw new IllegalArgumentException(String .format("Default capacity data contains a negative value: %s = %d", entry.getKey(), entry.getValue())); } data.put(entry.getKey(), Integer.toString(entry.getValue())); }); _record.setMapField(capacityPropertyType.name(), data); }</code><technical_language>capacityDataMap.size() == 0 I this a valid for users do, throw exception? allowed empty out default capacity map? allowed for stricter capacity planning, correct? provide a separate method for reset/removeDefaultCapacityMap</technical_language>

Target:
public void setDefaultCapacityMap(ClusterConfigProperty capacityPropertyType, Map<String, Integer> capacityDataMap) throws IllegalArgumentException { if (capacityDataMap == null) { throw new IllegalArgumentException("Default capacity data is null"); } Map<String, String> data = new HashMap<>(); capacityDataMap.entrySet().stream().forEach(entry -> { if (entry.getValue() < 0) { throw new IllegalArgumentException(String .format("Default capacity data contains a negative value: %s = %d", entry.getKey(), entry.getValue())); } data.put(entry.getKey(), Integer.toString(entry.getValue())); }); _record.setMapField(capacityPropertyType.name(), data); }
Source:
<code>public void testFilterNicsWithUnmanagedNetworks(){ List<VdsNetworkInterface> existingInterfaces = new ArrayList<VdsNetworkInterface>(); <START> for(int i=0; i<10; i++){ <END> Nic nic = new Nic(); nic.setName("eth" + i); NetworkImplementationDetails networkImplementationDetails = new NetworkImplementationDetails(true, i%2==1); nic.setNetworkImplementationDetails(networkImplementationDetails); existingInterfaces.add(nic); } UnmanagedNetworkValidator validator = new UnmanagedNetworkValidator(); List<VdsNetworkInterface> unmanagedNicsList = validator.filterNicsWithUnmanagedNetworks(existingInterfaces, new HashSet<String>()); assertEquals(5, unmanagedNicsList.size()); for(int i=0; i<5; i++){ assertEquals("eth" + (i*2), unmanagedNicsList.get(i).getName()); } }</code><technical_language>10? Is important for test? 2 fine? point is: maybe, if nics, instantiate nicely for loop. Reconsider this in this class. If actual need for 5 instances, amount, difference. if need loop, please extract creation of existing interfaces separate method. extract creation of nic with/without implementation details</technical_language>

Target:
public void testFilterNicsWithUnmanagedNetworks(){ VdsNetworkInterface nicManaged = createNicWithNetworkImplementationDetails("eth0", true); VdsNetworkInterface nicUnmanaged = createNicWithNetworkImplementationDetails("eth1", false); List<VdsNetworkInterface> existingInterfaces = Arrays.asList(nicManaged, nicUnmanaged); List<VdsNetworkInterface> unmanagedNicsList = validator.filterNicsWithUnmanagedNetworks(existingInterfaces, new HashSet<String>()); assertEquals(1, unmanagedNicsList.size()); assertEquals("eth1", unmanagedNicsList.get(0).getName()); }
Source:
<code>public String getName() { return String.format( <START> "%s [%s]", <END> super.getName(), inputs.stream().map(Transformation::getName).collect(joining(", "))); }</code><technical_language>In chaining input, source -> op1 -> op2 in log web UI. If I get this formatting correctly, op1 [source1, source2] -> op2 now. naively assume easier for users read [source1, source2] -> op1 -> op2. WDYT? Ofc, kinda assumes chaining is printed " -> " in JobGraphGenerator, ideal. Also, for source? print op []? I guess a special treatment for non-chained inputs</technical_language>

Target:
public String getName() { return inputs.isEmpty() ? super.getName() : "[" + inputs.stream().map(Transformation::getName).collect(joining(", ")) + "]"; }
Source:
<code>private void next(String email, final String password) { final FirebaseAuth firebaseAuth = mActivityHelper.getFirebaseAuth(); firebaseAuth.signInWithEmailAndPassword(email, password) .addOnFailureListener( new TaskFailureLogger(TAG, "Error signing in with email and password")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { AuthCredential authCredential = AuthCredentialHelper.getAuthCredential(mIdpResponse); authResult.getUser().linkWithCredential(authCredential); firebaseAuth.signOut(); firebaseAuth.signInWithCredential(authCredential) .addOnFailureListener( new TaskFailureLogger(TAG, "Error signing in with credential")) .addOnSuccessListener( new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { mSmartLock.saveCredentialsOrFinish( WelcomeBackPasswordPrompt.this, mActivityHelper.getFlowParams(), authResult.getUser(), password, null ); } <START> }); <END> } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { String error = e.getLocalizedMessage(); mPasswordLayout.setError(error); } }); }</code><technical_language>noticed this, removing calls dismissDialog()</technical_language>

Target:
private void next(String email, final String password) { final FirebaseAuth firebaseAuth = mActivityHelper.getFirebaseAuth(); if (TextUtils.isEmpty(password)) { mPasswordField.setError(getString(R.string.required_field)); return; } else { mPasswordField.setError(null); } firebaseAuth.signInWithEmailAndPassword(email, password) .addOnFailureListener( new TaskFailureLogger(TAG, "Error signing in with email and password")) .addOnSuccessListener(new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { AuthCredential authCredential = AuthCredentialHelper.getAuthCredential(mIdpResponse); authResult.getUser().linkWithCredential(authCredential); firebaseAuth.signOut(); firebaseAuth.signInWithCredential(authCredential) .addOnFailureListener( new TaskFailureLogger(TAG, "Error signing in with credential")) .addOnSuccessListener( new OnSuccessListener<AuthResult>() { @Override public void onSuccess(AuthResult authResult) { SmartLock .getInstance(WelcomeBackPasswordPrompt.this, TAG) .saveCredentialsOrFinish( WelcomeBackPasswordPrompt.this, mActivityHelper, authResult.getUser(), password, null ); } }); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { String error = e.getLocalizedMessage(); mPasswordLayout.setError(error); } }); }
Source:
<code>protected void gatherData() { View view = getView(); if(view == null) return; EditText usernameEditText = (EditText)view.findViewById(R.id.username); EditText passwordEditText = (EditText)view.findViewById(R.id.password); username = usernameEditText.getText().toString(); password = passwordEditText.getText().toString(); <START> url = "<LINK_0>"; <END> wallabagServerVersion = 2; tryPossibleURLs = false; }</code><technical_language>"<LINK_1>"? I test in app, though</technical_language>

Target:
protected void gatherData() { View view = getView(); if(view == null) return; EditText usernameEditText = (EditText)view.findViewById(R.id.username); EditText passwordEditText = (EditText)view.findViewById(R.id.password); username = usernameEditText.getText().toString(); password = passwordEditText.getText().toString(); url = "<LINK_1>"; wallabagServerVersion = 2; tryPossibleURLs = false; }
Source:
<code>public int getMaximumRelationAllowed(OrcsSession session, IRelationType type, RelationNode node, RelationSide side) throws OseeCoreException { <START> return validity.getMaximumRelationsAllowed(type, node.getArtifactType(), side); <END> }</code><technical_language>node null? (in other methods too)</technical_language>

Target:
public int getMaximumRelationAllowed(OrcsSession session, IRelationType type, RelationNode node, RelationSide side) throws OseeCoreException { Conditions.checkNotNull(node, "node"); return validity.getMaximumRelationsAllowed(type, node.getArtifactType(), side); }
Source:
<code>List<TaskCallbackImpl> update(TaskCallbackImpl cb) { synchronized (lock) { callbacks.add(cb); TaskCallbackImpl callback = null; <START> List<TaskCallbackImpl> committableCallbacks = new ArrayList<>(); <END> TaskCoordinator.RequestScope shutdownRequest = null; while (!callbacks.isEmpty() && callbacks.peek().matchSeqNum(nextSeqNum)) { ++nextSeqNum; callback = callbacks.poll(); if (callback.coordinator.commitRequest().isDefined()) { committableCallbacks.add(callback); } if (callback.coordinator.shutdownRequest().isDefined()) { shutdownRequest = callback.coordinator.shutdownRequest().get(); } } if (committableCallbacks.isEmpty() && callback != null) { committableCallbacks.add(callback); } if (shutdownRequest != null) { for (TaskCallbackImpl callbackToCommit : committableCallbacks) { callbackToCommit.coordinator.shutdown(shutdownRequest); } } return committableCallbacks; } }</code><technical_language>need a separate commitableCallbacks. need update for callbacks watermark. this callbacksToUpdate</technical_language>

Target:
List<TaskCallbackImpl> update(TaskCallbackImpl cb) { synchronized (lock) { callbacks.add(cb); List<TaskCallbackImpl> callbacksToUpdate = new ArrayList<>(); while (!callbacks.isEmpty() && callbacks.peek().matchSeqNum(nextSeqNum)) { ++nextSeqNum; TaskCallbackImpl callback = callbacks.poll(); callbacksToUpdate.add(callback); if (callback.coordinator.commitRequest().isDefined()) { break; } } return callbacksToUpdate; } }
Source:
<code>public void testOpportunistic() throws Exception { Configuration conf = new YarnConfiguration(); <START> String id = "container_01_01"; <END> ContainerId mockContainerId = mock(ContainerId.class); when(mockContainerId.toString()).thenReturn(id); cGroupsCpuResourceHandler.bootstrap(plugin, conf); ContainerTokenIdentifier tokenId = mock(ContainerTokenIdentifier.class); when(tokenId.getExecutionType()).thenReturn(ExecutionType.OPPORTUNISTIC); Container container = mock(Container.class); when(container.getContainerId()).thenReturn(mockContainerId); when(container.getContainerTokenIdentifier()).thenReturn(tokenId); when(container.getResource()).thenReturn(Resource.newInstance(1024, 2)); cGroupsCpuResourceHandler.preStart(container); verify(mockCGroupsHandler, times(1)) .updateCGroupParam(CGroupsHandler.CGroupController.CPU, id, CGroupsHandler.CGROUP_CPU_SHARES, "2"); }</code><technical_language>move this cGroupsCpuResourceHandler.prestart()</technical_language>

Target:
public void testOpportunistic() throws Exception { Configuration conf = new YarnConfiguration(); cGroupsCpuResourceHandler.bootstrap(plugin, conf); ContainerTokenIdentifier tokenId = mock(ContainerTokenIdentifier.class); when(tokenId.getExecutionType()).thenReturn(ExecutionType.OPPORTUNISTIC); Container container = mock(Container.class); String id = "container_01_01"; ContainerId mockContainerId = mock(ContainerId.class); when(mockContainerId.toString()).thenReturn(id); when(container.getContainerId()).thenReturn(mockContainerId); when(container.getContainerTokenIdentifier()).thenReturn(tokenId); when(container.getResource()).thenReturn(Resource.newInstance(1024, 2)); cGroupsCpuResourceHandler.preStart(container); verify(mockCGroupsHandler, times(1)) .updateCGroupParam(CGroupsHandler.CGroupController.CPU, id, CGroupsHandler.CGROUP_CPU_SHARES, "2"); }
Source:
<code><START> public void testFastTransformSlopeAndOffset() { <END> double offset = 54321.0; double slope = Math.pow(10.0, 4); for (int ex = 0; ex <= Long.BYTES - 1; ex++) { long start = 1 << ex; TmfTimestampTransformLinear precise = new TmfTimestampTransformLinear(slope, offset); TmfTimestampTransformLinearFast fast = fTransformFactory.create(slope, offset); checkTime(precise, fast, 5, start, 1); } }</code><technical_language>I understand of fix, Factory=Deserialized fail fix, oddly Factory=Object fails here. Do why</technical_language>

Target:
public void testFastTransformSlopeAndOffset() { double offset = 54321.0; double slope = Math.pow(10.0, 4); for (int ex = 0; ex <= Long.SIZE - 1; ex++) { long start = 1 << ex; TmfTimestampTransformLinear precise = new TmfTimestampTransformLinear(slope, offset); TmfTimestampTransformLinearFast fast = fTransformFactory.create(slope, offset); checkTime(precise, fast, 5, start, 1); } }
Source:
<code>public static List<KeyRange> getSaltByteRanges(List<List<KeyRange>> ranges, RowKeySchema schema, int bucketNum) { if (ScanRanges.isSingleRowScan(ranges, schema, false)) { int[] position = new int[ranges.size()]; int maxLength = ScanUtil.estimateKeyLength(schema, 1, ranges, new int[ranges.size()], Bound.LOWER); byte[] key = new byte[maxLength + 1]; ScanUtil.setKey(schema, ranges, position, Bound.LOWER, key, 1, 0, ranges.size(), 1); byte saltByte = SaltingUtil.getSaltingByte(key, bucketNum); KeyRange saltRange = SaltingUtil.SALTING_COLUMN.getDataType().getKeyRange(new byte[] {saltByte}, true, new byte[] {saltByte}, true); <START> List<KeyRange> saltRangeList = new ArrayList<KeyRange>(); <END> saltRangeList.add(saltRange); return saltRangeList; } return SaltingUtil.generateAllSaltingRanges(bucketNum); }</code><technical_language>Collections.singletonList</technical_language>

Target:
public static List<KeyRange> getSaltByteRanges(List<List<KeyRange>> ranges, RowKeySchema schema, int bucketNum) { if (ScanRanges.isSingleRowScan(ranges, schema, false)) { int[] position = new int[ranges.size()]; int maxLength = ScanUtil.estimateKeyLength(schema, 1, ranges, new int[ranges.size()], Bound.LOWER); byte[] key = new byte[maxLength + 1]; ScanUtil.setKey(schema, ranges, position, Bound.LOWER, key, 1, 0, ranges.size(), 1); byte saltByte = SaltingUtil.getSaltingByte(key, 1, key.length - 1, bucketNum); KeyRange saltRange = SaltingUtil.SALTING_COLUMN.getDataType().getKeyRange(new byte[] {saltByte}, true, new byte[] {saltByte}, true); List<KeyRange> saltRangeList = Collections.<KeyRange>singletonList(saltRange); return saltRangeList; } return Collections.<KeyRange>singletonList(SaltingUtil.SALTING_COLUMN.getDataType().getKeyRange( new byte[] {0}, true, new byte[] {(byte) bucketNum}, true)); }
Source:
<code>private boolean isValidVariableTypeForFormula(final int id) { return Iterables.any(this.ontologyVariableDataManager.getVariableTypes(id), new Predicate<VariableType>() { @Override public boolean apply(@Nullable final VariableType variableType) { <START> return variableType.equals(VariableType.TRAIT) || variableType.equals(VariableType.ENVIRONMENT_DETAIL) || variableType <END> .equals(VariableType.STUDY_CONDITION); } }); }</code><technical_language>Create a list of valid variable types check if is there. Ideally this list Middleware (maybe DerivedVariableService)</technical_language>

Target:
private boolean isValidVariableTypeForFormula(final int id) { return Iterables.any(this.ontologyVariableDataManager.getVariableTypes(id), new Predicate<VariableType>() { @Override public boolean apply(@Nullable final VariableType variableType) { return DerivedVariableServiceImpl.CALCULATED_VARIABLE_VARIABLE_TYPES.contains(variableType.getId()); } }); }
Source:
<code>public SamzaResource peekResource(String host) { synchronized (lock) { List<SamzaResource> resourcesOnPreferredHostBuffer = this.allocatedResources.get(host); List<SamzaResource> resourcesOnAnyHostBuffer = this.allocatedResources.get(ANY_HOST); if (resourcesOnPreferredHostBuffer != null && !resourcesOnPreferredHostBuffer.isEmpty()) { SamzaResource resource = resourcesOnPreferredHostBuffer.get(0); log.info("Returning a buffered resource: for from preferred-host buffer.", resource.getResourceID(), host); return resource; } else if (resourcesOnAnyHostBuffer != null && !resourcesOnAnyHostBuffer.isEmpty()) { log.debug("No resources on preferred-host buffer. Scanning ANY_HOST buffer"); SamzaResource resource = resourcesOnAnyHostBuffer.stream() .filter(resrc -> resrc.getHost().equals(host)) .findAny().orElse(null); if (resource != null) { log.info("Returning a buffered resource: for from ANY_HOST buffer.", resource.getResourceID(), host); <START> } <END> return resource; } else { log.debug("Cannot find any resource in the ANY_HOST buffer for because it is empty", host); return null; } } }</code><technical_language>log info find a buffered resource in buffer</technical_language>

Target:
public SamzaResource peekResource(String host) { synchronized (lock) { List<SamzaResource> resourcesOnPreferredHostBuffer = this.allocatedResources.get(host); List<SamzaResource> resourcesOnAnyHostBuffer = this.allocatedResources.get(ANY_HOST); if (resourcesOnPreferredHostBuffer != null && !resourcesOnPreferredHostBuffer.isEmpty()) { SamzaResource resource = resourcesOnPreferredHostBuffer.get(0); log.info("Returning a buffered resource: for from preferred-host buffer.", resource.getResourceID(), host); return resource; } else if (resourcesOnAnyHostBuffer != null && !resourcesOnAnyHostBuffer.isEmpty()) { log.debug("No resources on preferred-host buffer. Scanning ANY_HOST buffer"); SamzaResource resource = resourcesOnAnyHostBuffer.stream() .filter(resrc -> resrc.getHost().equals(host)) .findAny().orElse(null); if (resource != null) { log.info("Returning a buffered resource: for from ANY_HOST buffer.", resource.getResourceID(), host); } return resource; } else { log.debug("Cannot find any resource in the ANY_HOST buffer for because both buffers are empty", host); return null; } } }
Source:
<code>public void registerTransformers(SubsystemTransformerRegistration subsystemRegistration) { if (!isByPassTransformers()) { ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(subsystemRegistration.getCurrentSubsystemVersion()); ResourceTransformationDescriptionBuilder builder200 = chainedBuilder.createBuilder(subsystemRegistration.getCurrentSubsystemVersion(), MODEL_VERSION_2_0_0); registerTransformers_2_0_0(builder200); chainedBuilder.buildAndRegister(subsystemRegistration, new ModelVersion[] {MODEL_VERSION_2_0_0, MODEL_VERSION_1_0_0}); <START> } <END> }</code><technical_language>feels here. AIUI a "3.0" (imagine some air quotes) WF 19, a proper 2.0 some time in 2017. officially creating a proper 3.0. need transformation for hosts 1.0 matter what. need missing 3.0 -> 2.0 transformation admin disabled it. If admin disabled 3.0 -> 2.0 system property, do 3.0 -> 1.0. rename registerTransformers_2_0_0 registerTransformersFrom_3_0_0 invoked matter what. differs is target version provided chainedBuilder.createBuilder. BTW I names registerTransformersFrom_3_0_0 in general. I review classes I waste time figure out version # in methods represents -- source target</technical_language>

Target:
public void registerTransformers(SubsystemTransformerRegistration subsystemRegistration) { final ModelVersion[] modelVersions; final ModelVersion target; if (isByPassTransformers()) { target = MODEL_VERSION_1_0_0; modelVersions = new ModelVersion[] {MODEL_VERSION_1_0_0}; } else { target = MODEL_VERSION_2_0_0; modelVersions = new ModelVersion[] {MODEL_VERSION_2_0_0, MODEL_VERSION_1_0_0}; } ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(subsystemRegistration.getCurrentSubsystemVersion()); ResourceTransformationDescriptionBuilder builder300 = chainedBuilder.createBuilder(subsystemRegistration.getCurrentSubsystemVersion(), target); registerTransformers_3_0_0(builder300); chainedBuilder.buildAndRegister(subsystemRegistration, modelVersions); }
Source:
<code>public void validateField(String name, Object o) { if (o == null) { return; } Map numa = (Map<String, Object>) o; for (String key : new String[]{NUMA_CORES, NUMA_MEMORY_IN_MB, NUMA_PORTS}) { if (!numa.containsKey(key)) { throw new IllegalArgumentException( "The numa configuration key [" + key + "] is missing!" ); } } List<Integer> cores = (List<Integer>) numa.get(NUMA_CORES); Set coreSet = new HashSet(); coreSet.addAll(cores); if (coreSet.size() != cores.size()) { throw new IllegalArgumentException( <START> "No duplicate cores in NUMA config" <END> ); } }</code><technical_language>"duplicate cores in NUMA config"</technical_language>

Target:
public void validateField(String name, Object o) { if (o == null) { return; } Map numa = (Map<String, Object>) o; for (String key : new String[]{NUMA_CORES, NUMA_MEMORY_IN_MB, NUMA_PORTS}) { if (!numa.containsKey(key)) { throw new IllegalArgumentException( "The numa configuration key [" + key + "] is missing!" ); } } List<Integer> cores = (List<Integer>) numa.get(NUMA_CORES); Set coreSet = new HashSet(); coreSet.addAll(cores); if (coreSet.size() != cores.size()) { throw new IllegalArgumentException( "Duplicate cores in NUMA config" ); } }
Source:
<code>public RecursiveLoggerContextInstantiationException(String message) { <START> super(I18nMessageFactory.createStaticMessage(message)); <END> }</code><technical_language>static import</technical_language>

Target:
public RecursiveLoggerContextInstantiationException(String message) { super(createStaticMessage(message)); }
Source:
<code>protected Optional<ToggleButton> createAllButton() { final ToggleButton allCategoryButton = createSidebarToggleButton(tr("All")); allCategoryButton.setId("allButton"); allCategoryButton.setOnAction(event -> { <START> getControl().setSelectedElement(null); <END> getControl().getOnAllCategorySelection().run(); }); return Optional.of(allCategoryButton); }</code><technical_language>Thinking if nice setNothingSelected</technical_language>

Target:
protected Optional<ToggleButton> createAllButton() { final ToggleButton allCategoryButton = createSidebarToggleButton(tr("All")); allCategoryButton.setId("allButton"); allCategoryButton.setOnAction(event -> getControl().setNothingSelected()); return Optional.of(allCategoryButton); }
Source:
<code>public URLClassLoader loadDependencies() { ClassLoader currentCl = Thread.currentThread().getContextClassLoader(); <START> URLClassLoader cl = URLClassLoader.newInstance(launchDependencies.toArray(new URL[launchDependencies.size()]), currentCl); <END> Thread.currentThread().setContextClassLoader(cl); StringCodecs.check(); return cl; }</code><technical_language>Is this needed if necessary artifacts in launch dependencies</technical_language>

Target:
public URLClassLoader loadDependencies() { URLClassLoader cl = URLClassLoader.newInstance(launchDependencies.toArray(new URL[launchDependencies.size()])); Thread.currentThread().setContextClassLoader(cl); StringCodecs.check(); return cl; }
Source:
<code>public String getAccessibleHorizontalLabelForBarAt(int index) { if (mAccessibleVirtualLabels != null && index < mAccessibleVirtualLabels.length) { return mAccessibleVirtualLabels[index]; } <START> return ""; <END> }</code><technical_language>consider logging a warning message. WDYT</technical_language>

Target:
public String getAccessibleHorizontalLabelForBarAt(int index) { if (mAccessibleVirtualLabels != null && index < mAccessibleVirtualLabels.length) { return mAccessibleVirtualLabels[index]; } AppLog.w(AppLog.T.STATS, "Missing StatsBarGraph accessible label at index " + index); return ""; }
Source:
<code>public static <T> ArrayList<T> Intersection(ArrayList<ArrayList<T>> lists) { ArrayList<T> result = new ArrayList<T>(); if (lists != null) { <START> result.addAll(lists.get(0)); <END> for (ArrayList<T> list : lists) { result.retainAll(list); } } return result; }</code><technical_language>this handle empty 'lists', throw exception</technical_language>

Target:
public static <T> ArrayList<T> Intersection(ArrayList<ArrayList<T>> lists) { ArrayList<T> result = new ArrayList<T>(); if (lists != null && !lists.isEmpty()) { result.addAll(lists.get(0)); for (ArrayList<T> list : lists) { result.retainAll(list); } } return result; }
Source:
<code><START> synchronized void cleanupPreemptionList() { <END> Iterator<FSAppAttempt> iterator = resourcesPreemptedForApp.keySet().iterator(); while (iterator.hasNext()) { FSAppAttempt app = iterator.next(); boolean removeApp = false; if (app.isStopped() || Resources.equals( app.getPendingDemand(), Resources.none())) { Resources.subtractFrom(totalResourcesPreempted, resourcesPreemptedForApp.get(app)); iterator.remove(); } } }</code><technical_language>This method private. Offline, mentioned this is called in tests. I if avoided</technical_language>

Target:
private synchronized void cleanupPreemptionList() { Iterator<FSAppAttempt> iterator = resourcesPreemptedForApp.keySet().iterator(); while (iterator.hasNext()) { FSAppAttempt app = iterator.next(); if (app.isStopped() || !app.isStarved()) { Resources.subtractFrom(totalResourcesPreempted, resourcesPreemptedForApp.get(app)); appIdToAppMap.remove(app.getApplicationAttemptId()); iterator.remove(); } } }
Source:
<code>public void onAssignmentChange(List<DatastreamTask> tasks) { List<DatastreamTask> tasksAdded = tasks.stream().filter(x -> !_taskHandlers.containsKey(x)).collect(Collectors.toList()); List<DatastreamTask> tasksRemoved = _taskHandlers.keySet().stream().filter(x -> !tasks.contains(x)).collect(Collectors.toList()); stopAndRemoveHandlers(tasksRemoved); Map<DatastreamTask, SnapshotTaskHandler> addedHandlers = tasksAdded.stream() .collect(Collectors.toMap(Function.identity(), x -> new SnapshotTaskHandler(x, _tableInfoProvider, _defaultUserName, _defaultPassword, _bufferSizeInRows, _sqlTimeout))); <START> addedHandlers.values().stream().forEach(_executorService::submit); <END> _taskHandlers.putAll(addedHandlers); }</code><technical_language>handle exception thrown executorService:submit()</technical_language>

Target:
public void onAssignmentChange(List<DatastreamTask> tasks) { LOG.info(String.format("Mysql snapshot connector is assigned tasks %s", tasks)); List<DatastreamTask> tasksAdded = tasks.stream().filter(x -> !_taskHandlers.containsKey(x)).collect(Collectors.toList()); List<DatastreamTask> tasksRemoved = _taskHandlers.keySet().stream().filter(x -> !tasks.contains(x)).collect(Collectors.toList()); stopAndRemoveHandlers(tasksRemoved); Map<DatastreamTask, SnapshotTaskHandler> addedHandlers = tasksAdded.stream() .collect(Collectors.toMap(Function.identity(), x -> new SnapshotTaskHandler(x, _tableInfoProvider, getUsername(x), getPassword(x), _bufferSizeInRows, _sqlTimeout))); addedHandlers.values().stream().forEach(_executorService::submit); _taskHandlers.putAll(addedHandlers); }
Source:
<code>public static List<Phonenumber> extractTelecoms(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7DbParser201305.ExtractTelecoms method..."); List<Phonenumber> phonenumbers = new ArrayList<>(); Phonenumber phonenumber; if (CollectionUtils.isNotEmpty(params.getPatientTelecom()) && params.getPatientTelecom().get(0) != null) { for (PRPAMT201306UV02PatientTelecom patientTelecom : params.getPatientTelecom()) { String telecom = hl7ParserUtils.extractTelecom(patientTelecom); <START> if (hl7ParserUtils.extractTelecom(patientTelecom) != null) { <END> phonenumber = new Phonenumber(); phonenumber.setValue(telecom); phonenumbers.add(phonenumber); } } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7DbParser201305.ExtractTelecoms method..."); return phonenumbers; }</code><technical_language>call hl7ParserUtils.extractTelecom(patientTelecom) for checking? check telcom variable</technical_language>

Target:
public static List<Phonenumber> extractTelecoms(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7DbParser201305.ExtractTelecoms method..."); List<Phonenumber> phonenumbers = new ArrayList<>(); Phonenumber phonenumber; if (CollectionUtils.isNotEmpty(params.getPatientTelecom()) && params.getPatientTelecom().get(0) != null) { for (PRPAMT201306UV02PatientTelecom patientTelecom : params.getPatientTelecom()) { String telecom = hl7ParserUtils.extractTelecom(patientTelecom); if (telecom != null) { phonenumber = new Phonenumber(); phonenumber.setValue(telecom); phonenumbers.add(phonenumber); } } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7DbParser201305.ExtractTelecoms method..."); return phonenumbers; }
Source:
<code>public StreamingResponseBody streamEvents( @PathVariable("subscription_id") final String subscriptionId, @RequestParam(value = "window_size", required = false, defaultValue = "100") final int windowSize, @RequestParam(value = "commit_timeout", required = false, defaultValue = "30") final int commitTimeout, <START> @RequestParam(value = "batch_limit", required = false, defaultValue = "1") final int batchLimit, <END> @RequestParam(value = "stream_limit", required = false) final Integer streamLimit, @RequestParam(value = "batch_flush_timeout", required = false, defaultValue = "30") final int batchTimeout, @RequestParam(value = "stream_timeout", required = false) final Long streamTimeout, @RequestParam(value = "stream_keep_alive_limit", required = false) final Integer streamKeepAliveLimit, final NativeWebRequest request, final HttpServletResponse response) throws IOException { return outputStream -> { SubscriptionStreamer streamer = null; final SubscriptionOutputImpl output = new SubscriptionOutputImpl(response, outputStream); try { streamer = subscriptionStreamerFactory.build( subscriptionId, StreamParameters.of(batchLimit, streamLimit, batchTimeout, streamTimeout, streamKeepAliveLimit, windowSize, commitTimeout), output); streamer.stream(); } catch (final NoSuchSubscriptionException e) { output.onException(e); } catch (final InterruptedException ex) { LOG.warn("Interrupted while streaming with " + streamer, ex); Thread.currentThread().interrupt(); } finally { outputStream.close(); } }; }</code><technical_language>do primitive type for some of params Integer for others</technical_language>

Target:
public StreamingResponseBody streamEvents( @PathVariable("subscription_id") final String subscriptionId, @RequestParam(value = "window_size", required = false, defaultValue = "100") final int windowSize, @RequestParam(value = "commit_timeout", required = false, defaultValue = "30") final int commitTimeout, @RequestParam(value = "batch_limit", required = false, defaultValue = "1") final int batchLimit, @RequestParam(value = "stream_limit", required = false) final Integer streamLimit, @RequestParam(value = "batch_flush_timeout", required = false, defaultValue = "30") final int batchTimeout, @RequestParam(value = "stream_timeout", required = false) final Long streamTimeout, @RequestParam(value = "stream_keep_alive_limit", required = false) final Integer streamKeepAliveLimit, final NativeWebRequest request, final HttpServletResponse response) throws IOException { return outputStream -> { SubscriptionStreamer streamer = null; final SubscriptionOutputImpl output = new SubscriptionOutputImpl(response, outputStream); try { streamer = subscriptionStreamerFactory.build( subscriptionId, StreamParameters.of(batchLimit, streamLimit, batchTimeout, streamTimeout, streamKeepAliveLimit, windowSize, commitTimeout), output); streamer.stream(); } catch (final InterruptedException ex) { LOG.warn("Interrupted while streaming with " + streamer, ex); Thread.currentThread().interrupt(); } catch (final Exception e) { output.onException(e); } finally { outputStream.close(); } }; }
Source:
<code>protected void handleStateChange(ConnectionState newState) { switch (newState) { case CONNECTED: LOG.debug("Connected to ZooKeeper quorum. Leader retrieval can start."); break; case SUSPENDED: synchronized (lock) { <START> LOG.warn("Connection to ZooKeeper suspended. Can no longer retrieve the leader from " + "ZooKeeper."); <END> notifyLeaderLoss(); } break; case RECONNECTED: LOG.info("Connection to ZooKeeper was reconnected. Leader retrieval can be restarted."); break; case LOST: synchronized (lock) { LOG.warn("Connection to ZooKeeper lost. Can no longer retrieve the leader from " + "ZooKeeper."); notifyLeaderLoss(); } break; } }</code><technical_language>Logging statements happen of lock</technical_language>

Target:
protected void handleStateChange(ConnectionState newState) { switch (newState) { case CONNECTED: LOG.debug("Connected to ZooKeeper quorum. Leader retrieval can start."); break; case SUSPENDED: LOG.warn("Connection to ZooKeeper suspended. Can no longer retrieve the leader from " + "ZooKeeper."); synchronized (lock) { notifyLeaderLoss(); } break; case RECONNECTED: LOG.info("Connection to ZooKeeper was reconnected. Leader retrieval can be restarted."); break; case LOST: LOG.warn("Connection to ZooKeeper lost. Can no longer retrieve the leader from " + "ZooKeeper."); synchronized (lock) { notifyLeaderLoss(); } break; } }
Source:
<code>private void process(File file, URL dest, boolean expectContinue) throws Exception { log("putting " + file + " to " + dest + " with expectContinue=" + expectContinue, Project.MSG_VERBOSE); if (fFilterSets.hasFilters() || !fFilterChains.isEmpty()) { Resource filteredResult; File tempFile=null; <START> if (fInMemoryFiltering){ <END> filteredResult = new StringResource(); }else{ tempFile = File.createTempFile("filterResult", ".tmp"); filteredResult = new FileResource(tempFile); } try{ ResourceUtils.copyResource(new FileResource(file), filteredResult, fFilterSets, fFilterChains, false, false, false, fInputEncoding, fOutputEncoding, getProject()); getSardine().put(dest.toString(), filteredResult.getInputStream(), fContentType, expectContinue); } finally { FileUtils.delete(tempFile); } } else { getSardine().put(dest.toString(), new FileInputStream(file), fContentType, expectContinue); } }</code><technical_language>consistent formatting. if (...) { } else {</technical_language>

Target:
private void process(File file, URL dest, boolean expectContinue) throws Exception { log("putting " + file + " to " + dest + " with expectContinue=" + expectContinue, Project.MSG_VERBOSE); if (filterSets.hasFilters() || !filterChains.isEmpty()) { Resource filteredResult; File tempFile = null; if (inMemoryFiltering) { filteredResult = new StringResource(); } else { tempFile = File.createTempFile("filterResult", ".tmp"); filteredResult = new FileResource(tempFile); } try { ResourceUtils.copyResource(new FileResource(file), filteredResult, filterSets, filterChains, false, false, false, inputEncoding, outputEncoding, getProject()); getSardine().put(dest.toString(), filteredResult.getInputStream(), contentType, expectContinue); } finally { FileUtils.delete(tempFile); } } else { getSardine().put(dest.toString(), file, contentType, expectContinue); } }
Source:
<code>private Map<String, List<Integer>> generateOptionPointsMapping( List<FeedbackResponseAttributes> responses) { Map<String, List<Integer>> optionPoints = new TreeMap<String, List<Integer>>(new Comparator<String>() { @Override public int compare(String s1, String s2) { return s2.compareTo(s1); } <START> }); <END> for (FeedbackResponseAttributes response : responses) { FeedbackConstantSumResponseDetails frd = (FeedbackConstantSumResponseDetails) response.getResponseDetails(); for (int i = 0; i < frd.getAnswerList().size(); i++) { String optionReceivingPoints = distributeToRecipients ? response.recipient : String.valueOf(i); int pointsReceived = frd.getAnswerList().get(i); updateOptionPointsMapping(optionPoints, optionReceivingPoints, pointsReceived); } } return optionPoints; }</code><technical_language>apologies, I realised option type is recipient, key is recipient email recipient name. sort (in generateOptionPointsMapping), sorting recipient email recipient name</technical_language>

Target:
private Map<String, List<Integer>> generateOptionPointsMapping( List<FeedbackResponseAttributes> responses) { Map<String, List<Integer>> optionPoints = new HashMap<String, List<Integer>>(); for (FeedbackResponseAttributes response : responses) { FeedbackConstantSumResponseDetails frd = (FeedbackConstantSumResponseDetails) response.getResponseDetails(); for (int i = 0; i < frd.getAnswerList().size(); i++) { String optionReceivingPoints = distributeToRecipients ? response.recipient : String.valueOf(i); int pointsReceived = frd.getAnswerList().get(i); updateOptionPointsMapping(optionPoints, optionReceivingPoints, pointsReceived); } } return optionPoints; }
Source:
<code>protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() <START> .antMatchers("/message/**").hasAuthority("SCOPE_message:read") <END> .anyRequest().authenticated() .and() .oauth2ResourceServer() .opaque() .introspectionUri(this.introspectionUri) .introspectionClientId(this.clientId) .introspectionClientSecret(this.clientSecret); }</code><technical_language>mvcMatchers</technical_language>

Target:
protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .mvcMatchers("/message/**").hasAuthority("SCOPE_message:read") .anyRequest().authenticated() .and() .oauth2ResourceServer() .opaqueToken() .introspectionUri(this.introspectionUri) .introspectionClientCredentials(this.clientId, this.clientSecret); }
Source:
<code>public static void updateSpecificActionJobCompleted(Guid entityId, VdcActionType actionType, boolean status) { try { JobRepositoryFactory.getJobRepository().getJobsByEntityAndAction(entityId, actionType).stream() .peek(job -> JobRepositoryFactory.getJobRepository().updateCompletedJobAndSteps(job)) <START> .filter(job -> job.getStatus() == JobExecutionStatus.STARTED) <END> .peek(job -> job.markJobEnded(status)); List<Job> jobs = JobRepositoryFactory.getJobRepository().getJobsByEntityAndAction(entityId, actionType); } catch (RuntimeException e) { log.error("Exception", e); } }</code><technical_language>this incorrect - execution order is set status update job later</technical_language>

Target:
public static void updateSpecificActionJobCompleted(Guid entityId, VdcActionType actionType, boolean status) { try { Stream<Job> stream = JobRepositoryFactory.getJobRepository().getJobsByEntityAndAction(entityId, actionType).stream(); stream .filter(job -> job.getStatus() == JobExecutionStatus.STARTED) .peek(job -> job.markJobEnded(status)); stream .peek(job -> JobRepositoryFactory.getJobRepository().updateCompletedJobAndSteps(job)); } catch (RuntimeException e) { log.error("Exception", e); } }
Source:
<code>public void configure(Config conf) { encoding = ConfUtils.getString(conf, "file.encoding", "UTF-8"); maxContentLength = ConfUtils.getInt(conf, "file.content.limit", 64 * 1024); <START> crawlParent = ConfUtils.getBoolean(conf, "crawlParent", true); <END> }</code><technical_language>this one. if users want crawl parent dir, give seed straight away. set true default + called file.crawl.parent is obivous parameter is related file protocol</technical_language>

Target:
public void configure(Config conf) { encoding = ConfUtils.getString(conf, "file.encoding", "UTF-8"); crawlParent = ConfUtils.getBoolean(conf, "file.crawl.parent", false); }
Source:
<code>public long getIdentifier() { <START> return md5().hashString(identity.toString(), UTF_8).asLong(); <END> }</code><technical_language>toString() is redundant</technical_language>

Target:
public long getIdentifier() { return identifier; }
Source:
<code>public void testDeserializeFromStringNormalCase() throws IOException { String srcRegex = "-"; String replaceString = "_"; String serializedString = createSerializedString(srcRegex, replaceString); RegexMountPointResolvedDstPathReplaceInterceptor interceptor = RegexMountPointResolvedDstPathReplaceInterceptor .deserializeFromString(serializedString); Assert.assertTrue(interceptor.getSrcRegexString().equals(srcRegex)); Assert.assertTrue(interceptor.getReplaceString().equals(replaceString)); Assert.assertTrue(interceptor.getSrcRegexPattern() == null); interceptor.initialize(); <START> Assert.assertTrue( <END> interceptor.getSrcRegexPattern().toString().equals(srcRegex)); }</code><technical_language>want assertEquals directly</technical_language>

Target:
public void testDeserializeFromStringNormalCase() throws IOException { String srcRegex = "-"; String replaceString = "_"; String serializedString = createSerializedString(srcRegex, replaceString); RegexMountPointResolvedDstPathReplaceInterceptor interceptor = RegexMountPointResolvedDstPathReplaceInterceptor .deserializeFromString(serializedString); Assert.assertEquals(srcRegex, interceptor.getSrcRegexString()); Assert.assertEquals(replaceString, interceptor.getReplaceString()); Assert.assertNull(interceptor.getSrcRegexPattern()); interceptor.initialize(); Assert.assertEquals(srcRegex, interceptor.getSrcRegexPattern().toString()); }
Source:
<code>private void addDefaultAcls(OmBucketInfo omBucketInfo, OmVolumeArgs omVolumeArgs) { List<OzoneAcl> acls = new ArrayList<>(); if (omBucketInfo.getAcls() != null) { acls.addAll(omBucketInfo.getAcls()); } omVolumeArgs.getAclMap().getDefaultAclList().forEach( <START> defaultAcl -> acls.add( <END> OzoneAcl.fromProtobufWithAccessType(defaultAcl))); omBucketInfo.setAcls(acls); }</code><technical_language>Simple add merge acl properly. OzoneAclUtil.inheritDefaultAcls(acls, omVolumeArgs.getAclMap().getDefaultAclList()) do merge</technical_language>

Target:
private void addDefaultAcls(OmBucketInfo omBucketInfo, OmVolumeArgs omVolumeArgs) { List<OzoneAcl> acls = new ArrayList<>(); if (omBucketInfo.getAcls() != null) { acls.addAll(omBucketInfo.getAcls()); } List<OzoneAcl> defaultVolumeAclList = omVolumeArgs.getAclMap() .getDefaultAclList().stream().map(OzoneAcl::fromProtobuf) .collect(Collectors.toList()); OzoneAclUtil.inheritDefaultAcls(acls, defaultVolumeAclList); omBucketInfo.setAcls(acls); }
Source:
<code><START> public CalcSubscription(@Nullable Double amount, @Nullable Double discountAmount, @Nullable Double discountPercent, <END> @Nullable String period, @Nullable Double price, SubscriptionResource resource, @Nullable Date startTime, @Nullable Date endTime) { checkArgument(!(endTime == null && period == null), "Subscription period should be configured with endTime or period"); this.amount = amount; this.discountAmount = discountAmount; this.discountPercent = discountPercent; this.period = period; this.price = price; this.resource = checkNotNull(resource); this.startTime = startTime; this.endTime = endTime; }</code><technical_language>[minor] spaces in @Nullable Double</technical_language>

Target:
public CalcSubscription(@Nullable Double amount, @Nullable Double discountAmount, @Nullable Double discountPercent, @Nullable String period, @Nullable Double price, SubscriptionResource resource, @Nullable Date startTime, @Nullable Date endTime) { checkArgument(!(endTime == null && period == null), "Subscription period should be configured with endTime or period"); this.amount = amount; this.discountAmount = discountAmount; this.discountPercent = discountPercent; this.period = period; this.price = price; this.resource = checkNotNull(resource, "resource"); this.startTime = startTime; this.endTime = endTime; }