auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { writePermission= true; } setTitle(getIntent().getExtras().getString("selection_name")); setContentView(R.layout.player_simple_layout); EMBED = getIntent().getExtras().getString("embed_code"); PCODE = getIntent().getExtras().getString("pcode"); DOMAIN = getIntent().getExtras().getString("domain"); APIKEY =getIntent().getExtras().getString("apikey"); SECRET = getIntent().getExtras().getString("secret"); ACCOUNT_ID = getIntent().getExtras().getString("accountid"); AUTOPLAY = getIntent().getExtras().getBoolean("autoPlay"); OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer); Options options = new Options.Builder().setUseExoPlayer(true).build(); player = new OoyalaPlayer(PCODE, new PlayerDomain(DOMAIN), this, options); playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player); player.addObserver(this); if (player.setEmbedCode(EMBED)) { <START> if(AUTOPLAY) <END> player.play(); } else { Log.e(TAG, "Asset Failure"); } }</code><technical_language>add extra braces for this if, matter if line</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ContextCompat.checkSelfPermission(this, WRITE_EXTERNAL_STORAGE) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{WRITE_EXTERNAL_STORAGE}, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { writePermission= true; } setTitle(getIntent().getExtras().getString("selection_name")); setContentView(R.layout.player_simple_layout); EMBED = getIntent().getExtras().getString("embed_code"); PCODE = getIntent().getExtras().getString("pcode"); DOMAIN = getIntent().getExtras().getString("domain"); APIKEY =getIntent().getExtras().getString("apikey"); SECRET = getIntent().getExtras().getString("secret"); ACCOUNT_ID = getIntent().getExtras().getString("accountid"); AUTOPLAY = getIntent().getExtras().getBoolean("autoPlay"); OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer); Options options = new Options.Builder().setUseExoPlayer(true).build(); player = new OoyalaPlayer(PCODE, new PlayerDomain(DOMAIN), this, options); playerLayoutController = new OoyalaPlayerLayoutController(playerLayout, player); player.addObserver(this); if (player.setEmbedCode(EMBED)) { if(AUTOPLAY) { player.play(); } } else { Log.e(TAG, "Asset Failure"); } }
Source:
<code><START> public void testDirValidation() throws IOException { <END> CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_DISK_STORE); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKSTORENAME, "diskStoreName"); csb.addOption(CliStrings.ALTER_DISK_STORE__REGIONNAME, "regionName"); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKDIRS, "wrongDiskDir"); csb.addOption(CliStrings.ALTER_DISK_STORE__CONCURRENCY__LEVEL, "5"); String commandString = csb.toString(); gfsh.executeAndAssertThat(command, commandString).statusIsError() .containsOutput("Could not find disk-dirs: \"wrongDiskDir"); }</code><technical_language>remove throws IOException thrown method body?</technical_language>

Target:
public void testDirValidation() { CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_DISK_STORE); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKSTORENAME, "diskStoreName"); csb.addOption(CliStrings.ALTER_DISK_STORE__REGIONNAME, "regionName"); csb.addOption(CliStrings.ALTER_DISK_STORE__DISKDIRS, "wrongDiskDir"); csb.addOption(CliStrings.ALTER_DISK_STORE__CONCURRENCY__LEVEL, "5"); String commandString = csb.toString(); gfsh.executeAndAssertThat(command, commandString).statusIsError() .containsOutput("Could not find disk-dirs: \"wrongDiskDir"); }
Source:
<code>public void readExistingIdReturnsTheEvent(EventDao mockedEventDao) throws RecordNotFoundException { <START> long eventId = 1; <END> Event mockedEvent = mock(Event.class); when(mockedEventDao.read(eventId)).thenReturn(mockedEvent); Event result = eventsInteractor.getById(eventId); assertEquals(mockedEvent, result); verify(mockedEventDao, times(1)).read(eventId); }</code><technical_language>Constantes? Suggestion: EVENT_ID ou AN_EVENT_ID</technical_language>

Target:
public void readExistingIdReturnsTheEvent(EventDao mockedEventDao) throws RecordNotFoundException { Event mockedEvent = mock(Event.class); when(mockedEventDao.read(AN_EVENT_ID)).thenReturn(mockedEvent); Event result = eventsInteractor.getById(AN_EVENT_ID); assertEquals(mockedEvent, result); }
Source:
<code>public static <T> T withLocalModeOverride(Callable<T> c, long ttlSec, Map<String, Object> daemonConf) throws Exception { LOG.info("\n\n\t\tSTARTING LOCAL MODE CLUSTER\n\n"); Builder builder = new Builder(); if (daemonConf != null) { builder.withDaemonConf(daemonConf); } try (LocalCluster local = builder.build(); LocalDRPC drpc = new LocalDRPC(local.metricRegistry); DRPCClient.LocalOverride drpcOverride = new DRPCClient.LocalOverride(drpc)) { LOG.info("\n\n\t\tRUNNING LOCAL CLUSTER for seconds.\n\n", ttlSec); Thread.sleep(ttlSec * 1000); LOG.info("\n\n\t\tSTOPPING LOCAL MODE CLUSTER\n\n"); <START> T ret = c.call(); <END> return ret; } }</code><technical_language>This moved, sleep needs happen call</technical_language>

Target:
public static <T> T withLocalModeOverride(Callable<T> c, long ttlSec, Map<String, Object> daemonConf) throws Exception { LOG.info("\n\n\t\tSTARTING LOCAL MODE CLUSTER\n\n"); Builder builder = new Builder(); if (daemonConf != null) { builder.withDaemonConf(daemonConf); } try (LocalCluster local = builder.build(); LocalDRPC drpc = new LocalDRPC(local.metricRegistry); DRPCClient.LocalOverride drpcOverride = new DRPCClient.LocalOverride(drpc)) { T ret = c.call(); LOG.info("\n\n\t\tRUNNING LOCAL CLUSTER for seconds.\n\n", ttlSec); Thread.sleep(ttlSec * 1000); LOG.info("\n\n\t\tSTOPPING LOCAL MODE CLUSTER\n\n"); return ret; } }
Source:
<code>protected void added(Object[] elements) { List<Object> kids = null; boolean changed = false; synchronized (this) { ModelNode[] childrenNodes = getRootNode().getChildrenNodes(); if (childrenNodes == null) { kids = new ArrayList<>(elements.length); } else { kids = new ArrayList<>(elements.length + childrenNodes.length); for (ModelNode <START> childrenNode : <END> childrenNodes) { kids.add(childrenNode.getElement()); } } for (Object element : elements) { if (!kids.contains(element)) { kids.add(element); changed = true; } } } if (changed) { setChildren(getRootNode(), kids); } }</code><technical_language>rename childNode</technical_language>

Target:
protected void added(Object[] elements) { List<Object> kids = null; boolean changed = false; synchronized (this) { ModelNode[] childrenNodes = getRootNode().getChildrenNodes(); if (childrenNodes == null) { kids = new ArrayList<>(elements.length); } else { kids = new ArrayList<>(elements.length + childrenNodes.length); for (ModelNode childNode : childrenNodes) { kids.add(childNode.getElement()); } } for (Object element : elements) { if (!kids.contains(element)) { kids.add(element); changed = true; } } } if (changed) { setChildren(getRootNode(), kids); } }
Source:
<code>public Boolean call() throws Exception { if (DynamicClusterImpl.this.getMembers().isEmpty()) <START> return false; <END> if (Lifecycle.RUNNING != DynamicClusterImpl.this.sensors().get(SERVICE_STATE_ACTUAL)) return false; for (Entity member : DynamicClusterImpl.this.getMembers()) if (Boolean.FALSE.equals(member.sensors().get(SERVICE_UP))) return false; return true; }</code><technical_language>members members up</technical_language>

Target:
public Boolean call() throws Exception { if (DynamicClusterImpl.this.getMembers().isEmpty()) return false; if (Lifecycle.RUNNING != DynamicClusterImpl.this.sensors().get(SERVICE_STATE_ACTUAL)) return false; for (Entity member : DynamicClusterImpl.this.getMembers()) if (!Boolean.TRUE.equals(member.sensors().get(SERVICE_UP))) return false; return true; }
Source:
<code>private synchronized void writeInstanceDataSplit( Sheet sheet, InstanceData instanceData, List<QuestionDto> whichQuestions, MessageDigest md, boolean groupSheet) throws NoSuchAlgorithmException { int startRow = sheet.getLastRowNum() + 1; int maxIter = 0; if (!groupSheet) { maxIter = 1; } for (QuestionDto qd : whichQuestions) { final Long questionId = qd.getKeyId(); SortedMap<Long, String> iterationsMap = instanceData.responseMap.get(questionId); if (iterationsMap != null) { maxIter = Math.max(maxIter, iterationsMap.size()); } } for (int i = 0; i < maxIter; i++) { Row iterationRow = getRow(startRow + i, sheet); writeMetadataRow(iterationRow, instanceData, i + 1, groupSheet); for (QuestionDto qd : whichQuestions) { final Long questionId = qd.getKeyId(); <START> final QuestionDto questionDto = questionsById.get(questionId); <END> SortedMap<Long, String> iterationsMap = instanceData.responseMap.get(questionId); if (iterationsMap == null) { continue; } String val = iterationsMap.get(new Long(i)); if (val != null) { writeAnswer(iterationRow, columnIndexMap.get(questionId.toString()), questionDto, val); } } for (Cell cell : iterationRow) { String val = parseCellAsString(cell); if (val != null && !val.equals("")) { md.update(val.getBytes()); } } } }</code><technical_language>Is questionDto distinctly qd? this retrieval step is redundant</technical_language>

Target:
private synchronized void writeInstanceDataSplit( Sheet sheet, InstanceData instanceData, List<QuestionDto> whichQuestions, MessageDigest md, boolean groupSheet) throws NoSuchAlgorithmException { int startRow = sheet.getLastRowNum() + 1; int maxIter = 0; if (!groupSheet) { maxIter = 1; } for (QuestionDto qd : whichQuestions) { final Long questionId = qd.getKeyId(); SortedMap<Long, String> iterationsMap = instanceData.responseMap.get(questionId); if (iterationsMap != null) { maxIter = Math.max(maxIter, iterationsMap.size()); } } for (int i = 0; i < maxIter; i++) { Row iterationRow = getRow(startRow + i, sheet); writeMetadataRow(iterationRow, instanceData, i + 1, groupSheet); for (QuestionDto qd : whichQuestions) { final Long questionId = qd.getKeyId(); SortedMap<Long, String> iterationsMap = instanceData.responseMap.get(questionId); if (iterationsMap == null) { continue; } String val = iterationsMap.get(Long.valueOf(i)); if (val != null) { writeAnswer(iterationRow, columnIndexMap.get(questionId.toString()), qd, val); } } for (Cell cell : iterationRow) { String val = parseCellAsString(cell); if (val != null && !val.equals("")) { md.update(val.getBytes()); } } } }
Source:
<code>private boolean validateImagesAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { Guid imageGroupId = image.getId() != null ? image.getId() : Guid.Empty; if (!validateImageAvailability(image, imageGroupId)) { if (!getParameters().isAllowPartialImport()) { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } log.warn("Disk image '{}/{}' doesn't exist on any of its storage domains. " + "Ignoring since the 'Allow Partial' flag <START> in on", <END> imageGroupId, image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } } return true; }</code><technical_language>/s/in/is</technical_language>

Target:
private boolean validateImagesAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { Guid imageGroupId = image.getId() != null ? image.getId() : Guid.Empty; if (!validateImageAvailability(image, imageGroupId)) { if (!getParameters().isAllowPartialImport()) { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } log.warn("Disk image '{}/{}' doesn't exist on any of its storage domains. " + "Ignoring since the 'Allow Partial' flag is on", imageGroupId, image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } } return true; }
Source:
<code>protected void executeVdsBrokerCommand() { Guid sessionId = getParameters().getSessionId(); GlusterGeoRepDao geoRepDao = DbFacade.getInstance().getGlusterGeoRepDao(); List<GlusterGeoRepSessionConfiguration> existingSessionConfigs = geoRepDao.getGeoRepSessionConfig(sessionId); GlusterGeoRepSession session = geoRepDao.getById(sessionId); result = getBroker().glusterVolumeGeoRepConfigList(session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName()); proceedProxyReturnValue(); List<GlusterGeoRepSessionConfiguration> sessionConfigs = result.getSessionConfig(); <START> if (!existingSessionConfigs.containsAll(sessionConfigs)) { <END> for (GlusterGeoRepSessionConfiguration geoRepSessionConfig : sessionConfigs) { if (!existingSessionConfigs.contains(geoRepSessionConfig)) { if (prepareMapOfExistingConfigs(existingSessionConfigs).containsKey(geoRepSessionConfig.getKey())) { geoRepDao.updateConfig(geoRepSessionConfig); } else { geoRepDao.saveConfig(geoRepSessionConfig); } } } } setReturnValue(sessionConfigs); }</code><technical_language>Do want update database while retrieving this data here? leave sync job</technical_language>

Target:
protected void executeVdsBrokerCommand() { result = getBroker().glusterVolumeGeoRepConfigList(getParameters().getVolumeName(), getParameters().getSlaveHost(), getParameters().getSlaveVolume()); proceedProxyReturnValue(); List<GlusterGeoRepSessionConfiguration> sessionConfigs = result.getSessionConfig(); setReturnValue(sessionConfigs); }
Source:
<code>public void begin (int n) { if (n >= passShaderProviders.length) throw new GdxRuntimeException("Pass " + n + " doesn't exist in " + getClass().getName()); currentPass = n; spotCameraIterator = spotCameras.iterator(); <START> spotCameraIterator.reset(); <END> dirCameraIterator = dirCameras.iterator(); dirCameraIterator.reset(); pointCameraIterator = pointCameras.iterator(); pointCameraIterator.reset(); currentPointSide = 6; frameBuffers[n].begin(); beginPass(n); }</code><technical_language>Calling iterator method resets it, need of methods</technical_language>

Target:
public void begin (int n) { if (n >= passShaderProviders.length) throw new GdxRuntimeException("Pass " + n + " doesn't exist in " + getClass().getName()); currentPass = n; spotCameraIterator = spotCameras.iterator(); dirCameraIterator = dirCameras.iterator(); pointCameraIterator = pointCameras.iterator(); currentPointSide = 6; beginPass(n); }
Source:
<code>public synchronized boolean remove(String key) throws IOException { checkNotClosed(); validateKey(key); Entry entry = lruEntries.get(key); if (entry == null || entry.currentEditor != null) { return false; } for (int i = 0; i < valueCount; i++) { File file = entry.getCleanFile(i); boolean fileExisted = file.exists(); <START> if (fileExisted && !file.delete()) { <END> throw new IOException("failed to delete " + file); } size -= entry.lengths[i]; entry.lengths[i] = 0; } redundantOpCount++; journalWriter.append(REMOVE + ' ' + key + '\n'); lruEntries.remove(key); if (journalRebuildRequired()) { executorService.submit(cleanupCallable); } return true; }</code><technical_language>this if (file.exists() && !file.delete()) for cleanliness</technical_language>

Target:
public synchronized boolean remove(String key) throws IOException { checkNotClosed(); validateKey(key); Entry entry = lruEntries.get(key); if (entry == null || entry.currentEditor != null) { return false; } for (int i = 0; i < valueCount; i++) { File file = entry.getCleanFile(i); if (file.exists() && !file.delete()) { throw new IOException("failed to delete " + file); } size -= entry.lengths[i]; entry.lengths[i] = 0; } redundantOpCount++; journalWriter.append(REMOVE + ' ' + key + '\n'); lruEntries.remove(key); if (journalRebuildRequired()) { executorService.submit(cleanupCallable); } return true; }
Source:
<code>public PropertyKey cloudConfig() { return new PropertyKey(CONFIGS, ConfigScopeProperty.CLOUD, CloudConfig.class, <START> _clusterName, ConfigScopeProperty.CLOUD.toString(), _clusterName); <END> }</code><technical_language>Dont toString(). convention enum's name() function. please change previous one</technical_language>

Target:
public PropertyKey cloudConfig() { return new PropertyKey(CONFIGS, ConfigScopeProperty.CLOUD, CloudConfig.class, _clusterName, ConfigScopeProperty.CLOUD.name(), _clusterName); }
Source:
<code>public Observable<Throwable> postErrorObservable(){ <START> return this.postSucces.compose(ResponseOrError.<Response>onlyError()); <END> }</code><technical_language>"this." is unecessary</technical_language>

Target:
public Observable<Throwable> postErrorObservable() { return postErrorSubject; }
Source:
<code>static BlobId getBlobIdFromString(String blobIdString, ClusterMap clusterMap) throws RouterException { <START> if (blobIdString == null || blobIdString.length() == 0) { <END> logger.error("BlobIdString argument is null or zero length: {}", blobIdString); throw new RouterException("BlobId is empty.", RouterErrorCode.InvalidBlobId); } BlobId blobId; try { blobId = new BlobId(blobIdString, clusterMap); logger.trace("BlobId created " + blobId + " with partition " + blobId.getPartition()); } catch (Exception e) { logger.error("Caller passed in invalid BlobId " + blobIdString); throw new RouterException("BlobId is invalid " + blobIdString, RouterErrorCode.InvalidBlobId); } return blobId; }</code><technical_language>get rid of if block actually, this check is care of BlobId constructor hare handling exception anyway</technical_language>

Target:
static BlobId getBlobIdFromString(String blobIdString, ClusterMap clusterMap) throws RouterException { BlobId blobId; try { blobId = new BlobId(blobIdString, clusterMap); logger.trace("BlobId created " + blobId + " with partition " + blobId.getPartition()); } catch (Exception e) { logger.error("Caller passed in invalid BlobId " + blobIdString); throw new RouterException("BlobId is invalid " + blobIdString, RouterErrorCode.InvalidBlobId); } return blobId; }
Source:
<code>protected String[] getTransformedSelection() { <START> System.out.println(this.selectionStateMap); <END> List<String> selectedItems = new ArrayList<String>(); for (String item : this.selectionStateMap.keySet()) { Boolean isSelected = this.selectionStateMap.get(item); if (isSelected != null && isSelected) { selectedItems.add(item); } } return selectedItems.toArray(new String[selectedItems.size()]); }</code><technical_language>Please remove System.out calls code</technical_language>

Target:
protected String[] getTransformedSelection() { List<String> selectedItems = new ArrayList<String>(); for (String item : this.selectionStateMap.keySet()) { Boolean isSelected = this.selectionStateMap.get(item); if (isSelected != null && isSelected) { selectedItems.add(item); } } return selectedItems.toArray(new String[selectedItems.size()]); }
Source:
<code>private static String convertHost(final String host) { if (host == null) { return null; <START> } <END> return stripDotSuffix(host).toUpperCase(); }</code><technical_language>Please ? ternary operator</technical_language>

Target:
private static String convertHost(final String host) { return host != null ? stripDotSuffix(host).toUpperCase() : null; }
Source:
<code>public void testParse() { <START> assertEquals("1.6", parse("git/1.6.6-rc0")); <END> assertEquals("1.6.6", parse("git/1.6.6")); assertEquals("1.7.5", parse("git/1.7.5.GIT")); assertEquals("1.7.6.1", parse("git/1.7.6.1.45.gbe0cc")); assertEquals("1.5.4.3", parse("git/1.5.4.3,gzip(proxy)")); assertEquals("1.7.0.2", parse("git/1.7.0.2.msysgit.0.14.g956d7,gzip")); assertEquals("1.7.10.2", parse("git/1.7.10.2 (Apple Git-33)")); assertEquals(ClientVersionUtil.toString(invalidVersion()), parse("foo")); }</code><technical_language>Um, surely 1.6.6 is closer 1.6.5 is 1.6</technical_language>

Target:
public void testParse() { assertEquals("1.6.5", parseVersion("git/1.6.6-rc0")); assertEquals("1.6.6", parseVersion("git/1.6.6")); assertEquals("1.7.5", parseVersion("git/1.7.5.GIT")); assertEquals("1.7.6.1", parseVersion("git/1.7.6.1.45.gbe0cc")); assertEquals("1.5.4.3", parseVersion("git/1.5.4.3,gzip(proxy)")); assertEquals("1.7.0.2", parseVersion("git/1.7.0.2.msysgit.0.14.g956d7,gzip")); assertEquals("1.7.10.2", parseVersion("git/1.7.10.2 (Apple Git-33)")); assertEquals(ClientVersionUtil.toString(invalidVersion()), parseVersion("foo")); }
Source:
<code>private void verifyFileStatus(FileStatus[] listResult, Path parentPath, int startIndexInSortedName) throws IOException { if (startIndexInSortedName == -1) { Assert.assertTrue("Expected empty FileStatus array", listResult.length == 0); return; } FileStatus[] allFileStatuses = fs.listStatus(parentPath); <START> Assert.assertTrue("number of dir/file doesn't match", <END> allFileStatuses.length == SORTED_ENTRY_NAMES.length); int indexInResult = 0; for (int index = startIndexInSortedName; index < SORTED_ENTRY_NAMES.length; index++) { Assert.assertEquals("fileStatus doesn't match", allFileStatuses[index], listResult[indexInResult++]); } }</code><technical_language>assertEquals()</technical_language>

Target:
private void verifyFileStatus(FileStatus[] listResult, Path parentPath, int startIndexInSortedName) throws IOException { if (startIndexInSortedName == -1) { Assert.assertEquals("Expected empty FileStatus array", 0, listResult.length); return; } FileStatus[] allFileStatuses = fs.listStatus(parentPath); Assert.assertEquals("number of dir/file doesn't match", SORTED_ENTRY_NAMES.length, allFileStatuses.length); int indexInResult = 0; for (int index = startIndexInSortedName; index < SORTED_ENTRY_NAMES.length; index++) { Assert.assertEquals("fileStatus doesn't match", allFileStatuses[index], listResult[indexInResult++]); } }
Source:
<code>private static void checkPort(int port, AddressFamily addrFamily) { switch (addrFamily) { case AF_IPv6: case AF_IPv4: if (port < 0 || port > 65535) { <START> throw new IllegalArgumentException("invalid port: " + port + " (expected: 1 ~ 65535)"); <END> } break; case AF_UNIX: case AF_UNSPEC: if (port != 0) { throw new IllegalArgumentException("port cannot be specified with addrFamily: " + addrFamily); } break; default: throw new IllegalArgumentException("unexpected addrFamily: " + addrFamily); } }</code><technical_language>nit: PRs fault if statement is incorrect exception message in terms of allowed port range</technical_language>

Target:
private static void checkPort(int port, AddressFamily addrFamily) { switch (addrFamily) { case AF_IPv6: case AF_IPv4: if (port < 0 || port > 65535) { throw new IllegalArgumentException("invalid port: " + port + " (expected: 0 ~ 65535)"); } break; case AF_UNIX: case AF_UNSPEC: if (port != 0) { throw new IllegalArgumentException("port cannot be specified with addrFamily: " + addrFamily); } break; default: throw new IllegalArgumentException("unexpected addrFamily: " + addrFamily); } }
Source:
<code>private static String encodeChunk(String value, Charset charset, boolean allowReserved) { if (isEncoded(value, charset)) { return value; } byte[] data = value.getBytes(charset); try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { for (byte b : data) { if (isUnreserved((char) b)) { bos.write(b); } else if (isReserved((char) b) && allowReserved) { bos.write(b); } else { pctEncode(b, bos); } } <START> return new String(bos.toByteArray()); <END> } catch (IOException ioe) { throw new IllegalStateException("Error occurred during encoding of the uri: " + ioe.getMessage(), ioe); } }</code><technical_language>include a charset creating string</technical_language>

Target:
private static String encodeChunk(String value, Charset charset, boolean allowReserved) { if (isEncoded(value, charset)) { return value; } byte[] data = value.getBytes(charset); try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { for (byte b : data) { if (isUnreserved((char) b)) { bos.write(b); } else if (isReserved((char) b) && allowReserved) { bos.write(b); } else { pctEncode(b, bos); } } return new String(bos.toByteArray(), charset); } catch (IOException ioe) { throw new IllegalStateException("Error occurred during encoding of the uri: " + ioe.getMessage(), ioe); } }
Source:
<code>public void activate() { super.activate(); <START> diagram = (Diagram) ((GraphicalEditPart) getHost()).getNotationView().getElement(); <END> previewImage = DiagramRenderUtil.renderToSWTImage(diagram); }</code><technical_language>Check for NPEs, especially activation of Edit Policy: if wrong (during initialization), entire diagram crash</technical_language>

Target:
public void activate() { super.activate(); if (getHost() instanceof GraphicalEditPart) { if (((GraphicalEditPart) getHost()).getNotationView() != null && ((GraphicalEditPart) getHost()).getNotationView().getElement() instanceof Diagram) { diagram = (Diagram) ((GraphicalEditPart) getHost()).getNotationView().getElement(); } try { previewImage = DiagramRenderUtil.renderToSWTImage(diagram); } catch(Exception e) { Activator.log.error(e); } } }
Source:
<code>public static long xxHash64(@SqlType(StandardTypes.TINYINT) long value) { <START> return XxHash64.hash((byte) value); <END> }</code><technical_language>do unpack for inequality operators. of i assume assumption is higher bits zero (or same). i downcast byte is needed here</technical_language>

Target:
public static long xxHash64(@SqlType(StandardTypes.TINYINT) long value) { return XxHash64.hash(value); }
Source:
<code>public void onBannerFailedToLoad(BannerView bannerView, BannerErrorInfo bannerErrorInfo) { if(bannerErrorInfo.errorCode == BannerErrorCode.NO_FILL){ Log.e(TAG, "Unity Ads Banner returned NO FILL"); } else { <START> Log.e(TAG, "Unity Ads Banner encountered an error: " + bannerErrorInfo.errorMessage); <END> } }</code><technical_language>need if here. I NO_FILL fine. logs warnings publisher that</technical_language>

Target:
public void onBannerFailedToLoad(BannerView bannerView, BannerErrorInfo bannerErrorInfo) { Log.w(TAG, "Unity Ads Banner encountered an error: " + bannerErrorInfo.errorMessage); if (bannerErrorInfo.errorCode == BannerErrorCode.NO_FILL) { bannerListener.onAdFailedToLoad(UnityAdapter.this, AdRequest.ERROR_CODE_NO_FILL); } else { bannerListener.onAdFailedToLoad(UnityAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } }
Source:
<code>public Builder axonFrameworkVersionResolver(Supplier<String> axonFrameworkVersionResolver) { <START> assertNonNull(axonFrameworkVersionResolver, "AxonConnectorProperties may not be null"); <END> this.axonFrameworkVersionResolver = axonFrameworkVersionResolver; return this; }</code><technical_language>message added AxonConfigurationException is incorrect, states AxonConnectorProperties this is a Supplier of String verification</technical_language>

Target:
public Builder axonFrameworkVersionResolver(Supplier<String> axonFrameworkVersionResolver) { assertNonNull(axonFrameworkVersionResolver, "Axon Framework Version Resolver may not be null"); this.axonFrameworkVersionResolver = axonFrameworkVersionResolver; return this; }
Source:
<code>public int run() throws Exception { SitePaths sitePaths = new SitePaths(getSitePath()); File newSecureStoreFile = new File(newSecureStoreLib); if (!newSecureStoreFile.exists()) { throw new RuntimeException(String.format("File %s doesn't exists", newSecureStoreFile.getAbsolutePath())); } String newSecureStore = <START> getNewSecureStore(newSecureStoreFile); <END> String currentSecureStoreName = getCurrentSecureStoreName(sitePaths); if (currentSecureStoreName.equals(newSecureStore)) { log.error("Old and new SecureStore implementation names are the same. Migration will not work"); return -1; } IoUtil.loadJARs(newSecureStoreFile); SiteLibraryLoaderUtil.loadSiteLib(sitePaths.lib_dir); Injector dbInjector = createDbInjector(SINGLE_USER); SecureStore currentStore = getSecureStore(currentSecureStoreName, dbInjector); SecureStore newStore = getSecureStore(newSecureStore, dbInjector); migrateProperties(currentStore, newStore); removeOldLib(sitePaths, currentSecureStoreName); copyNewLib(sitePaths, newSecureStoreFile); updateGerritConfig(sitePaths, newSecureStore); return 0; }</code><technical_language>getNewSecureStoreClassName()</technical_language>

Target:
public int run() throws Exception { SitePaths sitePaths = new SitePaths(getSitePath()); File newSecureStoreFile = new File(newSecureStoreLib); if (!newSecureStoreFile.exists()) { throw new RuntimeException(String.format("File %s doesn't exists", newSecureStoreFile.getAbsolutePath())); } String newSecureStore = getNewSecureStoreClassName(newSecureStoreFile); String currentSecureStoreName = getCurrentSecureStoreClassName(sitePaths); if (currentSecureStoreName.equals(newSecureStore)) { log.error("Old and new SecureStore implementation names are the same. Migration will not work"); return -1; } IoUtil.loadJARs(newSecureStoreFile); SiteLibraryLoaderUtil.loadSiteLib(sitePaths.lib_dir); log.info("Current secureStoreClass property ({}) will be replaced with {}", currentSecureStoreName, newSecureStore); Injector dbInjector = createDbInjector(SINGLE_USER); SecureStore currentStore = getSecureStore(currentSecureStoreName, dbInjector); SecureStore newStore = getSecureStore(newSecureStore, dbInjector); migrateProperties(currentStore, newStore); removeOldLib(sitePaths, currentSecureStoreName); copyNewLib(sitePaths, newSecureStoreFile); updateGerritConfig(sitePaths, newSecureStore); return 0; }
Source:
<code>public void test() { RemoteService remoteService = RemoteService.getRemoteService(); long result = remoteService.doRemoteFunction(10); <START> assert result == 100 || result == -1; <END> }</code><technical_language>this assertion</technical_language>

Target:
public void test() { long result = RemoteService.getRemoteService().doRemoteFunction(10); assert result == 100 || result == -1; }
Source:
<code>public boolean conflictExist(Project firstProject, Project secondProject) { List<UserList> globalListConflict = getGlobalListConflicts(firstProject, secondProject); <START> List<UserVariable> globalVariableConflict = getGlobalVariableConflicts(firstProject, secondProject); <END> if (!globalListConflict.isEmpty() || !globalVariableConflict.isEmpty()) { return true; } return false; }</code><technical_language>if globalListConflict exists (not empty) need do process for globalVariables</technical_language>

Target:
public boolean conflictExist(Project firstProject, Project secondProject) { return (getGlobalListConflicts(firstProject.getUserLists(), secondProject.getUserLists()) || getGlobalVariableConflicts(firstProject.getUserVariables(), secondProject.getUserVariables())); }
Source:
<code>public void isTestMode_shouldReturnTrueIfFunctionalTestModeIsEnabled() { <START> System.setProperty("FUNCTIONAL_TEST_MODE", Boolean.toString(true)); <END> assertTrue(OpenmrsUtil.isTestMode()); }</code><technical_language>is "true" sufficient? dont need Boolean.toString for</technical_language>

Target:
public void isTestMode_shouldReturnTrueIfFunctionalTestModeIsEnabled() { System.setProperty("FUNCTIONAL_TEST_MODE", "true"); assertTrue(OpenmrsUtil.isTestMode()); }
Source:
<code><START> public DefaultLightblueMetadataResponse metadata(LightblueRequest lightblueRequest) throws LightblueParseException, LightblueResponseException, LightblueHttpClientException { <END> LOGGER.debug("Calling metadata service with lightblueRequest: {}", lightblueRequest.toString()); return new DefaultLightblueMetadataResponse( callService(lightblueRequest, configuration.getMetadataServiceURI()), mapper); }</code><technical_language>LightblueException? In cases care failed, easier catch exception. catch more specific if want</technical_language>

Target:
public DefaultLightblueMetadataResponse metadata(LightblueRequest lightblueRequest) throws LightblueParseException, LightblueResponseException, LightblueHttpClientException, LightblueException { LOGGER.debug("Calling metadata service with lightblueRequest: {}", lightblueRequest.toString()); return new DefaultLightblueMetadataResponse( callService(lightblueRequest, configuration.getMetadataServiceURI()), mapper); }
Source:
<code>public String[] getSupportedExtensions() { <START> return new String[] { "aiff", "aif" }; <END> }</code><technical_language>I continue **aifc** here..</technical_language>

Target:
public String[] getSupportedExtensions() { return new String[] { "aif", "aiff", "aifc" }; }
Source:
<code>private void parseFileInfo(Lexer lexer) throws AbsentInformationException { int lexemType = lexer.lexemType(); switch (lexemType) { case Lexer.NUMBER: <START> { <END> int fileId = integerValue(lexer.lexem()); if (isAsteriskLexem(lexer.nextLexem())) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_16); } fCurrentStratum.addFileInfo(fileId, getNonAsteriskString(lexer)); break; } case Lexer.PLUS: { if (lexer.nextLexem() != Lexer.NUMBER) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_17); } int fileId = integerValue(lexer.lexem()); if (isAsteriskLexem(lexer.nextLexem())) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_16); } String fileName = getNonAsteriskString(lexer); if (isAsteriskLexem(lexer.lexemType())) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_19); } fCurrentStratum.addFileInfo(fileId, fileName, getNonAsteriskString(lexer)); break; } default: throw new AbsentInformationException(NLS.bind( JDIMessages.SourceDebugExtensionParser_12, new String[] { new String(lexer.lexem()) })); } }</code><technical_language>introducing blocks</technical_language>

Target:
private void parseFileInfo(Lexer lexer) throws AbsentInformationException { int lexemType = lexer.lexemType(); switch (lexemType) { case Lexer.NUMBER: int fileId = integerValue(lexer.lexem()); if (isAsteriskLexem(lexer.nextLexem())) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_16); } fCurrentStratum.addFileInfo(fileId, getNonAsteriskString(lexer)); break; case Lexer.PLUS: if (lexer.nextLexem() != Lexer.NUMBER) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_17); } fileId = integerValue(lexer.lexem()); if (isAsteriskLexem(lexer.nextLexem())) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_16); } String fileName = getNonAsteriskString(lexer); if (isAsteriskLexem(lexer.lexemType())) { throw new AbsentInformationException( JDIMessages.SourceDebugExtensionParser_19); } fCurrentStratum.addFileInfo(fileId, fileName, getNonAsteriskString(lexer)); break; default: throw new AbsentInformationException(NLS.bind(JDIMessages.SourceDebugExtensionParser_12, new String[] { new String(lexer.lexem()) })); } }
Source:
<code>static public void addQueryParams(final StringBuilder urlString, final Map<String, String[]> requestParams) throws UnsupportedEncodingException { if (requestParams == null) return; boolean first = true; <START> if (urlString.indexOf("?") > 0) { <END> first = false; } for (Map.Entry<String, String[]> e : requestParams.entrySet()) { final String name = e.getKey(); final String[] vals = e.getValue(); if (vals == null) { urlString.append(first ? "?" : "&"); first = false; urlString.append(URLEncoder.encode(name, RemoteRepository.UTF8)); } else { for (String val : vals) { urlString.append(first ? "?" : "&"); first = false; urlString.append(URLEncoder.encode(name, RemoteRepository.UTF8)); urlString.append("="); if(val!=null) urlString.append(URLEncoder.encode(val, RemoteRepository.UTF8)); } } } }</code><technical_language>technically question mark present char position. method is public static, this case covered indexOf("?") >= 0. This some point if urlString contains empty relative path</technical_language>

Target:
static public void addQueryParams(final StringBuilder urlString, final Map<String, String[]> requestParams) throws UnsupportedEncodingException { if (requestParams == null) return; boolean first = true; if (urlString.indexOf("?") >= 0) { first = false; } for (Map.Entry<String, String[]> e : requestParams.entrySet()) { final String name = e.getKey(); final String[] vals = e.getValue(); if (vals == null) { urlString.append(first ? "?" : "&"); first = false; urlString.append(URLEncoder.encode(name, RemoteRepository.UTF8)); } else { for (String val : vals) { urlString.append(first ? "?" : "&"); first = false; urlString.append(URLEncoder.encode(name, RemoteRepository.UTF8)); urlString.append("="); if(val!=null) urlString.append(URLEncoder.encode(val, RemoteRepository.UTF8)); } } } }
Source:
<code>public void testTagDelete() throws Exception { git.tag().setName("test").call(); <START> assertTrue(getTags().filter(r -> r.getName().equals("refs/tags/test")) <END> .findAny().isPresent()); assertEquals("", executeUnchecked("git tag -d test")[0]); assertFalse(getTags().filter(r -> r.getName().equals("refs/tags/test")) .findAny().isPresent()); }</code><technical_language>optional: exactRef</technical_language>

Target:
public void testTagDelete() throws Exception { git.tag().setName("test").call(); assertNotNull(git.getRepository().exactRef("refs/tags/test")); assertEquals("", executeUnchecked("git tag -d test")[0]); assertNull(git.getRepository().exactRef("refs/tags/test")); }
Source:
<code>public static SessionMap create(Config config) { Tracer tracer = new LoggingOptions(config).getTracer(); SessionMapOptions sessionMapOptions = new SessionMapOptions(config); String tableName = sessionMapOptions.getJdbcTableName(); Connection connection = null; try { connection = sessionMapOptions.getJdbcConnection(); <START> } catch (SQLException e) { <END> } return new JdbcBackedSessionMap(tracer, connection, tableName); }</code><technical_language>Require.nonNull method ensure set properly</technical_language>

Target:
public static SessionMap create(Config config) { Tracer tracer = new LoggingOptions(config).getTracer(); EventBus bus = new EventBusOptions(config).getEventBus(); JdbcSessionMapOptions sessionMapOptions = new JdbcSessionMapOptions(config); Connection connection; try { connection = sessionMapOptions.getJdbcConnection(); } catch (SQLException e) { throw new ConfigException(e); } return new JdbcBackedSessionMap(tracer, connection, bus); }
Source:
<code>public void cleanup( final CommandContext commandContext, final Config state) throws IOException { final TaskRequest request = commandContext.getTaskRequest(); final long attemptId = request.getAttemptId(); final long taskId = request.getTaskId(); final Config taskConfig = request.getConfig(); final ObjectNode commandStatus = state.get("commandStatus", ObjectNode.class); final String clusterName = commandStatus.get("cluster_name").asText(); final String taskArn = commandStatus.get("task_arn").asText(); final EcsClientConfig clientConfig = createEcsClientConfig(Optional.of(clusterName), systemConfig, taskConfig); try (final EcsClient client = ecsClientFactory.createClient(clientConfig)) { final Task task; try { task = client.getTask(clusterName, taskArn); } catch (TaskSetNotFoundException e) { final String message = s("Cannot get the ECS task status. attemptId=%d, taskId=%d", attemptId, taskId); logger.warn(message); throw new TaskExecutionException(message); } <START> final String message = s("Command task execution cancel requested: attemptId=%d, taskId=%d", attemptId, taskId); <END> logger.info(message); logger.debug(s("Stop command task %s", task.getTaskArn())); client.stopTask(clusterName, task.getTaskArn()); throw new TaskExecutionException(message); } }</code><technical_language>responsibility of this method is cleaning a task cancel requests related this method, I think. This method non-cancel operation in future. this message mention cancel requests</technical_language>

Target:
public void cleanup( final CommandContext commandContext, final Config state) throws IOException { final TaskRequest request = commandContext.getTaskRequest(); final long attemptId = request.getAttemptId(); final long taskId = request.getTaskId(); final Config taskConfig = request.getConfig(); final ObjectNode commandStatus = state.get("commandStatus", ObjectNode.class); final String clusterName = commandStatus.get("cluster_name").asText(); final String taskArn = commandStatus.get("task_arn").asText(); final EcsClientConfig clientConfig = createEcsClientConfig(Optional.of(clusterName), systemConfig, taskConfig); try (final EcsClient client = ecsClientFactory.createClient(clientConfig)) { final Task task = client.getTask(clusterName, taskArn); final String message = s("Command task execution will be stopped: attempt_id=%d, task_id=%d", attemptId, taskId); logger.info(message); logger.debug(s("Stop command task: %s", task.getTaskArn())); client.stopTask(clusterName, task.getTaskArn()); } }
Source:
<code>private void initializeContainmentInput(EObject eObject, EReference eContainementReference) { List<Object> values = new ArrayList<>(); Adapter adapter = this.composedAdapterFactory.adapt(eObject, IEditingDomainItemProvider.class); if (adapter instanceof IEditingDomainItemProvider) { IEditingDomainItemProvider itemProviderAdapter = (IEditingDomainItemProvider) adapter; Collection<?> newChildDescriptors = itemProviderAdapter.getNewChildDescriptors(eObject, this.editingContextAdapter.getEditingDomain(), null); for (Object newChildDescriptor : newChildDescriptors) { if (newChildDescriptor instanceof CommandParameter) { CommandParameter commandParameter = (CommandParameter) newChildDescriptor; if <START> (this.eReference.getEReferenceType().isSuperTypeOf(commandParameter.getEReference().getEReferenceType())) <END> { values.add(commandParameter.getValue()); } } } } this.eClassInstanceComboViewer.setInput(values); if (values.size() > 0) { this.eClassInstanceComboViewer.setSelection(new StructuredSelection(values.get(0))); } else { this.eClassInstanceComboViewer.setSelection(new StructuredSelection()); } }</code><technical_language>Inverse order</technical_language>

Target:
private void initializeContainmentInput(EObject eObject, EReference eContainementReference) { List<Object> values = new ArrayList<>(); Adapter adapter = this.composedAdapterFactory.adapt(eObject, IEditingDomainItemProvider.class); if (adapter instanceof IEditingDomainItemProvider) { IEditingDomainItemProvider itemProviderAdapter = (IEditingDomainItemProvider) adapter; Collection<?> newChildDescriptors = itemProviderAdapter.getNewChildDescriptors(eObject, this.editingContextAdapter.getEditingDomain(), null); for (Object newChildDescriptor : newChildDescriptors) { if (newChildDescriptor instanceof CommandParameter) { CommandParameter commandParameter = (CommandParameter) newChildDescriptor; Object value = commandParameter.getValue(); if (commandParameter.getEReference().equals(eContainementReference) && value instanceof EObject && this.eReference.getEReferenceType().isSuperTypeOf(((EObject) value).eClass())) { values.add(commandParameter.getValue()); } } } } this.eClassInstanceComboViewer.setInput(values); if (values.size() > 0) { this.eClassInstanceComboViewer.setSelection(new StructuredSelection(values.get(0))); } else { this.eClassInstanceComboViewer.setSelection(new StructuredSelection()); } }
Source:
<code>public CurrentUserPopupPanel(Account account, boolean canLogOut) { super( true, false); setWidget(binder.createAndBindUi(this)); if (account.getFullName() != null) { userName.setText(account.getFullName()); } if (account.getPreferredEmail() != null) { userEmail.setText(account.getPreferredEmail()); } <START> settings.setHref(PageLinks.SETTINGS); <END> if (!canLogOut) { logout.setVisible(false); } else { logout.setHref(Gerrit.selfRedirect("/logout")); } }</code><technical_language>I figured out do this :-) import static field this: <ui:import field='com.google.gerrit.common.PageLinks.SETTINGS'/> add href='{SETTINGS}' g:Anchor tag ..</technical_language>

Target:
public CurrentUserPopupPanel(Account account, boolean canLogOut) { super( true, false); setWidget(binder.createAndBindUi(this)); setStyleName(Gerrit.RESOURCES.css().userInfoPopup()); if (account.getFullName() != null) { userName.setText(account.getFullName()); } if (account.getPreferredEmail() != null) { userEmail.setText(account.getPreferredEmail()); } if (!canLogOut) { logout.setVisible(false); } else { logout.setHref(Gerrit.selfRedirect("/logout")); } }
Source:
<code>private LayoutParams calculateLayoutParams(Boolean isInline, Boolean showAsSwitcher) { <START> if (showAsSwitcher && !isInline) { <END> return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); } else { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1.0f); } }</code><technical_language>extract local variable layoutparam</technical_language>

Target:
private LayoutParams calculateLayoutParams(Boolean isInline, Boolean showAsSwitcher) { LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); if (!showAsSwitcher || isInline) { layoutParams.width = LayoutParams.WRAP_CONTENT; layoutParams.weight = 1.0f; } return layoutParams; }
Source:
<code>public InputStream interpretResponseStream(@Nullable InputStream responseStream) { throwIfNoConnection(); if (isStethoEnabled()) { String contentEncoding = mConnection.getHeaderField("Content-Encoding"); responseStream = mStethoHook.interpretResponseStream( getStethoRequestId(), mConnection.getHeaderField("Content-Type"), contentEncoding, responseStream, contentEncoding != null ? <START> new ContentLengthResponseHandler( <END> mStethoHook, getStethoRequestId(), mConnection.getContentLength()) : new DefaultResponseHandler(mStethoHook, getStethoRequestId())); } return responseStream; }</code><technical_language>want ContentLengthResponseHandler contentEncoding is null</technical_language>

Target:
public InputStream interpretResponseStream(@Nullable InputStream responseStream) { throwIfNoConnection(); if (isStethoEnabled()) { responseStream = mStethoHook.interpretResponseStream( getStethoRequestId(), mConnection.getHeaderField("Content-Type"), mConnection.getHeaderField("Content-Encoding"), responseStream, new DefaultResponseHandler(mStethoHook, getStethoRequestId())); } return responseStream; }
Source:
<code>public void mercury_search_navigateUsingSearchSuggestionsOnDesktop() { String clickedSuggestion = new ArticlePage() <START> .open("/d/") <END> .getTopBar() .openSearch() .typeInSearch(SEARCH_PHRASE) .clickSearchSuggestion(0); Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.OASIS)); Assertion.assertEquals(clickedSuggestion.toLowerCase(), new ArticlePageObject().getArticleName().toLowerCase()); }</code><technical_language>This "/d/" is making this descriptive knowledge of URL structure. I suggest create a method openDiscussions(), - - a new Page object for discussions</technical_language>

Target:
public void mercury_search_navigateUsingSearchSuggestionsOnDesktop() { String clickedSuggestion = new DiscussionsPage() .getTopBar() .openSearch() .typeInSearch(SEARCH_PHRASE) .clickSearchSuggestion(0); Assertion.assertTrue(new SkinHelper(driver).isSkin(Skin.OASIS)); Assertion.assertEquals(clickedSuggestion.toLowerCase(), new ArticlePageObject().getArticleName().toLowerCase()); }
Source:
<code>private Cluster getClusterWithAuthenticationToken(OAuth2AuthenticationToken authentication) { OAuth2AuthorizedClient authorizedClient = getAuthorizedClient(authentication); <START> if (isExpired(authorizedClient.getAccessToken())) { <END> return reconnectedClusterForExpiredClient(authentication, authorizedClient); } return getClusterWithAuthorizedClient(authorizedClient); }</code><technical_language>wondering flow is better. get rid of reconnectToGemfire method in Cluster. suggestion String userName = authorizedClient.getPrincipalName(); if (isExpired(authorizedClient.getAccessToken())) { logoutUser(userName); authorizedClient = refreshExpiredClient(authentication, authorizedClient); } userName = authorizedClient.getPrincipalName(); String credentials = authorizedClient.getAccessToken().getTokenValue(); return getClusterWithCredentials(userName, credentials);</technical_language>

Target:
private Cluster getClusterWithAuthenticationToken(OAuth2AuthenticationToken authentication) { OAuth2AuthorizedClient authorizedClient = getAuthorizedClient(authentication); if (isExpired(authorizedClient.getAccessToken())) { return reconnectedClusterForExpiredClient(authentication, authorizedClient); } String credentials = authorizedClient.getAccessToken().getTokenValue(); String subject = getSubject(authentication); return getClusterWithCredentials(subject, credentials); }
Source:
<code><START> Axis(final Vector3d vector3d) { <END> this.direction = vector3d; }</code><technical_language>Why</technical_language>

Target:
private Axis(final Vector3d vector3d) { this.direction = vector3d; }