auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Set<DistributionModuleGroup> getModuleGroups() throws Exception { Set<DistributionModuleGroup> moduleGroups = new HashSet<>(); Set<DistributionModuleGroup> moduleGroupsFromSuper = super.getModuleGroups(); if (moduleGroupsFromSuper != null && !moduleGroupsFromSuper.isEmpty()) { moduleGroups.addAll(moduleGroupsFromSuper); } DynamicPluginAdapter pluginAdapter = getPluginAdapter(); String hdfsRuntimeId = pluginAdapter .getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.HDFS_MODULE_GROUP.getModuleName()); <START> String mrRuntimeId = pluginAdapter <END> .getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.MAPREDUCE_MODULE_GROUP.getModuleName()); checkRuntimeId(hdfsRuntimeId); checkRuntimeId(mrRuntimeId); if (StringUtils.isNotBlank(hdfsRuntimeId)) { moduleGroups.add(new DistributionModuleGroup(hdfsRuntimeId)); } if (StringUtils.isNotBlank(mrRuntimeId)) { moduleGroups.add(new DistributionModuleGroup(mrRuntimeId)); } return moduleGroups; }</code><technical_language>removed</technical_language>

Target:
public Set<DistributionModuleGroup> getModuleGroups() throws Exception { Set<DistributionModuleGroup> moduleGroups = new HashSet<>(); Set<DistributionModuleGroup> moduleGroupsFromSuper = super.getModuleGroups(); if (moduleGroupsFromSuper != null && !moduleGroupsFromSuper.isEmpty()) { moduleGroups.addAll(moduleGroupsFromSuper); } DynamicPluginAdapter pluginAdapter = getPluginAdapter(); String hdfsRuntimeId = pluginAdapter .getRuntimeModuleGroupIdByTemplateId(DynamicModuleGroupConstant.HDFS_MODULE_GROUP.getModuleName()); checkRuntimeId(hdfsRuntimeId); if (StringUtils.isNotBlank(hdfsRuntimeId)) { moduleGroups.add(new DistributionModuleGroup(hdfsRuntimeId)); } return moduleGroups; }
Source:
<code>synchronized void unmark() { <START> Preconditions.checkState(referenceCount >= 0, "Reference count can not go below zero!"); <END> referenceCount--; }</code><technical_language>this work; get -1</technical_language>

Target:
synchronized void unmark() { Preconditions.checkState(referenceCount > 0, "Reference count can not go below zero!"); referenceCount--; }
Source:
<code>public InputStream writeObject(final VelocityResourceKey key) throws DotStateException, DotDataException, DotSecurityException { long language = new Long(key.language); ContentletVersionInfo info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, language); <START> if (info == null && language != defualtLang && APILocator.getLanguageAPI().canDefaultContentToDefaultLanguage()) { <END> info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, defualtLang); } if (info == null || key.mode.showLive && info.getLiveInode() == null) { throw new ResourceNotFoundException("cannot find content for: " + key); } Contentlet contentlet = (key.mode.showLive) ? APILocator.getContentletAPI().find(info.getLiveInode(), APILocator.systemUser(), false) : APILocator.getContentletAPI().find(info.getWorkingInode(), APILocator.systemUser(), false); Logger.debug(this, "DotResourceLoader:\tWriting out contentlet inode = " + contentlet.getInode()); if (null == contentlet) { throw new ResourceNotFoundException("cannot find content for: " + key); } return buildVelocity(contentlet, key.mode, key.path); }</code><technical_language>is a typo defualtLang</technical_language>

Target:
public InputStream writeObject(final VelocityResourceKey key) throws DotStateException, DotDataException, DotSecurityException { long language = new Long(key.language); ContentletVersionInfo info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, language); if (info == null && language != defaultLang && APILocator.getLanguageAPI().canDefaultContentToDefaultLanguage()) { info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, defaultLang); } if (info == null || key.mode.showLive && info.getLiveInode() == null) { throw new ResourceNotFoundException("cannot find content for: " + key); } Contentlet contentlet = (key.mode.showLive) ? APILocator.getContentletAPI().find(info.getLiveInode(), APILocator.systemUser(), false) : APILocator.getContentletAPI().find(info.getWorkingInode(), APILocator.systemUser(), false); Logger.debug(this, "DotResourceLoader:\tWriting out contentlet inode = " + contentlet.getInode()); if (null == contentlet) { throw new ResourceNotFoundException("cannot find content for: " + key); } return buildVelocity(contentlet, key.mode, key.path); }
Source:
<code>public long interval() { return interval; <START> } <END></code><technical_language>ok this (and 'expiresIn' value) long, considered making new date / time types instead</technical_language>

Target:
public Duration interval() { return interval; }
Source:
<code>public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), <START> null, requestId, null); <END> } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(requestScope); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { log.error("IOException during TableExport", e); throw new TransactionException(e); } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }</code><technical_language>If this is is causing NPE, instead of passing null, create empty HashMap here</technical_language>

Target:
public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), null, requestId, Collections.emptyMap()); } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(requestScope); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { log.error("IOException during TableExport", e); throw new TransactionException(e); } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }
Source:
<code>public void close() { for (SegmentHandle fh : writeChannels.values()) { fh.close(); } <START> for (FileChannel channel : channelsToSync) { try { channel.force(true); } catch (IOException e) { log.debug("Can't force updates in the channel {}", e.getMessage()); } finally { IOUtils.closeQuietly(channel); } } <END> writeChannels = new ConcurrentHashMap<>(); channelsToSync.clear(); }</code><technical_language>channelsToSync is a subset of of writeChannels point of closing</technical_language>

Target:
public void close() { segmentSupervisor.close(); }
Source:
<code>default List<ITestNGMethod> getSkipCausedBy() { <START> return Lists.newArrayList(); <END> }</code><technical_language>unmodifiable</technical_language>

Target:
default List<ITestNGMethod> getSkipCausedBy() { return Collections.emptyList(); }
Source:
<code>public long getEstimatedSizeInBytes() { <START> long hashMemorySizeInBytes = groupByHash == null ? 0 : groupByHash.getEstimatedSize(); <END> return INSTANCE_SIZE + memorySizeInBytes + hashMemorySizeInBytes + groupedRows.sizeOf() + pageReferences.sizeOf() + emptyPageReferenceSlots.getEstimatedSizeInBytes(); }</code><technical_language>groupByHash is null</technical_language>

Target:
public long getEstimatedSizeInBytes() { return INSTANCE_SIZE + memorySizeInBytes + groupByHash.getEstimatedSize() + groupedRows.sizeOf() + pageReferences.sizeOf() + emptyPageReferenceSlots.getEstimatedSizeInBytes(); }
Source:
<code>public DefaultRefreshTokenResultFactory(Application application) { <START> <END> Assert.notNull(application, "Application argument cannot be null."); this.application = application; }</code><technical_language>remove empty line</technical_language>

Target:
public DefaultRefreshTokenResultFactory(Application application) { Assert.notNull(application, "application argument cannot be null."); this.application = application; }
Source:
<code>protected final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen) throws IOException { if (data.hasMemoryAddress()) { long memoryAddress = data.memoryAddress(); if (remoteAddress == null) { <START> return socket.writeAddress(memoryAddress, data.readerIndex(), data.writerIndex()); <END> } else { return socket.sendToAddress(memoryAddress, data.readerIndex(), data.writerIndex(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else if (data.nioBufferCount() > 1) { IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray(); array.add(data, data.readerIndex(), data.readableBytes()); int cnt = array.count(); assert cnt != 0; if (remoteAddress == null) { return socket.writevAddresses(array.memoryAddress(0), cnt); } else { return socket.sendToAddresses(array.memoryAddress(0), cnt, remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else { ByteBuffer nioData = data.internalNioBuffer(data.readerIndex(), data.readableBytes()); if (remoteAddress == null) { return socket.write(nioData, nioData.position(), nioData.limit()); } else { return socket.sendTo(nioData, nioData.position(), nioData.limit(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } }</code><technical_language>correct put assert !fastOpen here</technical_language>

Target:
protected final long doWriteOrSendBytes(ByteBuf data, InetSocketAddress remoteAddress, boolean fastOpen) throws IOException { assert !(fastOpen && remoteAddress == null) : "fastOpen requires a remote address"; if (data.hasMemoryAddress()) { long memoryAddress = data.memoryAddress(); if (remoteAddress == null) { return socket.writeAddress(memoryAddress, data.readerIndex(), data.writerIndex()); } else { return socket.sendToAddress(memoryAddress, data.readerIndex(), data.writerIndex(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else if (data.nioBufferCount() > 1) { IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray(); array.add(data, data.readerIndex(), data.readableBytes()); int cnt = array.count(); assert cnt != 0; if (remoteAddress == null) { return socket.writevAddresses(array.memoryAddress(0), cnt); } else { return socket.sendToAddresses(array.memoryAddress(0), cnt, remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } else { ByteBuffer nioData = data.internalNioBuffer(data.readerIndex(), data.readableBytes()); if (remoteAddress == null) { return socket.write(nioData, nioData.position(), nioData.limit()); } else { return socket.sendTo(nioData, nioData.position(), nioData.limit(), remoteAddress.getAddress(), remoteAddress.getPort(), fastOpen); } } }
Source:
<code><START> public LdapUser getAdUser() { <END> return adUser; }</code><technical_language>refactor this in a patch noise</technical_language>

Target:
public LdapUser getAdUser() { return ldapUser; }
Source:
<code>public static boolean isValidFirmwareUpdate(final Pair<Integer, List<SyncResponse.FileDownload>> fw_files, final Integer currentFirmwareVersion) { final Integer firmwareVersion = fw_files.getKey(); if (firmwareVersion == -1) { LOGGER.error("Failed to retrieve S3 file list."); return false; } if (firmwareVersion.equals(currentFirmwareVersion)) { <START> LOGGER.warn("Versions match: {}, current version = {}", firmwareVersion, currentFirmwareVersion); <END> return false; } return true; }</code><technical_language>need WARN here, I a relic of long days of debugging</technical_language>

Target:
public static boolean isValidFirmwareUpdate(final Pair<Integer, List<SyncResponse.FileDownload>> fw_files, final Integer currentFirmwareVersion) { final Integer firmwareVersion = fw_files.getKey(); if (firmwareVersion == -1) { LOGGER.error("Failed to retrieve S3 file list."); return false; } if (firmwareVersion.equals(currentFirmwareVersion)) { LOGGER.info("Versions match: {}, current version = {}", firmwareVersion, currentFirmwareVersion); return false; } return true; }
Source:
<code><START> public List<Partition> getPartitionsByNames(String catName, String db_name, String tbl_name, <END> List<String> part_names, boolean getColStats) throws TException { checkDbAndTableFilters(catName, db_name, tbl_name); List<Partition> parts = client.get_partitions_by_names(prependCatalogToDbName(catName, db_name, conf), tbl_name, part_names, getColStats); return deepCopyPartitions(FilterUtils.filterPartitionsIfEnabled(isClientFilterEnabled, filterHook, parts)); }</code><technical_language>@Override is missing</technical_language>

Target:
public List<Partition> getPartitionsByNames(String catName, String db_name, String tbl_name, List<String> part_names, boolean getColStats) throws TException { checkDbAndTableFilters(catName, db_name, tbl_name); GetPartitionsByNamesRequest gpbnr = new GetPartitionsByNamesRequest(prependCatalogToDbName(catName, db_name, conf), tbl_name); gpbnr.setNames(part_names); gpbnr.setGet_col_stats(getColStats); List<Partition> parts = client.get_partitions_by_names_req(gpbnr).getPartitions(); return deepCopyPartitions(FilterUtils.filterPartitionsIfEnabled(isClientFilterEnabled, filterHook, parts)); }
Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { Logger.debug(this, "Running CalendarReminderThread - " + new Date()); try { run(); } catch (Exception e) { Logger.warn(this, e.toString()); } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.warn(this, e.getMessage(), e); <START> } <END> } }</code><technical_language>Remove entire wrapper finally block</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { Logger.debug(this, "Running CalendarReminderThread - " + new Date()); try { run(); } catch (Exception e) { Logger.warn(this, e.toString()); } }
Source:
<code>public static Document parseInputStream( final InputStream instream ) throws ParserConfigurationException, SAXException, IOException { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); <START> dbf.setFeature( XMLConstants.FEATURE_SECURE_PROCESSING, true ); <END> dbf.setFeature( "<LINK_0>", true ); final DocumentBuilder db = dbf.newDocumentBuilder(); return db.parse( new InputSource( instream ) ); }</code><technical_language>configuration-editor libbase everywhere. this method in favor of ConfigurationMetaDataParser.parseInputStream libbase a public static this one. parse thingie in libbase else call</technical_language>

Target:
public static Document parseInputStream( final InputStream instream ) throws ParserConfigurationException, SAXException, IOException { final DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); final DocumentBuilder db = dbf.newDocumentBuilder(); return db.parse( new InputSource( instream ) ); }
Source:
<code>private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { if (!isShuttingDown) { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { <START> LOG.debug("Action: completed successfully.", actionName); <END> } } } catch (Throwable throwable) { LOG.error("Execution of action: failed.", actionName, throwable); doCleanUpOnTaskException(throwable); } }; }</code><technical_language>this "info". operations scheduled executor, good log completion status</technical_language>

Target:
private Runnable getScheduleableAction(String actionName, Runnable runnable) { return () -> { try { if (!isShuttingDown) { runnable.run(); if (Thread.currentThread().isInterrupted()) { LOG.warn("Action: is interrupted.", actionName); doCleanUpOnTaskException(new InterruptedException()); } else { LOG.info("Action: completed successfully.", actionName); } } } catch (Throwable throwable) { LOG.error("Execution of action: failed.", actionName, throwable); doCleanUpOnTaskException(throwable); } }; }
Source:
<code><START> private @CheckForNull Launcher getLauncher() { <END> final Executor e = Executor.currentExecutor(); final Jenkins jenkins = Jenkins.getInstance(); Computer computer = null; if (e != null) { computer = e.getOwner(); } else if (jenkins != null ) { computer = jenkins.toComputer(); } if (computer != null) { final Node node = computer.getNode(); if (node != null) { return node.createLauncher(listener); } } return null; }</code><technical_language>BTW this trick work for Workflow builds</technical_language>

Target:
private @CheckForNull Launcher getLauncher() throws IOException, InterruptedException { if (this.launcher != null) { return launcher; } Computer computer = null; if (repository != null) { computer = repository.toComputer(); } else { final Executor e = Executor.currentExecutor(); final Jenkins jenkins = Jenkins.getInstance(); if (e != null) { computer = e.getOwner(); } else if (jenkins != null) { computer = jenkins.toComputer(); } } if (computer != null) { final Node node = computer.getNode(); if (node != null) { return node.createLauncher(listener).decorateByEnv(computer.buildEnvironment(listener)); } } return null; }
Source:
<code>public void updateConfig(EntityConfigUpdateCommand command, Username currentUser) { LOGGER.info("Config update for entity request by is in queue - {}", currentUser, command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update for entity request by is being processed", currentUser); if (!command.canContinue(cachedConfigService.currentConfig())) { throw new ConfigUpdateCheckFailedException(); } cachedConfigService.writeEntityWithLock(command, currentUser); } catch (Exception e) { <START> LOGGER.info("Config update for entity failed", e); <END> } finally { LOGGER.info("Entity update for request by is completed", currentUser); } } }</code><technical_language>need throw exception</technical_language>

Target:
public void updateConfig(EntityConfigUpdateCommand command, Username currentUser) { LOGGER.info("Config update for entity request by is in queue - {}", currentUser, command); synchronized (GoConfigWriteLock.class) { try { LOGGER.info("Config update for entity request by is being processed", currentUser); if (!command.canContinue(cachedConfigService.currentConfig())) { throw new ConfigUpdateCheckFailedException(); } cachedConfigService.writeEntityWithLock(command, currentUser); } catch (Exception e) { LOGGER.error("Config update for entity failed", e); throw e; } finally { LOGGER.info("Entity update for request by is completed", currentUser); } } }
Source:
<code>private DatastreamTask getOrCreateDatastreamTask(List<DatastreamTask> reuseTasksPerDg, DatastreamGroup dg) { <START> if (reuseTasksPerDg.size() > 0) { return reuseTasksPerDg.remove(0); } return new DatastreamTaskImpl(dg.getDatastreams()); <END> }</code><technical_language>modify this be: return ((reuseTasksPerDg.size() > 0) ? reuseTasksPerDg.remove(0) : new DatastreamTaskImpl(dg.getDatastreams())); inline this is called if like</technical_language>

Target:
private DatastreamTask getOrCreateDatastreamTask(List<DatastreamTask> reuseTasksPerDg, DatastreamGroup dg) { return (!reuseTasksPerDg.isEmpty()) ? reuseTasksPerDg.remove(reuseTasksPerDg.size() - 1) : new DatastreamTaskImpl(dg.getDatastreams()); }
Source:
<code>public <E extends Throwable> void expectErrorWithMessage(Class<E> expected, String requiredMessagePart) throws Exception { <START> expectErrorWithMessage(expected, Collections.singletonList(requiredMessagePart), env.defaultTimeoutMillis(), env.defaultPollTimeoutMillis); <END> }</code><technical_language>If end introducing this new value, accessed this; gain public long defaultPollTimeoutMillis() { return defaultPollTimeoutMillis; } Similar defaultNoSignalsTimeoutMillis() a customization point people override set a want constructor;</technical_language>

Target:
public <E extends Throwable> void expectErrorWithMessage(Class<E> expected, String requiredMessagePart) throws Exception { expectErrorWithMessage(expected, Collections.singletonList(requiredMessagePart), env.defaultTimeoutMillis(), env.defaultPollTimeoutMillis()); }
Source:
<code>public void tearDown() { try { if ( !em.getTransaction().isActive() ) { em.getTransaction().begin(); <START> } <END> Family found = em.find( Family.class, family.getName() ); if ( found != null ) { em.remove( found ); } em.getTransaction().commit(); } finally { em.close(); } }</code><technical_language>Wondering if fix test a good example of done. tests worth fixing</technical_language>

Target:
public void tearDown() { try { em.getTransaction().begin(); Family found = em.find( Family.class, family.getName() ); if ( found != null ) { em.remove( found ); } em.getTransaction().commit(); } finally { em.close(); } }
Source:
<code>public void cleanup() { <START> module.close(); <END> }</code><technical_language>I get a NPE I traces downloaded. in other tests modified</technical_language>

Target:
public void cleanup() { if (module != null) { module.close(); } }
Source:
<code>protected void buildSubTree(TreeNode parentNode, Conflict conflict, Match match) { SetView<Diff> setView = Sets.intersection(Sets.newLinkedHashSet(match.getDifferences()), Sets .newHashSet(conflict.getDifferences())); for (Diff diff : setView) { if (!isParentPseudoConflictFromOtherSide(diff, parentNode.getData())) { TreeNode wrap = wrap(diff); parentNode.getChildren().add(wrap); <START> if (isContainment(diff)) { <END> final Match diffMatch = diff.getMatch().getComparison().getMatch( ((ReferenceChange)diff).getValue()); buildSubTree(wrap, conflict, diffMatch); } } } for (Match subMatch : match.getSubmatches()) { if (!isMatchOfConflictContainmentDiff(conflict, subMatch)) { buildSubTree(parentNode, conflict, subMatch); } } }</code><technical_language>ComparisonUtil.getComparison (diff).getMatch(...) instead of diff.getMatch().getComparison().getMatch(...) please</technical_language>

Target:
protected void buildSubTree(TreeNode parentNode, Conflict conflict, Match match) { SetView<Diff> setView = Sets.intersection(Sets.newLinkedHashSet(match.getDifferences()), Sets .newHashSet(conflict.getDifferences())); for (Diff diff : setView) { if (!isParentPseudoConflictFromOtherSide(diff, parentNode.getData())) { TreeNode wrap = wrap(diff); parentNode.getChildren().add(wrap); if (isContainment(diff)) { final Match diffMatch = ComparisonUtil.getComparison(diff).getMatch( ((ReferenceChange)diff).getValue()); buildSubTree(wrap, conflict, diffMatch); } } } for (Match subMatch : match.getSubmatches()) { if (!isMatchOfConflictContainmentDiff(conflict, subMatch)) { buildSubTree(parentNode, conflict, subMatch); } } }
Source:
<code>protected final SignalReactor provideSignalReactor(short signalID) { <START> SignalReactor signalReactor = null; <END> if (isActive()) { switch (signalID) { case SIGNAL_REMOTE_EXCEPTION: signalReactor = new RemoteExceptionIndication(this); break; case SIGNAL_MONITOR_CANCELED: signalReactor = new MonitorCanceledIndication(this); break; case SIGNAL_MONITOR_PROGRESS: signalReactor = new MonitorProgressIndication(this); break; case SIGNAL_SET_TIMEOUT: signalReactor = new SetTimeoutIndication(this); break; default: signalReactor = createSignalReactor(signalID); if (signalReactor == null) { throw new IllegalArgumentException("Invalid signalID " + signalID); } } } return signalReactor; }</code><technical_language>Please remove local variable add this check: if (!isActive()) return null;</technical_language>

Target:
protected final SignalReactor provideSignalReactor(short signalID) { if (!isActive()) { return null; } switch (signalID) { case SIGNAL_REMOTE_EXCEPTION: return new RemoteExceptionIndication(this); case SIGNAL_MONITOR_CANCELED: return new MonitorCanceledIndication(this); case SIGNAL_MONITOR_PROGRESS: return new MonitorProgressIndication(this); case SIGNAL_SET_TIMEOUT: return new SetTimeoutIndication(this); default: SignalReactor signal = createSignalReactor(signalID); if (signal == null) { throw new IllegalArgumentException("Invalid signalID " + signalID); } return signal; } }
Source:
<code>public void setStringValueFromFlag() throws Exception { final String certificateFileNameKey = "CertificateFileName"; ConfigKey originalAuthenticationMethod = config.getEngineConfigLogic().fetchConfigKey(certificateFileNameKey, "general"); final String certificateFileNameNewValue = "/certs/"; <START> final String version = "general"; <END> setKeyAndValidate(certificateFileNameKey, certificateFileNameNewValue, version); restoreOriginalValue(certificateFileNameKey, originalAuthenticationMethod); }</code><technical_language>remove this local var . is needed realy. In next line write "general"</technical_language>

Target:
public void setStringValueFromFlag() throws Exception { final String certificateFileNameKey = "CertificateFileName"; ConfigKey originalAuthenticationMethod = config.getEngineConfigLogic().fetchConfigKey(certificateFileNameKey, "general"); final String certificateFileNameNewValue = "/certs/"; setKeyAndValidate(certificateFileNameKey, certificateFileNameNewValue, "general"); restoreOriginalValue(certificateFileNameKey, originalAuthenticationMethod); }
Source:
<code>protected boolean considerEvent(ITmfEvent event) { if (!(event instanceof CtfTmfEvent)) { return false; } Object tid = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), LinuxTidAspect.class, event); if (!(tid <START> instanceof <END> Number)) { return false; } return true; }</code><technical_language>return tid instanceof Number;</technical_language>

Target:
protected boolean considerEvent(ITmfEvent event) { if (!(event instanceof CtfTmfEvent)) { return false; } Object tid = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), LinuxTidAspect.class, event); if (!(tid instanceof Integer)) { return false; } return true; }
Source:
<code>public FloatValue withNewChildren(NodeChildrenContainer newChildren) { if (!newChildren.isEmpty()) { throw new IllegalArgumentException("Cannot pass non-empty newChildren to Node that doesn't hold children"); } <START> return this; <END> }</code><technical_language>This finished. Is this a BUG</technical_language>

Target:
public FloatValue withNewChildren(NodeChildrenContainer newChildren) { assertNewChildrenAreEmpty(newChildren); return this; }
Source:
<code>public static void main(String[] args) throws Exception { LOGGER.info("Assembling indexing topology"); Config config = new Config(); if (args.length <= 2) { String providedIndexingPropertiesFile = ""; String providedPropertyFile = ""; if (args.length == 1) providedPropertyFile = args[0]; else if (args.length == 2) { providedPropertyFile = args[0]; providedIndexingPropertiesFile = args[1]; } IndexingTopology indexingTopology = new IndexingTopology(TOPOLOGY_PROPERTIES_FILE, providedPropertyFile, INDEXING_PROPERTIES_FILE, providedIndexingPropertiesFile); String topologyName = topologyProperties.getProperty(TopologyPropertyKeys.TOPOLOGY_NAME); String kafkaTopic = topologyName; String ecloudMcsAddress = topologyProperties.getProperty(TopologyPropertyKeys.MCS_URL); StormTopology stormTopology = indexingTopology.buildTopology(kafkaTopic, ecloudMcsAddress); <START> config.setNumWorkers(Integer.parseInt(topologyProperties.getProperty(TopologyPropertyKeys.WORKER_COUNT))); <END> config.setMaxTaskParallelism( Integer.parseInt(topologyProperties.getProperty(TopologyPropertyKeys.MAX_TASK_PARALLELISM))); LOGGER.info("Submitting indexing topology"); StormSubmitter.submitTopology(topologyName, config, stormTopology); } }</code><technical_language>Building topology configuration moved TopologyHelper (in develop)!. in mind merging</technical_language>

Target:
public static void main(String[] args) { try { LOGGER.info("Assembling indexing topology"); Config config = new Config(); if (args.length <= 2) { String providedIndexingPropertiesFile = ""; String providedPropertyFile = ""; if (args.length == 1) providedPropertyFile = args[0]; else if (args.length == 2) { providedPropertyFile = args[0]; providedIndexingPropertiesFile = args[1]; } IndexingTopology indexingTopology = new IndexingTopology(TOPOLOGY_PROPERTIES_FILE, providedPropertyFile, INDEXING_PROPERTIES_FILE, providedIndexingPropertiesFile); String topologyName = topologyProperties.getProperty(TOPOLOGY_NAME); String ecloudMcsAddress = topologyProperties.getProperty(MCS_URL); StormTopology stormTopology = indexingTopology.buildTopology(topologyName, ecloudMcsAddress); config.setNumWorkers(getAnInt(WORKER_COUNT)); config.setMaxTaskParallelism(getAnInt(MAX_TASK_PARALLELISM)); LOGGER.info("Submitting indexing topology"); StormSubmitter.submitTopology(topologyName, config, stormTopology); } } catch (Exception e) { LOGGER.error(Throwables.getStackTraceAsString(e)); } }
Source:
<code>public static void updateMaxMemorySize(VmBase vmBase, Version effectiveCompatibilityVersion) { final int maxOfMaxMemorySize = VmCommonUtils.maxMemorySizeWithHotplugInMb(vmBase.getOsId(), effectiveCompatibilityVersion); if (vmBase.getMaxMemorySizeMb() > maxOfMaxMemorySize) { vmBase.setMaxMemorySizeMb(maxOfMaxMemorySize); return; } if (vmBase.getMaxMemorySizeMb() == 0) { <START> vmBase.setMaxMemorySizeMb(VmCommonUtils.getMaxMemorySizeDefault(vmBase.getMemSizeMb())); <END> } }</code><technical_language>if 4*vmBase.getMemSizeMb() > maxOfMaxMemorySize</technical_language>

Target:
public static void updateMaxMemorySize(VmBase vmBase, Version effectiveCompatibilityVersion) { final int maxOfMaxMemorySize = VmCommonUtils.maxMemorySizeWithHotplugInMb(vmBase.getOsId(), effectiveCompatibilityVersion); if (vmBase.getMaxMemorySizeMb() > maxOfMaxMemorySize) { vmBase.setMaxMemorySizeMb(maxOfMaxMemorySize); return; } if (vmBase.getMaxMemorySizeMb() == 0) { final int maxMemorySize = Math.min( VmCommonUtils.getMaxMemorySizeDefault(vmBase.getMemSizeMb()), maxOfMaxMemorySize); vmBase.setMaxMemorySizeMb(maxMemorySize); } }
Source:
<code>private void writeGitPatchHeader(StringBuilder sb) { String template = headerFormat.getTemplate(); String[] segments = template.split("\\$\\{"); Stack<String> evaluated = new Stack<String>(); evaluated.add(segments[0]); for (int i = 1; i < segments.length; i++) { String segment = segments[i]; String value = null; int brace = segment.indexOf('}'); if (brace > 0) { String keyword = segment.substring(0, brace); keyword = keyword.toUpperCase(Locale.ROOT).replaceAll(" ", "_"); value = processKeyword(commit, DiffHeaderKeyword.valueOf(keyword)); } String trailingCharacters = segment.substring(brace + 1); if (value != null) { evaluated.add(value); evaluated.add(trailingCharacters); } else if (!evaluated.isEmpty()) evaluated.add(trailingCharacters); } <START> StringBuilder buffer = new StringBuilder(); for (String string : evaluated) buffer.append(string); sb.append(buffer); <END> }</code><technical_language>this extra builder? I missing here</technical_language>

Target:
private void writeGitPatchHeader(StringBuilder sb) { String template = headerFormat.getTemplate(); String[] segments = template.split("\\$\\{"); Stack<String> evaluated = new Stack<String>(); evaluated.add(segments[0]); for (int i = 1; i < segments.length; i++) { String segment = segments[i]; String value = null; int brace = segment.indexOf('}'); if (brace > 0) { String keyword = segment.substring(0, brace); keyword = keyword.toUpperCase(Locale.ROOT).replaceAll(" ", "_"); value = processKeyword(commit, DiffHeaderKeyword.valueOf(keyword)); } String trailingCharacters = segment.substring(brace + 1); if (value != null) { evaluated.add(value); evaluated.add(trailingCharacters); } else if (!evaluated.isEmpty()) evaluated.add(trailingCharacters); } for (String string : evaluated) { sb.append(string); } }
Source:
<code>public void storeToken(TrackingToken token, String processorName, int segment) throws UnableToClaimTokenException { RedisTokenEntry redisTokenEntry = new RedisTokenEntry(token, serializer, processorName, segment); redisTokenEntry.claim(nodeId, claimTimeout); boolean storedWithClaim = redisTokenRepository.storeTokenEntry(redisTokenEntry, redisTokenEntry.timestamp().minus(claimTimeout)); if(!storedWithClaim) { <START> throw new UnableToClaimTokenException("Unable to claim token."); <END> } }</code><technical_language>suggest expanding exception a little, currently holding token adding redisTokenEntry.getProcessorName()/redisTokenEntry.getSegment()/redisTokenEntry.getOwner()</technical_language>

Target:
public void storeToken(TrackingToken token, String processorName, int segment) throws UnableToClaimTokenException { RedisTokenEntry redisTokenEntry = new RedisTokenEntry(token, serializer, processorName, segment); redisTokenEntry.claim(nodeId, claimTimeout); RedisTokenEntry redisTokenEntryResponse = redisTokenRepository.storeTokenEntry(redisTokenEntry, redisTokenEntry.timestamp().minus(claimTimeout)); if(redisTokenEntryResponse != null) { if(!nodeId.equals(redisTokenEntryResponse.getOwner())) { throw new UnableToClaimTokenException( format("Unable to claim token '%s[%s]'. It is owned by '%s'", processorName, segment, redisTokenEntryResponse.getOwner())); } } else { throw new UnableToClaimTokenException(format("Unable to claim token '%s[%s]'.", processorName, segment)); } }
Source:
<code>public void addDownload(String download){ <START> if(!downloads.contains(download)) { <END> downloads.add(download); } }</code><technical_language>a Set<String> instead of a List<String> intention of code is clear glance</technical_language>

Target:
public void addDownload(String download) { downloads.add(download); }
Source:
<code>public FlowIdentifier backupDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); <START> List<FlowLog> flowLogs = flowLogService.findAllByResourceIdAndFinalizedIsFalseOrderByCreatedDesc(stack.getId()); if (!CollectionUtils.isEmpty(flowLogs)) { String errorMsg = String.format("Database backup cannot be performed because there is an active flow running: %s", flowLogs.stream().map(FlowLog::toString)); eventService.fireCloudbreakEvent( stack.getId(), DATALAKE_DATABASE_BACKUP, ResourceEvent.DATALAKE_DATABASE_BACKUP_COULD_NOT_START, List.of(errorMsg)); throw new BadRequestException(errorMsg); } else { <END> return flowManager.triggerDatalakeDatabaseBackup(stack.getId(), location, backupId); } }</code><technical_language>I need this flow engine reject this flow if other is running</technical_language>

Target:
public FlowIdentifier backupDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); MDCBuilder.buildMdcContext(stack); LOGGER.info("Initiating database backup flow for stack {}", stack.getId()); return flowManager.triggerDatalakeDatabaseBackup(stack.getId(), location, backupId); }
Source:
<code>public void testCollisionPolygon() { MockGame mockGame = new MockGame(); GameLoop gameLoop = mockGame.getGameLoop(); mockGame.act(); gameLoop.loadScene("collision"); mockGame.act(); SceneEngineObject scene = gameLoop.getGameView().getCurrentScene(); SceneElementEngineObject actor = (SceneElementEngineObject) scene.hit( 45, 45, true); assertTrue(actor.getSchema().getTags().contains("collisioned")); <START> assertNotSame(actor, scene.hit(10, 80, true)); <END> float xOffset = 100; actor = (SceneElementEngineObject) scene.hit(xOffset + 45, 45, true); assertTrue(actor.getSchema().getTags().contains("collisioned2")); assertEquals(actor, scene.hit(xOffset + 10, 80, true)); }</code><technical_language>fully understand this. actor is a triangle (has children?). I this, I scene.hit returning null. (10,80) is triangle</technical_language>

Target:
public void testCollisionPolygon() { MockGame mockGame = new MockGame(); GameLoop gameLoop = mockGame.getGameLoop(); mockGame.act(); gameLoop.loadScene("collision"); mockGame.act(); SceneEngineObject scene = gameLoop.getGameView().getCurrentScene(); SceneElementEngineObject actor = (SceneElementEngineObject) scene.hit( 45, 45, true); assertTrue(actor.getSchema().getTags().contains("collisioned")); assertNotSame(actor, scene.hit(10, 80, true)); assertNull(scene.hit(10, 80, true)); float xOffset = 100; actor = (SceneElementEngineObject) scene.hit(xOffset + 45, 45, true); assertTrue(actor.getSchema().getTags().contains("collisioned2")); assertEquals(actor, scene.hit(xOffset + 10, 80, true)); }
Source:
<code>public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean recycleBuffer = true; try { if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } final boolean wasEmpty; boolean firstPriorityEvent = false; synchronized (receivedBuffers) { if (isReleased.get()) { return; } wasEmpty = receivedBuffers.isEmpty(); <START> AbstractEvent priorityEvent = parsePriorityEvent(buffer); if (priorityEvent != null) { receivedBuffers.addPriorityElement(buffer); final int pos = receivedBuffers.getNumPriorityElements(); if (priorityEvent instanceof CheckpointBarrier) { final long barrierId = ((CheckpointBarrier) priorityEvent).getId(); if (!pendingCheckpointBarriers.remove(barrierId)) { numBuffersOvertaken.put(barrierId, receivedBuffers.size() - pos); } } firstPriorityEvent = pos == 1; } else { receivedBuffers.add(buffer); if (buffer.isBuffer()) { for (final long checkpointId : pendingCheckpointBarriers) { channelStateWriter.addInputData( checkpointId, channelInfo, sequenceNumber, CloseableIterator.ofElement(buffer.retainBuffer(), Buffer::recycleBuffer)); } } <END> } } recycleBuffer = false; ++expectedSequenceNumber; if (firstPriorityEvent) { notifyPriorityEvent(); } if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } } finally { if (recycleBuffer) { buffer.recycleBuffer(); } } }</code><technical_language>This method grown large</technical_language>

Target:
public void onBuffer(Buffer buffer, int sequenceNumber, int backlog) throws IOException { boolean recycleBuffer = true; try { if (expectedSequenceNumber != sequenceNumber) { onError(new BufferReorderingException(expectedSequenceNumber, sequenceNumber)); return; } final boolean wasEmpty; boolean firstPriorityEvent = false; synchronized (receivedBuffers) { if (isReleased.get()) { return; } wasEmpty = receivedBuffers.isEmpty(); if (buffer.getDataType().hasPriority()) { receivedBuffers.addPriorityElement(new SequenceBuffer(buffer, sequenceNumber)); if (channelStatePersister.checkForBarrier(buffer)) { numBuffersOvertaken = receivedBuffers.getNumUnprioritizedElements(); } firstPriorityEvent = receivedBuffers.getNumPriorityElements() == 1; } else { receivedBuffers.add(new SequenceBuffer(buffer, sequenceNumber)); channelStatePersister.maybePersist(buffer); } ++expectedSequenceNumber; } recycleBuffer = false; if (firstPriorityEvent) { notifyPriorityEvent(sequenceNumber); } if (wasEmpty) { notifyChannelNonEmpty(); } if (backlog >= 0) { onSenderBacklog(backlog); } } finally { if (recycleBuffer) { buffer.recycleBuffer(); } } }
Source:
<code>public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); CommandStack commandStack = domain.getCommandStack(); GlobalContext globalContext = new GlobalContext(session.getModelAccessor(), session.getInterpreter(), session.getSemanticResources()); if (expand) { <START> monitor.beginTask("Tree item expandion", 1); <END> CompoundCommand expandDTreeItemCmd = new CompoundCommand("Expand " + dTreeItem.getName() + " tree item"); expandDTreeItemCmd.append(new DTreeItemExpansionChangeCommand(globalContext, domain, dTreeItem, monitor, true)); if (!Platform.getPreferencesService().getBoolean(SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null)) { SiriusCommand result = new SiriusCommand(domain); result.getTasks().add(new RefreshTreeElementTask(dTreeItem)); expandDTreeItemCmd.append(result); } commandStack.execute(expandDTreeItemCmd); } else { monitor.beginTask("Tree item collabsing", 1); Command collapseDTreeItemCmd = new DTreeItemExpansionChangeCommand(globalContext, domain, dTreeItem, monitor, false); commandStack.execute(collapseDTreeItemCmd); } } finally { monitor.done(); } }</code><technical_language>Typo : expandion -> expansion</technical_language>

Target:
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); CommandStack commandStack = domain.getCommandStack(); GlobalContext globalContext = new GlobalContext(session.getModelAccessor(), session.getInterpreter(), session.getSemanticResources()); if (expand) { monitor.beginTask("Tree item expanding", 1); CompoundCommand expandDTreeItemCmd = new CompoundCommand("Expand " + dTreeItem.getName() + " tree item"); expandDTreeItemCmd.append(new DTreeItemExpansionChangeCommand(globalContext, domain, dTreeItem, monitor, true)); if (!Platform.getPreferencesService().getBoolean(SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null)) { SiriusCommand result = new SiriusCommand(domain); result.getTasks().add(new RefreshTreeElementTask(dTreeItem)); expandDTreeItemCmd.append(result); } commandStack.execute(expandDTreeItemCmd); } else { monitor.beginTask("Tree item collapsing", 1); Command collapseDTreeItemCmd = new DTreeItemExpansionChangeCommand(globalContext, domain, dTreeItem, monitor, false); commandStack.execute(collapseDTreeItemCmd); } } finally { monitor.done(); } }
Source:
<code>public String createSocketBinding() { String name = "UndertowSocketBinding_" + RandomStringUtils.randomAlphanumeric(6); try (OnlineManagementClient client = ManagementClientProvider.createOnlineManagementClient()) { client.apply(new AddSocketBinding.Builder(name) .port(ThreadLocalRandom.current().nextInt(1000, 9999)) .build()); <START> } catch (CommandFailedException e) { <END> e.getStackTrace(); } catch (IOException e) { e.printStackTrace(); } return name; }</code><technical_language>I prefer rethrow instead of continuing run test. BTW wanted printStackTrace instead of getStackTrace</technical_language>

Target:
public String createSocketBinding() throws CommandFailedException, IOException { String name = "UndertowSocketBinding_" + RandomStringUtils.randomAlphanumeric(6); try (OnlineManagementClient client = ManagementClientProvider.createOnlineManagementClient()) { client.apply(new AddSocketBinding.Builder(name) .port(ThreadLocalRandom.current().nextInt(10000, 19999)) .build()); } return name; }
Source:
<code>public final int hashCode() { <START> return HASH_CODE; <END> }</code><technical_language>overriding this</technical_language>

Target:
public final int hashCode() { int hashCode = 0; hashCode = PRIME * linesFromCursor + hashCode; hashCode = PRIME * resultSize + hashCode; hashCode = PRIME * topCount + hashCode; return hashCode; }
Source:
<code>public static String getSocketConnectString(InetSocketAddress socketAddress) { String host; InetAddress address = socketAddress.getAddress(); <START> if (address.isAnyLocalAddress() || address.isLoopbackAddress()) { <END> host = address.getCanonicalHostName(); } else { host = address.getHostName(); } return host + ":" + socketAddress.getPort(); }</code><technical_language>Do of 1. Add address.equals(InetAddress.getLocalHost()) check a local inet address match conditions above. 2. Create unresolved InetSocketAddress in getRMWebAddress canonical hostname check for null InetAddress</technical_language>

Target:
public static String getSocketConnectString(InetSocketAddress socketAddress) { String host; InetAddress address = socketAddress.getAddress(); if (address == null) { host = socketAddress.getHostString(); } else if (address.isAnyLocalAddress() || address.isLoopbackAddress()) { host = address.getCanonicalHostName(); } else { host = address.getHostName(); } return host + ":" + socketAddress.getPort(); }
Source:
<code>public ResultSet<PatchSetApproval> copyVetosToLatestPatchSet(Change change) throws OrmException, IOException { PatchSet.Id source; if (change.getNumberOfPatchSets() > 1) { source = new PatchSet.Id(change.getId(), change.getNumberOfPatchSets() - 1); } else { throw new IOException("Previous patch set could not be found"); } PatchSet.Id dest = change.currPatchSetId(); <START> ResultSet<PatchSetApproval> patchSetApprovals = db.patchSetApprovals().byPatchSet(source); <END> for (PatchSetApproval a : patchSetApprovals) { if (!ApprovalCategory.SUBMIT.equals(a.getCategoryId())) { final ApprovalType type = approvalTypes.byId(a.getCategoryId()); if (type.getCategory().isCopyMinScore() && type.isMaxNegative(a)) { db.patchSetApprovals().insert( Collections.singleton(new PatchSetApproval(dest, a))); } } } return patchSetApprovals; }</code><technical_language>A ResultSet iterated once. need convert this a List toList() List in for loop return List</technical_language>

Target:
public List<PatchSetApproval> copyVetosToLatestPatchSet(Change change) throws OrmException, IOException { PatchSet.Id source; if (change.getNumberOfPatchSets() > 1) { source = new PatchSet.Id(change.getId(), change.getNumberOfPatchSets() - 1); } else { throw new IOException("Previous patch set could not be found"); } PatchSet.Id dest = change.currPatchSetId(); ResultSet<PatchSetApproval> patchSetApprovals = db.patchSetApprovals().byPatchSet(source); for (PatchSetApproval a : patchSetApprovals) { if (!ApprovalCategory.SUBMIT.equals(a.getCategoryId())) { final ApprovalType type = approvalTypes.byId(a.getCategoryId()); if (type.getCategory().isCopyMinScore() && type.isMaxNegative(a)) { db.patchSetApprovals().insert( Collections.singleton(new PatchSetApproval(dest, a))); } } } return patchSetApprovals.toList(); }
Source:
<code>public boolean couldMatch(ScriptPath path) { <START> return (path.eventLower.startsWith("mythicmob") && (path.eventArgLowerAt(2).equals("spawns"))); <END> }</code><technical_language>stray parens Also, standard couldMatch format Denizen, this weird inline thing</technical_language>

Target:
public boolean couldMatch(ScriptPath path) { if (!path.eventLower.startsWith("mythicmob")) { return false; } if (!path.eventArgLowerAt(2).equals("spawns")) { return false; } return true; }