auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModule == null) { return; } ITmfStateSystem ss = fModule.getStateSystem(); if (ss == null) { return; } double[] xAxis = getXAxis(start, end, nb); if (xAxis.length == 1) { return; } setXAxis(xAxis); <START> <END> for (Integer quark : fQuarks) { try { double[] steps = new double[xAxis.length]; Object prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getValue(); for (int i = 0; i < xAxis.length; i++) { Object next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getValue(); long prevValue = prev instanceof Long ? (long) prev : 0; long nextValue = next instanceof Long ? (long) next : 0; long stateValue = (prev == null) ? nextValue : nextValue - prevValue; steps[i] = (next == null) ? 0 : stateValue; prev = next; } setSeries(ss.getFullAttributePath(quark), steps); } catch (StateSystemDisposedException e) { return; } } updateDisplay(); }</code><technical_language>add quarks there? Add a todo for now</technical_language>

Target:
protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModule == null) { return; } ITmfStateSystem ss = fModule.getStateSystem(); if (ss == null) { return; } double[] xAxis = getXAxis(start, end, nb); if (xAxis.length == 1) { return; } setXAxis(xAxis); try (ScopeLog log = new ScopeLog(LOGGER, Level.FINE, "CounterChartViewer#updateData")) { for (Integer quark : fQuarks) { double[] steps = new double[xAxis.length]; Object prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getValue(); long prevValue = prev instanceof Long ? (long) prev : 0; for (int i = 0; i < xAxis.length; i++) { Object next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getValue(); long nextValue = next instanceof Long ? (long) next : 0; steps[i] = (next == null) ? 0 : nextValue - prevValue; prevValue = nextValue; } setSeries(ss.getFullAttributePath(quark), steps); } } catch (StateSystemDisposedException e) { return; } updateDisplay(); }
Source:
<code>private static SslContextFactory getSslContextFactory(ZeppelinConfiguration conf) { SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); if (StringUtils.isNoneBlank(conf.getPemKeyFile(), conf.getPemCertFile())) { <START> File pemKey = new File(conf.getPemKeyFile()); File pemCert = new File(conf.getPemCertFile()); <END> try { String password = conf.getPemKeyPassword(); sslContextFactory.setKeyStore(PEMImporter.loadKeyStore(pemCert, pemKey, password)); sslContextFactory.setKeyStoreType("JKS"); sslContextFactory.setKeyStorePassword(password); if (conf.useClientAuth() && StringUtils.isNotBlank(conf.getPemCAFile())) { File pemCA = new File(conf.getPemCAFile()); sslContextFactory.setTrustStore(PEMImporter.loadTrustStore(pemCA)); sslContextFactory.setTrustStoreType("JKS"); sslContextFactory.setTrustStorePassword(""); sslContextFactory.setNeedClientAuth(conf.useClientAuth()); } } catch (IOException | GeneralSecurityException e) { LOG.error("Failed to initailize Certificates from PEM files", e); } } else { sslContextFactory.setKeyStorePath(conf.getKeyStorePath()); sslContextFactory.setKeyStoreType(conf.getKeyStoreType()); sslContextFactory.setKeyStorePassword(conf.getKeyStorePassword()); sslContextFactory.setKeyManagerPassword(conf.getKeyManagerPassword()); if (conf.useClientAuth()) { sslContextFactory.setNeedClientAuth(conf.useClientAuth()); sslContextFactory.setTrustStorePath(conf.getTrustStorePath()); sslContextFactory.setTrustStoreType(conf.getTrustStoreType()); sslContextFactory.setTrustStorePassword(conf.getTrustStorePassword()); } } return sslContextFactory; }</code><technical_language>I explicit check for presence of files, for easier identification of errors..</technical_language>

Target:
private static SslContextFactory getSslContextFactory(ZeppelinConfiguration conf) { SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); if (StringUtils.isNoneBlank(conf.getPemKeyFile(), conf.getPemCertFile())) { setupKeystoreWithPemFiles(sslContextFactory, conf); } else { sslContextFactory.setKeyStorePath(conf.getKeyStorePath()); sslContextFactory.setKeyStoreType(conf.getKeyStoreType()); sslContextFactory.setKeyStorePassword(conf.getKeyStorePassword()); sslContextFactory.setKeyManagerPassword(conf.getKeyManagerPassword()); } if (conf.useClientAuth()) { if (StringUtils.isNotBlank(conf.getPemCAFile())) { setupTruststoreWithPemFiles(sslContextFactory, conf); } else { sslContextFactory.setNeedClientAuth(conf.useClientAuth()); sslContextFactory.setTrustStorePath(conf.getTrustStorePath()); sslContextFactory.setTrustStoreType(conf.getTrustStoreType()); sslContextFactory.setTrustStorePassword(conf.getTrustStorePassword()); } } return sslContextFactory; }
Source:
<code>public void partialCumulate() { final Object decoded = new Object(); for (int firstMessageCount = 0 ; firstMessageCount <= 1 ; ++firstMessageCount) { for (int unreadFinalBytes = 0 ; unreadFinalBytes <= 1 ; ++unreadFinalBytes) { final PartialCumulationDecoder decoder = new PartialCumulationDecoder(2) { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) { while (true) { if (in.readableBytes() < 2) <START> return; <END> in.readByte(); in.readByte(); out.add(decoded); } } }; ByteBuf in1 = Unpooled.buffer().writeZero(firstMessageCount * 2 + 1); ByteBuf in2 = Unpooled.buffer().writeZero(5 + unreadFinalBytes); EmbeddedChannel channel = new EmbeddedChannel(decoder); channel.writeInbound(in1); for (int i = 0 ; i < firstMessageCount ; ++i) { assertSame(decoded, channel.readInbound()); } assertNull(channel.readInbound()); channel.writeInbound(in2); for (int i = 0 ; i < 3 ; ++i) { assertSame(decoded, channel.readInbound()); } assertEquals(0, in1.refCnt()); assertEquals(2 + unreadFinalBytes, decoder.cumulations); if (unreadFinalBytes > 0) { assertSame(in2, decoder.cumulation); assertEquals(1, decoder.cumulation.readableBytes()); decoder.cumulation.release(); } else { assertEquals(0, in2.refCnt()); assertNull(decoder.cumulation); } } } }</code><technical_language>simplify to: while (in.readableBytes() >= 2) { .... }</technical_language>

Target:
public void partialCumulate() { final Object decoded = new Object(); for (int firstMessageCount = 0 ; firstMessageCount <= 1 ; ++firstMessageCount) { for (int unreadFinalBytes = 0 ; unreadFinalBytes <= 1 ; ++unreadFinalBytes) { final PartialCumulationDecoder decoder = new PartialCumulationDecoder(2) { @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) { while (in.readableBytes() >= 2) { in.skipBytes(2); out.add(decoded); } } }; ByteBuf in1 = Unpooled.buffer().writeZero(firstMessageCount * 2 + 1); ByteBuf in2 = Unpooled.buffer().writeZero(5 + unreadFinalBytes); EmbeddedChannel channel = new EmbeddedChannel(decoder); assertEquals(firstMessageCount > 0, channel.writeInbound(in1)); for (int i = 0 ; i < firstMessageCount ; ++i) { assertSame(decoded, channel.readInbound()); } assertNull(channel.readInbound()); assertTrue(channel.writeInbound(in2)); for (int i = 0 ; i < 3 ; ++i) { assertSame(decoded, channel.readInbound()); } assertEquals(0, in1.refCnt()); assertEquals(2 + unreadFinalBytes, decoder.cumulations); if (unreadFinalBytes > 0) { assertSame(in2, decoder.cumulation); assertEquals(1, decoder.cumulation.readableBytes()); } else { assertEquals(0, in2.refCnt()); assertNull(decoder.cumulation); } assertFalse(channel.finish()); } } }
Source:
<code>public ValidationResult validate( LayerInfo layer, boolean isNew) { if ( layer.getResource() == null ) { throw new NullPointerException( "Layer resource must not be null" ); } if (null == getResourceByName(layer.getResource().getNamespace(), layer.getResource() .getName(), ResourceInfo.class)) { throw new IllegalStateException("Found no resource named " + layer.prefixedName() + " , Layer with that name can't be added"); } LayerInfo existing = getLayerByName( layer.getName() ); if ( existing != null && !existing.getId().equals( layer.getId() ) ) { if ( existing.getResource().getNamespace().equals( layer.getResource().getNamespace() ) ) { throw new IllegalArgumentException( "Layer named '"+layer.getName()+"' already exists."); } } if ( layer.getDefaultStyle() == null ) { try { LOGGER.log(Level.INFO, "Layer " + layer.prefixedName() + " is missing the default style, assigning one automatically"); StyleInfo style = new CatalogBuilder(this).getDefaultStyle(layer.getResource()); layer.setDefaultStyle(style); } catch(IOException e) { LOGGER.log(Level.WARNING, "Layer " + layer.prefixedName() + " is missing the default style, " + "failed to associate one automatically", e); } } Set<StyleInfo> styles = layer.getStyles(); <START> if (styles != null) { <END> for (Iterator it = styles.iterator(); it.hasNext();) { StyleInfo styleInfo = (StyleInfo) it.next(); if(styleInfo == null) { it.remove(); } } } return postValidate(layer, isNew); }</code><technical_language>styles collection is a "live" one, null (there is setter, set a null value), if happens, a significant bug introduced present, fixed instead</technical_language>

Target:
public ValidationResult validate( LayerInfo layer, boolean isNew) { if ( layer.getResource() == null ) { throw new NullPointerException( "Layer resource must not be null" ); } if (null == getResourceByName(layer.getResource().getNamespace(), layer.getResource() .getName(), ResourceInfo.class)) { throw new IllegalStateException("Found no resource named " + layer.prefixedName() + " , Layer with that name can't be added"); } LayerInfo existing = getLayerByName( layer.getName() ); if ( existing != null && !existing.getId().equals( layer.getId() ) ) { if ( existing.getResource().getNamespace().equals( layer.getResource().getNamespace() ) ) { throw new IllegalArgumentException( "Layer named '"+layer.getName()+"' already exists."); } } if ( layer.getDefaultStyle() == null ) { try { LOGGER.log(Level.INFO, "Layer " + layer.prefixedName() + " is missing the default style, assigning one automatically"); StyleInfo style = new CatalogBuilder(this).getDefaultStyle(layer.getResource()); layer.setDefaultStyle(style); } catch(IOException e) { LOGGER.log(Level.WARNING, "Layer " + layer.prefixedName() + " is missing the default style, " + "failed to associate one automatically", e); } } Set<StyleInfo> styles = layer.getStyles(); for (Iterator it = styles.iterator(); it.hasNext();) { StyleInfo styleInfo = (StyleInfo) it.next(); if(styleInfo == null) { it.remove(); } } return postValidate(layer, isNew); }
Source:
<code>public static CriticalHitEvent getCriticalHit(EntityPlayer player, Entity target, boolean vanillaCritical, float damageModifier) { <START> CriticalHitEvent hitResult = new CriticalHitEvent(player, target, damageModifier); <END> MinecraftForge.EVENT_BUS.post(hitResult); if (hitResult.getResult() == Event.Result.ALLOW || (vanillaCritical && hitResult.getResult() == Event.Result.DEFAULT)) { return hitResult; } return null; }</code><technical_language>prefer mods access vanilla results</technical_language>

Target:
public static CriticalHitEvent getCriticalHit(EntityPlayer player, Entity target, boolean vanillaCritical, float damageModifier) { CriticalHitEvent hitResult = new CriticalHitEvent(player, target, damageModifier, vanillaCritical); MinecraftForge.EVENT_BUS.post(hitResult); if (hitResult.getResult() == Event.Result.ALLOW || (vanillaCritical && hitResult.getResult() == Event.Result.DEFAULT)) { return hitResult; } return null; }
Source:
<code>public void shouldAddMetricsOnAllLevels() throws Exception { builder.stream(STREAM_INPUT, Consumed.with(Serdes.Integer(), Serdes.String())) .to(STREAM_OUTPUT_1, Produced.with(Serdes.Integer(), Serdes.String())); builder.table(STREAM_OUTPUT_1, Materialized.as(Stores.inMemoryKeyValueStore(MY_STORE_IN_MEMORY)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_2); builder.table(STREAM_OUTPUT_2, Materialized.as(Stores.persistentKeyValueStore(MY_STORE_PERSISTENT_KEY_VALUE)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_3); builder.table(STREAM_OUTPUT_3, Materialized.as(Stores.lruMap(MY_STORE_LRU_MAP, 10000)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_4); startApplication(); for (final Metric metric : new ArrayList<Metric>(kafkaStreams.metrics().values())) { <START> System.out.println(metric.metricName()); <END> } checkThreadLevelMetrics(); checkTaskLevelMetrics(); checkProcessorLevelMetrics(); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_ROCKSDB_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_LRU_STATE_METRICS); checkRocksDBMetricsByTag("rocksdb-state-id"); checkCacheMetrics(); closeApplication(); checkMetricsDeregistration(); }</code><technical_language>Is this intentional</technical_language>

Target:
public void shouldAddMetricsOnAllLevels() throws Exception { builder.stream(STREAM_INPUT, Consumed.with(Serdes.Integer(), Serdes.String())) .to(STREAM_OUTPUT_1, Produced.with(Serdes.Integer(), Serdes.String())); builder.table(STREAM_OUTPUT_1, Materialized.as(Stores.inMemoryKeyValueStore(MY_STORE_IN_MEMORY)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_2); builder.table(STREAM_OUTPUT_2, Materialized.as(Stores.persistentKeyValueStore(MY_STORE_PERSISTENT_KEY_VALUE)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_3); builder.table(STREAM_OUTPUT_3, Materialized.as(Stores.lruMap(MY_STORE_LRU_MAP, 10000)).withCachingEnabled()) .toStream() .to(STREAM_OUTPUT_4); startApplication(); checkThreadLevelMetrics(); checkTaskLevelMetrics(); checkProcessorLevelMetrics(); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_ROCKSDB_STATE_METRICS); checkKeyValueStoreMetricsByGroup(STREAM_STORE_IN_MEMORY_LRU_STATE_METRICS); checkRocksDBMetricsByTag("rocksdb-state-id"); checkCacheMetrics(); closeApplication(); checkMetricsDeregistration(); }
Source:
<code>public IgniteInternalFuture<?> initStartedCaches( boolean crd, final GridDhtPartitionsExchangeFuture fut, Collection<DynamicCacheDescriptor> descs ) throws IgniteCheckedException { IgniteInternalFuture<?> res = cachesRegistry.addUnregistered(descs); <START> for (DynamicCacheDescriptor d: descs) { <END> cctx.coordinators().validateCacheConfiguration(d.cacheConfiguration()); } if (fut.context().mergeExchanges()) return res; forAllRegisteredCacheGroups(new IgniteInClosureX<CacheGroupDescriptor>() { @Override public void applyx(CacheGroupDescriptor desc) throws IgniteCheckedException { CacheGroupHolder cache = getOrCreateGroupHolder(fut.initialVersion(), desc); if (cache.affinity().lastVersion().equals(AffinityTopologyVersion.NONE)) { initAffinity(desc, cache.affinity(), fut); cctx.exchange().exchangerUpdateHeartbeat(); fut.timeBag().finishLocalStage("Affinity initialization (new cache) " + "[grp=" + desc.cacheOrGroupName() + ", crd=" + crd + "]"); } } }); return res; }</code><technical_language>oneliner for braces</technical_language>

Target:
public IgniteInternalFuture<?> initStartedCaches( boolean crd, final GridDhtPartitionsExchangeFuture fut, Collection<DynamicCacheDescriptor> descs ) throws IgniteCheckedException { IgniteInternalFuture<?> res = cachesRegistry.addUnregistered(descs); for (DynamicCacheDescriptor d: descs) cctx.coordinators().validateCacheConfiguration(d.cacheConfiguration()); if (fut.context().mergeExchanges()) return res; forAllRegisteredCacheGroups(new IgniteInClosureX<CacheGroupDescriptor>() { @Override public void applyx(CacheGroupDescriptor desc) throws IgniteCheckedException { CacheGroupHolder cache = getOrCreateGroupHolder(fut.initialVersion(), desc); if (cache.affinity().lastVersion().equals(AffinityTopologyVersion.NONE)) { initAffinity(desc, cache.affinity(), fut); cctx.exchange().exchangerUpdateHeartbeat(); fut.timeBag().finishLocalStage("Affinity initialization (new cache) " + "[grp=" + desc.cacheOrGroupName() + ", crd=" + crd + "]"); } } }); return res; }
Source:
<code>private void destroyTree(RepositoryObject rootOfTree) throws FedoraException, IOException, FcrepoOperationFailedException { deletedObjCount += 1; deletedObjIds.add(rootOfTree.getPid().getUUID()); if (rootOfTree instanceof ContentContainerObject) { ContentContainerObject container = (ContentContainerObject) rootOfTree; List<ContentObject> members = container.getMembers(); for (ContentObject member : members) { <START> deletedObjIds.add(member.getPid().getUUID()); <END> destroyTree(member); } deletedObjCount += members.size(); } Resource rootResc = rootOfTree.getResource(); Model rootModel = rootResc.getModel(); if (rootOfTree instanceof FileObject) { destroyFile((FileObject) rootOfTree, rootResc); } boolean hasLdpContains = rootModel.contains(rootResc, Ldp.contains); if (hasLdpContains) { deleteNonContentObjects(rootModel); } Model stoneModel = convertModelToTombstone(rootOfTree, rootResc); repoObjFactory.createOrTransformObject(rootOfTree.getUri(), stoneModel); rootOfTree.getPremisLog().buildEvent(Premis.Deletion) .addAuthorizingAgent(agent.getUsername()) .addEventDetail("Item deleted from repository and replaced by tombstone") .writeAndClose(); }</code><technical_language>update DestroyObjectsJobIT check for event added parent? able check right number of objects destroyed</technical_language>

Target:
private void destroyTree(RepositoryObject rootOfTree) throws FedoraException, IOException, FcrepoOperationFailedException { if (rootOfTree instanceof ContentContainerObject) { ContentContainerObject container = (ContentContainerObject) rootOfTree; List<ContentObject> members = container.getMembers(); for (ContentObject member : members) { deletedObjIds.add(member.getPid().getUUID()); destroyTree(member); } } Resource rootResc = rootOfTree.getResource(); Model rootModel = rootResc.getModel(); if (rootOfTree instanceof FileObject) { destroyFile((FileObject) rootOfTree, rootResc); } boolean hasLdpContains = rootModel.contains(rootResc, Ldp.contains); if (hasLdpContains) { deleteNonContentObjects(rootModel); } Model stoneModel = convertModelToTombstone(rootOfTree, rootResc); repoObjFactory.createOrTransformObject(rootOfTree.getUri(), stoneModel); rootOfTree.getPremisLog().buildEvent(Premis.Deletion) .addAuthorizingAgent(agent.getUsername()) .addEventDetail("Item deleted from repository and replaced by tombstone") .writeAndClose(); }
Source:
<code>private List<String> getHdfsNotebook() { List<String> hdfsNotebook = new ArrayList<String>(); Gson gson = new Gson(); String hdfsDirStatus = null; try { hdfsDirStatus = this.hdfsCmd.runCommand(this.hdfsCmd.listStatus, this.hdfsNotebookDir, null); if (hdfsDirStatus != null) { AllFileStatus allFiles = gson.fromJson(hdfsDirStatus, AllFileStatus.class); if (allFiles != null && allFiles.FileStatuses != null && allFiles.FileStatuses.FileStatus != null) { for (OneFileStatus fs : allFiles.FileStatuses.FileStatus) { if ("DIRECTORY".equals(fs.type) && fs.pathSuffix.startsWith("_") == false) { hdfsNotebook.add(fs.pathSuffix); logger.info("read a notebook from HDFS: " + fs.pathSuffix); } } } } } catch (Exception e) { <START> logger.error("Exception: ", e); <END> } return hdfsNotebook; }</code><technical_language>a bit more description</technical_language>

Target:
private List<String> getHdfsNotebook() { List<String> hdfsNotebook = new ArrayList<String>(); Gson gson = new Gson(); String hdfsDirStatus = null; try { hdfsDirStatus = this.hdfsCmd.runCommand(this.hdfsCmd.listStatus, this.hdfsNotebookDir, null); if (hdfsDirStatus != null) { AllFileStatus allFiles = gson.fromJson(hdfsDirStatus, AllFileStatus.class); if (allFiles != null && allFiles.FileStatuses != null && allFiles.FileStatuses.FileStatus != null) { for (OneFileStatus fs : allFiles.FileStatuses.FileStatus) { if ("DIRECTORY".equals(fs.type) && fs.pathSuffix.startsWith("_") == false) { hdfsNotebook.add(fs.pathSuffix); logger.info("read a notebook from HDFS: " + fs.pathSuffix); } } } } } catch (Exception e) { logger.error("exception occurred during getting notebook from hdfs : ", e); } return hdfsNotebook; }
Source:
<code>public Builder hostStatuses(final List<HostStatus> hostStatuses) { <START> this.hostStatuses = hostStatuses; <END> return this; }</code><technical_language>a defensive copy of this list, ImmutableList.copyOf()</technical_language>

Target:
public Builder hostStatuses(final List<HostStatus> hostStatuses) { this.hostStatuses = ImmutableList.copyOf(hostStatuses); return this; }
Source:
<code>private void deferredWithResolver( final CheckedConsumer<ResourceResolver> action, final boolean closesResolver) { taskRunner.scheduleWork(() -> { started.compareAndSet(0, System.currentTimeMillis()); try { withResolver(action); if (!closesResolver) { logCompletetion(); } <START> } catch (Throwable t) { <END> LOG.error("Error in error handler for action "+getName(), t); if (!closesResolver) { logError(t); } } }); if (!closesResolver) { tasksAdded.incrementAndGet(); } }</code><technical_language>is I Throwable is wrong rethrowing exception. I catch (Exception|RuntimeException) ex) a choice</technical_language>

Target:
private void deferredWithResolver( final CheckedConsumer<ResourceResolver> action, final boolean closesResolver) { taskRunner.scheduleWork(() -> { started.compareAndSet(0, System.currentTimeMillis()); try { withResolver(action); if (!closesResolver) { logCompletetion(); } } catch (Exception ex) { LOG.error("Error in error handler for action "+getName(), ex); if (!closesResolver) { logError(ex); } } catch (Throwable t) { LOG.error("Fatal uncaught error in error handler for action "+getName(), t); if (!closesResolver) { logError(new RuntimeException(t)); } throw t; } }); if (!closesResolver) { tasksAdded.incrementAndGet(); } }
Source:
<code>public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { if (mSelectedSite != null && event.error.type == AuthenticationErrorType.INVALID_TOKEN) { AuthenticationDialogUtils.showAuthErrorView(this, mSiteStore, mSelectedSite); } return; } if (mAccountStore.hasAccessToken()) { <START> if (hasMagicLinkSignupIntent()) { <END> AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_MAGIC_LINK_SUCCEEDED); Intent intent = getIntent(); ActivityLauncher.showSignupEpilogue(this, null, null, null, null, true); } else if (hasMagicLinkLoginIntent()) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_SUCCEEDED); ActivityLauncher.showLoginEpilogue(this, true, getIntent().getIntegerArrayListExtra(ARG_OLD_SITES_IDS)); } } }</code><technical_language>hasMagicLinkSignupIntent() check for extra new_user query param checking for rest of magiclink format so, include _inside_ hasMagicLinkLoginIntent() conditional more secure</technical_language>

Target:
public void onAuthenticationChanged(OnAuthenticationChanged event) { if (event.isError()) { if (mSelectedSite != null && event.error.type == AuthenticationErrorType.INVALID_TOKEN) { AuthenticationDialogUtils.showAuthErrorView(this, mSiteStore, mSelectedSite); } return; } if (mAccountStore.hasAccessToken()) { if (hasMagicLinkLoginIntent()) { if (hasMagicLinkSignupIntent()) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_MAGIC_LINK_SUCCEEDED); Intent intent = getIntent(); ActivityLauncher.showSignupEpilogue(this, null, null, null, null, true); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_SUCCEEDED); ActivityLauncher.showLoginEpilogue(this, true, getIntent().getIntegerArrayListExtra(ARG_OLD_SITES_IDS)); } } } }
Source:
<code>String toRawHeaderString() { if (!parameters.isEmpty()) { throw new UnsupportedOperationException("arbitrary parameters not supported"); } String autocryptHeaderString = AutocryptHeader.AUTOCRYPT_HEADER + ": "; autocryptHeaderString += AutocryptHeader.AUTOCRYPT_PARAM_ADDR + "=" + addr + ";"; if (isPreferEncryptMutual) { autocryptHeaderString += AutocryptHeader.AUTOCRYPT_PARAM_PREFER_ENCRYPT + "=" + AutocryptHeader.AUTOCRYPT_PREFER_ENCRYPT_MUTUAL + ";"; } autocryptHeaderString += AutocryptHeader.AUTOCRYPT_PARAM_KEY_DATA + "=" + ByteString.of(keyData).base64(); StringBuilder headerLines = new StringBuilder(); int autocryptHeaderLength = autocryptHeaderString.length(); <START> for (int i = 0; i < autocryptHeaderLength; i += HEADER_LINE_LENGTH) { <END> if (i + HEADER_LINE_LENGTH <= autocryptHeaderLength) { headerLines.append(autocryptHeaderString, i, i + HEADER_LINE_LENGTH).append("\n "); } else { headerLines.append(autocryptHeaderString, i, autocryptHeaderLength); } } return headerLines.toString(); }</code><technical_language>Header folding is allowed in places whitespace is allowed. Unfolding rid of newline, space start of line. Example: Subject: world "Hello world" unfolded, "Helloworld"</technical_language>

Target:
String toRawHeaderString() { if (!parameters.isEmpty()) { throw new UnsupportedOperationException("arbitrary parameters not supported"); } StringBuilder builder = new StringBuilder(); builder.append(AutocryptHeader.AUTOCRYPT_HEADER).append(": "); builder.append(AutocryptHeader.AUTOCRYPT_PARAM_ADDR).append('=').append(addr).append("; "); if (isPreferEncryptMutual) { builder.append(AutocryptHeader.AUTOCRYPT_PARAM_PREFER_ENCRYPT) .append('=').append(AutocryptHeader.AUTOCRYPT_PREFER_ENCRYPT_MUTUAL).append("; "); } builder.append(AutocryptHeader.AUTOCRYPT_PARAM_KEY_DATA).append("="); appendBase64KeyData(builder); return builder.toString(); }
Source:
<code>private Collection<Classifier> getClassifiers(ClassificationRequest request) { final List<Classifier> srcPortClassifiers = classifierPortList.get(request.getSrcPort()); final List<Classifier> dstPortClassifiers = classifierPortList.get(request.getDstPort()); if (srcPortClassifiers.isEmpty()) { return dstPortClassifiers; } if (dstPortClassifiers.isEmpty()) { return srcPortClassifiers; } if (Objects.equals(srcPortClassifiers, dstPortClassifiers)) { return dstPortClassifiers; } <START> final Set<Classifier> classifiers = new HashSet<>(); <END> classifiers.addAll(srcPortClassifiers); classifiers.addAll(dstPortClassifiers); final List<Classifier> sortedClassifiers = new ArrayList<>(classifiers); Collections.sort(sortedClassifiers); return sortedClassifiers; }</code><technical_language>creating a SortedSet i.e. a <LINK_0> instead of create a set a list</technical_language>

Target:
private Collection<Classifier> getClassifiers(ClassificationRequest request) { final List<Classifier> srcPortClassifiers = classifierPortList.get(request.getSrcPort()); final List<Classifier> dstPortClassifiers = classifierPortList.get(request.getDstPort()); if (srcPortClassifiers.isEmpty()) { return dstPortClassifiers; } if (dstPortClassifiers.isEmpty()) { return srcPortClassifiers; } if (Objects.equals(srcPortClassifiers, dstPortClassifiers)) { return dstPortClassifiers; } final List<Classifier> classifiers = new ArrayList<>(); classifiers.addAll(srcPortClassifiers); for (Classifier c : dstPortClassifiers) { if (!classifiers.contains(c)) { classifiers.add(c); } } Collections.sort(classifiers); return classifiers; }
Source:
<code>public static void main(String[] args) { if (args.length < 2) { System.out.println("Please specify your access key and phone number."); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0], "<LINK_0>"); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); try { System.out.println(messageBirdClient.viewPurchasedNumber(args[1])); <START> return; <END> } catch (UnauthorizedException | NotFoundException | GeneralException exception) { if (exception.getErrors() != null) { System.out.println(exception.getErrors().toString()); } exception.printStackTrace(); } }</code><technical_language>return -- needed</technical_language>

Target:
public static void main(String[] args) { if (args.length < 2) { System.out.println("Please specify your access key and phone number."); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0], "<LINK_0>"); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); try { System.out.println(messageBirdClient.viewPurchasedNumber(args[1])); } catch (UnauthorizedException | NotFoundException | GeneralException exception) { if (exception.getErrors() != null) { System.out.println(exception.getErrors().toString()); } exception.printStackTrace(); } }
Source:
<code><START> private boolean onCanGrief(final BlockState blockState) { <END> return SilverfishBlock.canContainSilverfish(blockState) && ((GrieferBridge) this.creature).bridge$canGrief(); }</code><technical_language>Fix method name prefix.</technical_language>

Target:
private boolean impl$onCanGrief(final BlockState blockState) { return SilverfishBlock.canContainSilverfish(blockState) && ((GrieferBridge) this.creature).bridge$canGrief(); }
Source:
<code>public CustomCommandLine validateAndGetActiveCommandLine(CommandLine commandLine) { LOG.debug("Custom commandlines: {}", customCommandLines); for (CustomCommandLine cli : customCommandLines) { LOG.debug("Checking custom commandline {}, isActive: {}", cli, cli.isActive(commandLine)); if (cli.isActive(commandLine)) { return cli; } } throw new IllegalStateException( "No valid command-line found. If you were targeting a Yarn cluster, please make sure to have " + <START> "hadoop in your classpath. For more information refer to the \"Deployment & Operations\" section " + <END> "of the official Apache Flink documentation "); }</code><technical_language>suggestion "Hadoop in classpath. For more information refer \"Deployment & Operations\" section " + sth aboutHADOOP_CLASSPATH here</technical_language>

Target:
public CustomCommandLine validateAndGetActiveCommandLine(CommandLine commandLine) { LOG.debug("Custom commandlines: {}", customCommandLines); for (CustomCommandLine cli : customCommandLines) { LOG.debug("Checking custom commandline {}, isActive: {}", cli, cli.isActive(commandLine)); if (cli.isActive(commandLine)) { return cli; } } throw new IllegalStateException("No valid command-line found."); }
Source:
<code>public void testSystemCatalogWALEntryFilter() throws Exception { Get tenantGet = getGet(catalogTable, TENANT_BYTES, TENANT_VIEW_NAME); Get nonTenantGet = getGet(catalogTable, DEFAULT_TENANT_BYTES, NONTENANT_VIEW_NAME); WAL.Entry nonTenantEntry = getEntry(systemCatalogTableName, nonTenantGet); WAL.Entry tenantEntry = getEntry(systemCatalogTableName, tenantGet); SystemCatalogWALEntryFilter filter = new SystemCatalogWALEntryFilter(); ChainWALEntryFilter chainWALEntryFilter = new ChainWALEntryFilter(filter); Assert.assertTrue(nonTenantEntry.getEdit().size() > 0); Assert.assertTrue("Non tenant edits for system catalog got ", chainWALEntryFilter.filter(nonTenantEntry).getEdit().isEmpty()); WAL.Entry filteredTenantEntry = chainWALEntryFilter.filter(tenantEntry); Assert.assertNotNull("Tenant view was filtered when it shouldn't be!", filteredTenantEntry); Assert.assertEquals(tenantEntry.getEdit().size(), <START> chainWALEntryFilter.filter(tenantEntry).getEdit().size()); <END> WALEdit comboEdit = new WALEdit(); comboEdit.getCells().addAll(nonTenantEntry.getEdit().getCells()); comboEdit.getCells().addAll(tenantEntry.getEdit().getCells()); WAL.Entry comboEntry = new WAL.Entry(walKey, comboEdit); Assert.assertEquals(tenantEntry.getEdit().size() + nonTenantEntry.getEdit().size() , comboEntry.getEdit().size()); Assert.assertEquals(tenantEntry.getEdit().size(), chainWALEntryFilter.filter(comboEntry).getEdit().size()); }</code><technical_language>nit: this filteredTenantEntry.getEdit().size())</technical_language>

Target:
public void testSystemCatalogWALEntryFilter() throws Exception { Get tenantGet = getGet(catalogTable, TENANT_BYTES, TENANT_VIEW_NAME); Get nonTenantGet = getGet(catalogTable, DEFAULT_TENANT_BYTES, NONTENANT_VIEW_NAME); WAL.Entry nonTenantEntry = getEntry(systemCatalogTableName, nonTenantGet); WAL.Entry tenantEntry = getEntry(systemCatalogTableName, tenantGet); SystemCatalogWALEntryFilter filter = new SystemCatalogWALEntryFilter(); ChainWALEntryFilter chainWALEntryFilter = new ChainWALEntryFilter(filter); Assert.assertTrue(nonTenantEntry.getEdit().size() > 0); Assert.assertTrue("Non tenant edits for system catalog should not get filtered", chainWALEntryFilter.filter(nonTenantEntry).getEdit().isEmpty()); WAL.Entry filteredTenantEntry = chainWALEntryFilter.filter(tenantEntry); Assert.assertNotNull("Tenant view was filtered when it shouldn't be!", filteredTenantEntry); Assert.assertEquals("filtered entry is not correct", tenantEntry.getEdit().size(), filteredTenantEntry.getEdit().size()); WALEdit comboEdit = new WALEdit(); comboEdit.getCells().addAll(nonTenantEntry.getEdit().getCells()); comboEdit.getCells().addAll(tenantEntry.getEdit().getCells()); WAL.Entry comboEntry = new WAL.Entry(walKey, comboEdit); Assert.assertEquals(tenantEntry.getEdit().size() + nonTenantEntry.getEdit().size() , comboEntry.getEdit().size()); Assert.assertEquals(tenantEntry.getEdit().size(), chainWALEntryFilter.filter(comboEntry).getEdit().size()); }
Source:
<code>private void calculateBestPlan() { cost = -1; if (filters.length == 1 || session.isForceJoinOrder()) { testPlan(filters); } else { <START> start = System.nanoTime(); <END> if (filters.length <= MAX_BRUTE_FORCE_FILTERS) { calculateBruteForceAll(); } else { calculateBruteForceSome(); random = new Random(0); calculateGenetic(); } } }</code><technical_language>rename start startNs</technical_language>

Target:
private void calculateBestPlan() { cost = -1; if (filters.length == 1 || session.isForceJoinOrder()) { testPlan(filters); } else { startNs = System.nanoTime(); if (filters.length <= MAX_BRUTE_FORCE_FILTERS) { calculateBruteForceAll(); } else { calculateBruteForceSome(); random = new Random(0); calculateGenetic(); } } }
Source:
<code>public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_USER_ATTR_VIRT); attr.setFriendlyName("userCertificates"); <START> attr.setDisplayName("User certificates"); <END> attr.setType(LinkedHashMap.class.getName()); attr.setDescription("User certificates limited to ten newest certificates."); return attr; }</code><technical_language>need change content of this method (while changing name)</technical_language>

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_USER_ATTR_VIRT); attr.setFriendlyName("userCertificatesLimited"); attr.setDisplayName("User certificates limited"); attr.setType(ArrayList.class.getName()); attr.setDescription("User certificates limited to ten newest certificates."); return attr; }
Source:
<code>protected void onOntologyClicked(OntologySummaryBean ontology) { <START> if (ontology == ontologies.getSelectedOntology()) { <END> this.editor.setValue(null); ontologies.unselectItem(); return; } else if (ontologies.getSelectedOntology() != null) { if (this.editor.isDirty()) { Window.alert(i18n.format("ontologies-page.editor-is-dirty")); return; } ontologies.unselectItem(); } ontologies.selectItem(ontology); this.editor.clear(); this.ontologyService.get(ontology.getUuid(), true, new IRpcServiceInvocationHandler<OntologyBean>() { @Override public void onReturn(OntologyBean data) { editor.setValue(data); } @Override public void onError(Throwable error) { notificationService.sendErrorNotification( i18n.format("ontologies-page.error-loading-ontology"), error); editor.clear(); } }); }</code><technical_language>Do need check for a dirty editor in this case well? I so, right</technical_language>

Target:
protected void onOntologyClicked(OntologySummaryBean ontology) { if (ontology == ontologies.getSelectedOntology()) { if (this.editor.isDirty()) { Window.alert(i18n.format("ontologies-page.editor-is-dirty")); return; } this.editor.setValue(null); ontologies.unselectItem(); return; } else if (ontologies.getSelectedOntology() != null) { if (this.editor.isDirty()) { Window.alert(i18n.format("ontologies-page.editor-is-dirty")); return; } ontologies.unselectItem(); } ontologies.selectItem(ontology); reloadOntologyEditor(ontology.getUuid()); this.uuidNewOntology = ""; }
Source:
<code>public DefaultMessagingService(HelixManager manager) { _manager = manager; _evaluator = new CriteriaEvaluator(); boolean isParticipant = false; if (manager.getInstanceType() == InstanceType.PARTICIPANT || manager.getInstanceType() == InstanceType.CONTROLLER_PARTICIPANT) { isParticipant = true; } _taskExecutor = new HelixTaskExecutor( new ParticipantStatusMonitor(isParticipant, manager.getInstanceName()), <START> new MessageQueueMonitor(manager.getClusterName(), manager.getInstanceName()), manager); <END> _asyncCallbackService = new AsyncCallbackService(); _taskExecutor.registerMessageHandlerFactory(MessageType.TASK_REPLY.name(), _asyncCallbackService); }</code><technical_language>miss some files here? MessageQueueMonitor a constructor is changed in this PR</technical_language>

Target:
public DefaultMessagingService(HelixManager manager) { _manager = manager; _evaluator = new CriteriaEvaluator(); boolean isParticipant = false; if (manager.getInstanceType() == InstanceType.PARTICIPANT || manager.getInstanceType() == InstanceType.CONTROLLER_PARTICIPANT) { isParticipant = true; } _taskExecutor = new HelixTaskExecutor( new ParticipantStatusMonitor(isParticipant, manager.getInstanceName()), new MessageQueueMonitor(manager.getClusterName(), manager.getInstanceName())); _asyncCallbackService = new AsyncCallbackService(); _taskExecutor.registerMessageHandlerFactory(MessageType.TASK_REPLY.name(), _asyncCallbackService); }
Source:
<code><START> private InterceptorMismatchException() { <END> }</code><technical_language>serialization</technical_language>

Target:
private InterceptorMismatchException() { this(null, null); }
Source:
<code>public int getSSLPort() { if (hasSSLPort()) { return sslPort.getPort(); } else { throw new IllegalStateException( <START> "No HTTP2 port exists for the Data Node " + getHostname() + ":" + plainTextPort.getPort()); <END> } }</code><technical_language>benefit get changing this</technical_language>

Target:
public int getSSLPort() { if (hasSSLPort()) { return sslPort.getPort(); } else { throw new IllegalStateException( "No HTTP2 port exists for the Data Node " + hostName + ":" + plainTextPort.getPort()); } }
Source:
<code>public void testSystemPackages() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); Map<String, String> headers = new HashMap<String, String>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); config.mkdirs(); File bundle = SystemBundleTests.createBundle(config, getName(), headers); Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { equinox.start(); BundleContext systemContext = equinox.getBundleContext(); Dictionary<String, String> testHeaders = equinox.getHeaders(); assertTrue(Constants.EXPORT_PACKAGE + " does not contain the java.* package", testHeaders.get(Constants.EXPORT_PACKAGE).contains(JAVA_LANG)); assertTrue(Constants.EXPORT_PACKAGE + " does not contain the java.* package", testHeaders.get(Constants.EXPORT_PACKAGE).contains(JAVA_UTIL)); Bundle testBundle = systemContext.installBundle(bundle.toURI().toString()); testBundle.start(); String systemPackages = testBundle.getBundleContext().getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); <START> assertTrue("System packages should include java.* packages", systemPackages.contains(JAVA_LANG)); <END> } catch (BundleException e) { fail("Failed to test System packages"); } finally { try { equinox.stop(); equinox.waitForStop(10000); } catch (Exception e) { } } }</code><technical_language>check wiring of system bundle osgi.wiring.package capabilities attribute osgi.wiring.package=java.[lang|util]. BundleWiring of equinox object: BundleWiring sysWiring = equinox.adapt(BundleWiring.class);</technical_language>

Target:
public void testSystemPackages() throws Exception { Map<Integer, Integer> packagesPerVersion = new HashMap<Integer, Integer>(); packagesPerVersion.put(7, 56); packagesPerVersion.put(8, 63); packagesPerVersion.put(9, 66); for (Entry<Integer, Integer> entry : packagesPerVersion.entrySet()) { doSystemPackages(entry.getKey(), entry.getValue()); } }
Source:
<code>public List<SinkRecord> flush() throws SQLException { if (records.isEmpty()) { log.debug("Records is empty"); return new ArrayList<>(); } log.debug("Flushing buffered records", records.size()); for (SinkRecord record : records) { try { if (isNull(record.value()) && nonNull(deleteStatementBinder)) { deleteStatementBinder.bindRecord(record); } else { updateStatementBinder.bindRecord(record); } } catch (SQLException e) { <START> throw new SendToDLQException(e, record); <END> } } Optional<Long> totalUpdateCount = executeUpdates(); long totalDeleteCount = executeDeletes(); final long expectedCount = updateRecordCount(); log.trace("{} records:{} resulting in totalUpdateCount:{} totalDeleteCount:{}", config.insertMode, records.size(), totalUpdateCount, totalDeleteCount ); if (totalUpdateCount.filter(total -> total != expectedCount).isPresent() && config.insertMode == INSERT) { throw new ConnectException(String.format( "Update count (%d) did not sum up to total number of records inserted (%d)", totalUpdateCount.get(), expectedCount )); } if (!totalUpdateCount.isPresent()) { log.info( "{} records:{} , but no count of the number of rows it affected is available", config.insertMode, records.size() ); } final List<SinkRecord> flushedRecords = records; records = new ArrayList<>(); deletesInBatch = false; return flushedRecords; }</code><technical_language>I assume, design, retry, send DLQ</technical_language>

Target:
public List<SinkRecord> flush() throws SQLException { if (records.isEmpty()) { log.debug("Records is empty"); return new ArrayList<>(); } log.debug("Flushing buffered records", records.size()); for (SinkRecord record : records) { if (isNull(record.value()) && nonNull(deleteStatementBinder)) { deleteStatementBinder.bindRecord(record); } else { updateStatementBinder.bindRecord(record); } } Optional<Long> totalUpdateCount = executeUpdates(); long totalDeleteCount = executeDeletes(); final long expectedCount = updateRecordCount(); log.trace("{} records:{} resulting in totalUpdateCount:{} totalDeleteCount:{}", config.insertMode, records.size(), totalUpdateCount, totalDeleteCount ); if (totalUpdateCount.filter(total -> total != expectedCount).isPresent() && config.insertMode == INSERT) { throw new ConnectException(String.format( "Update count (%d) did not sum up to total number of records inserted (%d)", totalUpdateCount.get(), expectedCount )); } if (!totalUpdateCount.isPresent()) { log.info( "{} records:{} , but no count of the number of rows it affected is available", config.insertMode, records.size() ); } final List<SinkRecord> flushedRecords = records; records = new ArrayList<>(); deletesInBatch = false; return flushedRecords; }
Source:
<code>protected RestClient getRestClient(boolean doesNotRequireAuth) { final SalesforceReactActivity currentActivity = (SalesforceReactActivity) getCurrentActivity(); if (currentActivity == null) { return null; } if (doesNotRequireAuth) { <START> return currentActivity.getClientManager().peekUnauthenticatedRestClient(); <END> } return currentActivity.getRestClient(); }</code><technical_language>change SalesforceReactActivity's getRestClient boolean doesNotRequireAuth expose a new method get client manager</technical_language>

Target:
protected RestClient getRestClient(boolean doesNotRequireAuth) { final SalesforceReactActivity currentActivity = (SalesforceReactActivity) getCurrentActivity(); if (currentActivity == null) { return null; } if (doesNotRequireAuth) { return SalesforceReactSDKManager.getInstance().getClientManager().peekUnauthenticatedRestClient(); } return currentActivity.getRestClient(); }
Source:
<code><START> private boolean hasReportUri(List<String> cspOptions) { <END> for (String csp : cspOptions) { String lowerCsp = csp.toLowerCase(Locale.ROOT); if (lowerCsp.contains("report-uri") || lowerCsp.contains("report-to")) { return true; } } return false; }</code><technical_language>static</technical_language>

Target:
private static boolean hasReportUri(List<String> cspOptions) { for (String csp : cspOptions) { String lowerCsp = csp.toLowerCase(Locale.ROOT); if (lowerCsp.contains("report-uri")) { return true; } } return false; }
Source:
<code>private Expression getCopyOfOppositeExpression(ASTRewrite rewrite, AST ast, final Expression operand) { if (operand instanceof ParenthesizedExpression) { return getCopyOfOppositeExpression(rewrite, ast, ((ParenthesizedExpression) operand).getExpression()); } if (operand instanceof PrefixExpression) { final PrefixExpression pe= (PrefixExpression) operand; if (ASTNodes.hasOperator(pe, PrefixExpression.Operator.NOT)) { <START> PrefixExpression otherPe= ASTNodes.as((Expression) pe.getOperand(), PrefixExpression.class); <END> if (otherPe != null && ASTNodes.hasOperator(otherPe, PrefixExpression.Operator.NOT)) { return getCopyOfOppositeExpression(rewrite, ast, otherPe.getOperand()); } return (Expression) rewrite.createCopyTarget(pe.getOperand()); } } else if (operand instanceof InfixExpression) { final InfixExpression ie= (InfixExpression) operand; final InfixExpression.Operator aReverseOp= ASTNodes.oppositeInfixOperator(ie.getOperator()); if (aReverseOp != null) { return doRewriteAST(rewrite, ast, ie, aReverseOp); } } else { final Boolean constant= ASTNodes.getBooleanLiteral(operand); if (constant != null) { return ast.newBooleanLiteral(!constant.booleanValue()); } } return null; }</code><technical_language>cast Expression this line unnecessary cast error</technical_language>

Target:
private Expression getCopyOfOppositeExpression(ASTRewrite rewrite, AST ast, final Expression operand) { if (operand instanceof ParenthesizedExpression) { return getCopyOfOppositeExpression(rewrite, ast, ((ParenthesizedExpression) operand).getExpression()); } if (operand instanceof PrefixExpression) { final PrefixExpression pe= (PrefixExpression) operand; if (ASTNodes.hasOperator(pe, PrefixExpression.Operator.NOT)) { Expression otherOperand= pe.getOperand(); PrefixExpression otherPe= ASTNodes.as(otherOperand, PrefixExpression.class); if (otherPe != null && ASTNodes.hasOperator(otherPe, PrefixExpression.Operator.NOT)) { return getCopyOfOppositeExpression(rewrite, ast, otherPe.getOperand()); } return (Expression) rewrite.createCopyTarget(otherOperand); } } else if (operand instanceof InfixExpression) { final InfixExpression ie= (InfixExpression) operand; final InfixExpression.Operator aReverseOp= ASTNodes.oppositeInfixOperator(ie.getOperator()); if (aReverseOp != null) { return doRewriteAST(rewrite, ast, ie, aReverseOp); } } else { final Boolean constant= ASTNodes.getBooleanLiteral(operand); if (constant != null) { return ast.newBooleanLiteral(!constant.booleanValue()); } } return null; }
Source:
<code>private List<Cookie> get(String domain, String path, boolean secure) { final boolean[] removeExpired = {false}; <START> List<Cookie> result = cookieJar.entrySet().parallelStream().filter(pair -> { <END> CookieKey key = pair.getKey(); StoredCookie storedCookie = pair.getValue(); boolean hasCookieExpired = hasCookieExpired(storedCookie.cookie, storedCookie.createdAt); if (hasCookieExpired && !removeExpired[0]) removeExpired[0] = true; return !hasCookieExpired && domainsMatch(key.domain, domain, storedCookie.hostOnly) && pathsMatch(key.path, path) && (secure || !storedCookie.cookie.isSecure()); }).map(v -> v.getValue().cookie).collect(Collectors.toList()); if (removeExpired[0]) removeExpired(); return result; }</code><technical_language>parallelStream</technical_language>

Target:
private List<Cookie> get(String domain, String path, boolean secure) { final boolean[] removeExpired = {false}; List<Cookie> result = cookieJar.entrySet().stream().filter(pair -> { CookieKey key = pair.getKey(); StoredCookie storedCookie = pair.getValue(); boolean hasCookieExpired = hasCookieExpired(storedCookie.cookie, storedCookie.createdAt); if (hasCookieExpired && !removeExpired[0]) removeExpired[0] = true; return !hasCookieExpired && domainsMatch(key.domain, domain, storedCookie.hostOnly) && pathsMatch(key.path, path) && (secure || !storedCookie.cookie.isSecure()); }).map(v -> v.getValue().cookie).collect(Collectors.toList()); if (removeExpired[0]) removeExpired(); return result; }