auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String getAdvertisedHost() { String host = System.getProperty(TcpSlaveAgentListener.class.getName()+".hostName"); if(isBlank(host)) { try { host = new URL(Jenkins.get().getRootUrl()).getHost(); } catch (MalformedURLException | NullPointerException e) { throw new IllegalStateException("Could not get TcpSlaveAgentListener host name", e); } } return host; }

Target:
private String getAdvertisedHost() { try { return (String) TcpSlaveAgentListener.class.getMethod("getAdvertisedHost").invoke(Jenkins.get().getTcpSlaveAgentListener()); } catch (NoSuchMethodException x) { } catch (Exception x) { LOGGER.log(Level.WARNING, null, x); } String host = System.getProperty(TcpSlaveAgentListener.class.getName()+".hostName"); if(StringUtils.isBlank(host)) { try { host = new URL(Jenkins.get().getRootUrl()).getHost(); } catch (MalformedURLException | NullPointerException e) { throw new IllegalStateException("Could not get TcpSlaveAgentListener host name", e); } } return host; }
Source:
private void checkSynchronizationLevel(boolean isSynchronized) { String synchronizationLabel; if (isSynchronized) { dDiagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), REPRESENTATION_NAME, SYNCHRONIZED_REPRESENTATION_INSTANCE_NAME); assertEquals("The representation should be synchronized", true, dDiagram.isSynchronized()); } else if (!isSynchronized) { dDiagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), REPRESENTATION_NAME, UNSYNCHRONIZED_REPRESENTATION_INSTANCE_NAME); assertEquals("The representation should not be synchronized", false, dDiagram.isSynchronized()); } DiagramElementMapping diagramElementMapping = getMapping(); if (diagramElementMapping instanceof ContainerMapping) { ContainerMapping containerMapping = (ContainerMapping) diagramElementMapping; if (!isSynchronized) { synchronizationLabel = "Unsynchronizable"; assertFalse("The synchronization of the mapping should be '" + synchronizationLabel + "'", containerMapping.isSynchronizationLock()); } } }

Target:
private void checkSynchronizationLevel(boolean isSynchronized) { if (isSynchronized) { dDiagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), REPRESENTATION_NAME, SYNCHRONIZED_REPRESENTATION_INSTANCE_NAME); } else if (!isSynchronized) { dDiagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), REPRESENTATION_NAME, UNSYNCHRONIZED_REPRESENTATION_INSTANCE_NAME); } String containerName = dDiagram.getContainers().get(0).getName(); ContainerMapping containerMapping = dDiagram.getContainers().get(0).getActualMapping(); DiagramElementMappingQuery mappingQuery = new DiagramElementMappingQuery(containerMapping); assertTrue("The mapping of '" + containerName + " element should be a ContainerMapping'", containerMapping instanceof ContainerMapping); if (isSynchronized) { assertTrue("Both 'DDiagram' and 'DiagramElementMapping' attributes of '" + containerName + "' container should be synchronized", mappingQuery.isSynchronizedAndCreateElement(dDiagram)); } else { assertFalse("Both 'DDiagram' and 'DiagramElementMapping' attributes of '" + containerName + "' container should be unsynchronized", mappingQuery.isSynchronizedAndCreateElement(dDiagram)); } }
Source:
private void checkExpiredKeys(int startKey, int endKey) throws Exception { for (int i = startKey; i < endKey; i++) { sbetc.setCurrentKey(Integer.toString(i)); assertTrue(ctx().isOriginalEmptyValue()); } }

Target:
private void checkExpiredKeys(int startKey, int endKey) throws Exception { for (int i = startKey; i < endKey; i++) { sbetc.setCurrentKey(Integer.toString(i)); assertTrue("Original state should be cleared", ctx().isOriginalEmptyValue()); } }
Source:
private void getBlobAndCompareContent(String blobId) throws Exception { ByteBufferAsyncWritableChannel getChannel = new ByteBufferAsyncWritableChannel(); router.getBlob(blobId).get().readInto(getChannel, null); int readBytes = 0; do { ByteBuffer buf = getChannel.getNextChunk(); while (buf.hasRemaining()) { Assert.assertEquals("Get and Put blob content should match", putContent[readBytes++], buf.get()); } getChannel.resolveOldestChunk(null); } while (readBytes < putContent.length); }

Target:
private void getBlobAndCompareContent(String blobId) throws Exception { ByteBufferAsyncWritableChannel getChannel = new ByteBufferAsyncWritableChannel(); Future<Long> readIntoFuture = router.getBlob(blobId).get().readInto(getChannel, null); int readBytes = 0; do { ByteBuffer buf = getChannel.getNextChunk(); int bufLength = buf.remaining(); Assert.assertTrue("total content read should not be greater than length of put content", readBytes + bufLength <= putContent.length); while (buf.hasRemaining()) { Assert.assertEquals("Get and Put blob content should match", putContent[readBytes++], buf.get()); } getChannel.resolveOldestChunk(null); } while (readBytes < putContent.length); Assert.assertEquals("the returned length in the future should be the length of data written", (long) readBytes, (long) readIntoFuture.get()); Assert.assertNull("There should be no more data in the channel", getChannel.getNextChunk(0)); }
Source:
private void createWindow(final long timestamp) { if (firstTimestamp == Long.MIN_VALUE) { firstTimestamp = timestamp; long temporalWindowSize = emitPeriod; while (temporalWindowSize < windowSize) { final Window<T> window = new WindowImpl<>(firstTimestamp, temporalWindowSize); windowQueue.add(window); temporalWindowSize += emitPeriod; } } final long relativeTimestamp = timestamp - firstTimestamp; while (windowCreationTime <= relativeTimestamp) { final Window<T> window = new WindowImpl<>(windowCreationTime + firstTimestamp, windowSize); windowQueue.add(window); windowCreationTime += emitPeriod; } }

Target:
private void createWindow(final long timestamp) { if (firstTimestamp == Long.MIN_VALUE) { firstTimestamp = timestamp; windowCreationTime = firstTimestamp; if (emitPeriod <= windowSize) { this.windowEmissionTime = firstTimestamp + emitPeriod; } else { this.windowEmissionTime = firstTimestamp + windowSize; } long temporalWindowSize = emitPeriod; while (temporalWindowSize < windowSize) { final Window<T> window = new WindowImpl<>(firstTimestamp, temporalWindowSize); windowQueue.add(window); temporalWindowSize += emitPeriod; } } while (windowCreationTime <= timestamp) { final Window<T> window = new WindowImpl<>(windowCreationTime, windowSize); windowQueue.add(window); windowCreationTime += emitPeriod; } }
Source:
protected void commonAssignmentCheck( AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, Tree valueTree, @CompilerMessageKey String errorKey, Object... extraArgs) { replaceSpecialIntRangeAnnotations(varType); if (valueType.getKind() == TypeKind.CHAR && valueType.hasAnnotation(getTypeFactory().UNKNOWNVAL)) { valueType.addAnnotation( getTypeFactory().createIntRangeAnnotation(Range.CHAR_EVERYTHING)); } if (valueTree.getKind() == Kind.METHOD_INVOCATION && TreeUtils.isArrayscopyOfMethodInvocation((MethodInvocationTree) valueTree) && valueType.getKind() == TypeKind.ARRAY) { List<? extends ExpressionTree> args = ((MethodInvocationTree) valueTree).getArguments(); AnnotatedTypeMirror arrType = atypeFactory.getAnnotatedType(args.get(0)); if (TreeUtils.isArrayLengthAccess(args.get(1))) { valueType = arrType; } else if (atypeFactory.getAnnotatedType(args.get(1)).getAnnotation(IntVal.class) != null) { AnnotationMirror argType = atypeFactory.getAnnotatedType(args.get(1)).getAnnotation(IntVal.class); valueType.addAnnotation( getTypeFactory() .createArrayLenAnnotation( ValueAnnotatedTypeFactory.getIntValues(argType).stream() .map(Long::intValue) .collect(Collectors.toList()))); } } super.commonAssignmentCheck(varType, valueType, valueTree, errorKey, extraArgs); }

Target:
protected void commonAssignmentCheck( AnnotatedTypeMirror varType, AnnotatedTypeMirror valueType, Tree valueTree, @CompilerMessageKey String errorKey, Object... extraArgs) { replaceSpecialIntRangeAnnotations(varType); if (valueType.getKind() == TypeKind.CHAR && valueType.hasAnnotation(getTypeFactory().UNKNOWNVAL)) { valueType.addAnnotation( getTypeFactory().createIntRangeAnnotation(Range.CHAR_EVERYTHING)); } super.commonAssignmentCheck(varType, valueType, valueTree, errorKey, extraArgs); }
Source:
public static void updateEpisodePlaybackProgress(FeedItem item, TextView txtvPos, ProgressBar episodeProgress) { FeedMedia media = item.getMedia(); episodeProgress.setVisibility(View.GONE); if (media == null) { txtvPos.setVisibility(View.GONE); return; } else { txtvPos.setVisibility(View.VISIBLE); } FeedItem.State state = item.getState(); if (state == FeedItem.State.PLAYING || state == FeedItem.State.IN_PROGRESS) { if (media.getDuration() > 0) { episodeProgress.setVisibility(View.VISIBLE); episodeProgress.setProgress((int) (((double) media .getPosition()) / media.getDuration() * 100)); txtvPos.setText(Converter.getDurationStringLong(media.getDuration() - media.getPosition())); } } else if (!media.isDownloaded()) { if (media.getSize() > 0) { txtvPos.setText(Converter.byteToString(media.getSize())); } else if(media.getSize() > Integer.MIN_VALUE) { txtvPos.setText("{fa-spinner}"); Iconify.addIcons(txtvPos); NetworkUtils.getFeedMediaSizeObservable(media) .subscribe(size -> { if (size > 0) { txtvPos.setText(Converter.byteToString(size)); } else { txtvPos.setText(""); } }); } else { txtvPos.setText(""); } } else { txtvPos.setText(Converter.getDurationStringLong(media.getDuration())); } }

Target:
public static void updateEpisodePlaybackProgress(FeedItem item, TextView txtvPos, ProgressBar episodeProgress) { FeedMedia media = item.getMedia(); episodeProgress.setVisibility(View.GONE); if (media == null) { txtvPos.setVisibility(View.GONE); return; } else { txtvPos.setVisibility(View.VISIBLE); } FeedItem.State state = item.getState(); if (state == FeedItem.State.PLAYING || state == FeedItem.State.IN_PROGRESS) { if (media.getDuration() > 0) { episodeProgress.setVisibility(View.VISIBLE); episodeProgress.setProgress((int) (((double) media .getPosition()) / media.getDuration() * 100)); txtvPos.setText(Converter.getDurationStringLong(media.getDuration() - media.getPosition())); } } else if (!media.isDownloaded()) { if (media.getSize() > 0) { txtvPos.setText(Converter.byteToString(media.getSize())); } else if(false == media.checkedOnSizeButUnknown()) { txtvPos.setText("{fa-spinner}"); Iconify.addIcons(txtvPos); NetworkUtils.getFeedMediaSizeObservable(media) .subscribe(size -> { if (size > 0) { txtvPos.setText(Converter.byteToString(size)); } else { txtvPos.setText(""); } }); } else { txtvPos.setText(""); } } else { txtvPos.setText(Converter.getDurationStringLong(media.getDuration())); } }
Source:
public void testDescribeTable() throws Exception { execute("CREATE TABLE tpch.test (test_bigint bigint, test_varchar varchar(255), test_vardiff varchar(15), test_double double, test_date date, test_integer integer, test_timestamp timestamp)"); MaterializedResult actualColumns = computeActual("DESC test").toJdbcTypes(); MaterializedResult expectedColumns = MaterializedResult.resultBuilder(getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR) .row("test_bigint", "bigint", "", "") .row("test_varchar", "varchar(255)", "", "") .row("test_vardiff", "varchar(15)", "", "") .row("test_double", "double", "", "") .row("test_date", "date", "", "") .row("test_integer", "integer", "", "") .row("test_timestamp", "timestamp", "", "") .build(); assertEquals(actualColumns, expectedColumns); assertUpdate("DROP TABLE test"); }

Target:
public void testDescribeTable() throws Exception { execute("CREATE TABLE tpch.test_describe_table (c_bigint bigint, c_varchar_255 varchar(255), c_varchar_15 varchar(15), c_double double, c_date date, c_integer integer, c_timestamp timestamp)"); MaterializedResult actualColumns = computeActual("DESC test_describe_table").toJdbcTypes(); MaterializedResult expectedColumns = MaterializedResult.resultBuilder(getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR) .row("c_bigint", "bigint", "", "") .row("c_varchar_255", "varchar(255)", "", "") .row("c_varchar_15", "varchar(15)", "", "") .row("c_double", "double", "", "") .row("c_date", "date", "", "") .row("c_integer", "integer", "", "") .row("c_timestamp", "timestamp", "", "") .build(); assertEquals(actualColumns, expectedColumns); assertUpdate("DROP TABLE test_describe_table"); }
Source:
protected String[] doGetInternalRoleListOfUserWithID(String userID, String filter) throws UserStoreException { if (Boolean.parseBoolean(realmConfig.getUserStoreProperty(MULIPLE_ATTRIBUTE_ENABLE))) { String userNameAttribute = realmConfig.getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE); if (userNameAttribute != null && userNameAttribute.trim().length() > 0) { Map<String, String> map; map = getUserPropertyValuesWithID(userID, new String[] { userNameAttribute }, null); String tempUserName = map.get(userNameAttribute); if (tempUserName != null) { userID = tempUserName; if (log.isDebugEnabled()) { log.debug("Replaced user name : " + userID + " from user property value : " + tempUserName); } } } } if (log.isDebugEnabled()) { log.debug("Retrieving internal roles for user name : " + userID + " and search filter : " + filter); } return hybridRoleManager.getHybridRoleListOfUser(userID, filter); }

Target:
protected List<String> doGetInternalRoleListOfUserWithID(String userID, String filter) throws UserStoreException { if (Boolean.parseBoolean(realmConfig.getUserStoreProperty(MULIPLE_ATTRIBUTE_ENABLE))) { String userNameAttribute = realmConfig.getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE); if (StringUtils.isNotEmpty(userNameAttribute)) { Map<String, String> map = getUserPropertyValuesWithID(userID, new String[] { userNameAttribute }, null); String tempUserName = map.get(userNameAttribute); if (tempUserName != null) { userID = tempUserName; if (log.isDebugEnabled()) { log.debug("Replaced user name : " + userID + " from user property value : " + tempUserName); } } } } if (log.isDebugEnabled()) { log.debug("Retrieving internal roles for user name : " + userID + " and search filter : " + filter); } return Arrays.asList(hybridRoleManager.getHybridRoleListOfUser(userID, filter)); }
Source:
private void updateCertificate( @NonNull String certificateId, @NonNull CertificateStatus certificateStatus) { Objects.requireNonNull(certificateId); Objects.requireNonNull(certificateStatus); Log.d(TAG, "Updating certificate status for = " + certificateId + ", to " + certificateStatus); UpdateCertificateRequest updateCertificateRequest = new UpdateCertificateRequest(); updateCertificateRequest.setCertificateId(certificateId); updateCertificateRequest.setNewStatus(certificateStatus); iot.updateCertificate(updateCertificateRequest); }

Target:
void updateCertificate( @NonNull String certificateId, @NonNull CertificateStatus certificateStatus) { Objects.requireNonNull(certificateId); Objects.requireNonNull(certificateStatus); Log.d(TAG, "Updating certificate status for = " + certificateId + ", to " + certificateStatus); UpdateCertificateRequest updateCertificateRequest = new UpdateCertificateRequest(); updateCertificateRequest.setCertificateId(certificateId); updateCertificateRequest.setNewStatus(certificateStatus); iot.updateCertificate(updateCertificateRequest); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dev_auth); String json = getIntent().getStringExtra(AsyncDevGetEmails.EMAIL_JSON); recyclerView = (RecyclerView) findViewById(R.id.devAuthRecyclerView); List<String> emails = new ArrayList<>(); int directAdminSize = 1; connectionProgressDialog = new ProgressDialog(this); connectionProgressDialog.setMessage(getString(R.string.signing_in)); try { JSONObject jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray("direct_admins"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } directAdminSize = jsonArray.length(); jsonArray = jsonObject.getJSONArray("direct_users"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } } catch (JSONException e) { ZLog.logException(e); } AuthEmailAdapter authEmailAdapter = new AuthEmailAdapter(emails, directAdminSize, DevAuthActivity.this); recyclerView.setAdapter(authEmailAdapter); authEmailAdapter.setOnItemClickListener(new AuthClickListener() { @Override public void onItemClick(String email) { if(email.contains("@")) { getApp().setEmail(email); } getServices() .loginDEV(email) .enqueue(new DefaultCallback<LoginResponse>() { @Override public void onSuccess(Call<LoginResponse> call, Response<LoginResponse> response) { super.onSuccess(call, response); getApp().setLoggedInApiKey(response.body().getApiKey()); openHome(); } }); } }); recyclerView.setLayoutManager(new LinearLayoutManager(DevAuthActivity.this) { }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dev_auth); String json = getIntent().getStringExtra(AsyncDevGetEmails.EMAIL_JSON); recyclerView = (RecyclerView) findViewById(R.id.devAuthRecyclerView); List<String> emails = new ArrayList<>(); int directAdminSize = 1; connectionProgressDialog = new ProgressDialog(this); connectionProgressDialog.setMessage(getString(R.string.signing_in)); try { JSONObject jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray("direct_admins"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } directAdminSize = jsonArray.length(); jsonArray = jsonObject.getJSONArray("direct_users"); for (int i = 0; i < jsonArray.length(); i++) { emails.add(jsonArray.get(i).toString()); } } catch (JSONException e) { ZLog.logException(e); } AuthEmailAdapter authEmailAdapter = new AuthEmailAdapter(emails, directAdminSize, DevAuthActivity.this); recyclerView.setAdapter(authEmailAdapter); authEmailAdapter.setOnItemClickListener(new AuthClickListener() { @Override public void onItemClick(String email) { if(email.contains("@")) { getApp().setEmail(email); } getServices() .loginDEV(email) .enqueue(new DefaultCallback<LoginResponse>() { @Override public void onSuccess(Call<LoginResponse> call, Response<LoginResponse> response) { getApp().setLoggedInApiKey(response.body().getApiKey()); openHome(); } }); } }); recyclerView.setLayoutManager(new LinearLayoutManager(DevAuthActivity.this) { }); }
Source:
public void onOpenReply(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus, RCClient.ErrorCodes status, String text) { RCLogger.i(TAG, "onOpenReply(): id: " + jobId + ", connectivityStatus: " + connectivityStatus + ", status: " + status + ", text: " + text); cachedConnectivityStatus = connectivityStatus; if (status != RCClient.ErrorCodes.SUCCESS) { if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, status.ordinal(), text); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(status)); } return; } state = DeviceState.READY; if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, RCClient.ErrorCodes.SUCCESS.ordinal(), RCClient.errorText(RCClient.ErrorCodes.SUCCESS)); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(status)); } registerForPush(false); }

Target:
public void onOpenReply(String jobId, RCDeviceListener.RCConnectivityStatus connectivityStatus, RCClient.ErrorCodes status, String text) { RCLogger.i(TAG, "onOpenReply(): id: " + jobId + ", connectivityStatus: " + connectivityStatus + ", status: " + status + ", text: " + text); cachedConnectivityStatus = connectivityStatus; if (isServiceAttached) { listener.onInitialized(this, connectivityStatus, status.ordinal(), text); } else { RCLogger.w(TAG, "RCDeviceListener event suppressed since Restcomm Client Service not attached: onInitialized(): " + RCClient.errorText(status)); } if (status == RCClient.ErrorCodes.SUCCESS){ state = DeviceState.READY; } else { return; } registerForPush(false); }
Source:
public File generateDocket(DocketData docketData, URI xslFileUri) throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket.pdf"); FileOutputStream fileOutputStream = new FileOutputStream(file); try { exportDocket.startExport(docketData, fileOutputStream, new File(xslFileUri)); } catch (IOException e) { throw new IOException(e.getMessage()); } finally { fileOutputStream.flush(); fileOutputStream.close(); } return file; }

Target:
public File generateDocket(DocketData docketData, URI xslFileUri) throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket.pdf"); try (FileOutputStream fileOutputStream = new FileOutputStream(file)) { exportDocket.startExport(docketData, fileOutputStream, new File(xslFileUri)); } catch (IOException e) { throw new IOException(e.getMessage()); } return file; }
Source:
private void deleteProjectFromWorkspace(ProjectConfig project, String workspaceId) throws ServerException, ForbiddenException { String projectName = project.getName(); sendRecuestToDeleteProject(workspaceId, projectName); String projectType = project.getType(); LOG.info("EVENT#project-destroyed# PROJECT#{}# TYPE#{}# WS#{}# USER#{}#", project.getName(), projectType != null ? projectType : "unknown", EnvironmentContext.getCurrent().getWorkspaceName(), EnvironmentContext.getCurrent().getUser().getName()); }

Target:
private void deleteProjectFromWorkspace(ProjectConfig project, String workspaceId) throws ServerException, ForbiddenException { String projectName = project.getName(); doDeleteProject(workspaceId, projectName); String projectType = project.getType(); LOG.info("EVENT#project-destroyed# PROJECT#{}# TYPE#{}# WS#{}# USER#{}#", project.getName(), projectType != null ? projectType : "unknown", EnvironmentContext.getCurrent().getWorkspaceName(), EnvironmentContext.getCurrent().getUser().getName()); }
Source:
protected void processStateChanged(WatchedEvent event) { LOG.info("zookeeper state changed (" + event.getState() + ")"); setCurrentState(event.getState()); if (getShutdownTrigger()) { return; } fireStateChangedEvent(event.getState()); if (!isManagingZkConnection()) { if ((event.getState() == KeeperState.SyncConnected) && (!_isNewSessionEventFired) && (!"0" .equals(getHexSessionId()))) { fireAllEvents(); _isNewSessionEventFired = true; } else if (event.getState() == KeeperState.Expired) { _isNewSessionEventFired = false; } return; } if (event.getState() == KeeperState.SyncConnected) { if (!_isNewSessionEventFired && !"0".equals(getHexSessionId())) { fireNewSessionEvents(); _isNewSessionEventFired = true; fireAllEvents(); } } else if (event.getState() == KeeperState.Expired) { reconnectOnExpiring(); } }

Target:
protected void processStateChanged(WatchedEvent event) { LOG.info("zookeeper state changed (" + event.getState() + ")"); setCurrentState(event.getState()); if (getShutdownTrigger()) { return; } fireStateChangedEvent(event.getState()); if (event.getState() == KeeperState.SyncConnected) { if (!_isNewSessionEventFired && !"0".equals(getHexSessionId())) { fireNewSessionEvents(); _isNewSessionEventFired = true; fireAllEvents(); } } else if (event.getState() == KeeperState.Expired) { _isNewSessionEventFired = false; reconnectOnExpiring(); } }
Source:
public Collection<AbstractResourceWrapper<?, ?>> getResourcesOfKind(String kind) { return getResources().stream().filter(wrapper -> wrapper.getResource().getKind().equals(kind)) .collect(Collectors.toSet()); }

Target:
public Collection<IResourceWrapper<?, ?>> getResourcesOfKind(String kind) { return getResources().stream().filter(wrapper -> wrapper.getWrapped().getKind().equals(kind)) .collect(Collectors.toSet()); }
Source:
public static URI createURIFor(IFile file) { final URI uri; String fullPath = file.getFullPath().toString(); if (isAlreadyEncoded(fullPath)) { uri = URI.createPlatformResourceURI(fullPath, false); } else { uri = URI.createPlatformResourceURI(fullPath, true); } return uri; }

Target:
public static URI createURIFor(IFile file) { return URI.createPlatformResourceURI(file.getFullPath().toString(), true); }
Source:
public FlattenedNode(String node) { this.node = node; }

Target:
public FlattenedNode(String node) { this.node = requireNonNull(node, "node is null"); }
Source:
public static MessageDigest getMessageDigest() { try { MessageDigest md = null; synchronized(digests) { while (digests.size() > 0 && md == null) { md = digests.remove(0).get(); } } if(md == null) md = MessageDigest.getInstance("SHA-256", mdProvider); return md; } catch(NoSuchAlgorithmException e2) { Logger.error(Node.class, "Check your JVM settings especially the JCE!" + e2); System.err.println("Check your JVM settings especially the JCE!" + e2); e2.printStackTrace(); } WrapperManager.stop(NodeInitException.EXIT_CRAPPY_JVM); throw new RuntimeException(); }

Target:
public static MessageDigest getMessageDigest() { try { SoftReference<MessageDigest> item = null; while (((item = digests.poll()) != null)) { MessageDigest md = item.get(); if (md != null) { return md; } } return MessageDigest.getInstance("SHA-256", mdProvider); } catch(NoSuchAlgorithmException e2) { Logger.error(Node.class, "Check your JVM settings especially the JCE!" + e2); System.err.println("Check your JVM settings especially the JCE!" + e2); e2.printStackTrace(); } WrapperManager.stop(NodeInitException.EXIT_CRAPPY_JVM); throw new RuntimeException(); }
Source:
public void logout() { synchronized (Realm.class) { if (!SyncManager.getUserStore().isActive(identity)) { return; } for (SyncConfiguration syncConfiguration : realms.keySet()) { if (Realm.getGlobalInstanceCount(syncConfiguration) > 0) { throw new IllegalStateException("A Realm controlled by this user is still open. Close all Realms " + "before logging out: " + syncConfiguration.getPath()); } } SyncManager.getUserStore().remove(identity); for (SyncConfiguration syncConfiguration : realms.keySet()) { if (syncConfiguration.shouldDeleteRealmOnLogout()) { File realmFile = new File(syncConfiguration.getPath()); if (realmFile.exists() && !Util.deleteRealm(syncConfiguration.getPath(), realmFile.getParentFile(), realmFile.getName())) { RealmLog.error("Could not delete Realm when user logged out: " + syncConfiguration.getPath()); } } } realms.clear(); final AuthenticationServer server = SyncManager.getAuthServer(); ThreadPoolExecutor networkPoolExecutor = SyncManager.NETWORK_POOL_EXECUTOR; final Future<?> future = networkPoolExecutor.submit(new ExponentialBackoffTask<LogoutResponse>() { @Override protected LogoutResponse execute() { return server.logout(refreshToken, getAuthenticationUrl()); } @Override protected void onSuccess(LogoutResponse response) { SyncManager.notifyUserLoggedOut(SyncUser.this); } @Override protected void onError(LogoutResponse response) { RealmLog.error("Failed to log user out.\n" + response.getError().toString()); } }); } }

Target:
public void logout() { synchronized (Realm.class) { if (!SyncManager.getUserStore().isActive(identity, authenticationUrl.toString())) { return; } SyncManager.getUserStore().remove(identity, authenticationUrl.toString()); for (SyncConfiguration syncConfiguration : realms.keySet()) { SyncSession session = SyncManager.getSession(syncConfiguration); if (session != null) { session.clearScheduledAccessTokenRefresh(); } } realms.clear(); final AuthenticationServer server = SyncManager.getAuthServer(); final Token refreshTokenToBeRevoked = refreshToken; ThreadPoolExecutor networkPoolExecutor = SyncManager.NETWORK_POOL_EXECUTOR; networkPoolExecutor.submit(new ExponentialBackoffTask<LogoutResponse>() { @Override protected LogoutResponse execute() { return server.logout(refreshTokenToBeRevoked, getAuthenticationUrl()); } @Override protected void onSuccess(LogoutResponse response) { SyncManager.notifyUserLoggedOut(SyncUser.this); } @Override protected void onError(LogoutResponse response) { RealmLog.error("Failed to log user out.\n" + response.getError().toString()); } }); } }
Source:
public void execute(JobExecutionContext jobContext) throws JobExecutionException { Permissionable permissionable; JobDataMap map = jobContext.getJobDetail().getJobDataMap(); String permissionableId = (String) map.get("permissionableId"); String roleId = (String) map.get("roleId"); try { permissionable = (Permissionable) retrievePermissionable(permissionableId); Role role = (Role) roleAPI.loadRoleById(roleId); permissionAPI.cascadePermissionUnder(permissionable, role); permissionAPI.removePermissionableFromCache(permissionable.getPermissionId()); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } catch (DotSecurityException e) { Logger.error(CascadePermissionsJob.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } finally { try { HibernateUtil.closeSession(); } catch (DotHibernateException e) { Logger.warn(this, e.getMessage(), e); } } }

Target:
public void execute(JobExecutionContext jobContext) throws JobExecutionException { Permissionable permissionable; JobDataMap map = jobContext.getJobDetail().getJobDataMap(); String permissionableId = (String) map.get("permissionableId"); String roleId = (String) map.get("roleId"); try { permissionable = (Permissionable) retrievePermissionable(permissionableId); Role role = (Role) roleAPI.loadRoleById(roleId); permissionAPI.cascadePermissionUnder(permissionable, role); permissionAPI.removePermissionableFromCache(permissionable.getPermissionId()); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } catch (DotSecurityException e) { Logger.error(CascadePermissionsJob.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } }
Source:
public boolean isFluid(@Nonnull IBlockState blockstate) { return blockstate.getMaterial().isLiquid() || blockstate.getBlock() instanceof IFluidBlock; }

Target:
private boolean isFluid(@Nonnull IBlockState blockstate) { return blockstate.getMaterial().isLiquid() || blockstate.getBlock() instanceof IFluidBlock; }
Source:
public void cleanup() { super.cleanup(); for (Map.Entry<Query, ValueEventListener> entry : mRefs.entrySet()) { entry.getKey().removeEventListener(entry.getValue()); } }

Target:
public void cleanup() { super.cleanup(); final Iterator<Map.Entry<Query, ValueEventListener>> it = mRefs.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<Query, ValueEventListener> entry = it.next(); entry.getKey().removeEventListener(entry.getValue()); it.remove(); } }
Source:
public void testDocumentCreationFailureWithNoName() throws Exception { File archive = getArchiveFile("test-data/testNoNameCSVArchive.zip"); FileManager fm = Framework.getService(FileManager.class); Blob blob = Blobs.createBlob(archive); FileImporterContext context = FileImporterContext.builder(coreSession, blob, workspace2.getPathAsString()) .overwrite(true) .build(); fm.createOrUpdateDocument(context); DocumentModelList children = coreSession.getChildren(workspace2.getRef()); assertSame(0, children.size()); }

Target:
public void testDocumentCreationFailureWithNoName() throws Exception { File archive = getArchiveFile("test-data/testNoNameCSVArchive.zip"); FileManager fm = Framework.getService(FileManager.class); Blob blob = Blobs.createBlob(archive); FileImporterContext context = FileImporterContext.builder(coreSession, blob, workspace2.getPathAsString()) .overwrite(true) .build(); fm.createOrUpdateDocument(context); DocumentModelList children = coreSession.getChildren(workspace2.getRef()); assertEquals(0, children.size()); }
Source:
public void initStorage(StorageFactory factory) { super.initStorage(factory); setStatus(Status.STORAGE_ASSIGNED); if(catchUpAfterStorageInit) { if(log().isDebugEnabled()) { log().debug("Storage assigned. Starting catch-up."); } catchUp(); } }

Target:
public void initStorage(StorageFactory factory) { super.initStorage(factory); setStatus(Status.STORAGE_ASSIGNED); if(catchUpAfterStorageInit) { if(log().isDebugEnabled()) { log().debug("Storage assigned. is starting to catch-up", getClass()); } catchUp(); } }
Source:
protected String executeScript(String[] command) throws InterruptedException, IOException, RuntimeException { File pathToExecutable = new File(FILEPATH + command[1]); System.out.println(pathToExecutable.toString()); System.out.println("TEST"); isExecutable(pathToExecutable); command[1] = pathToExecutable.getAbsolutePath(); System.out.println(Arrays.toString(command)); return executeCommand(command); }

Target:
protected String executeScript(String[] command) throws InterruptedException, IOException, RuntimeException { File pathToExecutable = new File(FILEPATH + command[1]); Debug.log("[Executor.executeScript] Path to executable: " + pathToExecutable.toString()); isExecutable(pathToExecutable); command[1] = pathToExecutable.getAbsolutePath(); Debug.log("[Executor.executeScript] Executing the command: " + Arrays.toString(command)); return executeCommand(command); }
Source:
public boolean equals(Object object) { if (object == this) return true; if (!(object instanceof Color)) return false; Color color = (Color)object; GdkRGBA gdkRGBA = color.handle; if (handle == gdkRGBA) return true; boolean red = this.getRed() == color.getRed(); boolean green = this.getGreen() == color.getGreen(); boolean blue = this.getBlue() == color.getBlue(); boolean alpha = this.getAlpha() == color.getAlpha(); return device == color.device && red && green && blue && alpha; }

Target:
public boolean equals(Object object) { if (object == this) return true; if (!(object instanceof Color)) return false; Color color = (Color)object; GdkRGBA gdkRGBA = color.handle; if (handle == gdkRGBA) return true; if (this.getRed() != color.getRed()) return false; if (this.getGreen() != color.getGreen()) return false; if (this.getBlue() != color.getBlue()) return false; if (this.getAlpha() != color.getAlpha()) return false; return device == color.device; }
Source:
long copyStoreFiles( AdvertisedSocketAddress from, StoreId expectedStoreId, StoreFileStreams storeFileStreams ) throws StoreCopyFailedException { try { return catchUpClient.makeBlockingRequest( from, new GetStoreRequest( expectedStoreId ), new CatchUpResponseAdaptor<Long>() { private String destination; private int requiredAlignment; @Override public void onFileHeader( CompletableFuture<Long> requestOutcomeSignal, FileHeader fileHeader ) { this.destination = fileHeader.fileName(); this.requiredAlignment = fileHeader.requiredAlignment(); } @Override public boolean onFileContent( CompletableFuture<Long> signal, FileChunk fileChunk ) throws IOException { storeFileStreams.write( destination, requiredAlignment, fileChunk.bytes() ); return fileChunk.isLast(); } @Override public void onFileStreamingComplete( CompletableFuture<Long> signal, StoreCopyFinishedResponse response ) { log.info( "Finished streaming %s" ); signal.complete( response.lastCommittedTxBeforeStoreCopy() ); } } ); } catch ( CatchUpClientException e ) { throw new StoreCopyFailedException( e ); } }

Target:
long copyStoreFiles( AdvertisedSocketAddress from, StoreId expectedStoreId, StoreFileStreams storeFileStreams ) throws StoreCopyFailedException { try { return catchUpClient.makeBlockingRequest( from, new GetStoreRequest( expectedStoreId ), new CatchUpResponseAdaptor<Long>() { private String destination; private int requiredAlignment; @Override public void onFileHeader( CompletableFuture<Long> requestOutcomeSignal, FileHeader fileHeader ) { this.destination = fileHeader.fileName(); this.requiredAlignment = fileHeader.requiredAlignment(); } @Override public boolean onFileContent( CompletableFuture<Long> signal, FileChunk fileChunk ) throws IOException { storeFileStreams.write( destination, requiredAlignment, fileChunk.bytes() ); return fileChunk.isLast(); } @Override public void onFileStreamingComplete( CompletableFuture<Long> signal, StoreCopyFinishedResponse response ) { log.info( "Finished streaming" ); signal.complete( response.lastCommittedTxBeforeStoreCopy() ); } } ); } catch ( CatchUpClientException e ) { throw new StoreCopyFailedException( e ); } }
Source:
public void init(String regKey, String email, String courseId) { String joinUrl = new Url(Const.ActionURIs.STUDENT_COURSE_JOIN_NEW). withRegistrationKey(regKey). withStudentEmail(email). withCourseId(courseId). toString(); try { registerMessage = String.format(Const.StatusMessages.UNREGISTERED_STUDENT, student.name, joinUrl); } catch (NullPointerException e) { registerMessage = ""; } }

Target:
public void init(String regKey, String email, String courseId) { String joinUrl = new Url(Const.ActionURIs.STUDENT_COURSE_JOIN_NEW) .withRegistrationKey(regKey) .withStudentEmail(email) .withCourseId(courseId) .toString(); registerMessage = (student == null || joinUrl == null) ? "" : String.format(Const.StatusMessages.UNREGISTERED_STUDENT, student.name, joinUrl); createQuestionsWithResponses(); }
Source:
void notifyAllChangesDownloaded(Long errorcode, String errorMessage) { if (waitingForServerChanges != null) { waitingForServerChanges.handleResult(errorcode, errorMessage); } }

Target:
private void notifyAllChangesDownloaded(Long errorcode, String errorMessage) { WaitForServerChangesWrapper wrapper = waitingForServerChanges.get(); if (wrapper != null) { wrapper.handleResult(errorcode, errorMessage); } }
Source:
public static Lifecycle multiple( Lifecycle... lifecycles ) { return new CombinedLifecycle( Arrays.asList( lifecycles ) ); }

Target:
public static Lifecycle multiple( Lifecycle... lifecycles ) { return multiple( Arrays.asList( lifecycles ) ); }
Source:
public CPPASTLiteralExpression(int kind, char[] value, char[] numericCompilerSuffixes) { fKind = kind; setValue(kind, value); fNumericCompilerSuffixes = (numericCompilerSuffixes == null) ? CharArrayUtils.EMPTY : numericCompilerSuffixes; }

Target:
public CPPASTLiteralExpression(int kind, char[] value, char[] numericCompilerSuffixes) { set(kind, value); fNumericCompilerSuffixes = (numericCompilerSuffixes == null) ? CharArrayUtils.EMPTY : numericCompilerSuffixes; }
Source:
private User(UUID id, byte[] initializationVector, String firstName, String lastName, String mobileNumber, UserPrivate userPrivate, MessageDestination messageDestination) { super(id); this.status = Status.UNCONFIRMED; this.initializationVector = initializationVector; this.firstName = firstName; this.lastName = lastName; this.mobileNumber = mobileNumber; this.setUserPrivate(userPrivate); this.messageDestination = messageDestination; }

Target:
private User(UUID id, byte[] initializationVector, String firstName, String lastName, String mobileNumber, UserPrivate userPrivate, MessageDestination messageDestination) { super(id); this.initializationVector = initializationVector; this.firstName = firstName; this.lastName = lastName; this.mobileNumber = mobileNumber; this.setUserPrivate(userPrivate); this.messageDestination = messageDestination; }
Source:
static TypeSubstitution substitutionFromSuperType(ParametrizedTypeJavaType target, ParametrizedTypeJavaType source) { TypeSubstitution result = target.typeSubstitution.copy(); if (target.rawType != source.rawType) { TypeJavaSymbol targetSymbol = target.symbol; Type superClass = targetSymbol.superClass(); if (superClass != null && isParametrizedType(superClass)) { TypeSubstitution newSub = substitutionFromSuperType((ParametrizedTypeJavaType) superClass, source); result = combine(result, newSub); } for (Type superInterface : targetSymbol.interfaces()) { if (isParametrizedType(superInterface)) { TypeSubstitution newSub = substitutionFromSuperType((ParametrizedTypeJavaType) superInterface, source); result = combine(result, newSub); } } } else { result = combine(target.typeSubstitution, source.typeSubstitution); } return result; }

Target:
static TypeSubstitution substitutionFromSuperType(ParametrizedTypeJavaType target, ParametrizedTypeJavaType source) { TypeSubstitution result = new TypeSubstitution(target.typeSubstitution); if (target.rawType != source.rawType) { TypeJavaSymbol targetSymbol = target.symbol; Type superClass = targetSymbol.superClass(); if (superClass != null && isParametrizedType(superClass)) { TypeSubstitution newSub = substitutionFromSuperType((ParametrizedTypeJavaType) superClass, source); result = result.combine(newSub); } for (Type superInterface : targetSymbol.interfaces()) { if (isParametrizedType(superInterface)) { TypeSubstitution newSub = substitutionFromSuperType((ParametrizedTypeJavaType) superInterface, source); result = result.combine(newSub); } } } else { result = target.typeSubstitution.combine(source.typeSubstitution); } return result; }
Source:
public void testPreloadSplitsForGroupedExecution() throws Exception { ConnectorSession session = new TestingConnectorSession( new HiveSessionProperties( new HiveClientConfig().setPreloadSplitsForGroupedExecution(true), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties()); HiveSplitSource hiveSplitSource = HiveSplitSource.bucketed( session, "database", "table", TupleDomain.all(), 10, 10, new DataSize(1, MEGABYTE), new TestingHiveSplitLoader(), Executors.newFixedThreadPool(5), new CounterStat()); for (int i = 0; i < 10; i++) { hiveSplitSource.addToQueue(new TestSplit(i, OptionalInt.of(0))); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } final SettableFuture<List<ConnectorSplit>> splits = SettableFuture.create(); final CountDownLatch started = new CountDownLatch(1); Thread getterThread = new Thread(() -> { try { started.countDown(); List<ConnectorSplit> batch = getSplits(hiveSplitSource, OptionalInt.of(0), 10); splits.set(batch); } catch (Throwable e) { splits.setException(e); } }); getterThread.start(); try { assertTrue(started.await(1, TimeUnit.SECONDS)); MILLISECONDS.sleep(200); assertFalse(splits.isDone()); hiveSplitSource.noMoreSplits(); List<ConnectorSplit> connectorSplits = splits.get(800, MILLISECONDS); assertEquals(connectorSplits.size(), 10); for (int i = 0; i < 10; i++) { assertEquals(((HiveSplit) connectorSplits.get(i)).getSchema().getProperty("id"), Integer.toString(i)); } } finally { getterThread.interrupt(); } }

Target:
public void testPreloadSplitsForGroupedExecution() throws Exception { ConnectorSession session = new TestingConnectorSession( new HiveSessionProperties( new HiveClientConfig().setPreloadSplitsForGroupedExecution(true), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties()); HiveSplitSource hiveSplitSource = HiveSplitSource.bucketed( session, "database", "table", TupleDomain.all(), 10, 10, new DataSize(1, MEGABYTE), new TestingHiveSplitLoader(), EXECUTOR, new CounterStat()); for (int i = 0; i < 10; i++) { hiveSplitSource.addToQueue(new TestSplit(i, OptionalInt.of(0))); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } SettableFuture<List<ConnectorSplit>> splits = SettableFuture.create(); CountDownLatch started = new CountDownLatch(1); Thread getterThread = new Thread(() -> { try { started.countDown(); List<ConnectorSplit> batch = getSplits(hiveSplitSource, OptionalInt.of(0), 10); splits.set(batch); } catch (Throwable e) { splits.setException(e); } }); getterThread.start(); try { assertTrue(started.await(1, SECONDS)); MILLISECONDS.sleep(200); assertFalse(splits.isDone()); hiveSplitSource.noMoreSplits(); List<ConnectorSplit> connectorSplits = splits.get(800, MILLISECONDS); assertEquals(connectorSplits.size(), 10); for (int i = 0; i < 10; i++) { assertEquals(((HiveSplit) connectorSplits.get(i)).getSchema().getProperty("id"), Integer.toString(i)); } } finally { getterThread.interrupt(); } }
Source:
public String toString() { StringBuilder buf = new StringBuilder(64) .append(StringUtil.simpleClassName(this)) .append('@') .append(Integer.toHexString(hashCode())); if (!isDone()) { buf.append("(incomplete)"); } else { Throwable cause = cause(); if (cause != null) { buf.append("(failure: ") .append(cause) .append(')'); } else { Object result = getNow(); if (result == null) { buf.append("(success)"); } else { buf.append("(success: ") .append(result) .append(')'); } } } return buf.append(" task: ") .append(callable) .append(" id: ") .append(id) .append(", deadline: ") .append(deadlineNanos) .append(", period: ") .append(periodNanos) .append(')').toString(); }

Target:
public String toString() { StringBuilder buf = new StringBuilder(64) .append(StringUtil.simpleClassName(this)) .append('@') .append(Integer.toHexString(hashCode())); if (!isDone()) { buf.append("(incomplete)"); } else { Throwable cause = cause(); if (cause != null) { buf.append("(failure: ") .append(cause) .append(')'); } else { Object result = getNow(); if (result == null) { buf.append("(success)"); } else { buf.append("(success: ") .append(result) .append(')'); } } } return buf.append(" task: ") .append(callable) .append(", id: ") .append(id) .append(", deadline: ") .append(deadlineNanos) .append(", period: ") .append(periodNanos) .append(')').toString(); }
Source:
public ArrayList<Geometry> getGeometryObject() { List<Geometry> geometriesList = super.getGeometryObject(); ArrayList<Geometry> geometriesAList = new ArrayList<>(geometriesList); return geometriesAList; }

Target:
public ArrayList<Geometry> getGeometryObject() { List<Geometry> geometriesList = super.getGeometryObject(); return new ArrayList<>(geometriesList); }
Source:
public void testGetSmsCapacityOnIcc() { int[] records = new int[3]; records[2] = 500; Message fetchCapacityDone = mIccRecords.obtainMessage( IccRecords.EVENT_GET_SMS_RECORD_SIZE_DONE); AsyncResult.forMessage(fetchCapacityDone, records, null); fetchCapacityDone.sendToTarget(); waitForMs(200); assertEquals(mIccRecords.getSmsCapacityOnIcc(), 500); }

Target:
public void testGetSmsCapacityOnIcc() { int[] records = new int[3]; records[2] = 500; Message fetchCapacityDone = mIccRecords.obtainMessage( IccRecords.EVENT_GET_SMS_RECORD_SIZE_DONE); AsyncResult.forMessage(fetchCapacityDone, records, null); fetchCapacityDone.sendToTarget(); waitForLastHandlerAction(mIccRecords); assertEquals(mIccRecords.getSmsCapacityOnIcc(), 500); }
Source:
public void setLastSnapTransferDoneTimestamp(long topologyConfigId, long ts) { CorfuStoreMetadata.Timestamp timestamp = corfuStore.getTimestamp(); long persistedTopologyConfigId = query(timestamp, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID); long persistedSnapStart = query(timestamp, LogReplicationMetadataType.LAST_SNAPSHOT_STARTED); log.debug("setLastSnapTransferDone snapshotStart topologyConfigId={}, ts={}, persistedTopologyConfigID={}," + " persistedTopologyConfigID={}, persistedSnapshotStart={}", topologyConfigId, ts, persistedTopologyConfigId, persistedSnapStart); if (topologyConfigId != persistedTopologyConfigId || ts <= persistedTopologyConfigId) { log.warn("The metadata is older than the persisted one. Set snapshotStart topologyConfigId " + topologyConfigId + " ts " + ts + " persisteTopologyfigID " + persistedTopologyConfigId + " persistSnapStart " + persistedSnapStart); return; } TxBuilder txBuilder = corfuStore.tx(namespace); appendUpdate(txBuilder, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID, topologyConfigId); appendUpdate(txBuilder, LogReplicationMetadataType.LAST_SNAPSHOT_TRANSFERRED, ts); txBuilder.commit(timestamp); log.debug("Commit. Set snapshotStart topologyConfigId " + topologyConfigId + " ts " + ts + " persisteTopologyConfigID " + persistedTopologyConfigId + " persistSnapStart " + persistedSnapStart); return; }

Target:
public void setLastSnapTransferDoneTimestamp(long topologyConfigId, long ts) { CorfuStoreMetadata.Timestamp timestamp = corfuStore.getTimestamp(); long persistedTopologyConfigId = query(timestamp, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID); long persistedSnapStart = query(timestamp, LogReplicationMetadataType.LAST_SNAPSHOT_STARTED); log.debug("setLastSnapTransferDone snapshotStart topologyConfigId={}, ts={}, persistedTopologyConfigID={}," + " persistedTopologyConfigID={}, persistedSnapshotStart={}", topologyConfigId, ts, persistedTopologyConfigId, persistedSnapStart); if (topologyConfigId != persistedTopologyConfigId || ts <= persistedTopologyConfigId) { log.warn("The message metadata is older than the persisted one. Set snapshotStart topologyConfigId={} ts={} " + "with persistedTopologyConfigId={} persistedSnapShtart {}", topologyConfigId, ts, persistedTopologyConfigId, persistedSnapStart); return; } TxBuilder txBuilder = corfuStore.tx(namespace); appendUpdate(txBuilder, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID, topologyConfigId); appendUpdate(txBuilder, LogReplicationMetadataType.LAST_SNAPSHOT_TRANSFERRED, ts); txBuilder.commit(timestamp); log.debug("Commit. Set snapshotStart topologyConfigId={} ts={} persistedTopologyConfigId={} perstedSnapStart={} ", topologyConfigId, ts , persistedTopologyConfigId, persistedSnapStart); return; }