auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void init(Shell splash) { super.init(splash); String progressString = null; String messageString = null; IProduct product = Platform.getProduct(); if(product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); messageString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, new Rectangle(10, 300, 480, 15)); setProgressRect(progressRect); <START> Rectangle messageRect = StringConverter.asRectangle(messageString, new Rectangle(10, 280, 490, 0)); <END> setMessageRect(messageRect); try { setForeground(getSplash().getDisplay().getSystemColor(SWT.COLOR_WHITE).getRGB()); } catch(IllegalArgumentException e) { } getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }</code><technical_language>I added line above, is correct? Although, is point of creating a rectangle 0 height here? it</technical_language>

Target:
public void init(Shell splash) { super.init(splash); String progressString = null; IProduct product = Platform.getProduct(); if(product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, new Rectangle(10, 300, 480, 15)); setProgressRect(progressRect); try { setForeground(getSplash().getDisplay().getSystemColor(SWT.COLOR_WHITE).getRGB()); } catch(IllegalArgumentException e) { } getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }
Source:
<code>public ExecutionResult execute(Item item) { if (item instanceof DatabaseConnectionItem) { Connection connection = ((DatabaseConnectionItem) item).getConnection(); if (connection instanceof DatabaseConnection) { DatabaseConnection dbConn = (DatabaseConnection) connection; try { if (EDatabaseTypeName.REDSHIFT.getDisplayName().equals(dbConn.getDatabaseType())) { String oldUrl = dbConn.getURL(); if (oldUrl != null) { String newUrl = oldUrl.replaceFirst("jdbc:\\w+:", "jdbc:redshift:"); if (!oldUrl.equals(newUrl)) { dbConn.setURL(newUrl); ProxyRepositoryFactory.getInstance().save(item, true); return ExecutionResult.SUCCESS_NO_ALERT; } } } <START> if (EDatabaseTypeName.REDSHIFT_SSO.getDisplayName().equals(dbConn.getDatabaseType())) { <END> String oldUrl = dbConn.getURL(); if (oldUrl != null) { String newUrl = oldUrl.replaceFirst("jdbc:\\w+:", "jdbc:redshift:iam:"); if (!oldUrl.equals(newUrl)) { dbConn.setURL(newUrl); ProxyRepositoryFactory.getInstance().save(item, true); return ExecutionResult.SUCCESS_NO_ALERT; } } } } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } } } return ExecutionResult.NOTHING_TO_DO; }</code><technical_language>Please remove</technical_language>

Target:
public ExecutionResult execute(Item item) { if (item instanceof DatabaseConnectionItem) { Connection connection = ((DatabaseConnectionItem) item).getConnection(); if (connection instanceof DatabaseConnection) { DatabaseConnection dbConn = (DatabaseConnection) connection; try { if (EDatabaseTypeName.REDSHIFT.getDisplayName().equals(dbConn.getDatabaseType())) { String oldUrl = dbConn.getURL(); if (oldUrl != null) { String newUrl = oldUrl.replaceFirst("jdbc:\\w+:", "jdbc:redshift:"); if (!oldUrl.equals(newUrl)) { dbConn.setURL(newUrl); ProxyRepositoryFactory.getInstance().save(item, true); return ExecutionResult.SUCCESS_NO_ALERT; } } } } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } } } return ExecutionResult.NOTHING_TO_DO; }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> hostExtStatusUpdatePermissionsList = new ArrayList<>(); if (hasHostExternalStatus()) { hostExtStatusUpdatePermissionsList.add(new PermissionSubject(new Guid(getParameters().getEvent().getVdsId().toString()), VdcObjectType.VDS, ActionGroup.EDIT_HOST_CONFIGURATION)); } List<PermissionSubject> permissionList = getPermissionList(getParameters().getEvent()); List<PermissionSubject> joinedPermissionList = new ArrayList<>(); joinedPermissionList.addAll(hostExtStatusUpdatePermissionsList); joinedPermissionList.addAll(permissionList); <START> return joinedPermissionList; <END> }</code><technical_language>do: List<PermissionSubject> permissionList = getPermissionList(getParameters().getEvent()); if (hasHostExternalStatus()) { permissionList.add(new PermissionSubject(new Guid(getParameters().getEvent().getVdsId().toString()), VdcObjectType.VDS, ActionGroup.EDIT_HOST_CONFIGURATION)); } return permissionList;</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = getPermissionList(getParameters().getEvent()); if (hasHostExternalStatus()) { permissionList.add(new PermissionSubject(new Guid(getParameters().getEvent().getVdsId().toString()), VdcObjectType.VDS, ActionGroup.EDIT_HOST_CONFIGURATION)); } return permissionList; }
Source:
<code>public void testGetScannerNoQualifiers() throws IOException { HTableInterface table = connection.getTable(TABLE_NAME); byte[] rowKey = dataHelper.randomData("testrow-"); int numValues = 3; byte[][] quals = dataHelper.randomData("qual-", numValues); byte[][] values = dataHelper.randomData("value-", numValues); Put put = new Put(rowKey); for (int i = 0; i < numValues; ++i) { put.add(COLUMN_FAMILY, quals[i], values[i]); } table.put(put); Scan scan = new Scan(); scan.setStartRow(rowKey); scan.setStopRow(rowFollowing(rowKey)); scan.addFamily(COLUMN_FAMILY); ResultScanner resultScanner = table.getScanner(scan); <START> Result result = resultScanner.next(); <END> resultScanner.close(); Assert.assertEquals(numValues, result.size()); for (int i = 0; i < numValues; ++i) { Assert.assertTrue(result.containsColumn(COLUMN_FAMILY, quals[i])); Assert.assertArrayEquals(values[i], CellUtil.cloneValue(result.getColumnLatestCell(COLUMN_FAMILY, quals[i]))); } Delete delete = new Delete(rowKey); table.delete(delete); table.close(); }</code><technical_language>assert calling .next() returns null</technical_language>

Target:
public void testGetScannerNoQualifiers() throws IOException { HTableInterface table = connection.getTable(TABLE_NAME); byte[] rowKey = dataHelper.randomData("testrow-"); int numValues = 3; byte[][] quals = dataHelper.randomData("qual-", numValues); byte[][] values = dataHelper.randomData("value-", numValues); Put put = new Put(rowKey); for (int i = 0; i < numValues; ++i) { put.add(COLUMN_FAMILY, quals[i], values[i]); } table.put(put); Scan scan = new Scan(); scan.setStartRow(rowKey) .setStopRow(rowFollowing(rowKey)) .addFamily(COLUMN_FAMILY); ResultScanner resultScanner = table.getScanner(scan); Result result = resultScanner.next(); resultScanner.close(); Assert.assertEquals(numValues, result.size()); for (int i = 0; i < numValues; ++i) { Assert.assertTrue(result.containsColumn(COLUMN_FAMILY, quals[i])); Assert.assertArrayEquals(values[i], CellUtil.cloneValue(result.getColumnLatestCell(COLUMN_FAMILY, quals[i]))); } Delete delete = new Delete(rowKey); table.delete(delete); table.close(); }
Source:
<code>public void activate(final BundleContext bundleContext, final Map<String, Object> configuration) { logger.debug("FritzBox TR064 Binding activated!"); String refreshIntervalString = Objects.toString(configuration.get("refresh"), null); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); logger.debug("Custom refresh interval set to {}", refreshInterval); } String fboxurl = Objects.toString(configuration.get("url"), null); String fboxuser = Objects.toString(configuration.get("user"), null); String fboxpw = Objects.toString(configuration.get("pass"), null); String fboxphonebookid = Objects.toString(configuration.get("phonebookid"), null); if (fboxurl == null) { logger.warn("Fritzbox URL was not provided in config. Shutting down binding."); setProperlyConfigured(false); return; } if (fboxuser == null) { logger.warn("Fritzbox User was not provided in config. Using default username."); } if (fboxpw == null) { logger.warn("Fritzbox Password was not provided in config. Shutting down binding."); setProperlyConfigured(false); return; } if (fboxphonebookid == null) { logger.debug("No Phonebookid provided. Use default: 0"); fboxphonebookid = "0"; } this._pw = fboxpw; this._user = fboxuser; this._url = fboxurl; <START> this._pbid = Integer.valueOf(fboxphonebookid); <END> if (_fboxComm == null) { _fboxComm = new Tr064Comm(_url, _user, _pw); } setProperlyConfigured(true); }</code><technical_language>catch NumberFormatExceptions (and set 0 a fallback)</technical_language>

Target:
public void activate(final BundleContext bundleContext, final Map<String, Object> configuration) { logger.debug("FritzBox TR064 Binding activated!"); String refreshIntervalString = Objects.toString(configuration.get("refresh"), null); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); logger.debug("Custom refresh interval set to {}", refreshInterval); } String fboxurl = Objects.toString(configuration.get("url"), null); String fboxuser = Objects.toString(configuration.get("user"), null); String fboxpw = Objects.toString(configuration.get("pass"), null); String fboxphonebookid = Objects.toString(configuration.get("phonebookid"), null); if (fboxurl == null) { logger.warn("Fritzbox URL was not provided in config. Shutting down binding."); setProperlyConfigured(false); return; } if (fboxuser == null) { logger.warn("Fritzbox User was not provided in config. Using default username."); } if (fboxpw == null) { logger.warn("Fritzbox Password was not provided in config. Shutting down binding."); setProperlyConfigured(false); return; } if (fboxphonebookid == null) { logger.debug("No Phonebookid provided. Use default: 0"); fboxphonebookid = "0"; } this._pw = fboxpw; this._user = fboxuser; this._url = fboxurl; try { this._pbid = Integer.valueOf(fboxphonebookid); } catch(NumberFormatException ex) { this._pbid = 0; } if (_fboxComm == null) { _fboxComm = new Tr064Comm(_url, _user, _pw); } setProperlyConfigured(true); }
Source:
<code>@Override public Response addFromVmSnapshot(Template template) { validateIconParameters(template); validateSnapshotExistence(template.getVm()); String snapshotId = getSnapshotId(template.getVm().getSnapshots()); org.ovirt.engine.core.common.businessentities.VM vmConfiguration = getVmConfiguration(snapshotId); Guid clusterId = null; if (namedCluster(template)) { clusterId = getClusterId(template); } if (template.getVersion() != null) { validateParameters(template.getVersion(), "baseTemplate"); } VmStatic originalVm = vmConfiguration.getStaticData(); VmStatic staticVm = getMapper(Template.class, VmStatic.class).map(template, originalVm); if (namedCluster(template)) { staticVm.setClusterId(clusterId); } AddVmTemplateFromSnapshotParameters params = new AddVmTemplateFromSnapshotParameters( staticVm, template.getName(), template.getDescription(), <START> Guid.createGuidFromString(snapshotId)); <END> return addTemplate(template, originalVm, vmConfiguration.getDiskMap().keySet(), params, ActionType.AddVmTemplateFromSnapshot); }</code><technical_language>conversion of string->guid</technical_language>

Target:
@Override public Response addFromVmSnapshot(Template template) { validateIconParameters(template); validateSnapshotExistence(template.getVm()); Guid snapshotId = getSnapshotId(template.getVm().getSnapshots()); org.ovirt.engine.core.common.businessentities.VM vmConfiguration = getVmConfiguration(snapshotId); Guid clusterId = null; if (namedCluster(template)) { clusterId = getClusterId(template); } if (template.getVersion() != null) { validateParameters(template.getVersion(), "baseTemplate"); } VmStatic originalVm = vmConfiguration.getStaticData(); VmStatic staticVm = getMapper(Template.class, VmStatic.class).map(template, originalVm); if (namedCluster(template)) { staticVm.setClusterId(clusterId); } AddVmTemplateFromSnapshotParameters params = new AddVmTemplateFromSnapshotParameters( staticVm, template.getName(), template.getDescription(), snapshotId); return addTemplate(template, originalVm, vmConfiguration.getDiskMap().keySet(), params, ActionType.AddVmTemplateFromSnapshot); }
Source:
<code>public int hashCode() { <START> return Objects.hashCode(mSize, mLocation, mForceLocation, mEvictionAllowed); <END> }</code><technical_language>this need mUseReservedSpace? affects equals() toString()</technical_language>

Target:
public int hashCode() { return Objects.hashCode(mSize, mLocation, mForceLocation, mEvictionAllowed, mUseReservedSpace); }
Source:
<code>TxBuilder create(@Nonnull final String tableName, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { Table<K, V, M> table = getTable(tableName); validateNamespace(table); operations.add(() -> { CorfuRecord<V, M> previous = table.get(key); if (previous != null) { <START> throw new RuntimeException("Cannot create a record on existing key."); <END> } M newMetadata = null; if (table.getMetadataOptions().isMetadataEnabled()) { M metadataDefaultInstance = (M) table.getMetadataOptions().getDefaultMetadataInstance(); newMetadata = getNewMetadata(metadataDefaultInstance, metadata); } table.create(key, value, newMetadata); }); return this; }</code><technical_language>RuntimeException generic</technical_language>

Target:
TxBuilder create(@Nonnull final String tableName, @Nonnull final K key, @Nonnull final V value, @Nullable final M metadata) { Table<K, V, M> table = getTable(tableName); operations.add(() -> { table.create(key, value, metadata); }); return this; }
Source:
<code>public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); <START> before("", this.mimeType, this.apiAuthenticationHelper::checkAdminUserAnd403); <END> before(Routes.PluginInfoAPI.ID, this.mimeType, this.apiAuthenticationHelper::checkAdminUserAnd403); get(Routes.PluginInfoAPI.ID, mimeType, this::show); get("", mimeType, this::index); exception(HttpException.class, this::httpException); }); }</code><technical_language>this is checkAdminUserAnd403 ? Plugin Infos API is accessible users, apiAuthenticationHelper::checkUserAnd403 ? I looked v1 rails API, [check_user_and_403](<LINK_0></technical_language>

Target:
public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", this.mimeType, this.apiAuthenticationHelper::checkUserAnd403); before(Routes.PluginInfoAPI.ID, this.mimeType, this.apiAuthenticationHelper::checkUserAnd403); get("", mimeType, this::index); get(Routes.PluginInfoAPI.ID, mimeType, this::show); exception(HttpException.class, this::httpException); }); }
Source:
<code>public static Job createJob(VdcActionType actionType, CommandBase<?> command) { Job job = new Job(); job.setId(Guid.NewGuid()); job.setActionType(actionType); job.setCommandId(command.getCommandId()); job.setJobSubjectEntities(command.getPermissionCheckSubjects()); job.setCommandId(command.getCommandId()); job.setOwnerId(command.getUserId()); job.setStatus(ExecutionStatus.STARTED); <START> job.setStartTime(new Date()); <END> job.setJobRepository(JobRepositoryFactory.getJobRepository()); job.setCorrelationId(Guid.NewGuid().toString()); return job; }</code><technical_language>I get passed JobReposotory Job</technical_language>

Target:
public static Job createJob(VdcActionType actionType, CommandBase<?> command) { Job job = new Job(); job.setId(Guid.NewGuid()); job.setActionType(actionType); job.setDescription(actionType.name()); job.setCommandId(command.getCommandId()); job.setJobSubjectEntities(command.getPermissionCheckSubjects()); job.setCommandId(command.getCommandId()); job.setOwnerId(command.getUserId()); job.setStatus(ExecutionStatus.STARTED); job.setStartTime(new Date()); job.setCorrelationId(Guid.NewGuid().toString()); return job; }
Source:
<code>public AggregatedMemoryContext aggregateUserMemoryContext() { <START> return new InternalAggregatedMemoryContext(operatorMemoryContext.aggregateUserMemoryContext(), memoryFuture); <END> }</code><technical_language>adding UncloseableAggregatedMemoryContext throws if calls close</technical_language>

Target:
public AggregatedMemoryContext aggregateUserMemoryContext() { return new InternalAggregatedMemoryContext(operatorMemoryContext.aggregateUserMemoryContext(), memoryFuture, this::updatePeakMemoryReservations, false); }
Source:
<code>public static boolean insertHook(IHopper hopper, EnumFacing facing) { TileEntity tileEntity = hopper.getWorld().getTileEntity( new BlockPos(hopper.getXPos() + facing.getFrontOffsetX(), hopper.getYPos() + facing.getFrontOffsetY(), <START> hopper.getZPos() + facing.getFrontOffsetZ())); <END> if (tileEntity == null) return false; if (!tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite())) return false; IItemHandler handler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); for (int i = 0; i < hopper.getSizeInventory(); i++) { ItemStack stackInSlot = hopper.getStackInSlot(i); if (stackInSlot != null) { ItemStack insert = stackInSlot.copy(); insert.stackSize = 1; ItemStack newStack = ItemHandlerHelper.insertItem(handler, insert, true); if (newStack == null || newStack.stackSize == 0) { ItemHandlerHelper.insertItem(handler, hopper.decrStackSize(i, 1), false); hopper.markDirty(); return true; } } } return true; }</code><technical_language>new BlockPos(x, y, z).offset(facing) easier read</technical_language>

Target:
public static boolean insertHook(IHopper hopper, EnumFacing facing) { TileEntity tileEntity = hopper.getWorld().getTileEntity( new BlockPos(hopper.getXPos(), hopper.getYPos(), hopper.getZPos()).offset(facing)); if (tileEntity == null) return false; if (!tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite())) return false; IItemHandler handler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite()); for (int i = 0; i < hopper.getSizeInventory(); i++) { ItemStack stackInSlot = hopper.getStackInSlot(i); if (stackInSlot != null) { ItemStack insert = stackInSlot.copy(); insert.stackSize = 1; ItemStack newStack = ItemHandlerHelper.insertItem(handler, insert, true); if (newStack == null || newStack.stackSize == 0) { ItemHandlerHelper.insertItem(handler, hopper.decrStackSize(i, 1), false); hopper.markDirty(); return true; } } } return true; }
Source:
<code>public void add(Block block, int position) { long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentBlockBuilder.getPositionCount(); if (totalPositions == capacity) { capacity *= 1.5; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); } if (isEmpty()) { headBlockIndex.set(currentGroupId, insertedBlockIndex); headPosition.set(currentGroupId, insertedPosition); } else { long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); nextPosition.set(absoluteTailAddress, insertedPosition); } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); type.appendTo(block, position, currentBlockBuilder); totalPositions++; <START> if (pageBuilderStatus.getSizeInBytes() > MAX_BLOCK_SIZE) { <END> valueBlocksRetainedSizeInBytes += currentBlockBuilder.getRetainedSizeInBytes(); sumPositions.add(totalPositions); pageBuilderStatus = new PageBuilderStatus(MAX_BLOCK_SIZE, MAX_BLOCK_SIZE); currentBlockBuilder = currentBlockBuilder.newBlockBuilderLike(pageBuilderStatus.createBlockBuilderStatus()); values.add(currentBlockBuilder); verify(values.size() <= MAX_NUM_BLOCKS); } }</code><technical_language>pageBuilderStatus.isFull()</technical_language>

Target:
public void add(Block block, int position) { long currentGroupId = getGroupId(); short insertedBlockIndex = (short) (values.size() - 1); int insertedPosition = currentBlockBuilder.getPositionCount(); if (totalPositions == capacity) { capacity *= 1.5; nextBlockIndex.ensureCapacity(capacity); nextPosition.ensureCapacity(capacity); } if (isEmpty()) { headBlockIndex.set(currentGroupId, insertedBlockIndex); headPosition.set(currentGroupId, insertedPosition); } else { long absoluteTailAddress = toAbsolutePosition(tailBlockIndex.get(currentGroupId), tailPosition.get(currentGroupId)); nextBlockIndex.set(absoluteTailAddress, insertedBlockIndex); nextPosition.set(absoluteTailAddress, insertedPosition); } tailBlockIndex.set(currentGroupId, insertedBlockIndex); tailPosition.set(currentGroupId, insertedPosition); type.appendTo(block, position, currentBlockBuilder); totalPositions++; if (pageBuilderStatus.isFull()) { valueBlocksRetainedSizeInBytes += currentBlockBuilder.getRetainedSizeInBytes(); sumPositions.add(totalPositions); pageBuilderStatus = new PageBuilderStatus(MAX_BLOCK_SIZE, MAX_BLOCK_SIZE); currentBlockBuilder = currentBlockBuilder.newBlockBuilderLike(pageBuilderStatus.createBlockBuilderStatus()); values.add(currentBlockBuilder); verify(values.size() <= MAX_NUM_BLOCKS); } }
Source:
<code><START> public Split(ConnectorId connectorId, ConnectorTransactionHandle transactionHandle, ConnectorSplit connectorSplit) <END> { this(connectorId, transactionHandle, connectorSplit, DriverLifeCycle.taskWide()); }</code><technical_language>Consider inlineing this. of users in test code *might* nicer force callers decide lifecycle explicitly</technical_language>

Target:
public Split(ConnectorId connectorId, ConnectorTransactionHandle transactionHandle, ConnectorSplit connectorSplit) { this(connectorId, transactionHandle, connectorSplit, Lifespan.taskWide()); }
Source:
<code><START> public static int incrementSequenceNumber(int value, int delta) { <END> if (Integer.MAX_VALUE - delta >= value) { return value + delta; } else { return delta - (Integer.MAX_VALUE - value); } }</code><technical_language>this anywhere, adding some flexibility "in case"</technical_language>

Target:
public static int incrementSequenceNumber(int value, int delta) { if (Integer.MAX_VALUE - delta >= value) { return value + delta; } else { return delta - (Integer.MAX_VALUE - value) - 1; } }
Source:
<code>public void processMessage(final ObjectMessage message) { LOGGER.info("Processing microgrids set data request message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; SetDataRequest setDataRequest = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); <START> if (message.getObject() != null && message.getObject() instanceof SetDataRequest) { <END> setDataRequest = (SetDataRequest) message.getObject(); } } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); return; } try { LOGGER.info("Calling application service function: {}", messageType); this.adHocManagementService.handleSetDataRequest(organisationIdentification, deviceIdentification, correlationUid, messageType, setDataRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }</code><technical_language>null check is care of instanceof removed</technical_language>

Target:
public void processMessage(final ObjectMessage message) { LOGGER.info("Processing microgrids set data request message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; SetDataRequest setDataRequest = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); if (message.getObject() instanceof SetDataRequest) { setDataRequest = (SetDataRequest) message.getObject(); } } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); LOGGER.debug("correlationUid: {}", correlationUid); LOGGER.debug("messageType: {}", messageType); LOGGER.debug("organisationIdentification: {}", organisationIdentification); LOGGER.debug("deviceIdentification: {}", deviceIdentification); return; } try { LOGGER.info("Calling application service function: {}", messageType); this.adHocManagementService.handleSetDataRequest(organisationIdentification, deviceIdentification, correlationUid, messageType, setDataRequest); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }
Source:
<code>public static void preUpdateSchemaOwner(DDLMessage.DDLChange change, DataDictionary dd, DependencyManager dm) throws StandardException { if (LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG,"preUpdateSchemaOwner with change=%s",change); dd.getDataDictionaryCache().schemaCacheRemove(change.getUpdateSchemaOwner().getSchemaName()); dd.getDataDictionaryCache().clearPermissionCache(); <START> dd.getDataDictionaryCache().clearOidTdCache(); <END> }</code><technical_language>normal dm.invalidateFor() work here</technical_language>

Target:
public static void preUpdateSchemaOwner(DDLMessage.DDLChange change, DataDictionary dd, DependencyManager dm) throws StandardException { if (LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG,"preUpdateSchemaOwner with change=%s",change); dd.getDataDictionaryCache().schemaCacheRemove(change.getUpdateSchemaOwner().getSchemaName()); dd.getDataDictionaryCache().clearPermissionCache(); dd.getDataDictionaryCache().clearOidTdCache(); dd.getDataDictionaryCache().clearNameTdCache(); }
Source:
<code>public Set<Attribute<GlobalCredentialsConfiguration,?>> describe() { HashSet<Attribute<GlobalCredentialsConfiguration, ?>> set = new HashSet<>(); Attribute<GlobalCredentialsConfiguration, SystemCredentialsProvider> system = new Attribute<GlobalCredentialsConfiguration, SystemCredentialsProvider>("system", SystemCredentialsProvider.class) .getter(t -> SystemCredentialsProvider.getInstance()) .setter(noop()); set.add(system); <START> for(CredentialsProvider provider : CredentialsProvider.all()) { <END> Symbol s = provider.getClass().getAnnotation(Symbol.class); String name; if (s != null) { name = s.value()[0]; } else { name = provider.getClass().getSimpleName(); } set.add(new Attribute<GlobalCredentialsConfiguration, CredentialsProvider>(name, provider.getClass()) .getter(t -> provider) .setter(noop())); } return set; }</code><technical_language>spacing suggestion for (CredentialsProvider provider : CredentialsProvider.all()) {</technical_language>

Target:
public Set<Attribute<GlobalCredentialsConfiguration,?>> describe() { HashSet<Attribute<GlobalCredentialsConfiguration, ?>> set = new HashSet<>(); Attribute<GlobalCredentialsConfiguration, SystemCredentialsProvider> system = new Attribute<GlobalCredentialsConfiguration, SystemCredentialsProvider>("system", SystemCredentialsProvider.class) .getter(t -> SystemCredentialsProvider.getInstance()) .setter(noop()); set.add(system); for (CredentialsProvider provider : CredentialsProvider.all()) { String symbol = DescribableAttribute.getPreferredSymbol(provider.getDescriptor(), CredentialsProvider.class, provider.getClass()); set.add(new Attribute<GlobalCredentialsConfiguration, CredentialsProvider>(symbol, provider.getClass()) .getter(t -> provider) .setter(noop())); } return set; }
Source:
<code>private void extractSamplingInfo(TupleBatch tb) throws Exception { Preconditions.checkArgument(tb != null); int workerID; Type col0Type = tb.getSchema().getColumnType(0); if (col0Type == Type.INT_TYPE) { workerID = tb.getInt(0, 0); } else if (col0Type == Type.LONG_TYPE) { workerID = (int) tb.getLong(0, 0); } else { throw new DbException("WorkerID column must be of type INT or LONG"); } Preconditions.checkState(workerID == getNodeID(), "Invalid WorkerID for this worker. Expected %s, but received %s", getNodeID(), workerID); Type col1Type = tb.getSchema().getColumnType(1); if (col1Type == Type.INT_TYPE) { streamSize = tb.getInt(1, 0); } else if (col1Type == Type.LONG_TYPE) { streamSize = (int) tb.getLong(1, 0); } else { throw new DbException("StreamSize column must be of type INT or LONG"); } Preconditions.checkState(streamSize >= 0, "streamSize cannot be negative"); Type col2Type = tb.getSchema().getColumnType(2); if (col2Type == Type.INT_TYPE) { sampleSize = tb.getInt(2, 0); } else if (col2Type == Type.LONG_TYPE) { sampleSize = (int) tb.getLong(2, 0); } else { throw new DbException("SampleSize column must be of type INT or LONG"); } Preconditions.checkState(sampleSize >= 0, "sampleSize cannot be negative"); Type col3Type = tb.getSchema().getColumnType(3); if (col3Type == Type.STRING_TYPE) { <START> sampleType = tb.getString(3, 0); <END> } else { throw new DbException("SampleType column must be of type STRING"); } }</code><technical_language>If change SampleType enum catch exception parsing unknown string throw DbException</technical_language>

Target:
private void extractSamplingInfo(TupleBatch tb) throws Exception { Preconditions.checkArgument(tb != null); int workerID; Type col0Type = tb.getSchema().getColumnType(0); if (col0Type == Type.INT_TYPE) { workerID = tb.getInt(0, 0); } else if (col0Type == Type.LONG_TYPE) { workerID = (int) tb.getLong(0, 0); } else { throw new DbException("WorkerID column must be of type INT or LONG"); } Preconditions.checkState(workerID == getNodeID(), "Invalid WorkerID for this worker. Expected %s, but received %s", getNodeID(), workerID); Type col1Type = tb.getSchema().getColumnType(1); if (col1Type == Type.INT_TYPE) { streamSize = tb.getInt(1, 0); } else if (col1Type == Type.LONG_TYPE) { streamSize = (int) tb.getLong(1, 0); } else { throw new DbException("StreamSize column must be of type INT or LONG"); } Preconditions.checkState(streamSize >= 0, "streamSize cannot be negative"); Type col2Type = tb.getSchema().getColumnType(2); if (col2Type == Type.INT_TYPE) { sampleSize = tb.getInt(2, 0); } else if (col2Type == Type.LONG_TYPE) { sampleSize = (int) tb.getLong(2, 0); } else { throw new DbException("SampleSize column must be of type INT or LONG"); } Preconditions.checkState(sampleSize >= 0, "sampleSize cannot be negative"); Type col3Type = tb.getSchema().getColumnType(3); if (col3Type == Type.STRING_TYPE) { String col3Val = tb.getString(3, 0); try { sampleType = SamplingType.valueOf(col3Val); } catch (IllegalArgumentException e) { throw new DbException("Invalid SampleType: " + col3Val); } } else { throw new DbException("SampleType column must be of type STRING"); } }
Source:
<code>public void testExtension(){ <START> stateStore.storeExtensionBean("test1", "test_location", ExtensionType.TRUSTED, "test_description", "falcon"); <END> Assert.assertEquals(stateStore.getAllExtensions().size(), 1); ExtensionBean bean = stateStore.getDetail("test1"); Assert.assertEquals(bean.getLocation(), "test_location"); stateStore.deleteExtensionsOfType(ExtensionType.TRUSTED); Assert.assertEquals(stateStore.getAllExtensions().size(), 0); }</code><technical_language>rename falconUser for easy readability</technical_language>

Target:
public void testExtension(){ stateStore.storeExtensionBean("test1", "test_location", ExtensionType.TRUSTED, "test_description", "falconUser"); Assert.assertEquals(stateStore.getAllExtensions().size(), 1); ExtensionBean bean = stateStore.getDetail("test1"); Assert.assertEquals(bean.getLocation(), "test_location"); stateStore.deleteExtensionsOfType(ExtensionType.TRUSTED); Assert.assertEquals(stateStore.getAllExtensions().size(), 0); }
Source:
<code>public Map<String, String> getMapping(final JID jid) { final Map<String, String> result = new HashMap<>(); final String mapping = store.getString(RESOURCE_MAPPING_STORE_PREFIX + jid.getBase()); if (mapping.isEmpty()) return result; <START> final String[] names = SPLIT_PATTERN.split(mapping); <END> for (int i = 0; i < names.length; i += 2) { if (names[i].isEmpty() || names[i + 1].isEmpty()) continue; result.put(unescape(names[i]), unescape(names[i + 1])); } return result; }</code><technical_language>Check array length is avoid index out of bound exception in case of data corruption? I this is necessary</technical_language>

Target:
public Map<String, String> getMapping(final JID jid) { final Map<String, String> result = new HashMap<>(); final String mapping = store.getString(RESOURCE_MAPPING_STORE_PREFIX + jid.getBase()); if (mapping.isEmpty()) return result; final String[] names = SPLIT_PATTERN.split(mapping); for (int i = 0; i < names.length - 1; i += 2) { if (names[i].isEmpty() || names[i + 1].isEmpty()) continue; result.put(unescape(names[i]), unescape(names[i + 1])); } return result; }
Source:
<code>public static void main(String[] args) { MsbContext msbContext = new MsbContextBuilder(). enableShutdownHook(true). build(); MessageTemplate messageTemplate = new MessageTemplate().withTags("ping-static-tag"); RequestOptions requestOptions = new RequestOptions.Builder() .withAckTimeout(1000) .withResponseTimeout(2000) .withWaitForResponses(1) .withMessageTemplate(messageTemplate) .build(); ObjectFactory objectFactory = msbContext.getObjectFactory(); Requester<Payload> requester = objectFactory.createRequester("pingpong:namespace", requestOptions) .onResponse(payload -> LOG.info(String.format("Received response '%s'", payload.getBody()))) .onEnd(arg -> LOG.info("Received all expected responses")); Payload pingPayload = new Payload.Builder<Object, Object, Object, String>() .withBody("PING") .build(); <START> requester.publish(pingPayload, "ping-dynamic-tag"); END> }</code><technical_language>dynamic :)</technical_language>

Target:
public static void main(String[] args) { MsbContext msbContext = new MsbContextBuilder(). enableShutdownHook(true). build(); MessageTemplate messageTemplate = new MessageTemplate().withTags("ping-service"); RequestOptions requestOptions = new RequestOptions.Builder() .withAckTimeout(1000) .withResponseTimeout(2000) .withWaitForResponses(1) .withMessageTemplate(messageTemplate) .build(); ObjectFactory objectFactory = msbContext.getObjectFactory(); Requester<Payload> requester = objectFactory.createRequester("pingpong:namespace", requestOptions) .onResponse(payload -> LOG.info(String.format("Received response '%s'", payload.getBody()))) .onEnd(arg -> LOG.info("Received all expected responses")); Payload pingPayload = new Payload.Builder<Object, Object, Object, String>() .withBody("PING") .build(); requester.publish(pingPayload, UUID.randomUUID().toString()); }
Source:
<code>public V getAndRemove(K key) { boolean startedTx = startTxAndLock(key); <START> super.remove(key); <END> V prev = super.getAndRemove(key); stopTx(startedTx); return prev; }</code><technical_language>a bug - call super.remove super.getAndRemove. fix that? Also, I stopTx called in finally block</technical_language>

Target:
public V getAndRemove(K key) { boolean startedTx = false; V prev = null; try { startedTx = startTxAndLock(key); prev = super.getAndRemove(key); } finally { stopTx(startedTx); } return prev; }
Source:
<code>protected void execute() { <START> logger.debug("Querying Ecobee API"); <END> try { for (String userid : credentialsCache.keySet()) { OAuthCredentials oauthCredentials = getOAuthCredentials(userid); Selection selection = createSelection(oauthCredentials); if (selection == null) { logger.debug("Nothing to retrieve for '{}'; skipping thermostat retrieval.", oauthCredentials.userid); continue; } if (oauthCredentials.noAccessToken()) { if (!oauthCredentials.refreshTokens()) { logger.warn("Periodic poll skipped for '{}'.", oauthCredentials.userid); continue; } } readEcobee(oauthCredentials, selection); } } catch (Exception e) { logger.error("Error reading from Ecobee:", e); } }</code><technical_language>please remove statement decrease TRACE (preferably remove it)</technical_language>

Target:
protected void execute() { logger.trace("Querying Ecobee API"); try { for (String userid : credentialsCache.keySet()) { OAuthCredentials oauthCredentials = getOAuthCredentials(userid); Selection selection = createSelection(oauthCredentials); if (selection == null) { logger.debug("Nothing to retrieve for '{}'; skipping thermostat retrieval.", oauthCredentials.userid); continue; } if (oauthCredentials.noAccessToken()) { if (!oauthCredentials.refreshTokens()) { logger.warn("Periodic poll skipped for '{}'.", oauthCredentials.userid); continue; } } readEcobee(oauthCredentials, selection); } } catch (Exception e) { logger.error("Error reading from Ecobee:", e); } }
Source:
<code>public void removeReferenceToFilter() throws IOException { page.switchToReferenceToFilterSubTab(); ResourceManager manager = page.getConfigFragment().getResourceManager(); manager.removeResource(REWRITE_FILTER_NAME).confirmAndDismissReloadRequiredMessage(); Assert.assertFalse("Filter reference " + REWRITE_FILTER_NAME + " is present in table!", <START> manager.isResourcePresent(REWRITE_FILTER_NAME)); <END> }</code><technical_language>check in model</technical_language>

Target:
public void removeReferenceToFilter() throws Exception { page.switchToFilterReferencesSubTab(); ResourceManager manager = page.getConfigFragment().getResourceManager(); manager.removeResource(REWRITE_FILTER_ADDRESS.getLastPairValue()).confirmAndDismissReloadRequiredMessage(); Assert.assertFalse("Filter reference " + REWRITE_FILTER_ADDRESS.getLastPairValue() + " is present in table!", manager.isResourcePresent(REWRITE_FILTER_ADDRESS.getLastPairValue())); new ResourceVerifier(REWRITE_FILTER_REFERENCE_ADDRESS, client).verifyDoesNotExist(); }
Source:
<code>private static Status fromStatusCode(final int code) { for (final Status status: Status.values()) { if (status.getStatusCode() == code) { return status; } } <START> return null; <END> }</code><technical_language>this is exceptional situation</technical_language>

Target:
private static Status fromStatusCode(final int code) throws UnknownStatusCodeException { for (final Status status: Status.values()) { if (status.getStatusCode() == code) { return status; } } throw new UnknownStatusCodeException("Unknown status code: " + code); }
Source:
<code><START> static public Map<String, String> generate(Config jobConfig, List<TableDescriptor> tableDescriptors) { <END> Map<String, String> tableConfig = new HashMap<>(); tableDescriptors.forEach(tableDescriptor -> tableConfig.putAll(tableDescriptor.toConfig(jobConfig))); return tableConfig; }</code><technical_language>Minor: I tell, this is in place (JobNodeConfigurationGenerator). this is simple now, prefer removing this class inlining generate method there</technical_language>

Target:
static public Map<String, String> generate(Config jobConfig, List<TableDescriptor> tableDescriptors) { Map<String, String> tableConfig = new HashMap<>(); tableDescriptors.forEach(tableDescriptor -> tableConfig.putAll(tableDescriptor.toConfig(jobConfig))); LOG.info("TableConfigGenerator has generated configs {}", tableConfig); return tableConfig; }
Source:
<code>protected void executeCommand() { GetDiskAlignmentVDSCommandParameters parameters; acquireExclusiveDiskDbLocks(); Guid vmId = NGuid.Empty; if (getDiskType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) getDisk(); GetDiskImageAlignmentVDSCommandParameters imageParameters = new GetDiskImageAlignmentVDSCommandParameters(getVdsIdInPool(), vmId); imageParameters.setPoolId(getStoragePoolId()); imageParameters.setDomainId(diskImage.getStorageIds().get(0)); imageParameters.setImageGroupId(diskImage.getimage_group_id()); imageParameters.setImageId(diskImage.getImageId()); parameters = imageParameters; } else if (getDiskType() == DiskStorageType.LUN) { LunDisk lunDisk = (LunDisk) getDisk(); GetDiskLunAlignmentVDSCommandParameters lunParameters = new GetDiskLunAlignmentVDSCommandParameters(getVdsIdInPool(), vmId); lunParameters.setLunGuid(lunDisk.getLun().getLUN_id()); parameters = lunParameters; } else { throw new VdcBLLException(VdcBllErrors.ENGINE, "Unknown DiskStorageType: " + getDiskType().toString() + " Disk id: " + getDisk().getId().toString()); } <START> <END> Boolean isDiskAligned = (Boolean) runVdsCommand( VDSCommandType.GetDiskAlignment, parameters).getReturnValue(); getDisk().setAlignment(isDiskAligned ? DiskAlignment.Aligned : DiskAlignment.Misaligned); getDisk().setLastAlignmentScan(new Date()); getBaseDiskDao().update(getDisk()); setSucceeded(true); releaseExclusiveDiskDbLocks(); }</code><technical_language>please remember add comptabillity check prior executing</technical_language>

Target:
protected void executeCommand() { GetDiskAlignmentVDSCommandParameters parameters; acquireExclusiveDiskDbLocks(); Guid vmId = NGuid.Empty; if (getDiskType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) getDisk(); GetDiskImageAlignmentVDSCommandParameters imageParameters = new GetDiskImageAlignmentVDSCommandParameters(getVdsIdInPool(), vmId); imageParameters.setPoolId(getStoragePoolId()); imageParameters.setDomainId(diskImage.getStorageIds().get(0)); imageParameters.setImageGroupId(diskImage.getimage_group_id()); imageParameters.setImageId(diskImage.getImageId()); parameters = imageParameters; } else if (getDiskType() == DiskStorageType.LUN) { LunDisk lunDisk = (LunDisk) getDisk(); GetDiskLunAlignmentVDSCommandParameters lunParameters = new GetDiskLunAlignmentVDSCommandParameters(getVdsIdInPool(), vmId); lunParameters.setLunId(lunDisk.getLun().getLUN_id()); parameters = lunParameters; } else { throw new VdcBLLException(VdcBllErrors.ENGINE, "Unknown DiskStorageType: " + getDiskType().toString() + " Disk id: " + getDisk().getId().toString()); } Boolean isDiskAligned = (Boolean) runVdsCommand( VDSCommandType.GetDiskAlignment, parameters).getReturnValue(); getDisk().setAlignment(isDiskAligned ? DiskAlignment.Aligned : DiskAlignment.Misaligned); getDisk().setLastAlignmentScan(new Date()); getBaseDiskDao().update(getDisk()); setSucceeded(true); releaseExclusiveDiskDbLocks(); }
Source:
<code>public void onPartitionsPolled(@NotNull ConsumerRecords<?, ?> consumerRecords) { Collection<TopicPartition> topicPartitions = consumerRecords.partitions(); topicPartitions.forEach(topicPartition -> { List<? extends ConsumerRecord<?, ?>> partitionRecords = consumerRecords.records(topicPartition); ConsumerRecord<?, ?> lastRecord = partitionRecords.get(partitionRecords.size() - 1); Map<Integer, Long> partitionOffsetMap = _consumerOffsets.putIfAbsent(topicPartition.topic(), new ConcurrentHashMap<>()); <START> partitionOffsetMap.put(topicPartition.partition(), lastRecord.offset()); <END> }); }</code><technical_language>testing changes</technical_language>

Target:
public void onPartitionsPolled(@NotNull ConsumerRecords<?, ?> consumerRecords) { Collection<TopicPartition> topicPartitions = consumerRecords.partitions(); topicPartitions.forEach(topicPartition -> { List<? extends ConsumerRecord<?, ?>> partitionRecords = consumerRecords.records(topicPartition); ConsumerRecord<?, ?> lastRecord = partitionRecords.get(partitionRecords.size() - 1); Map<Integer, Long> partitionOffsetMap = _consumerOffsets.computeIfAbsent(topicPartition.topic(), k -> new ConcurrentHashMap<>()); partitionOffsetMap.put(topicPartition.partition(), lastRecord.offset()); }); }
Source:
<code>default <U> ClosableIterator<U> map(Function<T, U> mapper) { <START> return ClosableIterators.wrap(Iterators.transform(this, (com.google.common.base.Function)mapper)); <END> }</code><technical_language>nit: baseline requires a space here: ...Function) mapper); enforce baseline compliance for atlasdb-commons, avoid introducing new issues</technical_language>

Target:
default <U> ClosableIterator<U> map(Function<T, U> mapper) { return ClosableIterators.wrap(Iterators.transform(this, mapper::apply)); }
Source:
<code>private HttpResponse initResponse(HttpRequest request, int statusCode, HttpHeaders headers, String body) { return new HttpResponse(request) { @Override public int getStatusCode() { return statusCode; } @Override public String getHeaderValue(String name) { return headers.getValue(name); } @Override public HttpHeaders getHeaders() { return headers; } @Override public Flux<ByteBuffer> getBody() { return Flux.just(ByteBuffer.wrap(body.getBytes(StandardCharsets.UTF_8))); } @Override public Mono<byte[]> getBodyAsByteArray() { return Mono.just(body.getBytes(StandardCharsets.UTF_8)); } @Override public Mono<String> getBodyAsString() { return Mono.just(body); } @Override public Mono<String> getBodyAsString(Charset charset) { <START> return Mono.just(body); <END> } }; }</code><technical_language>this provided charset</technical_language>

Target:
private HttpResponse initResponse(HttpRequest request, int statusCode, HttpHeaders headers, String body) { return new HttpResponse(request) { @Override public int getStatusCode() { return statusCode; } @Override public String getHeaderValue(String name) { return headers.getValue(name); } @Override public HttpHeaders getHeaders() { return headers; } @Override public Flux<ByteBuffer> getBody() { return Flux.just(ByteBuffer.wrap(body.getBytes(StandardCharsets.UTF_8))); } @Override public Mono<byte[]> getBodyAsByteArray() { return Mono.just(body.getBytes(StandardCharsets.UTF_8)); } @Override public Mono<String> getBodyAsString() { return Mono.just(body); } @Override public Mono<String> getBodyAsString(Charset charset) { return getBodyAsByteArray().map(body -> new String(body, charset)); } }; }
Source:
<code>public ValidationResult check(Vertex vertex) { List<ValidationResult> validationResults = Lists.newArrayList(); String[] vertexTypes = getEntityTypesOrDefault(vertex); String id = vertex.value("tim_id"); vertex.edges(Direction.BOTH).forEachRemaining(edge -> { <START> if (Objects.equals(edge.label(), "VERSION_OF")) { END> String[] edgeTypes = getEntityTypesOrDefault(edge); for (String edgeType : edgeTypes) { Optional<Collection> collection = vres.getCollectionForType(edgeType); String edgeId = edge.value("tim_id"); if (!collection.isPresent()) { validationResults.add( new ElementValidationResult(false, String.format("Edge with tim_id '%s' has contains unknown variant '%s'", edgeId, edgeType))); continue; } if (collection.get().getVre().getOwnType(vertexTypes) == null) { addInvalidVertex(validationResults, id, vertexTypes, edgeType, edgeId); } } } }); return new CompositeValidationResult(validationResults); }</code><technical_language>equal version_of</technical_language>

Target:
public ValidationResult check(Vertex vertex) { List<ValidationResult> validationResults = Lists.newArrayList(); String[] vertexTypes = getEntityTypesOrDefault(vertex); String id = vertex.value("tim_id"); vertex.edges(Direction.BOTH).forEachRemaining(edge -> { if (!Objects.equals(edge.label(), "VERSION_OF")) { String[] edgeTypes = getEntityTypesOrDefault(edge); for (String edgeType : edgeTypes) { Optional<Collection> collection = vres.getCollectionForType(edgeType); String edgeId = edge.value("tim_id"); if (!collection.isPresent()) { validationResults.add( new ElementValidationResult(false, String.format("Edge with tim_id '%s' has contains unknown variant '%s'", edgeId, edgeType))); continue; } if (collection.get().getVre().getOwnType(vertexTypes) == null) { addInvalidVertex(validationResults, id, vertexTypes, edgeType, edgeId); } } } }); return new CompositeValidationResult(validationResults); }