auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static boolean equal( final String desc1, RelDataType type1, final String desc2, RelDataType type2, Litmus litmus) { if (!areRowTypesEqual(type1, type2, false)) { <START> return litmus.fail("Type mismatch:\n{}:\n{}\n{}:\n{}\ndifference:\n{}", desc1, type1.getFullTypeString(), desc2, type2.getFullTypeString(), getFullTypeDifferenceString(type1, type2)); <END> } return litmus.succeed(); }</code><technical_language>Is this method anywhere</technical_language>

Target:
public static boolean equal( final String desc1, RelDataType type1, final String desc2, RelDataType type2, Litmus litmus) { if (!areRowTypesEqual(type1, type2, false)) { return litmus.fail(getFullTypeDifferenceString(desc1, type1, desc2, type2)); } return litmus.succeed(); }
Source:
<code>protected void configure() { final SchemaFactory<ReviewDb> schema = dbInjector.getInstance( Key.get(new TypeLiteral<SchemaFactory<ReviewDb>>() {})); final List<ReviewDb> dbs = Collections.synchronizedList( <START> Lists.<ReviewDb> newArrayListWithCapacity(threads)); <END> final ThreadLocal<ReviewDb> localDb = new ThreadLocal<ReviewDb>(); bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() { @Override public ReviewDb get() { ReviewDb db = localDb.get(); if (db == null) { try { db = schema.open(); dbs.add(db); localDb.set(db); } catch (OrmException e) { throw new ProvisionException("unable to open ReviewDb", e); } } return db; } }); listener().toInstance(new LifecycleListener() { @Override public void start() { } @Override public void stop() { for (ReviewDb db : dbs) { db.close(); } } }); }</code><technical_language>Lists.<ReviewDb> newArrayListWithCapacity(2*threads + 1)) open 2*threads unique DB connections + main thread</technical_language>

Target:
protected void configure() { final SchemaFactory<ReviewDb> schema = dbInjector.getInstance( Key.get(new TypeLiteral<SchemaFactory<ReviewDb>>() {})); final List<ReviewDb> dbs = Collections.synchronizedList( Lists.<ReviewDb> newArrayListWithCapacity(threads + 1)); final ThreadLocal<ReviewDb> localDb = new ThreadLocal<ReviewDb>(); bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() { @Override public ReviewDb get() { ReviewDb db = localDb.get(); if (db == null) { try { db = schema.open(); dbs.add(db); localDb.set(db); } catch (OrmException e) { throw new ProvisionException("unable to open ReviewDb", e); } } return db; } }); listener().toInstance(new LifecycleListener() { @Override public void start() { } @Override public void stop() { for (ReviewDb db : dbs) { db.close(); } } }); }
Source:
<code>private Slice readOrSkip(boolean skip) throws IOException { if (currentPointer == null) { currentPointer = fileSystemWAL.walStartPointer; } do { if (inputStream == null) { inputStream = getInputStream(currentPointer); } if (inputStream != null && isOpenPathTmp && !fileSystemWAL.tempPartFiles.containsKey(currentPointer.partNum)) { close(); inputStream = getInputStream(currentPointer); } int ch1; <START> if (inputStream != null && (ch1 = inputStream.read()) != -1) { <END> int ch2 = inputStream.read(); int ch3 = inputStream.read(); int ch4 = inputStream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new EOFException(); } int len = ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); Preconditions.checkState(len >= 0, "negative length"); if (!skip) { byte[] data = new byte[len]; inputStream.readFully(data); currentPointer.offset += len + 4; return new Slice(data); } else { long actualSkipped = inputStream.skip(len); if (actualSkipped != len) { throw new IOException("unable to skip " + len); } currentPointer.offset += len + 4; return null; } } } while (nextSegment()); close(); return null; }</code><technical_language>is this readInt()</technical_language>

Target:
private Slice readOrSkip(boolean skip) throws IOException { if (currentPointer == null) { currentPointer = fileSystemWAL.walStartPointer; } do { if (inputStream == null) { inputStream = getInputStream(currentPointer); } if (inputStream != null && isOpenPathTmp && !fileSystemWAL.tempPartFiles.containsKey(currentPointer.partNum)) { close(); inputStream = getInputStream(currentPointer); } int len = readLen(inputStream); if (len != -1) { if (!skip) { byte[] data = new byte[len]; inputStream.readFully(data); currentPointer.offset += len + 4; return new Slice(data); } else { long actualSkipped = inputStream.skip(len); if (actualSkipped != len) { throw new IOException("unable to skip " + len); } currentPointer.offset += len + 4; return null; } } } while (nextSegment()); close(); return null; }
Source:
<code>public static synchronized Pkcs1Reader getInstance() { if (reader == null) { Iterator<Pkcs1Reader> iter = PKCS1_READER_LOADER.iterator(); if (!iter.hasNext()) { throw new IllegalStateException( "No Pkcs1Reader services were present. Ensure that a Pkcs1Reader with a properly configured " + "META-INF/services/ entry is present on the classpath."); } <START> reader = iter.next(); <END> } return reader; }</code><technical_language>Nit: Guava a pretty nice convenience method of Iterators.getFirst, error message is useful above, though</technical_language>

Target:
public static Pkcs1Reader getInstance() { return PKCS1_READER_SUPPLIER.get(); }
Source:
<code>public void requestResults( String query, Searcher searcher ) { String queryNormalized = StringNormalizer.normalize( query ); FuzzyScore fuzzyScore = new FuzzyScore(); FuzzyScore.MatchInfo matchInfo = new FuzzyScore.MatchInfo(); for( AppPojo pojo : pojos ) { <START> pojo.displayName = pojo.name; <END> pojo.displayTags = pojo.tags; boolean match = fuzzyScore.match( queryNormalized, pojo.nameNormalized, matchInfo ); pojo.relevance = matchInfo.score; if ( match ) { List<Pair<Integer, Integer>> positions = matchInfo.getMatchedSequences(); try { pojo.setDisplayNameHighlightRegion( positions ); } catch( Exception e ) { StringBuilder sb = new StringBuilder(); for( Pair p : positions ) sb.append( "<" ) .append( p.first ) .append( "," ) .append( p.second ) .append( ">" ); Log.e( "TBog", sb.toString(), e ); pojo.setDisplayNameHighlightRegion( 0, pojo.nameNormalized.length() ); } } if( !pojo.tagsNormalized.isEmpty() ) { if( fuzzyScore.match( queryNormalized, pojo.tagsNormalized, matchInfo ) ) { if( !match || (matchInfo.score > pojo.relevance) ) { match = true; pojo.relevance = matchInfo.score; pojo.setTagHighlight( matchInfo.matchedIndices ); } } } if( match ) { if( !searcher.addResult( pojo ) ) return; } } }</code><technical_language>Is worth setting displayName if a match? for displayTags</technical_language>

Target:
public void requestResults( String query, Searcher searcher ) { StringNormalizer.Result queryNormalized = StringNormalizer.normalizeWithResult( query, false ); FuzzyScore fuzzyScore = new FuzzyScore( queryNormalized.codePoints ); FuzzyScore.MatchInfo matchInfo = new FuzzyScore.MatchInfo(); for( AppPojo pojo : pojos ) { boolean bDisplayNameSet = false; boolean bDisplayTagsSet = false; boolean match = fuzzyScore.match( pojo.normalizedName.codePoints, matchInfo ); pojo.relevance = matchInfo.score; if ( match ) { List<Pair<Integer, Integer>> positions = matchInfo.getMatchedSequences(); try { pojo.setDisplayNameHighlightRegion( positions ); } catch( Exception e ) { pojo.setDisplayNameHighlightRegion( 0, pojo.normalizedName.length() ); } bDisplayNameSet = true; } if( pojo.normalizedTags != null ) { if( fuzzyScore.match( pojo.normalizedTags.codePoints, matchInfo ) ) { if( !match || (matchInfo.score > pojo.relevance) ) { match = true; pojo.relevance = matchInfo.score; pojo.setTagHighlight( matchInfo.matchedIndices ); bDisplayTagsSet = true; } } } if( match ) { if ( !bDisplayNameSet ) pojo.displayName = pojo.getName(); if ( !bDisplayTagsSet ) pojo.displayTags = pojo.getTags(); if( !searcher.addResult( pojo ) ) return; } } }
Source:
<code>private void chooseDistribution(PartitioningHandle distribution) { checkState(partitioningHandle.isPresent(), "No partitioning to choose from"); if (partitioningHandle.get().equals(distribution) || partitioningHandle.get().isSingleNode()) { return; } if (partitioningHandle.get().equals(SOURCE_DISTRIBUTION)) { partitioningHandle = Optional.of(distribution); return; } <START> checkState(false, <END> "Cannot set distribution to %s. Already set to %s", distribution, partitioningHandle); }</code><technical_language>checkState this weird. throw IllegalXXXException</technical_language>

Target:
private void chooseDistribution(PartitioningHandle distribution) { checkState(partitioningHandle.isPresent(), "No partitioning to choose from"); if (partitioningHandle.get().equals(distribution) || partitioningHandle.get().isSingleNode() || isCompatibleSystemPartitioning(distribution)) { return; } if (partitioningHandle.get().equals(SOURCE_DISTRIBUTION)) { partitioningHandle = Optional.of(distribution); return; } throw new IllegalStateException(format( "Cannot set distribution to %s. Already set to %s", distribution, partitioningHandle)); }
Source:
<code>private void cleanUpProjectOldInstallations(final Project project) throws ProjectManagerException, ExecutorManagerException { log.info("Cleaning up old install files older than " + (project.getVersion() - this.projectVersionRetention)); <START> Map<Integer, Pair<ExecutionReference, ExecutableFlow>> activeFlows = this.executorLoader <END> .fetchActiveFlows(); final List<Integer> versionsWithRunningExecutions = activeFlows.values() .stream().map(pair -> pair.getSecond()) .filter(exflow -> exflow.getProjectId() == project.getId()) .map(exflow -> exflow.getVersion()) .collect(Collectors.toList()); this.projectLoader.cleanOlderProjectVersion(project.getId(), project.getVersion() - this.projectVersionRetention, versionsWithRunningExecutions); this.storageManager.cleanupProjectArtifacts(project.getId()); }</code><technical_language>queued flows? mentioned, a delay in dispatching executors executions queued web server. exclude project versions deleted for queued flows well? If case, this.executorLoader.fetchUnfinishedFlows include queued flows</technical_language>

Target:
private void cleanUpProjectOldInstallations(final Project project) throws ProjectManagerException, ExecutorManagerException { log.info("Cleaning up old install files older than " + (project.getVersion() - this.projectVersionRetention)); final Map<Integer, Pair<ExecutionReference, ExecutableFlow>> unfinishedFlows = this.executorLoader .fetchUnfinishedFlowsMetadata(); final List<Integer> versionsWithUnfinishedExecutions = unfinishedFlows.values() .stream().map(pair -> pair.getSecond()) .filter(exflow -> exflow.getProjectId() == project.getId()) .map(exflow -> exflow.getVersion()) .collect(Collectors.toList()); this.projectLoader.cleanOlderProjectVersion(project.getId(), project.getVersion() - this.projectVersionRetention, versionsWithUnfinishedExecutions); this.storageManager.cleanupProjectArtifacts(project.getId()); }
Source:
<code>public static TimeSync initializeGPSD(InetSocketAddress gpsd, int timeSyncInterval, int localTimeRenew) { if (theInstance != null) { Logging.logMessage(Logging.LEVEL_WARN, Category.lifecycle, null, "time sync already running", new Object[0]); return theInstance; } TimeSync s = new TimeSync(ExtSyncSource.GPSD, null, gpsd, timeSyncInterval, localTimeRenew); s.start(); try { s.waitForStartup(); <START> } catch (Exception e) { <END> Logging.logError(Logging.LEVEL_ERROR, null, e); } return s; }</code><technical_language>I catching this Exception is counterproductive. system misbehave if starting TimeSync fails crash immediately. Btw, please add a reference current object instead of "null" while logging errors</technical_language>

Target:
public static TimeSync initializeGPSD(InetSocketAddress gpsd, int timeSyncInterval, int localTimeRenew) throws Exception { if (theInstance != null) { Logging.logMessage(Logging.LEVEL_WARN, Category.lifecycle, null, "time sync already running", new Object[0]); return theInstance; } TimeSync s = new TimeSync(ExtSyncSource.GPSD, null, gpsd, timeSyncInterval, localTimeRenew); s.start(); s.waitForStartup(); return s; }
Source:
<code>public synchronized WrappedChannel reserveChannel() { Channel reserved; boolean returned = false; if (channels.length == 1) { reserved = channels[0]; returned = true; <START> } else { <END> reserved = channels[channels.length - 1]; Channel[] newChannelArray = new Channel[channels.length - 1]; System.arraycopy(channels, 0, newChannelArray, 0, channels.length - 1); channels = newChannelArray; } return new WrappedChannel(reserved, returned); }</code><technical_language>I guess size of channels 0</technical_language>

Target:
public synchronized PooledChannel reserveChannel() { Channel reserved; boolean returned = false; if (channels.length == 1) { reserved = channels[0]; returned = true; } else { reserved = channels[channels.length - 1]; Channel[] newChannelArray = new Channel[channels.length - 1]; System.arraycopy(channels, 0, newChannelArray, 0, channels.length - 1); channels = newChannelArray; } return new PooledChannel(reserved, returned); }
Source:
<code>public int getCount() throws InterruptedException, KeeperException { <START> ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher(); <END> return ByteBuffer.wrap(m_zk.getData(m_path, fw, null)).getInt(); }</code><technical_language>Is this FutureWatcher needed here? I purpose of this watcher. method await() calls get() ZK data</technical_language>

Target:
public int getCount() throws InterruptedException, KeeperException { return ByteBuffer.wrap(m_zk.getData(m_path, false, null)).getInt(); }
Source:
<code>protected String getActiveMQBroker() { <START> return this.aciveMqBroker; <END> }</code><technical_language>typo: activeMqBroker in stead of aciveMqBroker</technical_language>

Target:
protected String getActiveMQBroker() { return this.activeMqBroker; }
Source:
<code><START> public Optional<CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>>> get( <END> CorfuTable.IndexName name) { String indexName = (name != null) ? name.get() : null; CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>> index = indices.get(indexName); if (index != null) { return Optional.of(index); } else { return Optional.empty(); } }</code><technical_language>return Result<Exception, List<Index>> instead of throwing runtime exception</technical_language>

Target:
public Optional<CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>>> get( CorfuTable.IndexName name) { String indexName = Optional.ofNullable(name) .map(Supplier::get) .orElse(null); CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>> index = indices.get(indexName); if (index != null) { return Optional.of(index); } else { return Optional.empty(); } }
Source:
<code>public void run() { <START> try { <END> while (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.lock(); try { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.listening = true; RedisQueueMessageDrivenEndpoint.this.popMessageAndSend(); } } finally { RedisQueueMessageDrivenEndpoint.this.lifecycleCondition.signalAll(); RedisQueueMessageDrivenEndpoint.this.lifecycleLock.unlock(); } try { Thread.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } finally { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.restart(); } else { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.lock(); try { RedisQueueMessageDrivenEndpoint.this.lifecycleCondition.signalAll(); } finally { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.unlock(); } } } }</code><technical_language>need reset this boolean</technical_language>

Target:
public void run() { try { while (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.listening = true; RedisQueueMessageDrivenEndpoint.this.popMessageAndSend(); } } finally { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.restart(); } else { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.lock(); try { RedisQueueMessageDrivenEndpoint.this.lifecycleCondition.signalAll(); } finally { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.unlock(); } } } }
Source:
<code>public void init() { ActionsConfiguratorsManager acm = ActionsConfiguratorsManager.getInstance(); System.setProperty("jsse.enableSNIExtension", "false"); MDKConfigurator mdkConfigurator = new MDKConfigurator(); acm.addContainmentBrowserContextConfigurator(mdkConfigurator); acm.addSearchBrowserContextConfigurator(mdkConfigurator); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, mdkConfigurator); acm.addMainMenuConfigurator(new MMSConfigurator()); EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader()); SRConfigurator srconfig = new SRConfigurator(); acm.addSearchBrowserContextConfigurator(srconfig); acm.addContainmentBrowserContextConfigurator(srconfig); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, srconfig); acm.addMainToolbarConfigurator(new OutputQueueStatusConfigurator()); acm.addMainToolbarConfigurator(new SyncStatusConfigurator()); getDebugExportImportPlugin().init(); getOclPlugin().init(); getVcPlugin().init(); MMSSyncPlugin.getInstance().init(); (new Thread(new OutputSyncRunner())).start(); loadExtensionJars(); configureEnvironmentOptions(); <START> SpecificationDialogManager.getManager().addConfigurator(Element.class, new SpecificationNodeAspectsConfigurator()); <END> }</code><technical_language>this a new tab in Specification window? If so, needs removed feature is completed</technical_language>

Target:
public void init() { ActionsConfiguratorsManager acm = ActionsConfiguratorsManager.getInstance(); System.setProperty("jsse.enableSNIExtension", "false"); MDKConfigurator mdkConfigurator = new MDKConfigurator(); acm.addContainmentBrowserContextConfigurator(mdkConfigurator); acm.addSearchBrowserContextConfigurator(mdkConfigurator); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, mdkConfigurator); acm.addMainMenuConfigurator(new MMSConfigurator()); EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader()); SRConfigurator srconfig = new SRConfigurator(); acm.addSearchBrowserContextConfigurator(srconfig); acm.addContainmentBrowserContextConfigurator(srconfig); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, srconfig); acm.addMainToolbarConfigurator(new OutputQueueStatusConfigurator()); acm.addMainToolbarConfigurator(new SyncStatusConfigurator()); getDebugExportImportPlugin().init(); getOclPlugin().init(); getVcPlugin().init(); MMSSyncPlugin.getInstance().init(); (new Thread(new OutputSyncRunner())).start(); loadExtensionJars(); configureEnvironmentOptions(); }
Source:
<code>private void checkNoResultView(EmptyQueryResultsFor query) { Activity activity = getActivity(); if (activity instanceof TaskProcessCallback) { if (discussionPostsAdapter.getCount() == 0) { String resultsText = ""; switch (query) { case FOLLOWING: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_following); break; case CATEGORY: resultsText = getActivity().getResources().getString(R.string.forum_no_results_in_category); break; case COURSE: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_all_posts); break; } if (postsFilter != DiscussionPostsFilter.ALL) { <START> resultsText += " " + getActivity().getResources().getString(R.string.forum_no_results_with_filter); <END> } ((TaskProcessCallback) activity).onMessage(MessageType.ERROR, resultsText); } else { ((TaskProcessCallback) activity).onMessage(MessageType.EMPTY, ""); } } }</code><technical_language>This is RTL language friendly. ~~Perhaps a placeholder in forum_no_results_with_filter instead of string concatenation? e.g. "{reason}\nTry removing filter"~~ if a line break instead of a space enough I guess ;) (As long need support [Hanun'o](<LINK_0>'o_alphabet))</technical_language>

Target:
private void checkNoResultView(EmptyQueryResultsFor query) { Activity activity = getActivity(); if (activity instanceof TaskProcessCallback) { if (discussionPostsAdapter.getCount() == 0) { String resultsText = ""; switch (query) { case FOLLOWING: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_following); break; case CATEGORY: resultsText = getActivity().getResources().getString(R.string.forum_no_results_in_category); break; case COURSE: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_all_posts); break; } if (postsFilter != DiscussionPostsFilter.ALL) { resultsText += "\n" + getActivity().getResources().getString(R.string.forum_no_results_with_filter); } ((TaskProcessCallback) activity).onMessage(MessageType.ERROR, resultsText); } else { ((TaskProcessCallback) activity).onMessage(MessageType.EMPTY, ""); } } }
Source:
<code>public void testPartitionedSourceAndTargetWritingToTopLevel() throws IOException { PartitionStrategy partitionStrategy = new PartitionStrategy.Builder().hash( "username", 2).build(); Dataset<Record> inputDataset = repo.create("in", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); Dataset<Record> outputDataset = repo.create("out", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); writeTestUsers(inputDataset, 10); PartitionKey key = partitionStrategy.partitionKey(0); Dataset<Record> inputPart0 = inputDataset.getPartition(key, false); Pipeline pipeline = new MRPipeline(TestCrunchDatasets.class); PCollection<GenericData.Record> data = pipeline.read( CrunchDatasets.asSource(inputPart0, GenericData.Record.class)); pipeline.write(data, CrunchDatasets.asTarget(outputDataset), Target.WriteMode.APPEND); pipeline.run(); <START> Assert.assertEquals(5, datasetSize(outputDataset)); <END> }</code><technical_language>This verify users source partition 0 written partition 0 of target. able copy line 138 change this assertion datasetSize(outputPart0)</technical_language>

Target:
public void testPartitionedSourceAndTargetWritingToTopLevel() throws IOException { PartitionStrategy partitionStrategy = new PartitionStrategy.Builder().hash( "username", 2).build(); Dataset<Record> inputDataset = repo.create("in", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); Dataset<Record> outputDataset = repo.create("out", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); writeTestUsers(inputDataset, 10); PartitionKey key = partitionStrategy.partitionKey(0); Dataset<Record> inputPart0 = inputDataset.getPartition(key, false); Pipeline pipeline = new MRPipeline(TestCrunchDatasets.class); PCollection<GenericData.Record> data = pipeline.read( CrunchDatasets.asSource(inputPart0, GenericData.Record.class)); pipeline.write(data, CrunchDatasets.asTarget(outputDataset), Target.WriteMode.APPEND); pipeline.run(); Assert.assertEquals(5, datasetSize(outputDataset)); Dataset<Record> outputPart0 = outputDataset.getPartition(key, false); Assert.assertNotNull(outputPart0); Assert.assertEquals(5, datasetSize(outputPart0)); }
Source:
<code>void prepare() throws InfrastructureException { KubernetesClient k8sClient = clientFactory.create(workspaceId); if (k8sClient.serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get() == null) { createWorkspaceServiceAccount(k8sClient); } String execRoleName = "exec"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(execRoleName).get() == null) { createExecRole(k8sClient, execRoleName); } <START> String viewRoleName = "exec"; <END> if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(viewRoleName).get() == null) { createViewRole(k8sClient, viewRoleName); } k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createExecRoleBinding()); k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createViewRoleBinding()); }</code><technical_language>I guess view</technical_language>

Target:
void prepare() throws InfrastructureException { KubernetesClient k8sClient = clientFactory.create(workspaceId); if (k8sClient.serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get() == null) { createWorkspaceServiceAccount(k8sClient); } String execRoleName = "exec"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(execRoleName).get() == null) { createExecRole(k8sClient, execRoleName); } String viewRoleName = "workspace-view"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(viewRoleName).get() == null) { createViewRole(k8sClient, viewRoleName); } k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createExecRoleBinding()); k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createViewRoleBinding()); }
Source:
<code>void createsMessageBatchWithSize() { int maxLinkSize = 10000; int batchSize = 1024; <START> int eventOverhead = 46; <END> int maxEventPayload = batchSize - eventOverhead; final ServiceBusMessage message = new ServiceBusMessage(new byte[maxEventPayload]); final ServiceBusMessage tooLargeMessage = new ServiceBusMessage(new byte[maxEventPayload + 1]); final CreateBatchOptions options = new CreateBatchOptions().setMaximumSizeInBytes(batchSize); ServiceBusMessageBatch batch = new ServiceBusMessageBatch(batchSize, null, tracerProvider, messageSerializer); when(asyncSender.createBatch(options)).thenReturn(Mono.just(batch)); ServiceBusMessageBatch messageBatch = sender.createBatch(options); Assertions.assertEquals(batchSize, messageBatch.getMaxSizeInBytes()); Assertions.assertTrue(messageBatch.tryAdd(message)); Assertions.assertFalse(messageBatch.tryAdd(tooLargeMessage)); }</code><technical_language>need this logic. assert correct properties for batch passed asyncClient. assume asyncClient right</technical_language>

Target:
void createsMessageBatchWithSize() { int batchSize = 1024; final CreateBatchOptions options = new CreateBatchOptions().setMaximumSizeInBytes(batchSize); final ServiceBusMessageBatch batch = new ServiceBusMessageBatch(batchSize, null, null, null); when(asyncSender.createBatch(options)).thenReturn(Mono.just(batch)); ServiceBusMessageBatch messageBatch = sender.createBatch(options); Assertions.assertEquals(batch, messageBatch); }
Source:
<code>public MavenRepositoryConfigurationDto convert(MavenRepositoryConfigurationForm mavenRepositoryConfigurationForm) { MavenRepositoryConfigurationDto configuration = new MavenRepositoryConfigurationDto(); configuration.setIndexingClassNamesEnabled(mavenRepositoryConfigurationForm.isIndexingClassNamesEnabled()); configuration.setIndexingEnabled(mavenRepositoryConfigurationForm.isIndexingEnabled()); configuration.setDownloadRemoteMavenIndexCronExpression( mavenRepositoryConfigurationForm.getDownloadRemoteMavenIndexCronExpression()); configuration.setRebuildMavenIndexesCronExpression( <START> mavenRepositoryConfigurationForm.getRebuildMavenIndexesCronExpression()); <END> return configuration; }</code><technical_language>missing cron expression for MergeMavenGroupRepositoryIndexCronJob</technical_language>

Target:
public MavenRepositoryConfigurationDto convert(MavenRepositoryConfigurationForm mavenRepositoryConfigurationForm) { MavenRepositoryConfigurationDto configuration = new MavenRepositoryConfigurationDto(); configuration.setIndexingClassNamesEnabled(mavenRepositoryConfigurationForm.isIndexingClassNamesEnabled()); configuration.setIndexingEnabled(mavenRepositoryConfigurationForm.isIndexingEnabled()); configuration.setCronExpression(mavenRepositoryConfigurationForm.getCronExpression()); return configuration; }
Source:
<code>public static ExtensionProfile create(final List<Extension> extensions) { <START> return new AutoValue_ExtensionProfile(extensions); <END> }</code><technical_language>Enforce immutability. Also, list declared nullable change like: java return new AutoValue_ExtensionProfile(extensions == null ? ImmutableList.of() : ImmutableList.copyOf(extensions)); review entire change set enforce immutability in collection properties present</technical_language>

Target:
public static ExtensionProfile create(final List<Extension> extensions) { return new AutoValue_ExtensionProfile(extensions == null ? ImmutableList.<Extension>of() : ImmutableList.copyOf(extensions)); }
Source:
<code>public boolean autoImportReferenceAtCursor(@NotNull Editor editor, @NotNull PsiFile file) { if (!file.getViewProvider().getLanguages().contains(GoLanguage.INSTANCE) || !GoCodeInsightSettings.getInstance().ADD_UNAMBIGUOUS_IMPORTS_ON_THE_FLY) { return false; } int caretOffset = editor.getCaretModel().getOffset(); Document document = editor.getDocument(); int lineNumber = document.getLineNumber(caretOffset); int startOffset = document.getLineStartOffset(lineNumber); int endOffset = document.getLineEndOffset(lineNumber); List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(file, startOffset, endOffset); for (PsiElement element : elements) { if (element instanceof GoElement) { for (PsiReference reference : element.getReferences()) { if (reference instanceof GoReference) { GoImportPackageQuickFix fix = new GoImportPackageQuickFix(reference); if (fix.isAvailable(file.getProject(), editor, file)) { <START> new GoImportPackageQuickFix(reference).applyFix(); <END> return true; } } } } } return false; }</code><technical_language>need write lock here? same: is secod fix needed</technical_language>

Target:
public boolean autoImportReferenceAtCursor(@NotNull Editor editor, @NotNull PsiFile file) { if (!file.getViewProvider().getLanguages().contains(GoLanguage.INSTANCE)) { return false; } int caretOffset = editor.getCaretModel().getOffset(); Document document = editor.getDocument(); int lineNumber = document.getLineNumber(caretOffset); int startOffset = document.getLineStartOffset(lineNumber); int endOffset = document.getLineEndOffset(lineNumber); List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(file, startOffset, endOffset); for (PsiElement element : elements) { if (element instanceof GoCompositeElement) { for (PsiReference reference : element.getReferences()) { if (reference instanceof GoReference) { GoImportPackageQuickFix fix = new GoImportPackageQuickFix(reference); if (fix.isAvailable(file.getProject(), editor, file)) { fix.applyFix(); return true; } } } } } return false; }
Source:
<code>HttpClient getHttpClient() { <START> return null == httpClient ? new DefaultHttpClient() : httpClient; <END> }</code><technical_language>style, I wrapping conditionals in () for this statement. In view improves readability in ternary operator is tricky</technical_language>

Target:
HttpClient getHttpClient() { return (null == httpClient) ? new DefaultHttpClient() : httpClient; }
Source:
<code>public String getTargetTypeName(ILaunchTarget target) { <START> return getContribution(target) == null ? null : getContribution(target).name; <END> }</code><technical_language>Instead of null check getContribution return non-null? I.e. return default provider if is mapping</technical_language>

Target:
public String getTargetTypeName(ILaunchTarget target) { return getContribution(target).name; }
Source:
<code>private final void throwIfInfeasibleTypeConversion(SQLStmt stmt, Class <?> argClass, int argInd, VoltType expectedType) { if (argClass.isArray()) { if (expectedType.acceptsArray(argClass)) { return; } } else { VoltType argType = VoltType.typeFromClass(argClass); if (argType == expectedType) { return; } if (argType == VoltType.STRING) { if (expectedType.isNumber() || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isNumber()) { if (expectedType.isNumber() || expectedType == VoltType.STRING || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isBackendIntegerType()) { if ((expectedType.isNumber() && <START> argType != VoltType.DECIMAL) || <END> expectedType == VoltType.STRING) { return; } } } String argTypeName = argClass.getSimpleName(); String preferredType = expectedType.getMostCompatibleJavaTypeName(); throw new VoltTypeException("Procedure " + m_procedureName + ": Incompatible parameter type: can not convert type '"+ argTypeName + "' to '"+ expectedType.getName() + "' for arg " + argInd + " for SQL stmt: " + stmt.getText() + "." + " Try explicitly using a " + preferredType + " parameter."); }</code><technical_language>I confused. If argType is BackendIntegerType(), argType VoltType.Decimal, is check " argType != VoltType.DECIMAL" necessary</technical_language>

Target:
private final void throwIfInfeasibleTypeConversion(SQLStmt stmt, Class <?> argClass, int argInd, VoltType expectedType) { if (argClass.isArray()) { if (expectedType.acceptsArray(argClass)) { return; } } else { VoltType argType = VoltType.typeFromClass(argClass); if (argType == expectedType) { return; } if (argType == VoltType.STRING) { if (expectedType.isNumber() || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isNumber()) { if (expectedType.isNumber() || expectedType == VoltType.STRING || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isBackendIntegerType()) { if (expectedType.isNumber() || expectedType == VoltType.STRING) { return; } } } String argTypeName = argClass.getSimpleName(); String preferredType = expectedType.getMostCompatibleJavaTypeName(); throw new VoltTypeException("Procedure " + m_procedureName + ": Incompatible parameter type: can not convert type '"+ argTypeName + "' to '"+ expectedType.getName() + "' for arg " + argInd + " for SQL stmt: " + stmt.getText() + "." + " Try explicitly using a " + preferredType + " parameter."); }
Source:
<code>public final void processAsync(IncomingMessageEnvelope ime, MessageCollector collector, TaskCoordinator coordinator, TaskCallback callback) { SystemStream systemStream = ime.getSystemStreamPartition().getSystemStream(); InputOperatorImpl inputOpImpl = operatorImplGraph.getInputOperator(systemStream); if (inputOpImpl != null) { CompletionStage<Void> processFuture; MessageType messageType = MessageType.of(ime.getMessage()); switch (messageType) { case USER_MESSAGE: <START> processFuture = inputOpImpl.onAsyncMessage(ime, collector, coordinator); <END> break; case END_OF_STREAM: EndOfStreamMessage eosMessage = (EndOfStreamMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateEndOfStream(eosMessage, ime.getSystemStreamPartition(), collector, coordinator); break; case WATERMARK: WatermarkMessage watermarkMessage = (WatermarkMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateWatermark(watermarkMessage, ime.getSystemStreamPartition(), collector, coordinator); break; default: processFuture = failedFuture(new SamzaException("Unknown message type " + messageType + " encountered.")); break; } processFuture.whenComplete((val, ex) -> { if (ex != null) { callback.failure(ex); } else { callback.complete(); } }); } }</code><technical_language>s/onAsyncMessage/onMessageAsync</technical_language>

Target:
public final void processAsync(IncomingMessageEnvelope ime, MessageCollector collector, TaskCoordinator coordinator, TaskCallback callback) { SystemStream systemStream = ime.getSystemStreamPartition().getSystemStream(); InputOperatorImpl inputOpImpl = operatorImplGraph.getInputOperator(systemStream); if (inputOpImpl != null) { CompletionStage<Void> processFuture; MessageType messageType = MessageType.of(ime.getMessage()); switch (messageType) { case USER_MESSAGE: processFuture = inputOpImpl.onMessageAsync(ime, collector, coordinator); break; case END_OF_STREAM: EndOfStreamMessage eosMessage = (EndOfStreamMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateEndOfStream(eosMessage, ime.getSystemStreamPartition(), collector, coordinator); break; case WATERMARK: WatermarkMessage watermarkMessage = (WatermarkMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateWatermark(watermarkMessage, ime.getSystemStreamPartition(), collector, coordinator); break; default: processFuture = failedFuture(new SamzaException("Unknown message type " + messageType + " encountered.")); break; } processFuture.whenComplete((val, ex) -> { if (ex != null) { callback.failure(ex); } else { callback.complete(); } }); } }
Source:
<code>public void testAtsProgramInsertionFeatureNegativeInsertionRestCall() throws Exception { String result = <START> doRequestString( <END> "/ats/program/" + getSawProgram().getArtId() + "/insertion/" + Integer.toString(-5) + "/feature", HttpMethod.GET, null, javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); Assert.assertTrue(result.contains("SERVER_ERROR")); }</code><technical_language>getUuid instead of getArtId,</technical_language>

Target:
public void testAtsProgramInsertionFeatureNegativeInsertionRestCall() throws Exception { String result = doRequestString( "/ats/program/" + getSawProgram().getUuid() + "/insertion/" + Integer.toString(-5) + "/feature", HttpMethod.GET, null, javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); Assert.assertTrue(result.contains("SERVER_ERROR")); }
Source:
<code>public IDMContext[] getFocus() { <START> return new IDMContext[] { fCurrentThreadCtx, fCurrentStackFrameCtx }; <END> }</code><technical_language>current thread is part of hierarchy of current frame. I send IDMContext, frame if exists, thread frame not</technical_language>

Target:
public IDMContext[] getFocus() { return new IDMContext[] { fCurrentGDBFocus }; }
Source:
<code>private String checkFormat(String format) throws GitLabApiException { if(format == null) <START> throw new GitLabApiException("format should not be null"); <END> if(validFormat.contains(format)) return ".".concat(format); else return ".tar.gz"; }</code><technical_language>format default "tar.gz" is null empty throw exception</technical_language>

Target:
private String checkFormat(String format) throws GitLabApiException { if(format == null || format.isEmpty()) return "tar.gz"; if(!validFormat.contains(format)) throw new GitLabApiException("Invalid format! Options are tar.gz, tar.bz2, tbz, tbz2, tb2, bz2, tar, zip."); return format; }
Source:
<code>private static boolean isMinMaxStatsSupported(PrimitiveType type) { return type != null && type.getPrimitiveTypeName() != PrimitiveTypeName.INT96 <START> && type.getOriginalType() != OriginalType.INTERVAL; <END> }</code><technical_language>I explicitly list supported logical types instead of unsupported implementing a new logical type in future accidentally gain statistics support intentional code change here</technical_language>

Target:
private static boolean isMinMaxStatsSupported(PrimitiveType type) { return type.columnOrder().getColumnOrderName() == ColumnOrderName.TYPE_DEFINED_ORDER; }
Source:
<code>private void collectFiles(boolean isRoots, List<List<?>> fileList) { for (List<?> rootDescriptor : fileList) { String fileName = (String) rootDescriptor.get(0); if (fileName.endsWith("-bootstrap.js")) { continue; } @SuppressWarnings("unchecked") List<List<?>> fileProperties = (List<List<?>>) rootDescriptor.get(1); boolean isExterns = false; boolean isGoogModule = false; List<String> provides = new ArrayList<>(); for (List<?> tuple : fileProperties) { String key = (String) tuple.get(0); if ("is_externs".equals(key) && Boolean.TRUE.equals(tuple.get(1))) { isExterns = true; break; } if ("load_flags".equals(key)) { List<List<String>> loadFlags = (List<List<String>>) tuple.get(1); if (loadFlags.contains(ImmutableList.of("module", "goog"))) { isGoogModule = true; } } if ("provides".equals(key)) { List<String> provideList = (List<String>) tuple.get(1); if (provideList.size() > 1) { provides.addAll(provideList.subList(1, provideList.size())); } } } fileName = GENERATED_FILE.matcher(fileName).replaceAll("$1"); if (isExterns && isRoots) { rootExterns.add(fileName); } else if (isExterns && !isRoots) { nonrootExterns.add(fileName); } else if (isRoots) { roots.add(fileName); } else { nonroots.add(fileName); } <START> if (!isGoogModule) { <END> knownGoogProvides.addAll(provides); } } }</code><technical_language>Name flag Set<String> consistently. module provide</technical_language>

Target:
private void collectFiles(boolean isRoots, List<List<?>> fileList) { for (List<?> rootDescriptor : fileList) { String fileName = (String) rootDescriptor.get(0); if (fileName.endsWith("-bootstrap.js")) { continue; } @SuppressWarnings("unchecked") List<List<?>> fileProperties = (List<List<?>>) rootDescriptor.get(1); boolean isExterns = false; boolean isGoogProvide = true; List<String> provides = new ArrayList<>(); for (List<?> tuple : fileProperties) { String key = (String) tuple.get(0); if ("is_externs".equals(key) && Boolean.TRUE.equals(tuple.get(1))) { isExterns = true; break; } if ("load_flags".equals(key)) { List<List<String>> loadFlags = (List<List<String>>) tuple.get(1); if (loadFlags.contains(ImmutableList.of("module", "goog"))) { isGoogProvide = false; } } if ("provides".equals(key)) { List<String> provideList = (List<String>) tuple.get(1); if (provideList.size() > 1) { provides.addAll(provideList.subList(1, provideList.size())); } } } fileName = GENERATED_FILE.matcher(fileName).replaceAll("$1"); if (isExterns && isRoots) { rootExterns.add(fileName); } else if (isExterns && !isRoots) { nonrootExterns.add(fileName); } else if (isRoots) { roots.add(fileName); } else { nonroots.add(fileName); } if (isGoogProvide) { googProvides.addAll(provides); } } }
Source:
<code>public void writeTo(OutputStream out) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; FileInputStream in = new FileInputStream(file()); float written = 0; try { int read; while ((read = in.read(buffer)) != -1 && !Thread.interrupted()) { out.write(buffer, 0, read); written += read; <START> mListener.onProgress(written / length()); <END> } } finally { in.close(); } }</code><technical_language>suggest assign of length() method loop, change loop</technical_language>

Target:
public void writeTo(OutputStream out) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; FileInputStream in = new FileInputStream(file()); float written = 0; try { int read; long length = length(); while ((read = in.read(buffer)) != -1 && !Thread.interrupted()) { out.write(buffer, 0, read); written += read; mListener.onProgress(written / length); } } finally { in.close(); } }
Source:
<code>protected ExecutionResult joinAllOf(List<CompletableFuture<ExecutionResult>> completableFutures) throws CompletionException { CompletableFuture[] stages = completableFutures.toArray(new CompletableFuture[completableFutures.size()]); CompletableFuture.allOf(stages).join(); List<Object> completedResults = new ArrayList<>(); completableFutures.forEach(future -> { ExecutionResult completedValue = future.getNow(null); <START> completedResults.add(completedValue != null ? completedValue.getData() : null); <END> }); return new ExecutionResultImpl(completedResults, null); }</code><technical_language>I changed this purpose simpler: completedValue null</technical_language>

Target:
protected ExecutionResult joinAllOf(List<CompletableFuture<ExecutionResult>> completableFutures) throws CompletionException { CompletableFuture[] stages = completableFutures.toArray(new CompletableFuture[completableFutures.size()]); CompletableFuture.allOf(stages).join(); List<Object> completedResults = new ArrayList<>(); completableFutures.forEach(future -> { ExecutionResult completedValue = future.getNow(null); Assert.assertNotNull(completedValue, "A null execution result value is not allowed"); completedResults.add(completedValue.getData()); }); return new ExecutionResultImpl(completedResults, null); }
Source:
<code>protected String normalizeSQLName(String name) { if (name != null) { <START> return name.replaceAll("ŗ", "").replaceAll("ņ", " "); <END> } else { return null; } }</code><technical_language>This drops rs collapses ns</technical_language>

Target:
protected String normalizeSQLName(String name) { if (name != null) { return name.replaceAll("\r", "").replaceAll("\n", " "); } else { return null; } }
Source:
<code>public String getAttribute(Attribute attribute) { if (attribute.startsWith("has_residence")) { <START> org.bukkit.Location loc = new org.bukkit.Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getYaw(), location.getPitch()); <END> ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc); return new Element(res != null).getAttribute(attribute.fulfill(1)); } if (attribute.startsWith("residence")) { org.bukkit.Location loc = new org.bukkit.Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getYaw(), location.getPitch()); ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc); if (res != null) { return new dResidence(res).getAttribute(attribute.fulfill(1)); } return null; } return null; }</code><technical_language>is this ^</technical_language>

Target:
public String getAttribute(Attribute attribute) { if (attribute.startsWith("has_residence")) { ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(location); return new Element(res != null).getAttribute(attribute.fulfill(1)); } if (attribute.startsWith("residence")) { ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(location); if (res != null) { return new dResidence(res).getAttribute(attribute.fulfill(1)); } return null; } return null; }
Source:
<code>public static WeightInit mapWeightInitialization(String kerasInit) { WeightInit init = WeightInit.XAVIER; if (kerasInit != null) { switch (kerasInit) { case "uniform": init = WeightInit.UNIFORM; break; case "zero": init = WeightInit.ZERO; break; case "lecun_uniform": case "normal": case "identity": case "orthogonal": case "glorot_normal": case "glorot_uniform": case "he_normal": case "he_uniform": <START> default: <END> log.warn("Unknown keras weight distribution " + init); break; } } return init; }</code><technical_language>Weight init, Keras -> DL4J mapping: glorot_normal is xavier glorot_uniform is xavier_uniform he_normal is relu he_uniform is relu_uniform Normal lecun uniform map uniform sigmoid uniform? check math</technical_language>

Target:
public static WeightInit mapWeightInitialization(String kerasInit) { WeightInit init = WeightInit.XAVIER; if (kerasInit != null) { switch (kerasInit) { case KERAS_INIT_UNIFORM: init = WeightInit.UNIFORM; break; case KERAS_INIT_ZERO: init = WeightInit.ZERO; break; case KERAS_INIT_GLOROT_NORMAL: init = WeightInit.XAVIER; break; case KERAS_INIT_GLOROT_UNIFORM: init = WeightInit.XAVIER_UNIFORM; break; case KERAS_INIT_HE_NORMAL: init = WeightInit.RELU; break; case KERAS_INIT_HE_UNIFORM: init = WeightInit.RELU_UNIFORM; break; case KERAS_INIT_LECUN_UNIFORM: case KERAS_INIT_NORMAL: case KERAS_INIT_IDENTITY: case KERAS_INIT_ORTHOGONAL: default: log.warn("Unknown keras weight distribution " + init); break; } } return init; }
Source:
<code>private static boolean isEvenlyDiversableByKnownPrimes(int previousPrime, int val) { <START> return knownPrimes.takeWhile((p) -> p < previousPrime).append(previousPrime) <END> .exists((p) -> val % p == 0); }</code><technical_language>Instead of appending previousPrime I takeWhile p <= previousPrime instead of p < previousPrime. This give result</technical_language>

Target:
private static boolean isEvenlyDiversableByKnownPrimes(int previousPrime, int val) { return knownPrimes.takeWhile(p -> p < previousPrime).append(previousPrime) .exists(p -> val % p == 0); }