auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public OAuth2TokenValidatorResult validate(Jwt idToken) { Map<String, Object> invalidClaims = validateRequiredClaims(idToken); if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } <START> if (!issuerMatchesMetadata(idToken)) { <END> invalidClaims.put(IdTokenClaimNames.ISS, idToken.getIssuer()); } if (!idToken.getAudience().contains(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AUD, idToken.getAudience()); } String authorizedParty = idToken.getClaimAsString(IdTokenClaimNames.AZP); if (idToken.getAudience().size() > 1 && authorizedParty == null) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } if (authorizedParty != null && !authorizedParty.equals(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } Instant now = Instant.now(this.clock); if (now.minus(this.clockSkew).isAfter(idToken.getExpiresAt())) { invalidClaims.put(IdTokenClaimNames.EXP, idToken.getExpiresAt()); } if (now.plus(this.clockSkew).isBefore(idToken.getIssuedAt())) { invalidClaims.put(IdTokenClaimNames.IAT, idToken.getIssuedAt()); } if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } return OAuth2TokenValidatorResult.success(); }</code><technical_language>move validation check remove method</technical_language>

Target:
public OAuth2TokenValidatorResult validate(Jwt idToken) { Map<String, Object> invalidClaims = validateRequiredClaims(idToken); if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } String metadataIssuer = (String) this.clientRegistration.getProviderDetails().getConfigurationMetadata() .get("issuer"); if (metadataIssuer != null && !Objects.equals(metadataIssuer, idToken.getIssuer().toExternalForm())) { invalidClaims.put(IdTokenClaimNames.ISS, idToken.getIssuer()); } if (!idToken.getAudience().contains(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AUD, idToken.getAudience()); } String authorizedParty = idToken.getClaimAsString(IdTokenClaimNames.AZP); if (idToken.getAudience().size() > 1 && authorizedParty == null) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } if (authorizedParty != null && !authorizedParty.equals(this.clientRegistration.getClientId())) { invalidClaims.put(IdTokenClaimNames.AZP, authorizedParty); } Instant now = Instant.now(this.clock); if (now.minus(this.clockSkew).isAfter(idToken.getExpiresAt())) { invalidClaims.put(IdTokenClaimNames.EXP, idToken.getExpiresAt()); } if (now.plus(this.clockSkew).isBefore(idToken.getIssuedAt())) { invalidClaims.put(IdTokenClaimNames.IAT, idToken.getIssuedAt()); } if (!invalidClaims.isEmpty()) { return OAuth2TokenValidatorResult.failure(invalidIdToken(invalidClaims)); } return OAuth2TokenValidatorResult.success(); }
Source:
<code>public void add(double element) { int index = getInsertIndex(); if (index >= 0) { <START> putAtIndex(index, Double.valueOf(element)); <END> } }</code><technical_language>inline getInsertIndex putAtIndex ++count; int index; if (elements.length < maxSamples) { index = elements.length; } else { index = ThreadLocalRandom.current().nextInt(0, (int) count); } if (index < elements.length) { if (elements.length < maxSamples) { double[] newElements = new double[elements.length + 1]; System.arraycopy(elements, 0, newElements, 0, elements.length); elements = newElements; } elements[index] = element; }</technical_language>

Target:
public void add(double element) { if (++count <= samples.length) { samples[count - 1] = element; return; } int index = ThreadLocalRandom.current().nextInt(0, count); if (index < samples.length) { samples[index] = element; } }
Source:
<code>private static Map<String, String> readProperties() { try { File file = new File(AndroidLocation.getFolder(), PATH_FIRST_RUN_PROPERTIES); if (file.isFile()) { Map<String, String> properties = Maps.newHashMap(); try { final List<String> lines = Files.readLines(file, Charsets.UTF_16LE); for (String line : lines) { <START> int keyValueSeparator = line.indexOf('='); <END> final String key = line.substring(0, keyValueSeparator); final String value = line.substring(keyValueSeparator + 1); properties.put(key, value); } } catch (IOException e) { Logger.getInstance(InstallerData.class).error(e); } return properties; } } catch (AndroidLocation.AndroidLocationException e) { Logger.getInstance(InstallerData.class).error(e); } return null; }</code><technical_language>need check keyValueSeparator is -1 (ie = in line)</technical_language>

Target:
private static Map<String, String> readProperties() { try { File file = new File(AndroidLocation.getFolder(), PATH_FIRST_RUN_PROPERTIES); if (file.isFile()) { Map<String, String> properties = Maps.newHashMap(); try { final List<String> lines = Files.readLines(file, Charsets.UTF_16LE); for (String line : lines) { int keyValueSeparator = line.indexOf('='); if (keyValueSeparator < 0) { continue; } final String key = line.substring(0, keyValueSeparator).trim(); final String value = line.substring(keyValueSeparator + 1).trim(); if (key == "") { continue; } properties.put(key, value); } } catch (IOException e) { Logger.getInstance(InstallerData.class).error(e); } return properties; } } catch (AndroidLocation.AndroidLocationException e) { Logger.getInstance(InstallerData.class).error(e); } return null; }
Source:
<code>public void serialize(LocalDateTime date, JsonGenerator generator, SerializerProvider serializerProvider) throws IOException { <START> dateTimeFormatter.withZone(ZoneId.of("Z")); <END> generator.writeString(dateTimeFormatter.format(date)); }</code><technical_language>UTC Z ? :sweat:</technical_language>

Target:
public void serialize(LocalDateTime date, JsonGenerator generator, SerializerProvider serializerProvider) throws IOException { dateTimeFormatter.withZone(of("UTC")); generator.writeString(dateTimeFormatter.format(date)); }
Source:
<code>public void disconnect() { <START> Object lock = partitions != null ? partitions : new Object(); <END> synchronized (lock) { document = null; partitions = null; try { inputStream.close(); } catch (IOException e) { } } }</code><technical_language>this sense. synchronizing a new object is meaningless. I do partitions null, if want synchronize this object, final null, instead simply clear() dispose</technical_language>

Target:
public void disconnect() { Object lock = partitions != null ? partitions : new Object(); synchronized (lock) { document = null; partitions.clear(); try { inputStream.close(); } catch (IOException e) { } } }
Source:
<code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Check logcat!"); setContentView(tv); printArgs("The", "Quick", "Brown", "Fox"); Log.i("Fibonacci", "fibonacci's 4th number is " + fibonacci(4)); Greeter greeter = new Greeter("Jake"); Log.d("Greeting", greeter.sayHello()); <START> (new Annonymous() { <END> @Override @DebugLog public String whoIsThis() { return "I'm a nobody!"; } }).whoIsThis(); }</code><technical_language>delete changes in this file? write proper tests for stuff this merging. I want overly clutter this example (more is)</technical_language>

Target:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Check logcat!"); setContentView(tv); printArgs("The", "Quick", "Brown", "Fox"); Log.i("Fibonacci", "fibonacci's 4th number is " + fibonacci(4)); Greeter greeter = new Greeter("Jake"); Log.d("Greeting", greeter.sayHello()); }
Source:
<code><START> public int compareTo(PersonName other) { <END> int ret = isVoided().compareTo(other.isVoided()); if (ret == 0) ret = other.isPreferred().compareTo(isPreferred()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyName(), other.getFamilyName()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyName2(), other.getFamilyName2()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getGivenName(), other.getGivenName()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getMiddleName(), other.getMiddleName()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyNamePrefix(), other.getFamilyNamePrefix()); if (ret == 0) ret = OpenmrsUtil.compareWithNullAsGreatest(getFamilyNameSuffix(), other.getFamilyNameSuffix()); if (ret == 0 && getDateCreated() != null) ret = OpenmrsUtil.compareWithNullAsLatest(getDateCreated(), other.getDateCreated()); if (ret == 0 && !equalsContent(other)) ret = 1; return ret; }</code><technical_language>here, change code, remove deprecate annotation</technical_language>

Target:
public int compareTo(PersonName other) { DefaultComparator pnDefaultComparator = new DefaultComparator(); return pnDefaultComparator.compare(this, other); }
Source:
<code>public void init() { <START> eventIpcManager.addEventListener(this); <END> }</code><technical_language>set collection of UEIs interested in, instead of a a callback for single event</technical_language>

Target:
public void init() { eventIpcManager.addEventListener(this, UEI_LIST); }
Source:
<code><START> public RequestStatus createResourcesAuthorized(Request request) <END> throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { Set<Resource> resources = new HashSet<>(); ResourceProvider userResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.User, getManagementController()); ResourceProvider privilegeResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.UserPrivilege, getManagementController()); ResourceProvider userAuthenticationSourceResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.UserAuthenticationSource, getManagementController()); ResourceProvider activeWidgetLayoutResourceProvider = AbstractControllerResourceProvider.getResourceProvider(Resource.Type.ActiveWidgetLayout, getManagementController()); for (Map<String, Object> requestProperties : request.getProperties()) { if (userResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, UserResourceProvider.USER_USERNAME_PROPERTY_ID); resources.addAll(userResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during users retrieving", e); } } if (privilegeResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, UserPrivilegeResourceProvider.USER_NAME); resources.addAll(privilegeResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during privileges retrieving", e); } } if (userAuthenticationSourceResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, UserAuthenticationSourceResourceProvider.AUTHENTICATION_USER_NAME_PROPERTY_ID); resources.addAll(userAuthenticationSourceResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during user authentication sources retrieving", e); } } if (activeWidgetLayoutResourceProvider != null) { try { Predicate predicate = getPredicate(requestProperties, ActiveWidgetLayoutResourceProvider.WIDGETLAYOUT_USERNAME_PROPERTY_ID); resources.addAll(activeWidgetLayoutResourceProvider.getResources(request, predicate)); } catch (NoSuchResourceException e) { throw new SystemException("Error during active widgets layouts retrieving", e); } } } return getRequestStatus(null, resources); }</code><technical_language>simplify current provider: data a safe spot authorize user post request. user profile pulled api endpoint</technical_language>

Target:
public RequestStatus createResourcesAuthorized(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException { return getRequestStatus(null); }
Source:
<code>public void canLoadPlugin() { <START> System.out.println(TestPlugin.class.getCanonicalName()); <END> config.setEnabledScheme("test-plugin"); final AuthenticationPlugin<?> plugin = AuthenticationPluginLoader.load(config); assertThat(plugin, instanceOf(TestPlugin.class)); }</code><technical_language>Do need this line</technical_language>

Target:
public void canLoadPlugin() { config.setEnabledScheme("test-plugin"); final AuthenticationPlugin<?> plugin = AuthenticationPluginLoader.load(config); assertThat(plugin, instanceOf(TestPlugin.class)); }
Source:
<code><START> protected double getColumnWidth(String expressionIdentifierName) { <END> ExpressionIdentifier.NAME expressionName; try { expressionName = ExpressionIdentifier.NAME.valueOf(expressionIdentifierName); } catch (IllegalArgumentException e) { expressionName = ExpressionIdentifier.NAME.Other; } switch (expressionName) { case Index: return 70; case Description: return 300; default: return 114; } }</code><technical_language>I remember a similar (the same?) code else. I wrong</technical_language>

Target:
protected static double getColumnWidth(String expressionIdentifierName) { ExpressionIdentifier.NAME expressionName; try { expressionName = ExpressionIdentifier.NAME.valueOf(expressionIdentifierName); } catch (IllegalArgumentException e) { expressionName = ExpressionIdentifier.NAME.Other; } switch (expressionName) { case Index: return 70; case Description: return 300; default: return 114; } }
Source:
<code>private boolean checkLDAPCredentials() { if (username == null || password == null || ldap_provider_url == null || ldap_provider_url.length() == 0) { return false; } boolean isAuthenticated = false; String localPrincipal = ldap_sec_principal; if (localPrincipal != null && localPrincipal.contains("<")) { localPrincipal = localPrincipal.replace("<uid>", username); } else if (localPrincipal != null && localPrincipal.contains("[")) { localPrincipal = localPrincipal.replace("[uid]", username); } try { ActiveDirectory ad = new ActiveDirectory(username, password, ldap_init_context_factory, ldap_provider_url, ldap_protocol, ldap_auth_meth, localPrincipal); if (ldap_domain != null && ldap_user_attribute_map != null && !ldap_user_attribute_map.isEmpty()) { NamingEnumeration<SearchResult> answer = ad.searchUser(username, ldap_domain, Util.keysToArray(ldap_user_attribute_map)); isAuthenticated = ad.doesMatchUserAttribute(answer, ldap_user_attribute_map); } else { isAuthenticated = true; } } catch (Exception e) { System.out.println("ERROR in checkLDAPCredentials: " + e); <START> e.printStackTrace(); <END> isAuthenticated = false; } return isAuthenticated; }</code><technical_language>a logger</technical_language>

Target:
private boolean checkLDAPCredentials() { if (username == null || password == null || ldap_provider_url == null || ldap_provider_url.length() == 0) { return false; } boolean isAuthenticated = false; String localPrincipal = ldap_sec_principal; if (localPrincipal != null && localPrincipal.contains("<")) { localPrincipal = localPrincipal.replace("<uid>", username); } else if (localPrincipal != null && localPrincipal.contains("[")) { localPrincipal = localPrincipal.replace("[uid]", username); } try { ActiveDirectory ad = new ActiveDirectory(username, password, ldap_init_context_factory, ldap_provider_url, ldap_protocol, ldap_auth_meth, localPrincipal); if (ldap_domain != null && ldap_user_attribute_map != null && !ldap_user_attribute_map.isEmpty()) { NamingEnumeration<SearchResult> answer = ad.searchUser(username, ldap_domain, Util.keysToArray(ldap_user_attribute_map)); isAuthenticated = ad.doesMatchUserAttribute(answer, ldap_user_attribute_map); } else { isAuthenticated = true; } } catch (Exception e) { LOG.error("ERROR in checkLDAPCredentials: ", e); isAuthenticated = false; } return isAuthenticated; }
Source:
<code>private boolean categorizeMutableRealmIntegerField(VariableElement field) { if (!field.getModifiers().contains(Modifier.FINAL)) { Utils.error(String.format(Locale.US, "Field \"%s\", a MutableRealmInteger, must be final.", field.getSimpleName().toString())); return false; } containsMutableRealmInteger = true; <START> <END> return true; }</code><technical_language>spaces</technical_language>

Target:
private boolean categorizeMutableRealmIntegerField(VariableElement field) { if (field.getModifiers().contains(Modifier.FINAL)) { return true; } Utils.error(String.format(Locale.US, "Field \"%s\", a MutableRealmInteger, must be final.", field.getSimpleName().toString())); return false; }
Source:
<code>public DatagramReader createRangeReader(int count) { <START> if (0 < currentBitIndex) { <END> throw new IllegalStateException(); } int available = byteStream.available(); if (available < count) { throw new IllegalArgumentException( "requested " + count + " bytes exceeds available " + available + " bytes."); } if (byteStream instanceof RangeInputStream) { RangeInputStream range = (RangeInputStream) byteStream; return new DatagramReader(range.range(count)); } else { byte[] range = new byte[count]; byteStream.read(range, 0, count); return new DatagramReader(new RangeInputStream(range)); } }</code><technical_language>currentBitIndex > 0</technical_language>

Target:
public DatagramReader createRangeReader(int count) { if (currentBitIndex > 0) { throw new IllegalStateException(currentBitIndex + " bits unread!"); } int available = byteStream.available(); if (available < count) { throw new IllegalArgumentException( "requested " + count + " bytes exceeds available " + available + " bytes."); } if (byteStream instanceof RangeInputStream) { RangeInputStream range = (RangeInputStream) byteStream; return new DatagramReader(range.range(count)); } else { byte[] range = new byte[count]; byteStream.read(range, 0, count); return new DatagramReader(new RangeInputStream(range)); } }
Source:
<code>protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); if (throwable == null && runnable instanceof Future<?>) { try { ((Future<?>) runnable).get(); <START> } catch (CancellationException ce) { END> if (s_logger.isDebugEnabled()) { s_logger.debug("Task Cancelled: ", ce); } } catch (ExecutionException ee) { throwable = ee.getCause(); } catch (InterruptedException ie) { throwable = ie; } } if (throwable != null) { if (m_consumer == null) { s_logger.error("Error from ErrorHandlingScheduledThreadPool thread", throwable); } else { m_consumer.accept(throwable); } } }</code><technical_language>test if a future is cancelled calling Future.isCancelled() avoid this happening</technical_language>

Target:
protected void afterExecute(Runnable runnable, Throwable throwable) { super.afterExecute(runnable, throwable); assert(throwable == null); assert(runnable instanceof ScheduledFuture); try { ((Future<?>) runnable).get(); } catch (CancellationException ce) { if (s_logger.isDebugEnabled()) { s_logger.debug("Task Cancelled: ", ce); } } catch (ExecutionException ee) { throwable = ee.getCause(); } catch (InterruptedException ie) { throwable = ie; } if (throwable != null) { if (m_consumer == null) { s_logger.error("Error from ErrorHandlingScheduledThreadPool thread", throwable); } else { m_consumer.accept(throwable); } } }
Source:
<code>public void deleteForDevice(UUID deviceId) throws StateAccessException, SerializationException { List<Op> ops = new <START> ArrayList<Op>(); <END> List<TraceRequestConfig> traceRequests = new ArrayList<>(); String path = paths.getTraceRequestsPath(); if (zk.exists(path)) { Set<String> trIds = zk.getChildren(path); for (String id : trIds) { UUID uuid = UUID.fromString(id); TraceRequestConfig config = get(uuid); if (Objects.equals(config.deviceId, deviceId)) { ops.addAll(prepareDelete(uuid)); } } } zk.multi(ops); }</code><technical_language>needed</technical_language>

Target:
public void deleteForDevice(UUID deviceId) throws StateAccessException, SerializationException { List<Op> ops = new ArrayList<>(); String path = paths.getTraceRequestsPath(); if (zk.exists(path)) { Set<String> trIds = zk.getChildren(path); for (String id : trIds) { UUID uuid = UUID.fromString(id); TraceRequestConfig config = get(uuid); if (Objects.equals(config.deviceId, deviceId)) { ops.addAll(prepareDelete(uuid)); } } } zk.multi(ops); }
Source:
<code>protected void clearLeftoverExpiredKeyQueues(CachePartitionSegment container) { Iterator<ICacheRecordStore> iterator = container.recordStoreIterator(); while (iterator.hasNext()) { ICacheRecordStore store = iterator.next(); InvalidationQueue expiredKeys = store.getExpiredKeys(); <START> for (; ; ) { <END> if (expiredKeys.poll() == null) { break; } } } }</code><technical_language>this expiredKeys.clear()</technical_language>

Target:
protected void clearLeftoverExpiredKeyQueues(CachePartitionSegment container) { Iterator<ICacheRecordStore> iterator = container.recordStoreIterator(); while (iterator.hasNext()) { ICacheRecordStore store = iterator.next(); InvalidationQueue expiredKeys = store.getExpiredKeys(); expiredKeys.clear(); } }
Source:
<code>private String repeatZeros(int num) { <START> return CharBuffer.allocate(num).toString().replace('\0', '0'); <END> }</code><technical_language>Another small performance observation (address if like), allocating a char[], Arrays.fill('0') turning a String faster</technical_language>

Target:
private String repeatZeros(int num) { char[] zeros = new char[num]; Arrays.fill(zeros, '0'); return new String(zeros); }
Source:
<code>public void workingWithAgents() { dashboardWorkspace.selectTabInWorspaceMenu(TabNames.AGENTS); dashboardWorkspace.selectMachine("Workspace Agents", "dev-machine"); agents.forEach( (name, value) -> { dashboardWorkspace.checkAgentExists(name); }); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); dashboardWorkspace.switchAgentState(name); <START> loader.waitOnClosed(); <END> }); clickOnSaveButton(); agents.forEach( (name, value) -> { dashboardWorkspace.switchAgentState(name); loader.waitOnClosed(); }); clickOnSaveButton(); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); }); }</code><technical_language>Is correct placement for waiting of loader closed, start of **dashboardWorkspace.switchAgentState(name)** method previously in class <LINK_0></technical_language>

Target:
public void workingWithAgents() { dashboardWorkspace.selectTabInWorspaceMenu(TabNames.AGENTS); dashboardWorkspace.selectMachine("Workspace Agents", "dev-machine"); agents.forEach( (name, value) -> { dashboardWorkspace.checkAgentExists(name); }); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); dashboardWorkspace.switchAgentState(name); WaitUtils.sleepQuietly(1); }); clickOnSaveButton(); agents.forEach( (name, value) -> { dashboardWorkspace.switchAgentState(name); loader.waitOnClosed(); }); clickOnSaveButton(); agents.forEach( (name, value) -> { Assert.assertEquals(dashboardWorkspace.getAgentState(name), value); }); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; <START> if (getClass() != obj.getClass()) <END> return false; NetworkStatistics other = (NetworkStatistics) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (receiveDropRate == null) { if (other.receiveDropRate != null) return false; } else if (!receiveDropRate.equals(other.receiveDropRate)) return false; if (receiveRate == null) { if (other.receiveRate != null) return false; } else if (!receiveRate.equals(other.receiveRate)) return false; if (status != other.status) return false; if (transmitDropRate == null) { if (other.transmitDropRate != null) return false; } else if (!transmitDropRate.equals(other.transmitDropRate)) return false; if (transmitRate == null) { if (other.transmitRate != null) return false; } else if (!transmitRate.equals(other.transmitRate)) return false; return true; }</code><technical_language>Please instanceof check breaking Liskov substitution principal</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof NetworkStatistics) return false; NetworkStatistics other = (NetworkStatistics) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (receiveDropRate == null) { if (other.receiveDropRate != null) return false; } else if (!receiveDropRate.equals(other.receiveDropRate)) return false; if (receiveRate == null) { if (other.receiveRate != null) return false; } else if (!receiveRate.equals(other.receiveRate)) return false; if (status != other.status) return false; if (transmitDropRate == null) { if (other.transmitDropRate != null) return false; } else if (!transmitDropRate.equals(other.transmitDropRate)) return false; if (transmitRate == null) { if (other.transmitRate != null) return false; } else if (!transmitRate.equals(other.transmitRate)) return false; return true; }
Source:
<code><START> public static boolean isInSubDirectory(File baseDir, File file) { <END> try { file = file.getCanonicalFile(); } catch(IOException e) { return false; } return isInSubDirectoryInternal(baseDir, file); }</code><technical_language>Please convert baseDir absolute path too. Otherwise, jadx skips resources if run file full path like: jadx some.apk</technical_language>

Target:
public static boolean isInSubDirectory(File baseDir, File file) { try { file = file.getCanonicalFile(); baseDir = baseDir.getCanonicalFile(); } catch(IOException e) { return false; } return isInSubDirectoryInternal(baseDir, file); }
Source:
<code>private VdcReturnValueBase runVm() { RunVmParams runVmParams = new RunVmParams(getVmId()); runVmParams.setSessionId(getParameters().getSessionId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); runVmParams.setParentCommand(getActionType()); runVmParams.setParentParameters(getParameters()); runVmParams.setEndProcedure(EndProcedure.COMMAND_MANAGED); runVmParams.setRunAsStateless(!getVmPool().isStateful()); ExecutionContext runVmContext = createRunVmContext(); VdcReturnValueBase vdcReturnValue = runInternalAction(VdcActionType.RunVm, runVmParams, cloneContext().withExecutionContext(runVmContext) <START> .withLock(vmPoolHandler.createLock(getVmId())) <END> .withCompensationContext(null)); getTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); return vdcReturnValue; }</code><technical_language>another motivation store lock in this command is change this confusing code - createLock means people lock (and reuse lock acquired)</technical_language>

Target:
private VdcReturnValueBase runVm() { RunVmParams runVmParams = new RunVmParams(getVmId()); runVmParams.setSessionId(getParameters().getSessionId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); runVmParams.setParentCommand(getActionType()); runVmParams.setParentParameters(getParameters()); runVmParams.setEndProcedure(EndProcedure.COMMAND_MANAGED); runVmParams.setRunAsStateless(!getVmPool().isStateful()); ExecutionContext runVmContext = createRunVmContext(); VdcReturnValueBase vdcReturnValue = runInternalAction(VdcActionType.RunVm, runVmParams, cloneContext().withExecutionContext(runVmContext).withCompensationContext(null)); getTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); return vdcReturnValue; }
Source:
<code>public void loadingThroughSystemProperty_nonExistingFile() { System.setProperty("hazelcast.client.failover.config", "idontexist"); <START> new YamlClientFailoverConfigBuilder(); <END> }</code><technical_language>is base abstract class YamlClientFailoverConfigBuilder()? I expect abstract method instead</technical_language>

Target:
public void loadingThroughSystemProperty_nonExistingFile() { System.setProperty("hazelcast.client.failover.config", "idontexist"); buildConfig(); }
Source:
<code>private SpanStrategy calculateAlternateSpanStrategy(Attributes attributes) { List<SpanStrategy> strategies = new ArrayList<>(); String cssStyle = attributes.getCssStyle(); if (cssStyle != null) { Iterator<CssRule> rules = new CssParser().createRuleIterator(cssStyle); while (rules.hasNext()) { CssRule rule = rules.next(); if (rule.name.equals("font-weight") && rule.value.equals("bold")) { strategies.add(calculateAlternateSpanStrategy(SpanType.BOLD)); } else if (rule.name.equals("font-style") && rule.value.equals("italic")) { strategies.add(calculateAlternateSpanStrategy(SpanType.ITALIC)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("underline")) { strategies.add(calculateAlternateSpanStrategy(SpanType.UNDERLINED)); } else if (rule.name.equals("font-family") && isFontFamilyMonospace(rule)) { strategies.add(new SubstitutionWithoutCssSpanStrategy(SpanType.MONOSPACE)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("line-through")) { <START> strategies.add(new SubstitutionWithoutCssSpanStrategy(SpanType.DELETED)); <END> } } } strategies = ImmutableList.copyOf(FluentIterable.from(strategies).filter(not(isNull()))); if (strategies.isEmpty()) { return null; } else if (strategies.size() == 1) { return strategies.get(0); } return new CompositeSpanStrategy(strategies); }</code><technical_language>difference calling calculateAlternateSpanStrategy (as is done for underline decoration) returning SubstitutionWithCssSpanStrategy directly</technical_language>

Target:
private SpanStrategy calculateAlternateSpanStrategy(Attributes attributes) { List<SpanStrategy> strategies = new ArrayList<>(); String cssStyle = attributes.getCssStyle(); if (cssStyle != null) { Iterator<CssRule> rules = new CssParser().createRuleIterator(cssStyle); while (rules.hasNext()) { CssRule rule = rules.next(); if (rule.name.equals("font-weight") && rule.value.equals("bold")) { strategies.add(calculateAlternateSpanStrategy(SpanType.BOLD)); } else if (rule.name.equals("font-style") && rule.value.equals("italic")) { strategies.add(calculateAlternateSpanStrategy(SpanType.ITALIC)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("underline")) { strategies.add(calculateAlternateSpanStrategy(SpanType.UNDERLINED)); } else if (rule.name.equals("text-decoration") && rule.value.equalsIgnoreCase("line-through")) { strategies.add(calculateAlternateSpanStrategy(SpanType.DELETED)); } else if (rule.name.equals("font-family") && isFontFamilyMonospace(rule)) { strategies.add(new SubstitutionWithoutCssSpanStrategy(SpanType.MONOSPACE)); } } } strategies = ImmutableList.copyOf(FluentIterable.from(strategies).filter(not(isNull()))); if (strategies.isEmpty()) { return null; } else if (strategies.size() == 1) { return strategies.get(0); } return new CompositeSpanStrategy(strategies); }
Source:
<code>private static String validate(Details details, RightCurlyOption bracePolicy, boolean shouldStartLine, String targetSourceLine) { final DetailAST rcurly = details.rcurly; final DetailAST lcurly = details.lcurly; final DetailAST nextToken = details.nextToken; final boolean shouldCheckLastRcurly = details.shouldCheckLastRcurly; String violation = ""; if (bracePolicy == RightCurlyOption.SAME && !hasLineBreakBefore(rcurly) && lcurly.getLineNo() != rcurly.getLineNo()) { violation = MSG_KEY_LINE_BREAK_BEFORE; } else if (shouldCheckLastRcurly) { if (rcurly.getLineNo() == nextToken.getLineNo()) { violation = MSG_KEY_LINE_ALONE; } } else if (shouldBeOnSameLine(bracePolicy, details)) { violation = MSG_KEY_LINE_SAME; } <START> else if (shouldBeAlone(bracePolicy, details)) { <END> violation = MSG_KEY_LINE_ALONE; } else if (shouldStartLine && !isOnStartOfLine(details, targetSourceLine)) { violation = MSG_KEY_LINE_NEW; } return violation; }</code><technical_language>please method name 'shouldBeAloneOnLine' (only name a logic), is in naming form others</technical_language>

Target:
private static String validate(Details details, RightCurlyOption bracePolicy, boolean shouldStartLine, String targetSourceLine) { final DetailAST rcurly = details.rcurly; final DetailAST nextToken = details.nextToken; final boolean shouldCheckLastRcurly = details.shouldCheckLastRcurly; String violation = ""; if (shouldHaveBeLineBreakBefore(bracePolicy, details)) { violation = MSG_KEY_LINE_BREAK_BEFORE; } else if (shouldCheckLastRcurly) { if (rcurly.getLineNo() == nextToken.getLineNo()) { violation = MSG_KEY_LINE_ALONE; } } else if (shouldBeOnSameLine(bracePolicy, details)) { violation = MSG_KEY_LINE_SAME; } else if (shouldBeAloneOnLine(bracePolicy, details)) { violation = MSG_KEY_LINE_ALONE; } else if (shouldStartLine && !isOnStartOfLine(details, targetSourceLine)) { violation = MSG_KEY_LINE_NEW; } return violation; }
Source:
<code>public SipMessage.Builder<T> withRouteHeaders(final RouteHeader... routes) { if (routes != null) { this.routeHeaders = ensureList(this.routeHeaders); this.routeHeaders.clear(); <START> routeHeader = routes[0]; <END> this.routeHeaders.addAll(Arrays.asList(routes)); } return this; }</code><technical_language>I guess this blow up..</technical_language>

Target:
public SipMessage.Builder<T> withRouteHeaders(final RouteHeader... routes) { if (routes != null && routes.length > 0) { this.routeHeaders = ensureList(this.routeHeaders); this.routeHeaders.clear(); routeHeader = routes[0]; this.routeHeaders.addAll(Arrays.asList(routes)); } return this; }
Source:
<code>private void saveSanStorage() { StorageModel storageModel = (StorageModel) getWindow(); final SanStorageModel sanStorageModel = (SanStorageModel) storageModel.getCurrentStorageItem(); List<String> unkownStatusLuns = new ArrayList(); <START> List<LUNs> usedStatusLuns = new ArrayList(); <END> for (LunModel lunModel : sanStorageModel.getAddedLuns()) { if (lunModel.getStatus() == LunStatus.Used) { usedStatusLuns.add((LUNs) lunModel.getEntity()); } else if (lunModel.getStatus() == LunStatus.Unknown) { unkownStatusLuns.add(lunModel.getLunId()); } } if (!unkownStatusLuns.isEmpty()) { Guid hostId = sanStorageModel.getContainer().getHost().getSelectedItem().getId(); Object target = getWidgetModel() != null ? getWidgetModel() : sanStorageModel.getContainer(); Frontend.getInstance() .runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModel.getType(), true, unkownStatusLuns), new AsyncQuery(target, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue(); postGetLunsMessages(sanStorageModel.getUsedLunsMessages(checkedLuns)); } else { sanStorageModel.setGetLUNsFailure( ConstantsManager.getInstance() .getConstants() .couldNotRetrieveLUNsLunsFailure()); } } }, true)); } else { postGetLunsMessages(sanStorageModel.getUsedLunsMessages(usedStatusLuns)); } }</code><technical_language>Generics: new ArrayList<>();</technical_language>

Target:
private void saveSanStorage() { StorageModel storageModel = (StorageModel) getWindow(); final SanStorageModel sanStorageModel = (SanStorageModel) storageModel.getCurrentStorageItem(); List<String> unkownStatusLuns = new ArrayList<>(); List<LUNs> usedStatusLuns = new ArrayList<>(); for (LunModel lunModel : sanStorageModel.getAddedLuns()) { if (lunModel.getStatus() == LunStatus.Used) { usedStatusLuns.add((LUNs) lunModel.getEntity()); } else if (lunModel.getStatus() == LunStatus.Unknown) { unkownStatusLuns.add(lunModel.getLunId()); } } if (!unkownStatusLuns.isEmpty()) { Guid hostId = sanStorageModel.getContainer().getHost().getSelectedItem().getId(); Model target = getWidgetModel() != null ? getWidgetModel() : sanStorageModel.getContainer(); Frontend.getInstance() .runQuery(VdcQueryType.GetDeviceList, new GetDeviceListQueryParameters(hostId, sanStorageModel.getType(), true, unkownStatusLuns), new AsyncQuery(target, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VdcQueryReturnValue response = (VdcQueryReturnValue) returnValue; if (response.getSucceeded()) { List<LUNs> checkedLuns = (ArrayList<LUNs>) response.getReturnValue(); postGetLunsMessages(sanStorageModel.getUsedLunsMessages(checkedLuns)); } else { sanStorageModel.setGetLUNsFailure( ConstantsManager.getInstance() .getConstants() .couldNotRetrieveLUNsLunsFailure()); } } }, true)); } else { postGetLunsMessages(sanStorageModel.getUsedLunsMessages(usedStatusLuns)); } }
Source:
<code>public OperationReport getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); <START> try { return DispoUtil.jsonObjToOperationSummary(operationSummaryJson); } catch (Exception ex) { throw new OseeCoreException("Could not parse Operation Summary Json", ex); } <END> }</code><technical_language>move try-catch DispoUtil.jsonObjToOperationSummary</technical_language>

Target:
public OperationReport getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); return DispoUtil.jsonObjToOperationSummary(operationSummaryJson); }
Source:
<code>private static void shutdownLeaderElectionService(LeaderElectionService leaderElectionService) { leaderElectionService.markNotEligibleForLeadership(); try { <START> leaderElectionService.stepDown(); <END> } catch (Exception e) { log.info("could not step down, continuing shutdown anyway", e); } }</code><technical_language>implementation throw</technical_language>

Target:
private static void shutdownLeaderElectionService(LeaderElectionService leaderElectionService) { leaderElectionService.markNotEligibleForLeadership(); leaderElectionService.stepDown(); }
Source:
<code>public static void addTypes(Biome biome, Type... types) { <START> Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot register biome types for unregistered biome"); <END> List<Type> subTags = listSubTags(types); for (Type type : subTags) { type.biomes.add(biome); } getBiomeInfo(biome).types.addAll(subTags); }</code><technical_language>"Cannot add biome types for unregistered biome"</technical_language>

Target:
public static void addTypes(Biome biome, Type... types) { Preconditions.checkArgument(ForgeRegistries.BIOMES.containsValue(biome), "Cannot add types to unregistered biome %s", biome); List<Type> subTypes = listSubTypes(types); for (Type type : subTypes) { type.biomes.add(biome); } getBiomeInfo(biome).types.addAll(subTypes); }
Source:
<code>public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } int amountToKeep = source.getManaCostsToPay().getX(); if (amountToKeep == 0) { player.discard(player.getHand(), source, game); } else if (amountToKeep < player.getHand().size()) { TargetCardInHand target = new TargetCardInHand(amountToKeep, new FilterCard()); target.setTargetName("cards to keep"); target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game); Cards cards = player.getHand().copy(); <START> cards.removeIf(target.getTargets()::contains); <END> } return true; }</code><technical_language>Missing discard command</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null) { return false; } int amountToKeep = source.getManaCostsToPay().getX(); if (amountToKeep == 0) { player.discard(player.getHand(), source, game); } else if (amountToKeep < player.getHand().size()) { TargetCardInHand target = new TargetCardInHand(amountToKeep, new FilterCard()); target.setTargetName("cards to keep"); target.choose(Outcome.Benefit, player.getId(), source.getSourceId(), game); Cards cards = player.getHand().copy(); cards.removeIf(target.getTargets()::contains); player.discard(cards, source, game); } return true; }
Source:
<code>public boolean updateNode(final @Nonnull Node node) throws IOException { boolean exists; try { exists = Queue.withLock(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (node == nodes.get(node.getNodeName())) { jenkins.trimLabels(); return true; } return false; } }); } catch (Exception e) { exists = false; } <START> if (exists) { <END> persistNode(node); return true; } return false; }</code><technical_language>this is longer thread safe - node removed. update a removed node fail. (return false)</technical_language>

Target:
public boolean updateNode(final @Nonnull Node node) throws IOException { boolean exists; try { exists = Queue.withLock(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (node == nodes.get(node.getNodeName())) { jenkins.trimLabels(); return true; } return false; } }); } catch (RuntimeException e) { throw e; } catch (Exception e) { exists = false; } if (exists) { persistNode(node); return true; } return false; }
Source:
<code>public boolean addMemberToReplicaSet(MongoDBServer secondary, Integer id) { BSONObject existingConfig = getReplicaSetConfig(); if (existingConfig == null) { <START> LOG.warn("Couldn't load existing config for replica set."); <END> return false; } BasicBSONObject newConfig = ReplicaSetConfig.fromExistingConfig(existingConfig) .member(secondary, id) .build(); return reconfigureReplicaSet(newConfig); }</code><technical_language>include context in log message (e.g. instance connect to)? If is running multiple MongoDB instances need more info in log</technical_language>

Target:
public boolean addMemberToReplicaSet(MongoDBServer secondary, Integer id) { BSONObject existingConfig = getReplicaSetConfig(); if (existingConfig == null) { LOG.warn("Couldn't load existing config for replica set from {}. Server not added.", getServerAddress(), secondary); return false; } BasicBSONObject newConfig = ReplicaSetConfig.fromExistingConfig(existingConfig) .member(secondary, id) .build(); return reconfigureReplicaSet(newConfig); }
Source:
<code>public void should_return_endpoints_with_context_path_and_base_path_set_to_root_different_port() { contextRunner.withConfiguration(UserConfigurations.of(EndpointConfig.class)) .withPropertyValues("management.endpoint.health.enabled=true", "management.endpoint.info.enabled=true", "management.endpoints.web.exposure.include=info,health", "management.endpoints.web.base-path=/", "management.servet.port=0", "server.servlet.context-path=foo") .run(context -> { SkipPatternProvider skipPatternProvider = context .getBean(SkipPatternProvider.class); Pattern pattern = skipPatternProvider.skipPattern(); <START> then(pattern.pattern()).contains("/(health|health/.*|info|info/.*)"); <END> }); }</code><technical_language>careful contains. is safest isEqualTo a constant in this class for default pattern concatenate interesting portion. I bring this is a typo in properties ("servet" -> "server") changes resulting pattern (/ foo/) assert is catch it</technical_language>

Target:
public void should_return_endpoints_with_context_path_and_base_path_set_to_root_different_port() { contextRunner.withConfiguration(UserConfigurations.of(ServerPropertiesConfig.class)) .withPropertyValues("management.endpoints.web.base-path=/", "management.server.port=0", "server.servlet.context-path=foo") .run(context -> { then(extractAllPatterns(context)).containsExactlyInAnyOrder( "/(health|health/.*|info|info/.*)", SleuthWebProperties.DEFAULT_SKIP_PATTERN); }); }
Source:
<code><START> public Collection<SequenceRegion> getSequenceRegions() { <END> return sequenceRegionMap.values(); }</code><technical_language>this a list sorted</technical_language>

Target:
public List<SequenceRegion> getSequenceRegions() { return Collections.unmodifiableList(new ArrayList<>(sequenceRegionMap.values())); }
Source:
<code>private String checkRatioLimit(final String minmax, final BigDecimal v) { if (v != null && (v.compareTo(BigDecimal.ZERO) == -1 <START> || v.compareTo(BigDecimal.ONE) == 1)) { <END> return String.format( "given %s ratio is %s, but must be between 0.0 and 1.0", minmax, v); } return null; }</code><technical_language>While [BigDecimal.compareTo](<LINK_0> specifies return values -1, 0, 1, < 0 (less zero) > 0 (greater zero) clearer taste, [Comparable.compareTo](<LINK_1> specifies return values a negative integer, zero, a positive</technical_language>

Target:
private String checkRatioLimit(final String minmax, final BigDecimal v) { if (v != null && (v.compareTo(BigDecimal.ZERO) < 0 || v.compareTo(BigDecimal.ONE) > 0)) { return String.format( "given %s ratio is %s, but must be between 0.0 and 1.0", minmax, v); } return null; }
Source:
<code>public void testFullTableLoad() { Query query = Query.builder() .table(playerStatsTable) .metric(invoke(playerStatsTable.getMetric("lowScore"))) .metric(invoke(playerStatsTable.getMetric("highScore"))) .timeDimension(toProjection(playerStatsTable.getTimeDimension("recordedDate"), TimeGrain.DAY)) .build(); List<Object> results; FutureTask<QueryResult> queryResult = engine.executeQuery(query); <START> queryResult.run(); <END> try { QueryResult result = queryResult.get(); results = StreamSupport.stream(result.getData().spliterator(), false) .collect(Collectors.toList()); } catch (TransactionException e) { throw new TransactionException(null); } catch (InterruptedException e) { throw new IllegalStateException(e); } catch (ExecutionException e) { throw new IllegalStateException(e); } PlayerStats stats0 = new PlayerStats(); stats0.setId("0"); stats0.setLowScore(241); stats0.setHighScore(2412); stats0.setRecordedDate(Timestamp.valueOf("2019-07-11 00:00:00")); PlayerStats stats1 = new PlayerStats(); stats1.setId("1"); stats1.setLowScore(35); stats1.setHighScore(1234); stats1.setRecordedDate(Timestamp.valueOf("2019-07-12 00:00:00")); PlayerStats stats2 = new PlayerStats(); stats2.setId("2"); stats2.setLowScore(72); stats2.setHighScore(1000); stats2.setRecordedDate(Timestamp.valueOf("2019-07-13 00:00:00")); assertEquals(3, results.size()); assertEquals(stats0, results.get(0)); assertEquals(stats1, results.get(1)); assertEquals(stats2, results.get(2)); }</code><technical_language>This code is violating DRY (do repeat yourself). a function in this class avoid repeating block over</technical_language>

Target:
public void testFullTableLoad() throws Exception { Query query = Query.builder() .table(playerStatsTable) .metric(invoke(playerStatsTable.getMetric("lowScore"))) .metric(invoke(playerStatsTable.getMetric("highScore"))) .timeDimension(toProjection(playerStatsTable.getTimeDimension("recordedDate"), TimeGrain.DAY)) .build(); List<Object> results = toList(engine.executeQuery(query, transaction).getData()); PlayerStats stats0 = new PlayerStats(); stats0.setId("0"); stats0.setLowScore(241); stats0.setHighScore(2412); stats0.setRecordedDate(Timestamp.valueOf("2019-07-11 00:00:00")); PlayerStats stats1 = new PlayerStats(); stats1.setId("1"); stats1.setLowScore(35); stats1.setHighScore(1234); stats1.setRecordedDate(Timestamp.valueOf("2019-07-12 00:00:00")); PlayerStats stats2 = new PlayerStats(); stats2.setId("2"); stats2.setLowScore(72); stats2.setHighScore(1000); stats2.setRecordedDate(Timestamp.valueOf("2019-07-13 00:00:00")); assertEquals(3, results.size()); assertEquals(stats0, results.get(0)); assertEquals(stats1, results.get(1)); assertEquals(stats2, results.get(2)); }
Source:
<code>private void assertDatasetCount(ApplicationManager appManager, long expectedMsgCount) throws Exception { <START> KeyValueTable counter = (KeyValueTable) getDataset("counter").get(); <END> CloseableIterator<KeyValue<byte[], byte[]>> scanner = counter.scan(null, null); try { int size = 0; while (scanner.hasNext()) { KeyValue<byte[], byte[]> keyValue = scanner.next(); Assert.assertEquals(1L, Bytes.toLong(keyValue.getValue())); size++; } Assert.assertEquals(expectedMsgCount, size); } finally { scanner.close(); } }</code><technical_language>I do casting, type parameterization, changes in: DictionaryOpsAppTest.java</technical_language>

Target:
private void assertDatasetCount(ApplicationManager appManager, long expectedMsgCount) throws Exception { DataSetManager<KeyValueTable> datasetManager = getDataset("counter"); KeyValueTable counter = datasetManager.get(); CloseableIterator<KeyValue<byte[], byte[]>> scanner = counter.scan(null, null); try { int size = 0; while (scanner.hasNext()) { KeyValue<byte[], byte[]> keyValue = scanner.next(); Assert.assertEquals(1L, Bytes.toLong(keyValue.getValue())); size++; } Assert.assertEquals(expectedMsgCount, size); } finally { scanner.close(); } }