auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static final HTNode readNode(HTConfig config, FileChannel fc) throws IOException { HTNode newNode = null; int res, i; ByteBuffer buffer = ByteBuffer.allocate(config.getBlockSize()); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.clear(); res = fc.read(buffer); assert (res == config.getBlockSize()); buffer.flip(); byte type = buffer.get(); long start = buffer.getLong(); long end = buffer.getLong(); int seqNb = buffer.getInt(); int parentSeqNb = buffer.getInt(); int intervalCount = buffer.getInt(); int stringSectionOffset = buffer.getInt(); buffer.get(); switch (type) { case HTConfig.CORENODE_TYPE: newNode = new CoreNode(config, seqNb, parentSeqNb, start); newNode.readSpecificHeader(buffer); break; case HTConfig.LEAFNODE_TYPE: newNode = new LeafNode(config, seqNb, parentSeqNb, start); newNode.readSpecificHeader(buffer); break; case HTConfig.CLAUDETTENODE_TYPE: newNode = new ClaudetteNode(config, seqNb, parentSeqNb, start); newNode.readSpecificHeader(buffer); break; default: throw new IOException(); } for (i = 0; i < intervalCount; i++) { newNode.intervals.add(HTInterval.readFrom(buffer)); } newNode.nodeEnd = end; newNode.stringSectionOffset = stringSectionOffset; newNode.isOnDisk = true; return newNode; }

Target:
public static final HTNode readNode(HTConfig config, FileChannel fc) throws IOException { HTNode newNode = null; int res, i; ByteBuffer buffer = ByteBuffer.allocate(config.getBlockSize()); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.clear(); res = fc.read(buffer); assert (res == config.getBlockSize()); buffer.flip(); byte type = buffer.get(); long start = buffer.getLong(); long end = buffer.getLong(); int seqNb = buffer.getInt(); int parentSeqNb = buffer.getInt(); int intervalCount = buffer.getInt(); int stringSectionOffset = buffer.getInt(); buffer.get(); switch (type) { case CORENODE_TYPE: newNode = new CoreNode(config, seqNb, parentSeqNb, start); newNode.readSpecificHeader(buffer); break; case LEAFNODE_TYPE: newNode = new LeafNode(config, seqNb, parentSeqNb, start); newNode.readSpecificHeader(buffer); break; case EXTENSIONNODE_TYPE: newNode = new ExtensionNode(config, seqNb, parentSeqNb, start); newNode.readSpecificHeader(buffer); break; default: throw new IOException(); } for (i = 0; i < intervalCount; i++) { newNode.intervals.add(HTInterval.readFrom(buffer)); } newNode.nodeEnd = end; newNode.stringSectionOffset = stringSectionOffset; newNode.isOnDisk = true; return newNode; }
Source:
AliasModuleSpec(final ModuleIdentifier moduleIdentifier, final ModuleIdentifier aliasTarget) { super(moduleIdentifier); this.aliasTarget = aliasTarget; DependencySpec aliasTargetDependency = DependencySpec.createModuleDependencySpec(PathFilters.acceptAll(), PathFilters.acceptAll(), null, aliasTarget, false); final String mainClass = null; final AssertionSetting assertionSetting = AssertionSetting.INHERIT; final ResourceLoaderSpec[] resourceLoaders = new ResourceLoaderSpec[0]; final DependencySpec[] dependencies = new DependencySpec[] { aliasTargetDependency }; final LocalLoader fallbackLoader = null; final ModuleClassLoaderFactory moduleClassLoaderFactory = null; final ClassFileTransformer classFileTransformer = null; final Map<String, String> properties = Collections.emptyMap(); final PermissionCollection permissionCollection = ModulesPolicy.DEFAULT_PERMISSION_COLLECTION; this.concreteModuleSpec = new ConcreteModuleSpec(moduleIdentifier, mainClass, assertionSetting, resourceLoaders, dependencies, fallbackLoader, moduleClassLoaderFactory, classFileTransformer, properties, permissionCollection); }

Target:
AliasModuleSpec(final ModuleIdentifier moduleIdentifier, final ModuleIdentifier aliasTarget) { super(moduleIdentifier); this.aliasTarget = aliasTarget; DependencySpec aliasTargetDependency = DependencySpec.createModuleDependencySpec(PathFilters.acceptAll(), PathFilters.acceptAll(), null, aliasTarget, false); final String mainClass = null; final AssertionSetting assertionSetting = AssertionSetting.INHERIT; final ResourceLoaderSpec[] resourceLoaders = ResourceLoaderSpec.NO_RESOURCE_LOADERS; final DependencySpec[] dependencies = new DependencySpec[] { aliasTargetDependency }; final LocalLoader fallbackLoader = null; final ModuleClassLoaderFactory moduleClassLoaderFactory = null; final ClassFileTransformer classFileTransformer = null; final Map<String, String> properties = Collections.emptyMap(); final PermissionCollection permissionCollection = ModulesPolicy.DEFAULT_PERMISSION_COLLECTION; this.concreteModuleSpec = new ConcreteModuleSpec(moduleIdentifier, mainClass, assertionSetting, resourceLoaders, dependencies, fallbackLoader, moduleClassLoaderFactory, classFileTransformer, properties, permissionCollection); }
Source:
private ExpectedCondition<Boolean> invisibilityOfAllElements(final List<WebElement> elements) { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver webDriver) { for (WebElement element : elements) { try { if (element.isDisplayed()) { return false; } } catch (Exception e) { } } return true; } }; }

Target:
private ExpectedCondition<Boolean> invisibilityOfAllElements(final List<WebElement> elements) { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver webDriver) { for (WebElement element : elements) { try { if (element.isDisplayed()) { return false; } } catch (Exception e) { } } return true; } @Override public String toString() { return "invisibility of all elements " + elements; } }; }
Source:
private <V> V as(TypeToken<V> javaType) { if (OBJECT_TYPE.equals(javaType)) { @SuppressWarnings("unchecked") V v = (V)asObject(); return v; } else { assert javaType != null; return with(codecFor(javaType)); } }

Target:
private <V> V as(TypeToken<V> javaType) { return with(codecFor(javaType)); }
Source:
public void setUp() throws Exception { MetadataStorageConnectorConfig config = jsonReadWriteRead( "{" + "\"type\" : \"db\",\n" + "\"segmentTable\" : \"segments\"\n" + "}", MetadataStorageConnectorConfig.class ); connector = new TestDerbyConnector( Suppliers.ofInstance(config), Suppliers.ofInstance(tablesConfig) ); }

Target:
public void setUp() throws Exception { connector = new TestDerbyConnector( Suppliers.ofInstance(new MetadataStorageConnectorConfig()), Suppliers.ofInstance(tablesConfig) ); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.login_email_screen, container, false); mEmailEditText = (EditText) rootView.findViewById(R.id.login_email); mEmailEditText.addTextChangedListener(this); mEmailEditTextLayout = (TextInputLayout) rootView.findViewById(R.id.login_email_layout); mNextButton = (Button) rootView.findViewById(R.id.login_email_next_button); mNextButton.setOnClickListener(mNextClickListener); mUsernamePasswordButton = rootView.findViewById(R.id.login_email_username_password); mEmailEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { autocorrectEmail(); } } }); autofillFromBuildConfig(); mEmailEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((didPressNextKey(actionId, event) || didPressEnterKey(actionId, event))) { next(getEmail()); return true; } else { return false; } } }); mUsernamePasswordButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLoginNavInputEmail != null) { mLoginNavInputEmail.loginViaUsernamePassword(); } } }); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.login_email_screen, container, false); mEmailEditText = (EditText) rootView.findViewById(R.id.login_email); mEmailEditTextLayout = (TextInputLayout) rootView.findViewById(R.id.login_email_layout); mNextButton = (Button) rootView.findViewById(R.id.login_email_next_button); mNextButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { next(getCleanedEmail()); } }); autoFillFromBuildConfig(); mEmailEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (event != null && event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { next(getCleanedEmail()); } return true; } }); rootView.findViewById(R.id.login_email_username_password).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLoginNavInputEmail != null) { mLoginNavInputEmail.loginViaUsernamePassword(); } } }); return rootView; }
Source:
private static boolean thatSupportForNestedPropertiesIsAvailable() { Optional<String> version = Optional.ofNullable(SpringBootVersion.getVersion()); return version.map(v -> v.split("\\.")) .filter(c -> c.length >= 3) .map(v -> new Integer[] { Integer.valueOf(v[0]), Integer.valueOf(v[1]), Integer.valueOf(v[2]) }) .map(c -> c[0] >= 2 && (c[1] >= 1 || c[1] == 0 && c[2] >= 5)) .orElseGet(ActorRepositoryIntegrationTest::boot210Or205SpecificMethodExists); }

Target:
private static boolean thatSupportForNestedPropertiesIsAvailable() { Version minVersion = Version.parse("2.0.5"); Optional<String> currentSpringBootVersion = Optional.ofNullable(SpringBootVersion.getVersion()); return currentSpringBootVersion.map(Version::parse) .map(v -> v.isGreaterThanOrEqualTo(minVersion)) .orElseGet(ActorRepositoryIntegrationTest::fallBackToVersionSpecificClasses); }
Source:
public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) { if (StringUtils.isBlank(accountingXmlDocumentBackupLink.getCredentialGroupCode())) { LOG.error("createAttachmentFromBackupLink, the Credential Group Code is blank"); throw new ValidationException("Unable to download attachment with blank Credential Group Code: " + accountingXmlDocumentBackupLink.getLinkUrl()); } try { byte[] formFile = downloadByteArray(accountingXmlDocumentBackupLink); if (formFile.length > 0) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(uploadFileName); int fileSize = (int) formFile.length; String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream inputStream = new ByteArrayInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, inputStream, attachmentType); return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); throw new ValidationException("The form file is NULL: " + accountingXmlDocumentBackupLink.getLinkUrl()); } } catch (IOException e) { LOG.error("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); throw new ValidationException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); } }

Target:
public Attachment createAttachmentFromBackupLink(Document document, AccountingXmlDocumentBackupLink accountingXmlDocumentBackupLink) { if (StringUtils.isBlank(accountingXmlDocumentBackupLink.getCredentialGroupCode())) { LOG.error("createAttachmentFromBackupLink, the Credential Group Code is blank"); throw new ValidationException("Unable to download attachment with blank Credential Group Code: " + accountingXmlDocumentBackupLink.getLinkUrl()); } try { byte[] formFile = downloadByteArray(accountingXmlDocumentBackupLink); if (formFile.length > 0) { String uploadFileName = accountingXmlDocumentBackupLink.getFileName(); String mimeType = URLConnection.guessContentTypeFromName(uploadFileName); int fileSize = (int) formFile.length; String attachmentType = null; if (LOG.isDebugEnabled()) { LOG.debug("createAttachmentFromBackupLink, uploadFileName: " + uploadFileName + " mimeType: " + mimeType + " fileSize: " + fileSize); } InputStream inputStream = new ByteArrayInputStream(formFile); Attachment attachment = attachmentService.createAttachment(document, uploadFileName, mimeType, fileSize, inputStream, attachmentType); return attachment; } else { LOG.error("createAttachmentFromBackupLink, the form file is NULL"); throw new ValidationException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); } } catch (IOException e) { LOG.error("createAttachmentFromBackupLink, Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl(), e); throw new ValidationException("Unable to download attachment: " + accountingXmlDocumentBackupLink.getLinkUrl()); } }
Source:
public void waitForJavaScriptTruthy(final String script) { driver.manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS); try { waitFor.until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { try { return (boolean) ((JavascriptExecutor) driver) .executeScript("return !!(" + script + ");"); } catch (WebDriverException e) { PageObjectLogging.logError("waitForJavaScriptTruthy", e); PageObjectLogging.log("Checking script to be truthy", script, false); return false; } } }); } finally { PageObjectLogging.log("Checking script to be truthy", script, true); restoreDeaultImplicitWait(); } }

Target:
public void waitForJavaScriptTruthy(final String script) { driver.manage().timeouts().implicitlyWait(500, TimeUnit.MILLISECONDS); try { waitFor.until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver driver) { try { return (boolean) ((JavascriptExecutor) driver) .executeScript("return !!(" + script + ");"); } catch (WebDriverException e) { PageObjectLogging.logError("waitForJavaScriptTruthy", e); return false; } } }); } finally { restoreDeaultImplicitWait(); } }
Source:
public void addRefundTransactionEvent(Long transactionId, RefundStatus refundStatus, ZonedDateTime updated) { jdbi.withHandle(h -> { int update = h.update( "INSERT INTO transaction_events(" + "transaction_id," + "status," + "updated," + "operation" + ")" + "VALUES (" + "?, ?, ?, 'REFUND'" + ")", transactionId, refundStatus.name(), Timestamp.from(updated.toInstant()) ); System.out.println("****************updated: " + update); return update; } ); }

Target:
public void addRefundTransactionEvent(Long transactionId, RefundStatus refundStatus, ZonedDateTime updated) { jdbi.withHandle(h -> h.update( "INSERT INTO transaction_events(" + "transaction_id," + "status," + "updated," + "operation" + ")" + "VALUES (" + "?, ?, ?, 'REFUND'" + ")", transactionId, refundStatus.name(), Timestamp.from(updated.toInstant()) ) ); }
Source:
private MetadataInterface findMetadatumIn(DocStructInterface node) { List<? extends MetadataInterface> metadataInterface = node.getAllMetadataByType(selector); for (MetadataInterface metadatum : metadataInterface) { if (selector.getName().equals(metadatum.getMetadataType().getName())) { return metadatum; } } return null; }

Target:
private MetadataInterface findMetadatumIn(DocStructInterface node) { List<? extends MetadataInterface> metadata = node.getAllMetadataByType(selector); for (MetadataInterface metadatum : metadata) { if (selector.getName().equals(metadatum.getMetadataType().getName())) { return metadatum; } } return null; }
Source:
public void selectionChanged(IWorkbenchPart part, ISelection selection) { final ISelection sel = selection; Job job = new Job(UIText.RepositorySourceProvider_updateRepoSelection) { @Override protected IStatus run(IProgressMonitor monitor) { Repository newRepository; if (sel == null) { newRepository = null; } else { newRepository = SelectionUtils.getRepository( SelectionUtils.getStructuredSelection(sel)); } if (repository != newRepository) { repository = newRepository; fireSourceChanged(ISources.ACTIVE_WORKBENCH_WINDOW, REPOSITORY_PROPERTY, repository); } return Status.OK_STATUS; } }; job.schedule(); }

Target:
public void selectionChanged(IWorkbenchPart part, ISelection selection) { if (updateSelectionJob != null) { updateSelectionJob.cancel(); } final ISelection sel = selection; updateSelectionJob = new Job( UIText.RepositorySourceProvider_updateRepoSelection) { @Override protected IStatus run(IProgressMonitor monitor) { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } Repository newRepository; if (sel == null) { newRepository = null; } else { newRepository = SelectionUtils.getRepository( SelectionUtils.getStructuredSelection(sel)); } if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } if (repository != newRepository) { repository = newRepository; fireSourceChanged(ISources.ACTIVE_WORKBENCH_WINDOW, REPOSITORY_PROPERTY, repository); } return Status.OK_STATUS; } }; updateSelectionJob.setSystem(true); updateSelectionJob.setUser(false); updateSelectionJob.schedule(); }
Source:
void attach() { vungleBannerAd.attach(); }

Target:
void attach() { if (vungleBannerAd != null) { vungleBannerAd.attach(); } }
Source:
public void addCompareInputChangeListener(ICompareInputChangeListener listener) { if (!containsListener(listener)) { listeners.add(listener); } }

Target:
public void addCompareInputChangeListener(ICompareInputChangeListener listener) { listeners.add(listener); }
Source:
public ATCommandResponsePacket(int frameID, ATCommandStatus status, String command, byte[] commandData) { super(XBeeAPIType.AT_COMMAND_RESPONSE); this.frameID = frameID; this.status = status; this.command = command; this.commandData = commandData; }

Target:
public ATCommandResponsePacket(int frameID, ATCommandStatus status, String command, byte[] commandData) { super(APIFrameType.AT_COMMAND_RESPONSE); if (command == null) throw new NullPointerException("Command cannot be null."); if (status == null) throw new NullPointerException("Command status cannot be null."); if (frameID < 0 || frameID > 255) throw new IllegalArgumentException("Frame ID must be between 0 and 255."); this.frameID = frameID; this.status = status; this.command = command; this.commandData = commandData; }
Source:
public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: toggleNavigationDrawer(!isDrawerOpen()); return true; case R.id.ab_action_refresh: Log.d("YOLO", "Refreshing..."); BusProvider.getInstance().post(new RefreshEvent()); return true; case R.id.ab_action_select_user: startActivityForResult( new Intent(this, LoginActivity.class), LoginActivity.REQUEST_PROFILE ); return true; case R.id.ab_action_about: startActivity(new Intent(this, AppInfoActivity.class)); return true; case R.id.ab_action_logout: showToast("TODO: Logout functionality"); return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: toggleNavigationDrawer(!isDrawerOpen()); return true; case R.id.ab_action_refresh: BusProvider.getInstance().post(new RefreshEvent()); return true; case R.id.ab_action_select_user: startActivityForResult( new Intent(this, LoginActivity.class), LoginActivity.REQUEST_PROFILE ); return true; case R.id.ab_action_about: startActivity(new Intent(this, AppInfoActivity.class)); return true; case R.id.ab_action_logout: showToast("TODO: Logout functionality"); return true; default: return super.onOptionsItemSelected(item); } }
Source:
AmbryDataNode(String dataCenterName, ClusterMapConfig clusterMapConfig, String hostName, int portNum, String rackId, Integer sslPortNum, long xid, ClusterManagerCallback clusterManagerCallback) throws Exception { this.hostName = hostName; this.plainTextPort = new Port(portNum, PortType.PLAINTEXT); this.sslPort = sslPortNum != null ? new Port(sslPortNum, PortType.SSL) : null; this.dataCenterName = dataCenterName; this.rackId = rackId; this.xid = xid; this.sslEnabledDataCenters = Utils.splitString(clusterMapConfig.clusterMapSslEnabledDatacenters, ","); ResourceStatePolicyFactory resourceStatePolicyFactory = Utils.getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.AVAILABLE, clusterMapConfig); this.resourceStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); this.clusterManagerCallback = clusterManagerCallback; validateHostName(clusterMapConfig.clusterMapResolveHostnames, hostName); validatePort(plainTextPort, sslPort, sslEnabledDataCenters.contains(dataCenterName)); }

Target:
AmbryDataNode(String dataCenterName, ClusterMapConfig clusterMapConfig, String hostName, int portNum, String rackId, Integer sslPortNum, long xid, ClusterManagerCallback clusterManagerCallback) throws Exception { this.hostName = hostName; this.plainTextPort = new Port(portNum, PortType.PLAINTEXT); this.sslPort = sslPortNum != null ? new Port(sslPortNum, PortType.SSL) : null; this.dataCenterName = dataCenterName; this.rackId = rackId; this.xid = xid; this.sslEnabledDataCenters = Utils.splitString(clusterMapConfig.clusterMapSslEnabledDatacenters, ","); ResourceStatePolicyFactory resourceStatePolicyFactory = Utils.getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.AVAILABLE, clusterMapConfig); this.resourceStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); this.clusterManagerCallback = clusterManagerCallback; validateHostName(clusterMapConfig.clusterMapResolveHostnames, hostName); validatePorts(plainTextPort, sslPort, sslEnabledDataCenters.contains(dataCenterName)); }
Source:
private void maybeInitTxns() { if (eosEnabled) { try { producer.initTransactions(); } catch (final TimeoutException exception) { final String errorMessage = "Timeout exception caught when initializing transactions for task " + taskId + ". " + "\nThe broker is either slow or in bad state (like not having enough replicas) in responding the request, " + "or the connection to broker was interrupted sending the request or receiving the response. " + "\n Consider overwriting `max.block.ms` to a larger value to avoid timeout errors"; throw new StreamsException(errorMessage, exception); } catch (final KafkaException exception) { throw new StreamsException("Error encountered while initializing transactions for task " + taskId, exception); } } }

Target:
private void maybeInitTxns() { if (eosEnabled) { try { producer.initTransactions(); } catch (final TimeoutException exception) { final String errorMessage = "Timeout exception caught when initializing transactions for task " + taskId + ". " + "\nThe broker is either slow or in bad state (like not having enough replicas) in responding to the request, " + "or the connection to broker was interrupted sending the request or receiving the response. " + "\n Consider overwriting `max.block.ms` to a larger value to avoid timeout errors"; throw new StreamsException(errorMessage, exception); } catch (final KafkaException exception) { throw new StreamsException("Error encountered while initializing transactions for task " + taskId, exception); } } }
Source:
private Command handleFilteredNotification(final Notification notification) { IRefactorService refactorService = getRefactorService(); INotificationMatch match = filter.getMatch(notification); Command command = null; if (null != refactorService && null != match) { IRefactorRequest refactorRequest = new EMFRefactorRequest((EObject) match.getObjectUnderMatch()); refactorRequest.setRefactorResource(match.getResourceUnderMatch()); command = refactorService.getRefactorCommand(refactorRequest); } return command; }

Target:
private Command handleFilteredNotification(final Notification notification) throws RollbackException { INotificationMatcher match = filter.getMatcher(notification); Command command = null; if (null != match) { IRefactorService refactorService = getRefactorService(); if (!unavailableService) { try { IRefactorRequest refactorRequest = new EMFRefactorRequest((EObject) match.getObjectUnderMatch()); refactorRequest.setRefactorResource(match.getResourceUnderMatch().getURI()); refactorRequest.setType(RefactorType.MOVE); command = refactorService.getRefactorCommand(refactorRequest); } catch (ServiceException e) { throw new RollbackException(new RollbackStatus(Activator.PLUGIN_ID, Status.ERROR, e.getMessage())); } } } return command; }
Source:
public void setUp() throws Exception { TestAccount user = accounts.create("user", "user@example.com", "User"); userSession = new RestSession(server, user); }

Target:
public void setUp() throws Exception { TestAccount user = accounts.create("user", "user@example.com", "User"); TestAccount admin = accounts.admin(); userSession = new RestSession(server, user); adminSession = new RestSession(server, admin); }
Source:
Job createJob(final String name, final JobCounter jc) { return new Job("Job 1") { @Override protected IStatus run(IProgressMonitor monitor) { jc.jobDone(getName()); return Status.OK_STATUS; } }; }

Target:
Job createJob(final String name, final JobCounter jc) { return new Job(name) { @Override protected IStatus run(IProgressMonitor monitor) { jc.jobDone(getName()); return Status.OK_STATUS; } }; }
Source:
public void doAccept(String method, Object... params) throws ForbiddenException { String workspaceId; switch (method) { case BROKER_STATUS_CHANGED_METHOD: case BROKER_RESULT_METHOD: workspaceId = ((BrokerStatusChangedEvent) params[0]).getRuntimeId().getWorkspaceId(); break; default: throw new ForbiddenException("Unknown method is configured to be filtered."); } Subject currentSubject = EnvironmentContext.getCurrent().getSubject(); if (!currentSubject.hasPermission( WorkspaceDomain.DOMAIN_ID, workspaceId, WorkspaceDomain.RUN)) { throw new ForbiddenException( "User doesn't have the required permissions to the specified workspace"); } }

Target:
public void doAccept(String method, Object... params) throws ForbiddenException { String workspaceId; switch (method) { case BROKER_STATUS_CHANGED_METHOD: case BROKER_RESULT_METHOD: RuntimeIdentityDto runtimeId = ((BrokerStatusChangedEvent) params[0]).getRuntimeId(); if (runtimeId == null || runtimeId.getWorkspaceId() == null) { throw new ForbiddenException("Workspace id must be specified"); } workspaceId = runtimeId.getWorkspaceId(); break; default: throw new ForbiddenException("Unknown method is configured to be filtered."); } Subject currentSubject = EnvironmentContext.getCurrent().getSubject(); if (!currentSubject.hasPermission( WorkspaceDomain.DOMAIN_ID, workspaceId, WorkspaceDomain.RUN)) { throw new ForbiddenException( "User doesn't have the required permissions to the specified workspace"); } }
Source:
private AbstractArrowSourceFunction<T> createTestArrowSourceFunction( List<T> testData, int batches) throws IOException { RowType rowType = (RowType) dataType.getLogicalType(); VectorSchemaRoot root = VectorSchemaRoot.create( ArrowUtils.toArrowSchema(rowType), allocator); ArrowWriter<T> arrowWriter = createArrowWriter(root, rowType); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ArrowStreamWriter arrowStreamWriter = new ArrowStreamWriter(root, null, baos); arrowStreamWriter.start(); List<List<T>> subLists = Lists.partition(testData, testData.size() / batches + 1); for (List<T> subList : subLists) { for (T value : subList) { arrowWriter.write(value); } arrowWriter.finish(); arrowStreamWriter.writeBatch(); arrowWriter.reset(); } AbstractArrowSourceFunction<T> arrowSourceFunction = createArrowSourceFunction( ArrowUtils.readArrowBatches( Channels.newChannel(new ByteArrayInputStream(baos.toByteArray())))); arrowSourceFunction.setRuntimeContext(Mockito.mock(RuntimeContext.class)); return arrowSourceFunction; }

Target:
private AbstractArrowSourceFunction<T> createTestArrowSourceFunction( List<T> testData, int batches) throws IOException { ArrowWriter<T> arrowWriter = createArrowWriter(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ArrowStreamWriter arrowStreamWriter = new ArrowStreamWriter(root, null, baos); arrowStreamWriter.start(); List<List<T>> subLists = Lists.partition(testData, testData.size() / batches + 1); for (List<T> subList : subLists) { for (T value : subList) { arrowWriter.write(value); } arrowWriter.finish(); arrowStreamWriter.writeBatch(); arrowWriter.reset(); } AbstractArrowSourceFunction<T> arrowSourceFunction = createArrowSourceFunction( ArrowUtils.readArrowBatches( Channels.newChannel(new ByteArrayInputStream(baos.toByteArray())))); arrowSourceFunction.setRuntimeContext(Mockito.mock(RuntimeContext.class)); return arrowSourceFunction; }
Source:
public ProcessUpdateResult processUpdate( final ProcessUpdateParams params ) { final Site editedSite = (Site) params.getEditedContent(); final SiteConfigs editedSiteConfigs = editedSite.getSiteConfigs(); final Site originalSite = (Site) params.getOriginalContent(); final SiteConfigs originalSiteConfigs = originalSite.getSiteConfigs(); final Context context = ContextAccessor.current(); final AuthenticationInfo authenticationInfo = context.getAuthInfo(); final ProjectName projectName = ProjectName.from( context.getRepositoryId() ); if ( !Objects.equals( originalSiteConfigs, editedSiteConfigs ) ) { if ( !this.projectPermissionsContextManager.hasAdminAccess( authenticationInfo ) ) { if ( ProjectConstants.DEFAULT_PROJECT_NAME.equals( projectName ) ) { throw new ProjectAccessRequiredException( authenticationInfo.getUser().getKey() ); } else if ( !this.projectPermissionsContextManager.hasAnyProjectPermission( projectName, authenticationInfo, Set.of( ProjectRole.OWNER ) ) ) { throw new ProjectAccessRequiredException( authenticationInfo.getUser().getKey(), ProjectRole.OWNER ); } } } return null; }

Target:
public ProcessUpdateResult processUpdate( final ProcessUpdateParams params ) { final Site editedSite = (Site) params.getEditedContent(); final SiteConfigs editedSiteConfigs = editedSite.getSiteConfigs(); final Site originalSite = (Site) params.getOriginalContent(); final SiteConfigs originalSiteConfigs = originalSite.getSiteConfigs(); final Context context = ContextAccessor.current(); final AuthenticationInfo authenticationInfo = context.getAuthInfo(); final ProjectName projectName = ProjectName.from( context.getRepositoryId() ); if ( !Objects.equals( originalSiteConfigs, editedSiteConfigs ) ) { if ( !ProjectAccessHelper.hasAdminAccess( authenticationInfo ) ) { if ( ProjectConstants.DEFAULT_PROJECT_NAME.equals( projectName ) ) { throw new ProjectAccessRequiredException( authenticationInfo.getUser().getKey() ); } else if ( !this.projectPermissionsContextManager.hasAnyProjectRole( authenticationInfo, projectName, Set.of( ProjectRole.OWNER ) ) ) { throw new ProjectAccessRequiredException( authenticationInfo.getUser().getKey(), ProjectRole.OWNER ); } } } return null; }
Source:
public Class<? extends TestEntity> getJavaClass() { return TestEntity.class; }

Target:
public Class<TestEntity> getJavaClass() { return TestEntity.class; }
Source:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQueryAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); when(storIOSQLite.internal()).thenReturn(internal); when(storIOSQLite.observeChangesInTables(any(Set.class))) .thenReturn(Observable.empty()); final TestSubscriber<TestItem> testSubscriber = new TestSubscriber<TestItem>(); storIOSQLite .get() .object(TestItem.class) .withQuery(Query.builder().table("test_table").build()) .prepare() .createObservable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) .hasCauseInstanceOf(IllegalStateException.class); verify(storIOSQLite).get(); verify(storIOSQLite).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).query(any(Query.class)); verify(storIOSQLite).observeChangesInTables(anySet()); verifyNoMoreInteractions(storIOSQLite, internal); }

Target:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithQueryAsObservable() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); when(storIOSQLite.internal()).thenReturn(internal); when(storIOSQLite.observeChangesInTables(any(Set.class))) .thenReturn(Observable.empty()); final TestSubscriber<TestItem> testSubscriber = new TestSubscriber<TestItem>(); storIOSQLite .get() .object(TestItem.class) .withQuery(Query.builder().table("test_table").build()) .prepare() .createObservable() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) .hasCauseInstanceOf(IllegalStateException.class) .hasMessageEndingWith("This type does not have type mapping: " + "type = " + TestItem.class + "," + "db was not touched by this operation, please add type mapping for this type"); verify(storIOSQLite).get(); verify(storIOSQLite).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).query(any(Query.class)); verify(storIOSQLite).observeChangesInTables(anySet()); verifyNoMoreInteractions(storIOSQLite, internal); }
Source:
default void setRetryAnalyzerClass(Class<? extends IRetryAnalyzer> clazz)

Target:
default void setRetryAnalyzerClass(Class<? extends IRetryAnalyzer> clazz) { setRetryAnalyzer(ClassHelper.newInstance(clazz)); }
Source:
public Parameter[] getParameters() { return new Parameter[]{ ParameterBuilder.create(ON+DESKTOP).label("Turn this test ON for desktop").matching("(YES|NO)") .description("Test will be off by default enter 'YES' in box above to enable"), ParameterBuilder.create(ON+TABLET).label("Turn this test ON for Tablet").matching("(YES|NO)") .description( "Test will be off by default enter 'YES' in box above to enable"), ParameterBuilder.create(ON+MOBILE).label("Turn this test ON for Mobile").matching("(YES|NO)") .description( "Test will be off by default enter 'YES' in box above to enable") }; }

Target:
public Parameter[] getParameters() { return new Parameter[]{ ParameterBuilder.create(NORMAL.name()) .label("Turn this feature ON for desktop").matching("(?i)(YES|NO)") .description("Feature will be off by default enter 'YES' in box above to enable"), ParameterBuilder.create(TABLET.name()) .label("Turn this feature ON for Tablet").matching("(?i)(YES|NO)") .description("Feature will be off by default enter 'YES' in box above to enable"), ParameterBuilder.create(MOBILE.name()) .label("Turn this feature ON for Mobile").matching("(?i)(YES|NO)") .description("Feature will be off by default enter 'YES' in box above to enable") }; }
Source:
public void setChangesPanelView(ChangesPanelView changesPanelView) { FlowPanel flowPanel = new FlowPanel(); flowPanel.ensureDebugId("git-compare-window-changed_files"); flowPanel.setWidth("600px"); flowPanel.setHeight("345px"); flowPanel.add((Widget) changesPanelView); this.setWidget(flowPanel); }

Target:
public void setChangesPanelView(ChangesPanelView changesPanelView) { FlowPanel flowPanel = new FlowPanel(); flowPanel.ensureDebugId("git-compare-window-changed-files"); flowPanel.setWidth("600px"); flowPanel.setHeight("345px"); flowPanel.add((Widget) changesPanelView); this.setWidget(flowPanel); }
Source:
public void testBackwardsClock() { int numIterations = 10000; Set<Long> idSet = new HashSet<Long>(numIterations); TimeProvider tp = new TimeProvider() { Random random = new Random(1); @Override public long getTimeInMillis() { if (random.nextInt(1000) == 1) { return System.currentTimeMillis() - 5; } return System.currentTimeMillis(); } }; IdGenerator idgen = new IdGenerator(0L, tp); for (int i = 0; i < numIterations; ++i) { assertTrue(idSet.add(idgen.getNextId())); } assertEquals(numIterations, idSet.size()); }

Target:
public void testBackwardsClock() { int numIterations = 10000; Set<Long> idSet = new HashSet<Long>(numIterations); TimeProvider tp = new TimeProvider() { private int counter = 0; @Override public long getTimeInMillis() { if ((counter++ % 109) == 0) { return System.currentTimeMillis() - 5; } return System.currentTimeMillis(); } }; IdGenerator idgen = new IdGenerator(0L, tp); for (int i = 0; i < numIterations; ++i) { assertTrue(idSet.add(idgen.getNextId())); } assertEquals(numIterations, idSet.size()); }
Source:
public boolean initialize(AndroidCommCarePlatform platform, boolean isUpgrade) throws IOException, InvalidReferenceException, InvalidStructureException, XmlPullParserException, UnfullfilledRequirementsException { super.initialize(platform, isUpgrade); if (platform.getFormDefId(namespace) == -1) { platform.registerXmlns(namespace, formDefId); } else { FormDefRecord existingForm = FormDefRecord.getFormDef(platform.getFormDefStorage(), platform.getFormDefId(namespace)); FormDefRecord newForm = FormDefRecord.getFormDef(platform.getFormDefStorage(), formDefId); if (newForm.getResourceVersion() > existingForm.getResourceVersion()) { platform.registerXmlns(namespace, formDefId); } } return true; }

Target:
public boolean initialize(AndroidCommCarePlatform platform, boolean isUpgrade) throws IOException, InvalidReferenceException, InvalidStructureException, XmlPullParserException, UnfullfilledRequirementsException { super.initialize(platform, isUpgrade); if (platform.getFormDefId(namespace) == -1) { platform.registerXmlns(namespace, formDefId); } else { FormDefRecord existingForm = FormDefRecord.getFormDef(platform.getFormDefStorage(), platform.getFormDefId(namespace)); FormDefRecord newForm = FormDefRecord.getFormDef(platform.getFormDefStorage(), formDefId); if (newForm.getResourceVersion() >= existingForm.getResourceVersion()) { platform.registerXmlns(namespace, formDefId); } } return true; }
Source:
private int evaluateExpressionForNumericResult( final Message<?> requestMessage, Expression expression) { int firstResult = 0; Object evaluationResult = expression.getValue(evaluationContext, requestMessage); if(evaluationResult != null) { if(evaluationResult instanceof Number) { firstResult = ((Number)evaluationResult).intValue(); } else if(evaluationResult instanceof String){ try { firstResult = Integer.parseInt((String)evaluationResult); } catch (NumberFormatException e) { throw new IllegalArgumentException( "Value " + evaluationResult + " passed as cannot be " + "parsed to a number, expected to be numeric"); } } else { throw new IllegalArgumentException("Expected the value to be a Number" + " got " + evaluationResult.getClass().getName()); } } return firstResult; }

Target:
private int evaluateExpressionForNumericResult(final Message<?> requestMessage, Expression expression) { int evaluatedResult = 0; if(expression != null) { Object evaluationResult = expression.getValue(evaluationContext, requestMessage); if(evaluationResult != null) { if(evaluationResult instanceof Number) { evaluatedResult = ((Number) evaluationResult).intValue(); } else if(evaluationResult instanceof String){ try { evaluatedResult = Integer.parseInt((String)evaluationResult); } catch (NumberFormatException e) { throw new IllegalArgumentException( "Value " + evaluationResult + " passed as cannot be " + "parsed to a number, expected to be numeric"); } } else { throw new IllegalArgumentException("Expected the value to be a Number" + " got " + evaluationResult.getClass().getName()); } } } return evaluatedResult; }
Source:
private void registerWithToken(final Exchange exchange) { enableStatus = true; Request request = exchange.getCurrentRequest(); Token token = request.getToken(); if (token == null) { do { token = tokenGenerator.createToken(false); request.setToken(token); } while (exchangesByToken.putIfAbsent(token, exchange) != null); LOGGER.debug("exchange added with gnerated token {}, {}", token, request); } else { if (token.isEmpty() && request.getCode() == null) { return; } Exchange previous = exchangesByToken.put(token, exchange); if (previous == null) { BlockOption block2 = request.getOptions().getBlock2(); if (block2 != null && block2.getNum() > 1) { LOGGER.warn("New exchange for ongoing blockwise transfer: {}, block {}", token, block2.getNum()); } else { LOGGER.debug("exchange added with token {}, {}", token, request); } } else if (previous != exchange) { if (exchange.getFailedTransmissionCount() == 0 && !request.getOptions().hasBlock1() && !request.getOptions().hasBlock2() && !request.getOptions().hasObserve()) { LOGGER.warn("manual token overrides existing open request: {}", token); } else { LOGGER.debug("exchange replaced with token {}, {}", token, request); } } } }

Target:
private void registerWithToken(final Exchange exchange) { enableStatus = true; Request request = exchange.getCurrentRequest(); Token token = request.getToken(); if (token == null) { do { token = tokenGenerator.createToken(false); request.setToken(token); } while (exchangesByToken.putIfAbsent(token, exchange) != null); LOGGER.debug("exchange added with generated token {}, {}", token, request); } else { if (token.isEmpty() && request.getCode() == null) { return; } Exchange previous = exchangesByToken.put(token, exchange); if (previous == null) { BlockOption block2 = request.getOptions().getBlock2(); if (block2 != null) { LOGGER.debug("block2 exchange for block add with token {}", block2.getNum(), token); } else { LOGGER.debug("exchange added with token {}, {}", token, request); } } else if (previous != exchange) { if (exchange.getFailedTransmissionCount() == 0 && !request.getOptions().hasBlock1() && !request.getOptions().hasBlock2() && !request.getOptions().hasObserve()) { LOGGER.warn("manual token overrides existing open request: {}", token); } else { LOGGER.debug("exchange replaced with token {}, {}", token, request); } } else { LOGGER.debug("exchange kept for {}, {}", token, request); } } }
Source:
private static Map<Integer, TurboMilestone> getMilestoneAliasIndex(List<TurboMilestone> milestones) { List<TurboMilestone> sortedMilestones = TurboMilestone.getSortedMilestonesByDueDate(milestones); Optional<Integer> currentMilestoneIndex = getCurrentMilestoneIndex(sortedMilestones); return IntStream .range(0, sortedMilestones.size()) .boxed() .collect(Collectors.toMap( i -> i - currentMilestoneIndex.get(), i -> sortedMilestones.get(i))); }

Target:
private static Map<Integer, TurboMilestone> getMilestoneAliasIndex(List<TurboMilestone> milestones) { List<TurboMilestone> sortedMilestones = TurboMilestone.sortByDueDate(milestones); Optional<Integer> currentMilestoneIndex = getCurrentMilestoneIndex(sortedMilestones); assert currentMilestoneIndex.isPresent() || !currentMilestoneIndex.isPresent() && sortedMilestones.isEmpty(); return IntStream .range(0, sortedMilestones.size()) .boxed() .collect(Collectors.toMap( i -> i - currentMilestoneIndex.get(), i -> sortedMilestones.get(i))); }
Source:
private void checkNoMaterialize(Sql sql) { final TestConfig testConfig = build(sql); final List<RelNode> results = optimize(testConfig); if (results.isEmpty() || (results.size() == 1 && !RelOptUtil.toString(results.get(0)).contains("MV0"))) { return; } final StringBuilder errMsgBuilder = new StringBuilder(); errMsgBuilder.append("Optimization succeeds out of expectation: "); for (RelNode res: results) { errMsgBuilder.append(RelOptUtil.toString(res)).append("\n"); } throw new AssertionError(errMsgBuilder.toString()); }

Target:
private void checkNoMaterialize(Sql sql) { final TestConfig testConfig = build(sql); final List<RelNode> results = optimize(testConfig); if (results.isEmpty() || (results.size() == 1 && !RelOptUtil.toString(results.get(0)).contains("MV0"))) { return; } final StringBuilder errMsgBuilder = new StringBuilder(); errMsgBuilder.append("Optmization succeeds out of expectation: "); for (RelNode res: results) { errMsgBuilder.append(RelOptUtil.toString(res)).append("\n"); } throw new AssertionError(errMsgBuilder.toString()); }
Source:
public static <T extends TypedSPI> T newTypedServiceInstance(final Class<T> typedService, final String type) { Class<?> instanceClass = TYPED_SERVICE_CLASSES.containsKey(typedService) ? TYPED_SERVICE_CLASSES.get(typedService).get(type) : null; if (instanceClass == null) { throw new JobConfigurationException("Cannot find a typed service class by the interface: @" + typedService.getName() + "and type: " + type); } return (T) newServiceInstance(instanceClass); }

Target:
public static <T extends TypedSPI> T newTypedServiceInstance(final Class<T> typedService, final String type) { Class<?> instanceClass = TYPED_SERVICE_CLASSES.containsKey(typedService) ? TYPED_SERVICE_CLASSES.get(typedService).get(type) : null; if (null == instanceClass) { throw new JobConfigurationException("Cannot find a typed service class by the interface: @" + typedService.getName() + "and type: " + type); } return (T) newServiceInstance(instanceClass); }
Source:
public IssueMetadata(IssueMetadata existingMetadata, String currentUser) { Date lastNonSelfUpdate = new Date(0); Date lastSelfUpdate = new Date(0); boolean isUpdatedByOthers = false; boolean isUpdatedBySelf = false; for (TurboIssueEvent event : existingMetadata.getEvents()) { if (isNewEventByOther(currentUser, event, lastNonSelfUpdate)) { lastNonSelfUpdate = event.getDate(); isUpdatedByOthers = true; } if (isNewEventBySelf(currentUser, event, lastSelfUpdate)){ lastSelfUpdate = event.getDate(); isUpdatedBySelf = true; } } for (Comment comment : existingMetadata.getComments()) { if (isNewCommentByOther(currentUser, comment, lastNonSelfUpdate)) { lastNonSelfUpdate = comment.getCreatedAt(); isUpdatedByOthers = true; } if (isNewCommentBySelf(currentUser, comment, lastSelfUpdate)){ lastSelfUpdate = comment.getCreatedAt(); isUpdatedBySelf = true; } } this.events = new ArrayList<>(existingMetadata.events); this.comments = new ArrayList<>(existingMetadata.comments); this.nonSelfUpdatedAt = LocalDateTime.ofInstant(lastNonSelfUpdate.toInstant(), ZoneId.systemDefault()); this.selfUpdatedAt = LocalDateTime.ofInstant(lastSelfUpdate.toInstant(), ZoneId.systemDefault()); this.nonSelfCommentCount = calculateCommentCount(existingMetadata.getComments(), currentUser, UpdatedKind.OTHER_UPDATED); this.selfCommentCount = calculateCommentCount(existingMetadata.getComments(), currentUser, UpdatedKind.SELF_UPDATED); this.isUpdated = true; this.isUpdatedByOthers = isUpdatedByOthers; this.isUpdatedBySelf = isUpdatedBySelf; }

Target:
public IssueMetadata(IssueMetadata existingMetadata, String currentUser) { Date lastNonSelfUpdate = new Date(0); Date lastSelfUpdate = new Date(0); boolean isUpdatedByOthers = false; boolean isUpdatedBySelf = false; for (TurboIssueEvent event : existingMetadata.getEvents()) { if (isNewEventByOther(currentUser, event, lastNonSelfUpdate)) { lastNonSelfUpdate = event.getDate(); isUpdatedByOthers = true; } if (isNewEventBySelf(currentUser, event, lastSelfUpdate)){ lastSelfUpdate = event.getDate(); isUpdatedBySelf = true; } } for (Comment comment : existingMetadata.getComments()) { if (isNewCommentByOther(currentUser, comment, lastNonSelfUpdate)) { lastNonSelfUpdate = comment.getCreatedAt(); isUpdatedByOthers = true; } if (isNewCommentBySelf(currentUser, comment, lastSelfUpdate)){ lastSelfUpdate = comment.getCreatedAt(); isUpdatedBySelf = true; } } this.events = new ArrayList<>(existingMetadata.events); this.comments = new ArrayList<>(existingMetadata.comments); this.nonSelfUpdatedAt = Utility.dateToLocalDateTime(lastNonSelfUpdate); this.selfUpdatedAt = Utility.dateToLocalDateTime(lastSelfUpdate); this.nonSelfCommentCount = calculateCommentCount(existingMetadata.getComments(), currentUser, UpdatedKind.UPDATED_BY_OTHER); this.selfCommentCount = calculateCommentCount(existingMetadata.getComments(), currentUser, UpdatedKind.UPDATED_BY_SELF); this.isUpdatedByOthers = isUpdatedByOthers; this.isUpdatedBySelf = isUpdatedBySelf; }