auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>boolean prepare(boolean markManaged, boolean canCreate) throws InfrastructureException { KubernetesClient client = clientFactory.create(workspaceId); Namespace namespace = get(name, client); if (namespace == null) { if (!canCreate) { throw new InfrastructureException( <START> format("Creating the namespace '%s' is not allowed, yet" + " it was not found.", name)); <END> } create(name, client, markManaged); return true; } if (markManaged && !isLabeled(namespace, "che-managed", "true")) { KubernetesObjectUtil.putLabel(namespace, "che-managed", "true"); update(namespace, client); } return false; }</code><technical_language>unnecessary concat</technical_language>

Target:
void prepare(boolean markManaged, boolean canCreate) throws InfrastructureException { KubernetesClient client = clientFactory.create(workspaceId); Namespace namespace = get(name, client); if (namespace == null) { if (!canCreate) { throw new InfrastructureException( format("Creating the namespace '%s' is not allowed, yet it was not found.", name)); } namespace = create(name, client); } if (markManaged && !isLabeled(namespace, MANAGED_NAMESPACE_LABEL, "true")) { KubernetesObjectUtil.putLabel(namespace, MANAGED_NAMESPACE_LABEL, "true"); update(namespace, client); } }
Source:
<code><START> private void updateMapping(String reviewUrl, String reviewDescription) { <END> String oldTaskUrl = getTaskUrl(reviewUrl); String newTaskUrl = this.extractTaskUrl(reviewDescription); if (newTaskUrl == null && oldTaskUrl != null) { taskReviewsMap.get(oldTaskUrl).remove(reviewUrl); } else if (newTaskUrl != null) { taskReviewsMap.put(newTaskUrl, reviewUrl); if (oldTaskUrl != null) { taskReviewsMap.remove(oldTaskUrl, reviewUrl); } } }</code><technical_language>Code double spaced</technical_language>

Target:
private void updateMapping(String reviewUrl, String reviewDescription) { String oldTaskUrl = getTaskUrl(reviewUrl); String newTaskUrl = this.extractTaskUrl(reviewDescription); if (newTaskUrl == null && oldTaskUrl != null) { taskReviewsMap.remove(oldTaskUrl, reviewUrl); } else if (newTaskUrl != null) { if (oldTaskUrl != null && !oldTaskUrl.equals(newTaskUrl)) { taskReviewsMap.remove(oldTaskUrl, reviewUrl); } if (newTaskUrl != null) { taskReviewsMap.put(newTaskUrl, reviewUrl); } } }
Source:
<code>private boolean initQcowCompat(Guid storagePoolId, Guid storageDomainId, Guid diskId, Guid volumeId, DiskImage newDiskImage) { if (newDiskImage.getVolumeFormat().equals(VolumeFormat.COW)) { StoragePool sp = storagePoolDao.get(storagePoolId); QemuImageInfo qemuImageInfo = null; if (sp != null && FeatureSupported.qcowCompatSupported(sp.getCompatibilityVersion())) { qemuImageInfo = ImagesHandler.getQemuImageInfoFromVdsm(storagePoolId, storageDomainId, diskId, volumeId, null, <START> false); <END> } if (qemuImageInfo == null) { getQueryReturnValue().setExceptionString("Failed to fetch qemu image info from storage"); return false; } newDiskImage.setQcowCompat(qemuImageInfo.getQcowCompat()); } return true; }</code><technical_language>is this work prepare/teardown? perform operation safely in flow</technical_language>

Target:
private boolean initQcowCompat(Guid storagePoolId, Guid storageDomainId, Guid diskId, Guid volumeId, DiskImage newDiskImage) { if (newDiskImage.getVolumeFormat().equals(VolumeFormat.COW)) { StoragePool sp = storagePoolDao.get(storagePoolId); QemuImageInfo qemuImageInfo = null; if (sp != null && FeatureSupported.qcowCompatSupported(sp.getCompatibilityVersion())) { qemuImageInfo = ImagesHandler.getQemuImageInfoFromVdsm(storagePoolId, storageDomainId, diskId, volumeId, null, true); if (qemuImageInfo == null) { getQueryReturnValue().setExceptionString("Failed to fetch qemu image info from storage"); return false; } newDiskImage.setQcowCompat(qemuImageInfo.getQcowCompat()); } } return true; }
Source:
<code>boolean nextImpl() { row = null; if (result != null && result.next()) { int columnCount = result.getVisibleColumnCount(); Value[] currentRow = result.currentRow(); values = new Value[columnCount]; <START> System.arraycopy(currentRow, 0, values, 0, columnCount); <END> } else { values = null; } return values != null; }</code><technical_language>Arrays.copyOf(T[], int) is a choice here</technical_language>

Target:
boolean nextImpl() { row = null; if (result != null && result.next()) { int columnCount = result.getVisibleColumnCount(); Value[] currentRow = result.currentRow(); values = Arrays.copyOf(currentRow, columnCount); } else { values = null; } return values != null; }
Source:
<code>public SwitchToBroker canSwitchToBroker() { final String packageName = mContext.getPackageName(); boolean switchToBrokerFlag = AuthenticationSettings.INSTANCE.getUseBroker() && checkAccount(mAcctManager, "", "") && !packageName.equalsIgnoreCase(AuthenticationSettings.INSTANCE.getBrokerPackageName()) && !packageName.equalsIgnoreCase(AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) && verifyAuthenticator(mAcctManager); if (!switchToBrokerFlag) { return SwitchToBroker.CANNOT_SWITCH_TO_BROKER; <START> } else { <END> try { verifyBrokerPermissionsAPI23AndHigher(); } catch (final UsageAuthenticationException exception) { return SwitchToBroker.NEED_PERMISSIONS_TO_SWITCH_TO_BROKER; } return SwitchToBroker.CAN_SWITCH_TO_BROKER; } }</code><technical_language>else [](start = 10, length = 4) dont need this else statement return if #Closed</technical_language>

Target:
public SwitchToBroker canSwitchToBroker() { final String packageName = mContext.getPackageName(); boolean switchToBrokerFlag = AuthenticationSettings.INSTANCE.getUseBroker() && checkAccount(mAcctManager, "", "") && !packageName.equalsIgnoreCase(AuthenticationSettings.INSTANCE.getBrokerPackageName()) && !packageName.equalsIgnoreCase(AuthenticationConstants.Broker.AZURE_AUTHENTICATOR_APP_PACKAGE_NAME) && verifyAuthenticator(mAcctManager); if (!switchToBrokerFlag) { return SwitchToBroker.CANNOT_SWITCH_TO_BROKER; } try { verifyBrokerPermissionsAPI23AndHigher(); } catch (final UsageAuthenticationException exception) { return SwitchToBroker.NEED_PERMISSIONS_TO_SWITCH_TO_BROKER; } return SwitchToBroker.CAN_SWITCH_TO_BROKER; }
Source:
<code>private Set<IArtifactType> getAllArtTypes() { Set<IArtifactType> allArtTypes = new HashSet<>(); if (artifactTypes == null || !artifactTypes.isEmpty()) { <START> allArtTypes.addAll(artifactTypes); <END> } else { getArtifactTypesFromWorkItemTypes(); } return allArtTypes; }</code><technical_language>add 'null' allArtTypes</technical_language>

Target:
private Set<IArtifactType> getAllArtTypes() { Set<IArtifactType> allArtTypes = new HashSet<>(); if (artifactTypes != null || !artifactTypes.isEmpty()) { allArtTypes.addAll(artifactTypes); } else { allArtTypes = getArtifactTypesFromWorkItemTypes(); } return allArtTypes; }
Source:
<code>public void testCompute() throws Exception { String testTaskName = "testTask"; int executions = 5; startCollectStatistics(); IgniteRunnable task = new IgniteRunnable() { @Override public void run() { } }; for (int i = 0; i < executions; i++) ignite.compute().withName(testTaskName).run(task); HashMap<IgniteUuid, Integer> sessions = new HashMap<>(); AtomicInteger tasks = new AtomicInteger(); AtomicInteger jobs = new AtomicInteger(); stopCollectStatisticsAndRead(new TestHandler() { @Override public void task(UUID nodeId, IgniteUuid sesId, String taskName, long startTime, long duration, int affPartId) { sessions.compute(sesId, (uuid, val) -> val == null ? 1 : ++val); tasks.incrementAndGet(); assertEquals(ignite.context().localNodeId(), nodeId); assertEquals(testTaskName, taskName); assertTrue(startTime > 0); assertTrue(duration >= 0); assertEquals(-1, affPartId); } @Override public void job(UUID nodeId, IgniteUuid sesId, long queuedTime, long startTime, long duration, <START> boolean timedOut) { <END> sessions.compute(sesId, (uuid, val) -> val == null ? 1 : ++val); jobs.incrementAndGet(); assertEquals(ignite.context().localNodeId(), nodeId); assertTrue(queuedTime >= 0); assertTrue(startTime > 0); assertTrue(duration >= 0); assertFalse(timedOut); } }); assertEquals(executions, tasks.get()); assertEquals(executions, jobs.get()); Collection<Integer> vals = sessions.values(); assertEquals(executions, vals.size()); assertTrue("Invalid sessions: " + sessions, vals.stream().allMatch(val -> val == 2)); }</code><technical_language>Typo: formatting</technical_language>

Target:
public void testCompute() throws Exception { String testTaskName = "testTask"; int executions = 5; long startTime = U.currentTimeMillis(); startCollectStatistics(); IgniteRunnable task = new IgniteRunnable() { @Override public void run() { } }; for (int i = 0; i < executions; i++) node.compute().withName(testTaskName).run(task); HashMap<IgniteUuid, Integer> sessions = new HashMap<>(); AtomicInteger tasks = new AtomicInteger(); AtomicInteger jobs = new AtomicInteger(); stopCollectStatisticsAndRead(new TestHandler() { @Override public void task(UUID nodeId, IgniteUuid sesId, String taskName, long taskStartTime, long duration, int affPartId) { sessions.compute(sesId, (uuid, cnt) -> cnt == null ? 1 : ++cnt); tasks.incrementAndGet(); assertEquals(node.context().localNodeId(), nodeId); assertEquals(testTaskName, taskName); assertTrue(taskStartTime >= startTime); assertTrue(duration >= 0); assertEquals(-1, affPartId); } @Override public void job(UUID nodeId, IgniteUuid sesId, long queuedTime, long jobStartTime, long duration, boolean timedOut) { sessions.compute(sesId, (uuid, cnt) -> cnt == null ? 1 : ++cnt); jobs.incrementAndGet(); assertEquals(srv.context().localNodeId(), nodeId); assertTrue(queuedTime >= 0); assertTrue(jobStartTime >= startTime); assertTrue(duration >= 0); assertFalse(timedOut); } }); assertEquals(executions, tasks.get()); assertEquals(executions, jobs.get()); Collection<Integer> vals = sessions.values(); assertEquals(executions, vals.size()); assertTrue("Invalid sessions: " + sessions, vals.stream().allMatch(cnt -> cnt == NODES_CNT)); }
Source:
<code>private int getSelectionValue(long time) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID); if (ssq == null) { continue; } if (time >= ssq.getStartTime() && time <= ssq.getCurrentEndTime()) { List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); for (int currentThreadQuark : currentThreadQuarks) { try { ITmfStateInterval currentThreadInterval = ssq.querySingleState(time, currentThreadQuark); int currentThread = currentThreadInterval.getStateValue().unboxInt(); if (currentThread > 0) { int statusQuark = ssq.optQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThread)); if (statusQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { continue; } ITmfStateInterval statusInterval = ssq.querySingleState(time, statusQuark); if (statusInterval.getStartTime() == time) { return currentThread; } } } catch (TimeRangeException | StateValueTypeException e) { Activator.getDefault().logError(e.getMessage()); } catch (StateSystemDisposedException e) { } } } } <START> return -1; <END> }</code><technical_language>a /** * thread is found, return a OS return */ private static final int NO_THREAD_FOUND = -1;</technical_language>

Target:
private int getSelectionValue(long time) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { ITmfStateSystem ssq = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID); if (ssq == null) { continue; } if (time >= ssq.getStartTime() && time <= ssq.getCurrentEndTime()) { List<Integer> currentThreadQuarks = ssq.getQuarks(Attributes.CPUS, "*", Attributes.CURRENT_THREAD); for (int currentThreadQuark : currentThreadQuarks) { try { ITmfStateInterval currentThreadInterval = ssq.querySingleState(time, currentThreadQuark); int currentThread = currentThreadInterval.getStateValue().unboxInt(); if (currentThread > 0) { int statusQuark = ssq.optQuarkAbsolute(Attributes.THREADS, Integer.toString(currentThread)); if (statusQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { continue; } ITmfStateInterval statusInterval = ssq.querySingleState(time, statusQuark); if (statusInterval.getStartTime() == time) { return currentThread; } } } catch (TimeRangeException | StateValueTypeException e) { Activator.getDefault().logError(e.getMessage()); } catch (StateSystemDisposedException e) { } } } } return NO_THREAD_FOUND; }
Source:
<code>public MachineSet ensureExists(int count, ReusableMachineTemplate template) { MachineSet current; synchronized (this) { <START> current = all(matching(template)); <END> } if (current.size() >= count) return current; MachineSet moreNeeded = create(count-current.size(), template); return current.added(moreNeeded); }</code><technical_language>this synchronized. a volatile read covers. if need synchronized, imply other calls all() need synchronized?</technical_language>

Target:
public MachineSet ensureExists(int count, ReusableMachineTemplate template) { MachineSet current; current = all(matching(template)); if (current.size() >= count) return current; MachineSet moreNeeded = create(count-current.size(), template); return current.added(moreNeeded); }
Source:
<code>public JsonObject findDocument(String query, String sort) throws DataException { SearchRestClient restClient = initiateRestClient(); String response = restClient.getDocument(query, sort, 0, 1); <START> JsonReader jsonReader = Json.createReader(new StringReader(response)); <END> JsonObject jsonObject = jsonReader.readObject(); if (jsonObject.containsKey("hits")) { JsonObject hits = jsonObject.getJsonObject("hits"); JsonArray inHits = hits.getJsonArray("hits"); if (!inHits.isEmpty()) { return inHits.getJsonObject(0); } } else { return jsonObject; } return Json.createObjectBuilder().build(); }</code><technical_language>here. JsonReader is closeable a try-with-resources statement for closing object is a good idea</technical_language>

Target:
public JsonObject findDocument(String query, String sort) throws DataException { SearchRestClient restClient = initiateRestClient(); String response = restClient.getDocument(query, sort, 0, 1); try (JsonReader jsonReader = Json.createReader(new StringReader(response))) { JsonObject jsonObject = jsonReader.readObject(); if (jsonObject.containsKey("hits")) { JsonObject hits = jsonObject.getJsonObject("hits"); JsonArray inHits = hits.getJsonArray("hits"); if (!inHits.isEmpty()) { return inHits.getJsonObject(0); } } else { return jsonObject; } } return Json.createObjectBuilder().build(); }
Source:
<code>public Optional<Joinable> build(final DataSource dataSource, final JoinConditionAnalysis condition) { if (condition.canHashJoin() && dataSource instanceof InlineDataSource) { final InlineDataSource inlineDataSource = (InlineDataSource) dataSource; <START> final List<String> rightKeyColumns = condition.getRightKeyColumns(); <END> return Optional.of( new IndexedTableJoinable( new RowBasedIndexedTable<>( inlineDataSource.getRowsAsList(), inlineDataSource.rowAdapter(), inlineDataSource.getRowSignature(), rightKeyColumns ) ) ); } else { return Optional.empty(); } }</code><technical_language>do a similar simplification in LookupJoinMatcher (there's a part checks equikeys key column)</technical_language>

Target:
public Optional<Joinable> build(final DataSource dataSource, final JoinConditionAnalysis condition) { if (condition.canHashJoin() && dataSource instanceof InlineDataSource) { final InlineDataSource inlineDataSource = (InlineDataSource) dataSource; final Set<String> rightKeyColumns = condition.getRightEquiConditionKeys(); return Optional.of( new IndexedTableJoinable( new RowBasedIndexedTable<>( inlineDataSource.getRowsAsList(), inlineDataSource.rowAdapter(), inlineDataSource.getRowSignature(), rightKeyColumns ) ) ); } else { return Optional.empty(); } }
Source:
<code>public static String autoPreciseConvert(long size, SizeUnit inUnit) { String convertedSize = ""; while(size > 1024) { Pair<SizeUnit, Double> result = SizeConverter.autoConvert(size, inUnit); convertedSize = convertedSize.concat(result.getSecond().intValue() + " " + result.getFirst().toString() + " "); <START> long reminder = size - SizeConverter.convert(result.getSecond().longValue(), result.getFirst(), inUnit).longValue(); <END> size = reminder; } convertedSize = convertedSize.concat((((convertedSize != "") && (size > 0)) || ((convertedSize == "") && (size == 0))) ? (size + " " + inUnit) : ""); return convertedSize; }</code><technical_language>%s/reminder/remainder/g</technical_language>

Target:
public static String autoPreciseConvert(long size, SizeUnit inUnit) { String convertedSize = ""; while(size > 1024) { Pair<SizeUnit, Double> result = SizeConverter.autoConvert(size, inUnit); convertedSize = convertedSize.concat(result.getSecond().intValue() + " " + result.getFirst().toString() + " "); long remainder = size - SizeConverter.convert(result.getSecond().longValue(), result.getFirst(), inUnit).longValue(); size = remainder; } convertedSize = convertedSize.concat((((convertedSize != "") && (size > 0)) || ((convertedSize == "") && (size == 0))) ? (size + " " + inUnit) : ""); return convertedSize; }
Source:
<code>public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.DREW_CARD) { amountOfCardsDrawnThisTurn.putIfAbsent(event.getPlayerId(), 0); <START> amountOfCardsDrawnThisTurn.compute(event.getPlayerId(), (k, amount) -> amount += 1); <END> } }</code><technical_language>amount + 1 is enough. need mutate amount</technical_language>

Target:
public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.DREW_CARD) { amountOfCardsDrawnThisTurn.putIfAbsent(event.getPlayerId(), 0); amountOfCardsDrawnThisTurn.compute(event.getPlayerId(), (k, amount) -> amount + 1); } }
Source:
<code>public void setup(TaskConfig config, String taskName, Collector<OT> outputCollector, <START> AbstractInvokable parent, UserCodeClassLoader userCodeClassLoader, ExecutionConfig executionConfig, <END> Map<String, Accumulator<?,?>> accumulatorMap) { this.config = config; this.taskName = taskName; this.userCodeClassLoader = userCodeClassLoader; this.metrics = parent.getEnvironment().getMetricGroup().getOrAddOperator(taskName); this.numRecordsIn = this.metrics.getIOMetricGroup().getNumRecordsInCounter(); this.numRecordsOut = this.metrics.getIOMetricGroup().getNumRecordsOutCounter(); this.outputCollector = new CountingCollector<>(outputCollector, numRecordsOut); Environment env = parent.getEnvironment(); if (parent instanceof BatchTask) { this.udfContext = ((BatchTask<?, ?>) parent).createRuntimeContext(metrics); } else { this.udfContext = new DistributedRuntimeUDFContext(env.getTaskInfo(), userCodeClassLoader, parent.getExecutionConfig(), env.getDistributedCacheEntries(), accumulatorMap, metrics, env.getExternalResourceInfoProvider() ); } this.executionConfig = executionConfig; this.objectReuseEnabled = executionConfig.isObjectReuseEnabled(); setup(parent); }</code><technical_language>formatting</technical_language>

Target:
public void setup(TaskConfig config, String taskName, Collector<OT> outputCollector, AbstractInvokable parent, UserCodeClassLoader userCodeClassLoader, ExecutionConfig executionConfig, Map<String, Accumulator<?,?>> accumulatorMap) { this.config = config; this.taskName = taskName; this.userCodeClassLoader = userCodeClassLoader.asClassLoader(); this.metrics = parent.getEnvironment().getMetricGroup().getOrAddOperator(taskName); this.numRecordsIn = this.metrics.getIOMetricGroup().getNumRecordsInCounter(); this.numRecordsOut = this.metrics.getIOMetricGroup().getNumRecordsOutCounter(); this.outputCollector = new CountingCollector<>(outputCollector, numRecordsOut); Environment env = parent.getEnvironment(); if (parent instanceof BatchTask) { this.udfContext = ((BatchTask<?, ?>) parent).createRuntimeContext(metrics); } else { this.udfContext = new DistributedRuntimeUDFContext(env.getTaskInfo(), userCodeClassLoader, parent.getExecutionConfig(), env.getDistributedCacheEntries(), accumulatorMap, metrics, env.getExternalResourceInfoProvider() ); } this.executionConfig = executionConfig; this.objectReuseEnabled = executionConfig.isObjectReuseEnabled(); setup(parent); }
Source:
<code>private void stopConnector(String connName) { try (LoggingContext loggingContext = LoggingContext.forConnector(connName)) { WorkerConnector workerConnector = connectors.get(connName); if (workerConnector == null) { log.warn("Ignoring stop request for unowned connector {}", connName); return; } <START> log.info("Stopping connector {}", connName); <END> ClassLoader savedLoader = plugins.currentThreadLoader(); try { savedLoader = Plugins.compareAndSwapLoaders(workerConnector.loader()); workerConnector.shutdown(); } finally { Plugins.compareAndSwapLoaders(savedLoader); } } }</code><technical_language>advantage of bringing this log message here. Searching logs for Stopping connector miss cases of "unowned" connectors, making debugging potentially more challenging</technical_language>

Target:
private void stopConnector(String connName) { try (LoggingContext loggingContext = LoggingContext.forConnector(connName)) { WorkerConnector workerConnector = connectors.get(connName); log.info("Stopping connector {}", connName); if (workerConnector == null) { log.warn("Ignoring stop request for unowned connector {}", connName); return; } ClassLoader savedLoader = plugins.currentThreadLoader(); try { savedLoader = Plugins.compareAndSwapLoaders(workerConnector.loader()); workerConnector.shutdown(); } finally { Plugins.compareAndSwapLoaders(savedLoader); } } }
Source:
<code>public IStaticContentProvider getContentProvider(String propertyPath) { IStaticContentProvider provider = null; <START> ResourceSet resourceSet= getRoot(getEditedTable().getContext()).eResource().getResourceSet(); <END> if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "rowSources"); } else if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "columnSources"); } else if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { provider = new GenericRelationshipMatrixElementTypeContentProvider(getRoot(getEditedTable().getContext())); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { provider = new MatrixDirectionContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER_STRATEGY.equals(propertyPath)) { provider = new MatrixRelationshipOwnerStrategyContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER.equals(propertyPath)) { provider = new MatrixSourcesContentProvider(getRoot(getEditedTable().getContext())); } else { provider = super.getContentProvider(propertyPath); } return provider; }</code><technical_language>Please resource this line dupplicate in conditions blocks (This is for performance (in case resource set is needed))</technical_language>

Target:
public IStaticContentProvider getContentProvider(String propertyPath) { IStaticContentProvider provider = null; ResourceSet resourceSet= getRoot(getEditedTable().getContext()).eResource().getResourceSet(); if (MatrixPropertyConstants.MATRIX_ROW_SOURCES.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "rowSources"); } else if (MatrixPropertyConstants.MATRIX_COLUMN_SOURCES.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "columnSources"); } else if (MatrixPropertyConstants.MATRIX_CELL_TYPE.equals(propertyPath)) { provider = new GenericRelationshipMatrixElementTypeContentProvider(getRoot(getEditedTable().getContext())); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_DIRECTION.equals(propertyPath)) { provider = new MatrixDirectionContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER_STRATEGY.equals(propertyPath)) { provider = new MatrixRelationshipOwnerStrategyContentProvider(); } else if (MatrixPropertyConstants.MATRIX_RELATIONSHIP_OWNER.equals(propertyPath)) { provider = ProviderHelper.encapsulateProvider(ProviderHelper.getContentProvider(resourceSet), resourceSet, "relationshipOwner"); } else { provider = super.getContentProvider(propertyPath); } return provider; }
Source:
<code><START> public static Map<String, Object> getMapFrom( <END> @Nullable Map<String, Object> map, @Nullable String key, boolean required) { final Map<String, Object> m = JsonUtils.getObjectFrom(Map.class, map, key, false); return (m != null) ? m : Collections.emptyMap(); }</code><technical_language>required somehow</technical_language>

Target:
public static Map<String, Object> getMapFrom( @Nullable Map<String, Object> map, @Nullable String key, boolean required) { final Map<String, Object> m = JsonUtils.getObjectFrom(Map.class, map, key, required); return (m != null) ? m : Collections.emptyMap(); }
Source:
<code>private void UpdateActionAvailability() { List<PairQueryable<VdsNetworkInterface, VDS>> selectedItems = getSelectedItems() != null ? getSelectedItems() : new ArrayList(); <START> Version v31 = new Version(3, 1); <END> getSetupNetworksCommand().setIsExecutionAllowed(selectedItems.size() == 1 && selectedItems.get(0).getSecond().getvds_group_compatibility_version().compareTo(v31) < 0); }</code><technical_language>Version.v3_1 instead</technical_language>

Target:
private void UpdateActionAvailability() { List<PairQueryable<VdsNetworkInterface, VDS>> selectedItems = getSelectedItems() != null ? getSelectedItems() : new ArrayList(); getSetupNetworksCommand().setIsExecutionAllowed(selectedItems.size() == 1 && selectedItems.get(0).getSecond().getvds_group_compatibility_version().compareTo(Version.v3_1) >= 0); }
Source:
<code>public MarketDataBox<FxOptionVolatilities> build( FxOptionVolatilitiesId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData) { FxOptionVolatilitiesDefinition volatilitiesDefinition = marketDataConfig.get(FxOptionVolatilitiesDefinition.class, id.getName().getName()); ValuationZoneTimeDefinition zoneTimeDefinition = marketDataConfig.get(ValuationZoneTimeDefinition.class); int nScenarios = marketData.getScenarioCount(); MarketDataBox<LocalDate> valuationDates = marketData.getValuationDate(); MarketDataBox<ZonedDateTime> valuationDateTimes = zoneTimeDefinition.toZonedDateTime(valuationDates); int nParameters = volatilitiesDefinition.getParameterCount(); ImmutableList<MarketDataBox<Double>> inputs = volatilitiesDefinition.volatilitiesInputs().stream() .map(q -> marketData.getValue(q)) .collect(toImmutableList()); ImmutableList<FxOptionVolatilities> vols = IntStream.range(0, nScenarios) <START> .mapToObj(i -> volatilitiesDefinition.volatilities( <END> valuationDateTimes.getValue(i), DoubleArray.of(nParameters, n -> inputs.get(n).getValue(i)), refData)) .collect(toImmutableList()); return nScenarios > 1 ? MarketDataBox.ofScenarioValues(vols) : MarketDataBox.ofSingleValue(vols.get(0)); }</code><technical_language>i -> scenarioIndex</technical_language>

Target:
public MarketDataBox<FxOptionVolatilities> build( FxOptionVolatilitiesId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData) { FxOptionVolatilitiesDefinition volatilitiesDefinition = marketDataConfig.get(FxOptionVolatilitiesDefinition.class, id.getName().getName()); ValuationZoneTimeDefinition zoneTimeDefinition = marketDataConfig.get(ValuationZoneTimeDefinition.class); int nScenarios = marketData.getScenarioCount(); MarketDataBox<LocalDate> valuationDates = marketData.getValuationDate(); MarketDataBox<ZonedDateTime> valuationDateTimes = zoneTimeDefinition.toZonedDateTime(valuationDates); int nParameters = volatilitiesDefinition.getParameterCount(); ImmutableList<MarketDataBox<Double>> inputs = volatilitiesDefinition.volatilitiesInputs().stream() .map(q -> marketData.getValue(q)) .collect(toImmutableList()); ImmutableList<FxOptionVolatilities> vols = IntStream.range(0, nScenarios) .mapToObj(scenarioIndex -> volatilitiesDefinition.volatilities( valuationDateTimes.getValue(scenarioIndex), DoubleArray.of(nParameters, paramIndex -> inputs.get(paramIndex).getValue(scenarioIndex)), refData)) .collect(toImmutableList()); return nScenarios > 1 ? MarketDataBox.ofScenarioValues(vols) : MarketDataBox.ofSingleValue(vols.get(0)); }
Source:
<code>private void handleAssignmentChange() { List<String> assignment = _adapter.getInstanceAssignment(_adapter.getInstanceName()); LOG.info("START: Coordinator::handleAssignmentChange. Instance: " + _adapter.getInstanceName() + ", assignment: " + assignment); Map<String, List<DatastreamTask>> currentAssignment = new HashMap<>(); assignment.forEach(ds -> { DatastreamTask task = _adapter.getAssignedDatastreamTask(_adapter.getInstanceName(), ds); if (!currentAssignment.containsKey(task.getConnectorType())) { currentAssignment.put(task.getConnectorType(), new ArrayList<>()); } currentAssignment.get(task.getConnectorType()).add(task); }); LOG.info(printAssignmentByType(currentAssignment)); DatastreamContext context = new DatastreamContextImpl(_adapter); List<String> oldConnectorList = new ArrayList<>(); oldConnectorList.addAll(_allStreamsByConnectorType.keySet()); List<String> newConnectorList = new ArrayList<>(); newConnectorList.addAll(currentAssignment.keySet()); List<String> deactivated = new ArrayList<>(oldConnectorList); deactivated.removeAll(newConnectorList); deactivated.forEach(connectorType -> _connectors.get(connectorType).onAssignmentChange(context, new ArrayList<>())); newConnectorList.forEach(connectorType -> dispatchAssignmentChangeIfNeeded(connectorType, context, currentAssignment)); _allStreamsByConnectorType = currentAssignment; <START> LOG.info("END: Coordinator::handleAssignmentChange"); <END> }</code><technical_language>Do sense log long total assignmentChange call took</technical_language>

Target:
private void handleAssignmentChange() { long startAt = System.currentTimeMillis(); List<String> assignment = _adapter.getInstanceAssignment(_adapter.getInstanceName()); LOG.info("START: Coordinator::handleAssignmentChange. Instance: " + _adapter.getInstanceName() + ", assignment: " + assignment); Map<String, List<DatastreamTask>> currentAssignment = new HashMap<>(); assignment.forEach(ds -> { DatastreamTask task = _adapter.getAssignedDatastreamTask(_adapter.getInstanceName(), ds); if (!currentAssignment.containsKey(task.getConnectorType())) { currentAssignment.put(task.getConnectorType(), new ArrayList<>()); } currentAssignment.get(task.getConnectorType()).add(task); }); LOG.info(printAssignmentByType(currentAssignment)); DatastreamContext context = new DatastreamContextImpl(_adapter); List<String> oldConnectorList = new ArrayList<>(); oldConnectorList.addAll(_allStreamsByConnectorType.keySet()); List<String> newConnectorList = new ArrayList<>(); newConnectorList.addAll(currentAssignment.keySet()); List<String> deactivated = new ArrayList<>(oldConnectorList); deactivated.removeAll(newConnectorList); deactivated.forEach(connectorType -> _connectors.get(connectorType).onAssignmentChange(context, new ArrayList<>())); newConnectorList.forEach(connectorType -> dispatchAssignmentChangeIfNeeded(connectorType, context, currentAssignment)); _allStreamsByConnectorType = currentAssignment; long endAt = System.currentTimeMillis(); LOG.info(String.format("END: Coordinator::handleAssignmentChange, Duration: %d milliseconds", endAt - startAt)); }
Source:
<code>public void shouldCreateCorrectTokenForWorldpay3dsFlexDdc() { var validCredentials = Map.of( "issuer", "me", "organisational_unit_id", "myOrg", "jwt_mac_id", "fa2daee2-1fbb-45ff-4444-52805d5cd9e0" ); var gatewayAccount = new GatewayAccount(1L, WORLDPAY.toString(), validCredentials); var paymentCreationTime = ZonedDateTime.now(); String token = worldpay3dsFlexJwtService.generateDdcToken(gatewayAccount, paymentCreationTime); Jws<Claims> jws = Jwts.parser() .setSigningKey(new SecretKeySpec(validCredentials.get("jwt_mac_id").getBytes(), "HmacSHA256")) .parseClaimsJws(token); assertThat(jws.getHeader().getAlgorithm(), is("HS256")); assertThat(jws.getHeader().get("typ"), is("JWT")); assertThat(jws.getBody().get("jti"), is (notNullValue())); assertThat(jws.getBody().get("iat"), is (notNullValue())); <START> assertThat(jws.getBody().get("exp"), is (paymentCreationTime.plusSeconds(tokenExpiryDurationSeconds).toInstant().toEpochMilli())); <END> assertThat(jws.getBody().get("iss"), is(validCredentials.get("issuer"))); assertThat(jws.getBody().get("OrgUnitId"), is(validCredentials.get("organisational_unit_id"))); }</code><technical_language>I more thinking if actual epoch millisecond test outputted of completely wrong format copy-pasted tests in future. I a big deal in this case, java.time libraries</technical_language>

Target:
public void shouldCreateCorrectTokenForWorldpay3dsFlexDdc() { var validCredentials = Map.of( "issuer", "me", "organisational_unit_id", "myOrg", "jwt_mac_id", "fa2daee2-1fbb-45ff-4444-52805d5cd9e0" ); var gatewayAccount = new GatewayAccount(1L, WORLDPAY.toString(), validCredentials); int paymentCreationTimeEpochSeconds19August2029 = 1881821916; int expectedTokenExpirationTimeEpochSeconds = paymentCreationTimeEpochSeconds19August2029 + tokenExpiryDurationSeconds; var paymentCreationZonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochSecond((long) paymentCreationTimeEpochSeconds19August2029), UTC); String token = worldpay3dsFlexJwtService.generateDdcToken(gatewayAccount, paymentCreationZonedDateTime); Jws<Claims> jws = Jwts.parser() .setSigningKey(new SecretKeySpec(validCredentials.get("jwt_mac_id").getBytes(), "HmacSHA256")) .parseClaimsJws(token); assertThat(jws.getHeader().getAlgorithm(), is("HS256")); assertThat(jws.getHeader().get("typ"), is("JWT")); assertThat(jws.getBody().get("jti"), is(notNullValue())); assertThat(jws.getBody().get("iat"), is(notNullValue())); assertThat(jws.getBody().get("exp"), is(expectedTokenExpirationTimeEpochSeconds)); assertThat(jws.getBody().get("iss"), is(validCredentials.get("issuer"))); assertThat(jws.getBody().get("OrgUnitId"), is(validCredentials.get("organisational_unit_id"))); }
Source:
<code>private static void updateDistinctCountHllExpr(Expression expr, int hllLog2mOverride) { if (expr == null || expr.getFunctionCall() == null) { return; } Function functionCall = expr.getFunctionCall(); try { switch (AggregationFunctionType.getAggregationFunctionType(functionCall.getOperator())) { case DISTINCTCOUNTHLL: case DISTINCTCOUNTHLLMV: case DISTINCTCOUNTRAWHLL: case DISTINCTCOUNTRAWHLLMV: if (functionCall.getOperandsSize() == 1) { functionCall.addToOperands(RequestUtils.getLiteralExpression(hllLog2mOverride)); } return; } } catch (Exception e) { } <START> if (functionCall.getOperandsSize() > 0) { <END> for (Expression operand : functionCall.getOperands()) { updateDistinctCountHllExpr(operand, hllLog2mOverride); } } }</code><technical_language>(nit) This check is redundant</technical_language>

Target:
private static void updateDistinctCountHllExpr(Expression expr, int hllLog2mOverride) { Function functionCall = expr.getFunctionCall(); if (functionCall == null) { return; } switch (functionCall.getOperator()) { case "DISTINCTCOUNTHLL": case "DISTINCTCOUNTHLLMV": case "DISTINCTCOUNTRAWHLL": case "DISTINCTCOUNTRAWHLLMV": if (functionCall.getOperandsSize() == 1) { functionCall.addToOperands(RequestUtils.getLiteralExpression(hllLog2mOverride)); } return; } if (functionCall.getOperandsSize() > 0) { for (Expression operand : functionCall.getOperands()) { updateDistinctCountHllExpr(operand, hllLog2mOverride); } } }
Source:
<code>protected void startCacheCreationThread(final T artifactLocation) { boolean inserted = pendingCacheFiles.add(artifactLocation); if (inserted) { Thread cacheCreatorThread = new Thread("cache-creator-thread-" + UUID.randomUUID().toString()) { public void run() { try { createCachedFile(artifactLocation); } catch (Exception e) { <START> LOG.error(String.format("An error occurred while trying to create the artifact zip file of directory '%s'", artifactLocation), e); <END> pendingExceptions.putIfAbsent(artifactLocation, e); } finally { pendingCacheFiles.remove(artifactLocation); } } }; cacheCreatorThread.start(); } }</code><technical_language>slf4j paramerized logging <LINK_0></technical_language>

Target:
protected long startCacheCreationThread(final T artifactLocation) throws InterruptedException { boolean inserted = pendingCacheFiles.add(artifactLocation); Thread cacheCreatorThread = new Thread("cache-creator-thread-" + UUID.randomUUID().toString()) { public void run() { try { createCachedFile(artifactLocation); } catch (Exception e) { LOG.error("An error occurred while trying to create the artifact zip file of directory {}", artifactLocation, e); pendingExceptions.putIfAbsent(artifactLocation, e); } finally { pendingCacheFiles.remove(artifactLocation); } } }; if (inserted) { cacheCreatorThread.start(); } return cacheCreatorThread.getId(); }
Source:
<code>private Mono<HermesResponse> publishWithRetries(HermesMessage message) { currentlySending.incrementAndGet(); Retry retry = prepareRetry(message); <START> return sendOnce(message) <END> .flatMap(response -> getNextAttempt() .map(attempt -> { if (retryCondition.test(response)) { return Result.failure(new ShouldRetryException(response), attempt); } else { return Result.attempt(response, attempt); } }) ) .onErrorResume(throwable -> getNextAttempt().map(attempt -> Result.failure(throwable, attempt))) .subscribeOn(scheduler) .flatMap(result -> { if (result instanceof Failed) { Failed failed = (Failed) result; return Mono.error(new RetryFailedException(failed.attempt, failed.cause)); } else { return Mono.just((Attempt) result); } }) .retryWhen(retry) .subscriberContext(ctx -> ctx.put(RETRY_CONTEXT_KEY, HermesRetryContext.emptyRetryContext())) .onErrorResume(Exception.class, exception -> { if (isRetryExhausted(exception)) { RetryFailedException rfe = (RetryFailedException) (exception.getCause()); handleMaxRetriesExceeded(message, rfe.attempt); Throwable cause = rfe.getCause(); if (cause instanceof ShouldRetryException) { ShouldRetryException sre = (ShouldRetryException) cause; return Mono.just((Attempt) Result.attempt(sre.hermesResponse, rfe.attempt)); } handleFailure(message, rfe.getAttempt()); } return Mono.error(exception); }) .doOnSuccess(hr -> { if (hr.response.isSuccess()) { handleSuccessfulRetry(message, hr.getAttempt()); } else { handleFailure(message, hr.getAttempt()); } }) .map(result -> result.response) .doFinally(s -> currentlySending.decrementAndGet()); }</code><technical_language>this chain is huuge ;) divide smaller parts ? I of them: 1. attempt result based response 2. mapping results Mono (with result exception in case of failed result) 3. handling exhausted retries</technical_language>

Target:
private Mono<HermesResponse> publishWithRetries(HermesMessage message) { currentlySending.incrementAndGet(); Mono<Result> sendOnceResult = sendOnce(message) .flatMap(this::testRetryCondition) .onErrorResume(exception -> mapExceptionToFailedAttempt(exception, message)) .subscribeOn(scheduler); return retry(sendOnceResult) .doOnSuccess(hr -> { if (hr.response.isSuccess() || !hr.matchesRetryPolicy) { handleSuccessfulRetry(hr.response, hr.attempt); } else { handleFailure(hr.response, hr.attempt); } }) .map(result -> result.response) .doFinally(s -> currentlySending.decrementAndGet()); }
Source:
<code>public void setModelRepository(ModelRepository modelRepo) { this.modelRepo = modelRepo; <START> modelRepo.addModelRepositoryChangeListener(this); <END> refreshSitemapModels(); }</code><technical_language>This potentially lead callbacks this component is activated. do care today activation state in this component, I prefer add listener in activate method (to created) only</technical_language>

Target:
public void setModelRepository(ModelRepository modelRepo) { this.modelRepo = modelRepo; }
Source:
<code>public void testMultipleScalingUnit() throws Exception { final int SCALING_UNITS = 3; Properties props = getNonBlockingRouterProperties(); props.setProperty("router.scaling.unit.count", Integer.toString(SCALING_UNITS)); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); MockTime mockTime = new MockTime(); router = new NonBlockingRouter(new RouterConfig(verifiableProperties), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(verifiableProperties, null, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, new MockServerLayout(mockClusterMap), mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); assertExpectedThreadCounts(SCALING_UNITS); <START> for (int i = 0; i < SCALING_UNITS * 10; i++) { <END> BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); byte[] putUserMetadata = new byte[10]; random.nextBytes(putUserMetadata); byte[] putContent = new byte[100]; random.nextBytes(putContent); ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); router.putBlob(putBlobProperties, putUserMetadata, putChannel).get(); } router.close(); assertExpectedThreadCounts(0); BlobProperties putBlobProperties = new BlobProperties(100, "serviceId", "memberId", "contentType", false, Utils.Infinite_Time); byte[] putUserMetadata = new byte[10]; random.nextBytes(putUserMetadata); byte[] putContent = new byte[100]; random.nextBytes(putContent); ReadableStreamChannel putChannel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(putContent)); Future<String> future = router.putBlob(putBlobProperties, putUserMetadata, putChannel); Assert.assertTrue(future.isDone()); RouterException e = (RouterException) ((FutureResult<String>) future).error(); Assert.assertEquals(e.getErrorCode(), RouterErrorCode.RouterClosed); }</code><technical_language>is purpose of this test? I feel goals clear, achieved methodology is deterministic</technical_language>

Target:
public void testMultipleScalingUnit() throws Exception { final int SCALING_UNITS = 3; Properties props = getNonBlockingRouterProperties(); props.setProperty("router.scaling.unit.count", Integer.toString(SCALING_UNITS)); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); MockTime mockTime = new MockTime(); router = new NonBlockingRouter(new RouterConfig(verifiableProperties), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(verifiableProperties, null, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, new MockServerLayout(mockClusterMap), mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); assertExpectedThreadCounts(SCALING_UNITS); for (int i = 0; i < SCALING_UNITS * 10; i++) { setOperationParams(); router.putBlob(putBlobProperties, putUserMetadata, putChannel).get(); } router.close(); assertExpectedThreadCounts(0); setOperationParams(); assertClosed(); }
Source:
<code>public void advanceMapScrollSpeed() { mapScrollSpeed++; <START> if(mapScrollSpeed > 10) { <END> mapScrollSpeed = 1; } }</code><technical_language>suggestion if (mapScrollSpeed > 10) {</technical_language>

Target:
public void advanceMapScrollSpeed() { mapScrollSpeed++; if (mapScrollSpeed > 15) { mapScrollSpeed = 1; } }
Source:
<code>public ModelAndView getQuestionsByCategory(@PathVariable String urlTag, @RequestParam(value = "index", defaultValue = "1", required = false) int index) { Tag tag; try { tag = Tag.valueOf(urlTag.toUpperCase()); } catch (Exception e) { <START> ModelAndView modelAndView = new ModelAndView("error/404"); <END> modelAndView.addObject("errorPage","true"); return modelAndView; } ModelAndView modelAndView = new ModelAndView("/question-category"); modelAndView.addObject("questions", questionService.findByTag(LoginUserInfo.getLoginName(), tag, index, 10)); modelAndView.addObject("tag", tag); return modelAndView; }</code><technical_language>/error/404</technical_language>

Target:
public ModelAndView getQuestionsByCategory(@PathVariable String urlTag, @RequestParam(value = "index", defaultValue = "1", required = false) int index) { Tag tag; try { tag = Tag.valueOf(urlTag.toUpperCase()); } catch (Exception e) { ModelAndView modelAndView = new ModelAndView("/error/404"); modelAndView.addObject("errorPage","true"); return modelAndView; } ModelAndView modelAndView = new ModelAndView("/question-category"); modelAndView.addObject("questions", questionService.findByTag(LoginUserInfo.getLoginName(), tag, index, 10)); modelAndView.addObject("tag", tag); return modelAndView; }
Source:
<code>public void addGroupMember(String groupName, String member) { List<IPersonAttributesGroupDefinition> groups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(groupName); List<IPersonAttributesGroupDefinition> attemptingToAddMembers = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(member); if (groups.isEmpty() || attemptingToAddMembers.isEmpty()) { throw new RuntimeException("Group: " + groupName + " or member: " + member + " does not exist"); } else { <START> IPersonAttributesGroupDefinition group = groups.get(0); <END> IPersonAttributesGroupDefinition attemptingToAddMember = attemptingToAddMembers.get(0); List<IPersonAttributesGroupDefinition> groupMembers = group.getMembers(); for (IPersonAttributesGroupDefinition groupMember : groupMembers) { if (groupMember.getName().equalsIgnoreCase(attemptingToAddMember.getName())) { return; } } groupMembers.add(attemptingToAddMember); group.setMembers(groupMembers); personAttributesGroupDefinitionDao.updatePersonAttributesGroupDefinition(group); } }</code><technical_language>Undetected error condition multiple groups matched groupName</technical_language>

Target:
public void addGroupMember(String groupName, String member) { Set<IPersonAttributesGroupDefinition> groups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(groupName); Set<IPersonAttributesGroupDefinition> attemptingToAddMembers = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(member); if (groups.isEmpty() || attemptingToAddMembers.isEmpty()) { throw new RuntimeException("Group: " + groupName + " or member: " + member + " does not exist"); } else { IPersonAttributesGroupDefinition group = groups.iterator().next(); IPersonAttributesGroupDefinition attemptingToAddMember = attemptingToAddMembers.iterator().next(); Set<IPersonAttributesGroupDefinition> groupMembers = group.getMembers(); for (IPersonAttributesGroupDefinition groupMember : groupMembers) { if (groupMember.getName().equalsIgnoreCase(attemptingToAddMember.getName())) { return; } } groupMembers.add(attemptingToAddMember); group.setMembers(groupMembers); personAttributesGroupDefinitionDao.updatePersonAttributesGroupDefinition(group); } }
Source:
<code>private void parseFeed(Repository repository, PackageFeed packageFeed) throws IOException { String repositoryId = repository.getId(); String storageId = repository.getStorage().getId(); ArtifactTag lastVersionTag = artifactTagService.findOneOrCreate(ArtifactTagEntry.LAST_VERSION); Set<ArtifactEntry> artifactToSaveSet = new HashSet<>(); for (PackageVersion packageVersion : packageFeed.getVersions().getAdditionalProperties().values()) { RemoteArtifactEntry remoteArtifactEntry = parseVersion(storageId, repositoryId, packageVersion); if (remoteArtifactEntry == null) { continue; } if (packageVersion.getVersion().equals(packageFeed.getDistTags().getLatest())) { remoteArtifactEntry.getTagSet().add(lastVersionTag); } artifactToSaveSet.add(remoteArtifactEntry); } for (ArtifactEntry e : artifactToSaveSet) { RepositoryPath repositoryPath = repositoryPathResolver.resolve(repository).resolve(e); <START> saveAritafctEntry(repositoryPath); <END> } }</code><technical_language>a typo in this method's name. called saveArtifactEntry</technical_language>

Target:
private void parseFeed(Repository repository, PackageFeed packageFeed) { try { parseFeedTransactional(repository, packageFeed); } catch (Exception e) { logger.error(String.format("Failed to parse NPM feed [%s/%s]", repository.getRemoteRepository().getUrl(), packageFeed.getName()), e); } }