auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected List<Brick> setupDataCategoryList(Context context) { List<Brick> dataBrickList = new ArrayList<>(); dataBrickList.add(new SetVariableBrick(BrickValues.SET_VARIABLE)); dataBrickList.add(new ChangeVariableBrick(BrickValues.CHANGE_VARIABLE)); dataBrickList.add(new ShowTextBrick(BrickValues.X_POSITION, BrickValues.Y_POSITION)); dataBrickList.add(new ShowTextColorSizeAlignmentBrick(BrickValues.X_POSITION, BrickValues.Y_POSITION, BrickValues.RELATIVE_SIZE_IN_PERCENT, BrickValues.SHOW_VARIABLE_COLOR)); dataBrickList.add(new HideTextBrick()); dataBrickList.add(new AddItemToUserListBrick(BrickValues.ADD_ITEM_TO_USERLIST)); dataBrickList.add(new DeleteItemOfUserListBrick(BrickValues.DELETE_ITEM_OF_USERLIST)); dataBrickList.add(new InsertItemIntoUserListBrick(BrickValues.INSERT_ITEM_INTO_USERLIST_VALUE, BrickValues.INSERT_ITEM_INTO_USERLIST_INDEX)); dataBrickList.add(new ReplaceItemInUserListBrick(BrickValues.REPLACE_ITEM_IN_USERLIST_VALUE, BrickValues.REPLACE_ITEM_IN_USERLIST_INDEX)); dataBrickList.add(new AskBrick(context.getString(R.string.brick_ask_default_question))); dataBrickList.add(new AskSpeechBrick(context.getString(R.string.brick_ask_speech_default_question))); <START> if (BuildConfig.DEBUG) { <END> dataBrickList.add(new WebRequestBrick(context.getString(R.string.brick_web_request_default_value))); } return dataBrickList; }</code><technical_language>feature toggles for this kind of thing. enable / disable features this gradle file instead of digging code locating this block above</technical_language>

Target:
protected List<Brick> setupDataCategoryList(Context context) { List<Brick> dataBrickList = new ArrayList<>(); dataBrickList.add(new SetVariableBrick(BrickValues.SET_VARIABLE)); dataBrickList.add(new ChangeVariableBrick(BrickValues.CHANGE_VARIABLE)); dataBrickList.add(new ShowTextBrick(BrickValues.X_POSITION, BrickValues.Y_POSITION)); dataBrickList.add(new ShowTextColorSizeAlignmentBrick(BrickValues.X_POSITION, BrickValues.Y_POSITION, BrickValues.RELATIVE_SIZE_IN_PERCENT, BrickValues.SHOW_VARIABLE_COLOR)); dataBrickList.add(new HideTextBrick()); dataBrickList.add(new WriteVariableOnDeviceBrick()); dataBrickList.add(new AddItemToUserListBrick(BrickValues.ADD_ITEM_TO_USERLIST)); dataBrickList.add(new DeleteItemOfUserListBrick(BrickValues.DELETE_ITEM_OF_USERLIST)); dataBrickList.add(new InsertItemIntoUserListBrick(BrickValues.INSERT_ITEM_INTO_USERLIST_VALUE, BrickValues.INSERT_ITEM_INTO_USERLIST_INDEX)); dataBrickList.add(new ReplaceItemInUserListBrick(BrickValues.REPLACE_ITEM_IN_USERLIST_VALUE, BrickValues.REPLACE_ITEM_IN_USERLIST_INDEX)); dataBrickList.add(new AskBrick(context.getString(R.string.brick_ask_default_question))); dataBrickList.add(new AskSpeechBrick(context.getString(R.string.brick_ask_speech_default_question))); if (BuildConfig.FEATURE_WEBREQUEST_BRICK_ENABLED) { dataBrickList.add(new WebRequestBrick(context.getString(R.string.brick_web_request_default_value))); } return dataBrickList; }
Source:
<code><START> public LedgerMetadata(int ensembleSize, int writeQuorumSize, int ackQuorumSize, <END> BookKeeper.DigestType digestType, byte[] password, Map<String, byte[]> customMetadata, LedgerType ledgerType) { this.ensembleSize = ensembleSize; this.writeQuorumSize = writeQuorumSize; this.ackQuorumSize = ackQuorumSize; this.ctime = System.currentTimeMillis(); this.length = 0; this.state = LedgerMetadataFormat.State.OPEN; this.lastEntryId = LedgerHandle.INVALID_ENTRY_ID; this.metadataFormatVersion = CURRENT_METADATA_FORMAT_VERSION; this.digestType = digestType.equals(BookKeeper.DigestType.MAC) ? LedgerMetadataFormat.DigestType.HMAC : LedgerMetadataFormat.DigestType.CRC32; this.ledgerType = ledgerType.equals(LedgerType.VD_JOURNAL) ? LedgerMetadataFormat.LedgerType.VD_JOURNAL : LedgerMetadataFormat.LedgerType.PD_JOURNAL; this.password = Arrays.copyOf(password, password.length); this.hasPassword = true; if (customMetadata != null) { this.customMetadata = customMetadata; } }</code><technical_language>create issue for Builder pattern construct ledger metadata? builder pattern here</technical_language>

Target:
public LedgerMetadata(int ensembleSize, int writeQuorumSize, int ackQuorumSize, BookKeeper.DigestType digestType, byte[] password, Map<String, byte[]> customMetadata, LedgerType ledgerType) { this.ensembleSize = ensembleSize; this.writeQuorumSize = writeQuorumSize; this.ackQuorumSize = ackQuorumSize; this.ctime = System.currentTimeMillis(); this.length = 0; this.state = LedgerMetadataFormat.State.OPEN; this.lastEntryId = LedgerHandle.INVALID_ENTRY_ID; this.metadataFormatVersion = CURRENT_METADATA_FORMAT_VERSION; this.digestType = digestType.equals(BookKeeper.DigestType.MAC) ? LedgerMetadataFormat.DigestType.HMAC : LedgerMetadataFormat.DigestType.CRC32; this.ledgerType = ledgerType.equals(LedgerType.VD_JOURNAL) ? DataFormats.LedgerType.VD_JOURNAL : DataFormats.LedgerType.PD_JOURNAL; this.password = Arrays.copyOf(password, password.length); this.hasPassword = true; if (customMetadata != null) { this.customMetadata = customMetadata; } }
Source:
<code>private static boolean isEntry(ITmfEvent event) { String phase = event.getContent().getFieldValue(String.class, ITraceEventConstants.PHASE); <START> return "B" == phase || phase == "s"; END> }</code><technical_language>string equals</technical_language>

Target:
private static boolean isEntry(ITmfEvent event) { String phase = event.getContent().getFieldValue(String.class, ITraceEventConstants.PHASE); return "B".equals(phase) || "s".equals(phase); }
Source:
<code>public void update_copiesAllEntriesFromSourceDBToDestinationDB_fetchedByWaterMark() throws SQLException { Indexer indexer = new Indexer(sourceDB, destinationDB); ResultSet resultSet = mock(ResultSet.class); int currentWaterMark = 0; when(destinationDB.currentWaterMark()).thenReturn(currentWaterMark); when(sourceDB.read(currentWaterMark)).thenReturn(resultSet); indexer.update(); <START> verify(sourceDB).read(currentWaterMark); <END> verify(destinationDB).write(resultSet); }</code><technical_language>I need verify this</technical_language>

Target:
public void update_copiesAllEntriesFromSourceDBToDestinationDB_fetchedByWaterMark() throws SQLException { Indexer indexer = new Indexer(sourceDB, destinationDB); ResultSet resultSet = mock(ResultSet.class); int currentWaterMark = 0; when(destinationDB.currentWaterMark()).thenReturn(currentWaterMark); when(sourceDB.read(currentWaterMark)).thenReturn(resultSet); indexer.update(); verify(destinationDB).write(resultSet); }
Source:
<code>private void onReplicaResponse(ReplicaId replicaId) { boolean isReplicaFound = false; for (String dataCenter : replicasInFlightPerDatacenter.keySet()) { <START> List<ReplicaId> replicasInFlight = replicasInFlightPerDatacenter.get(dataCenter); <END> if (replicasInFlight.contains(replicaId)) { replicasInFlight.remove(replicaId); isReplicaFound = true; replicasInFlightPerDatacenter.get(dataCenter).clear(); replicasInFlightPerDatacenter.get(dataCenter).addAll(replicasInFlight); if (dataCenter.equalsIgnoreCase(localDataCenterName)) { if (replicaListPerDatacenter.get(localDataCenterName) == null && replicasInFlightPerDatacenter.get(localDataCenterName).size() == 0) { isLocalDone = true; requestParallelism = requestParallelism * remoteDataCenterCount; } } break; } } if (!isReplicaFound) { logger.error("Found response for which no request was sent ", new CoordinatorException("Found response from " + replicaId + "replica for which no request was sent ", CoordinatorError.UnexpectedInternalError)); } }</code><technical_language>This a loop. get datacenter replicaId</technical_language>

Target:
private void onReplicaResponse(ReplicaId replicaId) { String dataCenter = replicaId.getDataNodeId().getDatacenterName(); List<ReplicaId> replicasInFlight = replicasInFlightPerDatacenter.get(dataCenter); if (replicasInFlight.contains(replicaId)) { replicasInFlight.remove(replicaId); if (dataCenter.equals(localDataCenterName)) { if (replicaListPerDatacenter.get(localDataCenterName).size() == 0 && replicasInFlight.size() == 0) { isLocalDone = true; requestParallelism = requestParallelism * remoteDataCenterCount; } } } else { logger.error("Found response for which no request was sent " + replicaId); coordinatorMetrics.unknownReplicaResponseError.inc(); } }
Source:
<code>public boolean tryReserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); <START> if (getFreeBytes() - bytes < 0) { <END> return false; } synchronized (this) { reservedBytes += bytes; } if (bytes != 0) { while (true) { if (queryMemoryReservations.computeIfPresent(queryId, (ignored, value) -> value + bytes) != null) { updateTaggedMemoryAllocations(queryId, allocationTag, bytes, false); break; } synchronized (this) { if (queryMemoryReservations.putIfAbsent(queryId, bytes) == null) { updateTaggedMemoryAllocations(queryId, allocationTag, bytes, true); break; } } } } onMemoryReserved(); return true; }</code><technical_language>This needs in synchronized block allow allocate more available</technical_language>

Target:
public boolean tryReserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); synchronized (this) { if (getFreeBytes() - bytes < 0) { return false; } reservedBytes += bytes; } if (bytes != 0) { while (true) { if (queryMemoryReservations.computeIfPresent(queryId, (ignored, value) -> value + bytes) != null) { updateTaggedMemoryAllocations(queryId, allocationTag, bytes, false); break; } synchronized (this) { if (queryMemoryReservations.putIfAbsent(queryId, bytes) == null) { updateTaggedMemoryAllocations(queryId, allocationTag, bytes, true); break; } } } } onMemoryReserved(); return true; }
Source:
<code>protected void executeCommand() { VdsActionParameters parameters = new VdsActionParameters(getVdsId()); <START> parameters.setLockProperties(LockProperties.create(LockProperties.Scope.Execution).withWait(true)); <END> VdcReturnValueBase returnValue = runInternalAction(VdcActionType.RefreshHostCapabilities, parameters); if (!returnValue.getSucceeded()) { return; } returnValue = runInternalAction(VdcActionType.RefreshHostDevices, parameters); if (!returnValue.getSucceeded()) { return; } setSucceeded(true); }</code><technical_language>Consider changing 'wait' lock in case of internal command. 'bad' users overload system</technical_language>

Target:
protected void executeCommand() { VdsActionParameters parameters = new VdsActionParameters(getVdsId()); parameters.setLockProperties( LockProperties.create(LockProperties.Scope.Execution).withWait(isInternalExecution())); VdcReturnValueBase returnValue = runInternalAction(VdcActionType.RefreshHostCapabilities, parameters); if (!returnValue.getSucceeded()) { return; } returnValue = runInternalAction(VdcActionType.RefreshHostDevices, parameters); if (!returnValue.getSucceeded()) { return; } setSucceeded(true); }
Source:
<code>private void uploadMissing(Map<Digest, Path> files, Map<Digest, ByteString> blobs) throws IOException, InterruptedException { List<ListenableFuture<Void>> uploads = new ArrayList<>(); for (Map.Entry<Digest, Path> entry : files.entrySet()) { uploads.add(cacheProtocol.uploadFile(entry.getKey(), entry.getValue())); } for (Map.Entry<Digest, ByteString> entry : blobs.entrySet()) { uploads.add(cacheProtocol.uploadBlob(entry.getKey(), entry.getValue())); } InterruptedException interruptedException = null; BulkTransferException bulkTransferException = null; boolean interrupted = Thread.currentThread().isInterrupted(); for (ListenableFuture<Void> upload : uploads) { try { upload.get(); } catch (ExecutionException e) { if (bulkTransferException != null) { bulkTransferException = new BulkTransferException(); } Throwable cause = e.getCause(); <START> IOException ioEx; if (cause instanceof IOException) { ioEx = new IOException(cause); } else { ioEx = (IOException) cause; } <END> bulkTransferException.add(ioEx); } catch (InterruptedException e) { interrupted = Thread.interrupted() || interrupted; interruptedException = e; } } if (interruptedException != null) { if (bulkTransferException != null) { interruptedException.addSuppressed(bulkTransferException); } throw interruptedException; } if (bulkTransferException != null) { throw bulkTransferException; } }</code><technical_language>suggestion IOException ioEx = instanceof IOException ? (IOException) : new IOException(cause);</technical_language>

Target:
private void uploadMissing(Map<Digest, Path> files, Map<Digest, ByteString> blobs) throws IOException, InterruptedException { List<ListenableFuture<Void>> uploads = new ArrayList<>(); for (Map.Entry<Digest, Path> entry : files.entrySet()) { uploads.add(cacheProtocol.uploadFile(entry.getKey(), entry.getValue())); } for (Map.Entry<Digest, ByteString> entry : blobs.entrySet()) { uploads.add(cacheProtocol.uploadBlob(entry.getKey(), entry.getValue())); } waitForBulkTransfer(uploads, false); }
Source:
<code>protected <T> T getValue(Class<T> type, String key) { Object rawProp = getRawProperty(key); if (rawProp == null) { return notFound(key); } if (rawProp instanceof String) { try { String value = interpolator.create(lookup).resolve(rawProp.toString()); <START> if (type.equals(boolean.class) || type.equals(Boolean.class)) { <END> if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on")) { return (T) Boolean.TRUE; } else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no") || value.equalsIgnoreCase("off")) { return (T) Boolean.FALSE; } return parseError(key, value, new Exception("Expected one of [true, yes, on, false, no, off]")); } return decoder.decode(type, value); } catch (NumberFormatException e) { return parseError(key, rawProp.toString(), e); } } else if (type.isInstance(rawProp)) { return (T)rawProp; } else { return parseError(key, rawProp.toString(), new NumberFormatException("Property " + rawProp.toString() + " is of wrong format " + type.getCanonicalName())); } }</code><technical_language>This part of decoder</technical_language>

Target:
protected <T> T getValue(Class<T> type, String key) { Object rawProp = getRawProperty(key); if (rawProp == null) { return notFound(key); } if (rawProp instanceof String) { try { String value = interpolator.create(lookup).resolve(rawProp.toString()); return decoder.decode(type, value); } catch (NumberFormatException e) { return parseError(key, rawProp.toString(), e); } } else if (type.isInstance(rawProp)) { return (T)rawProp; } else { return parseError(key, rawProp.toString(), new NumberFormatException("Property " + rawProp.toString() + " is of wrong format " + type.getCanonicalName())); } }
Source:
<code>public void testCreateDirectoriesWithTrailingSlash() throws IOException { Path testBaseDirectoryPath = Paths.get(ConfigCore.getParameter(ParameterCore.DIR_XML_CONFIG)); Path firstDirectoryOfTestPath = testBaseDirectoryPath.resolve("several"); if (Files.isDirectory(firstDirectoryOfTestPath)) { TreeDeleter.deltree(firstDirectoryOfTestPath); <START> } <END> String testBaseDirectoryURI = testBaseDirectoryPath.toUri().toString(); String createDirectories = "several/directories/can/be/created/with/trailing/"; new FileService().createDirectories(URI.create(testBaseDirectoryURI + createDirectories)); assertTrue(Files.isDirectory(firstDirectoryOfTestPath.resolve("directories/can/be/created/with/trailing"))); TreeDeleter.deltree(firstDirectoryOfTestPath); }</code><technical_language>mapping kitodo directory is happening module</technical_language>

Target:
public void testCreateDirectoriesWithTrailingSlash() throws IOException { ServiceManager.getFileService() .createDirectories(URI.create("several/directories/can/be/created/with/trailing/")); assertTrue(ServiceManager.getFileService().isDirectory(URI.create(SEVERAL))); cleanUp(); }
Source:
<code>public void makeHttpRequest(String jobId, Logger logger, List<HttpRequestBase> httpRequestList) { if (httpRequestList == null || httpRequestList.isEmpty()) { logger.info("No HTTP requests to make"); return; } <START> for (HttpRequestBase httpRequest : httpRequestList) { <END> logger.info("Job callback http request: " + httpRequest.toString()); logger.info("headers ["); for (Header header : httpRequest.getAllHeaders()) { logger.info(String.format(" %s : %s", header.getName(), header.getValue())); } logger.info("]"); HttpRequestFutureTask<Integer> task = futureRequestExecutionService.execute(httpRequest, HttpClientContext.create(), new LoggingResonseHandler(logger)); try { Integer statusCode = task.get(responseWaitTimeoutMS, TimeUnit.MILLISECONDS); logger.info("http callback status code: " + statusCode); } catch (TimeoutException timeOutEx) { logger .warn("Job callback target took longer " + (responseWaitTimeoutMS / 1000) + " seconds to respond", timeOutEx); } catch (ExecutionException ee) { if (ee.getCause() instanceof SocketTimeoutException) { logger.warn("Job callback target took longer " + (responseWaitTimeoutMS / 1000) + " seconds to respond", ee); } else { logger.warn( "Encountered error while waiting for job callback to complete", ee); } } catch (Throwable e) { logger.warn( "Encountered error while waiting for job callback to complete", e); } } }</code><technical_language>Here, code is http call sequentially: task, wait for task complete, next http call. is efficient. submit requests future service, check status of future tasks</technical_language>

Target:
public void makeHttpRequest(String jobId, Logger logger, List<HttpRequestBase> httpRequestList) { if (httpRequestList == null || httpRequestList.isEmpty()) { logger.info("No HTTP requests to make"); return; } for (HttpRequestBase httpRequest : httpRequestList) { logger.info("Job callback http request: " + httpRequest.toString()); logger.info("headers ["); for (Header header : httpRequest.getAllHeaders()) { logger.info(String.format(" %s : %s", header.getName(), header.getValue())); } logger.info("]"); HttpRequestFutureTask<Integer> task = futureRequestExecutionService.execute(httpRequest, HttpClientContext.create(), new LoggingResponseHandler(logger)); try { Integer statusCode = task.get(responseWaitTimeoutMS, TimeUnit.MILLISECONDS); logger.info("http callback status code: " + statusCode); } catch (TimeoutException timeOutEx) { logger .warn("Job callback target took longer " + (responseWaitTimeoutMS / 1000) + " seconds to respond", timeOutEx); } catch (ExecutionException ee) { if (ee.getCause() instanceof SocketTimeoutException) { logger.warn("Job callback target took longer " + (responseWaitTimeoutMS / 1000) + " seconds to respond", ee); } else { logger.warn( "Encountered error while waiting for job callback to complete", ee); } } catch (Throwable e) { logger.warn( "Encountered error while waiting for job callback to complete", e); } } }
Source:
<code>private void injectPortSelectorPropertySource(ConfigurableEnvironment environment) { environment.getPropertySources() .remove(PORT_SELECTOR_PROPERTY_SOURCE); environment.getPropertySources() <START> .addLast(new PropertySource<Integer>(PORT_SELECTOR_PROPERTY_SOURCE) { <END> @Override public Integer getProperty(@NonNull String s) { boolean isK8s = (!"IS_KUBERNETES".equalsIgnoreCase(s)) && "true".equalsIgnoreCase(environment.getProperty("IS_KUBERNETES", "false")); if (SERVER_PORT.equalsIgnoreCase(s)) { return Integer.parseInt(environment.getProperty("PORT_HTTP", environment.getProperty("PORT0", "0"))); } if (HTTPSERVER_CONNECTOR_DEFAULT_HTTP_PORT.equalsIgnoreCase(s)) { return Integer.parseInt(environment.getProperty("PORT_HTTP", environment.getProperty("PORT0", "-1"))); } if (isK8s && s.matches("ot\\.httpserver\\.connector\\..*-.*\\.port")) { final String name = s.split("\\.")[3].split("-")[0].toUpperCase(Locale.US); return Integer.parseInt(environment.getProperty("PORT_" + name, "-1")); } if (JMX_PORT.equalsIgnoreCase(s)) { return Integer.parseInt(environment.getProperty("PORT_JMX", environment.getProperty("PORT1", "0"))); } if (MANAGEMENT_SERVER_PORT.equalsIgnoreCase(s)) { return Integer.parseInt(environment.getProperty("PORT_ACTUATOR", environment.getProperty("PORT2", "0"))); } return null; } }); }</code><technical_language>is addLast addFirst correct</technical_language>

Target:
private void injectPortSelectorPropertySource(ConfigurableEnvironment environment) { environment.getPropertySources() .remove(OtPortSelectorPropertySource.class.getName()); environment.getPropertySources() .remove(OtPortSelectorInfoPropertySource.class.getName()); environment.getPropertySources() .remove(JMX_PROPERTY_SOURCE); ImmutableMap<String, PortSelector.PortSelection> portSelectionMap = ImmutableMap.copyOf(new PortSelector(environment).getPortSelectionMap()); environment.getPropertySources() .addFirst(getPortPropertySource(portSelectionMap)); environment.getPropertySources() .addLast(getPortDebugPropertySource(portSelectionMap)); environment.getPropertySources() .addFirst(getHostPropertySource(environment)); }
Source:
<code>public void setup() throws Exception { mySqlServer = setupMySql(); jdbi = getJdbi(mySqlServer); handle = jdbi.open(); config = new BenchmarkSuiteConfig() <START> .setSuitesTableName(BENCHMARK_SUITES_TABLE) .setQueriesTableName(BENCHMARK_QUERIES_TABLE); <END> }</code><technical_language>default config</technical_language>

Target:
public void setup() throws Exception { mySqlServer = setupMySql(); jdbi = getJdbi(mySqlServer); handle = jdbi.open(); }
Source:
<code>public <START> float getFraction() <END> { return mFraction; }</code><technical_language>@FloatRange</technical_language>

Target:
public @FloatRange(from = 0, to = 1) float getFraction() { return mFraction; }
Source:
<code>HiveMetaStoreClient getHive() throws IOException { if (mHive != null) { try { <START> mHive.getAllDatabases(); END> } catch (TException e) { LOG.info("Hive metastore client disconnected, attempting to reconnect"); mHive = newHiveClient(); } return mHive; } mHive = newHiveClient(); return mHive; }</code><technical_language>Is a detect if is connected? extra RPC sounds inefficient. alternative do desired operations existing cached client, if fails, try a re-connected client</technical_language>

Target:
MetaStoreClient getHive() { return mHive; }
Source:
<code>public CompletionServiceResponse doMultiGetRequest(List<String> serverURLs, String tableNameWithType, int timeoutMs) { CompletionServiceResponse completionServiceResponse = new CompletionServiceResponse(); CompletionService<GetMethod> completionService = new MultiGetRequest(_executor, _httpConnectionManager).execute(serverURLs, timeoutMs); for (int i = 0; i < serverURLs.size(); i++) { GetMethod getMethod = null; try { getMethod = completionService.take().get(); URI uri = getMethod.getURI(); String instance = _endpointsToServers.get(uri.getHost() + ":" + uri.getPort()); if (getMethod.getStatusCode() >= 300) { LOGGER.error("Server: returned error: {}", instance, getMethod.getStatusCode()); completionServiceResponse._failedResponseCount++; continue; } completionServiceResponse._httpResponses.put(instance, getMethod.getResponseBodyAsString()); } catch (Exception e) { } finally { if (getMethod != null) { getMethod.releaseConnection(); } } } int numServersResponded = completionServiceResponse._httpResponses.size(); if (numServersResponded != serverURLs.size()) { LOGGER.warn("Finish reading information for table: with {}/{} server responses", tableNameWithType, <START> numServersResponded, serverURLs); <END> } else { LOGGER.info("Finish reading information for table: {}", tableNameWithType); } return completionServiceResponse; }</code><technical_language>suggestion numServersResponded, serverURLs.size());</technical_language>

Target:
public CompletionServiceResponse doMultiGetRequest(List<String> serverURLs, String tableNameWithType, int timeoutMs) { CompletionServiceResponse completionServiceResponse = new CompletionServiceResponse(); CompletionService<GetMethod> completionService = new MultiGetRequest(_executor, _httpConnectionManager).execute(serverURLs, timeoutMs); for (int i = 0; i < serverURLs.size(); i++) { GetMethod getMethod = null; try { getMethod = completionService.take().get(); URI uri = getMethod.getURI(); String instance = _endpointsToServers.get(uri.getHost() + ":" + uri.getPort()); if (getMethod.getStatusCode() >= 300) { LOGGER.error("Server: returned error: {}", instance, getMethod.getStatusCode()); completionServiceResponse._failedResponseCount++; continue; } completionServiceResponse._httpResponses.put(instance, getMethod.getResponseBodyAsString()); } catch (Exception e) { } finally { if (getMethod != null) { getMethod.releaseConnection(); } } } int numServersResponded = completionServiceResponse._httpResponses.size(); if (numServersResponded != serverURLs.size()) { LOGGER.warn("Finished reading information for table: with {}/{} server responses", tableNameWithType, numServersResponded, serverURLs.size()); } else { LOGGER.info("Finished reading information for table: {}", tableNameWithType); } return completionServiceResponse; }
Source:
<code>public OAuthServiceClient(String backendServerURL, String username, String password, ConfigurationContext configCtx) throws Exception { String serviceURL = backendServerURL + "OAuth2TokenValidationService"; try { stub = new OAuth2TokenValidationServiceStub(configCtx, serviceURL); CarbonUtils.setBasicAccessSecurityHeaders(username, password, true, stub._getServiceClient()); } catch (AxisFault e) { log.error("Error initializing OAuth2 Client"); <START> throw new Exception("Error initializing OAuth Client", e); <END> } }</code><technical_language>throw "Exception". more specific exception. log throw</technical_language>

Target:
public OAuthServiceClient(String backendServerURL, String username, String password, ConfigurationContext configCtx) throws AxisFault { String serviceURL = backendServerURL + "OAuth2TokenValidationService"; try { stub = new OAuth2TokenValidationServiceStub(configCtx, serviceURL); CarbonUtils.setBasicAccessSecurityHeaders(username, password, true, stub._getServiceClient()); } catch (AxisFault e) { throw new AxisFault("Error initializing OAuth Client", e); } }
Source:
<code>protected List<PreviousCommit> findPreviousCommits() throws IOException { List<PreviousCommit> result = new ArrayList<PreviousCommit>(); Repository repository = getRepository(); IResource resource = getSelectedResources()[0]; String path = RepositoryMapping.getMapping(resource.getProject()) .getRepoRelativePath(resource); RevWalk rw = new RevWalk(repository); <START> rw.sort(RevSort.COMMIT_TIME_DESC); <END> try { if (path.length() > 0) { DiffConfig diffConfig = repository.getConfig().get( DiffConfig.KEY); FollowFilter filter = FollowFilter.create(path, diffConfig); rw.setTreeFilter(filter); } RevCommit headCommit = rw.parseCommit(repository.getRef( Constants.HEAD).getObjectId()); rw.markStart(headCommit); headCommit = rw.next(); if (headCommit == null) return result; List<RevCommit> directParents = Arrays.asList(headCommit .getParents()); RevCommit previousCommit = rw.next(); while (previousCommit != null && result.size() < directParents.size()) { if (directParents.contains(previousCommit)) { String previousPath = getPreviousPath(repository, rw.getObjectReader(), headCommit, previousCommit, path); result.add(new PreviousCommit(previousCommit, previousPath)); } previousCommit = rw.next(); } } finally { rw.dispose(); } return result; }</code><technical_language>do need RevSort.BOUNDARY</technical_language>

Target:
protected List<PreviousCommit> findPreviousCommits() throws IOException { List<PreviousCommit> result = new ArrayList<PreviousCommit>(); Repository repository = getRepository(); IResource resource = getSelectedResources()[0]; String path = RepositoryMapping.getMapping(resource.getProject()) .getRepoRelativePath(resource); RevWalk rw = new RevWalk(repository); rw.sort(RevSort.COMMIT_TIME_DESC, true); rw.sort(RevSort.BOUNDARY, true); try { if (path.length() > 0) { DiffConfig diffConfig = repository.getConfig().get( DiffConfig.KEY); FollowFilter filter = FollowFilter.create(path, diffConfig); rw.setTreeFilter(filter); } RevCommit headCommit = rw.parseCommit(repository.getRef( Constants.HEAD).getObjectId()); rw.markStart(headCommit); headCommit = rw.next(); if (headCommit == null) return result; List<RevCommit> directParents = Arrays.asList(headCommit .getParents()); RevCommit previousCommit = rw.next(); while (previousCommit != null && result.size() < directParents.size()) { if (directParents.contains(previousCommit)) { String previousPath = getPreviousPath(repository, rw.getObjectReader(), headCommit, previousCommit, path); result.add(new PreviousCommit(previousCommit, previousPath)); } previousCommit = rw.next(); } } finally { rw.dispose(); } return result; }
Source:
<code>protected void initDetailModels() { super.initDetailModels(); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); list.add(new VmGeneralModel()); list.add(new VmInterfaceListModel()); VmDiskListModel diskListModel = new VmDiskListModel(); diskListModel.setSystemTreeContext(this); list.add(diskListModel); list.add(new VmSnapshotListModel()); list.add(new VmEventListModel()); list.add(new VmAppListModel()); list.add(new PermissionListModel()); <START> list.add(new VmAffinityGroupListModel(VdcQueryType.GetAffinityGroupsByVmId)); <END> list.add(new VmSessionsModel()); setDetailModels(list); }</code><technical_language>VM subtab this query, I encapsulate VmAffinityGroupListModel constructor no-arg</technical_language>

Target:
protected void initDetailModels() { super.initDetailModels(); ObservableCollection<EntityModel> list = new ObservableCollection<EntityModel>(); list.add(new VmGeneralModel()); list.add(new VmInterfaceListModel()); VmDiskListModel diskListModel = new VmDiskListModel(); diskListModel.setSystemTreeContext(this); list.add(diskListModel); list.add(new VmSnapshotListModel()); list.add(new VmEventListModel()); list.add(new VmAppListModel()); list.add(new PermissionListModel()); list.add(new VmAffinityGroupListModel()); list.add(new VmSessionsModel()); setDetailModels(list); }
Source:
<code>public void applyProjection(int[][] projectedFields) { this.projectedFields = new int[projectedFields.length]; FieldsDataType dataType = (FieldsDataType) physicalRowDataType; RowType rowType = ((RowType) physicalRowDataType.getLogicalType()); DataTypes.Field[] fields = new DataTypes.Field[projectedFields.length]; for (int i = 0; i < projectedFields.length; ++i) { int[] projection = projectedFields[i]; Preconditions.checkArgument(projection.length == 1); int index = projection[0]; this.projectedFields[i] = index; String fieldName = rowType.getFieldNames().get(index); <START> fields[i] = DataTypes.FIELD(fieldName, dataType.getFieldDataTypes().get(fieldName)); <END> } this.physicalRowDataType = DataTypes.ROW(fields); }</code><technical_language>getFieldDataTypes deleted</technical_language>

Target:
public void applyProjection(int[][] projectedFields) { this.projectedFields = new int[projectedFields.length]; FieldsDataType dataType = (FieldsDataType) physicalRowDataType; RowType rowType = ((RowType) physicalRowDataType.getLogicalType()); DataTypes.Field[] fields = new DataTypes.Field[projectedFields.length]; for (int i = 0; i < projectedFields.length; ++i) { int[] projection = projectedFields[i]; Preconditions.checkArgument(projection.length == 1); int index = projection[0]; this.projectedFields[i] = index; fields[i] = DataTypes.FIELD(rowType.getFieldNames().get(index), dataType.getChildren().get(index)); } this.physicalRowDataType = DataTypes.ROW(fields); }
Source:
<code>public boolean process(final Exchange exchange, final AsyncCallback callback) { Operation operation = getOperation(exchange); LOG.debug("Executing operation", operation); switch (operation) { case PUBLISH: { doPublish(exchange, callback); break; } case FIRE: { doFire(exchange, callback); break; } case GETHISTORY: { doGetHistory(exchange, callback); break; } case GETSTATE: { doGetState(exchange, callback); break; } case HERENOW: { doHereNow(exchange, callback); break; } case SETSTATE: { doSetState(exchange, callback); break; } case WHERENOW: { doWhereNow(exchange, callback); break; } default: throw new UnsupportedOperationException(operation.toString()); } <START> if (exchange.getException() != null) { <END> if (exchange.getException() instanceof PubNubException) { LOG.error("Exception from PubNub : {}", exchange.getException(PubNubException.class).getPubnubError().getMessage()); } callback.done(true); return true; } return false; }</code><technical_language>This code ideally removed do this send message, instead a try .. catch need in case exception thrown sending message, need catch call callback.done(true)</technical_language>

Target:
public boolean process(final Exchange exchange, final AsyncCallback callback) { Operation operation = getOperation(exchange); LOG.debug("Executing operation", operation); try { switch (operation) { case PUBLISH: { doPublish(exchange, callback); break; } case FIRE: { doFire(exchange, callback); break; } case GETHISTORY: { doGetHistory(exchange, callback); break; } case GETSTATE: { doGetState(exchange, callback); break; } case HERENOW: { doHereNow(exchange, callback); break; } case SETSTATE: { doSetState(exchange, callback); break; } case WHERENOW: { doWhereNow(exchange, callback); break; } default: throw new UnsupportedOperationException(operation.toString()); } } catch (Exception e) { exchange.setException(e); callback.done(true); return true; } return false; }
Source:
<code>public void populateDAG(DAG dag, Configuration configuration) { <START> testInput.length(); <END> }</code><technical_language>is purpose of this operation</technical_language>

Target:
public void populateDAG(DAG dag, Configuration configuration) { if (testInput == null) { throw new NullPointerException(); } TestModuleOperator testModuleOperator = dag.addOperator("testModuleOperator", TestModuleOperator.class); testModuleOperator.setTestInput(this.getTestInput()); }
Source:
<code>protected void run() throws Exception { try (Git git = new Git(db)) { PushCommand push = git.push(); push.setDryRun(dryRun); push.setForce(force); push.setProgressMonitor(new TextProgressMonitor(errw)); push.setReceivePack(receivePack); push.setRefSpecs(refSpecs); if (all) push.setPushAll(); if (tags) push.setPushTags(); push.setRemote(remote); push.setThin(thin); push.setAtomic(atomic); push.setTimeout(timeout); if (pushOptions.isEmpty()) { <START> push.setPushOptions(null); <END> } else { push.setPushOptions(pushOptions); } Iterable<PushResult> results = push.call(); for (PushResult result : results) { try (ObjectReader reader = db.newObjectReader()) { printPushResult(reader, result.getURI(), result); } } } }</code><technical_language>optional: skip this line is default: if (!pushOptions.isEmpty()) { push.setPushOptions(pushOptions); }</technical_language>

Target:
protected void run() throws Exception { try (Git git = new Git(db)) { PushCommand push = git.push(); push.setDryRun(dryRun); push.setForce(force); push.setProgressMonitor(new TextProgressMonitor(errw)); push.setReceivePack(receivePack); push.setRefSpecs(refSpecs); if (all) push.setPushAll(); if (tags) push.setPushTags(); push.setRemote(remote); push.setThin(thin); push.setAtomic(atomic); push.setTimeout(timeout); if (!pushOptions.isEmpty()) { push.setPushOptions(pushOptions); } Iterable<PushResult> results = push.call(); for (PushResult result : results) { try (ObjectReader reader = db.newObjectReader()) { printPushResult(reader, result.getURI(), result); } } } }
Source:
<code>private void processElementWithoutRowNumber(RowData input, Collector<RowData> out) throws Exception { if (buffer.getCurrentTopNum() > rankEnd) { Map.Entry<RowData, Collection<RowData>> lastEntry = buffer.lastEntry(); RowData lastKey = lastEntry.getKey(); List<RowData> lastList = (List<RowData>) lastEntry.getValue(); int size = lastList.size(); RowData lastElement = null; if (size > 0) { lastElement = lastList.get(size - 1); } if (size <= 1) { <START> buffer.removeAll(lastKey); <END> dataState.remove(lastKey); } else { buffer.remove(lastKey, lastElement); dataState.put(lastKey, lastList); } if (size == 0 || input.equals(lastElement)) { return; } else { collectDelete(out, lastElement); } } collectInsert(out, input); }</code><technical_language>Remove list index more efficient buffer.remove</technical_language>

Target:
private void processElementWithoutRowNumber(RowData input, Collector<RowData> out) throws Exception { if (buffer.getCurrentTopNum() > rankEnd) { Map.Entry<RowData, Collection<RowData>> lastEntry = buffer.lastEntry(); RowData lastKey = lastEntry.getKey(); Collection<RowData> lastList = lastEntry.getValue(); RowData lastElement = buffer.lastElement(); int size = lastList.size(); if (size <= 1) { buffer.removeAll(lastKey); dataState.remove(lastKey); } else { buffer.removeLast(); dataState.put(lastKey, new ArrayList<>(lastList)); } if (size == 0 || input.equals(lastElement)) { return; } else { collectDelete(out, lastElement); } } collectInsert(out, input); }
Source:
<code>void account_credentials_are_valid_for_a_gateway_account(String type) { var gatewayAccount = aGatewayAccountEntity().withType(GatewayAccountEntity.Type.fromString(type)).build(); when(gatewayAccountService.getGatewayAccount(gatewayAccount.getId())).thenReturn(Optional.of(gatewayAccount)); when(response.getStatus()).thenReturn(HttpStatus.SC_OK); var flexCredentials = new Worldpay3dsFlexCredentials("53f0917f101a4428b69d5fb0", "57992a087a0c4849895ab8a2", "4cabd5d2-0133-4e82-b0e5-2024dbeddaa9"); assertTrue(service.validateCredentials(gatewayAccount.getId(), flexCredentials)); <START> verify(client).target(threeDsFlexDdcUrls.get(type)); <END> verify(worldpay3dsFlexJwtService).generateDdcToken(eq(GatewayAccount.valueOf(gatewayAccount)), eq(flexCredentials), any(ZonedDateTime.class)); verify(invocationBuilder).post(entityArgumentCaptor.capture()); assertEquals(((Form) entityArgumentCaptor.getValue().getEntity()).asMap(), new MultivaluedHashMap<String, String>() {{ add("JWT", DDC_TOKEN); }}); assertEquals(entityArgumentCaptor.getValue().getMediaType(), MediaType.APPLICATION_FORM_URLENCODED_TYPE); }</code><technical_language>amazed do this. Surely when(client.target(threeDsFlexDdcUrls.get(type))).thenReturn(webTarget) works</technical_language>

Target:
void account_credentials_are_valid_for_a_gateway_account(String type) { var gatewayAccount = aGatewayAccountEntity().withType(GatewayAccountEntity.Type.fromString(type)).build(); var flexCredentials = new Worldpay3dsFlexCredentials("53f0917f101a4428b69d5fb0", "57992a087a0c4849895ab8a2", "4cabd5d2-0133-4e82-b0e5-2024dbeddaa9"); when(response.getStatus()).thenReturn(HttpStatus.SC_OK); when(client.target(threeDsFlexDdcUrls.get(type))).thenReturn(webTarget); when(worldpay3dsFlexJwtService.generateDdcToken(eq(GatewayAccount.valueOf(gatewayAccount)), eq(flexCredentials), any(ZonedDateTime.class))).thenReturn(DDC_TOKEN); var expectedFormData = new MultivaluedHashMap<String, String>(){{add("JWT", DDC_TOKEN);}}; when(invocationBuilder.post(argThat(new EntityMatcher(Entity.form(expectedFormData))))).thenReturn(response); assertTrue(service.validateCredentials(gatewayAccount, flexCredentials)); }
Source:
<code>protected void setMultipleColumnItems(List<String> names, List<String> timestamps) { this.items.clearAll(); int i = 0; String[] columns = new String[2]; <START> if (timestamps.size() == 0) { <END> setItems(names); } else { for (String name : names) { TableItem item = new TableItem(this.items, SWT.NONE); columns[0] = name; columns[1] = timestamps.get(i); item.setText(columns); i++; } } }</code><technical_language>similar other place check lists size</technical_language>

Target:
protected void setMultipleColumnItems(List<String> names, List<String> timestamps) { this.items.clearAll(); int i = 0; String[] columns = new String[2]; if (timestamps.size() != names.size()) { LOG.error("Got mismatched timestamps and names"); setItems(names); } else { for (String name : names) { TableItem item = new TableItem(this.items, SWT.NONE); columns[0] = name; columns[1] = timestamps.get(i); item.setText(columns); i++; } } }
Source:
<code>private <K, V> JsrCacheLoaderWriter<K, V> initCacheLoaderWriter(CompleteConfiguration<K, V> config, MultiCacheException mce) { Factory<CacheLoader<K, V>> cacheLoaderFactory = config.getCacheLoaderFactory(); <START> Factory<CacheWriter<K, V>> cacheWriterFactory = getCacheWriterFactory(config); <END> if (config.isReadThrough() && cacheLoaderFactory == null) { throw new IllegalArgumentException("read-through enabled without a CacheLoader factory provided"); } if (config.isWriteThrough() && cacheWriterFactory == null) { throw new IllegalArgumentException("write-through enabled without a CacheWriter factory provided"); } CacheLoader<K, V> cacheLoader = cacheLoaderFactory == null ? null : cacheLoaderFactory.create(); CacheWriter<K, V> cacheWriter; try { cacheWriter = cacheWriterFactory == null ? null : cacheWriterFactory.create(); } catch (Throwable t) { if (t != mce) { mce.addThrowable(t); } CacheResources.close(cacheLoader, mce); throw mce; } if (cacheLoader == null && cacheWriter == null) { return null; } else { return new Eh107CacheLoaderWriter<K, V>(cacheLoader, config.isReadThrough(), cacheWriter, config.isWriteThrough()); } }</code><technical_language>strayed close this line... inline this method annotate declaration - a static method for this</technical_language>

Target:
private <K, V> Jsr107CacheLoaderWriter<K, V> initCacheLoaderWriter(CompleteConfiguration<K, V> config, MultiCacheException mce) { Factory<CacheLoader<K, V>> cacheLoaderFactory = config.getCacheLoaderFactory(); @SuppressWarnings("unchecked") Factory<CacheWriter<K, V>> cacheWriterFactory = (Factory<CacheWriter<K, V>>) (Object) config.getCacheWriterFactory(); if (config.isReadThrough() && cacheLoaderFactory == null) { throw new IllegalArgumentException("read-through enabled without a CacheLoader factory provided"); } if (config.isWriteThrough() && cacheWriterFactory == null) { throw new IllegalArgumentException("write-through enabled without a CacheWriter factory provided"); } CacheLoader<K, V> cacheLoader = cacheLoaderFactory == null ? null : cacheLoaderFactory.create(); CacheWriter<K, V> cacheWriter; try { cacheWriter = cacheWriterFactory == null ? null : cacheWriterFactory.create(); } catch (Throwable t) { if (t != mce) { mce.addThrowable(t); } CacheResources.close(cacheLoader, mce); throw mce; } if (cacheLoader == null && cacheWriter == null) { return null; } else { return new Eh107CacheLoaderWriter<K, V>(cacheLoader, config.isReadThrough(), cacheWriter, config.isWriteThrough()); } }
Source:
<code>public String getName() { <START> WebElement nameCell = getDaemonRowElement().findElements(By.xpath("./td[1]")).get(0); <END> Assert.assertThat(nameCell.isDisplayed(), is(true)); Assert.assertThat(nameCell.isEnabled(), is(true)); return nameCell.getText(); }</code><technical_language>reason findElements instead of findElement is used, if element is relevant anyways? ensure calls wrapped in a setImplicitWait(5, SECONDS), execution takes long if elements visible due changes errors</technical_language>

Target:
public String getName() { WebElement nameCell = getDaemonRowElement().findElement(By.xpath("./td[1]")); Assert.assertThat(nameCell.isDisplayed(), is(true)); Assert.assertThat(nameCell.isEnabled(), is(true)); return nameCell.getText(); }
Source:
<code>private String getErrorSubMessage(ValidationEvent validationError) { <START> String eventMessage = getErrorEventMessage(validationError); <END> LOG.warn("getErrorSubMessage: Detected validation error when parsing XML document: " + eventMessage); Matcher matcher = EXCEPTION_MESSAGE_PATTERN.matcher(eventMessage); if (!matcher.matches()) { return eventMessage; } String exceptionClassname = matcher.group(EXCEPTION_CLASSNAME_GROUP); if (StringUtils.isBlank(exceptionClassname)) { throw new IllegalStateException( "Pattern matched message but it does not contain exception classname; this should NEVER happen!"); } String subMessage; String detailMessage = matcher.group(DETAIL_MESSAGE_GROUP); if (StringUtils.isNotBlank(detailMessage)) { subMessage = detailMessage; } else if (StringUtils.equals(NumberFormatException.class.getName(), exceptionClassname)) { subMessage = getStringProperty(CuFPKeyConstants.ERROR_CREATE_ACCOUNTING_DOCUMENT_GENERIC_NUMERIC_ERROR); } else { subMessage = getStringProperty(CuFPKeyConstants.ERROR_CREATE_ACCOUNTING_DOCUMENT_GENERIC_ERROR); } return subMessage; }</code><technical_language>This function is long, refactored some smaller functions</technical_language>

Target:
private String getErrorSubMessage(ValidationEvent validationError) { String eventMessage = getErrorEventMessage(validationError); LOG.warn("getErrorSubMessage: Detected validation error when parsing XML document: " + eventMessage); Matcher matcher = exceptionMessagePattern.matcher(eventMessage); if (!matcher.matches()) { return eventMessage; } String detailMessage = matcher.group(DETAIL_MESSAGE_GROUP); String exceptionClassname = matcher.group(EXCEPTION_CLASSNAME_GROUP); if (StringUtils.isBlank(exceptionClassname)) { LOG.warn("getErrorSubMessage: Pattern matched message but it does not contain exception classname"); } return getUserFriendlySubMessage(detailMessage, exceptionClassname); }
Source:
<code>private void bindSocialView(final DiscussionSocialLayoutViewHolder holder, final int position, final DiscussionComment response) { holder.setDiscussionResponse(response); holder.voteViewContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { <START> boolean isVoted = holder.toggleVote(discussionThread.isVoted() ? discussionThread.getVoteCount()-1: discussionThread.getVoteCount()); <END> discussionService.setCommentVoted(response.getIdentifier(), new VoteBody(isVoted)) .enqueue(new ErrorHandlingCallback<DiscussionComment>( context, null, new DialogErrorNotification(baseFragment)) { @Override protected void onResponse(@NonNull final DiscussionComment comment) { discussionResponses.get(position - 1).patchObject(comment); discussionResponses.set(position - 1, comment); } @Override protected void onFailure(@NonNull final Throwable error) { notifyItemChanged(position); } }); } }); }</code><technical_language>Ooops!!! Bug spotted Hint: discussionThread right object here</technical_language>

Target:
private void bindSocialView(final DiscussionSocialLayoutViewHolder holder, final int position, final DiscussionComment response) { holder.setDiscussionResponse(response); holder.voteViewContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { boolean isVoted = holder.toggleVote(response.isVoted() ? response.getVoteCount()-1: response.getVoteCount()); discussionService.setCommentVoted(response.getIdentifier(), new VoteBody(isVoted)) .enqueue(new ErrorHandlingCallback<DiscussionComment>( context, null, new DialogErrorNotification(baseFragment)) { @Override protected void onResponse(@NonNull final DiscussionComment comment) { discussionResponses.get(position - 1).patchObject(comment); discussionResponses.set(position - 1, comment); } @Override protected void onFailure(@NonNull final Throwable error) { notifyItemChanged(position); } }); } }); }
Source:
<code>private List<Project> getVisibleProjects(IProgressMonitor monitor, GerritConfig gerritConfig) throws GerritException { List<Project> result = new ArrayList<Project>(); try { <START> List<ProjectDetailX> projectDetails = restClient.execute(monitor, <END> new Operation<List<ProjectDetailX>>(client) { @Override public void execute(IProgressMonitor monitor) throws GerritException { getProjectAdminService(monitor).visibleProjectDetails(this); } }); for (ProjectDetailX projectDetail : projectDetails) { if (!GerritUtil.isPermissionOnlyProject(projectDetail, gerritConfig)) { result.add(projectDetail.project); } } } catch (GerritException e) { if (isNoSuchServiceError(e)) { addProjectsWhenNoSuchService(monitor, gerritConfig, result); } else { throw e; } } Collections.sort(result, new ProjectByNameComparator()); return result; }</code><technical_language>lets move lines 354-361 a new protected method getProjectDetails, override in GerritClient212 implement this feature REST</technical_language>

Target:
private List<Project> getVisibleProjects(IProgressMonitor monitor, GerritConfig gerritConfig) throws GerritException { List<Project> result = new ArrayList<Project>(); try { getProjectDetails(monitor, gerritConfig, result); } catch (GerritException e) { if (isNoSuchServiceError(e)) { addProjectsWhenNoSuchService(monitor, gerritConfig, result); } else { throw e; } } Collections.sort(result, new ProjectByNameComparator()); return result; }