auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public BasicInvocationStage visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { updateTopologyId(command); if (ctx.isOriginLocal()) { return invokeNext(ctx, command).compose(this::handleGeyKeysInGroupReturn); } else { return invokeNext(ctx, command).thenAccept((rCtx, rCommand, rv) -> { GetKeysInGroupCommand cmd = (GetKeysInGroupCommand) rCommand; final int commandTopologyId = cmd.getTopologyId(); String groupName = cmd.getGroupName(); if (groupManager.isOwner(groupName) && currentTopologyId() != commandTopologyId) { throw new OutdatedTopologyException( "Cache topology changed while the command was executing: expected " + commandTopologyId + ", got " + currentTopologyId()); } }); } }

Target:
public BasicInvocationStage visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { updateTopologyId(command); if (ctx.isOriginLocal()) { return invokeNext(ctx, command).compose(this::handleLocalGetKeysInGroupReturn); } else { return invokeNext(ctx, command).thenAccept((rCtx, rCommand, rv) -> { GetKeysInGroupCommand cmd = (GetKeysInGroupCommand) rCommand; final int commandTopologyId = cmd.getTopologyId(); String groupName = cmd.getGroupName(); if (groupManager.isOwner(groupName) && currentTopologyId() != commandTopologyId) { throw new OutdatedTopologyException( "Cache topology changed while the command was executing: expected " + commandTopologyId + ", got " + currentTopologyId()); } }); } }
Source:
private GroupAwareQueryManagerImpl(final ScheduledExecutorServiceWrapper schedulerWrapper, final QueryInfoStore planStore, final EventProcessorManager eventProcessorManager, final ConfigDagGenerator configDagGenerator, final MQTTResource mqttSharedResource, final KafkaSharedResource kafkaSharedResource, final NettySharedResource nettySharedResource, final DagGenerator dagGenerator, final GroupAllocationTableModifier groupAllocationTableModifier, final ApplicationMap applicationMap, final GroupMap groupMap, @Parameter(PeriodicCheckpointPeriod.class) final long checkpointPeriod) { this.scheduler = schedulerWrapper.getScheduler(); this.planStore = planStore; this.eventProcessorManager = eventProcessorManager; this.configDagGenerator = configDagGenerator; this.mqttSharedResource = mqttSharedResource; this.kafkaSharedResource = kafkaSharedResource; this.nettySharedResource = nettySharedResource; this.dagGenerator = dagGenerator; this.groupAllocationTableModifier = groupAllocationTableModifier; this.applicationMap = applicationMap; this.groupMap = groupMap; this.checkpointPeriod = checkpointPeriod; if (checkpointPeriod == 0) { LOG.log(Level.INFO, "checkpointing is not turned on"); } }

Target:
private GroupAwareQueryManagerImpl(final ScheduledExecutorServiceWrapper schedulerWrapper, final QueryInfoStore planStore, final EventProcessorManager eventProcessorManager, final ConfigDagGenerator configDagGenerator, final MQTTResource mqttSharedResource, final KafkaSharedResource kafkaSharedResource, final NettySharedResource nettySharedResource, final DagGenerator dagGenerator, final GroupAllocationTableModifier groupAllocationTableModifier, final ApplicationMap applicationMap, final GroupMap groupMap, @Parameter(PeriodicCheckpointPeriod.class) final long checkpointPeriod) { this.scheduler = schedulerWrapper.getScheduler(); this.planStore = planStore; this.eventProcessorManager = eventProcessorManager; this.configDagGenerator = configDagGenerator; this.mqttSharedResource = mqttSharedResource; this.kafkaSharedResource = kafkaSharedResource; this.nettySharedResource = nettySharedResource; this.dagGenerator = dagGenerator; this.groupAllocationTableModifier = groupAllocationTableModifier; this.applicationMap = applicationMap; this.groupMap = groupMap; this.checkpointPeriod = checkpointPeriod; }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (Guid.isNullOrEmpty(getParameters().getHookId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED); return false; } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (Guid.isNullOrEmpty(getParameters().getHookId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED); return false; } List <VDS> servers = getAllUpServers(getParameters().getClusterId()); if (servers == null || servers.size() == 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_UP_SERVER_FOUND); return false; } return true; }
Source:
public void setConf(final Configuration conf) { if (conf == null) { return; } final Lock readLock = configUpdateLock.readLock(); final Lock writeLock = configUpdateLock.writeLock(); writeLock.lock(); readLock.lock(); try { final boolean currentSplitEnabled = splitEnabled; final boolean currentMergeEnabled = mergeEnabled; final int currentMinRegionCount = minRegionCount; final Period currentMergeMinRegionAge = mergeMinRegionAge; final int currentMergeMinRegionSizeMb = mergeMinRegionSizeMb; this.conf = conf; splitEnabled = conf.getBoolean(SPLIT_ENABLED_KEY, DEFAULT_SPLIT_ENABLED); mergeEnabled = conf.getBoolean(MERGE_ENABLED_KEY, DEFAULT_MERGE_ENABLED); minRegionCount = parseMinRegionCount(conf); mergeMinRegionAge = parseMergeMinRegionAge(conf); mergeMinRegionSizeMb = parseMergeMinRegionSizeMb(conf); logConfigurationUpdated(SPLIT_ENABLED_KEY, currentSplitEnabled, splitEnabled); logConfigurationUpdated(MERGE_ENABLED_KEY, currentMergeEnabled, mergeEnabled); logConfigurationUpdated(MIN_REGION_COUNT_KEY, currentMinRegionCount, minRegionCount); logConfigurationUpdated( MERGE_MIN_REGION_AGE_DAYS_KEY, currentMergeMinRegionAge, mergeMinRegionAge); logConfigurationUpdated( MERGE_MIN_REGION_SIZE_MB_KEY, currentMergeMinRegionSizeMb, mergeMinRegionSizeMb); } finally { readLock.unlock(); writeLock.unlock(); } }

Target:
public void setConf(final Configuration conf) { if (conf == null) { return; } normalizerConfiguration = new NormalizerConfiguration(conf, normalizerConfiguration); }
Source:
public void shutdown() throws InterruptedException { if (_zkClient != null) { _zkClient.close(); _reaper.shutdown(); } }

Target:
public void shutdown() throws InterruptedException { if (_zkClient != null) { _zkClient.close(); } }
Source:
public void contains() { final boolean result = U.contains(asList(1, 2, 3), 3); assertTrue(result); final boolean resultObj = new U<>(asList(1, 2, 3)).contains(3); assertTrue(resultObj); final boolean resultChain = U.chain(asList(1, 2, 3)).contains(3).item(); assertTrue(resultChain); final boolean result2 = U.contains(asList(1, 2, 3), 3, 1); assertTrue(result2); final boolean result3 = U.contains(asList(1, 2, 3), 1, 1); assertFalse(result3); final boolean result4 = U.contains(asList(1, 2, null), null); assertTrue(result4); final boolean result5 = U.containsAtLeast(asList(1, 2, 2), 2, 2); assertTrue(result5); final boolean result6 = U.containsAtLeast(asList(1, 2, 2), 3, 2); assertFalse(result6); final boolean result7 = U.containsAtMost(asList(1, 2, 2), 3, 2); assertTrue(result7); final boolean result8 = U.containsAtMost(asList(1, 2, 2), 1, 2); assertFalse(result8); final boolean result9 = new U<>(asList(1, 2, 2)).containsAtLeast(2, 2); assertTrue(result9); final boolean result10 = new U<>(asList(1, 2, 2)).containsAtLeast(3, 2); assertFalse(result10); final boolean result11 = new U<>(asList(1, 2, 2)).containsAtMost(2, 3); assertTrue(result11); final boolean result12 = new U<>(asList(1, 2, 2)).containsAtMost(1, 2); assertFalse(result12); }

Target:
public void contains() { final boolean result = U.contains(asList(1, 2, 3), 3); assertTrue(result); final boolean resultObj = new U<Integer>(asList(1, 2, 3)).contains(3); assertTrue(resultObj); final boolean resultChain = U.chain(asList(1, 2, 3)).contains(3).item(); assertTrue(resultChain); final boolean result2 = U.contains(asList(1, 2, 3), 3, 1); assertTrue(result2); final boolean result3 = U.contains(asList(1, 2, 3), 1, 1); assertFalse(result3); final boolean result4 = U.contains(asList(1, 2, null), null); assertTrue(result4); }
Source:
private void updateStatsIfDone(TaskState newState) { if (newState.isDone()) { DateTime now = DateTime.now(); long majorGcCount = gcMonitor.getMajorGcCount(); long majorGcTime = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(0, majorGcCount); startFullGcTimeNanos.compareAndSet(0, majorGcTime); lastExecutionStartTime.compareAndSet(null, now); executionEndTime.compareAndSet(null, now); endNanos.compareAndSet(0, System.nanoTime()); endFullGcCount.compareAndSet(0, majorGcCount); endFullGcTimeNanos.compareAndSet(0, majorGcTime); } }

Target:
private void updateStatsIfDone(TaskState newState) { if (newState.isDone()) { DateTime now = DateTime.now(); long majorGcCount = gcMonitor.getMajorGcCount(); long majorGcTime = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); executionStartTime.compareAndSet(null, now); startNanos.compareAndSet(0, System.nanoTime()); startFullGcCount.compareAndSet(-1, majorGcCount); startFullGcTimeNanos.compareAndSet(-1, majorGcTime); lastExecutionStartTime.compareAndSet(null, now); executionEndTime.compareAndSet(null, now); endNanos.compareAndSet(0, System.nanoTime()); endFullGcCount.compareAndSet(-1, majorGcCount); endFullGcTimeNanos.compareAndSet(-1, majorGcTime); } }
Source:
public void run() throws IOException, SQLException, InstantiationException, IllegalAccessException { DBManager dbManager = new DBManager(config); try { dbManager.ensureJDBCDriverIsAvailable(driverClass); try (Connection connection = getConnection()) { if (!config.enableAutoCommit) { connection.setAutoCommit(false); } try (Statement statement = connection.createStatement()) { statement.execute(config.query); if (!config.enableAutoCommit) { connection.commit(); } } } } finally { dbManager.destroy(); } }

Target:
public void run() throws SQLException, InstantiationException, IllegalAccessException { DBManager dbManager = new DBManager(config); try { dbManager.ensureJDBCDriverIsAvailable(driverClass); try (Connection connection = getConnection()) { if (!config.enableAutoCommit) { connection.setAutoCommit(false); } try (Statement statement = connection.createStatement()) { statement.execute(config.query); if (!config.enableAutoCommit) { connection.commit(); } } } } finally { dbManager.destroy(); } }
Source:
public List<Label> createLabel(SubmitRecord record, HashMap<String, AccountInfo> value, String status) { List<Label> list = new ArrayList<Label>(); for (String str : value.keySet()) { for (AccountInfo info : value.values()) { Label label = new Label(); label.setLabel(str); label.setStatus(status); label.setAppliedBy(info.getId()); list.add(label); } } return list; }

Target:
public List<Label> createLabel(SubmitRecord record, HashMap<String, AccountInfo> value, String status) { List<Label> list = new ArrayList<Label>(); for (Map.Entry<String, AccountInfo> info : value.entrySet()) { Label label = new Label(); label.setLabel(info.getKey()); label.setStatus(status); label.setAppliedBy(info.getValue().getId()); list.add(label); } return list; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_page, container, false); webView = (ObservableWebView) rootView.findViewById(R.id.page_web_view); webView.addOnUpOrCancelMotionEventListener(new ObservableWebView.OnUpOrCancelMotionEventListener() { @Override public void onUpOrCancelMotionEvent() { setToCButtonFadedIn(false); } }); webView.setOnFastScrollListener(new ObservableWebView.OnFastScrollListener() { @Override public void onFastScroll() { setToCButtonFadedIn(true); if (webView.getScrollY() > 0) { setToCButtonFadedIn(false); } } }); webView.addOnScrollChangeListener(new ObservableWebView.OnScrollChangeListener() { @Override public void onScrollChanged(int oldScrollY, int scrollY) { if (scrollY == 0) { setToCButtonFadedIn(true); } } }); tocDrawer = (WikiDrawerLayout) rootView.findViewById(R.id.page_toc_drawer); tocDrawer.setDragEdgeWidth(getResources().getDimensionPixelSize(R.dimen.drawer_drag_margin)); tocButton = (FloatingActionButton) rootView.findViewById(R.id.floating_toc_button); tocButton.setOnClickListener(tocButtonOnClickListener); refreshView = (SwipeRefreshLayoutWithScroll) rootView .findViewById(R.id.page_refresh_container); int swipeOffset = Utils.getActionBarSize(getActivity()); refreshView.setProgressViewOffset(true, -swipeOffset, swipeOffset); refreshView.setSize(SwipeRefreshLayout.LARGE); refreshView.setScrollableChild(webView); refreshView.setOnRefreshListener(pageRefreshListener); errorView = (WikiErrorView)rootView.findViewById(R.id.page_error); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_page, container, false); webView = (ObservableWebView) rootView.findViewById(R.id.page_web_view); initWebViewListeners(); tocDrawer = (WikiDrawerLayout) rootView.findViewById(R.id.page_toc_drawer); tocDrawer.setDragEdgeWidth(getResources().getDimensionPixelSize(R.dimen.drawer_drag_margin)); tocButton = (FloatingActionButton) rootView.findViewById(R.id.floating_toc_button); tocButton.setOnClickListener(tocButtonOnClickListener); refreshView = (SwipeRefreshLayoutWithScroll) rootView .findViewById(R.id.page_refresh_container); int swipeOffset = Utils.getActionBarSize(getActivity()); refreshView.setProgressViewOffset(true, -swipeOffset, swipeOffset); refreshView.setSize(SwipeRefreshLayout.LARGE); refreshView.setScrollableChild(webView); refreshView.setOnRefreshListener(pageRefreshListener); errorView = (WikiErrorView)rootView.findViewById(R.id.page_error); return rootView; }
Source:
private List<TestResult> filterTests(List<? extends TestResult> failedTests, String regexPattern) { List<TestResult> filteredTests = failedTests.stream().collect(Collectors.toList()); if(regexPattern.length() != 0) { Pattern pattern = Pattern.compile(regexPattern); filteredTests = filteredTests.stream().filter(t -> pattern.matcher(t.getFullName()).matches()).collect(Collectors.toList()); } return filteredTests; }

Target:
private List<? extends TestResult> filterTests(List<? extends TestResult> failedTests, String regexPattern) { if(regexPattern.length() != 0) { Pattern pattern = Pattern.compile(regexPattern); failedTests = failedTests.stream().filter(t -> pattern.matcher(t.getFullName()).matches()).collect(Collectors.toList()); } return failedTests; }
Source:
private ITmfTimeZoomProvider getTimeZoomProvider() { return (zoomIn, selection) -> { TimeGraphControl control = getTimeGraphControl(); TimeGraphViewer viewer = getTimeGraphViewer(); if (control != null && viewer != null) { if (selection) { int xCoord = control.toControl(control.getDisplay().getCursorLocation()).x; if ((viewer.getNameSpace() < xCoord) && (xCoord < control.getSize().x)) { if (zoomIn) { control.zoomIn(); } else { control.zoomOut(); } } } else { control.zoom(zoomIn); } } }; }

Target:
private ITmfTimeZoomProvider getTimeZoomProvider() { return (zoomIn, useMousePosition) -> { TimeGraphControl control = getTimeGraphControl(); TimeGraphViewer viewer = getTimeGraphViewer(); if (control != null && viewer != null) { if (useMousePosition) { control.zoom(zoomIn); } else { int xCoord = control.toControl(control.getDisplay().getCursorLocation()).x; if ((viewer.getNameSpace() <= xCoord) && (xCoord < control.getSize().x)) { if (zoomIn) { control.zoomIn(); } else { control.zoomOut(); } } } } }; }
Source:
private void handleIntent(Intent intent) { mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean bPageHasChanged = false; if (intent.hasExtra(EXTRA_VIEW_PAGES)) { boolean isPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); bPageHasChanged = isPage != mIsPage; } mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean bSiteHasChanged = false; if (intent.hasExtra(WordPress.SITE)) { SiteModel site = (SiteModel) intent.getSerializableExtra(WordPress.SITE); bSiteHasChanged = site.getId() != mSite.getId(); mSite = site; } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } mPostList = (PostsListFragment) getFragmentManager().findFragmentByTag(PostsListFragment.TAG); if (mPostList == null || bSiteHasChanged || bPageHasChanged) { PostsListFragment oldFragment = mPostList; mPostList = PostsListFragment.newInstance(mSite, mIsPage); if (oldFragment == null) { getFragmentManager().beginTransaction() .add(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } else { getFragmentManager().beginTransaction() .replace(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } } showErrorDialogIfNeeded(intent.getExtras()); }

Target:
private void handleIntent(Intent intent) { mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean pageHasChanged = false; if (intent.hasExtra(EXTRA_VIEW_PAGES)) { boolean isPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); pageHasChanged = isPage != mIsPage; } mIsPage = intent.getBooleanExtra(EXTRA_VIEW_PAGES, false); boolean siteHasChanged = false; if (intent.hasExtra(WordPress.SITE)) { SiteModel site = (SiteModel) intent.getSerializableExtra(WordPress.SITE); if (mSite != null && site != null) { siteHasChanged = site.getId() != mSite.getId(); } mSite = site; } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(getString(mIsPage ? R.string.pages : R.string.posts)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } mPostList = (PostsListFragment) getFragmentManager().findFragmentByTag(PostsListFragment.TAG); if (mPostList == null || siteHasChanged || pageHasChanged) { PostsListFragment oldFragment = mPostList; mPostList = PostsListFragment.newInstance(mSite, mIsPage); if (oldFragment == null) { getFragmentManager().beginTransaction() .add(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } else { getFragmentManager().beginTransaction() .replace(R.id.post_list_container, mPostList, PostsListFragment.TAG) .commit(); } } showErrorDialogIfNeeded(intent.getExtras()); }
Source:
public Cohort(String name, String description, Patient[] patients) { this(name, description, (Integer[]) null); if (patients != null) { for (Patient p : patients) { CohortMember cohortMember = new CohortMember(this, p, new Date()); members.add(cohortMember); } } }

Target:
public Cohort(String name, String description, Patient[] patients) { this(name, description, (Integer[]) null); if (patients != null) { for (Patient p : patients) { addMembership(new CohortMembership(p)); } } }
Source:
protected Set<Value.Immutable<?>> api$getVanillaValues() { Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); vanillaValues.add(this.type().asImmutable()); vanillaValues.add(this.sitting().asImmutable()); vanillaValues.add(this.faceplanted().asImmutable()); vanillaValues.add(this.defending().asImmutable()); vanillaValues.add(this.sleeping().asImmutable()); vanillaValues.add(this.pouncing().asImmutable()); vanillaValues.add(this.crouching().asImmutable()); vanillaValues.add(this.interested().asImmutable()); if (this.dataManager.get(FoxEntityAccessor.accessor$getTrustedUuidMain()).isPresent()) { this.firstTrusted().map(Value::asImmutable).ifPresent(vanillaValues::add); } if (this.dataManager.get(FoxEntityAccessor.accessor$getTrustedUuidSecondary()).isPresent()) { this.secondTrusted().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.type().asImmutable()); values.add(this.sitting().asImmutable()); values.add(this.faceplanted().asImmutable()); values.add(this.defending().asImmutable()); values.add(this.sleeping().asImmutable()); values.add(this.pouncing().asImmutable()); values.add(this.crouching().asImmutable()); values.add(this.interested().asImmutable()); this.firstTrusted().map(Value::asImmutable).ifPresent(values::add); this.secondTrusted().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
private void triggerForceRefreshProgressDialog() { Task<Boolean> task = new Task<Boolean>(){ @Override protected Boolean call() throws IOException { try { logger.info("Menu: View > Force Refresh"); ServiceManager.getInstance().stopModelUpdate(); ServiceManager.getInstance().getModel().forceReloadComponents(); ServiceManager.getInstance().restartModelUpdate(); } catch (Exception e1) { e1.printStackTrace(); } logger.info("Menu: View > Force Refresh completed"); return true; } }; DialogMessage.showProgressDialog(task, "Reloading issues for current repo. This may take awhile, please wait..."); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); }

Target:
private void triggerForceRefreshProgressDialog() { Task<Boolean> task = new Task<Boolean>(){ @Override protected Boolean call() throws IOException { try { logger.info("Menu: View > Force Refresh"); ServiceManager.getInstance().stopModelUpdate(); ServiceManager.getInstance().getModel().forceReloadComponents(); ServiceManager.getInstance().restartModelUpdate(); } catch (SocketTimeoutException e) { handleSocketTimeoutException(e); return false; } catch (UnknownHostException e) { handleUnknownHostException(e); return false; } catch (Exception e) { logger.error(e.getMessage(), e); e.printStackTrace(); return false; } logger.info("Menu: View > Force Refresh completed"); return true; } private void handleSocketTimeoutException(Exception e) { Platform.runLater(() -> { logger.error(e.getMessage(), e); DialogMessage.showWarningDialog("Internet Connection is down", "Timeout while loading items from github. Please check your internet connection."); }); } private void handleUnknownHostException(Exception e) { Platform.runLater(() -> { logger.error(e.getMessage(), e); DialogMessage.showWarningDialog("No Internet Connection", "Please check your internet connection and try again"); }); } }; DialogMessage.showProgressDialog(task, "Reloading issues for current repo... This may take awhile, please wait."); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); }
Source:
public void persist_shouldCreateARefund() { ChargeEntity chargeEntity = new ChargeEntity(); chargeEntity.setId(chargeTestRecord.getChargeId()); RefundEntity refundEntity = new RefundEntity(chargeEntity, 100L, null); refundEntity.setStatus(RefundStatus.REFUND_SUBMITTED); refundEntity.setReference("test-refund-entity"); refundDao.persist(refundEntity); assertNotNull(refundEntity.getId()); List<Map<String, Object>> refundByIdFound = databaseTestHelper.getRefund(refundEntity.getId()); assertThat(refundByIdFound.size(), is(1)); assertThat(refundByIdFound, hasItems(aRefundMatching(refundEntity.getExternalId(), is("test-refund-entity"), refundEntity.getChargeEntity().getId(), refundEntity.getAmount(), refundEntity.getStatus().getValue()))); assertThat(refundByIdFound.get(0), hasEntry("created_date", java.sql.Timestamp.from(refundEntity.getCreatedDate().toInstant()))); }

Target:
public void persist_shouldCreateARefund() { ChargeEntity chargeEntity = new ChargeEntity(); chargeEntity.setId(chargeTestRecord.getChargeId()); RefundEntity refundEntity = new RefundEntity(chargeEntity, 100L, userExternalId); refundEntity.setStatus(RefundStatus.REFUND_SUBMITTED); refundEntity.setReference("test-refund-entity"); refundDao.persist(refundEntity); assertNotNull(refundEntity.getId()); List<Map<String, Object>> refundByIdFound = databaseTestHelper.getRefund(refundEntity.getId()); assertThat(refundByIdFound.size(), is(1)); assertThat(refundByIdFound, hasItems(aRefundMatching(refundEntity.getExternalId(), is("test-refund-entity"), refundEntity.getChargeEntity().getId(), refundEntity.getAmount(), refundEntity.getStatus().getValue()))); assertThat(refundByIdFound.get(0), hasEntry("created_date", java.sql.Timestamp.from(refundEntity.getCreatedDate().toInstant()))); assertThat(refundByIdFound.get(0), hasEntry("user_external_id", userExternalId)); }
Source:
String[] oldPaths = (oldValue != null ? oldValue.toString() : new String()) .split(Character.toString(File.pathSeparatorChar)); String[] newPaths = (newValue != null ? newValue.toString() : new String()) .split(Character.toString(File.pathSeparatorChar)); List<String> removedPaths = new ArrayList<>(Arrays.asList(oldPaths)); for (String path : newPaths) { removedPaths.remove(path); }

Target:
String[] oldPaths = (oldValue != null ? oldValue.toString() : EMPTY_STRING) .split(Character.toString(File.pathSeparatorChar)); String[] newPaths = (newValue != null ? newValue.toString() : EMPTY_STRING) .split(Character.toString(File.pathSeparatorChar)); List<String> removedPaths = new ArrayList<>(Arrays.asList(oldPaths)); for (String path : newPaths) { removedPaths.remove(path); }
Source:
private List<Object> parseList(String str) { List<Object> rc = new ArrayList<Object>(); String temp = str.trim(); Pattern pattern = isPatternFoundList(str); if (pattern == null) return null; Matcher variableMatcher = pattern.matcher(temp); if (variableMatcher != null) { while (variableMatcher.find()) { rc.add(variableMatcher.group()); } } return rc; }

Target:
private List<String> parseList(String str) { List<String> rc = new ArrayList<String>(); String temp = str.trim(); Pattern pattern = isPatternFoundList(str); if (pattern == null) { return rc; } Matcher variableMatcher = pattern.matcher(temp); if (variableMatcher != null) { while (variableMatcher.find()) { rc.add(variableMatcher.group()); } } return rc; }
Source:
void testAttacking() { int index = 4; for (final var unit : units) { when(((UnitAttachment) unit.getType().getAttachment("")).getOffensiveAttackAa(any())) .thenReturn(index / 2); index--; } DiceRoll.sortAaHighToLow(units, gameData, false, unitPowerAndRollsMap); assertThat(units.get(0), is(unit1)); assertThat(units.get(1), is(unit2)); assertThat(units.get(2), is(unit3)); assertThat(units.get(3), is(unit4)); assertThat(units.get(4), is(unit5)); }

Target:
void testAttacking() { int index = 4; for (final var unit : units) { final var unitAttachment = setupUnitAttachment(unit); when(unitAttachment.getOffensiveAttackAa(any())).thenReturn(index / 2); index--; } DiceRoll.sortAaHighToLow(units, gameData, false, new HashMap<>()); assertThat(units.get(0), is(unit1)); assertThat(units.get(1), is(unit2)); assertThat(units.get(2), is(unit3)); assertThat(units.get(3), is(unit4)); assertThat(units.get(4), is(unit5)); }
Source:
private static void initializeAppsLocation(Log log, File serverXML, File configDir, File bootstrapFile, Map<String, String> bootstrapProp, File serverEnvFile) { try { ServerConfigDocument.log = log; serverXMLFile = serverXML; configDirectory = configDir; locations = new HashSet<String>(); props = new Properties(); Document doc = parseDocument(new FileInputStream(serverXMLFile)); Properties fProps; File cfgDirFile = getFileFromConfigDirectory("server.env"); if (cfgDirFile != null) { fProps = parseProperties(new FileInputStream(cfgDirFile)); props.putAll(fProps); } else if (serverEnvFile.exists()) { fProps = parseProperties(new FileInputStream(serverEnvFile)); props.putAll(fProps); } cfgDirFile = getFileFromConfigDirectory("bootstrap.properties"); if (cfgDirFile != null) { fProps = parseProperties(new FileInputStream(cfgDirFile)); props.putAll(fProps); } else if (bootstrapProp != null && !bootstrapProp.isEmpty()) { Map.Entry<String,String> entry=bootstrapProp.entrySet().iterator().next(); while (bootstrapProp.values().remove(null)) ; props.putAll(bootstrapProp); } else if (bootstrapFile.exists()) { fProps = parseProperties(new FileInputStream(bootstrapFile)); props.putAll(fProps); } parseIncludeVariables(doc); parseConfigDropinsDirVariables("defaults"); parseVariables(doc); parseConfigDropinsDirVariables("overrides"); parseApplication(doc, XPATH_SERVER_APPLICATION); parseApplication(doc, XPATH_SERVER_WEB_APPLICATION); parseApplication(doc, XPATH_SERVER_ENTERPRISE_APPLICATION); parseInclude(doc); parseConfigDropinsDir(); } catch (Exception e) { e.printStackTrace(); } }

Target:
private static void initializeAppsLocation(Log log, File serverXML, File configDir, File bootstrapFile, Map<String, String> bootstrapProp, File serverEnvFile) { try { ServerConfigDocument.log = log; serverXMLFile = serverXML; configDirectory = configDir; locations = new HashSet<String>(); props = new Properties(); Document doc = parseDocument(new FileInputStream(serverXMLFile)); Properties fProps; File cfgDirFile = getFileFromConfigDirectory("server.env"); if (cfgDirFile != null) { fProps = parseProperties(new FileInputStream(cfgDirFile)); props.putAll(fProps); } else if (serverEnvFile.exists()) { fProps = parseProperties(new FileInputStream(serverEnvFile)); props.putAll(fProps); } cfgDirFile = getFileFromConfigDirectory("bootstrap.properties"); if (cfgDirFile != null) { fProps = parseProperties(new FileInputStream(cfgDirFile)); props.putAll(fProps); } else if (bootstrapProp != null && !bootstrapProp.isEmpty()) { while (bootstrapProp.values().remove(null)) ; props.putAll(bootstrapProp); } else if (bootstrapFile.exists()) { fProps = parseProperties(new FileInputStream(bootstrapFile)); props.putAll(fProps); } parseIncludeVariables(doc); parseConfigDropinsDirVariables("defaults"); parseVariables(doc); parseConfigDropinsDirVariables("overrides"); parseApplication(doc, XPATH_SERVER_APPLICATION); parseApplication(doc, XPATH_SERVER_WEB_APPLICATION); parseApplication(doc, XPATH_SERVER_ENTERPRISE_APPLICATION); parseInclude(doc); parseConfigDropinsDir(); } catch (Exception e) { e.printStackTrace(); } }
Source:
private String commit(final CommitParams params, URI dockerDaemonUri) throws IOException { try (DockerConnection connection = connectionFactory.openConnection(dockerDaemonUri) .method("POST") .path("/commit")) { addQueryParamIfNotNull(connection, "container", params.getContainer()); addQueryParamIfNotNull(connection, "repo", params.getRepository()); addQueryParamIfNotNull(connection, "tag", params.getTag()); addQueryParamIfNotNull(connection, "comment", (params.getComment() == null) ? null : URLEncoder.encode(params.getComment(), "UTF-8")); addQueryParamIfNotNull(connection, "author", (params.getAuthor() == null) ? null : URLEncoder.encode(params.getAuthor(), "UTF-8")); final DockerResponse response = connection.request(); if (CREATED.getStatusCode() != response.getStatus()) { throw getDockerException(response); } return parseResponseStreamAndClose(response.getInputStream(), ContainerCommitted.class).getId(); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }

Target:
private String commit(final CommitParams params, URI dockerDaemonUri) throws IOException { try (DockerConnection connection = connectionFactory.openConnection(dockerDaemonUri) .method("POST") .path("/commit") .query("container", params.getContainer())) { addQueryParamIfNotNull(connection, "repo", params.getRepository()); addQueryParamIfNotNull(connection, "tag", params.getTag()); addQueryParamIfNotNull(connection, "comment", (params.getComment() == null) ? null : URLEncoder.encode(params.getComment(), "UTF-8")); addQueryParamIfNotNull(connection, "author", (params.getAuthor() == null) ? null : URLEncoder.encode(params.getAuthor(), "UTF-8")); final DockerResponse response = connection.request(); if (CREATED.getStatusCode() != response.getStatus()) { throw getDockerException(response); } return parseResponseStreamAndClose(response.getInputStream(), ContainerCommitted.class).getId(); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }
Source:
public static <Y> Key<Object, Y> create(ViewMetamodel metamodel, Object source, Class<Y> targetEntityViewClass, String constructorName, ConvertOption... convertOptions) { if (source instanceof EntityViewProxy) { EntityViewProxy sourceProxy = (EntityViewProxy) source; return (Key<Object, Y>) create(metamodel, sourceProxy.$$_getEntityViewClass(), targetEntityViewClass, constructorName, convertOptions); } else { return (Key<Object, Y>) create(metamodel, null, targetEntityViewClass, constructorName, convertOptions); } }

Target:
public static <Y> Key<Object, Y> create(ViewMetamodel metamodel, Object source, Class<Y> targetEntityViewClass, String constructorName, ConvertOption... convertOptions) { if (source instanceof EntityViewProxy) { EntityViewProxy sourceProxy = (EntityViewProxy) source; return (Key<Object, Y>) createWithConvertOptions(metamodel, sourceProxy.$$_getEntityViewClass(), targetEntityViewClass, constructorName, false, convertOptions); } else { ManagedViewType<Y> targetViewType = metamodel.managedView(targetEntityViewClass); if (targetViewType == null) { throw new IllegalArgumentException("Unknown target view type: " + targetEntityViewClass.getName()); } else if (!targetViewType.getEntityClass().isInstance(source)) { throw new IllegalArgumentException("The source object is not an instance of the target views entity type " + targetViewType.getEntityClass().getName() + ": " + source.getClass().getName()); } return createWithConvertOptions(metamodel, null, targetEntityViewClass, constructorName, true, convertOptions); } }
Source:
public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = KeyMID.fromInboundMessage(request); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getRequest(); EndpointContext previousSourceContext = previousRequest.getSourceContext(); duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); if (!duplicate) { exchangeStore.remove(idByMID, previous); if (exchangeStore.findPrevious(idByMID, exchange) != null) { LOGGER.warn("new request could not be registered!"); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (Exception ex) { LOGGER.debug("error receiving request again!", request, ex); receiver.reject(request); } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (Exception ex) { LOGGER.debug("error receiving request {}", request, ex); receiver.reject(request); } } }); } }

Target:
public void receiveRequest(final Request request, final EndpointReceiver receiver) { final KeyMID idByMID = KeyMID.fromInboundMessage(request); final Exchange exchange = new Exchange(request, Origin.REMOTE, executor); final Exchange previous = exchangeStore.findPrevious(idByMID, exchange); boolean duplicate = previous != null; if (duplicate) { EndpointContext sourceContext = request.getSourceContext(); Request previousRequest = previous.getRequest(); EndpointContext previousSourceContext = previousRequest.getSourceContext(); duplicate = endpointContextMatcher.isToBeSent(previousSourceContext, sourceContext); if (!duplicate) { exchangeStore.remove(idByMID, previous); if (exchangeStore.findPrevious(idByMID, exchange) != null) { LOGGER.warn("new request could not be registered!"); } } } if (duplicate) { LOGGER.trace("duplicate request: {}", request); request.setDuplicate(true); previous.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(previous, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request again!", request, ex); receiver.reject(request); } } }); } else { exchange.setRemoveHandler(exchangeRemoveHandler); exchange.execute(new Runnable() { @Override public void run() { try { receiver.receiveRequest(exchange, request); } catch (RuntimeException ex) { LOGGER.warn("error receiving request {}", request, ex); receiver.reject(request); } } }); } }
Source:
public void convertFromEntityShouldCopyRequiredFields(){ SpamRule entity = randomSpamRule(); SpamRuleDto dto = SpamRuleDto.fromEntity(entity); assertEquals(entity, dto); }

Target:
public void convertFromEntityShouldCopyRequiredFields(){ SpamRule expected = randomSpamRule(); SpamRuleDto dto = SpamRuleDto.fromEntity(expected); SpamRule actual = SpamRule.toEntity(dto); actual.setUuid(expected.getUuid()); assertReflectionEquals(expected, actual); }
Source:
public void testGetParameter() { String key = "foo"; CRRequest req = createTestRequest(null); assertNull( "When no parameters and no request wrapper is set, a call to get with fallback=true should not throw an exception", req.get(key, Boolean.TRUE) ); req = createTestRequest(new HashMap<String, String>()); assertNull("Null should be returned if no parameter is set", req.get(key)); assertNull("Null should be returned if no parameter is set and fallback=true", req.get(key, Boolean.FALSE)); req.set(key, "bar"); assertEquals("If a parameter is set in the CRRequest, the value should be returned", "bar", req.get(key)); HashMap<String, String> servletParams = new HashMap<>(); servletParams.put(key, "servletBar"); req = createTestRequest(servletParams); assertNull( "Null should be returned when get is called with a single argument and the parameter is only set in the servlet request", req.get(key) ); assertNull( "Null should be returned when get is called with fallback=false and the parameter is only set in the servlet request", req.get(key) ); assertEquals( "If the parameter is only set in the servlet request and get is called with fallback=true, the value should be retrieved from the servlet request.", "servletBar", req.get(key, Boolean.TRUE) ); req.set(key, "bar"); assertNotEquals( "If the parameter is set in both requests and get is called with a single argument, the value should be different from the one stored in the servlet reques", "servletBar", req.get(key) ); assertNotEquals( "If the parameter is set in both requests and get is called with fallback=false, the value should be different from the one stored in the servlet request.", "servletBar", req.get(key, Boolean.FALSE) ); assertEquals( "If the parameter is set in both requests and calls to get with fallback=false and fallback=true shoudl return the same value.", req.get(key, Boolean.TRUE), req.get(key, Boolean.FALSE) ); }

Target:
public void testGetParameter() { String key = "foo"; CRRequest req = createTestRequest(null); assertNull( "When no parameters and no request wrapper is set, a call to get with fallback=true should not throw an exception", req.get(key, Boolean.TRUE) ); }
Source:
public final void write(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final Channel channel = this.channel; int readableBytes = buffer.readableBytes(); Object fileObject = null; if (buffer instanceof FileDelegatedChannelBufferWrapper) { readableBytes += ((FileDelegatedChannelBufferWrapper)buffer).getDataSize(); fileObject = getFileObject((FileDelegatedChannelBufferWrapper)buffer); } if (logger.isDebugEnabled()) { final int remainingBytes = this.writeBufferHighWaterMark - readableBytes; if (remainingBytes < 0) { logger.debug("a write request is exceeding by " + (-remainingBytes) + " bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark + " ] : consider to set it at least of " + readableBytes + " bytes"); } } final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, fileObject, readableBytes, promise); } else if (fileObject == null) { future = channel.writeAndFlush(bytes, promise); } else { channel.write(bytes); future = channel.writeAndFlush(fileObject, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { flushAndWait(channel, promise); } }

Target:
public final void write(ActiveMQBuffer buffer, final boolean flush, final boolean batched, final ChannelFutureListener futureListener) { final int readableBytes = buffer.readableBytes(); if (logger.isDebugEnabled()) { final int remainingBytes = this.writeBufferHighWaterMark - readableBytes; if (remainingBytes < 0) { logger.debug("a write request is exceeding by " + (-remainingBytes) + " bytes the writeBufferHighWaterMark size [ " + this.writeBufferHighWaterMark + " ] : consider to set it at least of " + readableBytes + " bytes"); } } final Channel channel = this.channel; final ChannelPromise promise; if (flush || (futureListener != null)) { promise = channel.newPromise(); } else { promise = channel.voidPromise(); } final ChannelFuture future; final ByteBuf bytes = buffer.byteBuf(); assert readableBytes >= 0; final int writeBatchSize = this.batchLimit; final boolean batchingEnabled = this.batchingEnabled; if (batchingEnabled && batched && !flush && readableBytes < writeBatchSize) { future = writeBatch(bytes, readableBytes, promise); } else { future = channel.writeAndFlush(bytes, promise); } if (futureListener != null) { future.addListener(futureListener); } if (flush) { flushAndWait(channel, promise); } }
Source:
public static ChangeUpdate newUpdate(Injector injector, GitRepositoryManager repoManager, Change c, final IdentifiedUser user) throws Exception { return injector.createChildInjector(new FactoryModule() { @Override public void configure() { factory(ChangeUpdate.Factory.class); bind(IdentifiedUser.class).toInstance(user); } }).getInstance(ChangeUpdate.Factory.class).create( stubChangeControl(repoManager, c, user), TimeUtil.nowTs(), Ordering.<String> natural()); }

Target:
public static ChangeUpdate newUpdate(Injector injector, GitRepositoryManager repoManager, Change c, final IdentifiedUser user) throws OrmException { return injector.createChildInjector(new FactoryModule() { @Override public void configure() { factory(ChangeUpdate.Factory.class); bind(IdentifiedUser.class).toInstance(user); } }).getInstance(ChangeUpdate.Factory.class).create( stubChangeControl(repoManager, c, user), TimeUtil.nowTs(), Ordering.<String> natural()); }
Source:
public void testFormShortCircuit() { FormParseInit fpi = new FormParseInit("/IfShortCircuitTest.xhtml"); IFunctionHandler functionFailer = new IFunctionHandler() { @Override public String getName() { return "fail_function"; } @Override public Object eval(Object[] args, EvaluationContext ec) { throw new RuntimeException("You failed the test!"); } @Override public Vector getPrototypes() { Vector<Class[]> p = new Vector<>(); p.addElement(new Class[0]); return p; } @Override public boolean rawArgs() { return false; } }; fpi.getFormDef().exprEvalContext.addFunctionHandler(functionFailer); FormEntryController fec = fpi.getFormEntryController(); do { QuestionDef q = fpi.getCurrentQuestion(); if (q == null) { continue; } fec.answerQuestion(new SelectOneData(new Selection("yes"))); } while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM); }

Target:
public void testFormShortCircuit() { FormParseInit fpi = new FormParseInit("/IfShortCircuitTest.xhtml"); IFunctionHandler functionFailer = new IFunctionHandler() { @Override public String getName() { return "fail_function"; } @Override public Object eval(Object[] args, EvaluationContext ec) { throw new RuntimeException("False portion of if() statement called"); } @Override public Vector getPrototypes() { Vector<Class[]> p = new Vector<>(); p.addElement(new Class[0]); return p; } @Override public boolean rawArgs() { return false; } }; fpi.getFormDef().exprEvalContext.addFunctionHandler(functionFailer); FormEntryController fec = fpi.getFormEntryController(); do { QuestionDef q = fpi.getCurrentQuestion(); if (q == null) { continue; } fec.answerQuestion(new SelectOneData(new Selection("yes"))); } while (fec.stepToNextEvent() != FormEntryController.EVENT_END_OF_FORM); }
Source:
private static String createAliasUsingDoi(String doi, Workflow workflow) { Map<String, Alias> aliases = workflow.getAliases(); String doiReformattedAlias = doi.replaceAll("/", "-"); aliases.put(doiReformattedAlias, new Alias()); workflow.setAliases(aliases); return doiReformattedAlias; }

Target:
private static String createAliasUsingDoi(String doi, Workflow workflow) { Map<String, Alias> aliases = workflow.getAliases(); String doiReformattedAlias = doi.replaceAll("/", "-"); aliases.put(doiReformattedAlias, new Alias()); return doiReformattedAlias; }
Source:
default <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner) { R container = supplier.get(); accumulator.accept(container, get()); return container; }

Target:
default <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner) { return StreamSupport.stream(spliterator(), false).collect(supplier, accumulator, combiner); }
Source:
public void handleEvent(Event event) { EventContext ctx = event.getContext(); if (!(ctx instanceof DocumentEventContext)) { return; } DocumentEventContext docCtx = (DocumentEventContext) ctx; DocumentModel doc = docCtx.getSourceDocument(); if (doc.hasFacet(PICTURE_FACET) && !doc.isProxy()) { Property fileProp = doc.getProperty("file:content"); Property viewsProp = doc.getProperty(AbstractPictureAdapter.VIEWS_PROPERTY); Boolean forceGeneration = Boolean.TRUE.equals(doc.getContextData(CTX_FORCE_VIEWS_GENERATION)); if (forceGeneration || (!viewsProp.isDirty() || viewsProp.size() == 0) && (ABOUT_TO_CREATE.equals(event.getName()) || fileProp.isDirty())) { preFillPictureViews(docCtx.getCoreSession(), doc); } else { docCtx.setProperty(PictureViewsGenerationListener.DISABLE_PICTURE_VIEWS_GENERATION_LISTENER, true); } } }

Target:
public void handleEvent(Event event) { EventContext ctx = event.getContext(); if (!(ctx instanceof DocumentEventContext)) { return; } DocumentEventContext docCtx = (DocumentEventContext) ctx; DocumentModel doc = docCtx.getSourceDocument(); if (doc.hasFacet(PICTURE_FACET) && !doc.isProxy()) { Property fileProp = doc.getProperty("file:content"); Property viewsProp = doc.getProperty(AbstractPictureAdapter.VIEWS_PROPERTY); boolean forceGeneration = Boolean.TRUE.equals(doc.getContextData(CTX_FORCE_VIEWS_GENERATION)); boolean noPictureViews = !viewsProp.isDirty() || viewsProp.size() == 0; boolean fileChanged = ABOUT_TO_CREATE.equals(event.getName()) || fileProp.isDirty(); if (forceGeneration || (noPictureViews && fileChanged)) { preFillPictureViews(docCtx.getCoreSession(), doc); } else { docCtx.setProperty(PictureViewsGenerationListener.DISABLE_PICTURE_VIEWS_GENERATION_LISTENER, true); } } }
Source:
public void saveInterpreterBindings(NotebookSocket conn, Message fromMessage) { try { List<String> settingIdList = gson.fromJson(String.valueOf( fromMessage.data.get("selectedSettingIds")), new TypeToken<ArrayList<String>>() { }.getType()); notebook().bindInterpretersToNote((String) fromMessage.data.get("noteID"), settingIdList); } catch (Exception e) { LOG.error("Error while saving interpreter bindings", e); } }

Target:
public void saveInterpreterBindings(NotebookSocket conn, Message fromMessage) { String noteId = (String) fromMessage.data.get("noteID"); try { List<String> settingIdList = gson.fromJson(String.valueOf( fromMessage.data.get("selectedSettingIds")), new TypeToken<ArrayList<String>>() { }.getType()); notebook().bindInterpretersToNote(noteId, settingIdList); broadcastInterpreterBindings(noteId, InterpreterBindingUtils.getInterpreterBindings(notebook(), noteId)); } catch (Exception e) { LOG.error("Error while saving interpreter bindings", e); } }