auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void openUrlExternal(Context context, @NonNull String url) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); try { WPActivityUtils.disableComponent(context, ReaderPostPagerActivity.class); context.startActivity(intent); AppLockManager.getInstance().setExtendedTimeout(); } catch (ActivityNotFoundException e) { ToastUtils.showToast(context, context.getString(R.string.no_default_app_available_to_open_link), ToastUtils.Duration.LONG); AppLog.e(AppLog.T.UTILS, "No default app available on the device to open the link: " + url, e); } catch (SecurityException se) { AppLog.e(AppLog.T.UTILS, "Error opening url in default browser. Url: " + url, se); List<ResolveInfo> infos = context.getPackageManager().queryIntentActivities(intent, 0); if (infos.size() == 1) { AppLog.d(AppLog.T.UTILS, "Only one url handler found so, bailing."); ToastUtils.showToast(context, context.getString(R.string.cant_open_url)); } else { Intent chooser = Intent.createChooser(intent, context.getString(R.string.error_please_choose_browser)); <START> context.startActivity(chooser); <END> } } finally { WPActivityUtils.enableComponent(context, ReaderPostPagerActivity.class); } }</code><technical_language>Niptick: re-set AppLock extended timeout here? AppLockManager.getInstance().setExtendedTimeout();</technical_language>

Target:
public static void openUrlExternal(Context context, @NonNull String url) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); try { WPActivityUtils.disableComponent(context, ReaderPostPagerActivity.class); context.startActivity(intent); AppLockManager.getInstance().setExtendedTimeout(); } catch (ActivityNotFoundException e) { ToastUtils.showToast(context, context.getString(R.string.cant_open_url), ToastUtils.Duration.LONG); AppLog.e(AppLog.T.UTILS, "No default app available on the device to open the link: " + url, e); } catch (SecurityException se) { AppLog.e(AppLog.T.UTILS, "Error opening url in default browser. Url: " + url, se); List<ResolveInfo> infos = context.getPackageManager().queryIntentActivities(intent, 0); if (infos.size() == 1) { AppLog.d(AppLog.T.UTILS, "Only one url handler found so, bailing."); ToastUtils.showToast(context, context.getString(R.string.cant_open_url)); } else { Intent chooser = Intent.createChooser(intent, context.getString(R.string.error_please_choose_browser)); context.startActivity(chooser); AppLockManager.getInstance().setExtendedTimeout(); } } finally { WPActivityUtils.enableComponent(context, ReaderPostPagerActivity.class); } }
Source:
<code>private Map<Object, String> insertDefaultValues(boolean includeLoaderEntry) { Cache<Object, String> cache0 = cache(0, cacheName); Map<Object, String> originalValues = new HashMap<>(); Object loaderKey; <START> if (cacheMode.isDistributed() || cacheMode.isReplicated() || cacheMode.isScattered()) { <END> Cache<Object, String> cache1 = cache(1, cacheName); Cache<Object, String> cache2 = cache(2, cacheName); originalValues.put(new MagicKey(cache0), "cache0"); originalValues.put(new MagicKey(cache1), "cache1"); originalValues.put(new MagicKey(cache2), "cache2"); loaderKey = new MagicKey(cache2); } else { originalValues.put(1, "value0"); originalValues.put(2, "value1"); originalValues.put(3, "value2"); loaderKey = 4; } cache0.putAll(originalValues); PersistenceManager persistenceManager = TestingUtil.extractComponent(cache0, PersistenceManager.class); DummyInMemoryStore store = persistenceManager.getStores(DummyInMemoryStore.class).iterator().next(); TestObjectStreamMarshaller sm = new TestObjectStreamMarshaller(); try { String loaderValue = "loader-value"; store.write(new MarshalledEntryImpl(loaderKey, loaderValue, null, sm)); if (includeLoaderEntry) { originalValues.put(loaderKey, loaderValue); } } finally { sm.stop(); } return originalValues; }</code><technical_language>need a cacheMode.isSharedState() encompasses types</technical_language>

Target:
private Map<Object, String> insertDefaultValues(boolean includeLoaderEntry) { Cache<Object, String> cache0 = cache(0, cacheName); Map<Object, String> originalValues = new HashMap<>(); Object loaderKey; if (cacheMode.needsStateTransfer()) { Cache<Object, String> cache1 = cache(1, cacheName); Cache<Object, String> cache2 = cache(2, cacheName); originalValues.put(new MagicKey(cache0), "cache0"); originalValues.put(new MagicKey(cache1), "cache1"); originalValues.put(new MagicKey(cache2), "cache2"); loaderKey = new MagicKey(cache2); } else { originalValues.put(1, "value0"); originalValues.put(2, "value1"); originalValues.put(3, "value2"); loaderKey = 4; } cache0.putAll(originalValues); PersistenceManager persistenceManager = TestingUtil.extractComponent(cache0, PersistenceManager.class); DummyInMemoryStore store = persistenceManager.getStores(DummyInMemoryStore.class).iterator().next(); TestObjectStreamMarshaller sm = new TestObjectStreamMarshaller(); try { String loaderValue = "loader-value"; store.write(new MarshalledEntryImpl(loaderKey, loaderValue, null, sm)); if (includeLoaderEntry) { originalValues.put(loaderKey, loaderValue); } } finally { sm.stop(); } return originalValues; }
Source:
<code>private void showNoInternetConnectionSnackbar() { snackbar = Snackbar.make(findViewById(android.R.id.content), getString(R.string.no_internet_connection_message), Snackbar.LENGTH_INDEFINITE); View sbView = snackbar.getView(); <START> TextView textView = sbView.findViewById(com.google.android.material.R.id.snackbar_text); <END> textView.setTextColor(Color.WHITE); snackbar.show(); }</code><technical_language>Hey @Abdelaty, this line more readable importing com.google.android.material.R sbView.findViewById(R.id.snackbar_text); out here</technical_language>

Target:
private void showNoInternetConnectionSnackbar() { snackbar = make(findViewById(android.R.id.content), getString(R.string.no_internet_connection_message), LENGTH_INDEFINITE); View sbView = snackbar.getView(); TextView textView = sbView.findViewById(R.id.snackbar_text); textView.setTextColor(Color.WHITE); snackbar.show(); }
Source:
<code>private Set<TopicPartition> getAssignedTopicPartitionFromTask() { return _datastreamTask.getPartitionsV2().stream().map(str -> { <START> int i = str.lastIndexOf("-"); <END> int partition = Integer.valueOf(str.substring(i + 1)); String topic = str.substring(0, i); return new TopicPartition(topic, partition); }).collect(Collectors.toSet()); }</code><technical_language>great if this logic parse partitionsV2 string is in framework in connector</technical_language>

Target:
private Set<TopicPartition> getAssignedTopicPartitionFromTask() { return _datastreamTask.getPartitionsV2().stream() .map(TopicPartitionUtil::createTopicPartition).collect(Collectors.toSet()); }
Source:
<code>protected void scheduleContainer(Container container) { if (maxOppQueueLength <= 0) { startAllocatedContainer(container); return; } if (queuedGuaranteedContainers.isEmpty() && queuedOpportunisticContainers.isEmpty() && this.utilizationManager.hasResourcesAvailable(container)) { startAllocatedContainer(container); } else { <START> LOG.info("No available resources for container to start its execution " <END> + "immediately.", container.getContainerId()); boolean isQueued = true; if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.GUARANTEED) { queuedGuaranteedContainers.put(container.getContainerId(), container); killOpportunisticContainers(container); } else { if (queuedOpportunisticContainers.size() <= maxOppQueueLength) { LOG.info("Opportunistic container will be queued at the NM.", container.getContainerId()); queuedOpportunisticContainers.put( container.getContainerId(), container); } else { isQueued = false; LOG.info("Opportunistic container will not be queued at the NM" + "since max queue length has been reached", container.getContainerId(), maxOppQueueLength); container.sendKillEvent( ContainerExitStatus.KILLED_BY_CONTAINER_SCHEDULER, "Opportunistic container queue is full."); } } if (isQueued) { try { this.context.getNMStateStore().storeContainerQueued( container.getContainerId()); } catch (IOException e) { LOG.warn("Could not store container state into store..", e); } } } }</code><technical_language>this DEBUG level</technical_language>

Target:
protected void scheduleContainer(Container container) { if (maxOppQueueLength <= 0) { startAllocatedContainer(container); return; } if (queuedGuaranteedContainers.isEmpty() && queuedOpportunisticContainers.isEmpty() && this.utilizationTracker.hasResourcesAvailable(container)) { startAllocatedContainer(container); } else { LOG.info("No available resources for container to start its execution " + "immediately.", container.getContainerId()); boolean isQueued = true; if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.GUARANTEED) { queuedGuaranteedContainers.put(container.getContainerId(), container); killOpportunisticContainers(container); } else { if (queuedOpportunisticContainers.size() <= maxOppQueueLength) { LOG.info("Opportunistic container will be queued at the NM.", container.getContainerId()); queuedOpportunisticContainers.put( container.getContainerId(), container); } else { isQueued = false; LOG.info("Opportunistic container will not be queued at the NM" + "since max queue length has been reached", container.getContainerId(), maxOppQueueLength); container.sendKillEvent( ContainerExitStatus.KILLED_BY_CONTAINER_SCHEDULER, "Opportunistic container queue is full."); } } if (isQueued) { try { this.context.getNMStateStore().storeContainerQueued( container.getContainerId()); } catch (IOException e) { LOG.warn("Could not store container [" + container.getContainerId() + "] state. The Container has been queued.", e); } } } }
Source:
<code>public void testSeekStatistics() throws IOException { describe("Testing the values of statistics from seek operations in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path seekStatPath = path(getMethodName()); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, seekStatPath); out.write(defBuffer); out.hflush(); in = abfss.openFileForRead(seekStatPath, fs.getFsStatistics()); int result = in.read(defBuffer, 0, ONE_MB); LOG.info("Result of read : {}", result); for (int i = 0; i < OPERATIONS; i++) { in.seek(0); in.seek(ONE_MB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); LOG.info("STATISTICS: {}", stats.toString()); assertEquals("Mismatch in seekOps value", 2 * OPERATIONS, stats.getSeekOperations()); assertEquals("Mismatch in backwardSeekOps value", OPERATIONS, stats.getBackwardSeekOperations()); assertEquals("Mismatch in forwardSeekOps value", OPERATIONS, stats.getForwardSeekOperations()); assertEquals("Mismatch in bytesBackwardsOnSeek value", <START> OPERATIONS * ONE_MB, stats.getNegativeBytesBackwardsOnSeek()); <END> assertEquals("Mismatch in bytesSkippedOnSeek value", 0, stats.getBytesSkippedOnSeek()); assertEquals("Mismatch in seekInBuffer value", 2 * OPERATIONS, stats.getSeekInBuffer()); in.close(); LOG.info("STATISTICS after closing: {}", stats.toString()); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }</code><technical_language>name change? this statistic mean</technical_language>

Target:
public void testSeekStatistics() throws IOException { describe("Testing the values of statistics from seek operations in " + "AbfsInputStream"); AzureBlobFileSystem fs = getFileSystem(); AzureBlobFileSystemStore abfss = fs.getAbfsStore(); Path seekStatPath = path(getMethodName()); AbfsOutputStream out = null; AbfsInputStream in = null; try { out = createAbfsOutputStreamWithFlushEnabled(fs, seekStatPath); out.write(defBuffer); out.hflush(); in = abfss.openFileForRead(seekStatPath, fs.getFsStatistics()); int result = in.read(defBuffer, 0, ONE_MB); LOG.info("Result of read : {}", result); for (int i = 0; i < OPERATIONS; i++) { in.seek(0); in.seek(ONE_MB); } AbfsInputStreamStatisticsImpl stats = (AbfsInputStreamStatisticsImpl) in.getStreamStatistics(); LOG.info("STATISTICS: {}", stats.toString()); assertEquals("Mismatch in seekOps value", 2 * OPERATIONS, stats.getSeekOperations()); assertEquals("Mismatch in backwardSeekOps value", OPERATIONS, stats.getBackwardSeekOperations()); assertEquals("Mismatch in forwardSeekOps value", OPERATIONS, stats.getForwardSeekOperations()); assertEquals("Mismatch in bytesBackwardsOnSeek value", OPERATIONS * ONE_MB, stats.getBytesBackwardsOnSeek()); assertEquals("Mismatch in bytesSkippedOnSeek value", 0, stats.getBytesSkippedOnSeek()); assertEquals("Mismatch in seekInBuffer value", 2 * OPERATIONS, stats.getSeekInBuffer()); in.close(); LOG.info("STATISTICS after closing: {}", stats.toString()); } finally { IOUtils.cleanupWithLogger(LOG, out, in); } }
Source:
<code>private @NonNull InneractiveAdSpot.RequestListener createFyberInterstitialAdListener() { return new InneractiveAdSpot.RequestListener() { @Override public void onInneractiveSuccessfulAdRequest(InneractiveAdSpot adSpot) { if (!(mInterstitialSpot.getSelectedUnitController() instanceof <START> InneractiveFullscreenUnitController)) { <END> mMediationInterstitialListener.onAdFailedToLoad(FyberMediationAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } InneractiveFullscreenUnitController controller = (InneractiveFullscreenUnitController) mInterstitialSpot .getSelectedUnitController(); InneractiveFullscreenAdEventsListener listener = createFyberInterstitialListener(); controller.setEventsListener(listener); mMediationInterstitialListener.onAdLoaded(FyberMediationAdapter.this); } @Override public void onInneractiveFailedAdRequest(InneractiveAdSpot adSpot, InneractiveErrorCode inneractiveErrorCode) { int adMobErrorCode = AdRequest.ERROR_CODE_INTERNAL_ERROR; if (inneractiveErrorCode == InneractiveErrorCode.CONNECTION_ERROR || inneractiveErrorCode == InneractiveErrorCode.CONNECTION_TIMEOUT) { adMobErrorCode = AdRequest.ERROR_CODE_NETWORK_ERROR; } else if (inneractiveErrorCode == InneractiveErrorCode.NO_FILL) { adMobErrorCode = AdRequest.ERROR_CODE_NO_FILL; } mMediationInterstitialListener.onAdFailedToLoad(FyberMediationAdapter.this, adMobErrorCode); } }; }</code><technical_language>clean well</technical_language>

Target:
private @NonNull InneractiveAdSpot.RequestListener createFyberInterstitialAdListener() { return new InneractiveAdSpot.RequestListener() { @Override public void onInneractiveSuccessfulAdRequest(InneractiveAdSpot adSpot) { if (!(mInterstitialSpot.getSelectedUnitController() instanceof InneractiveFullscreenUnitController)) { mMediationInterstitialListener.onAdFailedToLoad(FyberMediationAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); mInterstitialSpot.destroy(); } InneractiveFullscreenUnitController controller = (InneractiveFullscreenUnitController) mInterstitialSpot .getSelectedUnitController(); InneractiveFullscreenAdEventsListener listener = createFyberInterstitialListener(); controller.setEventsListener(listener); mMediationInterstitialListener.onAdLoaded(FyberMediationAdapter.this); } @Override public void onInneractiveFailedAdRequest(InneractiveAdSpot adSpot, InneractiveErrorCode inneractiveErrorCode) { int adMobErrorCode = AdRequest.ERROR_CODE_INTERNAL_ERROR; if (inneractiveErrorCode == InneractiveErrorCode.CONNECTION_ERROR || inneractiveErrorCode == InneractiveErrorCode.CONNECTION_TIMEOUT) { adMobErrorCode = AdRequest.ERROR_CODE_NETWORK_ERROR; } else if (inneractiveErrorCode == InneractiveErrorCode.NO_FILL) { adMobErrorCode = AdRequest.ERROR_CODE_NO_FILL; } mMediationInterstitialListener.onAdFailedToLoad(FyberMediationAdapter.this, adMobErrorCode); } }; }
Source:
<code>protected void assertSelectionEquals(String message, TestElement expected) { <START> ISelection selection <END> = fViewer.getStructuredSelection(); assertTrue(selection instanceof IStructuredSelection); IStructuredSelection expectedSelection = new StructuredSelection( expected); assertEquals("selectionEquals - " + message, selection, expectedSelection); }</code><technical_language>change IStructuredSelection</technical_language>

Target:
protected void assertSelectionEquals(String message, TestElement expected) { IStructuredSelection structuredSelection = fViewer.getStructuredSelection(); IStructuredSelection expectedSelection = new StructuredSelection(expected); assertEquals("selectionEquals - " + message, structuredSelection, expectedSelection); }
Source:
<code>public synchronized void dispose() { for (Entry<String, IObservableValue> entry : expressionMap.entrySet()) { entry.getValue().dispose(); } <START> super.dispose(); <END> }</code><technical_language>clear map. EMF observable holds EObject disposal prevent GC collect model if this observable is retained. For similar reasons, please set 'match' null here</technical_language>

Target:
public synchronized void dispose() { for (Entry<String, IObservableValue> entry : expressionMap.entrySet()) { entry.getValue().dispose(); } expressionMap.clear(); super.dispose(); }
Source:
<code><START> boolean canPerform(String permissionName) { <END> List<PermissionRule> access = access(permissionName); Set<ProjectRef> allows = Sets.newHashSet(); Set<ProjectRef> blocks = Sets.newHashSet(); for (PermissionRule rule : access) { if (rule.isBlock() && !rule.getForce()) { blocks.add(relevant.getRuleProps(rule)); } else { allows.add(relevant.getRuleProps(rule)); } } blocks.removeAll(allows); return blocks.isEmpty() && !allows.isEmpty(); }</code><technical_language>I this method needs modified a isChangeOwner this CHANGE_OWNER concept apply non-labels</technical_language>

Target:
boolean canPerform(String permissionName) { return canPerform(permissionName, false); }
Source:
<code>protected void configure() { <START> DynamicSet.setOf(binder(), CacheRemovalListener.class); <END> install(new FactoryModule() { @Override protected void configure() { factory(ForwardingRemovalListener.Factory.class); } }); bind(DefaultCacheFactory.class); bind(MemoryCacheFactory.class).to(DefaultCacheFactory.class); bind(PersistentCacheFactory.class).to(H2CacheFactory.class); listener().to(H2CacheFactory.class); }</code><technical_language>This declared in GerritGlobalModule</technical_language>

Target:
protected void configure() { install(new FactoryModule() { @Override protected void configure() { factory(ForwardingRemovalListener.Factory.class); } }); bind(DefaultCacheFactory.class); bind(MemoryCacheFactory.class).to(DefaultCacheFactory.class); bind(PersistentCacheFactory.class).to(H2CacheFactory.class); listener().to(H2CacheFactory.class); }
Source:
<code>public void show() { this.assets.finishLoading(); this.stage = new Stage(); Texture texture = new Texture(Gdx.files.internal("data/loading.jpeg")); TextureRegion region = new TextureRegion(texture, 0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT); Image image = new Image(region); image.setFillParent(true); this.stage.addActor(image); this.assets.load(getFileName("end.jpg"), Texture.class); this.assets.load(getFileName("sector.png"), Texture.class); this.assets.load(getFileName("ship.png"), Texture.class); this.assets.load(getFileName("raccoon.png"), Texture.class); this.assets.load(getFileName("grass.jpg"), Texture.class); this.assets.load(getFileName("field.jpg"), Texture.class); this.assets.load(getFileName("river.png"), Texture.class); <START> this.assets.load(getFileName("cannonball.png"), Texture.class); <END> this.assets.load(getFileName("cannonballCrop.png"), Texture.class); this.assets.load(getFileName("iceberg.png"), Texture.class); this.assets.load(getFileName("win.png"), Texture.class); this.assets.load(getFileName("lose.png"), Texture.class); this.assets.load(getFileName("bootje.jpg"), Texture.class); this.assets.load(getFileName("wood-floor.jpg"), Texture.class); this.assets.load(getFileName("dividingLine.png"), Texture.class); }</code><technical_language>Is cannonball neccesary, replace it</technical_language>

Target:
public void show() { this.assets.finishLoading(); this.stage = new Stage(); Texture texture = new Texture(Gdx.files.internal("data/loading.jpeg")); TextureRegion region = new TextureRegion(texture, 0, 0, TEXTURE_WIDTH, TEXTURE_HEIGHT); Image image = new Image(region); image.setFillParent(true); this.stage.addActor(image); this.assets.load(getFileName("end.jpg"), Texture.class); this.assets.load(getFileName("sector.png"), Texture.class); this.assets.load(getFileName("ship.png"), Texture.class); this.assets.load(getFileName("raccoon.png"), Texture.class); this.assets.load(getFileName("grass.jpg"), Texture.class); this.assets.load(getFileName("field.jpg"), Texture.class); this.assets.load(getFileName("river.png"), Texture.class); this.assets.load(getFileName("cannonballCrop.png"), Texture.class); this.assets.load(getFileName("iceberg.png"), Texture.class); this.assets.load(getFileName("win.png"), Texture.class); this.assets.load(getFileName("lose.png"), Texture.class); this.assets.load(getFileName("bootje.jpg"), Texture.class); this.assets.load(getFileName("wood-floor.jpg"), Texture.class); this.assets.load(getFileName("dividingLine.png"), Texture.class); }
Source:
<code>private static boolean isVerifiableClassMemberAccess(ExpressionTree tree) { return tree.is(Tree.Kind.CLASS_MEMBER_ACCESS) <START> && ((MemberAccessTree) tree).member().is(Tree.Kind.NAME_IDENTIFIER) && ((((MemberAccessTree) tree).object().is(Tree.Kind.NAMESPACE_NAME) && ((NamespaceNameTree) ((MemberAccessTree) tree).object()).fullName().equals("self")) || (((MemberAccessTree) tree).object().is(Tree.Kind.NAME_IDENTIFIER) && ((NameIdentifierTree) ((MemberAccessTree) tree).object()).text().equals("static"))); <END> }</code><technical_language>Creating intermediate variables code more readable me, for example for ((MemberAccessTree) tree).object()</technical_language>

Target:
private static boolean isVerifiableClassMemberAccess(ExpressionTree tree) { if (tree.is(Kind.CLASS_MEMBER_ACCESS) && ((MemberAccessTree) tree).member().is(Kind.NAME_IDENTIFIER)) { Tree object = ((MemberAccessTree) tree).object(); return ((object.is(Kind.NAMESPACE_NAME) && ((NamespaceNameTree) object).fullName().equals("self")) || (object.is(Kind.NAME_IDENTIFIER) && ((NameIdentifierTree) object).text().equals("static"))); } return false; }
Source:
<code>public static void registerProtoFiles(SerializationContext ctx) throws IOException { FileDescriptorSource fileDescriptorSource = new FileDescriptorSource(); fileDescriptorSource.addProtoFile(QUERY_PROTO_RES, MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES)); <START> fileDescriptorSource.addProtoFile(WrappedMessage.PROTO_FILE, MarshallerRegistration.class.getResourceAsStream(WrappedMessage.PROTO_FILE)); <END> ctx.registerProtoFiles(fileDescriptorSource); }</code><technical_language>WrappedMessage.PROTO_FILE needs prepended a "/" exception is thrown: java Caused by: java.lang.IllegalArgumentException: contents null org.infinispan.protostream.FileDescriptorSource.addProtoFile(FileDescriptorSource.java:101) org.infinispan.query.remote.client.impl.MarshallerRegistration.registerProtoFiles(MarshallerRegistration.java:45) org.infinispan.query.remote.client.impl.MarshallerRegistration.init(MarshallerRegistration.java:31) org.infinispan.query.remote.impl.ProtobufMetadataManagerImpl.<init>(ProtobufMetadataManagerImpl.java:56) org.infinispan.query.remote.impl.LifecycleManager.initProtobufMetadataManager(LifecycleManager.java:109) org.infinispan.query.remote.impl.LifecycleManager.cacheManagerStarting(LifecycleManager.java:101) org.infinispan.factories.GlobalComponentRegistry.preStart(GlobalComponentRegistry.java:267) org.infinispan.factories.AbstractComponentRegistry.start(AbstractComponentRegistry.java:312) org.infinispan.manager.DefaultCacheManager.internalStart(DefaultCacheManager.java:734) ... 27 more</technical_language>

Target:
public static void registerProtoFiles(SerializationContext ctx) throws IOException { ctx.registerProtoFiles(FileDescriptorSource.fromResources(MarshallerRegistration.class.getClassLoader(), QUERY_PROTO_RES, WrappedMessage.PROTO_FILE)); }
Source:
<code>public void testUncompressedVcf() throws Exception { <START> <END> ExecutionContext executionContext = MetaDataInstanceFactory.createStepExecution().getExecutionContext(); final String inputFilePath = "/small20.vcf.gz"; String inputFile = VcfReaderTest.class.getResource(inputFilePath).getFile(); File tempFile = JobTestUtils.createTempFile(); JobTestUtils.uncompress(inputFile, tempFile); String fileId = "5"; String studyId = "7"; String studyName = "study name"; VariantSource source = new VariantSource(tempFile.getAbsolutePath(), fileId, studyId, studyName, VariantStudy.StudyType.COLLECTION, VariantSource.Aggregation.NONE); VcfReader vcfReader = new VcfReader(source, tempFile); vcfReader.setSaveState(false); vcfReader.open(executionContext); consumeReader(inputFile, source, vcfReader); }</code><technical_language>Remove blank line</technical_language>

Target:
public void testUncompressedVcf() throws Exception { ExecutionContext executionContext = MetaDataInstanceFactory.createStepExecution().getExecutionContext(); final String inputFilePath = "/small20.vcf.gz"; String inputFile = VcfReaderTest.class.getResource(inputFilePath).getFile(); File tempFile = JobTestUtils.createTempFile(); JobTestUtils.uncompress(inputFile, tempFile); String fileId = "5"; String studyId = "7"; String studyName = "study name"; VcfHeaderReader headerReader = new VcfHeaderReader(new File(inputFile), fileId, studyId, studyName, VariantStudy.StudyType.COLLECTION, VariantSource.Aggregation.NONE); VariantSource source = headerReader.read(); VcfReader vcfReader = new VcfReader(source, tempFile); vcfReader.setSaveState(false); vcfReader.open(executionContext); consumeReader(inputFile, vcfReader); }
Source:
<code>public void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { <START> throw HttpResponses.error(404, "Promotion processes may not be build directly"); <END> }</code><technical_language>built</technical_language>

Target:
public void doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { throw HttpResponses.error(404, "Promotion processes may not be built directly"); }
Source:
<code>public String getName () { <START> return NAME; <END> }</code><technical_language>suggestion return "Worldcat Fetcher";</technical_language>

Target:
public String getName() { return "Worldcat Fetcher"; }
Source:
<code>static Option<?> getAndValidateOption(ClassLoader loader, String name) { if (!name.contains(".")) { name = "org.xnio.Options." + name; } <START> return Option.fromString(name, loader); <END> }</code><technical_language>This catch IAE throw OperationFailedException. IAE propagate handled a server fault, this is a server fault. OFE is for user mistakes. existing code (i.e. L163) of this problem. :)</technical_language>

Target:
static Option<?> getAndValidateOption(ClassLoader loader, String name) throws OperationFailedException { if (!name.contains(".")) { name = "org.xnio.Options." + name; } try { return Option.fromString(name, loader); } catch (IllegalArgumentException iae) { throw RemotingLogger.ROOT_LOGGER.invalidOption(iae.getMessage()); } }
Source:
<code><START> public void setDisplayValueFromModel() { <END> if (this instanceof IntegerWidget || this instanceof ExIntegerWidget) { setDisplayIntegerValueFromModel(); } else if (this instanceof DecimalWidget || this instanceof ExDecimalWidget) { setDisplayDecimalValueFromModel(); } else { setDisplayStringValueFromModel(); } }</code><technical_language>Yes, polymorphism is want. instanceof generally is a last-resort kind of solution. in charge of design easily avoid adding another level hierarchy</technical_language>

Target:
public void setDisplayValueFromModel() { if (this instanceof IntegerWidget || this instanceof ExIntegerWidget) { setDisplayIntegerValueFromModel(); } else if (this instanceof DecimalWidget || this instanceof ExDecimalWidget) { setDisplayDecimalValueFromModel(); } else { setDisplayStringValueFromModel(); } Selection.setSelection(answerText.getText(), answerText.getText().toString().length()); }
Source:
<code>private void adjustKVMDataForBlockSD() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> { image.setActualSizeInBytes(image.getSize()); image.setVolumeType(VolumeType.Preallocated); }); log.info("Block Storage Domains do not support Sparseness. The Importing of VM '{}' is defaulting to Preallocated.", <START> getVm().getId()); <END> } }</code><technical_language>vm name is more readable vm id (see line #552 example), other ok me</technical_language>

Target:
private void adjustKVMDataForBlockSD() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> { image.setActualSizeInBytes(image.getSize()); image.setVolumeType(VolumeType.Preallocated); }); log.info("Block Storage Domains do not support Sparseness. The Importing of VM: '{}'({}) is defaulting to Preallocated.", getVm().getId(), getVm().getName()); } }
Source:
<code>private JToggleButton getButtonUseTrackingSessionState() { if (useTrackingSessionState == null) { useTrackingSessionState = new JToggleButton(new ImageIcon( HttpPanelSender.class .getResource("/resource/icon/fugue/cookie.png"))); useTrackingSessionState.setToolTipText(Constant.messages .getString("manReq.checkBox.useSession")); ItemListener btnItemnListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent itemEvent) { int state = itemEvent.getStateChange(); if (state == ItemEvent.SELECTED) { setUseTrackingSessionState(true); } else { setUseTrackingSessionState(false); } } }; <START> useTrackingSessionState.addItemListener(btnItemnListener); <END> } return useTrackingSessionState; }</code><technical_language>a lambda: Java useTrackingSessionState.addItemListener(e -> setUseTrackingSessionState(e.getStateChange() == ItemEvent.SELECTED));</technical_language>

Target:
private JToggleButton getButtonUseTrackingSessionState() { if (useTrackingSessionState == null) { useTrackingSessionState = new JToggleButton(new ImageIcon( HttpPanelSender.class .getResource("/resource/icon/fugue/cookie.png"))); useTrackingSessionState.setToolTipText(Constant.messages .getString("manReq.checkBox.useSession")); useTrackingSessionState.addItemListener(e -> setUseTrackingSessionState(e.getStateChange() == ItemEvent.SELECTED)); } return useTrackingSessionState; }
Source:
<code>private void rebootUserspaceAndWaitForBootComplete() throws Exception { Duration timeout = Duration.ofMillis(getDevice().getIntProperty( "init.userspace_reboot.watchdog.timeoutmillis", 0)).plusMinutes(2); setProperty("test.userspace_reboot.requested", "1"); getDevice().rebootUserspaceUntilOnline(); assertWithMessage("Device did not boot withing <START> 2 minutes").that( <END> getDevice().waitForBootComplete(timeout.toMillis())).isTrue(); }</code><technical_language>nit: assertWithMessage("Device boot " + timeout + " minutes");</technical_language>

Target:
private void rebootUserspaceAndWaitForBootComplete() throws Exception { Duration timeout = Duration.ofMillis(getDevice().getIntProperty( "init.userspace_reboot.watchdog.timeoutmillis", 0)).plusMinutes(2); setProperty("test.userspace_reboot.requested", "1"); getDevice().rebootUserspaceUntilOnline(); assertWithMessage("Device did not boot within %s", timeout).that( getDevice().waitForBootComplete(timeout.toMillis())).isTrue(); }
Source:
<code>public GraphicsConsole get() { for (GraphicsConsole graphicsConsole : parent.list().getGraphicsConsole()) { if (consoleId.equals(graphicsConsole.getId())) { return graphicsConsole; } } <START> return null; <END> }</code><technical_language>Returning null generate ugly stack trace in result. Check please</technical_language>

Target:
public GraphicsConsole get() { List<String> supportedIds = new ArrayList<>(); for (GraphicsConsole graphicsConsole : parent.list().getGraphicsConsoles()) { if (consoleId.equals(graphicsConsole.getId())) { return graphicsConsole; } supportedIds.add(graphicsConsole.getId()); } Fault fault = new Fault(); fault.setReason("Unsupported console ID"); fault.setDetail("Supported console IDs are: " + StringUtils.join(supportedIds, ", ")); throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(fault).build()); }
Source:
<code>private long sendEligibleCalls(long now) { long pollTimeout = Long.MAX_VALUE; for (Iterator<Map.Entry<Node, List<Call>>> iter = callsToSend.entrySet().iterator(); iter.hasNext(); ) { Map.Entry<Node, List<Call>> entry = iter.next(); List<Call> calls = entry.getValue(); if (calls.isEmpty()) { iter.remove(); continue; } Node node = entry.getKey(); if (!client.ready(node, now)) { long nodeTimeout = client.pollDelayMs(node, now); pollTimeout = Math.min(pollTimeout, nodeTimeout); log.trace("Client is not ready to send to {}. Must delay ms", node, nodeTimeout); continue; } Call call = calls.remove(0); <START> int timeoutMs = Math.min(requestTimeoutMs, calcTimeoutMsRemainingAsInt(now, call.deadlineMs)); <END> AbstractRequest.Builder<?> requestBuilder; try { requestBuilder = call.createRequest(timeoutMs); } catch (Throwable throwable) { call.fail(now, new KafkaException(String.format( "Internal error sending %s to %s.", call.callName, node))); continue; } ClientRequest clientRequest = client.newClientRequest(node.idString(), requestBuilder, now, true); log.trace("Sending to {}. correlationId={}", requestBuilder, node, clientRequest.correlationId()); client.send(clientRequest, now); getOrCreateListValue(callsInFlight, node.idString()).add(call); correlationIdToCalls.put(clientRequest.correlationId(), call); } return pollTimeout; }</code><technical_language>In addition passing timeout createRequest, need pass in newClientRequest. some of APIs support explicit request timeout. This appears a pre-existing bug</technical_language>

Target:
private long sendEligibleCalls(long now) { long pollTimeout = Long.MAX_VALUE; for (Iterator<Map.Entry<Node, List<Call>>> iter = callsToSend.entrySet().iterator(); iter.hasNext(); ) { Map.Entry<Node, List<Call>> entry = iter.next(); List<Call> calls = entry.getValue(); if (calls.isEmpty()) { iter.remove(); continue; } Node node = entry.getKey(); if (!client.ready(node, now)) { long nodeTimeout = client.pollDelayMs(node, now); pollTimeout = Math.min(pollTimeout, nodeTimeout); log.trace("Client is not ready to send to {}. Must delay ms", node, nodeTimeout); continue; } Call call = calls.remove(0); int timeoutMs = Math.min(requestTimeoutMs, calcTimeoutMsRemainingAsInt(now, call.deadlineMs)); AbstractRequest.Builder<?> requestBuilder; try { requestBuilder = call.createRequest(timeoutMs); } catch (Throwable throwable) { call.fail(now, new KafkaException(String.format( "Internal error sending %s to %s.", call.callName, node))); continue; } ClientRequest clientRequest = client.newClientRequest(node.idString(), requestBuilder, now, true, timeoutMs, null); log.trace("Sending to {}. correlationId={}", requestBuilder, node, clientRequest.correlationId()); client.send(clientRequest, now); getOrCreateListValue(callsInFlight, node.idString()).add(call); correlationIdToCalls.put(clientRequest.correlationId(), call); } return pollTimeout; }
Source:
<code>private InetSocketAddress getNativeAddressFromPeers(AdminRow row) { InetAddress native_address = row.getInetAddress("native_address"); <START> if (native_address == null) { <END> native_address = row.getInetAddress("rpc_address"); } if (native_address == null) { return null; } int row_port = port; if (allowPortDiscovery && row.contains("native_port")) { row_port = row.getInteger("native_port"); } return addressTranslator.translate(new InetSocketAddress(native_address, row_port)); }</code><technical_language>Nit: camel case for variable names</technical_language>

Target:
private InetSocketAddress getNativeAddressFromPeers(AdminRow row) { InetAddress nativeAddress = row.getInetAddress("native_address"); if (nativeAddress == null) { nativeAddress = row.getInetAddress("rpc_address"); } if (nativeAddress == null) { return null; } int row_port = port; return addressTranslator.translate(new InetSocketAddress(nativeAddress, row_port)); }
Source:
<code>public final void setFromDecimalDegrees(final String dd) throws ParseException { if (dd == null) { throw new ParseException("Null argument for decimal degrees parsing", 0); } if (dd.length() != "+dd.ddd+ddd.ddd".length()) { throw new ParseException("Incorrect length for decimal degrees parsing", 0); } sourceString = dd; String latPart = dd.substring(0, NitfConstants.LAT_DECIMAL_DEGREES_FORMAT_LENGTH); <START> String lonPart = dd.substring(NitfConstants.LAT_DECIMAL_DEGREES_FORMAT_LENGTH); <END> try { lat = Double.parseDouble(latPart); lon = Double.parseDouble(lonPart); } catch (NumberFormatException ex) { throw new ParseException(String.format("Incorrect decimal degrees format: %s", dd), 0); } }</code><technical_language>this LON_DECIMAL_DEGREES_FORMAT_LENGTH</technical_language>

Target:
public final void setFromDecimalDegrees(final String dd) throws ParseException { if (dd == null) { throw new ParseException("Null argument for decimal degrees parsing", 0); } if (dd.length() != "+dd.ddd+ddd.ddd".length()) { throw new ParseException("Incorrect length for decimal degrees parsing", 0); } sourceString = dd; String latPart = dd.substring(0, LAT_DECIMAL_DEGREES_FORMAT_LENGTH); String lonPart = dd.substring(LAT_DECIMAL_DEGREES_FORMAT_LENGTH); try { lat = Double.parseDouble(latPart); lon = Double.parseDouble(lonPart); } catch (NumberFormatException ex) { throw new ParseException(String.format("Incorrect decimal degrees format: %s", dd), 0); } }
Source:
<code>private String convertToFlatJsonAsString(String path, String data, Iterator<JsonNode> acls) { <START> StringBuilder node = new StringBuilder(); <END> node.append("{\"path\": \""); node.append(path); node.append("\", \"data\": \""); node.append(data); node.append("\", \"acls\": ["); while(acls.hasNext()) { JsonNode aclNode = acls.next(); node.append("{\"scheme\": \""); node.append(aclNode.get("scheme").getTextValue()); node.append("\", \"id\": \""); node.append(aclNode.get("id").getTextValue()); node.append("\", \"perms\": "); node.append(aclNode.get("perms").getIntValue()); node.append("}"); if (acls.hasNext()) { node.append(", "); } } node.append("]}"); return node.toString(); }</code><technical_language>manual JSON gen? Jackson</technical_language>

Target:
private String convertToFlatJsonAsString(String path, String data, Iterator<JsonNode> acls) throws JsonProcessingException { ExportObject exportObject = new ExportObject() .setPath(path) .setData(data); List<Acl> aclList = new ArrayList<Acl>(); while (acls.hasNext()) { JsonNode aclNode = acls.next(); aclList.add(new Acl() .setScheme(aclNode.get("scheme").getTextValue()) .setId(aclNode.get("id").getTextValue()) .setPerms(aclNode.get("perms").getIntValue())); } exportObject.setAcls(aclList); return objectMapper.writeValueAsString(exportObject); }
Source:
<code>public void testCreateColumnWithDefaultExpression() throws Exception { execute("create table test (col1 text default 'foo')"); <START> ensureYellow(); <END> String expectedMapping = "{\"default\":{" + "\"dynamic\":\"strict\",\"_meta\":{}," + "\"dynamic_templates\":[{\"strings\":{\"match_mapping_type\":\"string\",\"mapping\":{\"doc_values\":true,\"store\":false,\"type\":\"keyword\"}}}]," + "\"properties\":{\"col1\":{\"type\":\"keyword\",\"position\":1,\"default_expr\":\"'foo'\"}}}}"; assertEquals(expectedMapping, getIndexMapping("test")); }</code><technical_language>suggestion ensureYellow(); needed retrieve index mapping. create table returns cluster state updated (shard initialization is async, required here)</technical_language>

Target:
public void testCreateColumnWithDefaultExpression() throws Exception { execute("create table test (col1 text default 'foo')"); String expectedMapping = "{\"default\":{" + "\"dynamic\":\"strict\",\"_meta\":{}," + "\"dynamic_templates\":[{\"strings\":{\"match_mapping_type\":\"string\",\"mapping\":{\"doc_values\":true,\"store\":false,\"type\":\"keyword\"}}}]," + "\"properties\":{\"col1\":{\"type\":\"keyword\",\"position\":1,\"default_expr\":\"'foo'\"}}}}"; assertEquals(expectedMapping, getIndexMapping("test")); }
Source:
<code>public static BundleGroupDocAdapter create(BundleGroup bundleGroup, CoreSession session, String containerPath) { DocumentModel doc = session.createDocumentModel(TYPE_NAME); String name = computeDocumentName("bg-" + bundleGroup.getId()); String targetPath = new Path(containerPath).append(name).toString(); boolean exist = false; if (session.exists(new PathRef(targetPath))) { exist = true; doc = session.getDocument(new PathRef(targetPath)); } doc.setPathInfo(containerPath, name); doc.setPropertyValue(NuxeoArtifact.TITLE_PROPERTY_PATH, bundleGroup.getName()); doc.setPropertyValue(PROP_GROUP_NAME, bundleGroup.getName()); doc.setPropertyValue(PROP_KEY, bundleGroup.getId()); <START> ArrayList<Map<String, Serializable>> files = new ArrayList<>(); <END> for (Blob blob : bundleGroup.getReadmes()) { Map<String, Serializable> item = new HashMap<>(); item.put("file", (Serializable) blob); files.add(item); } doc.setPropertyValue(PROP_READMES, files); if (exist) { doc = session.saveDocument(doc); } else { doc = session.createDocument(doc); } return new BundleGroupDocAdapter(doc); }</code><technical_language>var declare ArrayList (and avoid implementation type declaration for List)</technical_language>

Target:
public static BundleGroupDocAdapter create(BundleGroup bundleGroup, CoreSession session, String containerPath) { DocumentModel doc = session.createDocumentModel(TYPE_NAME); String name = computeDocumentName("bg-" + bundleGroup.getId()); String targetPath = new Path(containerPath).append(name).toString(); boolean exist = false; if (session.exists(new PathRef(targetPath))) { exist = true; doc = session.getDocument(new PathRef(targetPath)); } doc.setPathInfo(containerPath, name); doc.setPropertyValue(NuxeoArtifact.TITLE_PROPERTY_PATH, bundleGroup.getName()); doc.setPropertyValue(PROP_GROUP_NAME, bundleGroup.getName()); doc.setPropertyValue(PROP_KEY, bundleGroup.getId()); var files = new ArrayList<Map<String, Serializable>>(); for (Blob blob : bundleGroup.getReadmes()) { Map<String, Serializable> item = new HashMap<>(); item.put("file", (Serializable) blob); files.add(item); } doc.setPropertyValue(PROP_READMES, files); if (exist) { doc = session.saveDocument(doc); } else { doc = session.createDocument(doc); } return new BundleGroupDocAdapter(doc); }
Source:
<code>public void unsuccessfulBackupsAreNotPruned() throws CommandFailed { when( firstStrategy.doBackup( any() ) ).thenReturn( new Fallible<>( BackupStrategyOutcome.INCORRECT_STRATEGY, new RuntimeException() ) ); when( secondStrategy.doBackup( any() ) ).thenReturn( new Fallible<>( BackupStrategyOutcome.INCORRECT_STRATEGY, new RuntimeException() ) ); try { subject.performBackup( onlineBackupContext ); fail( "Both strategies failed so the command should have failed" ); } catch ( CommandFailed e ) { } verify( forceCheckpointBackupService, never() ).forceCheckpoint(); verify( forceCheckpointBackupService, never() ).forcePrune(); <START> verify( forceCheckpointBackupService, never() ).forceRotation(); <END> }</code><technical_language>Mockito.verifyZeroInteractions( forceCheckpointBackupService ) replace verifications</technical_language>

Target:
public void unsuccessfulBackupsAreNotPruned() throws CommandFailed { when( firstStrategy.doBackup( any() ) ).thenReturn( new Fallible<>( BackupStrategyOutcome.INCORRECT_STRATEGY, new RuntimeException() ) ); when( secondStrategy.doBackup( any() ) ).thenReturn( new Fallible<>( BackupStrategyOutcome.INCORRECT_STRATEGY, new RuntimeException() ) ); try { subject.performBackup( onlineBackupContext ); fail( "Both strategies failed so the command should have failed" ); } catch ( CommandFailed e ) { } fail(); }
Source:
<code>void doOnProcessorChange(List<String> processors) { List<String> currentProcessorIds = getActualProcessorIds(processors); <START> List<String> uniqueProcessorIds = currentProcessorIds.stream() <END> .distinct() .collect(Collectors.toList()); if (currentProcessorIds.size() != uniqueProcessorIds.size()) { LOG.info("Processors: has duplicates. Not generating job model.", currentProcessorIds); return; } JobModel jobModel = generateNewJobModel(currentProcessorIds); String currentJMVersion = zkUtils.getJobModelVersion(); String nextJMVersion; if (currentJMVersion == null) { nextJMVersion = "1"; } else { nextJMVersion = Integer.toString(Integer.valueOf(currentJMVersion) + 1); } LOG.info("pid=" + processorId + "Generated new Job Model. Version = " + nextJMVersion); zkUtils.publishJobModel(nextJMVersion, jobModel); barrier.create(nextJMVersion, currentProcessorIds); zkUtils.publishJobModelVersion(currentJMVersion, nextJMVersion); LOG.info("pid=" + processorId + "Published new Job Model. Version = " + nextJMVersion); }</code><technical_language>This appears verbose. simpler a HashSet here? Set<String> uniqueProcessorIds = new HashSet<>(currentProcessorIds)</technical_language>

Target:
void doOnProcessorChange(List<String> processors) { List<String> currentProcessorIds = getActualProcessorIds(processors); Set<String> uniqueProcessorIds = new HashSet<String>(currentProcessorIds); if (currentProcessorIds.size() != uniqueProcessorIds.size()) { LOG.info("Processors: has duplicates. Not generating job model.", currentProcessorIds); return; } JobModel jobModel = generateNewJobModel(currentProcessorIds); String currentJMVersion = zkUtils.getJobModelVersion(); String nextJMVersion; if (currentJMVersion == null) { nextJMVersion = "1"; } else { nextJMVersion = Integer.toString(Integer.valueOf(currentJMVersion) + 1); } LOG.info("pid=" + processorId + "Generated new Job Model. Version = " + nextJMVersion); zkUtils.publishJobModel(nextJMVersion, jobModel); barrier.create(nextJMVersion, currentProcessorIds); zkUtils.publishJobModelVersion(currentJMVersion, nextJMVersion); LOG.info("pid=" + processorId + "Published new Job Model. Version = " + nextJMVersion); }
Source:
<code>private void showSyncOptionDialogWhenLogin() { ReadingListCheckSetupStatusTask checkSetupStatusTask = new ReadingListCheckSetupStatusTask() { @Override <START> public void onFinish(@Nullable Void result) { <END> Prefs.setReadingListSyncEnabled(true); if (ReadingListDbHelper.instance().getRandomPage() != null) { ReadingListSyncBehaviorDialogs.mergeAndSyncDialog(LoginActivity.this, () -> manualSyncAndFinish()); } else { manualSyncAndFinish(); } } @Override public void onCatch(Throwable caught) { Prefs.setReadingListSyncEnabled(false); if (Prefs.isShowDialogPromptOptInSyncReadingListsEnabled()) { ReadingListSyncBehaviorDialogs.promptTurnSyncOnDialog(LoginActivity.this, getLayoutInflater(), !loginSource.equals(LoginFunnel.SOURCE_SETTING), () -> finish()); } } }; checkSetupStatusTask.execute(); }</code><technical_language>check for isDestroyed()</technical_language>

Target:
private void showSyncOptionDialogWhenLogin() { ReadingListCheckSetupStatusTask checkSetupStatusTask = new ReadingListCheckSetupStatusTask() { @Override public void onFinish(@Nullable Void result) { if (isDestroyed()) { return; } Prefs.setReadingListSyncEnabled(true); if (ReadingListDbHelper.instance().getRandomPage() != null) { ReadingListSyncBehaviorDialogs.mergeAndSyncDialog(LoginActivity.this, () -> manualSyncAndFinish()); } else { manualSyncAndFinish(); } } @Override public void onCatch(Throwable caught) { if (isDestroyed()) { return; } Prefs.setReadingListSyncEnabled(false); if (Prefs.isShowDialogPromptOptInSyncReadingListsEnabled()) { ReadingListSyncBehaviorDialogs.promptTurnSyncOnDialog(LoginActivity.this, getLayoutInflater(), !loginSource.equals(LoginFunnel.SOURCE_SETTING), () -> finish()); } } }; checkSetupStatusTask.execute(); }
Source:
<code><START> public void deleteAll() { <END> stateHolder.getState().getEventHolder().deleteAll(); }</code><technical_language>locked</technical_language>

Target:
public void deleteAll() { readWriteLock.writeLock().lock(); try { stateHolder.getState().getEventHolder().deleteAll(); } finally { readWriteLock.writeLock().unlock(); } }