auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public FormValidation doCheckExtraDockerLabelsString(@QueryParameter String extraDockerLabelsString) { final List<String> extraDockerLabels = splitAndFilterEmptyList(extraDockerLabelsString, "\n"); for (String extraDockerLabel : extraDockerLabels) { if (extraDockerLabel.trim().split("=").length < 2) { <START> return FormValidation.error("Wrong extraDockerLabel {}", extraDockerLabel); <END> } } return FormValidation.ok(); }</code><technical_language>"Invalid {}" "Wrong". ...but, if correct in thinking invalid data saved, good user "Invalid line \"{}\" ignored." Note: I wrong this (I'm this PR a web browser - run code try it), I FormValidation.error(String format, Object... args) takes a String.format string, magic "put next argument here" sequence %s {}. sort of checked a unit test :wink:</technical_language>

Target:
public FormValidation doCheckExtraDockerLabelsString(@QueryParameter String extraDockerLabelsString) { final List<String> extraDockerLabels = splitAndFilterEmptyList(extraDockerLabelsString, "\n"); for (String extraDockerLabel : extraDockerLabels) { if (extraDockerLabel.trim().split("=").length < 2) { return FormValidation.error("Invalid extraDockerLabel \"%s\" will be ignored", extraDockerLabel); } } return FormValidation.ok(); }
Source:
<code>void connect() { synchronized (this) { if (connected) { throw new IllegalStateException("Already connected"); } <START> } <END> eventBus.vertx().getClusterManager().getNodeInfo(remoteNodeId) .flatMap(nodeInfo -> nodeInfo != null ? Future.succeededFuture(nodeInfo) : Future.failedFuture("Not a member of the cluster")) .map(NodeInfo::getAddress) .flatMap(address -> client.connect(address.getPort(), address.getHost())) .onSuccess(this::connected) .onFailure(t -> { log.warn("Connecting to server " + remoteNodeId + " failed", t); close(t); }); }</code><technical_language>this, getNodeInfo fails future instead of completing future null ? more clean avoid unecessary flatMap operation for this purpose</technical_language>

Target:
void connect() { synchronized (this) { if (connected) { throw new IllegalStateException("Already connected"); } } Promise<NodeInfo> promise = Promise.promise(); eventBus.vertx().getClusterManager().getNodeInfo(remoteNodeId, promise); promise.future() .flatMap(info -> client.connect(info.port(), info.host())) .onComplete(ar -> { if (ar.succeeded()) { connected(ar.result()); } else { log.warn("Connecting to server " + remoteNodeId + " failed", ar.cause()); close(ar.cause()); } }); }
Source:
<code>public static ComponentURI of(CodeSystemURI codeSystemURI, ComponentIdentifier componentIdentifier) { <START> return new ComponentURI(codeSystemURI, componentIdentifier.getTerminologyComponentId(), componentIdentifier.getComponentId()); <END> }</code><technical_language>new factory methods do caching mechanism built this class</technical_language>

Target:
public static ComponentURI of(CodeSystemURI codeSystemURI, ComponentIdentifier componentIdentifier) { return of(codeSystemURI, componentIdentifier.getTerminologyComponentId(), componentIdentifier.getComponentId()); }
Source:
<code>protected DomainBundle getDomainBundle(){ <START> return new DefaultDomainBundle( <END> Lists.<CommandHandler>newArrayList() , Lists.<QueryHandler>newArrayList(new SomeQueryHandler(), new SomeCollectionQueryHandler()) , Lists.<Repository>newArrayList() , Lists.<EventListener>newArrayList() , new AccountDomain() , "AccountDomain" ); }</code><technical_language>provide a builder for DefaultDomainBundle ? nice to: new DefaultDomainBundleBuilder("AccountDomain", new AccountDomain()) // ctr args if mandatory ? .withQueryHandlers(new SomeQueryHandler(), new SomeCollectionQueryHandler())) .create()</technical_language>

Target:
protected DomainBundle getDomainBundle(){ return new DomainBundle.Builder(new AccountDomain()) .with(new SomeQueryHandler()) .with(new SomeCollectionQueryHandler()) .build(); }
Source:
<code>public InfoboxBuilderPage deleteHeaderComponentWithIndex(int index) { wait.forElementVisible(headers.get(index)); headers.get(index).click(); <START> wait.forElementVisible(deleteButton); <END> deleteButton.click(); return this; }</code><technical_language>please add line separate 'block'</technical_language>

Target:
public InfoboxBuilderPage deleteHeaderComponentWithIndex(int index) { WebElement headerToDelete = headers.get(index); wait.forElementClickable(headerToDelete); headerToDelete.click(); wait.forElementClickable(deleteButton); deleteButton.click(); return this; }
Source:
<code>public String asSummaryString() { <START> return "Kafka universal scan source"; <END> }</code><technical_language>"Kafka"</technical_language>

Target:
public String asSummaryString() { return "Kafka"; }
Source:
<code>public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (orientation != newConfig.orientation) { orientation = newConfig.orientation; } <START> configureForOrientation(orientation, newConfig); <END> }</code><technical_language>this if statement above</technical_language>

Target:
public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); configureForOrientation(newConfig); }
Source:
<code>private void insertIterTwice(int size, int[] fuzz, String distributionName) { PerformanceMeter pMinsertion1 = perf.createPerformanceMeter(distributionName + " First Insertion: " + fName); PerformanceMeter pMiterate1 = perf.createPerformanceMeter(distributionName + " First Iteration: " + fName); PerformanceMeter pMinsertion2 = perf.createPerformanceMeter(distributionName + " Second Insertion: " + fName); PerformanceMeter pMiterate2 = perf.createPerformanceMeter(distributionName + " Second Iteration: " + fName); for (int i = 0; i < DEFAULT_LOOP_COUNT; i++) { fSegStore.clear(); pMinsertion1.start(); <START> populate(size, fuzz, fSegStore, getSegmentStoreSize()); <END> pMinsertion1.stop(); pMiterate1.start(); iterate(fSegStore); pMiterate1.stop(); pMinsertion2.start(); populate(size, fuzz, fSegStore, getSegmentStoreSize()); pMinsertion2.stop(); pMiterate2.start(); iterate(fSegStore); pMiterate2.stop(); } pMinsertion1.commit(); pMiterate1.commit(); pMinsertion2.commit(); pMiterate2.commit(); }</code><technical_language>segments in</technical_language>

Target:
private void insertIterTwice(int size, int[] fuzz, String distributionName) { PerformanceMeter pMinsertion1 = fPerf.createPerformanceMeter(distributionName + " First Insertion: " + fName); PerformanceMeter pMiterate1 = fPerf.createPerformanceMeter(distributionName + " First Iteration: " + fName); PerformanceMeter pMinsertion2 = fPerf.createPerformanceMeter(distributionName + " Second Insertion: " + fName); PerformanceMeter pMiterate2 = fPerf.createPerformanceMeter(distributionName + " Second Iteration: " + fName); for (int i = 0; i < DEFAULT_LOOP_COUNT; i++) { fSegStore.clear(); pMinsertion1.start(); populate(size, fuzz, fSegStore, 0, getSegmentStoreSize() / 2); pMinsertion1.stop(); pMiterate1.start(); iterate(fSegStore); pMiterate1.stop(); pMinsertion2.start(); populate(size, fuzz, fSegStore, getSegmentStoreSize() / 2 + 1, getSegmentStoreSize()); pMinsertion2.stop(); pMiterate2.start(); iterate(fSegStore); pMiterate2.stop(); } pMinsertion1.commit(); pMiterate1.commit(); pMinsertion2.commit(); pMiterate2.commit(); }
Source:
<code><START> public void testEncodeThrowsMeaningfulException() throws IllegalArgumentException { <END> expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Error: keyA and alphabet size must be coprime."); AffineCipher affineCipher = new AffineCipher(); affineCipher.encode("This is a test", 6, 17); }</code><technical_language>IllegalArgumentException is unchecked exception need include throws</technical_language>

Target:
public void testEncodeThrowsMeaningfulException() throws IllegalArgumentException { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Error: keyA and alphabet size must be coprime."); affineCipher.encode("This is a test", 6, 17); }
Source:
<code>InCoreMerger(final Repository local) { super(local); <START> tw = new NameConflictTreeWalk(local, reader); <END> cache = DirCache.newInCore(); }</code><technical_language>incore merger works in memory a working tree. need attribute handling</technical_language>

Target:
InCoreMerger(final Repository local) { super(local); tw = new NameConflictTreeWalk(reader); cache = DirCache.newInCore(); }
Source:
<code>protected String handleConstraintCreationSection(List<? extends ConstraintElement> constraints, String tableId) { List<String> constraintStatements = new ArrayList<String>(); for (ConstraintElement constraint : constraints) { constraintStatements.add(constraintDataToSQL(constraint, tableId)); } <START> StringBuilder toExecute = new StringBuilder(); <END> toExecute.append((constraintStatements.size() != 0 ? ",\n" : "")); toExecute.append(join(constraintStatements, ",\n")); return toExecute.toString(); }</code><technical_language>This clearer construct sb if statement size (non-negated) append joined constraints</technical_language>

Target:
protected String handleConstraintCreationSection(List<? extends ConstraintElement> constraints, String tableId) { List<String> constraintStatements = new ArrayList<String>(); for (ConstraintElement constraint : constraints) { constraintStatements.add(constraintDataToSQL(constraint, tableId)); } StringBuilder toExecute = new StringBuilder(); if (constraintStatements.isEmpty()) { toExecute.append(""); } else { toExecute.append(",\n"); } toExecute.append(join(constraintStatements, ",\n")); return toExecute.toString(); }
Source:
<code>public void listDirSyncOnlyTouchingChildren() throws Exception { String dir1 = PathUtils.concatPath(EXISTING_DIR, "dir_should_sync"); String dir2 = PathUtils.concatPath(dir1, "dir_should_not_sync"); new File(ufsPath(dir1)).mkdirs(); new File(ufsPath(dir2)).mkdirs(); ListStatusPOptions optionsAlways = ListStatusPOptions.newBuilder() <START> .setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_ALWAYS).build(); <END> checkListStatus(EXISTING_DIR, optionsAlways, true); ListStatusPOptions optionsNever = ListStatusPOptions.newBuilder() .setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_NEVER).build(); checkListStatus(dir2, optionsNever, false); }</code><technical_language>this work recursive is false default? want false, right</technical_language>

Target:
public void listDirSyncOnlyTouchingChildren() throws Exception { String dir1 = PathUtils.concatPath(EXISTING_DIR, "dir_should_sync"); String dir2 = PathUtils.concatPath(dir1, "dir_should_not_sync"); new File(ufsPath(dir1)).mkdirs(); new File(ufsPath(dir2)).mkdirs(); ListStatusPOptions optionsAlways = ListStatusPOptions.newBuilder() .setLoadMetadataType(LoadMetadataPType.NEVER).setRecursive(false) .setCommonOptions(PSYNC_ALWAYS).build(); checkListStatus(EXISTING_DIR, optionsAlways, true); ListStatusPOptions optionsNever = ListStatusPOptions.newBuilder() .setLoadMetadataType(LoadMetadataPType.NEVER).setCommonOptions(PSYNC_NEVER) .setRecursive(false).build(); checkListStatus(dir2, optionsNever, false); }
Source:
<code>public ChangeControl controlFor(Change change, CurrentUser user) throws NoSuchChangeException { <START> final Project.NameKey projectKey = projectCache.get(change.getProject()).getProject().getNameKey(); <END> try { return projectControl.controlFor(projectKey, user).controlFor(change); } catch (NoSuchProjectException e) { throw new NoSuchChangeException(change.getId(), e); } }</code><technical_language>This is dumb. Add a Project.Id form ProjectControl.GenericFactory ProjectControl.Factory. perform 1 cache lookup, 2</technical_language>

Target:
public ChangeControl controlFor(Change change, CurrentUser user) throws NoSuchChangeException { try { return projectControl.controlFor(change.getProject(), user).controlFor(change); } catch (NoSuchProjectException e) { throw new NoSuchChangeException(change.getId(), e); } }
Source:
<code>private static Set<String> getAllowedOSName() { return new HashSet<>(Arrays.asList( "linux", "windows", "win", "mac", "macos", "macosx", <START> "mac os x", "ubuntu", "debian", "fedora" <END> )); }</code><technical_language>add **SunOS** **FreeBSD**</technical_language>

Target:
private static Set<String> getAllowedOSName() { return new HashSet<>(Arrays.asList( "linux", "windows", "win", "mac", "macos", "macosx", "mac os x", "ubuntu", "debian", "fedora", "red hat", "sunos", "freebsd" )); }
Source:
<code>public void testNfcSensorVariable() throws InterpretationException { NdefMessage ndefMessage1 = NfcHandler.createMessage(NFC_NDEF_STRING_1, BrickValues.TNF_MIME_MEDIA); NdefMessage ndefMessage2 = NfcHandler.createMessage(NFC_NDEF_STRING_2, BrickValues.TNF_MIME_MEDIA); UiHardwareTestUtils.gotoNfcFragment(nfcBrickPosition); UiHardwareTestUtils.fakeNfcTag(FIRST_TEST_TAG_ID, ndefMessage1, null); onView(withId(R.id.button_play)) .perform(click()); <START> Assert.assertTrue("Timeout while waiting for user variable change - 'tag id'", <END> userVariableEqualsWithinTimeout(readTagId, 0, 2000)); Assert.assertTrue("Timeout while waiting for user variable change - 'tag message' ", userVariableEqualsWithinTimeout(readTagMessage, "0.0", 2000)); UiHardwareTestUtils.fakeNfcTag(SECOND_TEST_TAG_ID, ndefMessage2, null); Assert.assertTrue("Timeout while waiting for user variable change - 'tag id'", userVariableEqualsWithinTimeout(readTagId, Double.parseDouble(TAG_ID_2), 2000)); Assert.assertTrue("Timeout while waiting for user variable change - 'tag message' ", userVariableEqualsWithinTimeout(readTagMessage, NFC_NDEF_STRING_2, 2000)); }</code><technical_language>start activity in tests instead of setup start intent desired fragment, split tests in test classes, do checks in script view, want check in nfcFragment setup start respective fragment / activity</technical_language>

Target:
public void testNfcSensorVariable() throws InterpretationException { UiNFCTestUtils.gotoNfcFragment(nfcBrickPosition); UiNFCTestUtils.fakeNfcTag(UiNFCTestUtils.FIRST_TEST_TAG_ID, ndefMessage1, null, baseActivityTestRule.getActivity()); onView(withId(R.id.button_play)) .perform(click()); Assert.assertTrue(UserVariableTestUtils.userVariableEqualsWithinTimeout(readTagId, 0, 2000)); Assert.assertTrue(UserVariableTestUtils.userVariableEqualsWithinTimeout(readTagMessage, "0.0", 2000)); }
Source:
<code>public Choices getMatches(String field, String query, Collection collection, int start, int limit, String locale) { String formName; try { formName = Utils.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getMatches(field, query, collection, start, limit, locale); } catch (DCInputsReaderException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>Please a logger</technical_language>

Target:
public Choices getMatches(String field, String query, Collection collection, int start, int limit, String locale) { String formName; try { init(); if(collection==null) { Set<Choice> choices = new HashSet<Choice>(); for(ChoiceAuthority ca : delegates.values()) { Choices tmp = ca.getMatches(field, query, null, start, limit, locale); if(tmp.total>0) { Set<Choice> mySet = new HashSet<Choice>(Arrays.asList(tmp.values)); choices.addAll(mySet); } } if(!choices.isEmpty()) { Choice[] results = new Choice[choices.size()-1]; choices.toArray(results); return new Choices(results, 0, choices.size(), Choices.CF_AMBIGUOUS, false); } } else { formName = dci.getInputFormNameByCollectionAndField(collection, field); return delegates.get(formName).getMatches(field, query, collection, start, limit, locale); } } catch (DCInputsReaderException e) { log.error(e.getMessage(), e); } return new Choices(Choices.CF_NOTFOUND); }
Source:
<code>public Long getSearchKey1() { return extBusEvent.getAccountId().getMostSignificantBits() & Long.MAX_VALUE; <START> } <END></code><technical_language>a new behavior? user do of UUID</technical_language>

Target:
public Long getSearchKey1() { final UUID accountId = extBusEvent.getAccountId(); return accountId == null ? null : accountId.getMostSignificantBits() & Long.MAX_VALUE; }
Source:
<code>protected Stream<URL> listBundleComponents(Bundle bundle) { String list = OSGiRuntimeService.getComponentsList(bundle); String name = bundle.getSymbolicName(); log.debug("PartialBundle: " + name + " components: " + list); if (list == null) { return null; } <START> return Arrays.stream(list.split("[, \t\n\r\f]")).map(s -> bundle.getEntry((String) s)).filter(Objects::nonNull); <END> }</code><technical_language>needed, s is a String</technical_language>

Target:
protected Stream<URL> listBundleComponents(Bundle bundle) { String list = OSGiRuntimeService.getComponentsList(bundle); String name = bundle.getSymbolicName(); log.debug("PartialBundle: " + name + " components: " + list); if (list == null) { return null; } return Arrays.stream(list.split("[, \t\n\r\f]")).map(bundle::getEntry).filter(Objects::nonNull); }
Source:
<code>public TemporalSearchFunctionFactory(final Configuration conf, final TemporalIndexer temporalIndexer) { <START> this.conf = conf; <END> this.temporalIndexer = temporalIndexer; }</code><technical_language>Do need conf here? I used</technical_language>

Target:
public TemporalSearchFunctionFactory(final Configuration conf, final TemporalIndexer temporalIndexer) { this.temporalIndexer = temporalIndexer; }
Source:
<code>CompletableFuture<JobManagerRunner> createJobManagerRunner(JobGraph jobGraph) { final RpcService rpcService = getRpcService(); return CompletableFuture.supplyAsync( () -> { try { JobManagerRunner runner = jobManagerRunnerFactory.createJobManagerRunner( jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, new DefaultJobManagerJobMetricGroupFactory(jobManagerMetricGroup), fatalErrorHandler); runner.start(); return runner; } catch (Exception e) { throw new CompletionException(new JobExecutionException(jobGraph.getJobID(), "Could not instantiate JobManager.", e)); } }, <START> rpcService.getExecutor()); END> }</code><technical_language>file a follow issue replace rpcService.getExecutor a proper ioExecutor</technical_language>

Target:
CompletableFuture<JobManagerRunner> createJobManagerRunner(JobGraph jobGraph) { final RpcService rpcService = getRpcService(); return CompletableFuture.supplyAsync( () -> { try { JobManagerRunner runner = jobManagerRunnerFactory.createJobManagerRunner( jobGraph, configuration, rpcService, highAvailabilityServices, heartbeatServices, jobManagerSharedServices, new DefaultJobManagerJobMetricGroupFactory(jobManagerMetricGroup), fatalErrorHandler); runner.start(); return runner; } catch (Exception e) { throw new CompletionException(new JobInitializationException(jobGraph.getJobID(), "Could not instantiate JobManager.", e)); } }, rpcService.getExecutor()); }
Source:
<code>public void testEvalNegative() { <START> Mockito.when(mockExternalNetworkPredicate.eval(mockNetwork)).thenReturn(true); <END> assertFalse(underTest.eval(mockNetwork)); }</code><technical_language>please static import</technical_language>

Target:
public void testEvalNegative() { when(mockExternalNetworkPredicate.eval(mockNetwork)).thenReturn(true); assertFalse(underTest.eval(mockNetwork)); }
Source:
<code>public void publish(String content) { <START> System.out.println("Hello"); <END> RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); String priority = null; if (requestAttributes != null) { priority = (String) requestAttributes.getAttribute("priority", RequestAttributes.SCOPE_REQUEST); } String tenantId = String.valueOf(TenancyContextHolder.getContext().getTenant().getIdentity()); String userId = null; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication != null) { userId = authentication.getName(); } Message message = new Message(userId, tenantId, content, priority); this.messages.add(message); }</code><technical_language>remove this please, a logger</technical_language>

Target:
public void publish(String content) { RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); String priority = null; if (requestAttributes != null) { priority = (String) requestAttributes.getAttribute("priority", RequestAttributes.SCOPE_REQUEST); } String tenantId = String.valueOf(TenancyContextHolder.getContext().getTenant().getIdentity()); String userId = null; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication != null) { userId = authentication.getName(); } Message message = new Message(userId, tenantId, content, priority); this.messages.add(message); }
Source:
<code>private static RepositorySystemSession newSession(RepositorySystem system ) <START> { <END> DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME ); session.setLocalRepositoryManager( system.newLocalRepositoryManager( session, localRepo ) ); return session; }</code><technical_language>wrong code format</technical_language>

Target:
private static RepositorySystemSession newSession(RepositorySystem system) { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); LocalRepository localRepo = new LocalRepository(ArtifactRepositoryPreference.getGlobalM2RepoDirWithFallback()); session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo)); return session; }
Source:
<code>public boolean initialize(List<StorageDomain> sds, StoragePool dc, String okCommandName, String cancelCommandName, ICommandTarget target) { List<StorageDomain> sdsToUpgrade = sds.stream().filter(getComparePredicate(dc)).collect(Collectors.toList()); if (sdsToUpgrade.isEmpty()) { return false; } UICommand okCommand = UICommand.createDefaultOkUiCommand(okCommandName, target); UICommand cancelCommand = UICommand.createCancelUiCommand(cancelCommandName, target); getCommands().add(okCommand); getCommands().add(cancelCommand); setTitle(ConstantsManager.getInstance().getConstants().updatingStorageDomainTitle()); setMessage(getFormatWarningMessage(dc, sdsToUpgrade)); <START> getReason().setIsValid(false); <END> return true; }</code><technical_language>need, removed</technical_language>

Target:
public boolean initialize(List<StorageDomain> sds, StoragePool dc, String okCommandName, String cancelCommandName, ICommandTarget target) { List<StorageDomain> sdsToUpgrade = sds.stream().filter(getComparePredicate(dc)).collect(Collectors.toList()); if (sdsToUpgrade.isEmpty()) { return false; } UICommand okCommand = UICommand.createDefaultOkUiCommand(okCommandName, target); UICommand cancelCommand = UICommand.createCancelUiCommand(cancelCommandName, target); getCommands().add(okCommand); getCommands().add(cancelCommand); setTitle(ConstantsManager.getInstance().getConstants().updatingStorageDomainTitle()); setMessage(getFormatWarningMessage(dc, sdsToUpgrade)); return true; }
Source:
<code>public void signUpWithEmail() { SignupFlow signupFlow = new SignupFlow(); signupFlow.chooseSignupWithEmail(); signupFlow.enterEmail("e2eflowtestingmobile@example.com", mMagicLinkActivityTestRule); signupFlow.checkEpilogue( "e2eflowtestingmobile@example.com", <START> "Eeflowtestingmobile@example.com", <END> "e2eflowtestingmobile"); signupFlow.enterPassword("Pa$$word"); signupFlow.confirmSignup(); }</code><technical_language>I able get error I mentioned this change: suggestion "Eeflowtestingmobile",</technical_language>

Target:
public void signUpWithEmail() { SignupFlow signupFlow = new SignupFlow(); signupFlow.chooseSignupWithEmail(); signupFlow.enterEmail(E2E_SIGNUP_EMAIL, mMagicLinkActivityTestRule); signupFlow.checkEpilogue( E2E_SIGNUP_DISPLAY_NAME, E2E_SIGNUP_USERNAME); signupFlow.enterPassword(E2E_SIGNUP_PASSWORD); signupFlow.confirmSignup(); }
Source:
<code>private BestPossibleStateOutput calcBestPossState(ResourceControllerDataProvider cache, Set<String> resources) throws Exception { ClusterEvent event = new ClusterEvent(ClusterEventType.StateVerifier); event.addAttribute(AttributeName.ControllerDataProvider.name(), cache); runStage(event, new ResourceComputationStage()); if (resources != null && !resources.isEmpty()) { final Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.name()); resourceMap.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES.name(), resourceMap); final Map<String, Resource> resourceMapToRebalance = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); resourceMapToRebalance.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES_TO_REBALANCE.name(), resourceMapToRebalance); } runStage(event, new CurrentStateComputationStage()); DryrunWagedRebalancer wagedRebalancer = new DryrunWagedRebalancer(_zkClient.getServers(), cache.getClusterName(), cache.getClusterConfig().getGlobalRebalancePreference()); runStage(event, new BestPossibleStateCalcStage(wagedRebalancer)); <START> wagedRebalancer.close(); <END> BestPossibleStateOutput output = event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.name()); return output; }</code><technical_language>Do need try{} finally{} here? FYI, is a reason WagedRebalancer implement AutoCloseable</technical_language>

Target:
private BestPossibleStateOutput calcBestPossState(ResourceControllerDataProvider cache, Set<String> resources) throws Exception { ClusterEvent event = new ClusterEvent(ClusterEventType.StateVerifier); event.addAttribute(AttributeName.ControllerDataProvider.name(), cache); runStage(event, new ResourceComputationStage()); if (resources != null && !resources.isEmpty()) { final Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.name()); resourceMap.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES.name(), resourceMap); final Map<String, Resource> resourceMapToRebalance = event.getAttribute(AttributeName.RESOURCES_TO_REBALANCE.name()); resourceMapToRebalance.keySet().retainAll(resources); event.addAttribute(AttributeName.RESOURCES_TO_REBALANCE.name(), resourceMapToRebalance); } runStage(event, new CurrentStateComputationStage()); DryrunWagedRebalancer dryrunWagedRebalancer = new DryrunWagedRebalancer(_zkClient.getServers(), cache.getClusterName(), cache.getClusterConfig().getGlobalRebalancePreference()); try { runStage(event, new BestPossibleStateCalcStage(dryrunWagedRebalancer)); } finally { dryrunWagedRebalancer.close(); } BestPossibleStateOutput output = event.getAttribute(AttributeName.BEST_POSSIBLE_STATE.name()); return output; }
Source:
<code>public void buildConnectionCache() { this.connectionCache = null; this.connectionCache = CacheBuilder.newBuilder().removalListener((RemovalListener<ConnectionInfo, HikariDataSource>) notification -> { HikariDataSource source = notification.getValue(); if (source != null) { source.close(); } }).build(new CacheLoader<ConnectionInfo, HikariDataSource>() { @Override public HikariDataSource load(@Nonnull ConnectionInfo key) throws Exception { HikariConfig config = new HikariConfig(); config.setUsername(key.getUser()); config.setPassword(key.getPassword()); config.setDriverClassName(key.getDriverClassName()); config.setMaximumPoolSize((Runtime.getRuntime().availableProcessors() * 2) + 1); config.setLeakDetectionThreshold(60 * 1000); Properties driverSpecificProperties = PROTOCOL_SPECIFIC_PROPS.get(key.getDriverClassName()); if (driverSpecificProperties != null) { config.setDataSourceProperties(driverSpecificProperties); } if (key.getDriverClassName().equals("com.mysql.cj.jdbc.Driver")) { <START> config.setJdbcUrl(key.getAuthlessUrl() + "?disableMariaDbDriver"); <END> } else { config.setJdbcUrl(key.getAuthlessUrl()); } return new HikariDataSource(config); } }); }</code><technical_language>Info for reviewing / testing: <LINK_0></technical_language>

Target:
public void buildConnectionCache() { this.connectionCache = null; this.connectionCache = CacheBuilder.newBuilder().removalListener((RemovalListener<ConnectionInfo, HikariDataSource>) notification -> { HikariDataSource source = notification.getValue(); if (source != null) { source.close(); } }).build(new CacheLoader<ConnectionInfo, HikariDataSource>() { @Override public HikariDataSource load(@Nonnull ConnectionInfo key) throws Exception { HikariConfig config = new HikariConfig(); config.setUsername(key.getUser()); config.setPassword(key.getPassword()); config.setDriverClassName(key.getDriverClassName()); config.setMaximumPoolSize((Runtime.getRuntime().availableProcessors() * 2) + 1); config.setLeakDetectionThreshold(60 * 1000); Properties driverSpecificProperties = PROTOCOL_SPECIFIC_PROPS.get(key.getDriverClassName()); if (driverSpecificProperties != null) { config.setDataSourceProperties(driverSpecificProperties); } config.setJdbcUrl(key.getAuthlessUrl() + key.getOptions()); return new HikariDataSource(config); } }); }
Source:
<code><START> protected PendingWorkerNums notifyAllocatedWorkerStopped(ResourceID resourceID) { <END> WorkerResourceSpec workerResourceSpec = allocatedNotRegisteredWorkerResourceSpecs.remove(resourceID); if (workerResourceSpec == null) { return PendingWorkerNums.ZERO; } return new PendingWorkerNums( requestedNotAllocatedWorkerCounter.getNum(workerResourceSpec), requestedNotRegisteredWorkerCounter.decreaseAndGet(workerResourceSpec)); }</code><technical_language>here. This method need return PendingWorkerNums</technical_language>

Target:
protected void notifyAllocatedWorkerStopped(ResourceID resourceID) { WorkerResourceSpec workerResourceSpec = allocatedNotRegisteredWorkerResourceSpecs.remove(resourceID); if (workerResourceSpec == null) { return; } requestedNotRegisteredWorkerCounter.decreaseAndGet(workerResourceSpec); }
Source:
<code>public void underlineStyling() { interact(() -> { area.replaceText(firstWord + styledWord1 + moreText + styledWord2 + remainingLine); }); List<Text> textNodes = getTextNodes(); assertEquals(1, textNodes.size()); assertEquals(firstWord + styledWord1 + moreText + styledWord2 + remainingLine, textNodes.get(0).getText()); interact(() -> { final int start1 = firstWord.length(); final int end1 = start1 + styledWord1.length(); area.setStyle(start1, end1, "-rtfx-underline-color: red; -rtfx-underline-dash-array: 2 2; -rtfx-underline-width: 1; -rtfx-underline-cap: butt;"); final int start2 = end1 + moreText.length(); final int end2 = start2 + styledWord2.length(); area.setStyle(start2, end2, <START> "-rtfx-underline-color: red; -rtfx-underline-dash-array: 2 2; -rtfx-underline-width: 1; -rtfx-underline-cap: butt;"); <END> }); textNodes = getTextNodes(); assertEquals(5, textNodes.size()); Text first = textNodes.get(0); assertEquals(firstWord, first.getText()); Text second = textNodes.get(1); assertEquals(styledWord1, second.getText()); Text third = textNodes.get(2); assertEquals(moreText, third.getText()); Text fourth = textNodes.get(3); assertEquals(styledWord2, fourth.getText()); Text fifth = textNodes.get(4); assertEquals(remainingLine, fifth.getText()); List<Path> underlineNodes = getUnderlinePaths(); assertEquals(2, underlineNodes.size()); }</code><technical_language>this declared in a variable pass variable in area.setStyle() calls</technical_language>

Target:
public void underlineStyling() { final String underlineStyle = "-rtfx-underline-color: red; -rtfx-underline-dash-array: 2 2; -rtfx-underline-width: 1; -rtfx-underline-cap: butt;"; interact(() -> { area.replaceText(HELLO + WORLD + AND_ALSO_THE + SUN + AND_MOON); }); List<Text> textNodes = getTextNodes(0); assertEquals(1, textNodes.size()); assertEquals(HELLO + WORLD + AND_ALSO_THE + SUN + AND_MOON, textNodes.get(0).getText()); interact(() -> { final int start1 = HELLO.length(); final int end1 = start1 + WORLD.length(); area.setStyle(start1, end1, underlineStyle); final int start2 = end1 + AND_ALSO_THE.length(); final int end2 = start2 + SUN.length(); area.setStyle(start2, end2, underlineStyle); }); textNodes = getTextNodes(0); assertEquals(5, textNodes.size()); Text first = textNodes.get(0); assertEquals(HELLO, first.getText()); Text second = textNodes.get(1); assertEquals(WORLD, second.getText()); Text third = textNodes.get(2); assertEquals(AND_ALSO_THE, third.getText()); Text fourth = textNodes.get(3); assertEquals(SUN, fourth.getText()); Text fifth = textNodes.get(4); assertEquals(AND_MOON, fifth.getText()); List<Path> underlineNodes = getUnderlinePaths(0); assertEquals(2, underlineNodes.size()); }
Source:
<code>public void onPostUploaded(OnPostUploaded event) { if (isAdded() && event.post.getLocalSiteId() == mSite.getId()) { loadPosts(LoadMode.FORCED); final PostModel post = event.post; boolean isDraft = post != null && PostStatus.fromPost(post) == PostStatus.DRAFT; if (isDraft) { <START> if (PostUtils.isPublishable(post)) { <END> if (event.isError()) { showSnackbar(getString(R.string.editor_draft_saved_locally)); } else { View.OnClickListener publishPostListener = new View.OnClickListener() { @Override public void onClick(View v) { publishPost(post); } }; showSnackbar(R.string.editor_draft_saved_online, R.string.button_publish, publishPostListener); } } } else { if (event.isError()) { showSnackbar(getString(R.string.editor_draft_saved_locally)); } else { String message = post.isPage() ? getString(R.string.page_published) : getString(R.string.post_published); showSnackbar(message); } } } }</code><technical_language>This check necessary, check if a post is publishable (has of content, title, excerpt) publishing, a PUSH_POST request if qualify. (If a mistake in future upload unpublishable, get error response server, show.) removing this, pull event.isError() case isDraft check isDraft not</technical_language>

Target:
public void onPostUploaded(OnPostUploaded event) { final PostModel post = event.post; if (isAdded() && event.post != null && event.post.getLocalSiteId() == mSite.getId()) { loadPosts(LoadMode.FORCED); if (event.isError()) { showSnackbar(getString(R.string.editor_draft_saved_locally)); } else { boolean isDraft = PostStatus.fromPost(post) == PostStatus.DRAFT; if (isDraft) { View.OnClickListener publishPostListener = new View.OnClickListener() { @Override public void onClick(View v) { publishPost(post); } }; showSnackbar(R.string.editor_draft_saved_online, R.string.button_publish, publishPostListener); } else { String message = post.isPage() ? getString(R.string.page_published) : getString(R.string.post_published); showSnackbar(message); } } } }
Source:
<code>public void testAsSAMRecordParsedTags() throws Exception { <START> final String tags = "BC:Z:ACTG\tRG:Z:sample1"; <END> final SAMRecord samRecord = new SAMRecordSetBuilder().addFrag("test", 0, 1, false, false, "10M", null, 2); final FastqRecord record = new FastqRecord(samRecord.getReadName(), samRecord.getReadBases(), tags, samRecord.getBaseQualities()); final SAMRecord converted = FastqEncoder.asSAMRecord(record, samRecord.getHeader(), FastqEncoder.QUALITY_HEADER_PARSE_SAM_TAGS); testConvertedSAMRecord(converted, samRecord); Assert.assertEquals(converted.getAttribute("BC"), "ACTG"); Assert.assertEquals(converted.getAttribute("RG"), "sample1"); }</code><technical_language>please test other types well.</technical_language>

Target:
public void testAsSAMRecordParsedTags() throws Exception { final String bc = "ACTG"; final String rg = "sample1"; final int fi = 1; final String customTag = "ct"; final char ct = 'a'; final String tags = String.format("%s:Z:%s\t%s:Z:%s\t%s:i:%d\t%s:A:%c", SAMTag.BC, bc, SAMTag.RG, rg, SAMTag.FI, fi, customTag, ct ); final SAMRecord samRecord = new SAMRecordSetBuilder().addFrag("test", 0, 1, false, false, "10M", null, 2); final FastqRecord record = new FastqRecord(samRecord.getReadName(), samRecord.getReadBases(), tags, samRecord.getBaseQualities()); final SAMRecord converted = FastqEncoder.asSAMRecord(record, samRecord.getHeader(), FastqEncoder.QUALITY_HEADER_PARSE_SAM_TAGS); testConvertedSAMRecord(converted, samRecord); Assert.assertEquals(converted.getAttribute(SAMTag.BC.name()), bc); Assert.assertEquals(converted.getAttribute(SAMTag.RG.name()), rg); Assert.assertEquals(converted.getAttribute(SAMTag.FI.name()), fi); Assert.assertEquals(converted.getAttribute(customTag), ct); }
Source:
<code>public void execute(TronObject object) { if (object instanceof Player) { Player player = (Player) object; player.skipNumberOfActions(POWER_FAILURE_PENALTY_AT_START_TURN); <START> } <END> }</code><technical_language>super.execute() allow chaining</technical_language>

Target:
public void execute(TronObject object) { if (object instanceof TronPlayer) { TronPlayer player = (TronPlayer) object; player.skipNumberOfActions(POWER_FAILURE_PENALTY_AT_START_TURN); } super.execute(object); }
Source:
<code>public OkHttpClient provideOkHttpClient(Context context, HttpLoggingInterceptor httpLoggingInterceptor) { File dir = new File(context.getCacheDir(), "okHttpCache"); OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .addInterceptor(httpLoggingInterceptor) .readTimeout(60, TimeUnit.SECONDS) .cache(new Cache(dir, OK_HTTP_CACHE_SIZE)); <START> if(BuildConfig.FLAVOR.equals("beta")){ <END> builder.sslSocketFactory(SslUtils.INSTANCE.getSslContextForCertificateFile(context, "*.wikimedia.beta.wmflabs.org.cer").getSocketFactory()); } return builder.build(); }</code><technical_language>ConfigUtils:isBetaFlavour</technical_language>

Target:
public OkHttpClient provideOkHttpClient(Context context, HttpLoggingInterceptor httpLoggingInterceptor) { File dir = new File(context.getCacheDir(), "okHttpCache"); OkHttpClient.Builder builder = new OkHttpClient.Builder().connectTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .addInterceptor(httpLoggingInterceptor) .readTimeout(60, TimeUnit.SECONDS) .cache(new Cache(dir, OK_HTTP_CACHE_SIZE)); if(ConfigUtils.isBetaFlavour()){ builder.sslSocketFactory(SslUtils.INSTANCE.getSslContextForCertificateFile(context, "*.wikimedia.beta.wmflabs.org.cer").getSocketFactory()); } return builder.build(); }
Source:
<code>public static AttributeValue createValue(String value) { if (value == null) <START> throw new IllegalArgumentException(); <END> return new AttributeValue(value, value); }</code><technical_language>Please include a translation text indicating attribute null</technical_language>

Target:
public static AttributeValue createValue(String value) { if (value == null) throw new IllegalArgumentException( JGitText.get().attributeValueCantBeNull); return new AttributeValue(value, value); }
Source:
<code><START> String generateComponent(){ <END> return mPackage + "/" + mComponent; }</code><technical_language>Space {</technical_language>

Target:
String generateComponent() { return pkg + "/" + component; }
Source:
<code>protected void insert(Record record) throws NoGuidForIdException, NullCursorException, ParentNotFoundException { HistoryRecord toStore = (HistoryRecord) prepareRecord(record); <START> enqueueNewRecord(toStore); <END> }</code><technical_language>Again, inline toStore</technical_language>

Target:
protected void insert(Record record) throws NoGuidForIdException, NullCursorException, ParentNotFoundException { enqueueNewRecord((HistoryRecord) prepareRecord(record)); }
Source:
<code>public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { Table table = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); List<String> dataColumns = table.getSd().getCols().stream() .map(FieldSchema::getName) .collect(toImmutableList()); List<String> partitionColumns = table.getPartitionKeys().stream() .map(FieldSchema::getName) .collect(toImmutableList()); Map<String, HiveBasicStatistics> partitionBasicStatistics = getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)) .stream() .collect(toImmutableMap(partition -> makePartName(partitionColumns, partition.getValues()), partition -> getHiveBasicStatistics(partition.getParameters()))); Map<String, Map<String, HiveColumnStatistics>> partitionColumnStatistics = getPartitionColumnStatistics(databaseName, tableName, partitionNames, dataColumns); ImmutableMap.Builder<String, PartitionStatistics> result = ImmutableMap.builder(); for (String partitionName : partitionNames) { HiveBasicStatistics basicStatistics = partitionBasicStatistics.get(partitionName); if (basicStatistics == null) { basicStatistics = createEmptyStatistics(); } Map<String, HiveColumnStatistics> columnStatistics = partitionColumnStatistics.get(partitionName); if (columnStatistics == null) { columnStatistics = ImmutableMap.of(); } <START> result.put(partitionName, new PartitionStatistics(basicStatistics, columnStatistics)); <END> } return result.build(); }</code><technical_language>Put argument toImmutableMap separate lines, a bit long important</technical_language>

Target:
public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { Table table = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); List<String> dataColumns = table.getSd().getCols().stream() .map(FieldSchema::getName) .collect(toImmutableList()); List<String> partitionColumns = table.getPartitionKeys().stream() .map(FieldSchema::getName) .collect(toImmutableList()); Map<String, HiveBasicStatistics> partitionBasicStatistics = getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)).stream() .collect(toImmutableMap( partition -> makePartName(partitionColumns, partition.getValues()), partition -> getHiveBasicStatistics(partition.getParameters()))); Map<String, Map<String, HiveColumnStatistics>> partitionColumnStatistics = getPartitionColumnStatistics(databaseName, tableName, partitionNames, dataColumns); ImmutableMap.Builder<String, PartitionStatistics> result = ImmutableMap.builder(); for (String partitionName : partitionNames) { HiveBasicStatistics basicStatistics = partitionBasicStatistics.getOrDefault(partitionName, createEmptyStatistics()); Map<String, HiveColumnStatistics> columnStatistics = partitionColumnStatistics.getOrDefault(partitionName, ImmutableMap.of()); result.put(partitionName, new PartitionStatistics(basicStatistics, columnStatistics)); } return result.build(); }
Source:
<code>private void initializeMap() { WebSourceTileLayer tileSource = new WebSourceTileLayer( "openstreetmap", getString(R.string.map_tile_source_url), true ); mapView.setDiskCacheEnabled(true); mapView.setTileSource(tileSource); mapView.setZoom(getResources().getInteger(R.integer.map_default_zoom)); mapView.setUserLocationEnabled(true); mapView.setUserLocationTrackingMode(UserLocationOverlay.TrackingMode.FOLLOW_BEARING); mapView.getUserLocationOverlay().runOnFirstFix(new Runnable() { @Override public void run() { <START> currentLocation = mapView.getUserLocationOverlay().getLastFix(); <END> makeUseOfNewLocation(currentLocation); fetchNearbyPages(); } }); mapView.setMapViewListener(new DefaultMapViewListener() { @Override public void onTapMarker(MapView mapView, Marker marker) { highlightMarker(marker); int index = adapter.getPosition((NearbyPage) marker.getRelatedObject()); if (index == -1) { return; } nearbyList.setSelection(index); } }); mapView.addListener(new MapListener() { @Override public void onScroll(ScrollEvent scrollEvent) { fetchNearbyPages(); } @Override public void onZoom(ZoomEvent zoomEvent) { fetchNearbyPages(); } @Override public void onRotate(RotateEvent rotateEvent) { } }); }</code><technical_language>lol well, I suppose a location of 0N 0E is a good first-approximation (or 0th-approximation) of actual location</technical_language>

Target:
private void initializeMap() { WebSourceTileLayer tileSource = new WebSourceTileLayer( "openstreetmap", getString(R.string.map_tile_source_url), true ); mapView.setBubbleEnabled(false); mapView.setDiskCacheEnabled(true); mapView.setTileSource(tileSource); mapView.setZoom(getResources().getInteger(R.integer.map_default_zoom)); mapView.setUserLocationTrackingMode(UserLocationOverlay.TrackingMode.FOLLOW_BEARING); mapView.getUserLocationOverlay().runOnFirstFix(new Runnable() { @Override public void run() { currentLocation = mapView.getUserLocationOverlay().getLastFix(); makeUseOfNewLocation(currentLocation); fetchNearbyPages(); } }); mapView.setMapViewListener(new DefaultMapViewListener() { @Override public void onTapMarker(MapView mapView, Marker marker) { highlightMarker(marker); int index = adapter.getPosition((NearbyPage) marker.getRelatedObject()); if (index == -1) { return; } nearbyList.setSelection(index); } }); mapView.addListener(new MapListener() { @Override public void onScroll(ScrollEvent scrollEvent) { fetchNearbyPages(); } @Override public void onZoom(ZoomEvent zoomEvent) { fetchNearbyPages(); } @Override public void onRotate(RotateEvent rotateEvent) { } }); }
Source:
<code>private String getConsoleModelErrorMessage(Object sender, ErrorCodeEventArgs e) { String translatedError = consoleErrorCodeTranslator.translateErrorCode(e.getErrorCode()); if (sender instanceof SpiceConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingSpiceMsg(translatedError); } else if (sender instanceof RdpConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingRdpMsg(translatedError); } <START> throw new IllegalArgumentException("Message recieved from an unknown model " + sender.getClass().getName()); END> }</code><technical_language>catches that? return a message instead;</technical_language>

Target:
private String getConsoleModelErrorMessage(Object sender, ErrorCodeEventArgs e) { String translatedError = consoleErrorCodeTranslator.translateErrorCode(e.getErrorCode()); if (sender instanceof SpiceConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingSpiceMsg(translatedError); } else if (sender instanceof RdpConsoleModel) { return ConstantsManager.getInstance() .getMessages() .errConnectingVmUsingRdpMsg(translatedError); } return translatedError; }
Source:
<code>public void getAsCsvTest() throws Exception { <START> System.out.println(ENDPOINT); <END> getAsDelimitedTest(ENDPOINT + CSV, HttpConstants.MIME_TYPE_CSV, CSV, PROFILE, POSTABLE); }</code><technical_language>I logging framework for outputting info, System.out</technical_language>

Target:
public void getAsCsvTest() throws Exception { getAsDelimitedTest(ENDPOINT + CSV, HttpConstants.MIME_TYPE_CSV, CSV, PROFILE, POSTABLE); }
Source:
<code><START> public boolean isMaskValid(String netmask) { <END> if (!isMaskFormatValid(netmask)) { return false; } if (netmask.matches(ValidationUtils.SUBNET_PATTERN_AS_NETMASK_WITH_SLASH)) { return true; } return isMaskValidPrefixFree(netmask); }</code><technical_language>Again, method in current form completely redundant, I point in aggregated method validating format value</technical_language>

Target:
public boolean isMaskValid(String netmask) { if (netmask.matches(ValidationUtils.SUBNET_PATTERN_AS_NETMASK_WITH_OPTIONAL_PREFIX_SLASH)) { return true; } return isNetmaskValid(netmask); }