auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void destroyServerStore(DestroyServerStore destroyServerStore) throws ClusterException { if (!ehcacheStateService.isConfigured()) { throw new LifecycleException("Clustered Tier Manager is not configured"); } trackAndApplyMessage(destroyServerStore); String name = destroyServerStore.getName(); ServerStoreImpl store = ehcacheStateService.getStore(name); if (store != null) { <START> TreeNode node = StatisticsManager.nodeFor(store.getPageSource()); <END> if(node != null) { node.clean(); } } LOGGER.info("Destroying clustered tier '{}'", name); ehcacheStateService.destroyServerStore(name); }</code><technical_language>I this code moved ehcacheStateService.destroyServerStore(name); code class classloader</technical_language>

Target:
private void destroyServerStore(DestroyServerStore destroyServerStore) throws ClusterException { if (!ehcacheStateService.isConfigured()) { throw new LifecycleException("Clustered Tier Manager is not configured"); } trackAndApplyMessage(destroyServerStore); String name = destroyServerStore.getName(); LOGGER.info("Destroying clustered tier '{}'", name); management.serverStoreDestroyed(name); ehcacheStateService.destroyServerStore(name); ehcacheStateService.removeInvalidationtracker(name); }
Source:
<code>protected void buttonPressed(int buttonId) { switch (buttonId) { case IDialogConstants.DETAILS_ID: if (showDetails) { <START> detailsComposite.dispose(); <END> detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); } else { detailsComposite = createDetailsComposite(); detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); } getContents().getShell().pack(); showDetails = !showDetails; break; case IDialogConstants.OK_ID: commit = commitCombo.getValue(); message = messageText.getText(); overwriteTag = overwriteButton.getSelection(); default: super.buttonPressed(buttonId); } }</code><technical_language>Is a reason need dispose/recreate repeatedly</technical_language>

Target:
protected void buttonPressed(int buttonId) { switch (buttonId) { case IDialogConstants.OK_ID: commit = commitCombo.getValue(); message = messageText.getText(); overwriteTag = overwriteButton.getSelection(); default: super.buttonPressed(buttonId); } }
Source:
<code>public void testDoesItSmoke() throws Exception { WaitForAsyncUtils.asyncFx(() -> { Stopwatch stopwatch = Stopwatch.createStarted(); try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) { context.getBeanFactory().registerSingleton("hostService", mock(PlatformService.class)); context.getBeanFactory().registerSingleton("stage", new Stage()); context.getBeanFactory().registerSingleton("uidService", mock(UidService.class)); <START> context.register(ForgedAlliancePrefs.class); <END> context.register(FafClientApplication.class); context.refresh(); logger.debug("Loading application context took {}", stopwatch.stop()); } }); WaitForAsyncUtils.waitForFxEvents(); }</code><technical_language>noooooooo! Do register Preference classes need obtained calling preferenceService.getpreferences.ForgedAlliancePrefs(); Spring creates a new instance if u register it. empty settings loaded fom a json file. if u need register u need annotate @Component (like ForgedAlliancePrefs class) ForgedAlliancePrefs Injected Spring</technical_language>

Target:
public void testDoesItSmoke() throws Exception { WaitForAsyncUtils.asyncFx(() -> { Stopwatch stopwatch = Stopwatch.createStarted(); try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) { context.getBeanFactory().registerSingleton("hostService", mock(PlatformService.class)); context.getBeanFactory().registerSingleton("stage", new Stage()); context.getBeanFactory().registerSingleton("uidService", mock(UidService.class)); context.register(FafClientApplication.class); context.refresh(); logger.debug("Loading application context took {}", stopwatch.stop()); } }); WaitForAsyncUtils.waitForFxEvents(); }
Source:
<code>public void addPotentialOwners(String containerId, Number taskId, boolean removeExisting, String payload, String marshallingType) { logger.debug("About to unmarshall payload '{}' to map of task inputs", payload); <START> if (context.getContainer(containerId) == null) throw new DeploymentNotFoundException("Could not find container with ID: " + containerId); <END> OrganizationalEntity[] entities = convert(containerId, taskId, payload, marshallingType); userTaskAdminService.addPotentialOwners(taskId.longValue(), removeExisting, entities); logger.debug("Potential owners added to task {}", entities, taskId); }</code><technical_language>suggest move this separate method constantly repeated in places - checkContainer(containerId) throw DeploymentNotFoundException please if brackets if (context.getContainer(containerId) == null) { throw new DeploymentNotFoundException("Could find container ID: " + containerId); }</technical_language>

Target:
public void addPotentialOwners(String containerId, Number taskId, boolean removeExisting, String payload, String marshallingType) { logger.debug("About to unmarshall payload '{}' to map of task inputs", payload); verifyContainerId(containerId); OrganizationalEntity[] entities = convert(containerId, taskId, payload, marshallingType); userTaskAdminService.addPotentialOwners(taskId.longValue(), removeExisting, entities); logger.debug("Potential owners added to task {}", entities, taskId); }
Source:
<code>public String getMainTypeName() { <START> return getProject().get(MAIN_CLASS, EMBEDDED_LAUNCHER); <END> }</code><technical_language>good. squash commits in a single commit including changing line java getProject().getProperty(MAIN_CLASS, EMBEDDED_LAUNCHER); get is Domain method delegates Processor getProperty method anyway</technical_language>

Target:
public String getMainTypeName() { Instructions instructions = new Instructions(getProject().getProperty(Constants.REMOVEHEADERS)); if (!instructions.isEmpty() && instructions.matches(MAIN_CLASS)) { return EMBEDDED_LAUNCHER; } return getProject().getProperty(MAIN_CLASS, EMBEDDED_LAUNCHER); }
Source:
<code>public static DuplicateRequestException create(String sessionId, long requestSeq) { return new DuplicateRequestException("request of session '{}' was already sent, this is <START> duplicate or <END> retry submission; check if some proxy or agents have retry-post enabled.", requestSeq, sessionId); }</code><technical_language>is duplicate -> is a duplicate</technical_language>

Target:
public static DuplicateRequestException create(String sessionId, long requestSeq) { return new DuplicateRequestException("request of session '{}' was already sent, this is a duplicate or retry submission; check if some proxy or agents have retry-post enabled.", requestSeq, sessionId); }
Source:
<code>public static void register(Optional<MeterRegistry> metricsRegistry) { <START> if (metricsRegistry.isPresent()) { <END> SafePointStats safePointStats = new SafePointStats(); Gauge.builder("jvm.safe_point_time", safePointStats, data -> { long current = getRuntimeMBean().getTotalSafepointTime(); long delta = current - data.safepointTime; data.safepointTime = current; return delta; }).register(metricsRegistry.get()); Gauge.builder("jvm.safe_point_count", safePointStats, data -> { long current = getRuntimeMBean().getSafepointCount(); long delta = current - data.safepointCount; data.safepointCount = current; return delta; }).register(metricsRegistry.get()); } }</code><technical_language>micrometer's JVM metrics? <LINK_0></technical_language>

Target:
public static void register(Optional<MeterRegistry> metricsRegistry) { if (metricsRegistry.isPresent()) { SafePointStats safePointStats = new SafePointStats(); Gauge.builder("jvm.safe_point_time", safePointStats, data -> { long current = getRuntimeMBean().getTotalSafepointTime(); long delta = current - data.safepointTime; data.safepointTime = current; return delta; }).strongReference(true).register(metricsRegistry.get()); Gauge.builder("jvm.safe_point_count", safePointStats, data -> { long current = getRuntimeMBean().getSafepointCount(); long delta = current - data.safepointCount; data.safepointCount = current; return delta; }).strongReference(true).register(metricsRegistry.get()); } }
Source:
<code>public Properties getConfiguration(int tenantId) throws IdentityMgtException{ Properties properties = new Properties(); Map<String, String> configMap = null; try { configMap = identityMgtService.getConfiguration(tenantId); } catch (IdentityMgtException ex) { String msg = "Error when retrieving configurations"; <START> log.error(msg); <END> throw new IdentityMgtException(msg,ex); } Iterator<Map.Entry<String, String>> iterator = configMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, String> pair = iterator.next(); properties.setProperty(pair.getKey(), pair.getValue()); System.out.println(pair.getKey() + " = " + pair.getValue()); } return properties; }</code><technical_language>log throw</technical_language>

Target:
public Properties getConfiguration(int tenantId) throws IdentityMgtException{ Properties properties = new Properties(); Map<String, String> configMap = null; try { configMap = identityMgtService.getConfiguration(tenantId); } catch (IdentityMgtException ex) { throw new IdentityMgtException("Error when retrieving configurations", ex); } Iterator<Map.Entry<String, String>> iterator = configMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, String> pair = iterator.next(); properties.setProperty(pair.getKey(), pair.getValue()); } return properties; }
Source:
<code>private String makeRelative ( final File base, final File file ) { <START> final String result = base.toURI ().relativize ( file.toURI () ).getPath (); <END> this.log.info ( String.format ( "Make relative - base: %s, file: %s -> %s", base, file, result ) ); return result; }</code><technical_language>canonicalize files calling toURI() . E.g. uppercase/lowercase drive letter differences Windows URI String comparison relativize() fail</technical_language>

Target:
private String makeRelative(final File base, final File file) throws IOException { final String result = base.getCanonicalFile().toURI().relativize(file.getCanonicalFile().toURI()).getPath(); this.log.info(String.format("Make relative - base: %s, file: %s -> %s", base, file, result)); return result; }
Source:
<code>public static void refreshResources(IResource[] resources, IProgressMonitor monitor) throws CoreException { try { SubMonitor progress = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshing, resources.length); for (IResource resource : resources) { if (progress.isCanceled()) break; resource.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); <START> progress.worked(1); <END> } } finally { monitor.done(); } }</code><technical_language>needed, delete</technical_language>

Target:
public static void refreshResources(IResource[] resources, IProgressMonitor monitor) throws CoreException { try { SubMonitor progress = SubMonitor.convert(monitor, CoreText.ProjectUtil_refreshing, resources.length); for (IResource resource : resources) { if (progress.isCanceled()) break; resource.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } } finally { monitor.done(); } }
Source:
<code>private long getCleanupTimeSeconds() { try { String cleanupTimeString = System.getProperty(RMNodeStarter.SECONDS_TASK_CLEANUP_TIMEOUT_PROP_NAME); if (cleanupTimeString != null) { return Long.parseLong(cleanupTimeString); } else { return CLEANUP_TIME_DEFAULT_SECONDS; } } catch (NumberFormatException e) { LOGGER.warn("proactive.task.cleanup.time: " <START> + System.getProperty("proactive.task.cleanup.time") <END> + " is not parsable to long, fallback to default value. Error : " + e.getMessage()); return CLEANUP_TIME_DEFAULT_SECONDS; } }</code><technical_language>please final static name</technical_language>

Target:
private long getCleanupTimeSeconds() { try { String cleanupTimeString = System.getProperty(RMNodeStarter.SECONDS_TASK_CLEANUP_TIMEOUT_PROP_NAME); if (cleanupTimeString != null) { return Long.parseLong(cleanupTimeString); } else { return CLEANUP_TIME_DEFAULT_SECONDS; } } catch (NumberFormatException e) { LOGGER.warn("proactive.task.cleanup.time: " + System.getProperty(RMNodeStarter.SECONDS_TASK_CLEANUP_TIMEOUT_PROP_NAME) + " is not parsable to long, fallback to default value. Error : " + e.getMessage()); return CLEANUP_TIME_DEFAULT_SECONDS; } }
Source:
<code>public void updateExternalExecutionId(long taskExecutionId, String externalExecutionId) { <START> if (jdbcTemplate.queryForObject(getQuery(CHECK_TASK_EXECUTION_EXISTS), Integer.class, <END> taskExecutionId) != 1) { throw new IllegalStateException("Invalid TaskExecution, ID " + taskExecutionId + " not found."); } Object[] parameters = new Object[]{ externalExecutionId, taskExecutionId}; jdbcTemplate.update( getQuery(UPDATE_TASK_EXECUTION_EXTERNAL_EXECUTION_ID), parameters, new int[]{ Types.VARCHAR, Types.BIGINT}); }</code><technical_language>this check done result of UPDATE command</technical_language>

Target:
public void updateExternalExecutionId(long taskExecutionId, String externalExecutionId) { Object[] parameters = new Object[]{externalExecutionId, taskExecutionId}; if (jdbcTemplate.update( getQuery(UPDATE_TASK_EXECUTION_EXTERNAL_EXECUTION_ID), parameters, new int[]{Types.VARCHAR, Types.BIGINT}) != 1) { throw new IllegalStateException("Invalid TaskExecution, ID " + taskExecutionId + " not found."); } }
Source:
<code>public void map(GenericData.Record record, AvroCollector<Pair<ByteBuffer, ByteBuffer>> collector, Reporter reporter) throws IOException { byte[] keyBytes = null, valBytes = null; <START> Object keyRecord = null, valRecord = null; <END> try { keyRecord = record.get(keyField); valRecord = record.get(valField); keyBytes = keySerializer.toBytes(keyRecord); valBytes = valueSerializer.toBytes(valRecord); this.collectorWrapper.setCollector(collector); this.mapper.map(keyBytes, valBytes, this.collectorWrapper); recordCounter++; } catch (OutOfMemoryError oom) { logger.error(oomErrorMessage(reporter)); if (keyBytes == null) { logger.error("keyRecord caused OOM!"); } else { logger.error("keyRecord: " + keyRecord); logger.error("valRecord: " + (valBytes == null ? "caused OOM" : valRecord)); } throw new VoldemortException(oomErrorMessage(reporter), oom); } }</code><technical_language>LI style guide recommends declaration line</technical_language>

Target:
public void map(GenericData.Record record, AvroCollector<Pair<ByteBuffer, ByteBuffer>> collector, Reporter reporter) throws IOException { byte[] keyBytes = null; byte[] valBytes = null; Object keyRecord = null; Object valRecord = null; try { keyRecord = record.get(keyField); valRecord = record.get(valField); keyBytes = keySerializer.toBytes(keyRecord); valBytes = valueSerializer.toBytes(valRecord); this.collectorWrapper.setCollector(collector); this.mapper.map(keyBytes, valBytes, this.collectorWrapper); recordCounter++; } catch (OutOfMemoryError oom) { logger.error(oomErrorMessage(reporter)); if (keyBytes == null) { logger.error("keyRecord caused OOM!"); } else { logger.error("keyRecord: " + keyRecord); logger.error("valRecord: " + (valBytes == null ? "caused OOM" : valRecord)); } throw new VoldemortException(oomErrorMessage(reporter), oom); } }
Source:
<code>protected void initialize() { super.initialize(); getWindowPanel().add(getFooterStatusBar(), BorderLayout.SOUTH); getFooterStatusBar().add(getLabelTimeLapse()); getFooterStatusBar().addSeparator(); getFooterStatusBar().add(getLabelContentLength()); getFooterStatusBar().addSeparator(); getFooterStatusBar().add(getLabelTotalLength()); getWindowPanel() .addComponentListener( new ComponentAdapter() { @Override public void componentShown(ComponentEvent ce) { <START> sender.updateOptions(); <END> } }); }</code><technical_language>case is this addressing</technical_language>

Target:
protected void initialize() { super.initialize(); getWindowPanel().add(getFooterStatusBar(), BorderLayout.SOUTH); getFooterStatusBar().add(getLabelTimeLapse()); getFooterStatusBar().addSeparator(); getFooterStatusBar().add(getLabelContentLength()); getFooterStatusBar().addSeparator(); getFooterStatusBar().add(getLabelTotalLength()); }
Source:
<code>public void onDataSetChanged() { <START> if(null!=adapter) { <END> adapter.notifyDataSetChanged(); } }</code><technical_language>some spaces missing here</technical_language>

Target:
public void onDataSetChanged() { if (null != adapter) { adapter.notifyDataSetChanged(); if (null != lastVisibleItemID) { int itemPositionWithId = callback.findItemPositionWithId(lastVisibleItemID); rvContributionsList.scrollToPosition(itemPositionWithId); lastVisibleItemID = null; } } }
Source:
<code>public ImmutableValue<Vector3i> exitPortal() { <START> return new ImmutableSpongeValue<>(Keys.EXIT_PORTAL, Vector3i.ONE, this.exitPortal); <END> }</code><technical_language>This stored in a field</technical_language>

Target:
public ImmutableValue<Vector3i> exitPortal() { return this.exitPortalValue; }
Source:
<code>public void remove() { <START> throw new UnsupportedOperationException("Not supported yet."); <END> }</code><technical_language>this operation is optional, supported mandatory</technical_language>

Target:
public void remove() { throw new UnsupportedOperationException("It won't be supported because it's not mandatory."); }
Source:
<code><START> @Override public synchronized Boolean isLeader(String workerId) { <END> if (executeConditionCheckWithReadLock(() -> CollectionUtils.isNullOrEmpty(leaders))) { electLeaders(); leaderElectionThreadPool.scheduleWithFixedDelay(this::electLeaders, ELECTION_INITIAL_DELAY_MILLIS, ELECTION_SCHEDULING_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); } return executeConditionCheckWithReadLock(() -> isWorkerLeaderForShardSync(workerId)); }</code><technical_language>Nit: @Override is in line method. annotations in PR in line above</technical_language>

Target:
public synchronized Boolean isLeader(String workerId) { if (executeConditionCheckWithReadLock(() -> CollectionUtils.isNullOrEmpty(leaders))) { electLeaders(); leaderElectionThreadPool.scheduleWithFixedDelay(this::electLeaders, ELECTION_INITIAL_DELAY_MILLIS, ELECTION_SCHEDULING_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); } return executeConditionCheckWithReadLock(() -> isWorkerLeaderForShardSync(workerId)); }
Source:
<code>public ClusterComposition lookupRoutingTable( ConnectionPool connections, RoutingTable routingTable ) <START> throws InterruptedException, ServiceUnavailableException, ProtocolException <END> { assertRouterIsNotEmpty( routingTable.routerSize() ); int failures = 0; for ( long start = clock.millis(), delay = 0; ; delay = Math.max( settings.retryTimeoutDelay, delay * 2 ) ) { long waitTime = start + delay - clock.millis(); if ( waitTime > 0 ) { clock.sleep( waitTime ); } start = clock.millis(); for ( int i = 0, size = routingTable.routerSize(); i < size; i++ ) { BoltServerAddress address = routingTable.nextRouter(); if ( address == null ) { throw new ServiceUnavailableException( NO_ROUTERS_AVAILABLE ); } GetClusterCompositionResponse response = null; try ( Connection connection = connections.acquire( address ) ) { response = provider.getClusterComposition( connection ); } catch ( Throwable e ) { logger.error( format( "Failed to connect to routing server '%s'.", address ), e ); routingTable.removeRouter( address ); assertRouterIsNotEmpty( routingTable.routerSize() ); continue; } ClusterComposition cluster = response.clusterComposition(); logger.info( "Got cluster composition %s", cluster ); if ( cluster.isValid() ) { return cluster; } } if ( ++failures >= settings.maxRoutingFailures ) { throw new ServiceUnavailableException( NO_ROUTERS_AVAILABLE ); } } }</code><technical_language>Do need declare runtime exceptions ServiceUnavailableException ProtocolException here</technical_language>

Target:
public ClusterComposition lookupRoutingTable( ConnectionPool connections, RoutingTable routingTable ) throws InterruptedException { assertHasRouters( routingTable ); int failures = 0; for ( long start = clock.millis(), delay = 0; ; delay = Math.max( settings.retryTimeoutDelay, delay * 2 ) ) { long waitTime = start + delay - clock.millis(); if ( waitTime > 0 ) { clock.sleep( waitTime ); } start = clock.millis(); int size = routingTable.routerSize(); for ( int i = 0; i < size; i++ ) { BoltServerAddress address = routingTable.nextRouter(); if ( address == null ) { throw new ServiceUnavailableException( NO_ROUTERS_AVAILABLE ); } ClusterCompositionResponse response = null; try ( Connection connection = connections.acquire( address ) ) { response = provider.getClusterComposition( connection ); } catch ( Throwable e ) { logger.error( format( "Failed to connect to routing server '%s'.", address ), e ); routingTable.removeRouter( address ); assertHasRouters( routingTable ); continue; } ClusterComposition cluster = response.clusterComposition(); logger.info( "Got cluster composition %s", cluster ); if ( cluster.hasWriters() ) { return cluster; } } if ( ++failures >= settings.maxRoutingFailures ) { throw new ServiceUnavailableException( NO_ROUTERS_AVAILABLE ); } } }
Source:
<code>private void onRemove() { cancel(); AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { ArrayList<StoragePool> pools = (ArrayList<StoragePool>) returnValue; <START> if (pools != null && pools.size() > 0) { <END> pool = pools.get(0); getVmsFromExportDomain(pool.getId(), getEntity().getId()); } } }), getEntity().getId()); }</code><technical_language>consider call isEmpty() instead of checking size > 0</technical_language>

Target:
private void onRemove() { cancel(); AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { ArrayList<StoragePool> pools = (ArrayList<StoragePool>) returnValue; if (pools != null && !pools.isEmpty()) { pool = pools.get(0); checkVmsDependentOnTemplate(pool.getId(), getEntity().getId()); } } }), getEntity().getId()); }
Source:
<code>public V putIfAbsent(final K key, final V value) { V old = null; final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { loaded = cacheLoader.load(k); } } catch (RuntimeException e) { throw new CacheLoaderException(e); } if(loaded != null) { return loaded; } try { if (cacheWriter != null) { cacheWriter.write(k, value); } } catch (RuntimeException e) { throw new CacheWriterException(e); } return value; } }); try { <START> final Store.ValueHolder<V> holder = store.computeIfAbsent(key, mappingFunction); <END> if(holder != null) { old = holder.value(); } } catch (CacheAccessException e) { try { old = mappingFunction.apply(key); if(cacheLoader != null && cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if(holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } return old; }</code><technical_language>this brings cache in sync SOR (optimistically), if diverged - a side effect? Neat..</technical_language>

Target:
public V putIfAbsent(final K key, final V value) { checkNonNull(key, value); V old = null; final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { loaded = cacheLoader.load(k); } } catch (RuntimeException e) { throw new CacheLoaderException(e); } if(loaded != null) { return loaded; } try { if (cacheWriter != null) { cacheWriter.write(k, value); } } catch (RuntimeException e) { throw new CacheWriterException(e); } return value; } }); try { final Store.ValueHolder<V> holder = store.computeIfAbsent(key, mappingFunction); if(holder != null) { old = holder.value(); } } catch (CacheAccessException e) { try { old = mappingFunction.apply(key); if(cacheLoader != null && cacheWriter != null) { store.remove(key); } else { final Store.ValueHolder<V> holder = store.get(key); if(holder == null) { resilienceStrategy.possiblyInconsistent(key, e); } else { return holder.value(); } } } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } return old; }
Source:
<code>public int hashCode() { <START> int hash = 7; <END> hash = 43 * hash + Objects.hashCode(this.id); return hash; }</code><technical_language>please change this simply return Objects.hash(...) boilerplate/LOC</technical_language>

Target:
public int hashCode() { return Objects.hash(id, foo, bar); }
Source:
<code>public void shouldRunEnterprise() { try ( Neo4jContainer neo4jContainer = new Neo4jContainer() .withEnterpriseEdition() <START> .acceptLicense() <END> .withAdminPassword("Picard123") ) { neo4jContainer.start(); try ( Driver driver = getDriver(neo4jContainer); Session session = driver.session() ) { String edition = session .run("CALL dbms.components() YIELD edition RETURN edition", Collections.emptyMap()) .next().get(0).asString(); assertThat(edition, is("enterprise")); } } }</code><technical_language>I _assume_ Testcontainers project permitted freely enterprise edition for local builds CI testing of this module</technical_language>

Target:
public void shouldRunEnterprise() { assumeThat(Neo4jContainerTest.class.getResource(ACCEPTANCE_FILE_LOCATION)).isNotNull(); try ( Neo4jContainer neo4jContainer = new Neo4jContainer() .withEnterpriseEdition() .withAdminPassword("Picard123") ) { neo4jContainer.start(); try ( Driver driver = getDriver(neo4jContainer); Session session = driver.session() ) { String edition = session .run("CALL dbms.components() YIELD edition RETURN edition", Collections.emptyMap()) .next().get(0).asString(); assertThat(edition).isEqualTo("enterprise"); } } }
Source:
<code>protected HttpRequest getBlobWithTime() { return HttpRequest.builder().method("GET") .endpoint("<LINK_0>" + "?Signature=Y4Ac4sZfBemGZmgfG78F7IX%20IFg%3D&Expires=1212683902&AWSAccessKeyId=identity") .addHeader("Host", "container.s3.amazonaws.com") <START> .addHeader("Date", DATE).build(); <END> }</code><technical_language>Appreciated unrelated; please submit a separate PR in future</technical_language>

Target:
protected HttpRequest getBlobWithTime() { return HttpRequest.builder().method("GET") .endpoint("<LINK_0>" + "?Expires=1212683902&AWSAccessKeyId=identity&Signature=Y4Ac4sZfBemGZmgfG78F7IX%2BIFg%3D") .addHeader("Host", "container.s3.amazonaws.com") .addHeader("Date", DATE).build(); }
Source:
<code>public ElytronIntegrationChecker(Builder builder) { this.client = builder.client; this.operations = new Operations(client); this.address = builder.address; this.configFragment = builder.configFragment; if (builder.credentialReferenceAttributeName == null) { <START> this.credentialReferenceAttributeName = CREDENTIAL_REFERENCE; <END> } else { this.credentialReferenceAttributeName = builder.credentialReferenceAttributeName; } }</code><technical_language>Move this logic Builder#build method please</technical_language>

Target:
public ElytronIntegrationChecker(Builder builder) { this.client = builder.client; this.operations = new Operations(client); this.address = builder.address; this.configFragment = builder.configFragment; this.credentialReferenceAttributeName = builder.credentialReferenceAttributeName; }
Source:
<code>public void testUpload() throws Exception { <START> put("/rest/resource/mydir/mynewres", "This is my new test."); <END> Resource newRes = getDataDirectory().get("/mydir/mynewres"); try (InputStream is = newRes.in()) { Assert.assertEquals("This is my new test.", IOUtils.toString(is)); } newRes.delete(); }</code><technical_language>@NielsCharlier great opportunity include non-ASCII characters if survive trip</technical_language>

Target:
public void testUpload() throws Exception { put("/rest/resource/mydir/mynewres", STR_MY_NEW_TEST); Resource newRes = getDataDirectory().get("/mydir/mynewres"); try (InputStream is = newRes.in()) { Assert.assertEquals(STR_MY_NEW_TEST, IOUtils.toString(is)); } newRes.delete(); }
Source:
<code>public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(SEARCH_ACTION) <START> .setDescription("Search for webhooks associated to an organization or a project.<br/>") <END> .setSince("7.1") .setResponseExample(Resources.getResource(this.getClass(), "example-webhooks-search.json")) .setHandler(this); action.createParam(ORGANIZATION_KEY_PARAM) .setDescription("Organization key. If no organization is provided, the default organization is used.") .setInternal(true) .setRequired(false) .setExampleValue(KEY_ORG_EXAMPLE_001); action.createParam(PROJECT_KEY_PARAM) .setDescription("Project key") .setRequired(false) .setExampleValue(KEY_PROJECT_EXAMPLE_001); }</code><technical_language>"<br/>" dropped</technical_language>

Target:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(SEARCH_ACTION) .setDescription("Search for global or project webhooks") .setSince("7.1") .setResponseExample(Resources.getResource(this.getClass(), "example-webhooks-search.json")) .setHandler(this); action.createParam(ORGANIZATION_KEY_PARAM) .setDescription("Organization key. If no organization is provided, the default organization is used.") .setInternal(true) .setRequired(false) .setExampleValue(KEY_ORG_EXAMPLE_001); action.createParam(PROJECT_KEY_PARAM) .setDescription("Project key") .setRequired(false) .setExampleValue(KEY_PROJECT_EXAMPLE_001); }
Source:
<code>public LockToken createNewFileAtomic(File file) throws IOException { boolean created = false; try { Files.createFile(file.toPath()); created = true; } catch (FileAlreadyExistsException e) { } <START> if (!created) { <END> return token(false, null); } if (supportsAtomicCreateNewFile() || !supportsUnixNLink) { return token(true, null); } Path link = null; Path path = file.toPath(); try { link = Files.createLink(Paths.get(uniqueLinkPath(file)), path); Integer nlink = (Integer) (Files.getAttribute(path, "unix:nlink")); if (nlink.intValue() > 2) { LOG.warn(MessageFormat.format( JGitText.get().failedAtomicFileCreation, path, nlink)); return token(false, link); } else if (nlink.intValue() < 2) { supportsUnixNLink = false; } return token(true, link); } catch (UnsupportedOperationException | IllegalArgumentException e) { supportsUnixNLink = false; return token(true, link); } }</code><technical_language>Eliminate this flag, instead move line 459 catch block</technical_language>

Target:
public LockToken createNewFileAtomic(File file) throws IOException { Path path; try { path = file.toPath(); Files.createFile(path); } catch (FileAlreadyExistsException e) { return token(false, null); } if (supportsAtomicCreateNewFile() || !supportsUnixNLink) { return token(true, null); } Path link = null; try { link = Files.createLink(Paths.get(uniqueLinkPath(file)), path); Integer nlink = (Integer) (Files.getAttribute(path, "unix:nlink")); if (nlink.intValue() > 2) { LOG.warn(MessageFormat.format( JGitText.get().failedAtomicFileCreation, path, nlink)); return token(false, link); } else if (nlink.intValue() < 2) { supportsUnixNLink = false; } return token(true, link); } catch (UnsupportedOperationException | IllegalArgumentException e) { supportsUnixNLink = false; return token(true, link); } }
Source:
<code>public OverPeriodMeasureDefinition( @JsonProperty("measureIdentifier") final String measureIdentifier, @JsonProperty("dateAttributes") final List<OverPeriodDateAttribute> dateAttributes) { <START> this.measureIdentifier = notNull(measureIdentifier, "'measureIdentifier' must not be null!"); <END> this.dateAttributes = notEmpty(dateAttributes, "'dateAttributes' list must not be empty!"); }</code><technical_language>pls com.gooddata.util.Validate</technical_language>

Target:
public OverPeriodMeasureDefinition( @JsonProperty("measureIdentifier") final String measureIdentifier, @JsonProperty("dateAttributes") final List<OverPeriodDateAttribute> dateAttributes) { this.measureIdentifier = notNull(measureIdentifier, "measureIdentifier"); this.dateAttributes = notEmpty(dateAttributes, "dateAttributes"); }
Source:
<code>protected Long nullUnsafeScalar(YearMonth value) { <START> return value.atDay( 1 ).atStartOfDay().atZone( ZoneOffset.UTC ).toInstant().toEpochMilli(); <END> }</code><technical_language>call value.toInstant( ZoneOffset.UTC ) instead of atZone(...).toInstant()</technical_language>

Target:
protected Long nullUnsafeScalar(YearMonth value) { return value.atDay( 1 ).atStartOfDay().toInstant( ZoneOffset.UTC ).toEpochMilli(); }
Source:
<code>private CtfIterator replaceRandomElement(final CtfTmfContext context) { fAccessLock.lock(); try { final int size = fRandomAccess.size(); final int pos = fRnd.nextInt(size); final CtfTmfContext victim = fRandomAccess.get(pos); fRandomAccess.set(pos, context); CtfIterator elem = fMap.remove(victim); if (elem.isClosed()) { <START> Activator.getDefault().logError("Found closed iterator in iterator manager."); END> elem.dispose(); elem = (CtfIterator) fTrace.createIterator(); } fMap.put(context, elem); victim.dispose(); return elem; } finally { fAccessLock.unlock(); } }</code><technical_language>Indeed, is report...maybe TmfTrace context? in case this occurs while tests running multiple traces opened, trace a problem. String traceLog = context.getTrace() != null ? context.getTrace().toString() : ""; //$NON-NLS-1$ Activator.getDefault().logError("Found closed iterator in iterator manager. " + traceLog); //$NON-NLS-1$</technical_language>

Target:
private CtfIterator replaceRandomElement(final CtfTmfContext context) { fAccessLock.lock(); try { final int size = fRandomAccess.size(); final int pos = fRnd.nextInt(size); final CtfTmfContext victim = fRandomAccess.get(pos); fRandomAccess.set(pos, context); CtfIterator elem = fMap.remove(victim); if (elem.isClosed()) { String traceLog = victim.getTrace() != null ? victim.getTrace().toString() : ""; Activator.getDefault().logError("Found closed iterator in iterator manager. " + traceLog); elem.dispose(); elem = (CtfIterator) fTrace.createIterator(); } fMap.put(context, elem); victim.dispose(); return elem; } finally { fAccessLock.unlock(); } }
Source:
<code><START> public static String complement(String sequence, boolean RNA) { <END> String result = ""; for (int i = sequence.length() - 1; i >= 0; i--) { result += complementBase(sequence.charAt(i), RNA); } return result; }</code><technical_language>this present in biojava</technical_language>

Target:
private static String complement(String sequence, boolean RNA) { String result = ""; for (int i = sequence.length() - 1; i >= 0; i--) { result += complementBase(sequence.charAt(i), RNA); } return result; }
Source:
<code>String getClasspathForTemplate(String template) { <START> String classPath = configurationGenerator.getUserConfig().getProperty(template + ".check.classpath"); <END> final TextTemplate templateParser = new TextTemplate(configurationGenerator.getUserConfig()); classPath = templateParser.processText(classPath); return classPath; }</code><technical_language>Put ".check.classpath" in a constant</technical_language>

Target:
String getClasspathForTemplate(String template) { String classPath = configurationGenerator.getUserConfig().getProperty(template + PARAM_CHECK_CLASSPATH_SUFFIX); TextTemplate templateParser = new TextTemplate(configurationGenerator.getUserConfig()); return templateParser.processText(classPath); }
Source:
<code>public TransactionConfiguration get() { TransactionConfigurationBuilder builder = new ConfigurationBuilder().transaction() .lockingMode(this.locking) .cacheStopTimeout(this.timeout) .transactionMode((this.mode == TransactionMode.NONE) ? org.infinispan.transaction.TransactionMode.NON_TRANSACTIONAL : org.infinispan.transaction.TransactionMode.TRANSACTIONAL) .useSynchronization(EnumSet.of(TransactionMode.BATCH, TransactionMode.NON_XA).contains(this.mode)) .recovery().enabled(this.mode == TransactionMode.FULL_XA).transaction() ; switch (this.mode) { case NONE: { break; } case BATCH: { builder.transactionManagerLookup(new TransactionManagerProvider(EmbeddedTransactionManager.getInstance())); break; } case NON_XA: { <START> builder.transactionSynchronizationRegistryLookup(new TransactionSynchronizationRegistryProvider(this.tsrSupplier.get())); <END> } default: { builder.transactionManagerLookup(new TransactionManagerProvider(ContextTransactionManager.getInstance())); } } return builder.create(); }</code><technical_language>this becomes: builder.transactionSynchronizationRegistryLookup(new TransactionSynchronizationRegistryProvider(this.tsrDependency.get()));</technical_language>

Target:
public TransactionConfiguration get() { TransactionConfigurationBuilder builder = new ConfigurationBuilder().transaction() .lockingMode(this.locking) .cacheStopTimeout(this.timeout) .transactionMode((this.mode == TransactionMode.NONE) ? org.infinispan.transaction.TransactionMode.NON_TRANSACTIONAL : org.infinispan.transaction.TransactionMode.TRANSACTIONAL) .useSynchronization(EnumSet.of(TransactionMode.BATCH, TransactionMode.NON_XA).contains(this.mode)) .recovery().enabled(this.mode == TransactionMode.FULL_XA).transaction() ; switch (this.mode) { case NONE: { break; } case BATCH: { builder.transactionManagerLookup(new TransactionManagerProvider(EmbeddedTransactionManager.getInstance())); break; } case NON_XA: { builder.transactionSynchronizationRegistryLookup(new TransactionSynchronizationRegistryProvider(this.tsrDependency.get())); } default: { builder.transactionManagerLookup(new TransactionManagerProvider(ContextTransactionManager.getInstance())); } } return builder.create(); }
Source:
<code>public void writeLine(String line) throws IOException { if (!isClosed) { for (LineConsumer lineConsumer : lineConsumers) { try { lineConsumer.writeLine(line); } catch (ConsumerAlreadyClosedException | ClosedByInterruptException e) { lineConsumers.remove(lineConsumer); if (lineConsumers.size() == 0) { isClosed = true; } } catch (IOException e) { <START> LOG.error(String.format("An error occurred while writing line to the line consumer %s", lineConsumer), e); <END> } } } }</code><technical_language>is LineConsumer nice toString() ? line log</technical_language>

Target:
public void writeLine(String line) { if (isOpen) { for (LineConsumer lineConsumer : lineConsumers) { try { lineConsumer.writeLine(line); } catch (ConsumerAlreadyClosedException | ClosedByInterruptException e) { lineConsumers.remove(lineConsumer); if (lineConsumers.size() == 0) { isOpen = false; } } catch (IOException e) { LOG.error(String.format("An error occurred while writing line to the line consumer %s", lineConsumer), e); } } } }
Source:
<code>public FunctionParseNode functionDistinct(String name, List<ParseNode> args) { <START> if ("COUNT".equals(SchemaUtil.normalizeIdentifier(name))) { <END> BuiltInFunctionInfo info = getInfo( SchemaUtil.normalizeIdentifier(DistinctCountAggregateFunction.NAME), args); return new AggregateFunctionParseNode(name, args, info); } else { throw new UnsupportedOperationException("DISTINCT not supported with " + name); } }</code><technical_language>CountAggregateFunction.NAME instead (I've changed this constant upper case)</technical_language>

Target:
public FunctionParseNode functionDistinct(String name, List<ParseNode> args) { if (CountAggregateFunction.NAME.equals(SchemaUtil.normalizeIdentifier(name))) { BuiltInFunctionInfo info = getInfo( SchemaUtil.normalizeIdentifier(DistinctCountAggregateFunction.NAME), args); return new DistinctCountParseNode(name, args, info); } else { throw new UnsupportedOperationException("DISTINCT not supported with " + name); } }
Source:
<code>public void onEntityExplode(EntityExplodeEvent event) { if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { event.setCancelled(true); <START> return; <END> } event.blockList().clear(); }</code><technical_language>I allow blow other tnt blocks, else fun</technical_language>

Target:
public void onEntityExplode(EntityExplodeEvent event) { if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) { event.blockList().clear(); return; } event.setYield(0.0F); }
Source:
<code>public ReferenceCountingResourceHolder<T> take(final long timeout) throws InterruptedException { checkInitialized(); final T theObject = timeout >= 0 ? objects.poll(timeout, TimeUnit.MILLISECONDS) : objects.take(); return theObject == null ? null : new ReferenceCountingResourceHolder<>( theObject, new Closeable() { @Override public void close() throws IOException { <START> offer(theObject); <END> } } ); }</code><technical_language>nit: simple logic is separated in a method</technical_language>

Target:
public ReferenceCountingResourceHolder<T> take(final long timeout) { checkInitialized(); final T theObject; try { if (timeout > -1) { theObject = timeout > 0 ? poll(timeout) : poll(); } else { theObject = take(); } return theObject == null ? null : new ReferenceCountingResourceHolder<>( theObject, new Closeable() { @Override public void close() throws IOException { offer(theObject); } } ); } catch (InterruptedException e) { throw Throwables.propagate(e); } }
Source:
<code>public static Stream<Library> searchChildrenLibraries(DetailedSample model, LibraryService libraryService) { try { return Stream.concat(libraryService.listBySampleId(model.getId()).stream(), model.getChildren().stream().flatMap(child -> searchChildrenLibraries(child, libraryService))); } catch (IOException e) { <START> log.error("Failed to get child libraries.", e); <END> return Stream.empty(); } }</code><technical_language>throw exception confusing returning users developers</technical_language>

Target:
public static Stream<Library> searchChildrenLibraries(DetailedSample model, LibraryService libraryService) { try { return Stream.concat(libraryService.listBySampleId(model.getId()).stream(), model.getChildren().stream().flatMap(child -> searchChildrenLibraries(child, libraryService))); } catch (IOException e) { log.error("Failed to get child libraries.", e); throw new RestException("Error fetching library information", Status.INTERNAL_SERVER_ERROR); } }
Source:
<code>public IResult execute(IProgressListener listener) throws Exception { ExtractedCollectionBase extractor = CollectionExtractionUtils.extractCollection(list); if (extractor != null && extractor.hasExtractableContents()) { <START> END> return new ObjectListResult.Outbound(snapshot, extractor.extractEntryIds()); } else { throw new IllegalArgumentException(MessageUtil.format(Messages.ExtractListValuesQuery_NotAWellKnownList, list .getDisplayName())); } }</code><technical_language>is a check in original coding. check effect of skipping be</technical_language>

Target:
public IResult execute(IProgressListener listener) throws Exception { AbstractExtractedCollection extractor = CollectionExtractionUtils.extractCollection(list); if (extractor != null && extractor.hasExtractableContents()) { return new ObjectListResult.Outbound(snapshot, extractor.extractEntryIds()); } else { throw new IllegalArgumentException(MessageUtil.format(Messages.ExtractListValuesQuery_NotAWellKnownList, list.getDisplayName())); } }
Source:
<code>public void acquireTask(DatastreamTaskImpl task, long timeoutMs) throws DatastreamException { String lockPath = KeyBuilder.datastreamTaskLock(_cluster, task.getConnectorType(), task.getDatastreamTaskName()); String owner = null; if (_zkclient.exists(lockPath)) { owner = _zkclient.ensureReadData(lockPath); if (owner.equals(_instanceName)) { _log.info(String.format("%s already owns the lock on %s", _instanceName, task)); return; } CountDownLatch busyLatch = new CountDownLatch(1); String lockNode = lockPath.substring(lockPath.lastIndexOf('/') + 1); String taskPath = KeyBuilder.connectorTask(_cluster, task.getConnectorType(), task.getDatastreamTaskName()); <START> if (_zkclient.exists(lockPath)) { <END> IZkChildListener listener = (parentPath, currentChilds) -> { if (!currentChilds.contains(lockNode)) { busyLatch.countDown(); } }; try { _zkclient.subscribeChildChanges(taskPath, listener); busyLatch.await(timeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { _log.warn("Unexpectedly interrupted during task acquire.", e); } finally { _zkclient.unsubscribeChildChanges(taskPath, listener); } } } if (!_zkclient.exists(lockPath)) { _zkclient.createEphemeral(lockPath, _instanceName); _log.info(String.format("%s successfully acquired the lock on %s", _instanceName, task)); } else { String msg = String.format("%s failed to acquire task %s in %dms, current owner: %s", _instanceName, task, timeoutMs, owner); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, msg, null); } }</code><technical_language>major, i recommend creating tiny functions trywaitTillLockIsReleased acquirelock clear of easy read code</technical_language>

Target:
public void acquireTask(DatastreamTaskImpl task, long timeoutMs) throws DatastreamException { String lockPath = KeyBuilder.datastreamTaskLock(_cluster, task.getConnectorType(), task.getDatastreamTaskName()); String owner = null; if (_zkclient.exists(lockPath)) { owner = _zkclient.ensureReadData(lockPath); if (owner.equals(_instanceName)) { _log.info(String.format("%s already owns the lock on %s", _instanceName, task)); return; } waitForTaskRelease(task, timeoutMs, lockPath); } if (!_zkclient.exists(lockPath)) { _zkclient.createEphemeral(lockPath, _instanceName); _log.info(String.format("%s successfully acquired the lock on %s", _instanceName, task)); } else { String msg = String.format("%s failed to acquire task %s in %dms, current owner: %s", _instanceName, task, timeoutMs, owner); ErrorLogger.logAndThrowDatastreamRuntimeException(_log, msg, null); } }
Source:
<code>static boolean isImmutable(List<Object> extra) { if (extra == Collections.emptyList()) return true; <START> String simpleName = extra.getClass().getSimpleName(); <END> return simpleName.startsWith("Unmodifiable") || simpleName.contains("Immutable"); }</code><technical_language>SingletonList hurts brain is a type. I understand this.. is assumption else is this method is fair enough. hurt brain intentionally checking SingletonList due call site wont'</technical_language>

Target:
static boolean isImmutable(List<Object> extra) { assert extra.size() > 1; String simpleName = extra.getClass().getSimpleName(); return simpleName.startsWith("Unmodifiable") || simpleName.contains("Immutable"); }
Source:
<code>protected void beforeLogin(LoginModel loginModel) { <START> CommonModelManager.init(eventBus); <END> }</code><technical_language>stay consistent UserPortal ApplicationInit, put: ModelInitializedEvent.fire(eventBus); here, instead of CommonModelManager#init method. purpose of CommonModelManager is init & handle CommonModel, firing ModelInitializedEvent is out of scope of responsibility</technical_language>

Target:
protected void beforeLogin(LoginModel loginModel) { CommonModelManager.init(eventBus); ModelInitializedEvent.fire(eventBus); }
Source:
<code>public LayoutInflater onGetLayoutInflater(@Nullable Bundle savedInstanceState) { LayoutInflater layoutInflater = super.onGetLayoutInflater(savedInstanceState); if (!mShowsDialog || mCreatingDialog) { if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { String message = "getting layout inflater for DialogFragment " + this; if (!mShowsDialog) { Log.d(TAG, "mShowsDialog = false: " + message); } else { Log.d(TAG, "mCreatingDialog = true: " + message); } } return layoutInflater; } prepareDialog(savedInstanceState); if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { Log.d(TAG, "get layout inflater for DialogFragment " + this + " from dialog context"); } if (mDialog != null) { layoutInflater = <START> layoutInflater.cloneInContext(requireDialog().getContext()); <END> } return layoutInflater; }</code><technical_language>mDialog if null check in if</technical_language>

Target:
public LayoutInflater onGetLayoutInflater(@Nullable Bundle savedInstanceState) { LayoutInflater layoutInflater = super.onGetLayoutInflater(savedInstanceState); if (!mShowsDialog || mCreatingDialog) { if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { String message = "getting layout inflater for DialogFragment " + this; if (!mShowsDialog) { Log.d(TAG, "mShowsDialog = false: " + message); } else { Log.d(TAG, "mCreatingDialog = true: " + message); } } return layoutInflater; } prepareDialog(savedInstanceState); if (FragmentManager.isLoggingEnabled(Log.VERBOSE)) { Log.d(TAG, "get layout inflater for DialogFragment " + this + " from dialog context"); } if (mDialog != null) { layoutInflater = layoutInflater.cloneInContext(mDialog.getContext()); } return layoutInflater; }