auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ResourceResponse retrieveResource( URI resourceUri, Map<String, Serializable> requestProperties) throws IOException, ResourceNotFoundException, ResourceNotSupportedException { <START> if (resourceUri == null) { <END> throw new IllegalArgumentException( "Unable to retrieve resource because no resource URI was given"); } Serializable serializableId = null; String username = cswSourceConfiguration.getUsername(); String password = cswSourceConfiguration.getPassword(); if (requestProperties != null) { serializableId = requestProperties.get(Core.ID); if (StringUtils.isNotBlank(username)) { requestProperties.put(USERNAME_PROPERTY, username); requestProperties.put(PASSWORD_PROPERTY, password); } } else { requestProperties = new HashMap<>(); } if (canRetrieveResourceById()) { if (serializableId == null) { throw new ResourceNotFoundException( "Unable to retrieve resource because no metacard ID was found."); } String metacardId = serializableId.toString(); LOGGER.debug("Retrieving resource for ID : {}", metacardId); ResourceResponse response = retrieveResourceById(requestProperties, metacardId); if (response != null) { return response; } } LOGGER.debug("Retrieving resource at : {}", resourceUri); return resourceReader.retrieveResource(resourceUri, requestProperties); }</code><technical_language>return a response checking this parameter. check this point move check if (canRetrieveResourceById())</technical_language>

Target:
public ResourceResponse retrieveResource( URI resourceUri, Map<String, Serializable> requestProperties) throws IOException, ResourceNotFoundException, ResourceNotSupportedException { Serializable serializableId = null; String username = cswSourceConfiguration.getUsername(); String password = cswSourceConfiguration.getPassword(); if (requestProperties != null) { serializableId = requestProperties.get(Core.ID); if (StringUtils.isNotBlank(username)) { requestProperties.put(USERNAME_PROPERTY, username); requestProperties.put(PASSWORD_PROPERTY, password); } } if (canRetrieveResourceById()) { if (serializableId == null) { throw new ResourceNotFoundException( "Unable to retrieve resource because no metacard ID was found."); } String metacardId = serializableId.toString(); LOGGER.debug("Retrieving resource for ID : {}", metacardId); ResourceResponse response = retrieveResourceById(requestProperties, metacardId); if (response != null) { return response; } } if (resourceUri == null) { throw new IllegalArgumentException( "Unable to retrieve resource because no resource URI was given"); } LOGGER.debug("Retrieving resource at : {}", resourceUri); return resourceReader.retrieveResource(resourceUri, requestProperties); }
Source:
<code>public int getThreadOnCpu(long cpuId, long ts) { <START> ITmfStateSystem stateSystem = getStateSystem(); <END> if (stateSystem == null) { return -1; } try { int cpuQuark = stateSystem.getQuarkAbsolute(Attributes.CPUS, Long.toString(cpuId), Attributes.CURRENT_THREAD); ITmfStateInterval interval = stateSystem.querySingleState(ts, cpuQuark); ITmfStateValue val = interval.getStateValue(); switch (val.getType()) { case INTEGER: return val.unboxInt(); case LONG: case DOUBLE: case NULL: case STRING: default: break; } } catch (AttributeNotFoundException | StateSystemDisposedException e) { } return -1; }</code><technical_language>analysis need scheduled too, in getThreadQuarks</technical_language>

Target:
public int getThreadOnCpu(long cpuId, long ts) { ITmfStateSystem ss = getStateSystem(); if (ss == null) { return NO_TID; } try { int cpuQuark = ss.getQuarkAbsolute(Attributes.CPUS, Long.toString(cpuId), Attributes.CURRENT_THREAD); ITmfStateInterval interval = ss.querySingleState(ts, cpuQuark); ITmfStateValue val = interval.getStateValue(); switch (val.getType()) { case INTEGER: return val.unboxInt(); case LONG: case DOUBLE: case NULL: case STRING: default: break; } } catch (AttributeNotFoundException | StateSystemDisposedException e) { } return NO_TID; }
Source:
<code>public void rename_noSimilarPrimaryKeyWithOldSchema() { buildInitialMigrationSchema(MigrationClassRenamed.CLASS_NAME, true); RealmMigration migration = new RealmMigration() { @Override public void migrate(DynamicRealm realm, long oldVersion, long newVersion) { realm.getSchema() .rename(MigrationPrimaryKey.CLASS_NAME, MigrationClassRenamed.CLASS_NAME); realm.getSchema() .create(MigrationPrimaryKey.CLASS_NAME) .addField(MigrationPrimaryKey.FIELD_FIRST, Byte.class) .addField(MigrationPrimaryKey.FIELD_SECOND, Short.class) .addField(MigrationPrimaryKey.FIELD_PRIMARY, String.class) .addField(MigrationPrimaryKey.FIELD_FOURTH, Integer.class) .addField(MigrationPrimaryKey.FIELD_FIFTH, Long.class); } }; RealmConfiguration realmConfig = configFactory.createConfigurationBuilder() .schemaVersion(1) .schema(MigrationClassRenamed.class) .migration(migration) .build(); Realm realm = Realm.getInstance(realmConfig); realm.close(); DynamicRealm dynamicRealm = DynamicRealm.getInstance(realmConfig); assertTrue(dynamicRealm.getSchema().get(MigrationClassRenamed.CLASS_NAME).hasPrimaryKey()); assertFalse(dynamicRealm.getSchema().get(MigrationPrimaryKey.CLASS_NAME).hasPrimaryKey()); <START> dynamicRealm.close(); <END> }</code><technical_language>Small issue: For a more robust test, asserts try/catch this in a finally block. consistent in tests though</technical_language>

Target:
public void rename_noSimilarPrimaryKeyWithOldSchema() { buildInitialMigrationSchema(MigrationClassRenamed.CLASS_NAME, true); RealmMigration migration = new RealmMigration() { @Override public void migrate(DynamicRealm realm, long oldVersion, long newVersion) { realm.getSchema() .rename(MigrationPrimaryKey.CLASS_NAME, MigrationClassRenamed.CLASS_NAME); realm.getSchema() .create(MigrationPrimaryKey.CLASS_NAME) .addField(MigrationPrimaryKey.FIELD_FIRST, Byte.class) .addField(MigrationPrimaryKey.FIELD_SECOND, Short.class) .addField(MigrationPrimaryKey.FIELD_PRIMARY, String.class) .addField(MigrationPrimaryKey.FIELD_FOURTH, Integer.class) .addField(MigrationPrimaryKey.FIELD_FIFTH, Long.class); } }; RealmConfiguration realmConfig = configFactory.createConfigurationBuilder() .schemaVersion(1) .schema(MigrationClassRenamed.class) .migration(migration) .build(); Realm realm = Realm.getInstance(realmConfig); realm.close(); DynamicRealm dynamicRealm = DynamicRealm.getInstance(realmConfig); try { assertTrue(dynamicRealm.getSchema().get(MigrationClassRenamed.CLASS_NAME).hasPrimaryKey()); assertFalse(dynamicRealm.getSchema().get(MigrationPrimaryKey.CLASS_NAME).hasPrimaryKey()); } finally { dynamicRealm.close(); } }
Source:
<code>public List<ClassInfo> getTests() { return flatMap(this.classPath.test(), nameToClassInfo()).filter( and(isWithinATestClass(), isIncludedClass(), not(ClassInfo.matchIfAbstract()), <START> not(ClassInfo.matchIfAnnotationPresentWithValueString(RunWith.class, <END> isRanWith(this.excludedRunners))))); }</code><technical_language>I a good idea check this in CodeSource. I move JUnitTestClassIdentifier.isIncludedClass() This is JUnit specific behaviour executed in TestNG setups. surprised run a TestNG setup. Annotations treated differently class loader</technical_language>

Target:
public List<ClassInfo> getTests() { return flatMap(this.classPath.test(), nameToClassInfo()).filter( and(isWithinATestClass(), isIncludedClass(), not(ClassInfo.matchIfAbstract()))); }
Source:
<code>private boolean runFirehoseV2(FirehoseV2 firehose) throws Exception { firehose.start(); log.info("FirehoseV2 started"); final Supplier<Committer> committerSupplier = Committers.supplierFromFirehoseV2(firehose); boolean haveRow = true; while (haveRow) { <START> if (Thread.interrupted()) { <END> return false; } InputRow inputRow = null; int numRows = 0; try { inputRow = firehose.currRow(); if (inputRow != null) { numRows = plumber.add(inputRow, committerSupplier); if (numRows < 0) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); } else { metrics.incrementProcessed(); } } else { log.debug("thrown away null input row, considering unparseable"); metrics.incrementUnparseable(); } } catch (Exception e) { log.makeAlert(e, "Unknown exception, Ignoring and continuing.") .addData("inputRow", inputRow); } try { haveRow = firehose.advance(); } catch (Exception e) { log.debug(e, "exception in firehose.advance(), considering unparseable row"); metrics.incrementUnparseable(); } } return true; }</code><technical_language>reliable me, interruption status consumed (due bugs). in addition suggested add "stopping" flag RealtimeManager check in addition interruption status</technical_language>

Target:
private boolean runFirehoseV2(FirehoseV2 firehose) throws Exception { firehose.start(); log.info("FirehoseV2 started"); final Supplier<Committer> committerSupplier = Committers.supplierFromFirehoseV2(firehose); boolean haveRow = true; while (haveRow) { if (Thread.interrupted() || stopping) { return false; } InputRow inputRow = null; int numRows = 0; try { inputRow = firehose.currRow(); if (inputRow != null) { numRows = plumber.add(inputRow, committerSupplier); if (numRows < 0) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); } else { metrics.incrementProcessed(); } } else { log.debug("thrown away null input row, considering unparseable"); metrics.incrementUnparseable(); } } catch (Exception e) { log.makeAlert(e, "Unknown exception, Ignoring and continuing.") .addData("inputRow", inputRow); } try { haveRow = firehose.advance(); } catch (Exception e) { log.debug(e, "exception in firehose.advance(), considering unparseable row"); metrics.incrementUnparseable(); } } return true; }
Source:
<code>public void test() { Map<String, Object> mobileEmulation = new HashMap<>(); <START> mobileEmulation.put("userAgent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1"); <END> ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.setExperimentalOption("mobileEmulation", mobileEmulation); driver = new ChromiumHeadlessDriver(chromeOptions, true); connect(); waitResponse(); jq(".z-listbox-body").scrollTop(1000); waitResponse(); click(jq("@listcell:last")); waitResponse(); Assert.assertNotEquals(0, jq(".z-listbox-body").scrollTop()); driver = new ChromiumHeadlessDriver(getWebDriverOptions(), true); }</code><technical_language>call API</technical_language>

Target:
public void test() { connect(); waitResponse(); jq(".z-listbox-body").scrollTop(1000); waitResponse(); click(jq("@listcell:last")); waitResponse(); Assert.assertNotEquals(0, jq(".z-listbox-body").scrollTop()); }
Source:
<code>public void tripletsWhoseSumIs12() { List<PythagoreanTriplet> actual = PythagoreanTriplet.makeTripletsList().withFactorsLessThanOrEqualTo(12) <START> .thatSumTo(12).build(); <END> List<PythagoreanTriplet> expected = Arrays.asList(new PythagoreanTriplet(3, 4, 5)); assertEquals(expected.size(), actual.size()); for (int i = 0; i < expected.size(); ++i) { assertEquals(expected.get(i), actual.get(i)); } }</code><technical_language>expression is long for line I prefer break adding a new line full stop a bit more readable For example here: List<PythagoreanTriplet> actual = PythagoreanTriplet .makeTripletsList() .withFactorsLessThanOrEqualTo(12) .thatSumTo(12) .build();</technical_language>

Target:
public void tripletsWhoseSumIs12() { List<PythagoreanTriplet> actual = PythagoreanTriplet .makeTripletsList() .withFactorsLessThanOrEqualTo(12) .thatSumTo(12) .build(); List<PythagoreanTriplet> expected = Collections.singletonList(new PythagoreanTriplet(3, 4, 5)); assertEquals(expected, actual); }
Source:
<code>void loadName() { <START> this.name.setText(currentState.getNameText(getAdapterPosition())); <END> }</code><technical_language>suggestion name.setText(currentState.getNameText(getAdapterPosition()));</technical_language>

Target:
void loadName() { name.setText(currentState.getNameText(getAdapterPosition())); }
Source:
<code>default int compareTo(MountPointChooser other) { <START> Validate.notNull(other, "Other must not be null!"); <END> int compResult = Integer.compare(this.getPriority(), other.getPriority()); return compResult != 0 ? compResult : Integer.compare(this.hashCode(), other.hashCode()); }</code><technical_language>Guava instead of Apache Commons. suggestion Preconditions.checkNotNull(other, "Other null!");</technical_language>

Target:
default int compareTo(MountPointChooser other) { Preconditions.checkNotNull(other, "Other must not be null!"); return Integer.compare(this.getPriority(), other.getPriority()); }
Source:
<code>private String getEditUrl(String page, String query) { return urlBuilder.appendQueryStringToURL( <START> urlBuilder.getUrlForPage(String.format("/wiki/%s", page.replace(" ", "_"))), <END> query); }</code><technical_language>do moving normalization logic getUrlForPage(String pageName)</technical_language>

Target:
private String getEditUrl(String page, String query) { return urlBuilder.appendQueryStringToURL( urlBuilder.getUrlForPage(String.format("/wiki/%s", urlBuilder.normalizePageName(page))), query); }
Source:
<code>public Reader(CachableBlockFile.Reader rdr) throws IOException { this.reader = rdr; CachableBlockFile.CachedBlockRead mb = reader.getMetaBlock("RFile.index"); try { int magic = mb.readInt(); int ver = mb.readInt(); rfileVersion = ver; if (magic != RINDEX_MAGIC) throw new IOException("Did not see expected magic number, saw " + magic); if (ver != RINDEX_VER_8 && ver != RINDEX_VER_7 && ver != RINDEX_VER_6 && ver != RINDEX_VER_4 && ver != RINDEX_VER_3) throw new IOException("Did not see expected version, saw " + ver); int size = mb.readInt(); currentReaders = new ArrayList<>(size); <START> deepCopies = new ArrayList<>(); <END> for (int i = 0; i < size; i++) { LocalityGroupMetadata lgm = new LocalityGroupMetadata(ver, rdr); lgm.readFields(mb); localityGroups.add(lgm); currentReaders.add(new LocalityGroupReader(reader, lgm, ver)); } readers = currentReaders; if (ver == RINDEX_VER_8 && mb.readBoolean()) { sampleReaders = new ArrayList<>(size); for (int i = 0; i < size; i++) { LocalityGroupMetadata lgm = new LocalityGroupMetadata(ver, rdr); lgm.readFields(mb); sampleGroups.add(lgm); sampleReaders.add(new LocalityGroupReader(reader, lgm, ver)); } samplerConfig = new SamplerConfigurationImpl(mb); } else { sampleReaders = null; samplerConfig = null; } } finally { mb.close(); } lgContext = new LocalityGroupContext(currentReaders); createHeap(currentReaders.size()); }</code><technical_language>do add() this, problems system patterns a lot of deepCopies, if results in array resizing. LinkedList is for cases, worse for other cases. leave this was</technical_language>

Target:
public Reader(CachableBlockFile.Reader rdr) throws IOException { this.reader = rdr; CachableBlockFile.CachedBlockRead mb = reader.getMetaBlock("RFile.index"); try { int magic = mb.readInt(); int ver = mb.readInt(); rfileVersion = ver; if (magic != RINDEX_MAGIC) throw new IOException("Did not see expected magic number, saw " + magic); if (ver != RINDEX_VER_8 && ver != RINDEX_VER_7 && ver != RINDEX_VER_6 && ver != RINDEX_VER_4 && ver != RINDEX_VER_3) throw new IOException("Did not see expected version, saw " + ver); int size = mb.readInt(); currentReaders = new ArrayList<>(size); deepCopies = new LinkedList<>(); for (int i = 0; i < size; i++) { LocalityGroupMetadata lgm = new LocalityGroupMetadata(ver, rdr); lgm.readFields(mb); localityGroups.add(lgm); currentReaders.add(new LocalityGroupReader(reader, lgm, ver)); } readers = currentReaders; if (ver == RINDEX_VER_8 && mb.readBoolean()) { sampleReaders = new ArrayList<>(size); for (int i = 0; i < size; i++) { LocalityGroupMetadata lgm = new LocalityGroupMetadata(ver, rdr); lgm.readFields(mb); sampleGroups.add(lgm); sampleReaders.add(new LocalityGroupReader(reader, lgm, ver)); } samplerConfig = new SamplerConfigurationImpl(mb); } else { sampleReaders = null; samplerConfig = null; } } finally { mb.close(); } lgContext = new LocalityGroupContext(currentReaders); createHeap(currentReaders.size()); }
Source:
<code>public static String getLanguage() { SharedPreferences defaultSharedPref = OpenMRS.getInstance().getOpenMRSSharedPreferences(); <START> String isDarkMode = defaultSharedPref.getString(ApplicationConstants.OpenMRSlanguage.KEY_LANGUAGE_MODE, "en"); <END> return isDarkMode; }</code><technical_language>is isDarkMode name of variable</technical_language>

Target:
public static String getLanguage() { SharedPreferences defaultSharedPref = OpenMRS.getInstance().getOpenMRSSharedPreferences(); String selecetedLang = defaultSharedPref.getString(ApplicationConstants.OpenMRSlanguage.KEY_LANGUAGE_MODE, "en"); return selecetedLang; }
Source:
<code>private void connect() { this.connecting = true; this.stompSessionListenableFuture = doConnect(this.compositeStompSessionHandler); this.stompSessionListenableFuture.addCallback(new ListenableFutureCallback<StompSession>() { @Override public void onFailure(Throwable e) { AbstractStompSessionManager.this.connecting = false; logger.error("STOMP connect error.", e); scheduleReconnect(); if (applicationEventPublisher != null) { applicationEventPublisher.publishEvent( new StompExceptionEvent(AbstractStompSessionManager.this, e)); } } @Override public void onSuccess(StompSession stompSession) { AbstractStompSessionManager.this.connecting = false; stompSession.setAutoReceipt(isAutoReceiptEnabled()); AbstractStompSessionManager.this.connected = true; <START> AbstractStompSessionManager.this.reconnectFuture = null; <END> } }); }</code><technical_language>consider adding a StomConnectedEvent</technical_language>

Target:
private void connect() { this.connecting = true; this.stompSessionListenableFuture = doConnect(this.compositeStompSessionHandler); this.stompSessionListenableFuture.addCallback(new ListenableFutureCallback<StompSession>() { @Override public void onFailure(Throwable e) { scheduleReconnect(e); } @Override public void onSuccess(StompSession stompSession) { AbstractStompSessionManager.this.connected = true; AbstractStompSessionManager.this.connecting = false; stompSession.setAutoReceipt(isAutoReceiptEnabled()); if (AbstractStompSessionManager.this.applicationEventPublisher != null) { AbstractStompSessionManager.this.applicationEventPublisher.publishEvent( new StompSessionConnectedEvent(this)); } AbstractStompSessionManager.this.reconnectFuture = null; } }); }
Source:
<code>private long getUniqueId(String name) { <START> Long id = fIdToType.inverse().get(name); if (id == null) { id = ENTRY_ID.getAndIncrement(); fIdToType.put(id, name); } return id; <END> }</code><technical_language>computeIfAbsent</technical_language>

Target:
private long getUniqueId(String name) { return fIdToType.inverse().computeIfAbsent(name, n -> ENTRY_ID.getAndIncrement()); }
Source:
<code>public ResolvedCds toSingleNameCds() { return ResolvedCds.builder() <START> .buySell(getBuySell().isBuy() ? BuySell.SELL : BuySell.BUY) <END> .dayCount(getDayCount()) .legalEntityId(getCdsIndexId()) .paymentOnDefault(getPaymentOnDefault()) .periodicPayments(getPeriodicPayments()) .protectionEndDate(getProtectionEndDate()) .protectionStart(getProtectionStart()) .stepinDateOffset(getStepinDateOffset()) .settlementDateOffset(getSettlementDateOffset()) .build(); }</code><technical_language>Simplify, pass getBuySell() in</technical_language>

Target:
public ResolvedCds toSingleNameCds() { return ResolvedCds.builder() .buySell(getBuySell().isBuy() ? BuySell.SELL : BuySell.BUY) .dayCount(getDayCount()) .legalEntityId(getCdsIndexId()) .paymentOnDefault(getPaymentOnDefault()) .paymentPeriods(getPaymentPeriods()) .protectionEndDate(getProtectionEndDate()) .protectionStart(getProtectionStart()) .stepinDateOffset(getStepinDateOffset()) .settlementDateOffset(getSettlementDateOffset()) .build(); }
Source:
<code>protected long sleepFor() { <START> return 200L; <END> }</code><technical_language>Is a this customisable? default in Wait is 500ms right</technical_language>

Target:
protected long sleepFor() { return 500L; }
Source:
<code>public void onDisplayChanged(int displayId) { <START> final int defaultDisplayId = getDefaultDisplayId(context); <END> if (displayId == defaultDisplayId || defaultDisplayId == DISPLAY_ID_UNKNOWN) { setSync(getDefaultDisplayRefreshRate(context)); } }</code><technical_language>Display.DEFAULT_DISPLAY (and remove getDefaultDisplayId)</technical_language>

Target:
public void onDisplayChanged(int displayId) { if (displayId == Display.DEFAULT_DISPLAY) { setSync(getDefaultDisplayRefreshRate(context)); } }
Source:
<code>public Statement apply(Statement current, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { try { setUp(); <START> } catch (Exception e) <END> Security.addProvider(provider); LdapService embeddedServer = startEmbeddedServer(); try { current.evaluate(); } catch (Exception e) { throw e; } finally { if (embeddedServer != null) { embeddedServer.close(); } Security.removeProvider(provider.getName()); } } }; }</code><technical_language>If setUp() throws exception for some reason, empty catch block prevent reported. evaluate() is declared throwing Throwable, try/catch block removed</technical_language>

Target:
public Statement apply(Statement current, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { setUp(); Security.addProvider(provider); LdapService embeddedServer = startEmbeddedServer(); try { current.evaluate(); } catch (Exception e) { throw e; } finally { if (embeddedServer != null) { embeddedServer.close(); } Security.removeProvider(provider.getName()); } } }; }
Source:
<code>public void testSimpleAttributeChangeIsVisibleOnServer() { ClientAttribute ca = new ClientAttribute("name", null); ClientPresentationModel cpm = new ClientPresentationModel("model", Arrays.asList(ca)); clientModelStore.add(cpm); <START> final AtomicReference<Command> receivedCommand = new AtomicReference<Command>(null); <END> CommandHandler testServerAction = new CommandHandler<ValueChangedCommand>() { @Override public void handleCommand(ValueChangedCommand command, List<Command> response) { receivedCommand.set(command); } }; serverConnector.getRegistry().register(ValueChangedCommand.class, testServerAction); ca.setValue("initial"); clientDolphin.sync(new Runnable() { @Override public void run() { Assert.assertNotNull(receivedCommand.get()); Assert.assertEquals("ValueChanged", receivedCommand.get().getId()); Assert.assertEquals(ValueChangedCommand.class, receivedCommand.get().getClass()); ValueChangedCommand cmd = (ValueChangedCommand) receivedCommand.get(); Assert.assertEquals(null, cmd.getOldValue()); Assert.assertEquals("initial", cmd.getNewValue()); config.assertionsDone(); } }); }</code><technical_language>remove Command <> right side</technical_language>

Target:
public void testSimpleAttributeChangeIsVisibleOnServer() { ClientAttribute ca = new ClientAttribute("name", null); ClientPresentationModel cpm = new ClientPresentationModel("model", Arrays.asList(ca)); clientModelStore.add(cpm); final AtomicReference<Command> receivedCommand = new AtomicReference<>(null); CommandHandler testServerAction = new CommandHandler<ValueChangedCommand>() { @Override public void handleCommand(ValueChangedCommand command, List<Command> response) { receivedCommand.set(command); } }; serverConnector.getRegistry().register(ValueChangedCommand.class, testServerAction); ca.setValue("initial"); clientDolphin.sync(new Runnable() { @Override public void run() { Assert.assertNotNull(receivedCommand.get()); Assert.assertEquals("ValueChanged", receivedCommand.get().getId()); Assert.assertEquals(ValueChangedCommand.class, receivedCommand.get().getClass()); ValueChangedCommand cmd = (ValueChangedCommand) receivedCommand.get(); Assert.assertEquals(null, cmd.getOldValue()); Assert.assertEquals("initial", cmd.getNewValue()); config.assertionsDone(); } }); }
Source:
<code>private String getCardIdPath() { <START> if (this.getOrigin().getCardId() == null) { <END> return this.getDestination().getCardId(); } return this.getOrigin().getCardId(); }</code><technical_language>"deposit".equalsIgnoreCase(this.getType())</technical_language>

Target:
private String getCardIdPath() { if ("deposit".equalsIgnoreCase(this.getType())) { return this.getDestination().getCardId(); } return this.getOrigin().getCardId(); }
Source:
<code>public List<Attribute> getRequiredAttributes(PerunSession sess, Member member, Group group, boolean workWithUserAttributes) throws InternalErrorException, WrongAttributeAssignmentException { <START> List<Resource> resources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, member); <END> Set<Attribute> attributes = new HashSet<Attribute>(); for(Resource resource : resources) { attributes.addAll(this.getResourceRequiredAttributes(sess, resource, member, group)); } attributes.addAll(this.getRequiredAttributes(sess, member, workWithUserAttributes)); return new ArrayList<Attribute>(attributes); }</code><technical_language>This return resources member is assigned. get resources assigned group do intersection of groups resource member</technical_language>

Target:
public List<Attribute> getRequiredAttributes(PerunSession sess, Member member, Group group, boolean workWithUserAttributes) throws InternalErrorException, WrongAttributeAssignmentException { List<Resource> memberResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, member); List<Resource> groupResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group); memberResources.retainAll(groupResources); Set<Attribute> attributes = new HashSet<Attribute>(); for(Resource resource : memberResources) { attributes.addAll(this.getResourceRequiredAttributes(sess, resource, member, group)); } attributes.addAll(this.getRequiredAttributes(sess, member, workWithUserAttributes)); return new ArrayList<Attribute>(attributes); }
Source:
<code>private void validateResources() { ResourceConfigs resourceConfigs = getResources(); <START> if (isElastic() && !resourceConfigs.isEmpty()) { <END> errors.add("elasticAgentId", "Elastic agents cannot have resources."); return; } resourceConfigs.validate(null); if (resourceConfigs.hasErrors()) { errors.addAll(resourceConfigs.errors()); } }</code><technical_language>key for errors resources</technical_language>

Target:
private void validateResources() { ResourceConfigs resourceConfigs = new ResourceConfigs(getResources()); if (isElastic() && !resourceConfigs.isEmpty()) { errors.add(RESOURCES, "Elastic agents cannot have resources."); return; } resourceConfigs.validate(null); if (resourceConfigs.hasErrors()) { errors.addAll(resourceConfigs.errors()); } }
Source:
<code>public void testClose() throws InterruptedException, TimeoutException, ExecutionException, NetworkException, InjectionException { <START> setup(0); <END> ParameterWorkerTestUtil.close(parameterWorker, mockSender, workerHandler); }</code><technical_language>setup(Long.MAX_VALUE)? 0ms timeout works wait(timeout) for checking timeout</technical_language>

Target:
public void testClose() throws InterruptedException, TimeoutException, ExecutionException, NetworkException, InjectionException { prepare(Long.MAX_VALUE); ParameterWorkerTestUtil.close(parameterWorker, mockSender, workerHandler); }
Source:
<code>public void initializeUsers() { String activeUserString = GoogleLoginPrefs.getActiveUser(); List<String> allUsers = GoogleLoginPrefs.getStoredUsers(); String removedUsers = ""; for (String aUser : allUsers) { users.addUser(new CredentialedUser(aUser)); GoogleLoginState delegate = createGoogleLoginState(true); if(delegate == null) { removedUsers += aUser + ", "; if(aUser.equals(activeUserString)) { activeUserString = null; } users.removeUser(aUser); continue; } IGoogleLoginCompletedCallback callback = new IGoogleLoginCompletedCallback() { @Override public void onLoginCompleted() { uiFacade.notifyStatusIndicator(); } }; users.addUser(new CredentialedUser(delegate, callback)); } if(activeUserString == null) { users.removeActiveUser(); } else { try { users.setActiveUser(activeUserString); } catch (IllegalArgumentException ex) { LOG.warn("Error while initiating users", ex); users.removeActiveUser(); } } if (!removedUsers.isEmpty()) { <START> LOG.warn("The following user(s) had expired authentication scopes: " <END> + removedUsers + "and have been logged out."); } }</code><technical_language>LOG.info</technical_language>

Target:
public void initializeUsers() { String activeUserString = GoogleLoginPrefs.getActiveUser(); List<String> allUsers = GoogleLoginPrefs.getStoredUsers(); String removedUsers = ""; for (String aUser : allUsers) { users.addUser(new CredentialedUser(aUser)); GoogleLoginState delegate = createGoogleLoginState(true); if(delegate == null) { removedUsers += aUser + ", "; if(aUser.equals(activeUserString)) { activeUserString = null; } users.removeUser(aUser); continue; } IGoogleLoginCompletedCallback callback = new IGoogleLoginCompletedCallback() { @Override public void onLoginCompleted() { uiFacade.notifyStatusIndicator(); } }; users.addUser(new CredentialedUser(delegate, callback)); } if(activeUserString == null) { users.removeActiveUser(); } else { try { users.setActiveUser(activeUserString); } catch (IllegalArgumentException ex) { LOG.warn("Error while initiating users", ex); users.removeActiveUser(); } } if (!removedUsers.isEmpty()) { LOG.info("The following user(s) had expired authentication scopes: " + removedUsers + "and have been logged out."); } }
Source:
<code>public String toString() { <START> return "" + seatGroup + seatNumber; <END> }</code><technical_language>This hideous, please change this</technical_language>

Target:
public String toString() { return seatGroup + seatNumber; }
Source:
<code>boolean maybeCommit() { final int committed; if (now - lastCommitMs > commitTimeMs) { if (log.isTraceEnabled()) { log.trace("Committing all active tasks and standby tasks since {}ms has elapsed (commit interval is {}ms)", taskManager.activeTaskIds(), taskManager.standbyTaskIds(), now - lastCommitMs, commitTimeMs); } committed = taskManager.commitAllActive(); if (committed > 0) { if (eosBetaEnabled) { producer.commitTransaction(); <START> producer.beginTransaction(); <END> } } if (committed > 0 || taskManager.commitAllStandby() > 0) { final long intervalCommitLatency = advanceNowAndComputeLatency(); commitSensor.record(intervalCommitLatency / (double) committed, now); if (log.isDebugEnabled()) { log.debug("Committed all active tasks and standby tasks in {}ms", taskManager.activeTaskIds(), taskManager.standbyTaskIds(), intervalCommitLatency); } } if (committed > 0) { taskManager.maybePurgeCommitedRecords(); } if (committed == -1) { log.trace("Unable to commit as we are in the middle of a rebalance, will try again when it completes."); } else { lastCommitMs = now; } processStandbyRecords = true; } else { committed = taskManager.maybeCommitActiveTasksPerUserRequested(); if (committed > 0) { final long requestCommitLatency = advanceNowAndComputeLatency(); commitSensor.record(requestCommitLatency / (double) committed, now); } } return committed > 0; }</code><technical_language>@mjsax , clarify, asking <LINK_0> conflict in some restructuring commit logic? I so. changing tasks' lifecycles managed, encapsulated thread's perspective</technical_language>

Target:
boolean maybeCommit() { final int committed; if (now - lastCommitMs > commitTimeMs) { if (log.isTraceEnabled()) { log.trace("Committing all active tasks and standby tasks since {}ms has elapsed (commit interval is {}ms)", taskManager.activeTaskIds(), taskManager.standbyTaskIds(), now - lastCommitMs, commitTimeMs); } committed = taskManager.commitAllActive(); if (committed > 0) { if (eosBetaEnabled) { producer.commitTransaction(); producer.beginTransaction(); } } if (committed > 0 || taskManager.commitAllStandby() > 0) { final long intervalCommitLatency = advanceNowAndComputeLatency(); commitSensor.record(intervalCommitLatency / (double) committed, now); if (log.isDebugEnabled()) { log.debug("Committed all active tasks and standby tasks in {}ms", taskManager.activeTaskIds(), taskManager.standbyTaskIds(), intervalCommitLatency); } } if (committed > 0) { taskManager.maybePurgeCommittedRecords(); } if (committed == -1) { log.trace("Unable to commit as we are in the middle of a rebalance, will try again when it completes."); } else { lastCommitMs = now; } processStandbyRecords = true; } else { committed = taskManager.maybeCommitActiveTasksPerUserRequested(); if (committed > 0) { if (eosBetaEnabled) { taskManager.commitAllActive(); producer.commitTransaction(); producer.beginTransaction(); } final long requestCommitLatency = advanceNowAndComputeLatency(); commitSensor.record(requestCommitLatency / (double) committed, now); } } return committed > 0; }
Source:
<code>public void testCreateFileHeader_Binary() throws Exception { ObjectId adId = blob("a\nd\n"); ObjectId binId = blob("a\nb\nc\n\0\0\0\0d\n"); String diffHeader = makeDiffHeader(PATH_A, PATH_B, adId, binId) <START> + "Binary files differ\n"; <END> DiffEntry ad = DiffEntry.delete(PATH_A, adId); DiffEntry abcd = DiffEntry.add(PATH_B, binId); DiffEntry mod = DiffEntry.pair(ChangeType.MODIFY, ad, abcd, 0); FileHeader fh = df.createFileHeader(mod); assertEquals(diffHeader, RawParseUtils.decode(fh.getBuffer())); assertEquals(1, fh.getHunks().size()); HunkHeader hh = fh.getHunks().get(0); assertEquals(0, hh.toEditList().size()); }</code><technical_language>resulting FileHeader PatchType.BINARY. setting in this case</technical_language>

Target:
public void testCreateFileHeader_Binary() throws Exception { ObjectId adId = blob("a\nd\n"); ObjectId binId = blob("a\nb\nc\n\0\0\0\0d\n"); String diffHeader = makeDiffHeader(PATH_A, PATH_B, adId, binId) + "Binary files differ\n"; DiffEntry ad = DiffEntry.delete(PATH_A, adId); DiffEntry abcd = DiffEntry.add(PATH_B, binId); DiffEntry mod = DiffEntry.pair(ChangeType.MODIFY, ad, abcd, 0); FileHeader fh = df.createFileHeader(mod); assertEquals(diffHeader, RawParseUtils.decode(fh.getBuffer())); assertEquals(FileHeader.PatchType.BINARY, fh.getPatchType()); assertEquals(1, fh.getHunks().size()); HunkHeader hh = fh.getHunks().get(0); assertEquals(0, hh.toEditList().size()); }
Source:
<code>public User setSpecificUser(PerunSession sess, User specificUser, SpecificUserType specificUserType, User owner) throws InternalErrorException, RelationExistsException, UserNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); Utils.notNull(specificUserType, "specificUserType"); getPerunBl().getUsersManagerBl().checkUserExists(sess, owner); getPerunBl().getUsersManagerBl().checkUserExists(sess, specificUser); <START> if(!AuthzResolver.authorizedInternal(sess, "setSpecificUser_User_SpecificUserType_User_policy", Collections.singletonList(specificUser))) { <END> throw new PrivilegeException(sess, "Only PerunAdmin should have rights to call this method."); } return getUsersManagerBl().setSpecificUser(sess, specificUser, specificUserType, owner); }</code><technical_language>question above</technical_language>

Target:
public User setSpecificUser(PerunSession sess, User specificUser, SpecificUserType specificUserType, User owner) throws InternalErrorException, RelationExistsException, UserNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); Utils.notNull(specificUserType, "specificUserType"); getPerunBl().getUsersManagerBl().checkUserExists(sess, owner); getPerunBl().getUsersManagerBl().checkUserExists(sess, specificUser); if(!AuthzResolver.authorizedInternal(sess, "setSpecificUser_User_SpecificUserType_User_policy", Collections.singletonList(specificUser)) && !AuthzResolver.authorizedInternal(sess, "owner-setSpecificUser_User_SpecificUserType_User_policy", Collections.singletonList(owner))) { throw new PrivilegeException(sess, "Only PerunAdmin should have rights to call this method."); } return getUsersManagerBl().setSpecificUser(sess, specificUser, specificUserType, owner); }
Source:
<code><START> public int queuedJobsUniqueTimes() { <END> synchronized(timedJobsByTime) { return timedJobsByTime.size(); } }</code><technical_language>I this part of public API. Do need this of unit tests? If not, please package-private</technical_language>

Target:
int queuedJobsUniqueTimes() { synchronized(timedJobsByTime) { return timedJobsByTime.size(); } }
Source:
<code>public void run() { HttpContext context = new BasicHttpContext(null); try { if (!Thread.interrupted() && conn.isOpen()) { httpservice.handleRequest(conn, context); } } catch (ConnectionClosedException ex) { LogUtil.w("Client closed connection: %s", ex); } catch (IOException ex) { LogUtil.w("I/O error: %s", ex); } catch (HttpException ex) { LogUtil.w("Unrecoverable HTTP protocol violation: %s", ex); <START> } catch (OutOfMemoryError ex) { <END> LogUtil.w("Out of memory during download: %s", ex); } finally { try { conn.close(); } catch (IOException ignore) { } } }</code><technical_language>high level of a catch. Strongly recommend putting this in critical places, Network#readResponseBody (specifically readFile call) NetworkEventReporterImpl#readBodyAsString. I prefer this strategy is specific suppressing this serious error in call sites expect accidentally allocate larger segments expect. other code this. Also, catching levels allows respond actual DevTools protocol UI represent error in a discoverable fashion</technical_language>

Target:
public void run() { HttpContext context = new BasicHttpContext(null); try { if (!Thread.interrupted() && conn.isOpen()) { httpservice.handleRequest(conn, context); } } catch (ConnectionClosedException ex) { LogUtil.w("Client closed connection: %s", ex); } catch (IOException ex) { LogUtil.w("I/O error: %s", ex); } catch (HttpException ex) { LogUtil.w("Unrecoverable HTTP protocol violation: %s", ex); } finally { try { conn.close(); } catch (IOException ignore) { } } }
Source:
<code>public String getMessage() { <START> if( this.moduleTargets == null ) <END> return this.symbolName + " is not defined in symbolTable"; else return this.symbolName + " is not defined in " + String.join( ".", this.moduleTargets ); }</code><technical_language>missing curly brackets</technical_language>

Target:
public String getMessage() { if( this.importPath == null ) { return this.symbolName + " is not defined in symbolTable"; } return this.symbolName + " is not defined in " + importPath; }
Source:
<code>public void downloadFile(File destination, URI downloadUri) throws IOException, DownloadException { CloseableHttpResponse response = execute(downloadUri); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { throw new DownloadException( "Got error code " + statusCode + " from the server."); } new File( FilenameUtils.getFullPathNoEndSeparator(destination.toString())) <START> .mkdirs(); <END> ReadableByteChannel rbc = Channels .newChannel(response.getEntity().getContent()); try (FileOutputStream fos = new FileOutputStream(destination)) { fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Exceptional return of java.io.File.mkdirs() in com.vaadin.flow.server.frontend.installer.DefaultFileDownloader.downloadFile(File, URI) [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private void downloadFile(File destination, URI downloadUri) throws IOException, DownloadException { CloseableHttpResponse response = execute(downloadUri); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != 200) { throw new DownloadException( "Got error code " + statusCode + " from the server."); } new File( FilenameUtils.getFullPathNoEndSeparator(destination.toString())) .mkdirs(); try (ReadableByteChannel rbc = Channels.newChannel(response.getEntity() .getContent()); FileOutputStream fos = new FileOutputStream( destination)) { fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); } }
Source:
<code>public void handleDataChange(String dataPath, Object data) { LOG.info("got notification about barrier " + barrierStatePath + "; done=" + data); if (notAValidEvent()) return; State barrierState = (State) data; <START> if (!Objects.equals(barrierState, State.NEW)) { <END> zkUtils.unsubscribeDataChanges(barrierStatePath, this); barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierStateChanged(barrierVersion, (State) data)); } }</code><technical_language>explicit in state-checks here. states for terminal states: DONE, TIMED_OUT. This code immune refactors - for instance, if adds another state barrier state machine want this code-path triggered prior subscriptions cancelled</technical_language>

Target:
public void handleDataChange(String dataPath, Object data) { LOG.info(String.format("Received barrierState change notification for barrier version: %s from zkNode: %s with data: %s.", barrierVersion, dataPath, data)); if (notAValidEvent()) return; State barrierState = (State) data; List<State> expectedBarrierStates = ImmutableList.of(State.DONE, State.TIMED_OUT); if (barrierState != null && expectedBarrierStates.contains(barrierState)) { zkUtils.unsubscribeDataChanges(barrierStatePath, this); barrierListenerOptional.ifPresent(zkBarrierListener -> zkBarrierListener.onBarrierStateChanged(barrierVersion, (State) data)); } else { LOG.debug("Barrier version: is at state: {}. Ignoring the barrierState change notification.", barrierVersion, barrierState); } }
Source:
<code><START> protected String deduceIdentifierQuoteString( <END> DatabaseMetaData databaseMetaData) { return null; }</code><technical_language>quotes all? This work drillthrough operations, column alias words. quoting create invalid SQL</technical_language>

Target:
protected String deduceIdentifierQuoteString( DatabaseMetaData databaseMetaData) { return "`"; }
Source:
<code>synchronized void updateTimeRangeSelectionPieChart() { if (getTimeRangePC() == null) { fTimeRangePC = new PieChart(this, SWT.NONE); getTimeRangePC().getTitle().setText(fTimeRangePCname); getTimeRangePC().getAxisSet().getXAxis(0).getTitle().setText(""); <START> getTimeRangePC().getLegend().setPosition(SWT.RIGHT); <END> getTimeRangePC().getLegend().setVisible(true); getTimeRangePC().addListener(SWT.MouseMove, fMouseMoveListener); getTimeRangePC().addMouseListener(fMouseClickListener); } else if (getTimeRangePC().isDisposed()) { return; } Map<String, Long> totalEventCountForChart = getTotalEventCountForChart(false); if (totalEventCountForChart == null) { return; } updatePieChartWithData(fTimeRangePC, totalEventCountForChart, MIN_PRECENTAGE_TO_SHOW_SLICE, fOthersSliceName); }</code><technical_language>reason change this? related change</technical_language>

Target:
synchronized void updateTimeRangeSelectionPieChart() { if (getTimeRangePC() == null) { fTimeRangePC = new PieChart(this, SWT.NONE); getTimeRangePC().getTitle().setText(fTimeRangePCname); getTimeRangePC().getAxisSet().getXAxis(0).getTitle().setText(""); getTimeRangePC().getLegend().setPosition(SWT.BOTTOM); getTimeRangePC().getLegend().setVisible(true); getTimeRangePC().addListener(SWT.MouseMove, fMouseMoveListener); getTimeRangePC().addMouseListener(fMouseClickListener); } else if (getTimeRangePC().isDisposed()) { return; } Map<String, Long> totalEventCountForChart = getTotalEventCountForChart(false); if (totalEventCountForChart == null) { return; } updatePieChartWithData(fTimeRangePC, totalEventCountForChart, MIN_PRECENTAGE_TO_SHOW_SLICE, fOthersSliceName); }
Source:
<code>static Process launchPy4jPythonClient( GatewayServer gatewayServer, ReadableConfig config, List<String> commands, String entryPointScript, String tmpDir) throws IOException { <START> PythonEnvUtils.PythonEnvironment pythonEnv = PythonEnvUtils.preparePythonEnvironment( <END> config, entryPointScript, tmpDir); pythonEnv.systemEnv.put("PYFLINK_GATEWAY_PORT", String.valueOf(gatewayServer.getListeningPort())); pythonEnv.systemEnv.put("PYFLINK_CALLBACK_PORT", String.valueOf(gatewayServer.getCallbackClient().getPort())); return PythonEnvUtils.startPythonProcess(pythonEnv, commands); }</code><technical_language>remove PythonEnvUtils prefix method is in PythonEnvUtils</technical_language>

Target:
static Process launchPy4jPythonClient( GatewayServer gatewayServer, ReadableConfig config, List<String> commands, String entryPointScript, String tmpDir) throws IOException { PythonEnvironment pythonEnv = PythonEnvUtils.preparePythonEnvironment( config, entryPointScript, tmpDir); pythonEnv.systemEnv.put("PYFLINK_GATEWAY_PORT", String.valueOf(gatewayServer.getListeningPort())); pythonEnv.systemEnv.put("PYFLINK_CALLBACK_PORT", String.valueOf(gatewayServer.getCallbackClient().getPort())); return PythonEnvUtils.startPythonProcess(pythonEnv, commands); }
Source:
<code>public void accept(final List<SearchResult<?>> results) { if (results.isEmpty()) { return; } SearchResult[] searchResults = results.toArray(new SearchResult[0]); list.setListData(searchResults); int searchResultLength = searchResults.length; if (searchResultLength < 9) { <START> list.setVisibleRowCount(searchResultLength); <END> } JScrollPane scrollPane = new JScrollPane(list); scrollPane.setBorder(BorderFactory.createEmptyBorder()); final JPopupMenu popup = new JPopupMenu(); popup.add(scrollPane); popup.show(searchBox, 0, searchBox.getHeight()); list.requestFocusInWindow(); list.setSelectedIndex(0); onSelect = new Runnable() { @Override public void run() { onSelect(popup, results); } }; onDismiss = new Runnable() { @Override public void run() { popup.setVisible(false); searchBox.requestFocusInWindow(); } }; }</code><technical_language>Please add else block set visible row count 10 if enough results. dropdown shrinks small height search results</technical_language>

Target:
public void accept(final List<SearchResult<?>> results) { if (results.isEmpty()) { return; } SearchResult[] searchResults = results.toArray(new SearchResult[0]); list.setListData(searchResults); int searchResultLength = searchResults.length; if (searchResultLength < 9) { list.setVisibleRowCount(searchResultLength); } else { list.setVisibleRowCount(10); } JScrollPane scrollPane = new JScrollPane(list); scrollPane.setBorder(BorderFactory.createEmptyBorder()); final JPopupMenu popup = new JPopupMenu(); popup.add(scrollPane); popup.show(searchBox, 0, searchBox.getHeight()); list.requestFocusInWindow(); list.setSelectedIndex(0); onSelect = new Runnable() { @Override public void run() { onSelect(popup, results); } }; onDismiss = new Runnable() { @Override public void run() { popup.setVisible(false); searchBox.requestFocusInWindow(); } }; }
Source:
<code>public ReplicationStats execute(Client client) throws Exception { WalReplication edits = getWalEdits(target, input, p, status, sizeLimit, tids); log.debug("Read WAL entries and retained bytes of WAL entries for replication to peer '{}'", (Long.MAX_VALUE == edits.entriesConsumed) ? "all remaining" : edits.entriesConsumed, edits.sizeInBytes, p); if (0 < edits.walEdits.getEditsSize()) { if (Thread.interrupted()) { <START> log.debug("Replication work interrupted before writing edits, returning empty replstats"); <END> return new ReplicationStats(0L, 0L, 0L); } log.debug("Sending edits", edits.walEdits.getEditsSize()); long entriesReplicated = client.replicateLog(remoteTableId, edits.walEdits, tcreds); if (Thread.interrupted()) { log.debug("Replication work interrupted after writing edits, returning empty replstats"); return new ReplicationStats(0L, 0L, 0L); } if (entriesReplicated != edits.numUpdates) { log.warn("Sent WAL entries for replication but were reported as replicated", edits.numUpdates, entriesReplicated); } else { log.debug("Replicated edits", entriesReplicated); } return edits; } else if (edits.entriesConsumed > 0) { return edits; } return new ReplicationStats(0l, 0l, 0l); }</code><technical_language>nit: words instead of replstats here, please</technical_language>

Target:
public ReplicationStats execute(Client client) throws Exception { WalReplication edits = getWalEdits(target, input, p, status, sizeLimit, tids); log.debug("Read WAL entries and retained bytes of WAL entries for replication to peer '{}'", (Long.MAX_VALUE == edits.entriesConsumed) ? "all remaining" : edits.entriesConsumed, edits.sizeInBytes, p); if (0 < edits.walEdits.getEditsSize()) { log.debug("Sending edits", edits.walEdits.getEditsSize()); long entriesReplicated = client.replicateLog(remoteTableId, edits.walEdits, tcreds); if (entriesReplicated != edits.numUpdates) { log.warn("Sent WAL entries for replication but were reported as replicated", edits.numUpdates, entriesReplicated); } else { log.debug("Replicated edits", entriesReplicated); } return edits; } else if (edits.entriesConsumed > 0) { return edits; } return new ReplicationStats(0l, 0l, 0l); }