auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) { if (fDataReadMemoryBytes) { fCommandCache.execute( <START> fCommandFactory.createMIDataWriteMemoryBytes(dmc, address.add(offset).toString(), buffer), <END> new DataRequestMonitor<MIDataWriteMemoryBytesInfo>(getExecutor(), rm) ); } else { final CountingRequestMonitor countingRM = new CountingRequestMonitor(getExecutor(), rm); countingRM.setDoneCount(count); int format = MIFormat.DECIMAL; String baseAddress = address.toString(); for (int i = 0; i < count; i++) { String value = new Byte(buffer[i]).toString(); fCommandCache.execute( fCommandFactory.createMIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM) ); } } }</code><technical_language>I agree MIDataWriteMemoryBytes match GDB command do processing of 'count' in MIMemory service</technical_language>

Target:
protected void writeMemoryBlock(final IDMContext dmc, final IAddress address, final long offset, final int word_size, final int count, final byte[] buffer, final RequestMonitor rm) { if (fDataReadMemoryBytes) { fCommandCache.execute( fCommandFactory.createMIDataWriteMemoryBytes(dmc, address.add(offset).toString(), (buffer.length == count) ? buffer : Arrays.copyOf(buffer, count)), new DataRequestMonitor<MIInfo>(getExecutor(), rm) ); } else { final CountingRequestMonitor countingRM = new CountingRequestMonitor(getExecutor(), rm); countingRM.setDoneCount(count); int format = MIFormat.DECIMAL; String baseAddress = address.toString(); for (int i = 0; i < count; i++) { String value = new Byte(buffer[i]).toString(); fCommandCache.execute( fCommandFactory.createMIDataWriteMemory(dmc, offset + i, baseAddress, format, word_size, value), new DataRequestMonitor<MIDataWriteMemoryInfo>(getExecutor(), countingRM) ); } } }
Source:
<code>private static boolean validAggregate(Aggregate aggregate, DruidQuery query) { ImmutableBitSet.Builder builder = ImmutableBitSet.builder(); for (AggregateCall aggCall : aggregate.getAggCallList()) { builder.addAll(aggCall.getArgList()); } <START> for (int index : aggregate.getGroupSet()) { <END> if (query.druidTable.metricFieldNames .contains(query.getTopNode().getRowType().getFieldNames().get(index))) { return false; } } return !checkTimestampRefOnQuery(builder.build(), query.getTopNode(), query); }</code><technical_language>This approach correct, a Project operator DruidQuery field names changed. run complete DruidIT testsuite change? I some regressions there, e.g., Aggregate operators pushed DruidQuery a Project previously pushed. fix for this issue follow a similar approach in _checkTimestampRefOnQuery_ method (you copy-modify generalize method). Further, similar changes need DruidProjectAggregateRule too</technical_language>

Target:
private static boolean validAggregate(Aggregate aggregate, DruidQuery query) { ImmutableBitSet.Builder builder = ImmutableBitSet.builder(); for (AggregateCall aggCall : aggregate.getAggCallList()) { builder.addAll(aggCall.getArgList()); } if (checkAggregateOnMetric(aggregate.getGroupSet(), aggregate, query)) { return false; } return !checkTimestampRefOnQuery(builder.build(), query.getTopNode(), query); }
Source:
<code><START> private void check(Rule rule) { <END> if (rule.att().contains("unblock")) return; resetVars(); gatherVars(rule.body()); gatherVars(rule.requires()); gatherVars(rule.ensures()); check(rule.body()); check(rule.requires()); check(rule.ensures()); }</code><technical_language>Instead of check(Rule... check(Context... (which enriched others in future, simply a DefinitionTransformer pass this check, AbstractReflectiveVisitor</technical_language>

Target:
private void check(Rule rule) { resetVars(); gatherVars(rule.body()); check(rule.body(), true); check(rule.requires(), false); check(rule.ensures(), false); }
Source:
<code>private static boolean hasAtLeastOneSiblingWithSameTokenType(DetailAST ast) { boolean result = false; <START> if (ast.getParent() == null) { <END> DetailAST prev = ast.getPreviousSibling(); while (prev != null) { if (prev.getType() == ast.getType()) { result = true; break; } prev = prev.getPreviousSibling(); } if (!result) { DetailAST next = ast.getNextSibling(); while (next != null) { if (next.getType() == ast.getType()) { result = true; break; } next = next.getNextSibling(); } } } else { result = ast.getParent().getChildCount(ast.getType()) > 1; } return result; }</code><technical_language>removed conditional - replaced equality check true -> SURVIVED</technical_language>

Target:
private static boolean hasAtLeastOneSiblingWithSameTokenType(DetailAST ast) { boolean result = false; DetailAST prev = ast.getPreviousSibling(); while (prev != null) { if (prev.getType() == ast.getType()) { result = true; break; } prev = prev.getPreviousSibling(); } DetailAST next = ast.getNextSibling(); while (next != null) { if (next.getType() == ast.getType()) { result = true; break; } next = next.getNextSibling(); } return result; }
Source:
<code>public VdsManager GetVdsManager(Guid vdsId) { <START> return GetVdsManager(vdsId, true); <END> }</code><technical_language>true=>false</technical_language>

Target:
public VdsManager GetVdsManager(Guid vdsId) { return GetVdsManager(vdsId, false); }
Source:
<code>private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && <START> getStoragePool().getCompatibilityVersion().compareTo(vm.getCustomCompatibilityVersion()) > 0) <END> .map(VM::getName) .collect(Collectors.joining(", ")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }</code><technical_language>Version.greater(). More reabale</technical_language>

Target:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getOldStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) .collect(Collectors.joining(", ")); if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }
Source:
<code>private void setSubmitType(final Project.SubmitType newSubmitType) { if (submitType != null) { for (int i = 0; i < submitType.getItemCount(); i++) { if (newSubmitType.name().equals(submitType.getValue(i))) { <START> submitType.setSelectedIndex(i); <END> return; } } submitType.setSelectedIndex(-1); setEnabledForUseContentMerge(); } }</code><technical_language>need setEnabledForUseContentMerge(); here</technical_language>

Target:
private void setSubmitType(final Project.SubmitType newSubmitType) { int index = -1; if (submitType != null) { for (int i = 0; i < submitType.getItemCount(); i++) { if (newSubmitType.name().equals(submitType.getValue(i))) { index = i; break; } } submitType.setSelectedIndex(index); setEnabledForUseContentMerge(); } }
Source:
<code>@Test public void extractTraceContext_malformed() { MapEntry mapEntry = new MapEntry(); <START> map.put("x-b3-traceid", "1"); END> map.put("x-b3-parentspanid", "-"); SamplingFlags result = propagation().extractor(mapEntry).extract(map).samplingFlags(); assertThat(result) .isEqualTo(SamplingFlags.EMPTY); }</code><technical_language>declaring more examples a data provider? more expressive in terms cases this will/won't fail. do think</technical_language>

Target:
@Test public void extractTraceContext_malformed() { MapEntry mapEntry = new MapEntry(); map.put("X-B3-TraceId", "463ac35c9f6413ad48485a3953bb6124"); map.put("X-B3-SpanId", "48485a3953bb6124"); map.put("X-B3-ParentSpanId", "-"); SamplingFlags result = propagation().extractor(mapEntry).extract(map).samplingFlags(); assertThat(result) .isEqualTo(SamplingFlags.EMPTY); }
Source:
<code>private void testNamespace(String namespace, boolean shouldFail) { boolean errorThrown = false; try { ensureValidNamespace(namespace); } catch (IllegalStateException e) { errorThrown = true; if (shouldFail) { assertThat(e.getMessage(), equalTo( <START> "Namespace must only have alphanumeric characters or the underscore symbol" <END> )); } else { fail(String.format("ensureValidNamespace provided false positive for value: %s", namespace)); } } if (shouldFail && !errorThrown) { fail(String.format("ensureValidNamespace failed to throw exception for value: %s", namespace)); } }</code><technical_language>This is testing for exact implementation details (the exact contents of error message) instead of general behavior (it fails input is clean). check for exception, possibly check type of exception (in case define exception type, e.g. PossibleSQLInjectionException). Another option is perform SQL injection testing methods return unambiguous booleans (acceptable / non-acceptable) instead of exceptions. test boolean value, purely concentrates behavior meaning instead of implementation</technical_language>

Target:
private void testNamespace(String namespace, boolean shouldFail) { boolean errorThrown = false; try { ensureValidNamespace(namespace); } catch (Exception e) { errorThrown = true; if (shouldFail) { assertThat(e, new IsInstanceOf(InvalidNamespaceException.class)); } else { fail(String.format("ensureValidNamespace provided false positive for value: %s", namespace)); } } if (shouldFail && !errorThrown) { fail(String.format("ensureValidNamespace failed to throw exception for value: %s", namespace)); } }
Source:
<code><START> public Map<String, String> storeLevelTagMap(final String taskName, final String storeType, final String storeName) { <END> final Map<String, String> tagMap = taskLevelTagMap(taskName); tagMap.put(storeType + STORE_ID_TAG, storeName); return tagMap; }</code><technical_language>nit: line long (break parameter in line)</technical_language>

Target:
public Map<String, String> storeLevelTagMap(final String taskName, final String storeType, final String storeName) { final Map<String, String> tagMap = taskLevelTagMap(taskName); tagMap.put(storeType + "-" + STORE_ID_TAG, storeName); return tagMap; }
Source:
<code>void newSlotsAreAvailable(Collection<? extends PhysicalSlot> newSlots) { final Collection<PhysicalSlot> slotsToProcess = new ArrayList<>(); for (PhysicalSlot newSlot : newSlots) { if (newSlotsSet.add(newSlot.getAllocationId())) { slotsToProcess.add(newSlot); } } final Collection<PendingRequestSlotMatching> matchingsToFulfill = new ArrayList<>(); for (PhysicalSlot newSlot : slotsToProcess) { final Optional<PendingRequest> matchingPendingRequest = findMatchingPendingRequest(newSlot); matchingPendingRequest.ifPresent(pendingRequest -> { Preconditions.checkNotNull(pendingRequests.remove(pendingRequest.getSlotRequestId()), "Cannot fulfill a non existing pending slot request."); reserveFreeSlot(pendingRequest.getSlotRequestId(), newSlot.getAllocationId(), pendingRequest.resourceProfile); matchingsToFulfill.add(PendingRequestSlotMatching.createFor(pendingRequest, newSlot)); }); <START> newSlotsSet.remove(newSlot.getAllocationId()); <END> } for (PendingRequestSlotMatching pendingRequestSlotMatching : matchingsToFulfill) { pendingRequestSlotMatching.fulfillPendingRequest(); } }</code><technical_language>I fully understand newSlotsSet. If this set is supposed filter out repeated newSlotsAreAvailable calls, is this if adding a slot newSlotsAreAvailable removing is add slot matchingsToFulfill? this is longer completion of pending requests moved a separate loop</technical_language>

Target:
void newSlotsAreAvailable(Collection<? extends PhysicalSlot> newSlots) { final Collection<PendingRequestSlotMatching> matchingsToFulfill = new ArrayList<>(); for (PhysicalSlot newSlot : newSlots) { final Optional<PendingRequest> matchingPendingRequest = findMatchingPendingRequest(newSlot); matchingPendingRequest.ifPresent(pendingRequest -> { Preconditions.checkNotNull(pendingRequests.remove(pendingRequest.getSlotRequestId()), "Cannot fulfill a non existing pending slot request."); reserveFreeSlot(pendingRequest.getSlotRequestId(), newSlot.getAllocationId(), pendingRequest.resourceProfile); matchingsToFulfill.add(PendingRequestSlotMatching.createFor(pendingRequest, newSlot)); }); } for (PendingRequestSlotMatching pendingRequestSlotMatching : matchingsToFulfill) { pendingRequestSlotMatching.fulfillPendingRequest(); } }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_PREFERENCES: <START> reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_SETTINGS); <END> createPreferencesMenu(this); return true; case MENU_UPDATE: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_UPDATE_CC); Intent i = new Intent(getApplicationContext(), UpdateActivity.class); startActivity(i); return true; case MENU_REPORT_PROBLEM: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_REPORT_PROBLEM); startReportActivity(); return true; case MENU_VALIDATE_MEDIA: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_VALIDATE_MM); startValidationActivity(); return true; case MENU_DUMP_FORMS: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_MANAGE_SD); startFormDumpActivity(); return true; case MENU_WIFI_DIRECT: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_WIFI_DIRECT); startWifiDirectActivity(); return true; case MENU_CONNECTION_DIAGNOSTIC: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_CONNECTION_TEST); startMenuConnectionActivity(); return true; case MENU_SAVED_FORMS: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_SAVED_FORMS); goToFormArchive(false); return true; case MENU_ABOUT: reportOptionsItemEntry(GoogleAnalyticsFields.LABEL_ABOUT_CC); showAboutCommCareDialog(); return true; } return super.onOptionsItemSelected(item); }</code><technical_language>Oof, this is pretty ugly. I making item ID -> Key map adding event map switch a cleaner implement this</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { Map<Integer, String> menuIdToAnalyticsEventLabel = createMenuItemToEventMapping(); GoogleAnalyticsUtils.reportOptionsMenuItemEntry( GoogleAnalyticsFields.CATEGORY_HOME_SCREEN, menuIdToAnalyticsEventLabel.get(item.getItemId())); switch (item.getItemId()) { case MENU_PREFERENCES: createPreferencesMenu(this); return true; case MENU_UPDATE: Intent i = new Intent(getApplicationContext(), UpdateActivity.class); startActivity(i); return true; case MENU_REPORT_PROBLEM: startReportActivity(); return true; case MENU_VALIDATE_MEDIA: startValidationActivity(); return true; case MENU_DUMP_FORMS: startFormDumpActivity(); return true; case MENU_WIFI_DIRECT: startWifiDirectActivity(); return true; case MENU_CONNECTION_DIAGNOSTIC: startMenuConnectionActivity(); return true; case MENU_SAVED_FORMS: goToFormArchive(false); return true; case MENU_ABOUT: showAboutCommCareDialog(); return true; case MENU_DISABLE_ANALYTICS: showAnalyticsOptOutDialog(); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>public CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery> getCacheStrategy(final SegmentMetadataQuery query) { <START> <END> return new CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery>() { @Override public boolean isCacheable(SegmentMetadataQuery updatedQuery, boolean willMergeRunners) { return true; } @Override public byte[] computeCacheKey(SegmentMetadataQuery query) { SegmentMetadataQuery updatedQuery = (SegmentMetadataQuery) query.withAnalysisTypes(getFinalAnalysisTypes(query)); byte[] includerBytes = updatedQuery.getToInclude().getCacheKey(); byte[] analysisTypesBytes = updatedQuery.getAnalysisTypesCacheKey(); return ByteBuffer.allocate(1 + includerBytes.length + analysisTypesBytes.length) .put(SEGMENT_METADATA_CACHE_PREFIX) .put(includerBytes) .put(analysisTypesBytes) .array(); } @Override public TypeReference<SegmentAnalysis> getCacheObjectClazz() { return getResultTypeReference(); } @Override public Function<SegmentAnalysis, SegmentAnalysis> prepareForCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } @Override public Function<SegmentAnalysis, SegmentAnalysis> pullFromCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } }; }</code><technical_language>Extra line</technical_language>

Target:
public CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery> getCacheStrategy(final SegmentMetadataQuery query) { return new CacheStrategy<SegmentAnalysis, SegmentAnalysis, SegmentMetadataQuery>() { @Override public boolean isCacheable(SegmentMetadataQuery query, boolean willMergeRunners) { return true; } @Override public byte[] computeCacheKey(SegmentMetadataQuery query) { SegmentMetadataQuery updatedQuery = query.withFinalizedAnalysisTypes(config); byte[] includerBytes = updatedQuery.getToInclude().getCacheKey(); byte[] analysisTypesBytes = updatedQuery.getAnalysisTypesCacheKey(); return ByteBuffer.allocate(1 + includerBytes.length + analysisTypesBytes.length) .put(SEGMENT_METADATA_CACHE_PREFIX) .put(includerBytes) .put(analysisTypesBytes) .array(); } @Override public TypeReference<SegmentAnalysis> getCacheObjectClazz() { return getResultTypeReference(); } @Override public Function<SegmentAnalysis, SegmentAnalysis> prepareForCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } @Override public Function<SegmentAnalysis, SegmentAnalysis> pullFromCache() { return new Function<SegmentAnalysis, SegmentAnalysis>() { @Override public SegmentAnalysis apply(@Nullable SegmentAnalysis input) { return input; } }; } }; }
Source:
<code>private void handleNewCallEvent(EslEvent event) { String uuid = getHeader(event, FS_UUID); logger.debug("Adding Call with uuid " + uuid); Channel channel = new Channel(event); if(eventCache.containsKey(uuid)) return; eventCache.put(uuid, channel); itemMap.put(uuid, new LinkedList<FreeswitchBindingConfig>()); CallType call = channel.getCall(); logger.debug(String.format("new call to : %s from : %s", call.getDestNum(), call.getOrigNum())); for (FreeswitchBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { FreeswitchBindingConfig config = provider.getFreeswitchBindingConfig(itemName); if(config.getType() == FreeswitchBindingType.ACTIVE){ if(config.filtered()){ logger.debug(String.format("Trying to match filter string %s",config.getArgument())); String[] filters = config.getArgument().split(","); boolean matched = true; for(String filterString : filters){ String args = filterString.split(":"); if(args.length == 2 && StringUtils.isNotBlank(args[0]) && StringUtils.isNotBlank(args[1])){ String value = channel.getEventHeader(args[0]); try { if(StringUtils.isBlank(value) || !args[1].equals(URLDecoder.decode(value, "UTF-8"))){ matched = false; } } catch (UnsupportedEncodingException e) { logger.warn("Could not decode header", e); matched = false; } } else { logger.warn("The filter string does not look valid, not updating item"); matched = false; } if(!matched) break; <START> } <END> if(matched){ itemMap.get(uuid).add(config); newCallItemUpdate(config, channel); } } else { String direction = channel.getEventHeader("Call-Direction"); if(StringUtils.isNotBlank(direction) && "inbound".equals(direction)){ itemMap.get(uuid).add(config); newCallItemUpdate(config, channel); } } } } } }</code><technical_language>please refactor while block "if (config.filtered())" method increase readability</technical_language>

Target:
private void handleNewCallEvent(EslEvent event) { String uuid = getHeader(event, UUID); logger.debug("Adding Call with uuid " + uuid); Channel channel = new Channel(event); if(eventCache.containsKey(uuid)) return; eventCache.put(uuid, channel); itemMap.put(uuid, new LinkedList<FreeswitchBindingConfig>()); CallType call = channel.getCall(); logger.debug("new call to : from : {}", call.getDestNum(), call.getOrigNum()); for (FreeswitchBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { FreeswitchBindingConfig config = provider .getFreeswitchBindingConfig(itemName); if (config.getType() == FreeswitchBindingType.ACTIVE) { if ((config.filtered() && matchCall(channel,config.getArgument())) || (!config.filtered() && isInboundCall(channel))) { itemMap.get(uuid).add(config); newCallItemUpdate(config, channel); } } } } }
Source:
<code>getPluginFCPServer(String pluginClassName) throws PluginNotFoundException{ PluginInfoWrapper piw = getPluginInfoByClassName(pluginClassName); if(piw != null && piw.isFCPServerPlugin()) { <START> return (FredPluginFCPMessageHandler.ServerSideFCPMessageHandler)piw.plug; <END> } else { throw new PluginNotFoundException(pluginClassName); } }</code><technical_language>not: java if (piw instanceof FredPluginFCPMessageHandler.ServerSideFCPMessageHandler) { if cast anyways? A more elegant solution move this logic PluginInfoWrapper class do casting</technical_language>

Target:
getPluginFCPServer(String pluginClassName) throws PluginNotFoundException{ PluginInfoWrapper piw = getPluginInfoByClassName(pluginClassName); if(piw != null && piw.isFCPServerPlugin()) { return piw.getFCPServerPlugin(); } else { throw new PluginNotFoundException(pluginClassName); } }
Source:
<code>public void setReceiver(String username) { super.setReceiver(username); privateChatTabRoot.setId(username); privateChatTabRoot.setText(username); userPlayer = playerService.getPlayerForUsername(username); <START> if (userPlayer != null) { <END> CountryCode countryCode = CountryCode.getByCode(userPlayer.getCountry()); usernameLabel.setText(username); userImageView.setImage(IdenticonUtil.createIdenticon(userPlayer.getId())); countryImageView.setImage(countryFlagService.loadCountryFlag(userPlayer.getCountry())); countryLabel.setText(countryCode == null ? userPlayer.getCountry() : countryCode.getName()); userPlayer.globalRatingMeanProperty().addListener((observable) -> loadReceiverGlobalRatingInformation(userPlayer)); userPlayer.globalRatingDeviationProperty().addListener((observable) -> loadReceiverGlobalRatingInformation(userPlayer)); userPlayer.leaderboardRatingMeanProperty().addListener((observable) -> loadReceiverLadderRatingInformation(userPlayer)); userPlayer.leaderboardRatingDeviationProperty().addListener((observable) -> loadReceiverLadderRatingInformation(userPlayer)); loadReceiverGlobalRatingInformation(userPlayer); loadReceiverLadderRatingInformation(userPlayer); gamesPlayedLabel.textProperty().bind(userPlayer.numberOfGamesProperty().asString()); loadPlayerGameInformation(userPlayer.getGame()); userPlayer.gameProperty().addListener((observable, oldValue, newValue) -> { loadPlayerGameInformation(newValue); }); } }</code><technical_language>prefer if (userPlayer == null) { return; } avoid nesting big blocks</technical_language>

Target:
public void setReceiver(String username) { super.setReceiver(username); privateChatTabRoot.setId(username); privateChatTabRoot.setText(username); Player player = playerService.getPlayerForUsername(username); privateUserInfoController.setPlayer(player); }
Source:
<code>public ASTNode loadPgmAst(String content, Source source, Boolean kappize, Sort startSymbol, Context context) throws ParseFailedException { org.kframework.parser.concrete.KParser.ImportTblPgm(context.files.resolveKompiled(".")); String parsed = org.kframework.parser.concrete.KParser.ParseProgramString(content, startSymbol.toString()); Document doc = XmlLoader.getXMLDoc(parsed); XmlLoader.addSource(doc.getFirstChild(), source); XmlLoader.reportErrors(doc); JavaClassesFactory.startConstruction(context); ASTNode out = JavaClassesFactory.getTerm((Element) doc.getDocumentElement().getFirstChild().getNextSibling()); JavaClassesFactory.endConstruction(); out = new PriorityFilter(context, null, null).visitNode(out); <START> out = new PreferAvoidFilter(context, null, null).visitNode(out); <END> out = new NormalizeASTTransformer(context).visitNode(out); out = new AmbFilter(context, null, null).visitNode(out); out = new RemoveBrackets(context).visitNode(out); if (kappize) out = new FlattenTerms(context).visitNode(out); return out; }</code><technical_language>initialized. in this case Definition object syntax module, this is program parser</technical_language>

Target:
public ASTNode loadPgmAst(String content, Source source, Boolean kappize, Sort startSymbol, Context context) throws ParseFailedException { String parsed = org.kframework.parser.concrete.DefinitionLocalKParser.ParseProgramString(content, startSymbol.toString(), context.files.resolveKompiled(".")); Document doc = XmlLoader.getXMLDoc(parsed); XmlLoader.addSource(doc.getFirstChild(), source); XmlLoader.reportErrors(doc); ASTNode out = new JavaClassesFactory(context).getTerm((Element) doc.getDocumentElement().getFirstChild().getNextSibling()); out = new PriorityFilter(context).visitNode(out); out = new PreferAvoidFilter(context).visitNode(out); out = new NormalizeASTTransformer(context, kem).visitNode(out); out = new AmbFilter(context, kem).visitNode(out); out = new RemoveBrackets(context).visitNode(out); if (kappize) out = new FlattenTerms(context).visitNode(out); return out; }
Source:
<code>private void validate(String[] schemaList) { Schema schema = createSchema(schemaList); if (schema != null) { Validator validator = createSchema(schemaList).newValidator(); setFeature(validator, Constants.XERCES_FEATURE_PREFIX + "continue-after-fatal-error", true); validator.setErrorHandler(new MessageHandler()); validator.setResourceResolver(new SchemaResolver()); try { LOG.info("Validating with schema {}", getWebSourceCode(), StringUtils.join(schemaList, ",")); validator.validate(new StreamSource(getWebSourceCode().createInputStream())); } catch (SAXException e) { if (!containsMessage(e)) { createViolation(0, e.getMessage()); } <START> } catch (IOException e) { <END> LOG.warn("Unable to validate file {}", getWebSourceCode()); LOG.warn("Cause: {}", e.getMessage()); } catch (UnrecoverableParseError e) { } } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') log rethrow this exception. [![rule](<LINK_2>](<LINK_1></technical_language>

Target:
private void validate(String[] schemaList) { Schema schema = createSchema(schemaList); if (schema != null) { Validator validator = schema.newValidator(); setFeature(validator, Constants.XERCES_FEATURE_PREFIX + "continue-after-fatal-error", true); validator.setErrorHandler(new MessageHandler()); validator.setResourceResolver(new SchemaResolver()); try { LOG.info("Validating with schema {}", getWebSourceCode(), StringUtils.join(schemaList, ",")); validator.validate(new StreamSource(getWebSourceCode().createInputStream())); } catch (SAXException e) { if (!containsMessage(e)) { createViolation(0, e.getMessage()); } } catch (IOException e) { LOG.warn("Unable to validate file {}", getWebSourceCode()); LOG.warn("Cause: {}", e.getMessage()); } catch (UnrecoverableParseError e) { } } }
Source:
<code>public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); return ByteBuffer.allocate(1 + fieldNameBytes.length).put(CACHE_TYPE_ID).put(fieldNameBytes).array(); <START> } <END></code><technical_language>i this need encdoe name bitmap type too</technical_language>

Target:
public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); byte[] bitMapFactoryCacheKey = StringUtils.toUtf8(bitMapFactory.toString()); return ByteBuffer.allocate(1 + fieldNameBytes.length + bitMapFactoryCacheKey.length) .put(CACHE_TYPE_ID) .put(fieldNameBytes) .put(bitMapFactoryCacheKey) .array(); }
Source:
<code>public Datastream createBootstrapDatastream(Datastream bootstrapDatastream) { ActionRequest<Datastream> request = _bootstrapBuilders.actionCreate() .boostrapDatastreamParam(bootstrapDatastream).build(); ResponseFuture<Datastream> datastreamResponseFuture = _restClient.sendRequest(request); try { return datastreamResponseFuture.getResponse().getEntity(); } catch (RemoteInvocationException e) { throw new DatastreamRuntimeException( <START> String.format("Create Bootstrap Datastream {%s} failed with error.", bootstrapDatastream), e); <END> } }</code><technical_language>include e.getMessage() in this log message for easier troubleshooting? Otherwise, a stack trace I if exception is caught</technical_language>

Target:
public Datastream createBootstrapDatastream(Datastream bootstrapDatastream) { ActionRequest<Datastream> request = _bootstrapBuilders.actionCreate() .boostrapDatastreamParam(bootstrapDatastream).build(); ResponseFuture<Datastream> datastreamResponseFuture = _restClient.sendRequest(request); try { return datastreamResponseFuture.getResponse().getEntity(); } catch (RemoteInvocationException e) { String errorMessage = String.format("Create Bootstrap Datastream {%s} failed with error.", bootstrapDatastream); ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, e); } return null; }
Source:
<code>public void process(Node externs, Node root) { NodeTraversal.traverse(compiler, root, new FindCrossChunkReferences()); for (JSModule chunk : compiler.getModuleGraph().getAllModules()) { if (!crossChunkExports.containsKey(chunk) && !crossChunkImports.containsKey(chunk) && chunk.getInputs().size() > 0) { crossChunkExports.put(chunk, new HashSet<>()); } } <START> ConvertChunkSourcesToModules(); <END> AddExportStatements(); AddImportStatements(); }</code><technical_language>Google's Java style requires methods lower-camel-case. e.g. convertChunkSourcesToModules() This Python code me. :)</technical_language>

Target:
public void process(Node externs, Node root) { NodeTraversal.traverse(compiler, root, new FindCrossChunkReferences()); for (JSModule chunk : compiler.getModuleGraph().getAllModules()) { if (!crossChunkExports.containsKey(chunk) && !crossChunkImports.containsKey(chunk) && chunk.getInputs().size() > 0) { crossChunkExports.put(chunk, new HashSet<>()); } } convertChunkSourcesToModules(); addExportStatements(); addImportStatements(); compiler.setFeatureSet(compiler.getFeatureSet().with(Feature.MODULES)); }
Source:
<code>private static List<Method> findAllMethodsInHierarchy(Class<?> clazz, MethodSortOrder sortOrder) { Preconditions.notNull(clazz, "Class must not be null"); Preconditions.notNull(sortOrder, "MethodSortOrder must not be null"); List<Method> localMethods = Arrays.stream(clazz.getDeclaredMethods()) <START> .filter(Method::isBridge) END> .collect(toList()); List<Method> superclassMethods = getSuperclassMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> interfaceMethods = getInterfaceMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> methods = new ArrayList<>(); if (sortOrder == MethodSortOrder.HierarchyDown) { methods.addAll(superclassMethods); methods.addAll(interfaceMethods); } methods.addAll(localMethods); if (sortOrder == MethodSortOrder.HierarchyUp) { methods.addAll(interfaceMethods); methods.addAll(superclassMethods); } return methods; }</code><technical_language>this localMethods *only* include bridge methods (removing others)? I understand existing tests pass this. JUnit 5 JUnit4-style tests</technical_language>

Target:
private static List<Method> findAllMethodsInHierarchy(Class<?> clazz, MethodSortOrder sortOrder) { Preconditions.notNull(clazz, "Class must not be null"); Preconditions.notNull(sortOrder, "MethodSortOrder must not be null"); List<Method> localMethods = Arrays.stream(clazz.getDeclaredMethods()) .filter(method -> !method.isBridge()) .collect(toList()); List<Method> superclassMethods = getSuperclassMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> interfaceMethods = getInterfaceMethods(clazz, sortOrder).stream() .filter(method -> !isMethodShadowedByLocalMethods(method, localMethods)) .collect(toList()); List<Method> methods = new ArrayList<>(); if (sortOrder == MethodSortOrder.HierarchyDown) { methods.addAll(superclassMethods); methods.addAll(interfaceMethods); } methods.addAll(localMethods); if (sortOrder == MethodSortOrder.HierarchyUp) { methods.addAll(interfaceMethods); methods.addAll(superclassMethods); } return methods; }
Source:
<code>private void logNameChange() { String runtimeName = vmDynamicDao.get(getVmId()).getRuntimeName(); String newName = <START> getParameters().getVmStaticData().getName(); <END> if (!newName.equals(runtimeName)) { log.info("changing the name of a vm that started as to {}", runtimeName, newName); } }</code><technical_language>newVmStatic</technical_language>

Target:
private void logNameChange() { String runtimeName = vmDynamicDao.get(getVmId()).getRuntimeName(); String newName = newVmStatic.getName(); if (!newName.equals(oldVm.getName()) && !newName.equals(runtimeName)) { log.info("changing the name of a vm that started as to {}", runtimeName, newName); } }
Source:
<code>private ArrayList<IPAddress> parseDhclientFile(File dhClientFile, String interfaceMatch, String fixedAddressMatch) throws KuraException { ArrayList<IPAddress> servers = new ArrayList<>(); try (FileReader fr = new FileReader(dhClientFile); BufferedReader br = new BufferedReader(fr)) { String line = null; while ((line = br.readLine()) != null) { if ("lease {".equals(line.trim())) { <START> if (!br.readLine().trim().equals(interfaceMatch)) { <END> continue; } if (!br.readLine().trim().equals(fixedAddressMatch)) { continue; } while ((line = br.readLine()) != null) { if (line.indexOf("domain-name-servers") >= 0) { StringTokenizer st = new StringTokenizer( line.substring(line.indexOf("domain-name-servers") + 19), ", ;"); while (st.hasMoreTokens()) { String nameServer = st.nextToken(); logger.debug("Found nameserver... {}", nameServer); IPAddress ipa = IPAddress.parseHostAddress(nameServer); if (!servers.contains(ipa)) { servers.add(IPAddress.parseHostAddress(nameServer)); } } break; } else if (line.indexOf("expire") >= 0) { break; } } } } } catch (Exception e) { throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, e); } return servers; }</code><technical_language>180 183 merged in order a single continue</technical_language>

Target:
private ArrayList<IPAddress> parseDhclientFile(File dhClientFile, String interfaceMatch, String fixedAddressMatch) throws KuraException { ArrayList<IPAddress> servers = new ArrayList<>(); try (FileReader fr = new FileReader(dhClientFile); BufferedReader br = new BufferedReader(fr)) { String line = null; ArrayList<String> leaseBlock = null; while ((line = br.readLine()) != null) { if ("lease {".equals(line.trim())) { leaseBlock = new ArrayList<>(); } else if ("}".equals(line.trim())) { servers = parseDhclientLeaseBlock(leaseBlock, interfaceMatch, fixedAddressMatch); leaseBlock = null; } else if ((leaseBlock != null) && !line.trim().isEmpty()) { leaseBlock.add(line.trim()); } } } catch (Exception e) { throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, e); } return servers; }
Source:
<code>public void process(FProtocol iprot, FProtocol oprot) throws TException { FContext ctx = iprot.readRequestHeader(); TMessage message = iprot.readMessageBegin(); FProcessorFunction processor = this.processMap.get(message.name); if (processor != null) { try { processor.process(ctx, iprot, oprot); } catch (Exception e) { <START> System.err.println("frugal: Error processing request with correlationID " + ctx.getCorrelationId() + ": " + e.getMessage()); <END> throw e; } return; } TProtocolUtil.skip(iprot, TType.STRUCT); iprot.readMessageEnd(); TApplicationException e = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Unknown function " + message.name); synchronized (WRITE_LOCK) { oprot.writeResponseHeader(ctx); oprot.writeMessageBegin(new TMessage(message.name, TMessageType.EXCEPTION, 0)); e.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } throw e; }</code><technical_language>a logger</technical_language>

Target:
public void process(FProtocol iprot, FProtocol oprot) throws TException { FContext ctx = iprot.readRequestHeader(); TMessage message = iprot.readMessageBegin(); FProcessorFunction processor = this.processMap.get(message.name); if (processor != null) { try { processor.process(ctx, iprot, oprot); } catch (Exception e) { logger.log(Level.WARNING, "Error processing request with correlationID " + ctx.getCorrelationId() + ": " + e.getMessage()); throw e; } return; } TProtocolUtil.skip(iprot, TType.STRUCT); iprot.readMessageEnd(); TApplicationException e = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Unknown function " + message.name); synchronized (WRITE_LOCK) { oprot.writeResponseHeader(ctx); oprot.writeMessageBegin(new TMessage(message.name, TMessageType.EXCEPTION, 0)); e.write(oprot); oprot.writeMessageEnd(); oprot.getTransport().flush(); } throw e; }
Source:
<code>public boolean matches(ScriptPath path) { String mob = path.eventArgLowerAt(1); <START> <END> if (!mob.equals("mob") && !mob.equals(CoreUtilities.toLowerCase(this.mob.getMobType().getInternalName()))) { return false; } if (!runInCheck(path, location)) { return false; } return super.matches(path); }</code><technical_language>stray blank lines</technical_language>

Target:
public boolean matches(ScriptPath path) { String mob = path.eventArgLowerAt(1); if (!mob.equals("mob") && !runGenericCheck(mob, mythicmob.getMobType().getInternalName())) { return false; } if (!runInCheck(path, location)) { return false; } return super.matches(path); }
Source:
<code>private void writeSummary(String summaryLocation, String propLocation) { <START> String[] properties = { <END> "graph.nodes", "graph.edges", "measurement.seed", CH.PREPARE + "time", CH.PREPARE + "shortcuts", "routing.distance_mean", "routing.mean", "routing.visited_nodes_mean", "routingCH.distance_mean", "routingCH.mean", "routingCH.visited_nodes_mean" }; try { File f = new File(summaryLocation); boolean writeHeader = !f.exists(); FileWriter writer = new FileWriter(f, true); if (writeHeader) writer.write(getSummaryHeader(properties)); writer.write(getSummaryLogLine(properties, propLocation)); writer.close(); } catch (IOException e) { logger.error("Could not write summary to file '{}'", summaryLocation, e); } }</code><technical_language>add a timestamp? I this historical data, for example write summary weeks/days easily spot run executed. WDYT</technical_language>

Target:
private void writeSummary(String summaryLocation, String propLocation) { logger.info("writing summary to " + summaryLocation); String[] properties = { "graph.nodes", "graph.edges", "measurement.seed", CH.PREPARE + "time", CH.PREPARE + "shortcuts", "routing.distance_mean", "routing.mean", "routing.visited_nodes_mean", "routingCH.distance_mean", "routingCH.mean", "routingCH.visited_nodes_mean", "measurement.timestamp" }; File f = new File(summaryLocation); boolean writeHeader = !f.exists(); try (FileWriter writer = new FileWriter(f, true)) { if (writeHeader) writer.write(getSummaryHeader(properties)); writer.write(getSummaryLogLine(properties, propLocation)); } catch (IOException e) { logger.error("Could not write summary to file '{}'", summaryLocation, e); } }
Source:
<code>public boolean isMatch(String forwardedIpAddresses, Set<String> allowedIpAddresses) { if (Objects.nonNull(forwardedIpAddresses) && Objects.nonNull(allowedIpAddresses)) { String ipAddress = getFirstIpAddress(forwardedIpAddresses); if (ipAddressValidator.isValid(ipAddress)) { <START> return allowedIpAddresses.contains(getFirstIpAddress(forwardedIpAddresses)); <END> } } return false; }</code><technical_language>ipAddress do this: java return allowedIpAddresses.contains(ipAddress);</technical_language>

Target:
public boolean isMatch(String forwardedIpAddresses, Set<String> allowedIpAddresses) { if (Objects.nonNull(forwardedIpAddresses) && Objects.nonNull(allowedIpAddresses)) { String ipAddress = getFirstIpAddress(forwardedIpAddresses); if (ipAddressValidator.isValid(ipAddress)) { return allowedIpAddresses.contains(ipAddress); } } return false; }
Source:
<code>public static MessageNumberSet[] createMessageNumberSets(@Nonnull final long[] msgs) { List<MessageNumberSet> v = new ArrayList<MessageNumberSet>(); int i, j; <START> for (i = 0; i < msgs.length; i++) { <END> long start = msgs[i]; for (j = i + 1; j < msgs.length; j++) { if (msgs[j] != msgs[j - 1] + 1) { break; } } long end = msgs[j - 1]; v.add(new MessageNumberSet(start, end)); i = j - 1; } return v.toArray(new MessageNumberSet[v.size()]); }</code><technical_language>i++ is optional</technical_language>

Target:
public static MessageNumberSet[] createMessageNumberSets(@Nonnull final long[] msgs) { final List<MessageNumberSet> v = new ArrayList<MessageNumberSet>(); int i = 0; while (i < msgs.length) { long start = msgs[i]; int j = i + 1; while (j < msgs.length && msgs[j] == msgs[j - 1] + 1) { j++; } long end = msgs[j - 1]; v.add(new MessageNumberSet(start, end)); i = j; } return v.toArray(new MessageNumberSet[v.size()]); }
Source:
<code>protected CDONet4jSessionConfiguration getNet4jSessionConfiguration(IConnector connector, CDOURIData uriData, URI uri) { String userName = uriData.getUserName(); String passWord = uriData.getPassWord(); String repositoryName = uriData.getRepositoryName(); CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); configuration.setConnector(connector); configuration.setRepositoryName(repositoryName); <START> IPasswordCredentialsProvider credentialsProvider = null; <END> if (userName != null && passWord != null) { credentialsProvider = new PasswordCredentialsProvider(userName, passWord); } else { try { CDOURIData minimalUriData = new CDOURIData(uri); minimalUriData.setUserName(null); minimalUriData.setPassWord(null); minimalUriData.setResourcePath(null); minimalUriData.setBranchPath(null); minimalUriData.setTimeStamp(CDOBranchPoint.UNSPECIFIED_DATE); minimalUriData.setTransactional(false); credentialsProvider = (IPasswordCredentialsProvider)getContainer().getElement(CredentialsProviderFactory.PRODUCT_GROUP, "password", minimalUriData.toString()); } catch (FactoryNotFoundException ex) { } if (credentialsProvider == null) { credentialsProvider = getCredentialProvider(connector, repositoryName); } } configuration.setCredentialsProvider(credentialsProvider); return configuration; }</code><technical_language>mutualize this code line 254 giving userName, password description parameter</technical_language>

Target:
protected CDONet4jSessionConfiguration getNet4jSessionConfiguration(IConnector connector, CDOURIData uriData, URI uri) { String userName = uriData.getUserName(); String passWord = uriData.getPassWord(); String repositoryName = uriData.getRepositoryName(); CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration(); configuration.setConnector(connector); configuration.setRepositoryName(repositoryName); IPasswordCredentialsProvider credentialsProvider = null; if (userName != null && passWord != null) { credentialsProvider = new PasswordCredentialsProvider(userName, passWord); } else { try { CDOURIData minimalUriData = CDOUtil.getMinimalCDOURIData(uri); credentialsProvider = (IPasswordCredentialsProvider)getContainer().getElement(CredentialsProviderFactory.PRODUCT_GROUP, "password", minimalUriData.toString()); } catch (FactoryNotFoundException ex) { } if (credentialsProvider == null) { credentialsProvider = getCredentialProvider(connector, repositoryName); } } configuration.setCredentialsProvider(credentialsProvider); return configuration; }
Source:
<code>private static void unparseCube(SqlWriter writer, SqlCall call) { writer.keyword(call.getOperator().getName()); final SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")"); for (SqlNode operand : call.getOperandList()) { writer.sep(","); if (operand.getKind() == SqlKind.ROW) { final SqlWriter.Frame frame2 = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE, "(", ")"); for (SqlNode operand2 : ((SqlCall) operand).getOperandList()) { writer.sep(","); <START> operand2.unparse(writer, PRECEDENCE + 1, PRECEDENCE + 1); <END> } writer.endList(frame2); } else if (operand instanceof SqlNodeList && ((SqlNodeList) operand).size() == 0) { writer.keyword("()"); } else { operand.unparse(writer, PRECEDENCE + 1, PRECEDENCE + 1); } } writer.endList(frame); }</code><technical_language>getLeftPrec() getRightPrec() (inherited SqlOperator)? remove PRECEDENCE</technical_language>

Target:
private void unparseCube(SqlWriter writer, SqlCall call) { writer.keyword(call.getOperator().getName()); final SqlWriter.Frame frame = writer.startList(SqlWriter.FrameTypeEnum.FUN_CALL, "(", ")"); for (SqlNode operand : call.getOperandList()) { writer.sep(","); if (operand.getKind() == SqlKind.ROW) { final SqlWriter.Frame frame2 = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE, "(", ")"); for (SqlNode operand2 : ((SqlCall) operand).getOperandList()) { writer.sep(","); operand2.unparse(writer, getLeftPrec() + 1, getRightPrec() + 1); } writer.endList(frame2); } else if (operand instanceof SqlNodeList && ((SqlNodeList) operand).size() == 0) { writer.keyword("()"); } else { operand.unparse(writer, getLeftPrec() + 1, getRightPrec() + 1); } } writer.endList(frame); }
Source:
<code>public int hashCode() { <START> int result = name.hashCode(); <END> result = 31 * result + fullName.hashCode(); return result; }</code><technical_language>fullName enough too</technical_language>

Target:
public int hashCode() { return fullName.hashCode(); }
Source:
<code>public void testTextFieldFeatures() { SeleniumWComponentsWebDriver driver = getDriver(); SeleniumWButtonWebElement validatingButton = driver.findWButton(new ByButton("Validate button", false, true)); validatingButton.click(); SeleniumWPhoneNumberFieldWebElement phoneNumberField = driver.findWPhoneNumberField(new ByLabel("this is a phoneNumberField", false)); phoneNumberField.sendKeys("0400000000"); phoneNumberField.sendKeys(Keys.TAB); assertEquals("0400000000", phoneNumberField.getValue()); SeleniumWFieldIndicatorWebElement message = phoneNumberField.getFieldIndicatorMessage(); assertEquals("Successfully updated.", message.getText()); assertEquals(message.getIndicatorType(), AbstractWFieldIndicator.FieldIndicatorType.SUCCESS); <START> } <END></code><technical_language>testing is validation WFieldIndicatorWebElement. test rest of WPhoneNumberFieldWebElement please</technical_language>

Target:
public void testTextFieldFeatures() { SeleniumWComponentsWebDriver driver = getDriver(); SeleniumWButtonWebElement validatingButton = driver.findWButton(new ByButtonText("Validate button", false, true)); validatingButton.click(); SeleniumWPhoneNumberFieldWebElement phoneNumberField = driver.findWPhoneNumberField(new ByLabel("this is a phoneNumberField", false)); phoneNumberField.sendKeys("0400000000"); phoneNumberField.sendKeys(Keys.TAB); assertEquals("0400000000", phoneNumberField.getValue()); SeleniumWFieldIndicatorWebElement message = phoneNumberField.getFieldIndicatorMessage(); assertEquals("Successfully updated.", message.getText()); assertEquals(message.getIndicatorType(), AbstractWFieldIndicator.FieldIndicatorType.SUCCESS); }