auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public MapReduceJobState(RunningJob runningJob, TaskReport[] mapTaskReport, TaskReport[] reduceTaskReport) throws IOException { jobId = runningJob.getID().toString(); jobName = runningJob.getJobName(); trackingURL = runningJob.getTrackingURL(); isComplete = runningJob.isComplete(); isSuccessful = runningJob.isSuccessful(); mapProgress = runningJob.mapProgress(); reduceProgress = runningJob.reduceProgress(); totalMappers = mapTaskReport.length; totalReducers = reduceTaskReport.length; <START> mapTaskStartTime = Long.MAX_VALUE; <END> reduceTaskStartTime = Long.MAX_VALUE; mapTaskEndTime = 0L; reduceTaskEndTime = 0L; finishedMappers = 0; finishedReducers = 0; for (TaskReport report : mapTaskReport) { if (mapTaskEndTime < report.getFinishTime()) mapTaskEndTime = report.getFinishTime(); if (report.getStartTime() < mapTaskStartTime) mapTaskStartTime = report.getStartTime(); TIPStatus status = report.getCurrentStatus(); if (status != TIPStatus.PENDING && status != TIPStatus.RUNNING) { finishedMappers++; } } for (TaskReport report : reduceTaskReport) { if (reduceTaskEndTime < report.getFinishTime()) reduceTaskEndTime = report.getFinishTime(); if (report.getStartTime() < reduceTaskStartTime) reduceTaskStartTime = report.getStartTime(); TIPStatus status = report.getCurrentStatus(); if (status != TIPStatus.PENDING && status != TIPStatus.RUNNING) { finishedReducers++; } } }</code><technical_language>{{0L}} for initial / default of map/reduceTaskStartTime here? If {{reduceTaskReport}} is empty {{reduceTaskStartTime}} {{Long.MAX_VALUE}}, odd default</technical_language>

Target:
public MapReduceJobState(RunningJob runningJob, TaskReport[] mapTaskReport, TaskReport[] reduceTaskReport) throws IOException { jobId = runningJob.getID().toString(); jobName = runningJob.getJobName(); trackingURL = runningJob.getTrackingURL(); isComplete = runningJob.isComplete(); isSuccessful = runningJob.isSuccessful(); mapProgress = runningJob.mapProgress(); reduceProgress = runningJob.reduceProgress(); totalMappers = mapTaskReport.length; totalReducers = reduceTaskReport.length; for (TaskReport report : mapTaskReport) { if (report.getStartTime() < jobStartTime || jobStartTime == 0L) { jobStartTime = report.getStartTime(); } TIPStatus status = report.getCurrentStatus(); if (status != TIPStatus.PENDING && status != TIPStatus.RUNNING) { finishedMappersCount++; } } for (TaskReport report : reduceTaskReport) { if (jobLastUpdateTime < report.getFinishTime()) { jobLastUpdateTime = report.getFinishTime(); } TIPStatus status = report.getCurrentStatus(); if (status != TIPStatus.PENDING && status != TIPStatus.RUNNING) { finishedReducersCount++; } } if (finishedReducersCount != reduceTaskReport.length || jobLastUpdateTime == 0) { jobLastUpdateTime = System.currentTimeMillis(); } }
Source:
<code>public Object visit(NativeFilter nativeFilter, Object extraData) { <START> throw new UnsupportedOperationException("Native filter is not supported"); <END> }</code><technical_language>similar default method offers? it, throw exception stating native filters encodable in XML (this is visitor doing, prepare filters for XML encoding)</technical_language>

Target:
public Object visit(NativeFilter nativeFilter, Object extraData) { throw new UnsupportedOperationException("XML encoding of native filters is not supported."); }
Source:
<code>public String shortenUrl(String url, int expireInSeconds) { Preconditions.checkNotNull(url); String token = getToken(); CacheKey cacheKey = CacheKey.shortenUrl(token); String foundValue = cacheProvider.getObject(cacheKey, String.class); while(foundValue != null && !foundValue.equals(url)) { token = getToken(); cacheKey = CacheKey.shortenUrl(token); foundValue = cacheProvider.getObject(cacheKey, String.class); <START> } <END> if (foundValue == null) { cacheProvider.setObject(cacheKey, url, expireInSeconds); } return WEBSERVICES_URL + "/r/" + token; }</code><technical_language>Minor: a do-while loop better, repeat code twice</technical_language>

Target:
public String shortenUrl(String url, int expireInSeconds) { Preconditions.checkNotNull(url); String token = null; CacheKey cacheKey = null; String foundValue = null; do { token = getToken(); cacheKey = CacheKey.shortenUrl(token); foundValue = cacheProvider.getObject(cacheKey, String.class); } while(foundValue != null && !foundValue.equals(url)); if (foundValue == null) { cacheProvider.setObject(cacheKey, url, expireInSeconds); } return WEBSERVICES_URL + "/r/" + token; }
Source:
<code>@Override public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) { QuickAssistAssistant quickAssistAssistant = new QuickAssistAssistant(); List<IQuickAssistProcessor> quickAssistProcessors = new ArrayList<IQuickAssistProcessor>(); quickAssistProcessors.add(new MarkerResoltionQuickAssistProcessor()); <START> ExtensionBasedQuickAssistProcessor compQuickAssistProcessor = new ExtensionBasedQuickAssistProcessor(quickAssistProcessors); <END> quickAssistAssistant.setQuickAssistProcessor(compQuickAssistProcessor); quickAssistAssistant.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); quickAssistAssistant.setInformationControlCreator(parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString())); return quickAssistAssistant; }</code><technical_language>This replaced like, for content assist for instance quickAssistProcessors.addAll(GenericEditorPlugin.getDefault().getContentAssistProcessorRegistry().getQuickAssistProcessors(...))</technical_language>

Target:
@Override public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) { QuickAssistAssistant quickAssistAssistant = new QuickAssistAssistant(); List<IQuickAssistProcessor> quickAssistProcessors = new ArrayList<IQuickAssistProcessor>(); quickAssistProcessors.add(new MarkerResoltionQuickAssistProcessor()); quickAssistProcessors.addAll(GenericEditorPlugin.getDefault().getQuickAssistProcessorRegistry().getQuickAssistProcessors()); CompositeQuickAssistProcessor compQuickAssistProcessor = new CompositeQuickAssistProcessor(quickAssistProcessors); quickAssistAssistant.setQuickAssistProcessor(compQuickAssistProcessor); quickAssistAssistant.setRestoreCompletionProposalSize(EditorsPlugin.getDefault().getDialogSettingsSection("quick_assist_proposal_size")); quickAssistAssistant.setInformationControlCreator(parent -> new DefaultInformationControl(parent, EditorsPlugin.getAdditionalInfoAffordanceString())); return quickAssistAssistant; }
Source:
<code>public void trackVideoSpeed(String videoId, Double currentTime, String courseId, <START> String unitUrl, float oldSpeed, float newSpeed) { <END> }</code><technical_language>implemented this function</technical_language>

Target:
public void trackVideoSpeed(String videoId, Double currentTime, String courseId, String unitUrl, float oldSpeed, float newSpeed) { final FirebaseEvent event = new FirebaseEvent(Events.SPEED_CHANGE_VIDEO, videoId, Values.VIDEO_PLAYBACK_SPEED_CHANGED, currentTime); event.setCourseContext(courseId, unitUrl, Values.VIDEOPLAYER); event.putFloat(Keys.NEW_SPEED, newSpeed); event.putFloat(Keys.OLD_SPEED, oldSpeed); logFirebaseEvent(event.getName(), event.getBundle()); }
Source:
<code>private CompletionStage<Boolean> doPassivate(Object key, InternalCacheEntry<?, ?> entry) { if (trace) log.tracef("Passivating entry %s", toStr(key)); <START> MarshallableEntry marshalledEntry = marshalledEntryFactory.create((InternalCacheEntry) entry); <END> CompletionStage<Void> stage = passivationPersistenceManager.passivate(marshalledEntry, keyPartitioner.getSegment(key)); return stage.handle((v, t) -> { if (t != null) { CONTAINER.unableToPassivateEntry(key, t); return false; } if (statsEnabled) { passivations.getAndIncrement(); } return true; }); }</code><technical_language>Unnecessary cast InternalCacheEntry MarshallableEntry<?, ?></technical_language>

Target:
private CompletionStage<Boolean> doPassivate(Object key, InternalCacheEntry<?, ?> entry) { if (trace) log.tracef("Passivating entry %s", toStr(key)); MarshallableEntry<?, ?> marshalledEntry = marshalledEntryFactory.create((InternalCacheEntry) entry); CompletionStage<Void> stage = passivationPersistenceManager.passivate(marshalledEntry, keyPartitioner.getSegment(key)); return stage.handle((v, t) -> { if (t != null) { CONTAINER.unableToPassivateEntry(key, t); return false; } if (statsEnabled) { passivations.getAndIncrement(); } return true; }); }
Source:
<code>public final void collectExistingBucket(LeafBucketCollector subCollector, int doc, long bucketOrd) throws IOException { <START> if (doc == 1) { <END> breaker.addEstimateBytesAndMaybeBreak(0, "allocated_buckets"); } docCounts.increment(bucketOrd, 1); subCollector.collect(doc, bucketOrd); }</code><technical_language>Hm, I this right. doc is doc ID, place, bucket. I options here: 1. below, do if (docCounts.increment(bucketOrd, 1) == 1) { <breaker stuff> } I work increment method returns count incrementing. if a doc count of 1, doc a new bucket account 2. Alternatively, account for in collectBucket a conditional, theoretically called new buckets. guaranteed API in practice aggs it. other issues need address though: 1. breaker logic checked 1024 buckets, checking real-memory breaker a amount of overhead. re-implement 2. Trickier situation I suggesting BucketsAggregator... if add 1024 threshold back, a local count aggs 1023 buckets trigger breaker if query millions of buckets. continue MultiBucketConsumer service thing, move breaker accounting a method? maintain global count BucketsAggregator calls a method something? sure, discuss more offline</technical_language>

Target:
public final void collectExistingBucket(LeafBucketCollector subCollector, int doc, long bucketOrd) throws IOException { if (docCounts.increment(bucketOrd, 1) == 1) { multiBucketConsumer.accept(0); } subCollector.collect(doc, bucketOrd); }
Source:
<code>public void getAllChannelsShouldReturnThreeElementListWhenThereAreThreeChannels() { given(channelRepository.findAll()).willReturn(expectedChannelEntityList); given(modelMapper.map(expectedChannelEntityList, CHANNEL_DTO_LIST_TYPE)) .willReturn(expectedChannelDTOList); Collection<ChannelDTO> result = channelService.getAllChannels(); assertEquals(result, expectedChannelDTOList); <START> then(channelRepository).should(times(1)).findAll(); <END> }</code><technical_language>modelMapper invocation is verified</technical_language>

Target:
public void getAllChannelsShouldReturnThreeElementListWhenThereAreThreeChannels() { given(channelRepository.findAll()).willReturn(expectedChannelEntityList); given(modelMapper.map(expectedChannelEntityList, CHANNEL_DTO_LIST_TYPE)) .willReturn(expectedChannelDTOList); Collection<ChannelDTO> result = channelService.getAllChannels(); assertEquals(result, expectedChannelDTOList); then(channelRepository).should().findAll(); then(modelMapper).should().map(expectedChannelEntityList, CHANNEL_DTO_LIST_TYPE); }
Source:
<code>private Map<String, Map<String, DataColumn>> generateTableMetaData() { <START> int i = 1; <END> Map<String, Map<String, DataColumn>> metaData = new HashMap<>(); HashMap<String, DataColumn> column = new HashMap<>(); for (String tableName : this.tableList) { DBCollection readResult = jongo.getDatabase().getCollection(tableName); Iterator<DBObject> cursor = readResult.find(); while (cursor.hasNext()) { final DBObject current = cursor.next(); String tempValue = current.toString(); Iterator<?> keys = new JSONObject(tempValue).keys(); while (keys.hasNext()) { String columnName = (String) keys.next(); DataColumn dataColumn = new DataColumn(columnName, DataColumn.ODataDataType.STRING, i, true, 100, columnName.equals(DOCUMENT_ID)); column.put(columnName, dataColumn); i++; } metaData.put(tableName, column); } } return metaData; }</code><technical_language>set a meaningful name</technical_language>

Target:
private Map<String, Map<String, DataColumn>> generateTableMetaData() { int ordinalPosition = 1; Map<String, Map<String, DataColumn>> metaData = new HashMap<>(); HashMap<String, DataColumn> column = new HashMap<>(); for (String tableName : this.tableList) { DBCollection readResult = jongo.getDatabase().getCollection(tableName); Iterator<DBObject> cursor = readResult.find(); while (cursor.hasNext()) { DBObject doumentData = cursor.next(); String tempValue = doumentData.toString(); Iterator<?> keys = new JSONObject(tempValue).keys(); while (keys.hasNext()) { String columnName = (String) keys.next(); DataColumn dataColumn = new DataColumn(columnName, DataColumn.ODataDataType.STRING, ordinalPosition, true, 100, columnName.equals(DOCUMENT_ID)); column.put(columnName, dataColumn); ordinalPosition++; } metaData.put(tableName, column); } } return metaData; }
Source:
<code>public List<Capabilities> getSupportedCapabilities() { <START> return Collections.unmodifiableList(Arrays.asList(Capabilities.values())); <END> }</code><technical_language>copyOf necessarilly copy (I name is misleading). readability, version is more redable new. Finnaly prefer relying guava's collection. I disagree this commit</technical_language>

Target:
public List<Capabilities> getSupportedCapabilities() { return ImmutableList.copyOf(Capabilities.values()); }
Source:
<code>private void displayReplyDetail(Optional<Replay> replay, String url) { if (!replay.isPresent()) { <START> logger.warn("Replay with url: " + url + "could not be found"); <END> return; } replayDetailController = uiService.loadFxml("theme/vault/replay/replay_detail.fxml"); replayDetailController.setReplay(replay.get()); Node replayDetailRoot = replayDetailController.getRoot(); replayDetailRoot.setVisible(true); replayDetailRoot.requestFocus(); Stage stage = new Stage(StageStyle.UNDECORATED); WindowController windowController = uiService.loadFxml("theme/window.fxml"); windowController.configure(stage, (Region) ((AnchorPane) replayDetailRoot).getChildren().get(0), true); replayDetailController.setOnClosure(stage::close); stage.setWidth(((Region) replayDetailRoot).getWidth()); stage.setHeight(((Region) replayDetailRoot).getHeight()); Stage mainStage = StageHolder.getStage(); stage.setX(mainStage.getX()); stage.setY(mainStage.getY()); stage.show(); }</code><technical_language>logger placeholders</technical_language>

Target:
private void displayReplyDetail(Optional<Replay> replay, String url) { if (!replay.isPresent()) { logger.warn("Replay with url: could not be found", url); return; } replayDetailController = uiService.loadFxml("theme/vault/replay/replay_detail.fxml"); replayDetailController.setReplay(replay.get()); Node replayDetailRoot = replayDetailController.getRoot(); replayDetailRoot.setVisible(true); replayDetailRoot.requestFocus(); Stage stage = new Stage(StageStyle.UNDECORATED); WindowController windowController = uiService.loadFxml("theme/window.fxml"); windowController.configure(stage, (Region) ((AnchorPane) replayDetailRoot).getChildren().get(0), true); replayDetailController.setOnClosure(stage::close); stage.setWidth(((Region) replayDetailRoot).getWidth()); stage.setHeight(((Region) replayDetailRoot).getHeight()); Stage mainStage = StageHolder.getStage(); stage.setX(mainStage.getX()); stage.setY(mainStage.getY()); stage.show(); }
Source:
<code>public List<String> filePaths(PatchSet ps) throws OrmException { if <START> (!files.containsKey(Integer.valueOf(ps.getPatchSetId()))) <END> { Change c = change(); if (c == null) { return null; } PatchList p; try { p = patchListCache.get(c, ps); } catch (PatchListNotAvailableException e) { List<String> emptyFileList = Collections.emptyList(); files.put(Integer.valueOf(ps.getPatchSetId()), emptyFileList); return emptyFileList; } List<String> r = new ArrayList<String>(p.getPatches().size()); for (PatchListEntry e : p.getPatches()) { if (Patch.COMMIT_MSG.equals(e.getNewName())) { continue; } switch (e.getChangeType()) { case ADDED: case MODIFIED: case DELETED: case COPIED: case REWRITE: r.add(e.getNewName()); break; case RENAMED: r.add(e.getOldName()); r.add(e.getNewName()); break; } } Collections.sort(r); files.put(Integer.valueOf(ps.getPatchSetId()), Collections.unmodifiableList(r)); } return files.get(Integer.valueOf(ps.getPatchSetId())); }</code><technical_language>Rely auto-boxing instead</technical_language>

Target:
public List<String> filePaths(PatchSet ps) throws OrmException { if (!files.containsKey(ps.getPatchSetId())) { Change c = change(); if (c == null) { return null; } PatchList p; try { p = patchListCache.get(c, ps); } catch (PatchListNotAvailableException e) { List<String> emptyFileList = Collections.emptyList(); files.put(ps.getPatchSetId(), emptyFileList); return emptyFileList; } List<String> r = new ArrayList<String>(p.getPatches().size()); for (PatchListEntry e : p.getPatches()) { if (Patch.COMMIT_MSG.equals(e.getNewName())) { continue; } switch (e.getChangeType()) { case ADDED: case MODIFIED: case DELETED: case COPIED: case REWRITE: r.add(e.getNewName()); break; case RENAMED: r.add(e.getOldName()); r.add(e.getNewName()); break; } } Collections.sort(r); files.put(ps.getPatchSetId(), Collections.unmodifiableList(r)); } return files.get(ps.getPatchSetId()); }
Source:
<code>static SwapTrade parse(CsvRow row, TradeInfo info) { List<FloatingRateIndex> indices = new ArrayList<>(); Set<DayCount> dayCounts = new LinkedHashSet<>(); boolean missingDayCount = false; String legPrefix = "Leg 1 "; Optional<String> payReceiveOpt = Optional.of(getValue(row, legPrefix, DIRECTION_FIELD)); int i = 1; while (payReceiveOpt.isPresent()) { FloatingRateIndex index = parseIndex(row, legPrefix); if (index != null) { <START> indices.add(index); <END> dayCounts.add(index.getDefaultFixedLegDayCount()); } else { indices.add(null); if (!findValue(row, legPrefix, DAY_COUNT_FIELD).isPresent()) { missingDayCount = true; } } i++; legPrefix = "Leg " + i + " "; payReceiveOpt = findValue(row, legPrefix, DIRECTION_FIELD); } DayCount defaultFixedLegDayCount = null; if (missingDayCount) { if (dayCounts.size() > 1) { throw new IllegalArgumentException( "Swap leg must define day count on fixed legs when more than 2 floating legs"); } defaultFixedLegDayCount = dayCounts.iterator().next(); } List<SwapLeg> legs = parseLegs(row, indices, defaultFixedLegDayCount); Swap swap = Swap.of(legs); return SwapTrade.of(info, swap); }</code><technical_language>indices.add(index) if loop here; add null for fixed rate</technical_language>

Target:
static SwapTrade parse(CsvRow row, TradeInfo info) { List<FloatingRateIndex> indices = new ArrayList<>(); Set<DayCount> dayCounts = new LinkedHashSet<>(); boolean missingDayCount = false; String legPrefix = "Leg 1 "; Optional<String> payReceiveOpt = Optional.of(getValue(row, legPrefix, DIRECTION_FIELD)); int i = 1; while (payReceiveOpt.isPresent()) { FloatingRateIndex index = parseIndex(row, legPrefix); indices.add(index); if (index != null) { dayCounts.add(index.getDefaultFixedLegDayCount()); } if (index == null && !findValue(row, legPrefix, DAY_COUNT_FIELD).isPresent()) { missingDayCount = true; } i++; legPrefix = "Leg " + i + " "; payReceiveOpt = findValue(row, legPrefix, DIRECTION_FIELD); } DayCount defaultFixedLegDayCount = null; if (missingDayCount) { if (dayCounts.size() != 1) { throw new IllegalArgumentException("Invalid swap definition, day count must be defined on each fixed leg"); } defaultFixedLegDayCount = Iterables.getOnlyElement(dayCounts); } List<SwapLeg> legs = parseLegs(row, indices, defaultFixedLegDayCount); Swap swap = Swap.of(legs); return SwapTrade.of(info, swap); }
Source:
<code>private void executeTask(Task task, Multimap<NodeType, NodeId> allNodes, NodeContext nodeContext) throws TerminateException { log.debug("Distributing task {}", task); @SuppressWarnings("unchecked") TaskDistributor<Task> taskDistributor = (TaskDistributor<Task>) distributorRegistry.getTaskDistributor(task.getClass()); <START> DistributionListener decisionMakerListener = new DecisionMakerDistributionListener(nodeContext); <END> Map<NodeId, RemoteExecutor> remotes = Maps.newHashMap(); log.debug("Distributed task will be executed on nodes", remotes.size()); String taskId = taskIdProvider.getTaskId(); Service distribute = taskDistributor.distribute(executor, sessionIdProvider.getSessionId(), taskId, allNodes, coordinator, task, distributionListener(decisionMakerListener), nodeContext); try{ Future<Service.State> start; synchronized (terminateConfigurationLock) { distributes.put(distribute, null); start = distribute.start(); } Futures.get(start, timeoutConfiguration.getDistributionStartTime()); Services.awaitTermination(distribute, timeoutConfiguration.getTaskExecutionTime().getValue()); } finally { Future<Service.State> stop = distribute.stop(); Futures.get(stop, timeoutConfiguration.getDistributionStopTime()); } }</code><technical_language>move this object distributionListener() method</technical_language>

Target:
private void executeTask(Task task, Multimap<NodeType, NodeId> allNodes, NodeContext nodeContext) throws TerminateException { log.debug("Distributing task {}", task); @SuppressWarnings("unchecked") TaskDistributor<Task> taskDistributor = (TaskDistributor<Task>) distributorRegistry.getTaskDistributor(task.getClass()); Map<NodeId, RemoteExecutor> remotes = Maps.newHashMap(); log.debug("Distributed task will be executed on nodes", remotes.size()); String taskId = taskIdProvider.getTaskId(); Service distribute = taskDistributor.distribute(executor, sessionIdProvider.getSessionId(), taskId, allNodes, coordinator, task, distributionListener(nodeContext), nodeContext); try{ Future<Service.State> start; synchronized (terminateConfigurationLock) { distributes.put(distribute, null); start = distribute.start(); } Futures.get(start, timeoutConfiguration.getDistributionStartTime()); Services.awaitTermination(distribute, timeoutConfiguration.getTaskExecutionTime().getValue()); } finally { Future<Service.State> stop = distribute.stop(); Futures.get(stop, timeoutConfiguration.getDistributionStopTime()); } }
Source:
<code>public void getDescriptionWithAnnotation() { JUnit38ClassRunner runner = new JUnit38ClassRunner(JUnit3ClassWithAnnotatedMethod.class); Description d = runner.getDescription(); <START> Assert.assertEquals(2, d.testCount()); <END> for (Description methodDesc : d.getChildren()) { if (methodDesc.getMethodName().equals("testAnnotated")) { assertNotNull(methodDesc.getAnnotation(MyAnnotation.class)); } else { assertNull( methodDesc.getAnnotation(MyAnnotation.class)); } } }</code><technical_language>nit: please a static import for assertEquals</technical_language>

Target:
public void getDescriptionWithAnnotation() { JUnit38ClassRunner runner = new JUnit38ClassRunner(JUnit3ClassWithAnnotatedMethod.class); Description d = runner.getDescription(); assertEquals(2, d.testCount()); for (Description methodDesc : d.getChildren()) { if (methodDesc.getMethodName().equals("testAnnotated")) { assertNotNull(methodDesc.getAnnotation(MyAnnotation.class)); } else { assertNull(methodDesc.getAnnotation(MyAnnotation.class)); } } }
Source:
<code>void unsubscribe() { <START> eventService.subscribe(this); <END> }</code><technical_language>unsubscribe</technical_language>

Target:
void unsubscribe() { eventService.unsubscribe(this); }
Source:
<code>public void testPointFromTextNegative() throws Exception { Client client = getClient(); validateTableOfScalarLongs(client, "insert into t (pk) values (0)", new long[] {1}); assertSelectGeographyPointValueWktParseError(client, "expected input of the form 'POINT\\(<lng> <lat>\\)", "point(20.0)"); assertSelectGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(10 100)"); assertInsertGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(10 100)", 100); assertSelectGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(20 -100)"); assertInsertGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(20 -100)", 101); assertSelectGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(200 20)"); assertInsertGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(200 20)", 200); assertSelectGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(-200 20)"); <START> assertInsertGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(-200 20)", 201); <END> }</code><technical_language>I check boundary values too... 90.0, -90.0 valid latitudes 180.0, -180.0 valid longitudes</technical_language>

Target:
public void testPointFromTextNegative() throws Exception { Client client = getClient(); for (String tbl : TABLES) { fillTable(client, tbl, 0); } assertSelectGeographyPointValueWktParseError(client, "expected input of the form 'POINT\\(<lng> <lat>\\)", "point(20.0)"); assertSelectGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(10 100)"); assertInsertGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(10 100)", 100); assertSelectGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(20 -100)"); assertInsertGeographyPointValueWktParseError(client, "Latitude must be in the range", "point(20 -100)", 101); assertSelectGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(200 20)"); assertInsertGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(200 20)", 200); assertSelectGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(-200 20)"); assertInsertGeographyPointValueWktParseError(client, "Longitude must be in the range", "point(-200 20)", 201); }
Source:
<code>public void setUp() throws IOException { Assume.assumeTrue(new MercurialRepository().isWorking()); Assume.assumeTrue(new SubversionRepository().isWorking()); <START> Assume.assumeTrue(new GitRepository().isWorking()); <END> repository = new TestRepository(); repository.create(HistoryGuru.class.getResourceAsStream( "repositories.zip")); env = RuntimeEnvironment.getInstance(); env.removeAllMessages(); env.setSourceRoot(repository.getSourceRoot()); env.setDataRoot(repository.getDataRoot()); env.setProjectsEnabled(true); RepositoryFactory.initializeIgnoredNames(env); }</code><technical_language>I I included repeateable conditional rule for this, try it</technical_language>

Target:
public void setUp() throws IOException { repository = new TestRepository(); repository.create(HistoryGuru.class.getResourceAsStream( "repositories.zip")); env = RuntimeEnvironment.getInstance(); env.removeAllMessages(); env.setSourceRoot(repository.getSourceRoot()); env.setDataRoot(repository.getDataRoot()); env.setProjectsEnabled(true); RepositoryFactory.initializeIgnoredNames(env); }
Source:
<code>private OsiamConnector(Builder builder) { String authServiceEndpoint = authServiceEndpoint(builder.authServiceEndpoint, builder.combinedEndpoint); <START> if (builder.connectTimeout == null) { <END> builder.connectTimeout = DEFAULT_CONNECT_TIMEOUT; } if (builder.readTimeout == null) { builder.readTimeout = DEFAULT_READ_TIMEOUT; } if (!Strings.isNullOrEmpty(authServiceEndpoint)) { AuthService.Builder authServiceBuilder = new AuthService.Builder(authServiceEndpoint); if (builder.clientId != null) { authServiceBuilder = authServiceBuilder.setClientId(builder.clientId); } if (builder.clientSecret != null) { authServiceBuilder = authServiceBuilder.setClientSecret(builder.clientSecret); } if (builder.clientRedirectUri != null) { authServiceBuilder = authServiceBuilder.setClientRedirectUri(builder.clientRedirectUri); } authServiceBuilder.withConnectTimeout(builder.connectTimeout); authServiceBuilder.withReadTimeout(builder.readTimeout); authService = authServiceBuilder.build(); } String resourceServiceEndpoint = resourceServiceEndpoint(builder.resourceServiceEndpoint, builder.combinedEndpoint); if (!Strings.isNullOrEmpty(resourceServiceEndpoint)) { userService = new OsiamUserService.Builder(resourceServiceEndpoint) .withConnectTimeout(builder.connectTimeout).withReadTimeout(builder.readTimeout).build(); groupService = new OsiamGroupService.Builder(resourceServiceEndpoint) .withConnectTimeout(builder.connectTimeout).withReadTimeout(builder.readTimeout).build(); } }</code><technical_language>uninitialized int values default 0 null</technical_language>

Target:
private OsiamConnector(Builder builder) { String authServiceEndpoint = authServiceEndpoint(builder.authServiceEndpoint, builder.combinedEndpoint); if (!Strings.isNullOrEmpty(authServiceEndpoint)) { AuthService.Builder authServiceBuilder = new AuthService.Builder(authServiceEndpoint); if (builder.clientId != null) { authServiceBuilder = authServiceBuilder.setClientId(builder.clientId); } if (builder.clientSecret != null) { authServiceBuilder = authServiceBuilder.setClientSecret(builder.clientSecret); } if (builder.clientRedirectUri != null) { authServiceBuilder = authServiceBuilder.setClientRedirectUri(builder.clientRedirectUri); } authService = authServiceBuilder.withConnectTimeout(builder.connectTimeout) .withReadTimeout(builder.readTimeout).build(); } String resourceServiceEndpoint = resourceServiceEndpoint(builder.resourceServiceEndpoint, builder.combinedEndpoint); if (!Strings.isNullOrEmpty(resourceServiceEndpoint)) { userService = new OsiamUserService.Builder(resourceServiceEndpoint) .withConnectTimeout(builder.connectTimeout).withReadTimeout(builder.readTimeout).build(); groupService = new OsiamGroupService.Builder(resourceServiceEndpoint) .withConnectTimeout(builder.connectTimeout).withReadTimeout(builder.readTimeout).build(); } }
Source:
<code>public Map<String, Map<String, String>> rebalanceTable(Map<String, Map<String, String>> currentAssignment, Map<InstancePartitionsType, InstancePartitions> instancePartitionsMap, @Nullable List<Tier> sortedTiers, @Nullable Map<String, InstancePartitions> tierInstancePartitionsMap, Configuration config) { Map<String, Map<String, String>> newAssignment = new TreeMap<>(); <START> for (String segment : currentAssignment.keySet()) { <END> List<String> assignedInstances = assignSegment(segment, newAssignment, instancePartitionsMap); newAssignment.put(segment, SegmentAssignmentUtils .getInstanceStateMap(assignedInstances, CommonConstants.Helix.StateModel.SegmentStateModel.ONLINE)); } return newAssignment; }</code><technical_language>need assign segment. Fetch instances tag once, construct new assignment</technical_language>

Target:
public Map<String, Map<String, String>> rebalanceTable(Map<String, Map<String, String>> currentAssignment, Map<InstancePartitionsType, InstancePartitions> instancePartitionsMap, @Nullable List<Tier> sortedTiers, @Nullable Map<String, InstancePartitions> tierInstancePartitionsMap, Configuration config) { String serverTag = TagNameUtils.extractOfflineServerTag(_tenantConfig); List<String> instances = HelixHelper.getInstancesWithTag(_helixManager, serverTag); Map<String, Map<String, String>> newAssignment = new TreeMap<>(); for (String segment : currentAssignment.keySet()) { newAssignment.put(segment, SegmentAssignmentUtils .getInstanceStateMap(instances, CommonConstants.Helix.StateModel.SegmentStateModel.ONLINE)); } return newAssignment; }
Source:
<code>protected void onInitialize() { super.onInitialize(); featureLocationModel = Model.of(new LongLat(-72.638382, 42.313181, "EPSG:4326")); Style style = new Style(new Icon("<LINK_0>") .crossOrigin(CorsPolicy.ANONYMOUS)); Feature feature = new PersistentFeature( new Point(featureLocationModel.getObject().transform(View.DEFAULT_PROJECTION)), "Miles Office"); feature.setStyle(style); Vector vectorFeatures = new Vector(new VectorSource(Arrays.asList(feature))); add(featureLocationLabel = new Label("featureLocationLabel", new LoadableDetachableModel<String>() { @Override protected String load() { StringBuilder builder = new StringBuilder(); if(featureLocationModel.getObject() != null) { builder.append(featureLocationModel.getObject().getX()); builder.append(", "); builder.append(featureLocationModel.getObject().getY()); } else { <START> builder.append("Unkown..."); <END> } return builder.toString(); } })); featureLocationLabel.setOutputMarkupId(true); add(map = new DefaultOpenLayersMap("map", Model.of(new Map( Arrays.<Layer>asList( new Tile("Streets", new Osm()), vectorFeatures), new View( new LongLat(-72.638382, 42.313181, "EPSG:4326").transform(View.DEFAULT_PROJECTION), 16)) .interactions(Arrays.<Interaction>asList(new Modify(vectorFeatures)))))); map.add(new FeatureChangeListener(feature) { @Override public void handleChange(AjaxRequestTarget target, String featureId, LongLat longLat, JsonObject properties) { featureLocationModel.setObject(longLat); target.add(featureLocationLabel); } }); }</code><technical_language>typo</technical_language>

Target:
protected void onInitialize() { super.onInitialize(); featureLocationModel = Model.of(new LongLat(-72.638382, 42.313181, "EPSG:4326")); Style style = new Style(new Icon("<LINK_0>") .crossOrigin(CorsPolicy.ANONYMOUS)); Feature feature = new PersistentFeature( new Point(featureLocationModel.getObject().transform(View.DEFAULT_PROJECTION)), "Miles Office"); feature.setStyle(style); Vector vectorFeatures = new Vector(new VectorSource(Arrays.asList(feature))); add(featureLocationLabel = new Label("featureLocationLabel", new LoadableDetachableModel<String>() { @Override protected String load() { StringBuilder builder = new StringBuilder(); if(featureLocationModel.getObject() != null) { builder.append(featureLocationModel.getObject().getX()); builder.append(", "); builder.append(featureLocationModel.getObject().getY()); } else { builder.append("Unknown..."); } return builder.toString(); } })); featureLocationLabel.setOutputMarkupId(true); add(map = new DefaultOpenLayersMap("map", Model.of(new Map( Arrays.<Layer>asList( new Tile("Streets", new Osm()), vectorFeatures), new View( new LongLat(-72.638382, 42.313181, "EPSG:4326").transform(View.DEFAULT_PROJECTION), 16)) .interactions(Arrays.<Interaction>asList(new Modify(vectorFeatures)))))); map.add(new FeatureChangeListener(feature) { @Override public void handleChange(AjaxRequestTarget target, String featureId, LongLat longLat, JsonObject properties) { featureLocationModel.setObject(longLat); target.add(featureLocationLabel); } }); }
Source:
<code>public HllSketchMergeBufferAggregator( final ColumnValueSelector<HllSketch> selector, final int lgK, final TgtHllType tgtHllType, final int size ) { this.selector = selector; this.lgK = lgK; this.tgtHllType = tgtHllType; this.size = size; this.emptySketch = new byte[size]; <START> new Union(lgK, WritableMemory.wrap(emptySketch, ByteOrder.LITTLE_ENDIAN).writableRegion(0, size)); <END> }</code><technical_language>need call writableRegion region is identical</technical_language>

Target:
public HllSketchMergeBufferAggregator( final ColumnValueSelector<HllSketch> selector, final int lgK, final TgtHllType tgtHllType, final int size ) { this.selector = selector; this.lgK = lgK; this.tgtHllType = tgtHllType; this.size = size; this.emptyUnion = new byte[size]; new Union(lgK, WritableMemory.wrap(emptyUnion)); }
Source:
<code>private IjFolder mergePromotingToSourceIfDifferent(IjFolder from, IjFolder to) { if (from.getClass().equals(to.getClass())) { return from.merge(to); } if ((from.getClass().equals(JavaResourceFolder.class) && to.getClass().equals(JavaTestResourceFolder.class)) || (to.getClass().equals(JavaResourceFolder.class) && from.getClass().equals(JavaTestResourceFolder.class))) { Path resourcesRoot = (to instanceof JavaResourceFolder) ? ((JavaResourceFolder) to).getResourcesRoot() : ((JavaTestResourceFolder) to).getResourcesRoot(); return new JavaResourceFolder(to.getPath(), IjFolder.combineInputs(from, to), resourcesRoot); } <START> return new SourceFolder( <END> to.getPath(), from.getWantsPackagePrefix() || to.getWantsPackagePrefix(), IjFolder.combineInputs(from, to)); }</code><technical_language>a case java test sources java resource files? merged test sources, regular sources</technical_language>

Target:
private IjFolder mergePromotingToSourceIfDifferent(IjFolder from, IjFolder to) { if (from.getClass().equals(to.getClass())) { return from.merge(to); } if (ResourceFolder.class.isInstance(from) && ResourceFolder.class.isInstance(to)) { Path resourcesRoot = ((ResourceFolder) to).getResourcesRoot(); return new JavaResourceFolder(to.getPath(), resourcesRoot, IjFolder.combineInputs(from, to)); } if ((from.getClass().equals(TestFolder.class) && ResourceFolder.class.isInstance(to)) || (to.getClass().equals(TestFolder.class) && ResourceFolder.class.isInstance(from))) { return new TestFolder( to.getPath(), from.getWantsPackagePrefix() || to.getWantsPackagePrefix(), IjFolder.combineInputs(from, to)); } return new SourceFolder( to.getPath(), from.getWantsPackagePrefix() || to.getWantsPackagePrefix(), IjFolder.combineInputs(from, to)); }
Source:
<code><START> public Response info(@PathParam("date") String date) throws Exception { <END> Instant instant = DateUtil.parseInstant(date); List<BackupMetadata> metadataList = backupStatusMgr.getLatestBackupMetadata( SnapshotMetaService.BACKUP_VERSION, new DateRange( instant, instant.plus(1, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS))); return Response.ok(metadataList.toString(), MediaType.APPLICATION_JSON).build(); }</code><technical_language>nix throw</technical_language>

Target:
public Response info(@PathParam("date") String date) { Instant instant = DateUtil.parseInstant(date); List<BackupMetadata> metadataList = backupStatusMgr.getLatestBackupMetadata( BackupVersion.SNAPSHOT_META_SERVICE, new DateRange( instant, instant.plus(1, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS))); return Response.ok(metadataList).build(); }
Source:
<code>public V get(final K key) throws CacheLoaderException { getObserver.begin(); checkNonNull(key); final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { loaded = cacheLoader.load(k); } } catch (Exception e) { throw newCacheLoaderException(e); } return loaded; } }); try { final Store.ValueHolder<V> valueHolder = store.computeIfAbsent(key, mappingFunction); if (valueHolder == null) { getObserver.end(GetOutcome.MISS_NOT_FOUND); return null; } else { getObserver.end(GetOutcome.HIT); return valueHolder.value(); } } catch (CacheAccessException e) { <START> getObserver.end(GetOutcome.MISS_NOT_FOUND); <END> try { store.remove(key); resilienceStrategy.recoveredFrom(key, e); } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e1, e); } return mappingFunction.apply(key); } }</code><technical_language>I a thrown exception recorded a cache miss event</technical_language>

Target:
public V get(final K key) throws CacheLoaderException { statusTransitioner.checkAvailable(); checkNonNull(key); final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { loaded = cacheLoader.load(k); } } catch (Exception e) { throw newCacheLoaderException(e); } return loaded; } }); try { final Store.ValueHolder<V> valueHolder = store.computeIfAbsent(key, mappingFunction); return valueHolder == null ? null : valueHolder.value(); } catch (CacheAccessException e) { try { store.remove(key); resilienceStrategy.recoveredFrom(key, e); } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e1, e); } return mappingFunction.apply(key); } }
Source:
<code>public void removeAllAppLauncher() { <START> appLauncherItemViews.destroyAll(); <END> }</code><technical_language>OK. fine. destroy re-create AppLauncherItemView based list of AppLauncherAddEvent in AppLauncherPresenter clears leftColumn rightColumn children? I suspect columns duplicated items "app" is removed</technical_language>

Target:
public void removeAllAppLauncher() { appLauncherItemViews.destroyAll(); removeAllNodes(leftColumn); removeAllNodes(rightColumn); }
Source:
<code>private void feedDataToExtractor( DataSource dataSource, DataSpec dataSpec, boolean dataIsEncrypted) throws IOException { DataSpec loadDataSpec; boolean skipLoadedBytes; if (dataIsEncrypted) { loadDataSpec = dataSpec; skipLoadedBytes = nextLoadPosition != 0; } else { loadDataSpec = dataSpec.subrange(nextLoadPosition); skipLoadedBytes = false; } try { ExtractorInput input = prepareExtraction(dataSource, loadDataSpec); if (skipLoadedBytes) { input.skipFully(nextLoadPosition); } try { int result = Extractor.RESULT_CONTINUE; while (result == Extractor.RESULT_CONTINUE && !loadCanceled) { result = extractor.read(input, DUMMY_POSITION_HOLDER); } <START> } catch (UnexpectedDiscontinuityException e) { Log.d(TAG, "UnexpectedDiscontinuityException - recovering by discarding balance of segment", e); throw new IOException("load aborted for segment - " + e.dataSpec + " unexpected discontinuity", e); } finally { <END> nextLoadPosition = (int) (input.getPosition() - dataSpec.position); } } finally { Util.closeQuietly(dataSource); } }</code><technical_language>IOException, avoid needing catch re-throw</technical_language>

Target:
private void feedDataToExtractor( DataSource dataSource, DataSpec dataSpec, boolean dataIsEncrypted) throws IOException { DataSpec loadDataSpec; boolean skipLoadedBytes; if (dataIsEncrypted) { loadDataSpec = dataSpec; skipLoadedBytes = nextLoadPosition != 0; } else { loadDataSpec = dataSpec.subrange(nextLoadPosition); skipLoadedBytes = false; } try { ExtractorInput input = prepareExtraction(dataSource, loadDataSpec); if (skipLoadedBytes) { input.skipFully(nextLoadPosition); } try { int result = Extractor.RESULT_CONTINUE; while (result == Extractor.RESULT_CONTINUE && !loadCanceled) { result = extractor.read(input, DUMMY_POSITION_HOLDER); } } finally { nextLoadPosition = (int) (input.getPosition() - dataSpec.position); } } catch (UnexpectedDiscontinuityException e) { Log.d(TAG, "UnexpectedDiscontinuityException - recovering by discarding balance of segment", e); throw new IOException("load aborted for segment - " + e.dataSpec + " unexpected discontinuity", e); } finally { Util.closeQuietly(dataSource); } }
Source:
<code>public void setUp() throws Exception { doInHibernate( this::sessionFactory, s -> { Post post = new Post(); post.setDetails(new PostDetails()); post.getDetails().setCreatedBy("ME"); post.getDetails().setCreatedOn(new Date()); post.setTitle("title"); s.persist(post); s.flush(); <START> s.clear(); <END> } ); }</code><technical_language>I need flush() clear(). Considering this init is specific test method, I moved test method remove this setUp() altogether</technical_language>

Target:
public void setUp() throws Exception { doInHibernate( this::sessionFactory, s -> { Post post = new Post(); post.setDetails( new PostDetails() ); post.getDetails().setCreatedBy( "ME" ); post.getDetails().setCreatedOn( new Date() ); post.setTitle( "title" ); s.persist( post ); } ); }
Source:
<code>public CreateAccountResponse doSendInvite(String accountEmail, String currentUserEmail, String instructorName) { M_log.debug("Friend doSendInvite() called"); CreateAccountResponse response = CreateAccountResponse.RUNTIME_PROBLEM; int rv = 0; try { HashMap<String, String> map = new HashMap<String,String>(); map.put(INSTRUCTOR_NAME_TAG, instructorName); map.put(CONTACT_EMAIL_TAG, contactEmail); <START> emailMessage = Utils.readFile(friendEmailFile, StandardCharsets.UTF_8); <END> emailMessage = Utils.replacePlaceHolders(emailMessage, map); Object[] params = new Object[]{contactEmail, referrerUrl, emailMessage, new String[]{accountEmail}, currentUserEmail}; Object[] results = (Object[]) Xclient.execute(SEND_INVITES_WS, params); if (results != null && results.length == 1) { rv = ((Integer) results[0]).intValue(); } } catch (Exception e) { M_log.warn("Friend doSendInvite(): email address=" + accountEmail + " " + e.getMessage()); } if(rv == -1){ response = CreateAccountResponse.INVALID_EMAIL; } if(rv == 0){ response = CreateAccountResponse.RUNTIME_PROBLEM; } if(rv == 1){ response = CreateAccountResponse.INVITATION_SUCCESSFULLY_SENT; } return response; }</code><technical_language>is repeated couple of lines a method pass in file name map. method small purpose clearer, code read, figure out is happening</technical_language>

Target:
public CreateAccountResponse doSendInvite(String accountEmail, String currentUserEmail, String instructorName) { M_log.debug("Friend doSendInvite() called"); CreateAccountResponse response = CreateAccountResponse.RUNTIME_PROBLEM; int rv = 0; try { HashMap<String, String> map = new HashMap<String,String>(); map.put(INSTRUCTOR_NAME_TAG, instructorName); map.put(CONTACT_EMAIL_TAG, contactEmail); emailMessage=Utils.readEmailTemplateAndReplacePlaceHolders(map,friendEmailFile); Object[] params = new Object[]{contactEmail, referrerUrl, emailMessage, new String[]{accountEmail}, currentUserEmail}; Object[] results = (Object[]) Xclient.execute(SEND_INVITES_WS, params); if (results != null && results.length == 1) { rv = ((Integer) results[0]).intValue(); } } catch (Exception e) { M_log.warn("Friend doSendInvite(): email address=" + accountEmail + " " + e.getMessage()); } if(rv == -1){ response = CreateAccountResponse.INVALID_EMAIL; } if(rv == 0){ response = CreateAccountResponse.RUNTIME_PROBLEM; } if(rv == 1){ response = CreateAccountResponse.INVITATION_SUCCESSFULLY_SENT; } return response; }
Source:
<code>public void remove(String userName, UserStoreManager userStoreManager) throws IdentityException { Cache<String, UserIdentityClaimsDO> cache = getCache(); if (userName == null) { return; } if (userStoreManager instanceof org.wso2.carbon.user.core.UserStoreManager) { String caseInsensitiveUsername = ((org.wso2.carbon.user.core.UserStoreManager) userStoreManager) <START> .getRealmConfiguration().getUserStoreProperty("CaseInsensitiveUsername"); <END> if (!StringUtils.isBlank(caseInsensitiveUsername) && "true".equalsIgnoreCase(caseInsensitiveUsername.trim ())) { if (log.isDebugEnabled()) { log.debug("Case insensitive user store found. Changing username from : " + userName + " to : " + userName.toLowerCase()); } userName = userName.toLowerCase(); } } org.wso2.carbon.user.core.UserStoreManager store = (org.wso2.carbon.user.core.UserStoreManager) userStoreManager; String domainName = store.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME); cache.remove(domainName + CarbonContext.getThreadLocalCarbonContext().getTenantId() + userName); }</code><technical_language>define CaseInsensitiveUsername in a string constant constant</technical_language>

Target:
public void remove(String userName, UserStoreManager userStoreManager) throws IdentityException { Cache<String, UserIdentityClaimsDO> cache = getCache(); if (userName == null) { return; } if (userStoreManager instanceof org.wso2.carbon.user.core.UserStoreManager) { if (!IdentityUtil.isUserStoreCaseSensitive((org.wso2.carbon.user.core.UserStoreManager) userStoreManager)) { if (log.isDebugEnabled()) { log.debug("Case insensitive user store found. Changing username from : " + userName + " to : " + userName.toLowerCase()); } userName = userName.toLowerCase(); } } org.wso2.carbon.user.core.UserStoreManager store = (org.wso2.carbon.user.core.UserStoreManager) userStoreManager; String domainName = store.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.RealmConfig .PROPERTY_DOMAIN_NAME); cache.remove(domainName + CarbonContext.getThreadLocalCarbonContext().getTenantId() + userName); }