auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void ExecuteVmCommand() { AddCustomValue("InterfaceType", (VmInterfaceType.forValue(getParameters().getInterface().getType()).getInterfaceTranslation()).toString()); this.setVmName(DbFacade.getInstance().getVmStaticDAO().get(getParameters().getVmId()).getvm_name()); if (StringUtils.isEmpty(getMacAddress())) { getParameters().getInterface().setMacAddress(MacPoolManager.getInstance().allocateNewMac()); } getParameters().getInterface().setSpeed( VmInterfaceType.forValue( getParameters().getInterface().getType()).getSpeed()); getParameters().getInterface().setId(Guid.NewGuid()); getParameters().getInterface().setVmId(getParameters().getVmId()); DbFacade dbFacade = DbFacade.getInstance(); dbFacade .getVmNetworkInterfaceDAO() .save(getParameters().getInterface()); dbFacade .getVmNetworkStatisticsDAO() .save(getParameters().getInterface().getStatistics()); VmDevice vmDevice = VmDeviceUtils.addNetworkInterfaceDevice( new VmDeviceId(getParameters().getInterface().getId(), getParameters().getVmId()), getParameters().getInterface().isActive()); boolean succeded = true; VmDynamic vmDynamic = getVm().getDynamicData(); if (getParameters().getInterface().isActive() <START> && HotPlugUnplugVmNicCommand.isHotPlugNicAllowedForVmStatus(vmDynamic.getstatus())) { <END> succeded = hotPlugNic(vmDevice, vmDynamic); if (!succeded) { getReturnValue().getExecuteFailedMessages().add("Failed hot-plugging nic to VM"); } } setSucceeded(succeded); }</code><technical_language>Consider moving static method VmHandler</technical_language>

Target:
protected void ExecuteVmCommand() { AddCustomValue("InterfaceType", (VmInterfaceType.forValue(getParameters().getInterface().getType()).getInterfaceTranslation()).toString()); this.setVmName(DbFacade.getInstance().getVmStaticDAO().get(getParameters().getVmId()).getvm_name()); if (StringUtils.isEmpty(getMacAddress())) { getParameters().getInterface().setMacAddress(MacPoolManager.getInstance().allocateNewMac()); } getParameters().getInterface().setSpeed( VmInterfaceType.forValue( getParameters().getInterface().getType()).getSpeed()); getParameters().getInterface().setId(Guid.NewGuid()); getParameters().getInterface().setVmId(getParameters().getVmId()); DbFacade dbFacade = DbFacade.getInstance(); dbFacade .getVmNetworkInterfaceDAO() .save(getParameters().getInterface()); dbFacade .getVmNetworkStatisticsDAO() .save(getParameters().getInterface().getStatistics()); VmDevice vmDevice = VmDeviceUtils.addNetworkInterfaceDevice( new VmDeviceId(getParameters().getInterface().getId(), getParameters().getVmId()), getParameters().getInterface().isActive()); boolean succeded = true; VmDynamic vmDynamic = getVm().getDynamicData(); if (getParameters().getInterface().isActive() && VmHandler.isHotPlugNicAllowedForVmStatus(vmDynamic.getstatus())) { succeded = hotPlugNic(vmDevice, vmDynamic); if (!succeded) { getReturnValue().getExecuteFailedMessages().add("Failed hot-plugging nic to VM"); } } setSucceeded(succeded); }
Source:
<code>public static APIRevisionListDTO fromListAPIRevisiontoDTO(List<APIRevision> apiRevisionList) throws APIManagementException { APIRevisionListDTO apiRevisionListDTO = new APIRevisionListDTO(); List<APIRevisionDTO> apiRevisionDTOS = new ArrayList<>(); <START> int count = 0; for (APIRevision apiRevision: apiRevisionList) { count++; apiRevisionDTOS.add(fromAPIRevisiontoDTO(apiRevision)); } apiRevisionListDTO.setCount(count); <END> apiRevisionListDTO.setList(apiRevisionDTOS); return apiRevisionListDTO; }</code><technical_language>suggestion for (APIRevision apiRevision: apiRevisionList) { apiRevisionDTOS.add(fromAPIRevisiontoDTO(apiRevision)); } apiRevisionListDTO.setCount(apiRevisionList.size());</technical_language>

Target:
public static APIRevisionListDTO fromListAPIRevisiontoDTO(List<APIRevision> apiRevisionList) throws APIManagementException { APIRevisionListDTO apiRevisionListDTO = new APIRevisionListDTO(); List<APIRevisionDTO> apiRevisionDTOS = new ArrayList<>(); for (APIRevision apiRevision: apiRevisionList) { apiRevisionDTOS.add(fromAPIRevisiontoDTO(apiRevision)); } apiRevisionListDTO.setCount(apiRevisionList.size()); apiRevisionListDTO.setList(apiRevisionDTOS); return apiRevisionListDTO; }
Source:
<code>public void shouldPassWhenBuildingSettlementInMainStageOnlyAfterDiceThrown() throws GameException, PlayException { hex_0_0.getEdges().getTopRight().setBuilding(new Building<EdgeBuiltType>(EdgeBuiltType.ROAD, gameUser1)); gameUser1.setResources(new Resources(1, 1, 1, 1, 0)); game.setStage(GameStage.MAIN); game.setDiceThrown(false); allowUserToThrowDice(gameUser1); <START> when(gameDao.getGameByGameId(1)).thenReturn(game); <END> when(gameDao.getGameByGameId(1)).thenReturn(game); HashMap<String, String> params = new HashMap<String, String>(); params.put("nodeId", "3"); try { playService.processAction(GameUserActionCode.BUILD_SETTLEMENT, gameUser1.getUser(), "1", params); fail("Exception should be thrown should be thrown"); } catch (PlayException e) { assertEquals(PlayServiceImpl.ERROR_CODE_ERROR, e.getErrorCode()); } catch (Exception e) { fail("No other exceptions should be thrown"); } playService.processAction(GameUserActionCode.THROW_DICE, gameUser1.getUser(), "1"); playService.processAction(GameUserActionCode.BUILD_SETTLEMENT, gameUser1.getUser(), "1", params); assertNotNull(game); assertNotNull(hex_0_0); assertNotNull(hex_0_0.getNodes().getTopRight()); assertNotNull(hex_0_0.getNodes().getTopRight().getBuilding()); assertEquals(hex_0_0.getNodes().getTopRight().getBuilding().getBuilt(), NodeBuiltType.SETTLEMENT); assertEquals(hex_0_0.getNodes().getTopRight().getBuilding().getBuildingOwner(), gameUser1); }</code><technical_language>duplicates next row?)</technical_language>

Target:
public void shouldPassWhenBuildingSettlementInMainStageOnlyAfterDiceThrown() throws GameException, PlayException { hex_0_0.getEdges().getTopRight().setBuilding(new Building<EdgeBuiltType>(EdgeBuiltType.ROAD, gameUser1)); gameUser1.setResources(new Resources(1, 1, 1, 1, 0)); game.setStage(GameStage.MAIN); game.setDiceThrown(false); allowUserToThrowDice(gameUser1); when(gameDao.getGameByGameId(1)).thenReturn(game); Map<String, String> params = new HashMap<String, String>(); params.put("nodeId", "3"); try { playService.processAction(GameUserActionCode.BUILD_SETTLEMENT, gameUser1.getUser(), "1", params); fail("Exception should be thrown should be thrown"); } catch (PlayException e) { assertEquals(PlayServiceImpl.ERROR_CODE_ERROR, e.getErrorCode()); } catch (Exception e) { fail("No other exceptions should be thrown"); } playService.processAction(GameUserActionCode.THROW_DICE, gameUser1.getUser(), "1"); playService.processAction(GameUserActionCode.BUILD_SETTLEMENT, gameUser1.getUser(), "1", params); assertNotNull(game); assertNotNull(hex_0_0); assertNotNull(hex_0_0.getNodes().getTopRight()); assertNotNull(hex_0_0.getNodes().getTopRight().getBuilding()); assertEquals(hex_0_0.getNodes().getTopRight().getBuilding().getBuilt(), NodeBuiltType.SETTLEMENT); assertEquals(hex_0_0.getNodes().getTopRight().getBuilding().getBuildingOwner(), gameUser1); }
Source:
<code>public void testRetrieveAllUsers() throws Exception { <START> <END> String response = RestAssuredMockMvc.given() .contentType("application/json") .when() .get("/users/all") .peek() .then() .statusCode(200) .extract() .asString(); List<User> users = objectMapper.readValue(response, objectMapper.getTypeFactory().constructCollectionType(List.class, User.class)); assertNotNull(users); assertFalse(users.isEmpty()); users.forEach(user -> logger.debug("Retrieved " + user)); System.out.println(users); }</code><technical_language>remove this blank line</technical_language>

Target:
public void testRetrieveAllUsers() throws Exception { String response = given().contentType("application/json") .when() .get("/users/all") .peek() .then() .statusCode(200) .extract() .asString(); List<User> users = objectMapper.readValue(response, objectMapper.getTypeFactory().constructCollectionType(List.class, User.class)); assertNotNull(users); assertFalse(users.isEmpty()); users.forEach(user -> logger.debug("Retrieved " + user)); }
Source:
<code>public boolean canConfigure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { return project.getFile(PlatformConstants.FILE_XML_CONFIG).exists() || project.getFolder(PlatformConstants.DIR_WWW).getFile(PlatformConstants.FILE_XML_CONFIG).exists(); <START> } <END></code><technical_language>needs check existence of www folder. org.eclipse.thym.ui.internal.project.CanConvertToHybridTester.test(Object, String, Object[], Object)</technical_language>

Target:
public boolean canConfigure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { return shouldBeAnEclipseProject(project, monitor); }
Source:
<code>public static void cleanupSsoSession( SsoContext ssoContext, SsoSession ssoSession, Set<String> associateClientIds) { try { ssoContext.removeSsoSession(ssoSession.getAccessToken()); HttpSession existingSession = ssoSession.getHttpSession(); if (existingSession == null) { log.debug("No existing Session found for token: {}, cannot invalidate session", ssoSession.getAccessToken()); } else { log.debug("Existing Session found for token: {}, invalidating session", ssoSession.getAccessToken()); <START> existingSession.invalidate(); <END> } invokeAuthnLogout(ssoContext, ssoSession); SsoUtils.notifyClientsOfLogoutEvent(ssoContext, associateClientIds, ssoSession.getAccessToken()); } catch (IllegalStateException ex) { log.debug("Unable to cleanup SsoSession: {}", ex.getMessage()); } catch (Exception ex) { log.error("Unable to cleanup SsoSession: {}", ex.getMessage()); log.debug("Exception", ex); } }</code><technical_language>Hmm, safer catch IllegalStateException for this call instead of method? swallow IllegalStateException reasons? try { existingSession.invalidate(); } catch (IllegalStateException ex) { log.debug("Exception", ex); }</technical_language>

Target:
public static void cleanupSsoSession( SsoContext ssoContext, SsoSession ssoSession, Set<String> associateClientIds) { try { ssoContext.removeSsoSession(ssoSession.getAccessToken()); HttpSession existingSession = ssoSession.getHttpSession(); if (existingSession == null) { log.debug("No existing Session found for token: {}, cannot invalidate session", ssoSession.getAccessToken()); } else { log.debug("Existing Session found for token: {}, invalidating session", ssoSession.getAccessToken()); try { existingSession.invalidate(); } catch (IllegalStateException ex) { log.debug("Unable to cleanup SsoSession: {}", ex.getMessage()); } } invokeAuthnLogout(ssoContext, ssoSession); SsoUtils.notifyClientsOfLogoutEvent(ssoContext, associateClientIds, ssoSession.getAccessToken()); } catch (Exception ex) { log.error("Unable to cleanup SsoSession: {}", ex.getMessage()); log.debug("Exception", ex); } }
Source:
<code>private boolean isCountry(SimpleFeature feature) { return feature <START> .getAttribute(GeoCodingConstants.GEOMETRY_TYPE) <END> .equals(GeoCodingConstants.COUNTRY_TAG); }</code><technical_language>If feature.getAttribute(GeoCodingConstants.GEOMETRY_TYPE) exist SimpleFeature this throw NPE right? <LINK_0> refactored to... private boolean isCountry(SimpleFeature feature) { Object geoType = feature.getAttribute(GeoCodingConstants.GEOMETRY_TYPE) return GeoCodingConstants.COUNTRY_TAG).equals(geoType); }</technical_language>

Target:
private boolean isCountry(SimpleFeature feature) { return GeoCodingConstants.COUNTRY_TAG.equals( feature.getAttribute(GeoCodingConstants.GEOMETRY_TYPE)); }
Source:
<code>public boolean addFile(File file, URI uri) throws Exception { if (uri == null) <START> uri = file.getCanonicalFile().toURI(); <END> Domain manifest = Domain.domain(file); String mime = BUNDLE_MIME_TYPE; boolean hasIdentity = false; if (manifest != null) hasIdentity = addManifest(manifest); else mime = JAR_MIME_TYPE; String sha256 = SHA256.digest(file) .asHex(); addContentCapability(uri, sha256, file.length(), mime); return hasIdentity; }</code><technical_language>I this is a good idea. caller supplies File objects supply canonical/absolute/relative File objects if choose</technical_language>

Target:
public boolean addFile(File file, URI uri) throws Exception { if (uri == null) uri = file.toURI(); Domain manifest = Domain.domain(file); String mime = BUNDLE_MIME_TYPE; boolean hasIdentity = false; if (manifest != null) hasIdentity = addManifest(manifest); else mime = JAR_MIME_TYPE; String sha256 = SHA256.digest(file) .asHex(); addContentCapability(uri, sha256, file.length(), mime); return hasIdentity; }
Source:
<code>public boolean forceEvictAndRun(MapOperation mapOperation, double evictionPercentage) { assert evictionPercentage > 0 && evictionPercentage <= 1; int partitionCount = numberOfPartitions(mapOperation); int threadCount = threadCount(mapOperation); int mod = mod(mapOperation, threadCount); ILogger logger = mapOperation.logger(); int evictionRetryTimes = noRetryIfEvictingAll(evictionPercentage); for (int i = 0; i < evictionRetryTimes; i++) { final int attempt = i + 1; try { IntStream.range(0, partitionCount) .filter(partitionId -> partitionId % threadCount == mod) .mapToObj(partitionId -> partitionMaps(mapOperation, partitionId)) .flatMap(maps -> maps.values().stream()) .filter(this::isValid) <START> .forEach(recordStore -> { <END> int sizeBeforeEviction = recordStore.size(); MapContainer mapContainer = recordStore.getMapContainer(); Evictor evictor = mapContainer.getEvictor(); evictor.forceEvictByPercentage(recordStore, evictionPercentage); int sizeAfterEviction = recordStore.size(); if (logger.isFineEnabled()) { String msg = "Multiple record store forced eviction " + "[attempt: %d, mainMapName: %s, evictingMapName: %s, " + "evictionPercentage: %.2f, partitionId: %d, evictedCount: %d (%d --> %d)]"; logger.fine(format(msg, attempt, mapOperation.getName(), recordStore.getName(), evictionPercentage, mapOperation.getPartitionId(), sizeBeforeEviction - sizeAfterEviction, sizeBeforeEviction, sizeAfterEviction)); } }); mapOperation.runInternal(); return true; } catch (NativeOutOfMemoryError e) { if (evictionRetryTimes > 1) { ignore(e); } else { throw e; } } } return false; }</code><technical_language>In this expression allocate 4 instances of capturing lambdas eviction retry. avoid allocation of instance retry making method ForcedEviction#isValid static. Rewriting this in verbose imperative style save capturing lambda allocations. wdyt</technical_language>

Target:
public boolean forceEvictAndRun(MapOperation mapOperation, double evictionPercentage) { assert evictionPercentage > 0 && evictionPercentage <= 1; int partitionCount = numberOfPartitions(mapOperation); int threadCount = threadCount(mapOperation); int mod = mod(mapOperation, threadCount); ILogger logger = mapOperation.logger(); int evictionRetryTimes = retryCount(evictionPercentage); for (int i = 0; i < evictionRetryTimes; i++) { try { for (int partitionId = 0; partitionId < partitionCount; partitionId++) { if ((partitionId % threadCount) != mod) { continue; } Collection<RecordStore> recordStores = partitionMaps(mapOperation, partitionId).values(); for (RecordStore recordStore : recordStores) { int sizeBeforeEviction = recordStore.size(); MapContainer mapContainer = recordStore.getMapContainer(); Evictor evictor = mapContainer.getEvictor(); evictor.forceEvictByPercentage(recordStore, evictionPercentage); if (logger.isFineEnabled()) { logForcedEviction(logger, mapOperation, recordStore, evictionPercentage, (i + 1), sizeBeforeEviction); } } } mapOperation.runInternal(); return true; } catch (NativeOutOfMemoryError e) { if (evictionPercentage == 1D) { throw e; } else { ignore(e); } } } return false; }
Source:
<code><START> private void removeTaskFromRestoring(final StreamTask task) { <END> restoring.remove(task.id()); for (final TopicPartition tp : task.partitions()) { restoredPartitions.remove(tp); restoringByPartition.remove(tp); } }</code><technical_language>loop task.changelogPartitions() instead? For StreamTask partitions() changelogPartitions() non-overlapping shared source/changelog partitions</technical_language>

Target:
private void removeTaskFromRestoring(final StreamTask task) { restoring.remove(task.id()); for (final TopicPartition topicPartition : task.partitions()) { restoredPartitions.remove(topicPartition); restoringByPartition.remove(topicPartition); } for (final TopicPartition topicPartition : task.changelogPartitions()) { restoredPartitions.remove(topicPartition); restoringByPartition.remove(topicPartition); } }
Source:
<code>public String toString() <START> { <END> StringBuilder sb = new StringBuilder("ColumnarRow{"); sb.append("positionCount=").append(getPositionCount()).append(","); sb.append("fields count=").append(fields.length).append(","); for (int i = 0; i < fields.length; i++) { sb.append("field_").append(i).append("=").append(fields[i].toString()).append(","); } sb.append('}'); return sb.toString(); }</code><technical_language>@Override</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(getClass().getSimpleName()).append("{"); sb.append("positionCount=").append(getPositionCount()).append(","); sb.append("fieldsCount=").append(fields.length).append(","); for (int i = 0; i < fields.length; i++) { sb.append("field_").append(i).append("=").append(fields[i].toString()).append(","); } sb.append('}'); return sb.toString(); }
Source:
<code>public DbResourceGroupConfigurationManager(ClusterMemoryPoolManager memoryPoolManager, DbResourceGroupConfig config, ResourceGroupsDao dao, @ForEnvironment String environment) { super(memoryPoolManager); requireNonNull(memoryPoolManager, "memoryPoolManager is null"); requireNonNull(config, "config is null"); <START> this.enableExactMatchSelector = config.getEnableExactMatchSelector(); <END> requireNonNull(dao, "daoProvider is null"); this.environment = requireNonNull(environment, "environment is null"); this.dao = dao; this.dao.createResourceGroupsGlobalPropertiesTable(); this.dao.createResourceGroupsTable(); this.dao.createSelectorsTable(); if (enableExactMatchSelector) { this.dao.createExactMatchSelectorsTable(); } load(); }</code><technical_language>nit: please move this line requireNonNull(dao, "daoProvider is null"); non-null checks beginning of method</technical_language>

Target:
public DbResourceGroupConfigurationManager(ClusterMemoryPoolManager memoryPoolManager, DbResourceGroupConfig config, ResourceGroupsDao dao, @ForEnvironment String environment) { super(memoryPoolManager); requireNonNull(memoryPoolManager, "memoryPoolManager is null"); requireNonNull(config, "config is null"); requireNonNull(dao, "daoProvider is null"); this.environment = requireNonNull(environment, "environment is null"); this.exactMatchSelectorEnabled = config.getExactMatchSelectorEnabled(); this.dao = dao; this.dao.createResourceGroupsGlobalPropertiesTable(); this.dao.createResourceGroupsTable(); this.dao.createSelectorsTable(); if (exactMatchSelectorEnabled) { this.dao.createExactMatchSelectorsTable(); } load(); }
Source:
<code>public Set<ConnectorPlanOptimizer> getPhysicalPlanOptimizers() { <START> return ImmutableSet.of(new HiveFilterPushdown(transactionManager, rowExpressionService, functionResolution, partitionManager, functionMetadataManager)); <END> }</code><technical_language>reason a new HiveFilterPushdown object here? object re-used in logical physical phases</technical_language>

Target:
public Set<ConnectorPlanOptimizer> getPhysicalPlanOptimizers() { return planOptimizers; }
Source:
<code>AggregateProviderDefinition() { super(new Parameters(PathElement.pathElement(AGGREGATE_PROVIDER), DiscoveryExtension.getResourceDescriptionResolver(AGGREGATE_PROVIDER)) <START> .setAddHandler(AggregateProviderAddHandler.getInstance()) <END> .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setCapabilities(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)); }</code><technical_language>This needs a remove step handler</technical_language>

Target:
AggregateProviderDefinition() { super(new Parameters(PathElement.pathElement(AGGREGATE_PROVIDER), DiscoveryExtension.getResourceDescriptionResolver(AGGREGATE_PROVIDER)) .setAddHandler(AggregateProviderAddHandler.getInstance()) .setRemoveHandler(new TrivialRemoveStepHandler(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)) .setCapabilities(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)); }
Source:
<code>public static VmWatchdog map(WatchDog model, VmWatchdog template) { VmWatchdog entity = template == null ? new VmWatchdog() : template; if (model.isSetAction()) { WatchdogAction wdAction = WatchdogAction.fromValue(model.getAction().toUpperCase()); if (wdAction != null) { entity.setAction(map(wdAction, null)); } } if (model.isSetModel()) { WatchdogModel wdModel = WatchdogModel.fromValue(model.getModel().toUpperCase()); if (wdModel != null) { entity.setModel(map(wdModel, null)); } } entity.setModel(VmWatchdogType.getByName(model.getModel())); <START> entity.setId(new Guid(model.getId())); <END> return entity; }</code><technical_language>please GuidUtils.asGuid() returns BAD_REQUEST new Guid() throws illegalargument exception string convertible UUID</technical_language>

Target:
public static VmWatchdog map(WatchDog model, VmWatchdog template) { VmWatchdog entity = template == null ? new VmWatchdog() : template; if (model.isSetAction()) { WatchdogAction wdAction = WatchdogAction.fromValue(model.getAction().toUpperCase()); if (wdAction != null) { entity.setAction(map(wdAction, null)); } } if (model.isSetModel()) { WatchdogModel wdModel = WatchdogModel.fromValue(model.getModel().toUpperCase()); if (wdModel != null) { entity.setModel(map(wdModel, null)); } } entity.setModel(VmWatchdogType.getByName(model.getModel())); entity.setId(GuidUtils.asGuid(model.getId())); return entity; }
Source:
<code>private void loadPhysicalNetworkProviderParameters(Network network) { <START> NetworkDao networkDao = new NetworkDaoImpl(); <END> Network physicalProviderNetwork = networkDao.get(network.getPhysicalNetworkProviderId()); network.setVlanId(physicalProviderNetwork.getVlanId()); network.setLabel(physicalProviderNetwork.getLabel()); }</code><technical_language>Please injection instead of creating new object. line 25: @Inject private NetworkDao networkDao;</technical_language>

Target:
private void loadPhysicalNetworkProviderParameters(Network network) { Network physicalProviderNetwork = networkDao.get(network.getPhysicalNetworkProviderId()); network.setVlanId(physicalProviderNetwork.getVlanId()); network.setLabel(physicalProviderNetwork.getVdsmName()); }
Source:
<code>protected boolean canDoAction() { boolean returnValue = true; if (isVmUpDownOrPoweringUp(getVm().getstatus())) { setVdsId(getVm().getrun_on_vds().getValue()); returnValue = isHotPlugSupported() && isOSSupportingHotPlug(); } else { <START> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); <END> returnValue = false; } if (returnValue) { vmDevice = getVmDeviceDao().get(new VmDeviceId(getParameters().getNicId(), getParameters().getVmId())); if (vmDevice == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.VM_INTERFACE_NOT_EXIST); } } return returnValue; }</code><technical_language>please add specific error message for nic plug actions specifies valid statues for this action</technical_language>

Target:
protected boolean canDoAction() { boolean returnValue = true; if (isVmStatusProperForHotPlugNic(getVm().getstatus())) { setVdsId(getVm().getrun_on_vds().getValue()); returnValue = isHotPlugSupported() && isOSSupportingHotPlug(); } else { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); returnValue = false; } if (returnValue) { vmDevice = getVmDeviceDao().get(new VmDeviceId(getParameters().getNicId(), getParameters().getVmId())); if (vmDevice == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.VM_INTERFACE_NOT_EXIST); } } return returnValue; }
Source:
<code>public CompletableFuture<RestoreResponse> restore(RestoreRequest request) { logRequest(request); if (request.term() != context.currentTerm()) { return CompletableFuture.completedFuture(logResponse(RestoreResponse.error())); } HeapBuffer buffer = HeapBuffer.allocate(); List<Session> sessions = Lists.newArrayList(context.sessions()); buffer.writeInt(sessions.size()); for (Session session : sessions) { buffer.writeLong(session.sessionId().id()); buffer.writeString(session.nodeId().id()); } context.service().backup(buffer); buffer.flip(); byte[] bytes = buffer.readBytes(buffer.remaining()); <START> replicator.removePreviousOperation(request.nodeId(), context.currentIndex()); <END> return CompletableFuture.completedFuture( RestoreResponse.ok(context.currentIndex(), context.currentTimestamp(), bytes)) .thenApply(this::logResponse); }</code><technical_language>This line assume primary's response backup is received. dangerous me. remove operations primary *knows* backup received installed snapshot. Of course, remove operations all. Instead, backup respond backup requests highest index received, primary remove indexes _knows_ backup has</technical_language>

Target:
public CompletableFuture<RestoreResponse> restore(RestoreRequest request) { logRequest(request); if (request.term() != context.currentTerm()) { return CompletableFuture.completedFuture(logResponse(RestoreResponse.error())); } HeapBuffer buffer = HeapBuffer.allocate(); List<PrimitiveSession> sessions = Lists.newArrayList(context.sessions()); buffer.writeInt(sessions.size()); for (PrimitiveSession session : sessions) { buffer.writeLong(session.sessionId().id()); buffer.writeString(session.memberId().id()); } context.service().backup(new DefaultBackupOutput(buffer, context.service().serializer())); buffer.flip(); byte[] bytes = buffer.readBytes(buffer.remaining()); return CompletableFuture.completedFuture( RestoreResponse.ok(context.currentIndex(), context.currentTimestamp(), bytes)) .thenApply(this::logResponse); }
Source:
<code>public void setFilter(String filter) { Cursor sqlCursor = ReaderSearchTable.getQueryStringCursor(filter, MAX_SUGGESTIONS); MatrixCursor matrixCursor = new MatrixCursor( new String[]{ ReaderSearchTable.COL_ID, ReaderSearchTable.COL_QUERY}); if (sqlCursor.moveToFirst()) { do { long id = sqlCursor.getLong(sqlCursor.getColumnIndex(ReaderSearchTable.COL_ID)); String query = sqlCursor.getString(sqlCursor.getColumnIndex(ReaderSearchTable.COL_QUERY)); matrixCursor.addRow(new Object[]{id, query}); } while (sqlCursor.moveToNext()); <START> matrixCursor.addRow(new Object[]{CLEAR_ALL_ROW_ID, mClearAllText}); <END> } mCurrentFilter = filter; swapCursor(matrixCursor); }</code><technical_language>storing mClearAllText store row data prevent new Object[] allocations user types. remove mClearAllText create Object[] mClearRow in constructor</technical_language>

Target:
public void setFilter(String filter) { if (isCurrentFilter(filter) && getCursor() != null) { return; } Cursor sqlCursor = ReaderSearchTable.getQueryStringCursor(filter, MAX_SUGGESTIONS); MatrixCursor matrixCursor = new MatrixCursor( new String[]{ ReaderSearchTable.COL_ID, ReaderSearchTable.COL_QUERY}); if (sqlCursor.moveToFirst()) { do { long id = sqlCursor.getLong(sqlCursor.getColumnIndex(ReaderSearchTable.COL_ID)); String query = sqlCursor.getString(sqlCursor.getColumnIndex(ReaderSearchTable.COL_QUERY)); matrixCursor.addRow(new Object[]{id, query}); } while (sqlCursor.moveToNext()); matrixCursor.addRow(mClearAllRow); } mCurrentFilter = filter; swapCursor(matrixCursor); }
Source:
<code>private void validateMimeType(String resourceType, String mimeType) { mimeType = Optional.ofNullable(mimeType) .map(t -> t.split("/")[1]) .orElseThrow(() -> new RestServerError("Invalid mime type", null)); List<String> allowedExtensions; if ("Image".equals(resourceType)){ allowedExtensions = imageAllowedExtensions; } else if ("Attach".equals(resourceType)){ allowedExtensions = fileAllowedExtensions; } else throw new RestServerError(String.format("Invalid resource type %s", resourceType), null); if (!allowedExtensions.contains(mimeType)) { <START> throw new RestServerError(String.format("Invalid mime type: %s", mimeType), null); <END> } }</code><technical_language>This get logged. a minimum fact invalid type encountered</technical_language>

Target:
private void validateMimeType(String resourceType, String mimeType) { mimeType = Optional.ofNullable(mimeType) .map(t -> t.split("/")[1]) .orElseThrow(() -> { log.error("Invalid mime type"); return new RestServerError("plugins.jacms.resources.invalidMimeType", null); }); List<String> allowedExtensions; if ("Image".equals(resourceType)){ allowedExtensions = imageAllowedExtensions; } else if ("Attach".equals(resourceType)){ allowedExtensions = fileAllowedExtensions; } else { log.error("File type not allowed"); throw new RestServerError("plugins.jacms.resources.invalidResourceType", null); } if (!allowedExtensions.contains(mimeType)) { log.error("Invalid mime type"); throw new RestServerError("plugins.jacms.resources.invalidMimeType", null); } }
Source:
<code><START> public long size() { <END> return conflictToGlobalTailCache.estimatedSize(); }</code><technical_language>Missing Java doc</technical_language>

Target:
public long size() { return conflictCache.estimatedSize(); }
Source:
<code><START> public Configuration newProjectConfiguration(String projectKey, Optional<Branch> branch) { <END> String effectiveKey = generateProjectKey(projectKey, branch); Settings projectSettings = new ProjectSettings(globalSettings); dbClient.propertiesDao() .selectProjectProperties(effectiveKey) .forEach(property -> projectSettings.setProperty(property.getKey(), property.getValue())); return new ConfigurationBridge(projectSettings); }</code><technical_language>![MINOR](<LINK_1> 'Severity: MINOR') a "Branch" parameter instead. [![rule](<LINK_0>](<LINK_2></technical_language>

Target:
public Configuration newProjectConfiguration(String projectKey, Optional<Branch> branch) { Settings projectSettings = new ProjectSettings(globalSettings); addSettings(projectSettings, projectKey); getBranchName(branch).ifPresent( b -> addSettings(projectSettings, generateBranchKey(projectKey, b))); return new ConfigurationBridge(projectSettings); }
Source:
<code>final PublisherVerification<Integer> multiSubscribersPublisherVerification(final boolean shouldBlowUp) { return new PublisherVerification<Integer>(newTestEnvironment()) { @Override public Publisher<Integer> createPublisher(final long elements) { return new Publisher<Integer>() { private final Collection<Demand> demands = new CopyOnWriteArrayList<Demand>(); private final AtomicLong source = new AtomicLong(elements); @Override public void subscribe(Subscriber<? super Integer> s) { if (shouldBlowUp && !demands.isEmpty()) { new Demand(s); s.onError(new RuntimeException("Unexpected additional subscriber")); } else { demands.add(new Demand(s)); } } class Demand implements Subscription { final AtomicBoolean canceled = new AtomicBoolean(); Subscriber<? super Integer> subscriber; Demand(Subscriber<? super Integer> subscriber) { this.subscriber = subscriber; <START> this.subscriber.onSubscribe(this); <END> } @Override public void request(long n) { if (!canceled.get()) { for (long i = 0; i < n; i++) { if (source.getAndDecrement() < 0) { canceled.set(true); subscriber.onComplete(); } else { subscriber.onNext((int) i); } } } } @Override public void cancel() { canceled.set(true); subscriber = null; for (Demand demand : demands) { if (demand == this) { demands.remove(demand); } } } } }; } @Override public Publisher<Integer> createFailedPublisher() { return SKIP; } }; }</code><technical_language>a big fan of letting this escape constructor finished running - subscriber immediately synchronously call right away. I pretty safe current impl generally avoid this pattern, WDYT</technical_language>

Target:
final PublisherVerification<Integer> multiSubscribersPublisherVerification(final boolean shouldBlowUp) { return new PublisherVerification<Integer>(newTestEnvironment()) { @Override public Publisher<Integer> createPublisher(final long elements) { return new Publisher<Integer>() { private final Collection<CancelableSubscription> subscriptions = new CopyOnWriteArrayList<CancelableSubscription>(); private final AtomicLong source = new AtomicLong(elements); @Override public void subscribe(Subscriber<? super Integer> s) { CancelableSubscription subscription = new CancelableSubscription(s); s.onSubscribe(subscription); if (shouldBlowUp && !subscriptions.isEmpty()) { s.onError(new RuntimeException("Unexpected additional subscriber")); } else { subscriptions.add(subscription); } } class CancelableSubscription implements Subscription { final AtomicBoolean canceled = new AtomicBoolean(); Subscriber<? super Integer> subscriber; CancelableSubscription(Subscriber<? super Integer> subscriber) { this.subscriber = subscriber; } @Override public void request(long n) { if (!canceled.get()) { for (long i = 0; i < n; i++) { if (source.getAndDecrement() < 0) { canceled.set(true); subscriber.onComplete(); } else { subscriber.onNext((int) i); } } } } @Override public void cancel() { canceled.set(true); subscriber = null; subscriptions.remove(this); } } }; } @Override public Publisher<Integer> createFailedPublisher() { return SKIP; } }; }
Source:
<code>private void initializeDefinedElements(CContentAssistInvocationContext context) { int startOffset = getStatementStartOffset(context.getDocument(), context.getParseOffset() - fPrefix.length()); Map<String, IBinding> elementsMap = new HashMap<>(); IASTCompletionNode node = null; CContentAssistInvocationContext newContext = new CContentAssistInvocationContext( context.getViewer(), startOffset, context.getEditor(), true, false); try { node = newContext.getCompletionNode(); if (node != null) { IASTTranslationUnit tu = node.getTranslationUnit(); IASTName[] names = node.getNames(); for (IASTName name : names) { IASTCompletionContext astContext = name.getCompletionContext(); if (astContext != null) { IBinding[] bindings = astContext.findBindings(name, true); if (bindings != null) { AccessContext accessibilityContext = new AccessContext(name); for (IBinding binding : bindings) { if ((binding instanceof <START> ICPPField || <END> binding instanceof IVariable) && accessibilityContext.isAccessible(binding) && !elementsMap.containsKey(binding.getName())) { if (binding instanceof ICPPField) { elementsMap.put(binding.getName(), binding); } else { IASTName[] declarations = tu.getDeclarationsInAST(binding); if (declarations != null && declarations.length != 0) elementsMap.put(binding.getName(), binding); } } } } } } } } finally { fAvailableElements = new ArrayList<>(elementsMap.values()); newContext.dispose(); } }</code><technical_language>condition is redundant ICPPField is a subinterface of IVariable</technical_language>

Target:
private void initializeDefinedElements(CContentAssistInvocationContext context) { int startOffset = getStatementStartOffset(context.getDocument(), context.getParseOffset() - fPrefix.length()); Map<String, IBinding> elementsMap = new HashMap<>(); IASTCompletionNode node = null; CContentAssistInvocationContext newContext = new CContentAssistInvocationContext( context.getViewer(), startOffset, context.getEditor(), true, false); try { node = newContext.getCompletionNode(); if (node != null) { IASTTranslationUnit tu = node.getTranslationUnit(); IASTName[] names = node.getNames(); for (IASTName name : names) { IASTCompletionContext astContext = name.getCompletionContext(); if (astContext != null) { IBinding[] bindings = astContext.findBindings(name, true); if (bindings != null) { AccessContext accessibilityContext = new AccessContext(name); for (IBinding binding : bindings) { if (binding instanceof IVariable && accessibilityContext.isAccessible(binding) && !elementsMap.containsKey(binding.getName())) { if (binding instanceof ICPPField) { elementsMap.put(binding.getName(), binding); } else { IASTName[] declarations = tu.getDeclarationsInAST(binding); if (declarations.length != 0) elementsMap.put(binding.getName(), binding); } } } } } } } } finally { fAvailableElements = new ArrayList<>(elementsMap.values()); newContext.dispose(); } }
Source:
<code>public DataBuffer write(CharSequence charSequence, Charset charset) { Assert.notNull(charSequence, "'charSequence' must not be null"); Assert.notNull(charset, "'charset' must not be null"); if (StandardCharsets.UTF_8.equals(charset)) { ByteBufUtil.writeUtf8(this.byteBuf, charSequence); } else if (StandardCharsets.US_ASCII.equals(charset)) { ByteBufUtil.writeAscii(this.byteBuf, charSequence); } else { CharsetEncoder charsetEncoder = charset.newEncoder() .onMalformedInput(CodingErrorAction.REPLACE) .onUnmappableCharacter(CodingErrorAction.REPLACE); <START> CharBuffer inBuffer = CharBuffer.wrap(charSequence); <END> int estimatedSize = (int) (inBuffer.remaining() * charsetEncoder.averageBytesPerChar()); this.byteBuf.ensureWritable(estimatedSize); charsetEncoder.reset(); ByteBuffer outBuffer = asByteBuffer(this.byteBuf.writerIndex(), writableByteCount()); try { for (; ; ) { CoderResult cr = inBuffer.hasRemaining() ? charsetEncoder.encode(inBuffer, outBuffer, true) : CoderResult.UNDERFLOW; if (cr.isUnderflow()) { cr = charsetEncoder.flush(outBuffer); } if (cr.isUnderflow()) { break; } if (cr.isOverflow()) { writePosition(outBuffer.position()); int maximumSize = (int) (inBuffer.remaining() * charsetEncoder.maxBytesPerChar()); this.byteBuf.ensureWritable(maximumSize); outBuffer = asByteBuffer(this.byteBuf.writerIndex(), writableByteCount()); } } } catch (CoderMalfunctionError ex) { throw new IllegalStateException(ex); } writePosition(outBuffer.position()); } return this; }</code><technical_language>non-UTF-8, non-ASCII code live in a base class, shared DefaultDataBuffer NettyDataBuffer. yet: give method a default implementation in DataBuffer</technical_language>

Target:
public DataBuffer write(CharSequence charSequence, Charset charset) { Assert.notNull(charSequence, "'charSequence' must not be null"); Assert.notNull(charset, "'charset' must not be null"); if (StandardCharsets.UTF_8.equals(charset)) { ByteBufUtil.writeUtf8(this.byteBuf, charSequence); } else if (StandardCharsets.US_ASCII.equals(charset)) { ByteBufUtil.writeAscii(this.byteBuf, charSequence); } else { return PooledDataBuffer.super.write(charSequence, charset); } return this; }
Source:
<code>public StringInputRowParser( @JsonProperty("parseSpec") ParseSpec parseSpec, @JsonProperty("encoding") String encoding ) { this.parseSpec = parseSpec; this.mapParser = new MapInputRowParser(parseSpec); this.parser = parseSpec.makeParser(); if(encoding != null) { this.charset = Charset.forName(encoding); } else { <START> this.charset = Charsets.UTF_8; <END> } }</code><technical_language>set this default a constant? (private final static Charset)</technical_language>

Target:
public StringInputRowParser( @JsonProperty("parseSpec") ParseSpec parseSpec, @JsonProperty("encoding") String encoding ) { this.parseSpec = parseSpec; this.mapParser = new MapInputRowParser(parseSpec); this.parser = parseSpec.makeParser(); if (encoding != null) { this.charset = Charset.forName(encoding); } else { this.charset = DEFAULT_CHARSET; } }
Source:
<code>public void shouldUnRetireAProgram() throws Exception { Program program = service.getProgramByUuid(getUuid()); program.setRetired(true); program.setRetireReason("random reason"); program = service.saveProgram(program); Assert.assertTrue(program.isRetired()); <START> String json = "{\"deleted\": \"false\"}"; <END> SimpleObject response = deserialize(handle(newPostRequest(getURI() + "/" + getUuid(), json))); program = service.getProgramByUuid(getUuid()); Assert.assertFalse(program.isRetired()); Assert.assertEquals("false", PropertyUtils.getProperty(response, "retired").toString()); }</code><technical_language>a REST call confirm is retired</technical_language>

Target:
public void shouldUnRetireAProgram() throws Exception { Program program = service.getProgramByUuid(getUuid()); program.setRetired(true); program.setRetireReason("random reason"); service.saveProgram(program); program = service.getProgramByUuid(getUuid()); Assert.assertTrue(program.isRetired()); String json = "{\"deleted\": \"false\"}"; SimpleObject response = deserialize(handle(newPostRequest(getURI() + "/" + getUuid(), json))); program = service.getProgramByUuid(getUuid()); Assert.assertFalse(program.isRetired()); Assert.assertEquals("false", PropertyUtils.getProperty(response, "retired").toString()); }
Source:
<code>public static int getItemBurnTime(ItemStack stack) { if (stack.isEmpty()) { return 0; } else { Item item = stack.getItem(); int base = stack.getBurnTime(); <START> return getBurnTimes().computeIfAbsent(item, i -> net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack, base == -1 ? getVanillaBurnTimes().getOrDefault(i, 0) : base)); <END> } }</code><technical_language>event fired time e.g. mods dynamically adjust other mods' items' burn times</technical_language>

Target:
public static int getItemBurnTime(ItemStack stack) { if (stack.isEmpty()) { return 0; } else { Item item = stack.getItem(); int base = stack.getBurnTime(); return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack, base == -1 ? getBurnTimes().getOrDefault(item, 0) : base); } }
Source:
<code>public MapReduceTask<String, String, String, Integer> invokeMapReduce(String keys[]) throws Exception{ MapReduceTask<String,String,String,Integer> task = super.invokeMapReduce(keys, true); EmbeddedCacheManager cacheManager = getCacheManagers().get(0); String sharedCache = task.getIntermediateCacheName(); <START> assertTrue("MapReduceTask has not use shared intermediate cache as it should have but it used " + sharedCache, <END> MapReduceTask.DEFAULT_TMP_CACHE_CONFIGURATION_NAME.equals(sharedCache)); Cache<Object, Object> sharedTmpCache = cacheManager.getCache(sharedCache); int elementsInCache = sharedTmpCache.size(); assertTrue("Shared cache " + sharedCache + " is not empty. It has " + elementsInCache + " keys/values", elementsInCache == 0); return task; }</code><technical_language>assertEquals(expectedValue, currentValue) (or other around)</technical_language>

Target:
public MapReduceTask<String, String, String, Integer> invokeMapReduce(String keys[]) throws Exception{ MapReduceTask<String,String,String,Integer> task = super.invokeMapReduce(keys, true); EmbeddedCacheManager cacheManager = getCacheManagers().get(0); String sharedCache = task.getIntermediateCacheName(); assertEquals("MapReduceTask has not use shared intermediate cache as it should have but it used " + sharedCache, MapReduceTask.DEFAULT_TMP_CACHE_CONFIGURATION_NAME, sharedCache); Cache<Object, Object> sharedTmpCache = cacheManager.getCache(sharedCache); int elementsInCache = sharedTmpCache.size(); assertEquals("Shared cache " + sharedCache + " is not empty. It has " + elementsInCache + " keys/values", elementsInCache, 0); return task; }
Source:
<code>public NetworkTemplateListModel() { setTitle(ConstantsManager.getInstance().getConstants().templatesTitle()); setHelpTag(HelpTag.templates); setHashName("templates"); <START> setIsAvailable(ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)); <END> setComparator(new Comparator<PairQueryable<VmNetworkInterface, VmTemplate>>() { @Override public int compare(PairQueryable<VmNetworkInterface, VmTemplate> paramT1, PairQueryable<VmNetworkInterface, VmTemplate> paramT2) { int compareValue = paramT1.getSecond().getVdsGroupName().compareTo(paramT2.getSecond().getVdsGroupName()); if (compareValue != 0) { return compareValue; } return paramT1.getSecond().getName().compareTo(paramT2.getSecond().getName()); } }); setRemoveCommand(new UICommand("Remove", this)); updateActionAvailability(); }</code><technical_language>setAvailableInModes(ApplicationMode.VirtOnly)</technical_language>

Target:
public NetworkTemplateListModel() { setTitle(ConstantsManager.getInstance().getConstants().templatesTitle()); setHelpTag(HelpTag.templates); setHashName("templates"); setAvailableInModes(ApplicationMode.VirtOnly); setComparator(new Comparator<PairQueryable<VmNetworkInterface, VmTemplate>>() { @Override public int compare(PairQueryable<VmNetworkInterface, VmTemplate> paramT1, PairQueryable<VmNetworkInterface, VmTemplate> paramT2) { int compareValue = paramT1.getSecond().getVdsGroupName().compareTo(paramT2.getSecond().getVdsGroupName()); if (compareValue != 0) { return compareValue; } return paramT1.getSecond().getName().compareTo(paramT2.getSecond().getName()); } }); setRemoveCommand(new UICommand("Remove", this)); updateActionAvailability(); }
Source:
<code>private boolean correctStorageDomainFormat() { storage_pool storagePool = getStoragePool(); StorageFormatType storageFormat = getStorageDomain().getStorageFormat(); StorageType storageType = getStorageDomain().getstorage_type(); boolean isBlockStorage = storageType == StorageType.ISCSI || storageType == StorageType.FCP; Set<StorageFormatType> supportedStorageFormats; if (storagePool != null) { supportedStorageFormats = getSupportedStorageFormatSet(storagePool.getcompatibility_version()); } else { <START> Version vdsVersion = Collections.max(getVds().getSupportedClusterVersionsSet()); <END> supportedStorageFormats = getSupportedStorageFormatSet(vdsVersion); } if (!supportedStorageFormats.contains(storageFormat)) { return false; } if (storageFormat == StorageFormatType.V1 && isBlockStorage && storagePool == null) { return false; } if (storageFormat == StorageFormatType.V2 && !isBlockStorage) { return false; } return true; }</code><technical_language>1. i this based "potential" of host, DC in. 2. also, if DC is 3.0, create a useless V3 storage domain host i selected is 3.1. i able do i a 3.1 DC. 3. while it, guessing this line is buggy a headache if a 3.2 vdsm released, collections.max return 3.2, getSupported(3.2) return empty/NPE/etc. a 3.1 engine</technical_language>

Target:
private boolean correctStorageDomainFormat() { storage_pool storagePool = getStoragePool(); StorageFormatType storageFormat = getStorageDomain().getStorageFormat(); StorageType storageType = getStorageDomain().getstorage_type(); StorageDomainType storageDomainType = getStorageDomain().getstorage_domain_type(); boolean isBlockStorage = storageType == StorageType.ISCSI || storageType == StorageType.FCP; boolean isDataStorageDomain = storageDomainType == StorageDomainType.Data; Set<StorageFormatType> supportedStorageFormats; if (storagePool != null) { supportedStorageFormats = getSupportedStorageFormatSet(storagePool.getcompatibility_version()); } else { storage_pool vdsStoragePool = getStoragePoolDAO().get(getVds().getstorage_pool_id()); if (vdsStoragePool == null) { return false; } supportedStorageFormats = getSupportedStorageFormatSet(vdsStoragePool.getcompatibility_version()); } if (!supportedStorageFormats.contains(storageFormat)) { return false; } if (storageFormat == StorageFormatType.V1 && isBlockStorage && storagePool == null) { return false; } if (storageFormat == StorageFormatType.V2 && (!isBlockStorage || !isDataStorageDomain)) { return false; } if (storageFormat == StorageFormatType.V3 && !isDataStorageDomain) { return false; } return true; }
Source:
<code>protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { Map<String, Serializable> actualProperties = new HashMap<>(properties); String eventId = (String) actualProperties.remove(NOTIFY); Collection<DocumentRef> refs = ids.stream().map(IdRef::new).collect(Collectors.toList()); <START> ids.forEach(id -> actualProperties.forEach((k, v) -> session.setDocumentSystemProp(new IdRef(id), k, v))); <END> session.save(); if (eventId != null) { fireEvent(session, eventId, refs); } }</code><technical_language>applying forEach refs ? Furthermore, @efge changes in SetPropertyComputation handle error, apply</technical_language>

Target:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { Map<String, Serializable> actualProperties = new HashMap<>(properties); String eventId = (String) actualProperties.remove(NOTIFY); Collection<DocumentRef> refs = ids.stream().map(IdRef::new).collect(Collectors.toList()); Collection<DocumentRef> updatedRefs = new ArrayList<>(refs.size()); for (DocumentRef ref : refs) { for (Entry<String, Serializable> entry : actualProperties.entrySet()) { try { session.setDocumentSystemProp(ref, entry.getKey(), entry.getValue()); updatedRefs.add(ref); } catch (NuxeoException e) { getLog().warn("Cannot set system property: " + entry.getKey() + " on: " + ref.toString(), e); } } } try { session.save(); if (eventId != null && !updatedRefs.isEmpty()) { fireEvent(session, eventId, updatedRefs); } } catch (PropertyException e) { getLog().warn("Cannot save session", e); } }