auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { View element = super.getView(position, convertView, parent); PlaylistEntry entry = super.getItem(position); if (!entry.isLoaded()) { element.setBackgroundColor(getResources().getColor(R.color.abs__bright_foreground_disabled_holo_light)); <START> element.findViewById(R.id.progress).setVisibility(View.VISIBLE); <END> } else if (entry.isPlayed()) { element.setBackgroundColor(getResources().getColor(R.color.used)); } else { element.setBackgroundColor(getResources().getColor(com.actionbarsherlock.R.color.abs__background_holo_light)); element.findViewById(R.id.progress).setVisibility(View.INVISIBLE); } final GestureDetectorCompat songGesture = new GestureDetectorCompat(getActivity(), new PlaylistSongGestureListener(element, entry)); element.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return songGesture.onTouchEvent(event); } }); ImageButton delete = (ImageButton)element.findViewById(R.id.btn_remove_from_playlist); delete.setOnClickListener(new DeleteSongListener(entry)); delete.setVisibility(View.VISIBLE); return element; }</code><technical_language>is impression a song is in playlist is currently loaded. i this creates a binary distinction loaded loaded a song loaded ready loaded</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { View element = super.getView(position, convertView, parent); PlaylistEntry entry = super.getItem(position); if (!entry.isLoaded()) { element.setBackgroundColor(getResources().getColor(R.color.abs__bright_foreground_disabled_holo_light)); element.findViewById(R.id.progress).setVisibility(View.VISIBLE); element.findViewById(R.id.now_playing).setVisibility(View.INVISIBLE); } else if (entry.isPlayed()) { element.setBackgroundColor(getResources().getColor(R.color.used)); element.findViewById(R.id.now_playing).setVisibility(View.INVISIBLE); } else { element.setBackgroundColor(getResources().getColor(com.actionbarsherlock.R.color.abs__background_holo_light)); element.findViewById(R.id.progress).setVisibility(View.INVISIBLE); if(entry.equals(getPlaylistService().getCurrentEntry())){ element.findViewById(R.id.now_playing).setVisibility(View.VISIBLE); } else{ element.findViewById(R.id.now_playing).setVisibility(View.INVISIBLE); } } final GestureDetectorCompat songGesture = new GestureDetectorCompat(getActivity(), new PlaylistSongGestureListener(element, entry)); element.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return songGesture.onTouchEvent(event); } }); return element; }
Source:
<code>public void toStream(@NonNull JsonStream writer) throws IOException { writer.beginObject(); writer.name("osName").value("android"); writer.name("manufacturer").value(android.os.Build.MANUFACTURER); writer.name("brand").value(android.os.Build.BRAND); writer.name("model").value(android.os.Build.MODEL); writer.name("id").value(id); writer.name("apiLevel").value(android.os.Build.VERSION.SDK_INT); writer.name("osVersion").value(android.os.Build.VERSION.RELEASE); writer.name("osBuild").value(android.os.Build.DISPLAY); writer.name("locale").value(locale); writer.name("totalMemory").value(totalMemory); writer.name("jailbroken").value(rooted); writer.name("screenDensity").value(screenDensity); writer.name("dpi").value(dpi); writer.name("screenResolution").value(screenResolution); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { writer.name("cpuAbi").value(Arrays.toString(Build.SUPPORTED_ABIS)); } else { <START> writer.name("cpuAbi").value(Build.CPU_ABI); <END> } writer.endObject(); }</code><technical_language>This include Build.CPU_ABI2</technical_language>

Target:
public void toStream(@NonNull JsonStream writer) throws IOException { writer.beginObject(); writer.name("osName").value("android"); writer.name("manufacturer").value(android.os.Build.MANUFACTURER); writer.name("brand").value(android.os.Build.BRAND); writer.name("model").value(android.os.Build.MODEL); writer.name("id").value(id); writer.name("apiLevel").value(android.os.Build.VERSION.SDK_INT); writer.name("osVersion").value(android.os.Build.VERSION.RELEASE); writer.name("osBuild").value(android.os.Build.DISPLAY); writer.name("locale").value(locale); writer.name("totalMemory").value(totalMemory); writer.name("jailbroken").value(rooted); writer.name("screenDensity").value(screenDensity); writer.name("dpi").value(dpi); writer.name("screenResolution").value(screenResolution); String cpuAbi = Build.CPU_ABI; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { cpuAbi = Arrays.toString(Build.SUPPORTED_ABIS); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { cpuAbi = Arrays.toString(new String[]{Build.CPU_ABI,Build.CPU_ABI2}); } writer.name("cpuAbi").value(cpuAbi); writer.endObject(); }
Source:
<code>public static void main(final String[] args) throws Exception { <START> LoggerUtil.addAppender("apexclient"); <END> final ApexCli shell = new ApexCli(); shell.preImpersonationInit(args); String hadoopUserName = System.getenv("HADOOP_USER_NAME"); if (UserGroupInformation.isSecurityEnabled() && StringUtils.isNotBlank(hadoopUserName) && !hadoopUserName.equals(UserGroupInformation.getLoginUser().getUserName())) { LOG.info("You ({}) are running as user {}", UserGroupInformation.getLoginUser().getUserName(), hadoopUserName); UserGroupInformation ugi = UserGroupInformation.createProxyUser(hadoopUserName, UserGroupInformation.getLoginUser()); ugi.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { shell.mainHelper(); return null; } }); } else { shell.mainHelper(); } }</code><technical_language>LOGGER_APPENDER property set for apex client</technical_language>

Target:
public static void main(final String[] args) throws Exception { LoggerUtil.addAppenders(); final ApexCli shell = new ApexCli(); shell.preImpersonationInit(args); String hadoopUserName = System.getenv("HADOOP_USER_NAME"); if (UserGroupInformation.isSecurityEnabled() && StringUtils.isNotBlank(hadoopUserName) && !hadoopUserName.equals(UserGroupInformation.getLoginUser().getUserName())) { LOG.info("You ({}) are running as user {}", UserGroupInformation.getLoginUser().getUserName(), hadoopUserName); UserGroupInformation ugi = UserGroupInformation.createProxyUser(hadoopUserName, UserGroupInformation.getLoginUser()); ugi.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { shell.mainHelper(); return null; } }); } else { shell.mainHelper(); } }
Source:
<code>public ObjStoreBrowserImpl(ObjStoreBrowser osb) { try { <START> printStream = new PrintStream(System.out, true, "UTF-8"); <END> } catch (UnsupportedEncodingException e) { throw new AssertionError("UTF-8 is not supported"); } this.osb = osb; }</code><technical_language>StandardCharsets.UTF_8</technical_language>

Target:
public ObjStoreBrowserImpl(ObjStoreBrowser osb) { try { printStream = new PrintStream(System.out, true, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { System.err.println("Encoding " + StandardCharsets.UTF_8.name() + " is not supported"); throw new IllegalStateException(StandardCharsets.UTF_8.name() + " is not supported"); } this.osb = osb; }
Source:
<code>public void setStarred(TaskRepository taskRepository, String taskID, boolean starred) throws CoreException { GerritClient client = getClient(taskRepository); SaveStarredRequest saveStarRequest = new SaveStarredRequest(taskRepository, taskID, starred); try { client.setStarred(saveStarRequest.getReviewId(), starred, null); } catch (GerritException e) { Status status = new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, <START> "Unable to set the starred, received", e); END> throw new CoreException(status); } }</code><technical_language>"received" here? Please rephrase message</technical_language>

Target:
public void setStarred(TaskRepository taskRepository, String taskID, boolean starred) throws CoreException { GerritClient client = getClient(taskRepository); SaveStarredRequest saveStarRequest = new SaveStarredRequest(taskRepository, taskID, starred); try { client.setStarred(saveStarRequest.getReviewId(), starred, null); } catch (GerritException e) { Status status = new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Unable to set the starred flag, the following Status is received", e); throw new CoreException(status); } }
Source:
<code>private static SortedMap<String, List<String>> asMap(final String query) { final SortedMap<String, List<String>> params = new TreeMap<String, List<String>>(); if (query != null) { <START> final String[] pairs = query.split("&"); <END> for (final String pair : pairs) { final String[] parts = pair.split("=", 2); final String key = Href.decode(parts[0]); final String value; if (parts.length > 1) { value = Href.decode(parts[1]); } else { value = ""; } if (!params.containsKey(key)) { params.put(key, new LinkedList<String>()); } params.get(key).add(value); } } return params; }</code><technical_language>@essobedo variable inline</technical_language>

Target:
private static SortedMap<String, List<String>> asMap(final String query) { final SortedMap<String, List<String>> params = new TreeMap<>(); if (query != null) { for (final String pair : query.split("&")) { final String[] parts = pair.split("=", 2); final String key = Href.decode(parts[0]); final String value; if (parts.length > 1) { value = Href.decode(parts[1]); } else { value = ""; } if (!params.containsKey(key)) { params.put(key, new LinkedList<String>()); } params.get(key).add(value); } } return params; }
Source:
<code>public boolean isDown() { boolean down = false; if (hardDown) { down = true; } else if (failureCount.get() >= failureCountThreshold) { if (SystemTime.getInstance().milliseconds() < downUntil.get()) { down = true; } } logger.trace("Resource is {}; failureCount: {}; failureCountThreshold: {}; remaining time: {}; hard down: {}", resource, (down ? "down" : "not down"), failureCount.get(), failureCountThreshold, <START> (downUntil.get() - SystemTime.getInstance().milliseconds()), hardDown); <END> return down; }</code><technical_language>remaining time sense if state is down. In case downUntil in this print a negative, misleading value</technical_language>

Target:
public boolean isDown() { boolean down = false; if (hardDown) { down = true; } else if (failureCount.get() >= failureCountThreshold) { if (SystemTime.getInstance().milliseconds() < downUntil.get()) { down = true; } } if (down) { logger .trace("Resource is down; failureCount: {}; failureCountThreshold: {}; remaining time: {}; hard down: {}", resource, failureCount.get(), failureCountThreshold, downUntil.get() - SystemTime.getInstance().milliseconds(), hardDown); } else { logger.trace("Resource is not down; failureCount: {}; failureCountThreshold: {}", resource, failureCount.get(), failureCountThreshold); } return down; }
Source:
<code>public boolean mkdir(String remoteDirectory) throws IOException { try { this.channel.mkdir(remoteDirectory); } catch (SftpException ex) { if (ex.id == ChannelSftp.SSH_FX_FAILURE && exists(remoteDirectory)) { <START> return false; <END> } else { throw new NestedIOException("failed to create remote directory '" + remoteDirectory + "'.", ex); } } return true; }</code><technical_language>I this return true a race condition. RFU currently discards result; I check throw exception if false - FtpSession simply delegate client</technical_language>

Target:
public boolean mkdir(String remoteDirectory) throws IOException { try { this.channel.mkdir(remoteDirectory); } catch (SftpException ex) { if (ex.id != ChannelSftp.SSH_FX_FAILURE || !exists(remoteDirectory)) { throw new NestedIOException("failed to create remote directory '" + remoteDirectory + "'.", ex); } } return true; }
Source:
<code>public void testDoubleNaNInfinity() throws Exception { <START> tester.testRoundTrip(DOUBLE, ImmutableList.of(1000.0, -1.0, Double.POSITIVE_INFINITY)); <END> tester.testRoundTrip(DOUBLE, ImmutableList.of(-1000.0, Double.NEGATIVE_INFINITY, 1.0)); tester.testRoundTrip(DOUBLE, ImmutableList.of(0.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, -1.0, 1.0)); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, -1.0, Double.POSITIVE_INFINITY)); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, Double.NEGATIVE_INFINITY, 1.0)); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)); }</code><technical_language>perhaps, test filters</technical_language>

Target:
public void testDoubleNaNInfinity() throws Exception { List<Map<Integer, TupleDomainFilter>> filters = ImmutableList.of( ImmutableMap.of(0, DoubleRange.of(0, false, false, 1_000, false, false, false)), ImmutableMap.of(0, IS_NULL), ImmutableMap.of(0, IS_NOT_NULL)); tester.testRoundTrip(DOUBLE, ImmutableList.of(1000.0, -1.0, Double.POSITIVE_INFINITY), filters); tester.testRoundTrip(DOUBLE, ImmutableList.of(-1000.0, Double.NEGATIVE_INFINITY, 1.0), filters); tester.testRoundTrip(DOUBLE, ImmutableList.of(0.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), filters); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, -1.0, 1.0), filters); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, -1.0, Double.POSITIVE_INFINITY), filters); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, Double.NEGATIVE_INFINITY, 1.0), filters); tester.testRoundTrip(DOUBLE, ImmutableList.of(Double.NaN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), filters); }
Source:
<code><START> @Override public void onResume() { <END> super.onResume(); if( getArguments().getString("state").equalsIgnoreCase("From Favourite")) { setUpFavTriggers(); } else { BackendClient.of(this).getTriggers(new TriggersCallback()); } }</code><technical_language>@free4murad put @Override in line of method everytime :laughing:</technical_language>

Target:
public void onResume() { super.onResume(); if( getArguments().getString("state").equalsIgnoreCase("From Favourite")) { setUpFavTriggers(); } else { BackendClient.of(this).getTriggers(new TriggersCallback()); } }
Source:
<code>protected void log(Object... params) { int sampleRate = WikipediaApp.getInstance().getRemoteConfig().getConfig() <START> .optInt("linkPreviewLogSampleRate", WikipediaApp.getInstance().getReleaseType() == WikipediaApp.RELEASE_PROD ? DEFAULT_SAMPLE_RATE : 1); <END> super.log(title.getSite(), sampleRate, params); }</code><technical_language>minor: consider adding a isProdRelease() release method WikipediaApp</technical_language>

Target:
protected void log(Object... params) { int sampleRate = WikipediaApp.getInstance().getRemoteConfig().getConfig() .optInt("linkPreviewLogSampleRate", WikipediaApp.getInstance().isProdRelease() ? DEFAULT_SAMPLE_RATE : 1); super.log(title.getSite(), sampleRate, params); }
Source:
<code><START> public String getHtmlPage() { <END> return htmlPage; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Update this method implementation is identical "getParent1" line 135. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public String getHtmlPage() { return parent1; }
Source:
<code>public String toString() { return MoreObjects.toStringHelper(this) .add("name", name) <START> .add("first_name", firstName) <END> .add("middle_name", middleName) .add("last_name", lastName) .add("gender", gender) .add("verified", verified) .toString(); }</code><technical_language>Camel case</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("name", name) .add("firstName", firstName) .add("middleName", middleName) .add("lastName", lastName) .add("gender", gender) .add("verified", verified) .toString(); }
Source:
<code>private void initializeBridge() { bridgeProperties = new HashMap<>(); bridge = BridgeBuilder.create(new ThingTypeUID("iota", "test-bridge"), "testbridge").withLabel("Test Bridge") .withConfiguration(new Configuration(bridgeProperties)).build(); IotaUtilsImpl mockUtils = mock(IotaUtilsImpl.class); when(mockUtils.checkAPI()).thenReturn(true); iotaBridgeHandler = new IotaBridgeHandler(bridge, mockUtils); bridge.setHandler(iotaBridgeHandler); <START> ThingHandlerCallback bridgeHandler = mock(ThingHandlerCallback.class); <END> doAnswer(answer -> { ((Thing) answer.getArgument(0)).setStatusInfo(answer.getArgument(1)); return null; }).when(bridgeHandler).statusUpdated(any(), any()); iotaBridgeHandler.setCallback(bridgeHandler); iotaBridgeHandler.initialize(); }</code><technical_language>bridgeHandler bridgeHandlerCallback, other ThingHandlerCallback mocks in other methods</technical_language>

Target:
protected Bridge initializeBridge() { bridgeProperties = new HashMap<>(); bridge = BridgeBuilder.create(new ThingTypeUID("iota", "test-bridge"), "testbridge").withLabel("Test Bridge") .withConfiguration(new Configuration(bridgeProperties)).build(); IotaUtilsImpl mockUtils = Mockito.mock(IotaUtilsImpl.class); when(mockUtils.checkAPI()).thenReturn(true); iotaBridgeHandler = new IotaBridgeHandler(bridge, mockUtils); bridge.setHandler(iotaBridgeHandler); ThingHandlerCallback bridgeHandlerCallback = mock(ThingHandlerCallback.class); doAnswer(answer -> { ((Thing) answer.getArgument(0)).setStatusInfo(answer.getArgument(1)); return null; }).when(bridgeHandlerCallback).statusUpdated(any(), any()); iotaBridgeHandler.setCallback(bridgeHandlerCallback); iotaBridgeHandler.initialize(); return bridge; }
Source:
<code>public static ViewAssertion matchesVisually(final Bitmap expectedBitmap) { return new ViewAssertion() { @Override public void check(View view, NoMatchingViewException noViewFoundException) { <START> if(noViewFoundException!=null) <END> { throw noViewFoundException; } Bitmap viewBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); view.draw(new Canvas(viewBitmap)); assertTrue("View matches the given bitmap " + HumanReadables.describe(view), BitmapUtil.compareBitmaps(viewBitmap, expectedBitmap)); } }; }</code><technical_language>add spaces</technical_language>

Target:
public static ViewAssertion matchesVisually(final Bitmap expectedBitmap) { return new ViewAssertion() { @Override public void check(View view, NoMatchingViewException noViewFoundException) { if(noViewFoundException != null) { throw noViewFoundException; } Bitmap viewBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), expectedBitmap.getConfig()); view.draw(new Canvas(viewBitmap)); assertTrue("View matches the given bitmap " + HumanReadables.describe(view), BitmapUtil.compareBitmaps(viewBitmap, expectedBitmap)); } }; }
Source:
<code>private PrometheusClient getPrometheusClient() { if (prometheusClient == null) { <START> Provider provider <END> = providerDao.get(vdsManager.getClusterId()); prometheusClient = PrometheusClient.create(provider); } return prometheusClient; }</code><technical_language>declare Provider<KubevirtAdditionalProperties></technical_language>

Target:
private PrometheusClient getPrometheusClient() { if (prometheusClient == null) { Provider<?> provider = providerDao.get(vdsManager.getClusterId()); prometheusClient = KubevirtUtils.create(provider); } return prometheusClient; }
Source:
<code>public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { final TaskAssigningSolution workingSolution = scoreDirector.getWorkingSolution(); final User workingUser = scoreDirector.lookUpWorkingObjectOrReturnNull(user); <START> if (workingUser != null) { <END> if (workingUser.isEnabled()) { scoreDirector.beforeProblemPropertyChanged(workingUser); workingUser.setEnabled(false); scoreDirector.afterProblemPropertyChanged(workingUser); } releaseAllTasks(workingUser, scoreDirector); workingSolution.setUserList(new ArrayList<>(workingSolution.getUserList())); scoreDirector.beforeProblemFactRemoved(workingUser); workingSolution.getUserList().remove(workingUser); scoreDirector.afterProblemFactRemoved(workingUser); scoreDirector.triggerVariableListeners(); } }</code><technical_language>suggestion nesting</technical_language>

Target:
public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { final TaskAssigningSolution workingSolution = scoreDirector.getWorkingSolution(); final User workingUser = scoreDirector.lookUpWorkingObjectOrReturnNull(user); if (workingUser == null) { return; } if (workingUser.isEnabled()) { scoreDirector.beforeProblemPropertyChanged(workingUser); workingUser.setEnabled(false); scoreDirector.afterProblemPropertyChanged(workingUser); } releaseAllTasks(workingUser, scoreDirector); workingSolution.setUserList(new ArrayList<>(workingSolution.getUserList())); scoreDirector.beforeProblemFactRemoved(workingUser); workingSolution.getUserList().remove(workingUser); scoreDirector.afterProblemFactRemoved(workingUser); scoreDirector.triggerVariableListeners(); }
Source:
<code>private void setInitialState() { for (PlexBindingProvider provider : providers) <START> setInitialState(provider); <END> }</code><technical_language>please curly braces this is a Oneliner</technical_language>

Target:
private void setInitialState() { for (PlexBindingProvider provider : providers) { setInitialState(provider); } }
Source:
<code>public void ensureEmptyGuestIdsAreIgnored() throws Exception { Owner owner = new Owner("admin"); Map<String, ArrayList<GuestId>> hostGuestMap = new HashMap<String, ArrayList<GuestId>>(); hostGuestMap.put("HYPERVISOR_A", new ArrayList(Arrays.asList(new GuestId("GUEST_A"), new GuestId("")))); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(consumerCurator.getHostConsumersMap(any(Owner.class), any(Set.class))). thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestConsumersMap(any(Owner.class), any(Set.class))). thenReturn(new VirtConsumerMap()); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(principal.canAccess(eq(owner), eq(SubResource.CONSUMERS), eq(Access.CREATE))). thenReturn(true); when(consumerTypeCurator.lookupByLabel( eq(ConsumerTypeEnum.HYPERVISOR.getLabel()))).thenReturn(hypervisorType); when(idCertService.generateIdentityCert(any(Consumer.class))) .thenReturn(new IdentityCertificate()); HypervisorCheckInResult result = null; try { result = hypervisorResource.hypervisorUpdate(hostGuestMap, <START> principal, owner.getKey(), true); <END> } catch (PersistenceException e) { fail("Expected no exception"); } assertTrue(result != null); assertTrue(result.getCreated() != null); Consumer[] created = result.getCreated().toArray(new Consumer[1]); assertTrue(created.length == 1); List<GuestId> gids = created[0].getGuestIds(); assertTrue(gids.size() == 1); }</code><technical_language>Indentation out of whack</technical_language>

Target:
public void ensureEmptyGuestIdsAreIgnored() throws Exception { Owner owner = new Owner("admin"); Map<String, List<GuestId>> hostGuestMap = new HashMap<String, List<GuestId>>(); hostGuestMap.put("HYPERVISOR_A", new ArrayList( Arrays.asList(new GuestId("GUEST_A"), new GuestId("")))); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(consumerCurator.getHostConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(principal.canAccess(eq(owner), eq(SubResource.CONSUMERS), eq(Access.CREATE))) .thenReturn(true); when(consumerTypeCurator.lookupByLabel(eq(ConsumerTypeEnum.HYPERVISOR.getLabel()))) .thenReturn(hypervisorType); when(idCertService.generateIdentityCert(any(Consumer.class))) .thenReturn(new IdentityCertificate()); HypervisorCheckInResult result = hypervisorResource.hypervisorUpdate( hostGuestMap, principal, owner.getKey(), true); assertNotNull(result); assertNotNull(result.getCreated()); List<Consumer> created = new ArrayList<Consumer>(result.getCreated()); assertEquals(1, created.size()); List<GuestId> gids = created.get(0).getGuestIds(); assertEquals(1, gids.size()); }
Source:
<code><START> public TopologySummary getTopologySummaryByName(String name) throws AuthorizationException, TException { <END> try { getTopologySummaryByNameCalls.mark(); checkAuthorization(null, null, "getTopologySummaries"); IStormClusterState state = stormClusterState; String topoId = state.getTopoId(name).orElseThrow(() -> new WrappedNotAliveException(name + " is not alive")); return getTopologySummary(topoId, state.topologyBases().get(topoId)); } catch (Exception e) { LOG.warn("Get TopologySummaryByName info exception.", e); if (e instanceof TException) { throw (TException) e; } throw new RuntimeException(e); } }</code><technical_language>need AuthorizationException</technical_language>

Target:
public TopologySummary getTopologySummaryByName(String name) throws NotAliveException, AuthorizationException, TException { try { getTopologySummaryByNameCalls.mark(); checkAuthorization(name, null, "getTopologySummaryByName"); IStormClusterState state = stormClusterState; String topoId = state.getTopoId(name).orElseThrow(() -> new WrappedNotAliveException(name + " is not alive")); return getTopologySummaryImpl(topoId, state.topologyBases().get(topoId)); } catch (Exception e) { LOG.warn("Get TopologySummaryByName info exception.", e); if (e instanceof TException) { throw (TException) e; } throw new RuntimeException(e); } }
Source:
<code>private Player getRandomPlayer(boolean allowDevs) { final Collection<? extends Player> players = Bukkit.getOnlinePlayers(); if (players.isEmpty()) { return null; } if (!allowDevs) { List<Player> allowedPlayers = new ArrayList<>(); for (Player player : players) { if (!FUtil.DEVELOPERS.contains(player.getName())) { allowedPlayers.add(player); } <START> if (!FUtil.FOUNDER.contains(player.getName())) <END> { allowedPlayers.add(player); } } return allowedPlayers.get(random.nextInt(allowedPlayers.size())); } return (Player) players.toArray()[random.nextInt(players.size())]; }</code><technical_language>done this</technical_language>

Target:
private Player getRandomPlayer(boolean allowDevs) { final Collection<? extends Player> players = Bukkit.getOnlinePlayers(); if (players.isEmpty()) { return null; } if (!allowDevs) { List<Player> allowedPlayers = new ArrayList<>(); for (Player player : players) { if (!FUtil.DEVELOPERS.contains(player.getName())) { allowedPlayers.add(player); } } return allowedPlayers.get(random.nextInt(allowedPlayers.size())); } return (Player) players.toArray()[random.nextInt(players.size())]; }
Source:
<code>protected Optional<CoverageReportView> getCoverageReportView(PlaceRequest placeRequest) { final Activity activity = placeManager.getActivity(placeRequest); <START> if (activity != null) { <END> final AbstractWorkbenchActivity coverageActivity = (AbstractWorkbenchActivity) activity; return Optional.of((CoverageReportView) coverageActivity.getWidget()); } else { return Optional.empty(); } }</code><technical_language>a small remark feel free skip it. a nicer if if else logic direct if (activity == null) { return Optional.empty(); } else { final AbstractWorkbenchActivity coverageActivity = (AbstractWorkbenchActivity) activity; return Optional.of((CoverageReportView) coverageActivity.getWidget()); }</technical_language>

Target:
protected Optional<CoverageReportView> getCoverageReportView(PlaceRequest placeRequest) { final Activity activity = placeManager.getActivity(placeRequest); if (activity == null) { return Optional.empty(); } else { final AbstractWorkbenchActivity coverageActivity = (AbstractWorkbenchActivity) activity; return Optional.of((CoverageReportView) coverageActivity.getWidget()); } }
Source:
<code>public ResourceLocation getShaderType() { <START> return new ResourceLocation("immersiveengineering", "drill"); <END> }</code><technical_language>prefer ImmersiveEngineering.MODID, eliminate possibility of typos. compiler inline it, difference runtime</technical_language>

Target:
public ResourceLocation getShaderType() { return new ResourceLocation(ImmersiveEngineering.MODID, "drill"); }
Source:
<code>protected static GoExpression findExpressionAtOffset(GoIntroduceOperation operation) { PsiFile file = operation.getFile(); int offset = operation.getEditor().getCaretModel().getOffset(); PsiElement element = file.findElementAt(offset); GoParenthesesExpr parenthesesParent = PsiTreeUtil.getParentOfType(element, GoParenthesesExpr.class); if (element instanceof PsiWhiteSpace || (parenthesesParent != null && parenthesesParent.getRparen() == element)) { element = file.findElementAt(offset - 1); } <START> return element instanceof GoExpression ? (GoExpression)element : PsiTreeUtil.getParentOfType(element, GoExpression.class); <END> }</code><technical_language>getNonStrictParentOfType</technical_language>

Target:
private static GoExpression findExpressionAtOffset(GoIntroduceOperation operation) { PsiFile file = operation.getFile(); int offset = operation.getEditor().getCaretModel().getOffset(); GoExpression expr = PsiTreeUtil.getNonStrictParentOfType(file.findElementAt(offset), GoExpression.class); GoExpression preExpr = PsiTreeUtil.getNonStrictParentOfType(file.findElementAt(offset - 1), GoExpression.class); if (expr == null || preExpr != null && PsiTreeUtil.isAncestor(expr, preExpr, false)) return preExpr; return expr; }
Source:
<code>public List<SqlFunction> listFunctions(Session session) { Set<String> managerIds = isListBuiltInFunctionsOnly(session) ? ImmutableSet.of(BuiltInFunctionNamespaceManager.ID) : functionNamespaceManagers.keySet(); ImmutableList.Builder<SqlFunction> functions = ImmutableList.builder(); for (String managerId : managerIds) { FunctionNamespaceManager<? extends SqlFunction> manager = functionNamespaceManagers.get(managerId); Set<CatalogSchemaPrefix> servingNamespaces = this.servingNamespaces.get().get(managerId); for (SqlFunction function : manager.listFunctions()) { CatalogSchemaName functionNamespace = function.getSignature().getName().getFunctionNamespace(); if (!servingNamespaces.contains(functionNamespace.asCatalogSchemaPrefix()) && !servingNamespaces.contains(new CatalogSchemaPrefix(functionNamespace.getCatalogName(), Optional.empty()))) { <START> throw new PrestoException( <END> GENERIC_INTERNAL_ERROR, format("Invalid function [%s] found in function namespace manager [%s]", function.getSignature().getName(), managerId)); } if (function.getVisibility() == PUBLIC || (function.getVisibility() == EXPERIMENTAL && isExperimentalFunctionsEnabled(session))) { functions.add(function); } } } return functions.build(); }</code><technical_language>Hmm, do need error if function namespace manager some functions a namespace longer used? Personally I prefer function namespace manager support a listFunction(prefix) API. This simply ignore in function namespace manager configured managed this instance. (Think, backend database hosting function namespaces a.b, x.y, for cluster configuring manage a.b, while another cluster configured manage x.y). I this needs internal error. reasonable. Essentially, config is constructing a view of underlying database exposed a cluster configuration</technical_language>

Target:
public List<SqlFunction> listFunctions(Session session) { Collection<FunctionNamespaceManager<?>> managers = isListBuiltInFunctionsOnly(session) ? ImmutableSet.of(builtInFunctionNamespaceManager) : functionNamespaceManagers.values(); return managers.stream() .flatMap(manager -> manager.listFunctions().stream()) .filter(function -> function.getVisibility() == PUBLIC || (function.getVisibility() == EXPERIMENTAL && SystemSessionProperties.isExperimentalFunctionsEnabled(session))) .collect(toImmutableList()); }
Source:
<code>public void setUp() throws Exception { if (!hasCleared) { clearTestRegistries(); hasCleared = true; } bout = new ByteArrayOutputStream(); <START> System.setOut(new PrintStream(bout, true, StandardCharsets.UTF_8)); <END> }</code><technical_language>[ERROR] /tmpfs/src/github/java-docs-samples/iot/api-client/manager/src/test/java/com/example/cloud/iot/examples/ManagerIT.java:[75,18] error: suitable constructor for PrintStream(ByteArrayOutputStream,boolean,Charset) constructor PrintStream.PrintStream(boolean,OutputStream,Charset) is applicable (argument mismatch; ByteArrayOutputStream converted boolean) constructor PrintStream.PrintStream(boolean,Charset,OutputStream) is applicable (argument mismatch; ByteArrayOutputStream converted boolean) constructor PrintStream.PrintStream(OutputStream,boolean,String) is applicable (argument mismatch; Charset converted String) Try setting StandardCharsets.UTF_8.name() instead</technical_language>

Target:
public void setUp() throws Exception { if (!hasCleared) { clearTestRegistries(); hasCleared = true; } bout = new ByteArrayOutputStream(); System.setOut(new PrintStream(bout, true, StandardCharsets.UTF_8.name())); }
Source:
<code>public int updateUploading(String filePath, boolean uploading) { ContentValues cv = new ContentValues(); cv.put(ProviderTableMeta.FILE_UPLOADING, uploading); <START> int result = getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, ProviderTableMeta.FILE_PATH + "=? AND "+ <END> ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?", new String[] { filePath, mAccount.name }); Log_OC.d(TAG, "updateUploading, result=" + String.valueOf(result)); return result; }</code><technical_language>This method for ContentResolver ContentProvider, other methods in this class</technical_language>

Target:
public int updateUploading(String filePath, boolean uploading) { ContentValues cv = new ContentValues(); cv.put(ProviderTableMeta.FILE_UPLOADING, uploading); int result = -1; if (getContentResolver() != null) { result = getContentResolver().update(ProviderTableMeta.CONTENT_URI, cv, ProviderTableMeta.FILE_PATH + "=? AND "+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?", new String[] { filePath, mAccount.name }); } else { try { result = getContentProvider().update(ProviderTableMeta.CONTENT_URI, cv, ProviderTableMeta.FILE_PATH + "=? AND "+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?", new String[] { filePath, mAccount.name }); } catch (RemoteException e) { Log_OC.e(TAG, "Fail to update 'uploading' of " + filePath + " in database", e); } } return result; }
Source:
<code>public synchronized void notifyManager() { _logger.debug(String.format("Notifying Manager for %s", this.getClass().getName())); try { <START> _metricManager.reportMetric( (IMetric<?>) this.clone()); <END> } catch (NullPointerException ex) { _logger.error(String.format("Metric Manager is not set for %s metric %s", this.getClass().getName(), ex.toString())); } catch (CloneNotSupportedException ex) { _logger.error(String.format("Failed to take snapshot for %s metric %s", this.getClass().getName(), ex.toString())); } }</code><technical_language>need synchronized while calling this.clone(). I this entire method needs synchronized. cloned this, I call .reportMetric() holding a synchronization lock</technical_language>

Target:
public void notifyManager() { logger.debug(String.format("Notifying Manager for %s", this.getClass().getName())); try { metricManager.reportMetric(this); } catch (Throwable ex) { logger.error(String.format("Metric Manager is not set for %s metric", this.getClass().getName()), ex); } }
Source:
<code>protected boolean parseHeader(ParsableByteArray data) throws UnsupportedFormatException { if (!hasParsedAudioDataHeader) { int header = data.readUnsignedByte(); audioFormat = (header >> 4) & 0x0F; if (audioFormat == AUDIO_FORMAT_MP3) { int sampleRateIndex = (header >> 2) & 0x03; <START> if (sampleRateIndex < 0 || sampleRateIndex >= AUDIO_SAMPLING_RATE_TABLE.length) { <END> Log.d(TAG, "Invalid sample rate, attempting to read at 44.1k"); sampleRateIndex = 3; } int sampleRate = AUDIO_SAMPLING_RATE_TABLE[sampleRateIndex]; Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_MPEG, null, Format.NO_VALUE, Format.NO_VALUE, 1, sampleRate, null, null, 0, null); output.format(format); hasOutputFormat = true; } else if (audioFormat == AUDIO_FORMAT_ALAW || audioFormat == AUDIO_FORMAT_ULAW) { String type = audioFormat == AUDIO_FORMAT_ALAW ? MimeTypes.AUDIO_ALAW : MimeTypes.AUDIO_ULAW; int pcmEncoding = (header & 0x01) == 1 ? C.ENCODING_PCM_16BIT : C.ENCODING_PCM_8BIT; Format format = Format.createAudioSampleFormat(null, type, null, Format.NO_VALUE, Format.NO_VALUE, 1, 8000, pcmEncoding, null, null, 0, null); output.format(format); hasOutputFormat = true; } else if (audioFormat != AUDIO_FORMAT_AAC) { throw new UnsupportedFormatException("Audio format not supported: " + audioFormat); } hasParsedAudioDataHeader = true; } else { data.skipBytes(1); } return true; }</code><technical_language>This impossible. L68, sampleRateIndex 0,1,2 3 here, I think? If agree, please delete this block (and TAG constant top)</technical_language>

Target:
protected boolean parseHeader(ParsableByteArray data) throws UnsupportedFormatException { if (!hasParsedAudioDataHeader) { int header = data.readUnsignedByte(); audioFormat = (header >> 4) & 0x0F; if (audioFormat == AUDIO_FORMAT_MP3) { int sampleRateIndex = (header >> 2) & 0x03; int sampleRate = AUDIO_SAMPLING_RATE_TABLE[sampleRateIndex]; Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_MPEG, null, Format.NO_VALUE, Format.NO_VALUE, 1, sampleRate, null, null, 0, null); output.format(format); hasOutputFormat = true; } else if (audioFormat == AUDIO_FORMAT_ALAW || audioFormat == AUDIO_FORMAT_ULAW) { String type = audioFormat == AUDIO_FORMAT_ALAW ? MimeTypes.AUDIO_ALAW : MimeTypes.AUDIO_ULAW; int pcmEncoding = (header & 0x01) == 1 ? C.ENCODING_PCM_16BIT : C.ENCODING_PCM_8BIT; Format format = Format.createAudioSampleFormat(null, type, null, Format.NO_VALUE, Format.NO_VALUE, 1, 8000, pcmEncoding, null, null, 0, null); output.format(format); hasOutputFormat = true; } else if (audioFormat != AUDIO_FORMAT_AAC) { throw new UnsupportedFormatException("Audio format not supported: " + audioFormat); } hasParsedAudioDataHeader = true; } else { data.skipBytes(1); } return true; }
Source:
<code>public static boolean isInformationSchema(Schema schema) { String name = schema.getName(); if (name == null) { return false; } <START> return MetaModelHelper.isInformationSchema(schema); <END> }</code><technical_language>MetaModelHelper name check lowercasing, need repeat it. (Errr, nevermind lowercasing, code, name null-checking is redundant)</technical_language>

Target:
public static boolean isInformationSchema(Schema schema) { return MetaModelHelper.isInformationSchema(schema); }
Source:
<code>private void createIndex() { lastFoundElementPosition = 0; filteredPlan.clear(); for (PlanElement element : plan.getList()) { <START> if (!element.isComment()) { <END> filteredPlan.add(element); } } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
private void createIndex() { lastFoundElementPosition = 0; filteredPlan.clear(); for (PlanElement element : plan.getList()) { if (!element.isComment()) filteredPlan.add(element); } }
Source:
<code>public void transition(TaskImpl task, TaskEvent event) { LOG.info("Scheduling a redundant attempt for task " + task.taskId); task.counters.findCounter(TaskCounter.NUM_SPECULATIONS).increment(1); TaskAttempt earliestUnfinishedAttempt = null; for (TaskAttempt ta : task.attempts.values()) { if (!ta.isFinished()) { earliestUnfinishedAttempt = ta; } } NodeId nodeId = earliestUnfinishedAttempt.getNodeId(); <START> task.unhealthyNodesHistory.add(nodeId); <END> LOG.info("A long-tailed attempt was running on node {}, adding it to the task's unhealthy node history.", nodeId, earliestUnfinishedAttempt.getID()); task.addAndScheduleAttempt(earliestUnfinishedAttempt.getID()); }</code><technical_language>a piece of thought for discussions: in loop (line 1018-1021), put node id of running attempts unhealthy nodes (instead of earliest attempt)? time here, a redundant attempt deemed necessary, suggesting unfinished(running) attempts for this task potentially problematic/long-tailed</technical_language>

Target:
public void transition(TaskImpl task, TaskEvent event) { LOG.info("Scheduling a redundant attempt for task " + task.taskId); task.counters.findCounter(TaskCounter.NUM_SPECULATIONS).increment(1); TaskAttempt earliestUnfinishedAttempt = null; for (TaskAttempt ta : task.attempts.values()) { if (!ta.isFinished()) { earliestUnfinishedAttempt = ta; task.nodesWithRunningAttempts.add(ta.getNodeId()); } } task.addAndScheduleAttempt(earliestUnfinishedAttempt.getID()); }
Source:
<code><START> private void validateOATag(final File testSam, final File truthSam) { <END> final ArrayList<String> truthOAValues = new ArrayList<>(); final ArrayList<String> testOAValues = new ArrayList<>(); SAMRecordIterator iterator = SamReaderFactory.makeDefault().open(truthSam).iterator(); while (iterator.hasNext()){ SAMRecord rec = iterator.next(); truthOAValues.add(rec.getStringAttribute(AddOATag.OA)); } iterator = SamReaderFactory.makeDefault().open(testSam).iterator(); while (iterator.hasNext()){ SAMRecord rec = iterator.next(); testOAValues.add(rec.getStringAttribute(AddOATag.OA)); } Assert.assertEquals(testOAValues, truthOAValues); }</code><technical_language>static suggestion private static void validateOATag(final File testSam, final File truthSam) {</technical_language>

Target:
private static void validateOATag(final File testSam, final File truthSam) { final ArrayList<String> truthOAValues = new ArrayList<>(); final ArrayList<String> testOAValues = new ArrayList<>(); SAMRecordIterator iterator = SamReaderFactory.makeDefault().open(truthSam).iterator(); while (iterator.hasNext()) { SAMRecord rec = iterator.next(); truthOAValues.add(rec.getStringAttribute(AddOATag.OA)); } iterator = SamReaderFactory.makeDefault().open(testSam).iterator(); while (iterator.hasNext()) { SAMRecord rec = iterator.next(); testOAValues.add(rec.getStringAttribute(AddOATag.OA)); } Assert.assertEquals(testOAValues, truthOAValues); }
Source:
<code>private static Guid getEntityId(String fileName) { <START> return Guid.createGuidFromString(fileName.substring(0, fileName.indexOf(".ovf"))); <END> }</code><technical_language>1. replace .ovf constant 2. replace fileName.indexOf(".ovf") filename.length - OVF_FILE_EXT.length save lookup in string</technical_language>

Target:
private static Guid getEntityId(String fileName) { return Guid.createGuidFromString(fileName.substring(0, fileName.length() - OVF_FILE_EXT.length())); }
Source:
<code>public static ExternalIdBundle parse(Iterable<String> strs) { ArgChecker.noNulls(strs, "strs"); List<ExternalId> externalIds = StreamSupport.stream(strs.spliterator(), false) .map(ExternalId::parse) .collect(Collectors.toList()); <START> return create(externalIds); <END> }</code><technical_language>Worth creating a Collector avoid intermediate List</technical_language>

Target:
public static ExternalIdBundle parse(Iterable<String> strs) { ArgChecker.noNulls(strs, "strs"); Set<ExternalId> ids = StreamSupport.stream(strs.spliterator(), false) .map(ExternalId::parse) .collect(Collectors.toSet()); return create(ids); }
Source:
<code>public StringEncoder(Charset charset) { if (charset == null) { throw new NullPointerException("charset"); } <START> this.encoder = CharsetUtil.encoder(charset); <END> }</code><technical_language>@johnou this is thread-safe... need todo this in handlerAdded(...) method CharsetUtil.encoder(...) encoder a thread-local. need ensure call this thread encode on</technical_language>

Target:
public StringEncoder(Charset charset) { if (charset == null) { throw new NullPointerException("charset"); } this.charset = charset; }
Source:
<code>public Gff3Writer(final Path path) throws IOException { <START> if (!FileExtensions.GFF3.stream().anyMatch(e -> path.toString().endsWith(e))) { <END> throw new TribbleException("File " + path + " does not have extension consistent with gff3"); } final OutputStream outputStream = IOUtil.hasGzipFileExtension(path)? new GZIPOutputStream(Files.newOutputStream(path)) : Files.newOutputStream(path); out = new PrintStream(outputStream); initialize(); }</code><technical_language>! anyMatch -> noneMatch for clarity</technical_language>

Target:
public Gff3Writer(final Path path) throws IOException { if (FileExtensions.GFF3.stream().noneMatch(e -> path.toString().endsWith(e))) { throw new TribbleException("File " + path + " does not have extension consistent with gff3"); } final OutputStream outputStream = IOUtil.hasGzipFileExtension(path)? new BlockCompressedOutputStream(path.toFile()) : Files.newOutputStream(path); out = new BufferedOutputStream(outputStream); initialize(); }
Source:
<code>public void createCSR() { if (StringUtils.isBlank(getAlias())) { HelperUtil.addMessageError(null, "Required fields cannot be empty when creating CSR."); return; } csrFile = null; SimpleCertificateResponseMessageType response = service.createCSR(getAlias()); if (null != response && response.isStatus()) { HelperUtil.addMessageInfo(null, MessageFormat.format("Successfully created CSR for: {0}", getAlias())); if(null != response.getCsrData()){ DataHandler data = response.getCsrData(); String filename = MessageFormat.format("{0}-{1}.csr", getAlias(), CoreHelpUtils.formatDate("yyyyMMdd", new Date())); try { csrFile = new DefaultStreamedContent(data.getInputStream(), data.getContentType(), filename); } catch (IOException e) { <START> LOG.error("unable to open input-stream from response", e.getLocalizedMessage(), e); <END> } } } else { HelperUtil.addMessageError(null, MessageFormat.format("Failed to create CSR for: {0}", getAlias())); } }</code><technical_language>user operation failed here</technical_language>

Target:
public void createCSR() { if (StringUtils.isBlank(getAlias())) { HelperUtil.addMessageError(null, "Required fields cannot be empty when creating CSR."); return; } csrFile = null; SimpleCertificateResponseMessageType response = service.createCSR(getAlias()); if (null != response && response.isStatus()) { HelperUtil.addMessageInfo(null, MessageFormat.format("Successfully created CSR for: {0}", getAlias())); if(null != response.getCsrData()){ DataHandler data = response.getCsrData(); String filename = MessageFormat.format("{0}-{1}.csr", getAlias(), CoreHelpUtils.formatDate("yyyyMMdd", new Date())); try { csrFile = new DefaultStreamedContent(data.getInputStream(), data.getContentType(), filename); } catch (IOException e) { LOG.error(ERROR_INPUTSTREAM, e.getLocalizedMessage(), e); HelperUtil.addMessageError(null, ERROR_INPUTSTREAM); } } } else { HelperUtil.addMessageError(null, MessageFormat.format("Failed to create CSR for: {0}", getAlias())); } }
Source:
<code><START> public static Vector num2Vec(int num, int vecSize) { <END> return new DenseLocalOnHeapVector(vecSize).setX(num, 1); }</code><technical_language>add isDistributed flag produce types of vector, local dense</technical_language>

Target:
public static Vector num2Vec(int num, int vecSize) { return num2Vec(num, vecSize, false); }
Source:
<code><START> public CharSequence apply(final String context, final Options options) throws IOException { <END> final List<String> languageTags = getLocales(options); final String language = languageTags.get(0); final String[] parts = StringUtils.split(context, ':'); final boolean usingDefaultBundle = parts.length == 1; final String bundle = usingDefaultBundle ? "translations" : parts[0]; final boolean containsPlural = containsPlural(options); final String key = usingDefaultBundle ? context : parts[1]; final String resolvedValue = containsPlural ? Optional.ofNullable(resolve(language, bundle, key + "_plural")).orElseGet(() -> resolve(language, bundle, key)) : resolve(language, bundle, key); String parametersReplaced = StringUtils.defaultString(resolvedValue); for (final Map.Entry<String, Object> entry : options.hash.entrySet()) { parametersReplaced = parametersReplaced.replace("__" + entry.getKey() + "__", entry.getValue().toString()); } return parametersReplaced; }</code><technical_language>Split method in smaller functions easier read</technical_language>

Target:
public CharSequence apply(final String context, final Options options) throws IOException { final List<String> languageTags = getLocales(options); final String language = languageTags.get(0); final TranslationIdentifier translationIdentifier = obtainTranslationIdentifier(context); final String bundle = translationIdentifier.bundle; final String key = translationIdentifier.key; final String resolvedValue = pluralize(options, language, bundle, key); return replaceParameters(options, resolvedValue); }