auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void executeQueryCommand() { StorageDomainStatic storage = DbFacade.getInstance().getStorageDomainStaticDao().get( getParameters().getStorageDomainId()); if (storage.getstorage_domain_type() == StorageDomainType.ImportExport) { VDSReturnValue retVal = null; try { retVal = executeVerb(); } catch (RuntimeException e) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("StorageDomainName", storage.getstorage_name()); AuditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_GET_VMS_INFO_FAILED); <START> throw e; <END> } buildOvfReturnValue(retVal.getReturnValue()); } else { getQueryReturnValue().setReturnValue(new java.util.ArrayList<VM>()); } }</code><technical_language>This create flood in event tab</technical_language>

Target:
protected void executeQueryCommand() { StorageDomainStatic storage = DbFacade.getInstance().getStorageDomainStaticDao().get( getParameters().getStorageDomainId()); if (storage.getstorage_domain_type() == StorageDomainType.ImportExport) { VDSReturnValue retVal = null; retVal = executeVerb(storage); buildOvfReturnValue(retVal.getReturnValue()); } else { getQueryReturnValue().setReturnValue(new java.util.ArrayList<VM>()); } }
Source:
<code>private boolean checkSelection(ISelection selection) { <START> if (selection instanceof StructuredSelection ) { <END> for (Object selected : ((StructuredSelection) selection).toList()) { if (selected instanceof AbstractFBNElementEditPart) { checkMapping(((AbstractFBNElementEditPart)selected).getModel()); } } } return (!selectedNetworkElements.isEmpty()); }</code><technical_language>a selectedNetworkElements.clear()</technical_language>

Target:
private boolean checkSelection(ISelection selection) { if (selection instanceof StructuredSelection) { for (Object selected : ((StructuredSelection) selection).toList()) { if ((selected instanceof FBEditPart) || (selected instanceof SubAppForFBNetworkEditPart)) { checkMapping(((AbstractFBNElementEditPart) selected).getModel()); } } } return (!selectedNetworkElements.isEmpty()); }
Source:
<code>protected abstract void tryDelete(String name, Jenkins jenkins) throws Exception; <START> protected void checkExists(T item, String item_s, String item_type) throws Exception{ <END> if(item == null) { throw new IllegalArgumentException("No such " + item_type + " '" + item_s + "'"); } return; }</code><technical_language>Weird argument names, inconsistent usual naming expressions</technical_language>

Target:
protected abstract void tryDelete(String name, Jenkins jenkins) throws Exception; protected void checkExists(T elementObject, String elementName, String elementType) throws Exception{ if(elementObject == null) { throw new IllegalArgumentException("No such " + elementType + " '" + elementName + "'"); } return; }
Source:
<code>public ResponseEntity<GeneralConfigViewModel> updateGeneralConfig(@RequestBody @Valid GeneralConfigBackingForm form, @PathVariable Integer id) { GeneralConfig updatedConfig = null; form.setId(id); updatedConfig = configRepository.update(form.getGeneralConfig()); if (form.getName().equalsIgnoreCase("log.level")) <START> setLogLevel(configRepository.getGeneralConfigByName("log.level").getValue()); <END> return new ResponseEntity<GeneralConfigViewModel>(new GeneralConfigViewModel(updatedConfig), HttpStatus.CREATED); }</code><technical_language>need for a static import here</technical_language>

Target:
public ResponseEntity<GeneralConfigViewModel> updateGeneralConfig(@RequestBody @Valid GeneralConfigBackingForm form, @PathVariable Integer id) { GeneralConfig updatedConfig = null; form.setId(id); updatedConfig = configRepository.update(form.getGeneralConfig()); if (form.getName().equalsIgnoreCase("log.level")) LoggerUtil.setLogLevel(configRepository.getGeneralConfigByName("log.level").getValue()); return new ResponseEntity<GeneralConfigViewModel>(new GeneralConfigViewModel(updatedConfig), HttpStatus.OK); }
Source:
<code><START> public <T extends AbstractEntity> List<CdoSnapshot> getChanges(final T entity) { <END> if(isAuditable(entity)) { return javers.findSnapshots(QueryBuilder.byInstanceId(entity.getId(), entity.getClass()).build()); } else { throw new DolphinRuntimeException("Entity not auditable"); } }</code><technical_language>Add not-null check here</technical_language>

Target:
public <T extends AbstractEntity> List<CdoSnapshot> getChanges(final T entity) { Assert.requireNonNull(entity , "entity"); if(isAuditable(entity)) { return javers.findSnapshots(QueryBuilder.byInstanceId(entity.getId(), entity.getClass()).build()); } else { throw new DolphinRuntimeException("Entity not auditable"); } }
Source:
<code>void fetchRepositoryAndPackageMetaData(GoPluginDescriptor pluginDescriptor) { try { <START> RepositoryConfiguration repositoryConfiguration = packageAsRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id()); <END> if (repositoryConfiguration != null) { repositoryMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(repositoryConfiguration)); } com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = packageAsRepositoryExtension.getPackageConfiguration(pluginDescriptor.id()); if (packageConfiguration != null) { packageMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(packageConfiguration)); } } catch (GoPluginFrameworkException e) { LOGGER.error(String.format("Failed to fetch package metadata for plugin : %s", pluginDescriptor.id()), e); } }</code><technical_language>this a task plugin? this fail? I mean, if a task plugin well, registered, this a problem, right? plugin load call pluginLoaded method in this class. will, in turn, call this method. This call packageAsRepositoryExtension.getRepositoryConfiguration() (I think) fail, send a JSON request task plugin. code line 51 (earlier code) metadata for plugins a reference of PackageMaterialProvider.class. is equivalent for JSON messaging based plugins? capabilities of plugin verified? I missed something</technical_language>

Target:
void fetchRepositoryAndPackageMetaData(GoPluginDescriptor pluginDescriptor) { try { RepositoryConfiguration repositoryConfiguration = packageAsRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id()); com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = packageAsRepositoryExtension.getPackageConfiguration(pluginDescriptor.id()); if (repositoryConfiguration == null) { throw new RuntimeException(format("Plugin[%s] returned null repository configuration", pluginDescriptor.id())); } if (packageConfiguration == null) { throw new RuntimeException(format("Plugin[%s] returned null package configuration", pluginDescriptor.id())); } repositoryMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(repositoryConfiguration)); packageMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(packageConfiguration)); } catch (GoPluginFrameworkException e) { LOGGER.error(format("Failed to fetch package metadata for plugin : %s", pluginDescriptor.id()), e); } }
Source:
<code>public static int getSkyBlendColour(World world, int playerX, int playerY, int playerZ) { if (playerX == skyX && playerZ == skyZ && skyInit) { return skyRGBMultiplier; } skyInit = true; GameSettings settings = Minecraft.getMinecraft().gameSettings; int[] ranges = ForgeModContainer.blendRanges; int distance = 0; if (settings.fancyGraphics && settings.renderDistanceChunks >= 0 && settings.renderDistanceChunks < ranges.length) { distance = ranges[settings.renderDistanceChunks]; } int r = 0; int g = 0; int b = 0; int divider = 0; for (int x = -distance; x <= distance; ++x) { for (int z = -distance; z <= distance; ++z) { BiomeGenBase biome = world.getBiomeGenForCoords(playerX + x, playerZ + z); int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(playerX + x, playerY, playerZ + z)); r += (colour & 0xFF0000) >> 16; g += (colour & 0x00FF00) >> 8; b += colour & 0x0000FF; divider++; } } <START> SkyColorEvent event = new SkyColorEvent(r, g, b, divider); <END> MinecraftForge.EVENT_BUS.post(event); r = event.red; g = event.green; b = event.blue; int multiplier = (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255; skyX = playerX; skyZ = playerZ; skyRGBMultiplier = multiplier; return skyRGBMultiplier; }</code><technical_language>this is done, giving sum of reds, greens blues give "divider" a multiplier (which of other). want divide r, g b divider leave out multiplier parameter, instead add distance variable event, mods search</technical_language>

Target:
public static int getSkyBlendColour(World world, int playerX, int playerY, int playerZ) { if (playerX == skyX && playerZ == skyZ && skyInit) { return skyRGBMultiplier; } skyInit = true; GameSettings settings = Minecraft.getMinecraft().gameSettings; int[] ranges = ForgeModContainer.blendRanges; int distance = 0; if (settings.fancyGraphics && settings.renderDistanceChunks >= 0 && settings.renderDistanceChunks < ranges.length) { distance = ranges[settings.renderDistanceChunks]; } int r = 0; int g = 0; int b = 0; int divider = 0; for (int x = -distance; x <= distance; ++x) { for (int z = -distance; z <= distance; ++z) { BiomeGenBase biome = world.getBiomeGenForCoords(playerX + x, playerZ + z); int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(playerX + x, playerY, playerZ + z)); r += (colour & 0xFF0000) >> 16; g += (colour & 0x00FF00) >> 8; b += colour & 0x0000FF; divider++; } } SkyColorEvent event = new SkyColorEvent(r / divider, g / divider, b / divider); MinecraftForge.EVENT_BUS.post(event); r = event.red; g = event.green; b = event.blue; int multiplier = (r & 255) << 16 | (g & 255) << 8 | b & 255; skyX = playerX; skyZ = playerZ; skyRGBMultiplier = multiplier; return skyRGBMultiplier; }
Source:
<code><START> public String getMobileUri() { <END> try { return String.format( "%1$s://%2$s/wiki/%3$s%4$s", WikipediaApp.PROTOCOL, getSite().getApiDomain(), URLEncoder.encode(getPrefixedText().replace(" ", "_"), "utf-8"), (this.fragment != null && this.fragment.length() > 0) ? ("#" + this.fragment) : "" ); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }</code><technical_language>Minor nitpick! This duplicates code getCanonicalUri. a private method generates URI for domain, getCanonicalUri getMobileUri call that</technical_language>

Target:
public String getMobileUri() { return getUriForDomain(getSite().getApiDomain()); }
Source:
<code>public static ImageType getType(List<ImageHeaderParser> parsers, @Nullable InputStream is, ArrayPool byteArrayPool) throws IOException { if (is == null) { return ImageType.UNKNOWN; } if (!is.markSupported()) { is = new RecyclableBufferedInputStream(is, byteArrayPool); } is.mark(MARK_POSITION); <START> for (ImageHeaderParser parser : parsers) { <END> try { ImageType type = parser.getType(is); if (type != ImageType.UNKNOWN) { return type; } } finally { is.reset(); } } return ImageType.UNKNOWN; }</code><technical_language>deliberate. for allocates iterator, avoid writing loop ourselves. rest of loops unfortunately</technical_language>

Target:
public static ImageType getType(List<ImageHeaderParser> parsers, @Nullable InputStream is, ArrayPool byteArrayPool) throws IOException { if (is == null) { return ImageType.UNKNOWN; } if (!is.markSupported()) { is = new RecyclableBufferedInputStream(is, byteArrayPool); } is.mark(MARK_POSITION); for (int i = 0, size = parsers.size(); i < size; i++) { ImageHeaderParser parser = parsers.get(i); try { ImageType type = parser.getType(is); if (type != ImageType.UNKNOWN) { return type; } } finally { is.reset(); } } return ImageType.UNKNOWN; }
Source:
<code>public void createContent(Composite parent) { this.controls = new LinkedHashMap<>(); GridLayout layout = new GridLayout(1, false); parent.setLayout(layout); boolean firstControl = true; for (Entry<ITextHover, IInformationControlCreator> hoverControlCreator : this.creators.entrySet()) { IInformationControl informationControl = hoverControlCreator.getValue().createInformationControl(parent.getShell()); if (informationControl instanceof AbstractInformationControl) { List<Control> children = Arrays.asList(((AbstractInformationControl)informationControl).getShell().getChildren()); children.remove(parent); if (children.isEmpty() ) { continue; } for (Control control : children) { control.setParent(parent); control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); } if (!firstControl) { <START> ((GridData)children.get(0).getLayoutData()).verticalIndent = 0; <END> } controls.put(hoverControlCreator.getKey(), informationControl); firstControl = false; } else { GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, GenericEditorPlugin.BUNDLE_ID, "Only text hovers producing an AbstractInformationControl can be aggregated; got a " + informationControl.getClass().getSimpleName())); informationControl.dispose(); } } }</code><technical_language>remove this line</technical_language>

Target:
public void createContent(Composite parent) { this.controls = new LinkedHashMap<>(); GridLayout layout = new GridLayout(1, false); parent.setLayout(layout); boolean firstControl = true; for (Entry<ITextHover, IInformationControlCreator> hoverControlCreator : this.creators.entrySet()) { IInformationControl informationControl = hoverControlCreator.getValue().createInformationControl(parent.getShell()); if (informationControl instanceof AbstractInformationControl) { List<Control> children = Arrays.asList(((AbstractInformationControl)informationControl).getShell().getChildren()); children.remove(parent); if (children.isEmpty() ) { continue; } for (Control control : children) { control.setParent(parent); control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); } controls.put(hoverControlCreator.getKey(), informationControl); firstControl = false; } else { GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, GenericEditorPlugin.BUNDLE_ID, "Only text hovers producing an AbstractInformationControl can be aggregated; got a " + informationControl.getClass().getSimpleName())); informationControl.dispose(); } } }
Source:
<code>private static <T> int countGroupByLayers(final Query<T> query, final int foundNum) { if (foundNum == MAX_MERGE_BUFFER_NUM + 1) { return foundNum; } int maxFoundFromChildren = -1; for (DataSourceWithSegmentSpec eachSpec : query.getDataSources()) { final DataSource dataSource = eachSpec.getDataSource(); if (dataSource instanceof QueryDataSource) { QueryDataSource queryDataSource = (QueryDataSource) dataSource; if (queryDataSource.getQuery() instanceof GroupByQuery) { final int tmp = countGroupByLayers(queryDataSource.getQuery(), foundNum + 1); <START> maxFoundFromChildren = tmp > maxFoundFromChildren ? tmp : maxFoundFromChildren; <END> } else { final int tmp = countGroupByLayers(queryDataSource.getQuery(), 0); maxFoundFromChildren = tmp > maxFoundFromChildren ? tmp : maxFoundFromChildren; } } } if (maxFoundFromChildren > -1) { return maxFoundFromChildren > foundNum ? maxFoundFromChildren : foundNum; } else { return foundNum; } }</code><technical_language>Math.max</technical_language>

Target:
private static <T> int countGroupByLayers(final Query<T> query, final int foundNum) { if (foundNum == MAX_MERGE_BUFFER_NUM + 1) { return foundNum; } int maxFoundFromChildren = -1; for (DataSourceWithSegmentSpec eachSpec : query.getDataSources()) { final DataSource dataSource = eachSpec.getDataSource(); if (dataSource instanceof QueryDataSource) { QueryDataSource queryDataSource = (QueryDataSource) dataSource; if (queryDataSource.getQuery() instanceof GroupByQuery) { final int foundFromChild = countGroupByLayers(queryDataSource.getQuery(), foundNum + 1); maxFoundFromChildren = Math.max(foundFromChild, maxFoundFromChildren); } else { final int foundFromChild = countGroupByLayers(queryDataSource.getQuery(), 0); maxFoundFromChildren = Math.max(foundFromChild, maxFoundFromChildren); } } } return Math.max(maxFoundFromChildren, foundNum); }
Source:
<code>public void testResolve() throws IOException { String regexStr = "^/user/(?<username>\\w+)"; String dstPathStr = "/namenode1/testResolve/$username"; String settingsStr = null; RegexMountPoint regexMountPoint = new RegexMountPoint(inodeTree, regexStr, dstPathStr, settingsStr); regexMountPoint.initialize(); InodeTree.ResolveResult resolveResult = regexMountPoint.resolve("/user/hadoop/file1", true); Assert.assertEquals(resolveResult.kind, InodeTree.ResultKind.EXTERNAL_DIR); Assert.assertTrue( <START> resolveResult.targetFileSystem <END> instanceof TestRegexMountPointFileSystem); Assert.assertTrue(resolveResult.resolvedPath.equals("/user/hadoop")); Assert.assertTrue( resolveResult.targetFileSystem instanceof TestRegexMountPointFileSystem); Assert.assertTrue( ((TestRegexMountPointFileSystem) resolveResult.targetFileSystem) .getUri().toString().equals("/namenode1/testResolve/hadoop")); Assert.assertTrue(resolveResult.remainingPath.toString().equals("/file1")); }</code><technical_language>want assertEquals ? advantage that, assertion fails mismatching. lot of asserts this, please change if possible</technical_language>

Target:
public void testResolve() throws IOException { String regexStr = "^/user/(?<username>\\w+)"; String dstPathStr = "/namenode1/testResolve/$username"; String settingsStr = null; RegexMountPoint regexMountPoint = new RegexMountPoint(inodeTree, regexStr, dstPathStr, settingsStr); regexMountPoint.initialize(); InodeTree.ResolveResult resolveResult = regexMountPoint.resolve("/user/hadoop/file1", true); Assert.assertEquals(resolveResult.kind, InodeTree.ResultKind.EXTERNAL_DIR); Assert.assertTrue( resolveResult.targetFileSystem instanceof TestRegexMountPointFileSystem); Assert.assertEquals("/user/hadoop", resolveResult.resolvedPath); Assert.assertTrue( resolveResult.targetFileSystem instanceof TestRegexMountPointFileSystem); Assert.assertEquals("/namenode1/testResolve/hadoop", ((TestRegexMountPointFileSystem) resolveResult.targetFileSystem) .getUri().toString()); Assert.assertEquals("/file1", resolveResult.remainingPath.toString()); }
Source:
<code>public void readItemWithEventualConsistency() throws Exception { CosmosAsyncContainer asyncContainer = getSharedMultiPartitionCosmosContainer(this.client.asyncClient()); container = client.getDatabase(asyncContainer.getDatabase().getId()).getContainer(asyncContainer.getId()); String idAndPkValue = UUID.randomUUID().toString(); ObjectNode properties = getDocumentDefinition(idAndPkValue, idAndPkValue); CosmosItemResponse<ObjectNode> itemResponse = container.createItem(properties); CosmosItemResponse<ObjectNode> readResponse1 = container.readItem( idAndPkValue, new PartitionKey(idAndPkValue), new CosmosItemRequestOptions() .setSessionToken(StringUtils.repeat("SomeManualInvalidSessionToken", 2000)) .setConsistencyLevel(ConsistencyLevel.EVENTUAL), ObjectNode.class); <START> System.out.println("REQUEST DIAGNOSTICS: " + readResponse1.getDiagnostics().toString()); <END> validateIdOfItemResponse(idAndPkValue, readResponse1); }</code><technical_language>suggestion logger.info("REQUEST DIAGNOSTICS: {}" readResponse1.getDiagnostics());</technical_language>

Target:
public void readItemWithEventualConsistency() throws Exception { CosmosAsyncContainer asyncContainer = getSharedMultiPartitionCosmosContainer(this.client.asyncClient()); container = client.getDatabase(asyncContainer.getDatabase().getId()).getContainer(asyncContainer.getId()); String idAndPkValue = UUID.randomUUID().toString(); ObjectNode properties = getDocumentDefinition(idAndPkValue, idAndPkValue); CosmosItemResponse<ObjectNode> itemResponse = container.createItem(properties); CosmosItemResponse<ObjectNode> readResponse1 = container.readItem( idAndPkValue, new PartitionKey(idAndPkValue), new CosmosItemRequestOptions() .setSessionToken(StringUtils.repeat("SomeManualInvalidSessionToken", 2000)) .setConsistencyLevel(ConsistencyLevel.EVENTUAL), ObjectNode.class); logger.info("REQUEST DIAGNOSTICS: {}", readResponse1.getDiagnostics().toString()); validateIdOfItemResponse(idAndPkValue, readResponse1); }
Source:
<code><START> public PushSetupSms(final CosemObisCode logicalName, final List<CosemObjectDefinition> pushObjectList, <END> final SendDestinationAndMethod sendDestinationAndMethod, final List<WindowElement> communicationWindow, final Integer randomisationStartInterval, final Integer numberOfRetries, final Integer repetitionDelay) { this.checkRandomisationStartInterval(randomisationStartInterval); this.checkNumberOfRetries(numberOfRetries); this.checkRepetitionDelay(repetitionDelay); this.logicalName = logicalName; if (pushObjectList == null) { this.pushObjectList = null; } else { this.pushObjectList = new ArrayList<>(pushObjectList); } this.sendDestinationAndMethod = sendDestinationAndMethod; if (communicationWindow == null) { this.communicationWindow = null; } else { this.communicationWindow = new ArrayList<>(communicationWindow); } this.randomisationStartInterval = randomisationStartInterval; this.numberOfRetries = numberOfRetries; this.repetitionDelay = repetitionDelay; }</code><technical_language>a private constructor, builder is used</technical_language>

Target:
private PushSetupSms(final CosemObisCode logicalName, final List<CosemObjectDefinition> pushObjectList, final SendDestinationAndMethod sendDestinationAndMethod, final List<WindowElement> communicationWindow, final Integer randomisationStartInterval, final Integer numberOfRetries, final Integer repetitionDelay) { this.checkRandomisationStartInterval(randomisationStartInterval); this.checkNumberOfRetries(numberOfRetries); this.checkRepetitionDelay(repetitionDelay); this.logicalName = logicalName; if (pushObjectList == null) { this.pushObjectList = null; } else { this.pushObjectList = new ArrayList<>(pushObjectList); } this.sendDestinationAndMethod = sendDestinationAndMethod; if (communicationWindow == null) { this.communicationWindow = null; } else { this.communicationWindow = new ArrayList<>(communicationWindow); } this.randomisationStartInterval = randomisationStartInterval; this.numberOfRetries = numberOfRetries; this.repetitionDelay = repetitionDelay; }
Source:
<code>private ServiceReference<ESystemInformation> reference(BundleContext context, String section) throws InvalidSyntaxException { String filter = About.createSectionFilter(section); Optional<ServiceReference<ESystemInformation>> first = context .getServiceReferences(ESystemInformation.class, filter) .stream().findFirst(); <START> assumeTrue("No <END> reference found", first.isPresent()); return first.get(); }</code><technical_language>assume, assert</technical_language>

Target:
private ServiceReference<ISystemInformation> reference(BundleContext context, String section) throws InvalidSyntaxException { String filter = AboutSections.createSectionFilter(section); Optional<ServiceReference<ISystemInformation>> first = context .getServiceReferences(ISystemInformation.class, filter) .stream().findFirst(); assumeTrue("No reference found", first.isPresent()); return first.get(); }
Source:
<code>public static void setUp() throws Exception { <START> server.start(50831); <END> System.setProperty("wildfly.config.url", CredentialStoreSaslAuthenticationTest.class.getResource(CREDENTIAL_CONFIG_FILE).toExternalForm()); }</code><technical_language>I MockWebServer removed needed for this test</technical_language>

Target:
public static void setUp() throws Exception { System.setProperty("wildfly.config.url", CredentialStoreSaslAuthenticationTest.class.getResource(CREDENTIAL_CONFIG_FILE).toExternalForm()); Security.insertProviderAt(providers[1], 1); CredentialStoreBuilder.get().setKeyStoreFile(BASE_STORE_DIRECTORY + "/mycredstore.cs") .setKeyStoreType("JCEKS") .setKeyStorePassword("StorePassword") .addPassword(USERNAME, PASSWORD) .build(); Security.removeProvider(providers[1].getName()); }
Source:
<code>public static Permission findOrCreatePermissionForRole(RealmObject container, RealmList<Permission> permissions, String roleName) { <START> if (roleName == null) { <END> throw new IllegalArgumentException("Non-null 'roleName' required."); } if (!container.isManaged()) { throw new IllegalStateException("'findOrCreate()' can only be called on managed objects."); } Realm realm = container.getRealm(); if (!realm.isInTransaction()) { throw new IllegalStateException("'findOrCreate()' can only be called inside a write transaction."); } Permission permission = permissions.where().equalTo("role.name", roleName).findFirst(); if (permission == null) { Role role = realm.where(Role.class).equalTo("name", roleName).findFirst(); if (role == null) { role = realm.createObject(Role.class, roleName); } permission = realm.copyToRealm(new Permission.Builder(role).noPrivileges().build()); permissions.add(permission); } return permission; }</code><technical_language>suggestion if (Util.isEmptyString(roleName)) {</technical_language>

Target:
public static Permission findOrCreatePermissionForRole(RealmObject container, RealmList<Permission> permissions, String roleName) { if (Util.isEmptyString(roleName)) { throw new IllegalArgumentException("Non-empty 'roleName' required."); } if (!container.isManaged()) { throw new IllegalStateException("'findOrCreate()' can only be called on managed objects."); } Realm realm = container.getRealm(); if (!realm.isInTransaction()) { throw new IllegalStateException("'findOrCreate()' can only be called inside a write transaction."); } Permission permission = permissions.where().equalTo("role.name", roleName).findFirst(); if (permission == null) { Role role = realm.where(Role.class).equalTo("name", roleName).findFirst(); if (role == null) { role = realm.createObject(Role.class, roleName); } permission = realm.copyToRealm(new Permission.Builder(role).noPrivileges().build()); permissions.add(permission); } return permission; }
Source:
<code>public void queryAnd(IAttributeType attrType, Collection<String> values) { <START> query.and(attrType, values); <END> }</code><technical_language>query builder set here, needs check</technical_language>

Target:
public void queryAnd(IAttributeType attrType, Collection<String> values) { getQuery().and(attrType, values); }
Source:
<code>public Date walkDateLiteral(DateLiteral lit) { <START> return Date.from(lit.value.toInstant()); <END> }</code><technical_language>Please TODO</technical_language>

Target:
public Date walkDateLiteral(DateLiteral lit) { return DateUtils.toDate(lit.value); }
Source:
<code><START> public String getTrialUntil() { <END> return trialUntil; }</code><technical_language>Hmm... a tricky date format. This is usable right now, wants convert usable. in this PR a future implement a special data container IMO</technical_language>

Target:
public ZonedDateTime getTrialUntil() { return trialUntil; }
Source:
<code>private boolean bootstrapRealtimeTable(String tableName, File schemaFile, File realtimeTableConfigFile) throws Exception { <START> Quickstart.printStatus(Quickstart.Color.CYAN, String.format("***** Adding %s realtime table *****", tableName)); <END> if (!new AddTableCommand().setSchemaFile(schemaFile.getAbsolutePath()) .setTableConfigFile(realtimeTableConfigFile.getAbsolutePath()).setControllerHost(_controllerHost) .setControllerPort(String.valueOf(_controllerPort)).setExecute(true).execute()) { throw new RuntimeException(String .format("Unable to create realtime table - %s from schema file [%s] and table conf file [%s].", tableName, schemaFile, realtimeTableConfigFile)); } return true; }</code><technical_language>logger in other places</technical_language>

Target:
private boolean bootstrapRealtimeTable(String tableName, File schemaFile, File realtimeTableConfigFile) throws Exception { LOGGER.info("Adding realtime table {}", tableName); if (!createTable(schemaFile, realtimeTableConfigFile)) { throw new RuntimeException(String .format("Unable to create realtime table - %s from schema file [%s] and table conf file [%s].", tableName, schemaFile, realtimeTableConfigFile)); } return true; }
Source:
<code>public String toString() { <START> return getClass().getName(); <END> }</code><technical_language>n p</technical_language>

Target:
public String toString() { return "Binomial(" + n + ", " + p + ")"; }
Source:
<code>public void close() { <START> runAll( <END> () -> merger.ifPresent(MergingHashAggregationBuilder::close), () -> spiller.ifPresent(Spiller::close), () -> mergeHashSort.ifPresent(MergeHashSort::close) ); }</code><technical_language>Closer</technical_language>

Target:
public void close() { try (Closer closer = Closer.create()) { if (hashAggregationBuilder != null) { closer.register(hashAggregationBuilder::close); } merger.ifPresent(closer::register); spiller.ifPresent(closer::register); mergeHashSort.ifPresent(closer::register); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public void returnsNotFoundOnQueryingNonexistentClient() { <START> RemoteLockService lockService = getLockService(NONEXISTENT_CLIENT); <END> assertThatThrownBy(lockService::currentTimeMillis) .satisfies(PaxosTimeLockServerIntegrationTest::assertRemoteNotFoundException); }</code><technical_language>nonExistentLockService for consistency</technical_language>

Target:
public void returnsNotFoundOnQueryingNonexistentClient() { RemoteLockService nonExistentLockService = getLockService(NONEXISTENT_CLIENT); assertThatThrownBy(nonExistentLockService::currentTimeMillis) .satisfies(PaxosTimeLockServerIntegrationTest::assertRemoteNotFoundException); }
Source:
<code>public ColumnValueSelector<?> makeColumnValueSelector( TimeAndDimsHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerFloatColumnSelector implements FloatColumnSelector { @Override public float getFloat() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length || dims[dimIndex] == null) { return 0.0f; } return (Float) dims[dimIndex]; } <START> @Override <END> public boolean isNull() { final Object[] dims = currEntry.get().getDims(); return dimIndex >= dims.length || dims[dimIndex] == null; } @SuppressWarnings("deprecation") @Nullable @Override public Float getObject() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length) { return null; } return (Float) dims[dimIndex]; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerFloatColumnSelector(); }</code><technical_language>Align this class Double version. E. g. in Double version methods in order, logic is different</technical_language>

Target:
public ColumnValueSelector<?> makeColumnValueSelector( TimeAndDimsHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerFloatColumnSelector implements FloatColumnSelector { @Override public boolean isNull() { final Object[] dims = currEntry.get().getDims(); return dimIndex >= dims.length || dims[dimIndex] == null; } @Override public float getFloat() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length || dims[dimIndex] == null) { assert NullHandling.replaceWithDefault(); return 0.0f; } return (Float) dims[dimIndex]; } @SuppressWarnings("deprecation") @Nullable @Override public Float getObject() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length) { return null; } return (Float) dims[dimIndex]; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerFloatColumnSelector(); }
Source:
<code>private void handleProtocolResponseMessage(final ProtocolResponseMessage message) throws FunctionalException, JMSException { <START> if (message.getRetryHeader().shouldRetry()) { <END> final ScheduledTask task = this.createScheduledRetryTask(message); this.scheduledTaskRepository.save(task); } else if (this.shouldRetryBasedOnMessage(message)) { LOGGER.info("Retrying: for time", message.getMessageType(), message.getRetryCount() + 1); final ProtocolRequestMessage protocolRequestMessage = this.createProtocolRequestMessage(message); this.deviceRequestMessageService.processMessage(protocolRequestMessage); } else { LOGGER.info("Sending domain response message."); this.domainResponseMessageSender.send(message); } }</code><technical_language>consider adding a logging statement here. This method code paths of a logging statement. Keeping this for paths examining a log file determine happened a easier</technical_language>

Target:
private void handleProtocolResponseMessage(final ProtocolResponseMessage message) throws FunctionalException, JMSException { if (message.getRetryHeader().shouldRetry()) { LOGGER.info("Creating a scheduled retry task for message of type for device {}.", message.getMessageType(), message.getDeviceIdentification()); final ScheduledTask task = this.createScheduledRetryTask(message); this.scheduledTaskRepository.save(task); } else if (this.shouldRetryBasedOnMessage(message)) { LOGGER.info("Retrying: for device for time", message.getMessageType(), message.getDeviceIdentification(), message.getRetryCount() + 1); final ProtocolRequestMessage protocolRequestMessage = this.createProtocolRequestMessage(message); this.deviceRequestMessageService.processMessage(protocolRequestMessage); } else { LOGGER.info("Sending domain response message for message of type for device {}.", message.getMessageType(), message.getDeviceIdentification()); this.domainResponseMessageSender.send(message); } }
Source:
<code>public synchronized void removeReferencePoint(String id) { IReferencePoint referencePoint = idToReferencePointMapping.get(id); if (referencePoint == null) { <START> LOG.warn("could not remove referencePoint, no referencePoint is registerid with ID: " + id); <END> return; } if (partiallySharedReferencePoints.contains(referencePoint)) partiallySharedReferencePoints.remove(referencePoint); else completelySharedReferencePoints.remove(referencePoint); idToReferencePointMapping.remove(id); referencePointToIDMapping.remove(referencePoint); partiallySharedResourceMapping.remove(referencePoint); LOG.debug("removed referencePoint " + referencePoint + " with ID " + id); }</code><technical_language>suggestion LOG.warn("could remove referencePoint, referencePoint is registered ID: " + id);</technical_language>

Target:
public synchronized void removeReferencePoint(String id) { IReferencePoint referencePoint = idToReferencePointMapping.get(id); if (referencePoint == null) { LOG.warn("could not remove referencePoint, no referencePoint is registered with ID: " + id); return; } if (partiallySharedReferencePoints.contains(referencePoint)) partiallySharedReferencePoints.remove(referencePoint); else completelySharedReferencePoints.remove(referencePoint); idToReferencePointMapping.remove(id); referencePointToIDMapping.remove(referencePoint); partiallySharedResourceMapping.remove(referencePoint); LOG.debug("removed referencePoint " + referencePoint + " with ID " + id); }
Source:
<code><START> public HTTPTransportListener(int bossGroupSize, int workerGroupSize, <END> Set<ListenerConfiguration> listenerConfigurationSet) { super("ServerBootStrapper"); if (listenerConfigurationSet.size() == 0) { log.error("Cannot find registered listener configurations hence cannot start the transport listeners"); return; } listenerConfigurationMap = listenerConfigurationSet.stream() .collect(Collectors.toMap(ListenerConfiguration::getId, config -> config)); listenerConfigurationSet.forEach(config -> { String host = config.getHost(); int port = config.getPort(); String id = host + ":" + port; listenerConfigMapWithHostPort.put(id, config); if (host.equals(Constants.DEFAULT_ADDRESS) || host.equals(Constants.LOCALHOST) || host .equals(Constants.LOOP_BACK_ADDRESS)) { id = Constants.LOCALHOST + ":" + port; listenerConfigMapWithHostPort.put(id, config); id = Constants.LOOP_BACK_ADDRESS + ":" + port; listenerConfigMapWithHostPort.put(id, config); id = Constants.DEFAULT_ADDRESS + ":" + port; listenerConfigMapWithHostPort.put(id, config); } }); Iterator itr = listenerConfigurationSet.iterator(); if (itr.hasNext()) { defaultListenerConfig = (ListenerConfiguration) itr.next(); } this.bossGroupSize = bossGroupSize; this.workerGroupSize = workerGroupSize; }</code><technical_language>java docs</technical_language>

Target:
public HTTPTransportListener(int bossGroupSize, int workerGroupSize, Set<ListenerConfiguration> listenerConfigurationSet) { super("ServerBootStrapper"); if (listenerConfigurationSet.isEmpty()) { log.error("Cannot find registered listener configurations hence cannot start the transport listeners"); return; } listenerConfigurationMap = listenerConfigurationSet.stream() .collect(Collectors.toMap(ListenerConfiguration::getId, config -> config)); listenerConfigurationSet.forEach(config -> { String host = config.getHost(); int port = config.getPort(); String id = host + ":" + port; listenerConfigMapWithHostPort.put(id, config); if (host.equals(Constants.DEFAULT_ADDRESS) || host.equals(Constants.LOCALHOST) || host .equals(Constants.LOOP_BACK_ADDRESS)) { id = Constants.LOCALHOST + ":" + port; listenerConfigMapWithHostPort.put(id, config); id = Constants.LOOP_BACK_ADDRESS + ":" + port; listenerConfigMapWithHostPort.put(id, config); id = Constants.DEFAULT_ADDRESS + ":" + port; listenerConfigMapWithHostPort.put(id, config); } }); Iterator itr = listenerConfigurationSet.iterator(); if (itr.hasNext()) { defaultListenerConfig = (ListenerConfiguration) itr.next(); } this.bossGroupSize = bossGroupSize; this.workerGroupSize = workerGroupSize; }
Source:
<code>public void onCompleted(Run build, @Nonnull TaskListener listener) { logger.entering(getClass().getName(), "onCompleted"); File file = new File(build.getRootDir(), ScanLogAction.FILE_NAME); try ( FileOutputStream fos = new FileOutputStream(file, true); PrintStream bfaLog = new PrintStream(fos, true, "UTF8") ) { if (PluginImpl.isSizeInLimit(build)) { scanIfNotScanned(build, bfaLog); } else { <START> bfaLog.println("Log exceeds limit: " + PluginImpl.getInstance().getMaxLogSize() + "MB"); <END> } } catch (Exception e) { logger.log(Level.SEVERE, "Could not get the causes from the knowledge base", e); } }</code><technical_language>log is detached build log I need a timestamp beginning of log line able correlate other logs</technical_language>

Target:
public void onCompleted(Run build, @Nonnull TaskListener listener) { logger.entering(getClass().getName(), "onCompleted"); File file = new File(build.getRootDir(), ScanLogAction.FILE_NAME); try ( FileOutputStream fos = new FileOutputStream(file, true); PrintStream scanLog = new PrintStream(fos, true, "UTF8") ) { if (PluginImpl.isSizeInLimit(build)) { scanIfNotScanned(build, scanLog); } else { logToScanLog(scanLog, "Log exceeds limit: " + PluginImpl.getInstance().getMaxLogSize() + "MB"); } } catch (Exception e) { logger.log(Level.SEVERE, "Could not get the causes from the knowledge base", e); } }
Source:
<code>private Boolean constrainedResize(TableView.ResizeFeatures<?> prop) { TableView<?> table = prop.getTable(); Double tableWidth = getContentWidth(table); List<? extends TableColumnBase<?, ?>> visibleLeafColumns = table.getVisibleLeafColumns(); <START> Double requiredWidth = visibleLeafColumns.stream().mapToDouble(TableColumnBase::getWidth).sum(); <END> Double delta = prop.getDelta(); TableColumn<?, ?> userChosenColumnToResize = prop.getColumn(); boolean columnsCanFitTable = requiredWidth + delta < tableWidth; if (columnsCanFitTable) { LOGGER.debug("User shrunk column in that way thus that window can contain all the columns"); if (requiredWidth >= tableWidth) { LOGGER.debug("Before, the content did not fit. Rearrange everything."); return rearrangeColumns(table); } LOGGER.debug("Everything already fit. We distribute the delta now."); determineNewWidth(userChosenColumnToResize, delta) .ifPresent(newWidth -> { double currentWidth = userChosenColumnToResize.getWidth(); Double deltaToApply = newWidth - currentWidth; for (TableColumnBase<?, ?> col : visibleLeafColumns) { Double share = expansionShare.get(col); Double newSize; if (col.equals(prop.getColumn())) { newSize = newWidth; } else { newSize = col.getWidth() - share * deltaToApply; } newSize = Math.min(newSize, col.getMaxWidth()); col.setPrefWidth(newSize); } }); return true; } LOGGER.debug("Window smaller than content"); determineNewWidth(userChosenColumnToResize, delta).ifPresent(newWidth -> userChosenColumnToResize.setPrefWidth(newWidth)); return true; }</code><technical_language>this more currentTotalWidth</technical_language>

Target:
private Boolean constrainedResize(TableView.ResizeFeatures<?> prop) { TableColumn<?, ?> userChosenColumnToResize = prop.getColumn(); TableView<?> table = prop.getTable(); Double tableWidth = table.getWidth(); Double currentTableContentWidth = getContentWidth(table); Double delta = prop.getDelta(); boolean columnsCanFitTable = currentTableContentWidth + delta < tableWidth; LOGGER.debug("currentTableContentWidth + delta < tableWidth = {}", currentTableContentWidth, delta, tableWidth, columnsCanFitTable); if (columnsCanFitTable) { LOGGER.debug("User changed column size in a way that window can contain all the columns"); Optional<Double> newWidthOptional; if (currentTableContentWidth >= tableWidth) { LOGGER.debug("Before, the content did not fit. Now it fits. Rearrange everything."); return rearrangeColumns(table); } LOGGER.debug("Everything already fit. We distribute the delta now."); newWidthOptional = determineNewWidth(userChosenColumnToResize, delta); newWidthOptional.ifPresent(newWidth -> { distributeDelta(table, userChosenColumnToResize, newWidth); }); return newWidthOptional.isPresent(); } LOGGER.debug("Window smaller than content"); Optional<Double> newWidth = determineNewWidth(userChosenColumnToResize, delta); newWidth.ifPresent(userChosenColumnToResize::setPrefWidth); return newWidth.isPresent(); }
Source:
<code>protected abstract void doMatchQuery(String queryId, Query matchQuery, Map<String, String> metadata) throws IOException; private void addMatch(String queryId, String docId, T match) { MatchHolder<T> docMatches = matches.computeIfAbsent(docId, k -> new MatchHolder<>()); T found = docMatches.matches.get(queryId); if (found != null) { docMatches.matches.put(queryId, resolve(match, found)); <START> } <END> else { docMatches.matches.put(queryId, match); } }</code><technical_language>This replaced docMatches.matches.compute(), I think</technical_language>

Target:
protected abstract void doMatchQuery(String queryId, Query matchQuery, Map<String, String> metadata) throws IOException; private void addMatch(String queryId, String docId, T match) { MatchHolder<T> docMatches = matches.computeIfAbsent(docId, k -> new MatchHolder<>()); docMatches.matches.compute(queryId, (key, oldValue) -> { if (oldValue != null) { return resolve(match, oldValue); } return match; }); }
Source:
<code>public LogUnitPerformanceTest() { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream("PerformanceTest.properties"); try { PROPERTIES.load(input); } catch (IOException e) { e.printStackTrace(); } random = new Random(seed); metricRegistry = CorfuRuntime.getDefaultMetrics(); <START> readTimer = metricRegistry.timer(METRIC_PREFIX + "logunit-single-read"); writeTimer = metricRegistry.timer(METRIC_PREFIX + "logunit-single-write"); <END> }</code><technical_language>find a unified report result, metrics logs</technical_language>

Target:
public LogUnitPerformanceTest() { readTimer = metricRegistry.timer(METRIC_PREFIX + "logunit-read"); writeTimer = metricRegistry.timer(METRIC_PREFIX + "logunit-write"); }
Source:
<code><START> public Stream<RelationshipResult> relationshipManualIndexSearch( @Name( "indexName" ) String manualIndexName, @Name( "query" ) Object query ) <END> throws ProcedureException { try ( Statement statement = tx.acquireStatement() ) { ReadOperations readOperations = statement.readOperations(); LegacyIndexHits hits = readOperations.relationshipLegacyIndexQuery( manualIndexName, query, -1, -1 ); return toStream( hits, ( id ) -> new RelationshipResult( graphDatabaseAPI.getRelationshipById( id ) ) ); } catch ( LegacyIndexNotFoundKernelException e ) { throw new ProcedureException( Status.LegacyIndex.LegacyIndexNotFound, "Relationship index %s not found", manualIndexName ); } }</code><technical_language>this replaced other procedure? do need two</technical_language>

Target:
public Stream<WeightedRelationshipResult> relationshipManualIndexSearch( @Name( "indexName" ) String manualIndexName, @Name( "query" ) Object query ) throws ProcedureException { try ( Statement statement = tx.acquireStatement() ) { ReadOperations readOperations = statement.readOperations(); LegacyIndexHits hits = readOperations.relationshipLegacyIndexQuery( manualIndexName, query, -1, -1 ); return toWeightedRelationshipResultStream( hits ); } catch ( LegacyIndexNotFoundKernelException e ) { throw new ProcedureException( Status.LegacyIndex.LegacyIndexNotFound, "Relationship index %s not found", manualIndexName ); } }
Source:
<code>private String[] getFormattedBoundaryValues(Object color) { Object[] values = colorScale.invertExtent(color); <START> String minStr = String.valueOf(values[1]); <END> String maxStr = String.valueOf(values[1]); double max = Double.parseDouble(maxStr); double min = Double.parseDouble(minStr); return new String[] { conf.getFormatter().apply(min), conf.getFormatter().apply(max) }; }</code><technical_language>This suspicious: minStr maxStr initialized values[1]</technical_language>

Target:
private String[] getFormattedBoundaryValues(Object color) { Object[] values = colorScale.invertExtent(color); String minStr = String.valueOf(values[0]); String maxStr = String.valueOf(values[1]); double max = Double.parseDouble(maxStr); double min = Double.parseDouble(minStr); return new String[] { conf.getFormatter().apply(min), conf.getFormatter().apply(max) }; }
Source:
<code>private boolean areBricksInTheList(GlusterVolumeEntity volumeEntity, final List<GlusterBrickEntity> bricks, final List<GlusterBrickEntity> searchBricks) { boolean found = false; for (GlusterBrickEntity paramBrick : bricks) { GlusterBrickEntity paramBrickFromVolume = volumeEntity.getBrickWithId(paramBrick.getId()); if (paramBrickFromVolume == null) { paramBrickFromVolume = volumeEntity.getBrickWithQualifiedName(paramBrick.getQualifiedName()); <START> } <END> found = false; for (GlusterBrickEntity brick : searchBricks) { if (paramBrickFromVolume != null && paramBrickFromVolume.getId() != null && paramBrickFromVolume.getId().equals(brick.getId())) { found = true; break; } } } return found; }</code><technical_language>if paramBrickFromVolume == null paramBrickFromVolume.getId() == null again, return false</technical_language>

Target:
private boolean areBricksInTheList(GlusterVolumeEntity volumeEntity, final List<GlusterBrickEntity> bricks, final List<GlusterBrickEntity> searchBricks) { boolean found = false; for (GlusterBrickEntity paramBrick : bricks) { GlusterBrickEntity paramBrickFromVolume = volumeEntity.getBrickWithId(paramBrick.getId()); if (paramBrickFromVolume == null) { paramBrickFromVolume = volumeEntity.getBrickWithQualifiedName(paramBrick.getQualifiedName()); } found = false; for (GlusterBrickEntity brick : searchBricks) { if (paramBrickFromVolume == null || paramBrickFromVolume.getId() == null) { return false; } if (paramBrickFromVolume.getId().equals(brick.getId())) { found = true; break; } } } return found; }
Source:
<code>private void initAccessor(RegionShortcut regionShortcut) { <START> @SuppressWarnings("rawtypes") <END> PartitionAttributes attributes = new PartitionAttributesFactory<String, String>() .setTotalNumBuckets(BUCKETS) .setLocalMaxMemory(0) .create(); cacheRule.getCache().createRegionFactory(regionShortcut) .setPartitionAttributes(attributes) .create(REGION_NAME); }</code><technical_language>This warning suppression removed if line is changed PartitionAttributes<String, String> attributes = new PartitionAttributesFactory<String, String>()</technical_language>

Target:
private void initAccessor(RegionShortcut regionShortcut) { PartitionAttributes<String, String> attrs = new PartitionAttributesFactory<String, String>() .setTotalNumBuckets(BUCKETS) .setLocalMaxMemory(0) .create(); cacheRule.getCache().createRegionFactory(regionShortcut) .setPartitionAttributes(attrs) .create(REGION_NAME); }