auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void apply(RuntimeIdentity identity, Environment envConfig, OpenShiftEnvironment environment) throws InfrastructureException { for (Pod pod : environment.getPods().values()) { String podName = pod.getMetadata().getName(); for (Container container : pod.getSpec().getContainers()) { String containerName = container.getName(); String machineName = podName + "/" + containerName; MachineConfig machineConf = envConfig.getMachines().get(machineName); List<String> installers = machineConf.getInstallers(); Map<String, ServerConfig> name2Server = new HashMap<>(); for (String installerId : installers) { Installer installer = getInstaller(installerId); provisionEnv(container, installer.getProperties()); name2Server.putAll(installer.getServers()); } ServerExposeUtils.expose(machineName, container, name2Server, environment, "agents"); container.getEnv().removeIf(env -> "CHE_API".equals(env.getName())); container.getEnv().add(new EnvVar("CHE_API", cheServerEndpoint, null)); <START> <END> if (installers.contains("org.eclipse.che.ws-agent")) { container.getEnv().removeIf(env -> "CHE_WORKSPACE_ID".equals(env.getName())); container.getEnv().add(new EnvVar("CHE_WORKSPACE_ID", identity.getWorkspaceId(), null)); } } } }</code><technical_language>this code part of 'General' infra independent provision installer configurations, docker openshift other implementation need do again</technical_language>

Target:
public void apply(RuntimeIdentity identity, Environment envConfig, OpenShiftEnvironment environment) throws InfrastructureException { for (Pod pod : environment.getPods().values()) { String podName = pod.getMetadata().getName(); for (Container container : pod.getSpec().getContainers()) { String containerName = container.getName(); String machineName = podName + "/" + containerName; MachineConfig machineConf = envConfig.getMachines().get(machineName); List<String> installers = machineConf.getInstallers(); Map<String, ServerConfig> name2Server = new HashMap<>(); for (String installerId : installers) { Installer installer = getInstaller(installerId); provisionEnv(container, installer.getProperties()); name2Server.putAll(installer.getServers()); } ServerExposer serverExposer = new ServerExposer(machineName, container, environment); serverExposer.expose("agents", name2Server); container.getEnv().removeIf(env -> "CHE_API".equals(env.getName())); container.getEnv().add(new EnvVar("CHE_API", cheServerEndpoint, null)); if (installers.contains("org.eclipse.che.ws-agent")) { container.getEnv().removeIf(env -> "CHE_WORKSPACE_ID".equals(env.getName())); container.getEnv().add(new EnvVar("CHE_WORKSPACE_ID", identity.getWorkspaceId(), null)); } } } }
Source:
<code>private static boolean referenceIsSplit(String lineOne, String lineTwo) { Matcher lineOneMatcher = referenceStartPattern.matcher(lineOne); return (lineOneMatcher.find() && lineOneMatcher.end() == lineOne.length() && <START> !referenceStartPattern.matcher(lineTwo).find()); <END> }</code><technical_language>This RegexWithTimeout, for safety</technical_language>

Target:
private static boolean referenceIsSplit(String lineOne, String lineTwo) { Matcher lineOneMatcher = RegexWithTimeout.matcher(referenceStartPattern, lineOne); return (lineOneMatcher.find() && lineOneMatcher.end() == lineOne.length() && !RegexWithTimeout.matcher(referenceStartPattern, lineTwo).find()); }
Source:
<code>public void processBatch(MappedStatement ms, Statement stmt, Object parameter) { final String[] keyProperties = ms.getKeyProperties(); if (keyProperties == null || keyProperties.length == 0) { return; } <START> try (final ResultSet rs = stmt.getGeneratedKeys()) { <END> final Configuration configuration = ms.getConfiguration(); if (rs.getMetaData().getColumnCount() >= keyProperties.length) { Object soleParam = getSoleParameter(parameter); if (soleParam != null) { assignKeysToParam(configuration, rs, keyProperties, soleParam); } else { assignKeysToOneOfParams(configuration, rs, keyProperties, (Map<?, ?>) parameter); } } } catch (Exception e) { throw new ExecutorException("Error getting generated key or setting result to parameter object. Cause: " + e, e); } }</code><technical_language>In this case, is need explicitly final</technical_language>

Target:
public void processBatch(MappedStatement ms, Statement stmt, Object parameter) { final String[] keyProperties = ms.getKeyProperties(); if (keyProperties == null || keyProperties.length == 0) { return; } try (ResultSet rs = stmt.getGeneratedKeys()) { final Configuration configuration = ms.getConfiguration(); if (rs.getMetaData().getColumnCount() >= keyProperties.length) { Object soleParam = getSoleParameter(parameter); if (soleParam != null) { assignKeysToParam(configuration, rs, keyProperties, soleParam); } else { assignKeysToOneOfParams(configuration, rs, keyProperties, (Map<?, ?>) parameter); } } } catch (Exception e) { throw new ExecutorException("Error getting generated key or setting result to parameter object. Cause: " + e, e); } }
Source:
<code><START> public int hashCode() { <END> int result = binary != null ? binary.hashCode() : 0; result = 31 * result + (host != null ? host.hashCode() : 0); result = 31 * result + (state != null ? state.hashCode() : 0); result = 31 * result + (status != null ? status.hashCode() : 0); result = 31 * result + (disabledReason != null ? disabledReason.hashCode() : 0); result = 31 * result + (updated != null ? updated.hashCode() : 0); result = 31 * result + (zone != null ? zone.hashCode() : 0); result = 31 * result + (id != null ? id.hashCode() : 0); return result; }</code><technical_language>In general, prefer Objects.hashCode(...). is example in Nova [Network](<LINK_0> class</technical_language>

Target:
public int hashCode() { return Objects.hashCode(binary, host, state, status, disabledReason, updated, zone, id); }
Source:
<code>private void processData(final AbstractTripleStore toInsert, final String contentType, final InputStream is, final RDFHandler handler, final String baseURI) throws Exception { final RDFFormat format = RDFFormat .forMIMEType(new MiniMime(contentType).getMimeType()); final RDFParserFactory rdfParserFactory = RDFParserRegistry .getInstance().get(format); final RDFParser rdfParser = rdfParserFactory.getParser(); rdfParser.setValueFactory(toInsert.getValueFactory()); <START> rdfParser.setVerifyData(true); <END> rdfParser.setStopAtFirstError(true); rdfParser.setDatatypeHandling(RDFParser.DatatypeHandling.IGNORE); if (handler != null) { rdfParser.setRDFHandler(handler); } rdfParser.parse(is, baseURI); }</code><technical_language>functions deprecated, values default</technical_language>

Target:
private void processData(final AbstractTripleStore toInsert, final String contentType, final InputStream is, final RDFHandler handler, final String baseURI) throws RDFParseException, IOException, RDFHandlerException { final RDFFormat format = RDFFormat .forMIMEType(new MiniMime(contentType).getMimeType()); final RDFParserFactory rdfParserFactory = RDFParserRegistry .getInstance().get(format); final RDFParser rdfParser = rdfParserFactory.getParser(); rdfParser.setValueFactory(toInsert.getValueFactory()); if (handler != null) { rdfParser.setRDFHandler(handler); } rdfParser.parse(is, baseURI); }
Source:
<code>protected void onLogin(final LoginModel loginModel) { ReportInit.getInstance().init(); ReportInit.getInstance().getReportsInitEvent().addListener(new IEventListener() { @Override <START> public void eventRaised(Event ev, Object sender, EventArgs args) { <END> Frontend.setLoggedInUser(loginModel.getLoggedUser()); beforeUiCommonInitEvent(loginModel); UiCommonInitEvent.fire(eventBus); user.onUserLogin(loginModel.getLoggedUser().getUserName()); clearPassword(loginModel); } }); }</code><technical_language>please call super.onLogin() this is code</technical_language>

Target:
protected void onLogin(final LoginModel loginModel) { ReportInit.getInstance().init(); ReportInit.getInstance().getReportsInitEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { ApplicationInit.super.onLogin(loginModel); } }); }
Source:
<code>public void onNewIntent(Intent intent) { checkArgument(intent != null, "intent may not be null"); <START> this.newIntent = intent; <END> }</code><technical_language>Need verify this is onResume</technical_language>

Target:
public void onNewIntent(Intent intent) { checkArgument(intent != null, "intent may not be null"); if (intent.hasExtra(BACKSTACK_KEY)) { Backstack backstack = Backstack.from(intent.getParcelableExtra(BACKSTACK_KEY), parceler); flow.set(backstack, Flow.Direction.REPLACE); } }
Source:
<code>protected int run() { <START> Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER); <END> System.setProperty("jline.terminal", UnsupportedTerminal.class.getName()); TerminalFactory.reset(); StringBuilder commandLine = new StringBuilder(); for (String arg : args) { if (commandLine.length() > 0) { commandLine.append(" "); } commandLine.append(arg); } Groovysh shell = createShell(stdin, stdout, stderr); return shell.run(commandLine.toString()); }</code><technical_language>this active instance</technical_language>

Target:
protected int run() { Jenkins.get().checkPermission(Jenkins.ADMINISTER); System.setProperty("jline.terminal", UnsupportedTerminal.class.getName()); TerminalFactory.reset(); StringBuilder commandLine = new StringBuilder(); for (String arg : args) { if (commandLine.length() > 0) { commandLine.append(" "); } commandLine.append(arg); } Groovysh shell = createShell(stdin, stdout, stderr); return shell.run(commandLine.toString()); }
Source:
<code>public InstallableUnitDescription readOneIU(InputStream is) throws IOException { Parser parser = new <START> Parser(org.eclipse.tycho.p2.maven.repository.xmlio.MetadataIO.Parser.PARSER_MODE.IU); <END> parser.parse(is, new NullProgressMonitor()); return parser.getUnits().get(0); }</code><technical_language>omit</technical_language>

Target:
public InstallableUnitDescription readOneIU(InputStream is) throws IOException { Parser parser = new Parser(Parser.PARSER_MODE.IU); parser.parse(is, new NullProgressMonitor()); return parser.getUnits().get(0); }
Source:
<code>@Test public void attachMultipleRequests() throws Exception { Action action1 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); Action action2 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); BitmapHunter hunter = new TestableBitmapHunter(picasso, dispatcher, cache, stats, action1); assertThat(hunter.actions).isNull(); hunter.attach(action2); assertThat(hunter.actions).isNotNull(); <START> assertThat(hunter.actions).hasSize(1); <END> }</code><technical_language>chain previous line's assertion</technical_language>

Target:
@Test public void attachMultipleRequests() throws Exception { Action action1 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); Action action2 = mockAction(URI_KEY_1, URI_1, mockImageViewTarget()); BitmapHunter hunter = new TestableBitmapHunter(picasso, dispatcher, cache, stats, action1); assertThat(hunter.actions).isNull(); hunter.attach(action2); assertThat(hunter.actions).isNotNull().hasSize(1); }
Source:
<code>protected boolean doProcess(Record record) { if (!preserveExisting) { record.removeAll(outputFieldName); } ListIterator iter = record.get(inputFieldName).listIterator(); while (iter.hasNext()) { <START> record.put(outputFieldName, doHash(iter.next().toString())); <END> } return super.doProcess(record); }</code><technical_language>adding a bit of logic for user pass a byte[], conversion string byte[]? This enables user algorithm convert input data a byte[](not UTF8 string conversion), in a prior morphline command. lines: Object next = iter.next(); byte[] bytes; if (next instanceof byte[]) { bytes = (byte[]) next; } else { bytes = next.toString(); } ... hex encode (bytes)</technical_language>

Target:
protected boolean doProcess(Record record) { if (!preserveExisting) { record.removeAll(outputFieldName); } ListIterator iter = record.get(inputFieldName).listIterator(); while (iter.hasNext()) { Object inputField = iter.next(); byte[] inputFieldBytes; if (inputField == null ) { inputFieldBytes = null; } else if (inputField instanceof byte[]) { inputFieldBytes = (byte[])inputField; } else { inputFieldBytes = inputField.toString().getBytes(charset); } record.put(outputFieldName, doHash(inputFieldBytes)); } return super.doProcess(record); }
Source:
<code>public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin,":"); String rsType = st.nextToken(); if ("coinmarketcap".equalsIgnoreCase(rsType)) { String preferredFiatCurrency = FiatCurrency.USD.getCode(); String apiKey = null; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } if (st.hasMoreTokens()) { apiKey = st.nextToken(); } return new CoinmarketcapRateSource(apiKey, preferredFiatCurrency); <START> } else if ("coingecko".equalsIgnoreCase(rsType)) { <END> String preferredFiatCurrency = st.hasMoreTokens() ? st.nextToken().toUpperCase() : FiatCurrency.USD.getCode(); return new CoinGeckoRateSource(preferredFiatCurrency); } else if ("coinpaprika".equalsIgnoreCase(rsType)) { String preferredFiatCurrency = st.hasMoreTokens() ? st.nextToken().toUpperCase() : FiatCurrency.USD.getCode(); return new CoinPaprikaRateSource(preferredFiatCurrency); } } return null; }</code><technical_language>Please remove. is provided extension</technical_language>

Target:
public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin,":"); String exchangeType = st.nextToken(); if ("hatchfix".equalsIgnoreCase(exchangeType)) { BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } String preferedFiatCurrency = FiatCurrency.USD.getCode(); if (st.hasMoreTokens()) { preferedFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate,preferedFiatCurrency); } } return null; }
Source:
<code>public final static Pair<TopicDefaultsType, Map<String, TopicProfileType>> getDeploymentTopics( DeploymentType deployment, CompoundErrors errors) { TopicsType topics = deployment.getTopics(); if (topics == null) { return Pair.of(null, null); } TopicDefaultsType defaults = topics.getDefaults(); List<TopicProfileType> profiles = topics.getProfile(); if (profiles == null) { if (hostLog.isDebugEnabled()) { hostLog.debug("No topic profiles in deployment"); } return Pair.of(defaults, null); } Map<String, TopicProfileType> profileMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); for (TopicProfileType profile : profiles) { <START> if (profileMap.put(profile.getName().toUpperCase(), profile) != null) { <END> errors.addErrorMessage("Profile " + profile.getName() + " is defined multiple times"); } } return Pair.of(defaults, profileMap); }</code><technical_language>map is case insensitive force upper case necessary</technical_language>

Target:
public final static Pair<TopicDefaultsType, Map<String, TopicProfileType>> getDeploymentTopics( DeploymentType deployment, CompoundErrors errors) { TopicsType topics = deployment.getTopics(); if (topics == null) { return Pair.of(null, null); } TopicDefaultsType defaults = topics.getDefaults(); List<TopicProfileType> profiles = topics.getProfile(); if (profiles == null) { if (hostLog.isDebugEnabled()) { hostLog.debug("No topic profiles in deployment"); } return Pair.of(defaults, null); } Map<String, TopicProfileType> profileMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); for (TopicProfileType profile : profiles) { if (profileMap.put(profile.getName(), profile) != null) { errors.addErrorMessage("Profile " + profile.getName() + " is defined multiple times"); } } return Pair.of(defaults, profileMap); }
Source:
<code>public CompletionStage<Void> passivateAsync(InternalCacheEntry entry) { final Runnable before = beforePassivate; if (before != null) { before.run(); } CompletionStage<Void> stage = delegate.passivateAsync(entry); <START> if (afterPassivate != null) { <END> return stage.thenRun(afterPassivate); } return stage; }</code><technical_language>caching field needed? done for beforePassivate</technical_language>

Target:
public CompletionStage<Void> passivateAsync(InternalCacheEntry entry) { final Runnable before = beforePassivate; if (before != null) { before.run(); } CompletionStage<Void> stage = delegate.passivateAsync(entry); final Runnable after = afterPassivate; if (after != null) { return stage.thenRun(after); } return stage; }
Source:
<code>public void add(ITmfStateInterval interval) { list.add(interval); start = Math.max(start, interval.getStartTime()); <START> end = Math.min(end, interval.getStartTime()); <END> }</code><technical_language>end = Math.min(end, interval.get***End***Time());</technical_language>

Target:
public void add(ITmfStateInterval interval) { list.add(interval); start = Math.min(start, interval.getStartTime()); end = Math.max(end, interval.getEndTime()); }
Source:
<code>public void run() throws InterruptedException { final int numThreads = 8; final int putsPerThread = 2000; final int totalNumberOfObjects = numThreads * putsPerThread; final DataIdFactory<Long> remoteIdFactory = initDataIdFactory(nextRemoteStoreId); final Callable[] threads = new Callable[numThreads]; for (int index = 0; index < numThreads; index++) { threads[index] = new PutThread(putsPerThread, 1, remoteIdFactory); } <START> final Future<Long>[] futures = ThreadUtils.runConcurrentlyWithResult(threads); <END> long numTotalPutSuccess = 0; for (int index = 0; index < numThreads; index++) { try { numTotalPutSuccess += futures[index].get(); } catch (final ExecutionException e) { LOG.log(Level.SEVERE, "Test thread failed", e); } } if (numTotalPutSuccess != totalNumberOfObjects) { throw new RuntimeException(MSG_OPERATION_FAILED); } synchronize(); final int numUnits = memoryStore.getNumUnits(DATA_TYPE); if (numUnits != totalNumberOfObjects) { throw new RuntimeException(MSG_LOCAL_SIZE_ASSERTION); } }</code><technical_language>a big fan of array of generic type; change method public static <T> List<Future<T>> runConcurrentlyWithResult(final List<Callable<T>> threads), change type of threads futures accordingly</technical_language>

Target:
public void run() { final int numThreads = 8; final int putsPerThread = 2000; final int totalNumberOfObjects = numThreads * putsPerThread; final DataIdFactory<Long> remoteIdFactory = initDataIdFactory(nextRemoteStoreId); final List<Callable<Long>> threads = new ArrayList<>(numThreads); for (int index = 0; index < numThreads; index++) { threads.add(index, new PutThread(putsPerThread, 1, remoteIdFactory)); } final List<Future<Long>> futures = ThreadUtils.runConcurrentlyWithResult(threads); long numTotalPutSuccess = 0; for (int index = 0; index < numThreads; index++) { try { numTotalPutSuccess += futures.get(index).get(); } catch (final ExecutionException | InterruptedException e) { throw new RuntimeException("Test thread failed", e); } } if (numTotalPutSuccess != totalNumberOfObjects) { throw new RuntimeException(MSG_OPERATION_FAILED); } synchronize(); final int numUnits = memoryStore.getNumUnits(DATA_TYPE); if (numUnits != totalNumberOfObjects) { throw new RuntimeException(MSG_LOCAL_SIZE_MISMATCH); } }
Source:
<code>private Table getSysMutexTable() throws SQLException, IOException { <START> String table = SYSTEM_MUTEX_NAME; <END> TableName tableName = TableName.valueOf(table); try (Admin admin = getAdmin()) { if (!admin.tableExists(tableName)) { table = table.replace(QueryConstants.NAME_SEPARATOR, QueryConstants.NAMESPACE_SEPARATOR); tableName = TableName.valueOf(table); } return connection.getTable(tableName); } }</code><technical_language>nit: table variable is unnecessary</technical_language>

Target:
public Table getSysMutexTable() throws SQLException, IOException { String table = SYSTEM_MUTEX_NAME; TableName tableName = TableName.valueOf(table); try (Admin admin = getAdmin()) { if (!admin.tableExists(tableName)) { table = table.replace(QueryConstants.NAME_SEPARATOR, QueryConstants.NAMESPACE_SEPARATOR); tableName = TableName.valueOf(table); } return connection.getTable(tableName); } }
Source:
<code>public boolean applicabilityExistsOnBranchView(BranchId branch, ArtifactId viewId, String applicability) { List<GammaId> tuples = new ArrayList<>(); queryFactory.tupleQuery().getTuple2GammaFromE1E2(CoreTupleTypes.ViewApplicability, branch, viewId, applicability, <START> tuples::add); <END> return (!tuples.isEmpty()); }</code><technical_language>need parens</technical_language>

Target:
public boolean applicabilityExistsOnBranchView(BranchId branch, ArtifactId viewId, String applicability) { List<GammaId> tuples = new ArrayList<>(); queryFactory.tupleQuery().getTuple2GammaFromE1E2(CoreTupleTypes.ViewApplicability, branch, viewId, applicability, tuples::add); return !tuples.isEmpty(); }
Source:
<code>public CheckNotificationsSupportedTask(ServerConnection connection) { <START> super(null, "Check if smart notifications is available in the SonarQube edition", true); <END> this.connection = connection; }</code><technical_language>is -></technical_language>

Target:
public CheckNotificationsSupportedTask(ServerConnection connection) { super(null, "Check if smart notifications are available in the SonarQube edition", true); this.connection = connection; }
Source:
<code>public static UserSession createMockUserSession(Person person) { UserSession userSession = mock(UserSession.class); <START> String principleId = person.getPrincipalId(); <END> when(userSession.getPrincipalId()).thenReturn(principleId); String principleName = person.getPrincipalName(); when(userSession.getPrincipalName()).thenReturn(principleName); when(userSession.getLoggedInUserPrincipalName()).thenReturn(principleName); when(userSession.getPerson()).thenReturn(person); when(userSession.getActualPerson()).thenReturn(person); return userSession; }</code><technical_language>Typo in variable name</technical_language>

Target:
public static UserSession createMockUserSession(Person person) { UserSession userSession = mock(UserSession.class); String principalId = person.getPrincipalId(); when(userSession.getPrincipalId()).thenReturn(principalId); String principalName = person.getPrincipalName(); when(userSession.getPrincipalName()).thenReturn(principalName); when(userSession.getLoggedInUserPrincipalName()).thenReturn(principalName); when(userSession.getPerson()).thenReturn(person); when(userSession.getActualPerson()).thenReturn(person); return userSession; }
Source:
<code>public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes attributes) { URI requestUri = request.getURI(); String servicePrincipal = makeServicePrincipal(remoteServiceName, requestUri.getHost()); GSSContext context = doAs(loginContext.getSubject(), () -> { GSSContext result = GSS_MANAGER.createContext( GSS_MANAGER.createName(servicePrincipal, null), SPNEGO_OID, clientCredential, <START> GSSContext.INDEFINITE_LIFETIME); <END> result.requestMutualAuth(true); result.requestConf(true); result.requestInteg(true); result.requestCredDeleg(false); return result; }); try { byte[] token = context.initSecContext(new byte[0], 0, 0); if (token != null) { return new SpnegoResult( headerInfo.getHeader(), UriUtil.normalizedUri(requestUri), format("%s %s", NEGOTIATE, Base64.getEncoder().encodeToString(token))); } } catch (GSSException e) { } finally { try { context.dispose(); } catch (GSSException e) { } } throw new AuthenticationException(format("Failed to establish GSSContext for request %s", requestUri)); }</code><technical_language>static import of constants</technical_language>

Target:
public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes attributes) { URI requestUri = request.getURI(); String servicePrincipal = makeServicePrincipal(remoteServiceName, requestUri.getHost()); GSSContext context = doAs(loginContext.getSubject(), () -> { GSSContext result = GSS_MANAGER.createContext( GSS_MANAGER.createName(servicePrincipal, null), SPNEGO_OID, clientCredential, INDEFINITE_LIFETIME); result.requestMutualAuth(true); result.requestConf(true); result.requestInteg(true); result.requestCredDeleg(false); return result; }); try { byte[] token = context.initSecContext(new byte[0], 0, 0); if (token != null) { return new SpnegoResult( UriUtil.normalizedUri(requestUri), headerInfo.getHeader(), format("%s %s", NEGOTIATE, Base64.getEncoder().encodeToString(token))); } } catch (GSSException e) { } finally { try { context.dispose(); } catch (GSSException e) { } } throw new AuthenticationException(format("Failed to establish GSSContext for request %s", requestUri)); }
Source:
<code>public void addItem(String itemName, String property) { <START> logger.debug("Mapping: itemname=" + itemName + " & property = " + property); <END> if (!watches.containsKey(itemName)) { watches.put(itemName, property); } }</code><technical_language>parameterized logging, like: java logger.debug("Mapping: itemname={} & property = {}", itemName, property);</technical_language>

Target:
public void addItem(String itemName, String property) { logger.debug("Mapping: itemname = & property = {}", itemName, property); if (!watches.containsKey(itemName)) { watches.put(itemName, property); } }
Source:
<code><START> public void onPlayerActive(CallbackInfo ci) { <END> ((IMixinNetHandlerPlayServer) this.connection).resendLatestResourcePackRequest(); }</code><technical_language>above; is need this injector public</technical_language>

Target:
private void onPlayerActive(CallbackInfo ci) { ((IMixinNetHandlerPlayServer) this.connection).resendLatestResourcePackRequest(); }
Source:
<code>public FileFavoritesCtrl(ProjectState projectState, FileNavigationState navState){ this.navState = navState; projectState.configProperty().addListener((p, o, n) -> { if (n == null) return; Path path = Paths.get(n.getProjectPath()); this.navState.getFavoriteFolders().add(new LocalFile(path)); this.navState.getFavoriteFolders().add(new LocalFile(path.resolve(Paths.get("schemas")))); this.navState.setSelectedParent(this.navState.getFavoriteFolders().get(0)); }); this.navState.selectedParentProperty().addListener((p, o, n) -> { <START> if (n == null || n.equals(fileFavorites.getSelectionModel().getSelectedItem())) <END> return; fileFavorites.getSelectionModel().clearSelection(); }); }</code><technical_language>Listeners a UI component added in initialize method</technical_language>

Target:
public FileFavoritesCtrl(ProjectState projectState, FileNavigationState navState){ this.navState = navState; projectState.configProperty().addListener((p, o, n) -> { if (n == null) return; Path path = Paths.get(n.getProjectPath()); this.navState.getFavoriteFolders().add(new LocalFile(path)); this.navState.getFavoriteFolders().add(new LocalFile(path.resolve(Paths.get("schemas")))); this.navState.setSelectedParent(this.navState.getFavoriteFolders().get(0)); }); }
Source:
<code>public void testGetAllForHost() { List<NetworkAttachment> result = dao.getAllForHost(FixturesTool.NETWORK_ATTACHMENT_HOST); assertNotNull(result); assertEquals(2, result.size()); result.forEach(r -> assertNull(r.getHostNetworkQos())); result.forEach(r-> { HostNetworkQos hostNetworkQos = new HostNetworkQos(); hostNetworkQos.setId(r.getId()); hostNetworkQosDao.save(hostNetworkQos); <START> }); <END> result = dao.getAllForHost(FixturesTool.NETWORK_ATTACHMENT_HOST); assertNotNull(result); assertEquals(2, result.size()); result.forEach(r -> { assertNotNull(r.getHostNetworkQos()); assertEquals(r.getId(), r.getHostNetworkQos().getId()); assertNull(r.getHostNetworkQos().getOutAverageLinkshare()); assertNull(r.getHostNetworkQos().getOutAverageRealtime()); assertNull(r.getHostNetworkQos().getOutAverageUpperlimit()); }); }</code><technical_language>extra effort include OutAverageLinkshare, OutAverageRealtime OutAverageUpperlimit</technical_language>

Target:
public void testGetAllForHost() { List<NetworkAttachment> result = dao.getAllForHost(FixturesTool.NETWORK_ATTACHMENT_HOST); assertNotNull(result); assertEquals(2, result.size()); result.forEach(r -> assertNull(r.getHostNetworkQos())); result.forEach(r-> { HostNetworkQos hostNetworkQos = new HostNetworkQos(); hostNetworkQos.setId(r.getId()); hostNetworkQos.setOutAverageLinkshare(31); hostNetworkQos.setOutAverageUpperlimit(32); hostNetworkQos.setOutAverageRealtime(33); hostNetworkQosDao.save(hostNetworkQos); }); result = dao.getAllForHost(FixturesTool.NETWORK_ATTACHMENT_HOST); assertNotNull(result); assertEquals(2, result.size()); result.forEach(r -> { assertNotNull(r.getHostNetworkQos()); assertEquals(r.getId(), r.getHostNetworkQos().getId()); assertEquals(31, r.getHostNetworkQos().getOutAverageLinkshare().intValue()); assertEquals(32, r.getHostNetworkQos().getOutAverageUpperlimit().intValue()); assertEquals(33, r.getHostNetworkQos().getOutAverageRealtime().intValue()); }); }
Source:
<code>public List<RichMember> getSponsoredMembers(PerunSession sess, Vo vo, User user, List<String> attrNames) throws InternalErrorException, AttributeNotExistsException, PrivilegeException, VoNotExistsException, UserNotExistsException { Utils.checkPerunSession(sess); perunBl.getVosManagerBl().checkVoExists(sess, vo); perunBl.getUsersManagerBl().checkUserExists(sess, user); if (!(AuthzResolver.isAuthorized(sess, Role.REGISTRAR)||AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo))) { throw new PrivilegeException(sess, "getSponsoredRichMembers"); } List<AttributeDefinition> attributeDefinitions = new ArrayList<>(); for (String attrName : attrNames) { attributeDefinitions.add(getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attrName)); } List<RichMember> richMembers = membersManagerBl.convertMembersToRichMembers(sess, membersManagerBl.getSponsoredMembers(sess, vo, user)); richMembers = membersManagerBl.convertMembersToRichMembersWithAttributes(sess, richMembers, attributeDefinitions); <START> richMembers = membersManagerBl.filterOnlyAllowedAttributes(sess, richMembers); <END> return richMembers; }</code><technical_language>I prefer filterOnlyAllowedAttributes(PerunSession sess, List<RichMember> richMembers, Group group, boolean useContext) group = NULL useContext = TRUE. optimized check rights for member store results based attribute name. If members VO, apply rights member/user attributes. If VO, exception is thrown. Group is optional useful for this use-case. saves "init" part of attribute rights check method, checks if attribute definition exists etc. adds overhead for member attribute returned</technical_language>

Target:
public List<RichMember> getSponsoredMembers(PerunSession sess, Vo vo, User user, List<String> attrNames) throws InternalErrorException, AttributeNotExistsException, PrivilegeException, VoNotExistsException, UserNotExistsException { Utils.checkPerunSession(sess); perunBl.getVosManagerBl().checkVoExists(sess, vo); perunBl.getUsersManagerBl().checkUserExists(sess, user); if (!(AuthzResolver.isAuthorized(sess, Role.REGISTRAR)||AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo))) { throw new PrivilegeException(sess, "getSponsoredMembers"); } List<AttributeDefinition> attributeDefinitions = new ArrayList<>(); for (String attrName : attrNames) { attributeDefinitions.add(getPerunBl().getAttributesManagerBl().getAttributeDefinition(sess, attrName)); } List<RichMember> richMembers = membersManagerBl.convertMembersToRichMembers(sess, membersManagerBl.getSponsoredMembers(sess, vo, user)); richMembers = membersManagerBl.convertMembersToRichMembersWithAttributes(sess, richMembers, attributeDefinitions); richMembers = membersManagerBl.filterOnlyAllowedAttributes(sess, richMembers, null, true); return richMembers; }
Source:
<code>private void createNotificationChannel() { NotificationChannel serviceChannel = new NotificationChannel( NOTIFICATION_CHANNEL_ID, "Telescope Service Channel", NotificationManager.IMPORTANCE_DEFAULT ); NotificationManager notificationManager = getSystemService(NotificationManager.class); <START> notificationManager.createNotificationChannel(serviceChannel); <END> }</code><technical_language>Is this safe do repeatedly? do need check no-op if present</technical_language>

Target:
private void createNotificationChannel() { NotificationChannel serviceChannel = new NotificationChannel( NOTIFICATION_CHANNEL_ID, "Telescope", NotificationManager.IMPORTANCE_MIN ); NotificationManager notificationManager = getSystemService(NotificationManager.class); notificationManager.createNotificationChannel(serviceChannel); }
Source:
<code>public static NamedVector of(Map<String, Double> values) { SparseVector vector = new SparseVector(values.size(), StorageConstants.RANDOM_ACCESS_MODE); <START> for (int i = 0; i < values.size(); i++) <END> vector.set(i, Double.NaN); Map<String, Integer> dict = new HashMap<>(); int idx = 0; for (Map.Entry<String, Double> e : values.entrySet()) { dict.put(e.getKey(), idx); vector.set(idx, e.getValue()); idx++; } return new DelegatingNamedVector(vector, dict); }</code><technical_language>reason for Double.NaN setting? values below</technical_language>

Target:
public static SimpleNamedVector of(Map<String, Double> values) { Map<String, Integer> dict = new HashMap<>(); int idx = 0; for (Map.Entry<String, Double> e : values.entrySet()) { dict.put(e.getKey(), idx); idx++; } SimpleNamedVector vector = new SimpleNamedVector(dict); for (Map.Entry<String, Double> e : values.entrySet()) vector.set(e.getKey(), e.getValue()); return vector; }
Source:
<code>public void addFileToPackage(TarArchiveOutputStream tarArchiveOutputStream, File file, String path) throws IOException { <START> CompressionUtils.addFileToTar(tarArchiveOutputStream, file, getLibPath() + path); <END> }</code><technical_language>Please static import for CompressionUtils. addFolderToTar above</technical_language>

Target:
public void addFileToPackage(TarArchiveOutputStream tarArchiveOutputStream, File file, String path) throws IOException { addFileToTar(tarArchiveOutputStream, file, getLibPath() + path); }
Source:
<code>void setupToC(@NonNull Page page, @NonNull WikiSite wiki, boolean firstPage) { adapter.setPage(page); rtl = L10nUtil.isLangRTL(wiki.languageCode()); showOnboading = Prefs.isTocTutorialEnabled() && !page.isMainPage() && !firstPage && !Prefs.showActionFeedIndicator(); tocList.setRtl(rtl); setConditionalLayoutDirection(tocContainer, wiki.languageCode()); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)tocContainer.getLayoutParams(); <START> params.gravity = rtl ? Gravity.START : Gravity.END; <END> tocContainer.setLayoutParams(params); funnel = new ToCInteractionFunnel(WikipediaApp.getInstance(), wiki, page.getPageProperties().getPageId(), adapter.getCount()); }</code><technical_language>is a reason explicit LEFT RIGHT for gravity. system language is RTL language, "start" "right", position of ToC broken now. Please restrict this PR does: "scroller onboarding text visibility"</technical_language>

Target:
void setupToC(@NonNull Page page, @NonNull WikiSite wiki, boolean firstPage) { adapter.setPage(page); rtl = L10nUtil.isLangRTL(wiki.languageCode()); showOnboading = Prefs.isTocTutorialEnabled() && !page.isMainPage() && !firstPage && !Prefs.showActionFeedIndicator(); tocList.setRtl(rtl); setConditionalLayoutDirection(tocContainer, wiki.languageCode()); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)tocContainer.getLayoutParams(); params.gravity = rtl ? Gravity.LEFT : Gravity.RIGHT; tocContainer.setLayoutParams(params); funnel = new ToCInteractionFunnel(WikipediaApp.getInstance(), wiki, page.getPageProperties().getPageId(), adapter.getCount()); }
Source:
<code>public void testGetBuildsSummary() throws Exception { TestBuildsView view = Mockito.spy(new TestBuildsView()); when(view.getContentProvider()).thenReturn(new BuildContentProvider()); when(view.getModel()).thenReturn(BuildsUiInternal.getModel()); assertTrue(view.getBuildsSummary().isEmpty()); <START> assertBuildSummary(view.getBuildsSummary(), false, false, false); <END> view.getModel().getPlans().add(createBuildPlan(BuildStatus.SUCCESS)); view.getModel().getPlans().add(createBuildPlan(BuildStatus.SUCCESS)); view.getModel().getPlans().add(createBuildPlan(BuildStatus.SUCCESS)); assertBuildSummary(view.getBuildsSummary(), true, false, false); view.getModel().getPlans().add(createBuildPlan(BuildStatus.UNSTABLE)); view.getModel().getPlans().add(createBuildPlan(BuildStatus.UNSTABLE)); assertBuildSummary(view.getBuildsSummary(), false, true, false); view.getModel().getPlans().add(createBuildPlan(BuildStatus.FAILED)); assertBuildSummary(view.getBuildsSummary(), false, false, true); assertFalse(view.getBuildsSummary().isEmpty()); assertEquals("3 Succeeded, 2 Unstable, 1 Failed", view.getBuildsSummary().toString()); }</code><technical_language>Please add a new line assertion method easier read</technical_language>

Target:
public void testGetBuildsSummary() throws Exception { TestBuildsView view = Mockito.spy(new TestBuildsView()); when(view.getContentProvider()).thenReturn(new BuildContentProvider()); when(view.getModel()).thenReturn(BuildsUiInternal.getModel()); assertBuildSummary(view.getBuildsSummary(), false, false, false); assertTrue(view.getBuildsSummary().isEmpty()); view.getModel().getPlans().add(createBuildPlan(BuildStatus.SUCCESS)); view.getModel().getPlans().add(createBuildPlan(BuildStatus.SUCCESS)); view.getModel().getPlans().add(createBuildPlan(BuildStatus.SUCCESS)); assertBuildSummary(view.getBuildsSummary(), true, false, false); view.getModel().getPlans().add(createBuildPlan(BuildStatus.UNSTABLE)); view.getModel().getPlans().add(createBuildPlan(BuildStatus.UNSTABLE)); assertBuildSummary(view.getBuildsSummary(), false, true, false); view.getModel().getPlans().add(createBuildPlan(BuildStatus.FAILED)); assertBuildSummary(view.getBuildsSummary(), false, false, true); assertFalse(view.getBuildsSummary().isEmpty()); assertEquals("3 Succeeded, 2 Unstable, 1 Failed", view.getBuildsSummary().toString()); }
Source:
<code><START> public Text toText() { <END> Text.Builder builder = null; for (Object element : this.elements) { if (element instanceof TextElement) { if (builder == null) { builder = Text.builder(); } ((TextElement) element).applyTo(builder); } else { String str = element.toString(); if (builder == null) { builder = Text.builder(str); } else { builder.append(Text.of(str)); } } } return Optional.ofNullable(builder).orElse(Text.builder()).build(); }</code><technical_language>Is a toText(Text.Builder) method? nice pass already-made builder here, if</technical_language>

Target:
public Text toText() { return this.text; }
Source:
<code>public Set<GPUInfo> retrieveResourceInfo(long gpuAmount) throws Exception { if (gpuAmount <= 0) { throw new FlinkException("The amount of GPU should be positive."); } final Set<GPUInfo> gpuResources = new HashSet<>(); String output = executeDiscoveryScript(discoveryScript, gpuAmount, args); if (output != null && !output.isEmpty()) { String[] indexes = output.split(","); for (String index : indexes) { gpuResources.add(new GPUInfo(index)); } } LOG.info("Discover the GPU resource {}.", gpuResources); <START> return Collections.unmodifiableSet(gpuResources); <END> }</code><technical_language>check discoveryScript.canExecute()</technical_language>

Target:
public Set<GPUInfo> retrieveResourceInfo(long gpuAmount) throws Exception { Preconditions.checkArgument(gpuAmount > 0, "The gpuAmount should be positive when retrieving the GPU resource information."); final Set<GPUInfo> gpuResources = new HashSet<>(); String output = executeDiscoveryScript(discoveryScriptFile, gpuAmount, args); if (!output.isEmpty()) { String[] indexes = output.split(","); for (String index : indexes) { if (!StringUtils.isNullOrWhitespaceOnly(index)) { gpuResources.add(new GPUInfo(index.trim())); } } } LOG.info("Discover GPU resources: {}.", gpuResources); return Collections.unmodifiableSet(gpuResources); }
Source:
<code>public void emptyRefreshResponse() { setTimeDynamic(NanoTime::now); LockToken t1 = LockToken.of(UUID.randomUUID()); LockToken t2 = LockToken.of(UUID.randomUUID()); Leased<Set<LockToken>> refreshResult = heldLocksCollection.refresh(ImmutableSet.of(t1, t2)); assertThat(refreshResult.value()).isEmpty(); <START> assertThat(refreshResult.lease().leaderTime().currentTime()).isLessThan(NanoTime.now()); <END> }</code><technical_language>isLessThanOrEqualTo</technical_language>

Target:
public void emptyRefreshResponse() { LockToken t1 = LockToken.of(UUID.randomUUID()); LockToken t2 = LockToken.of(UUID.randomUUID()); Leased<Set<LockToken>> refreshResult = heldLocksCollection.refresh(ImmutableSet.of(t1, t2)); assertThat(refreshResult.value()).isEmpty(); assertThat(refreshResult.lease().leaderTime().currentTime()).isLessThanOrEqualTo(time.get()); }
Source:
<code>String handleResponse(final HttpRequestBase requestBase, final CloseableHttpResponse response) throws IOException { String result = StringUtils.EMPTY; final HttpEntity entity = response.getEntity(); if (null != entity) { result = EntityUtils.toString(entity); if (response.getStatusLine().getStatusCode() >= 400) { <START> PageObjectLogging.logInfo("Error response:", response.toString()); <END> throw new RemoteException("Error while invoking request. " + " Method: " + requestBase.getMethod() + " Url: " + requestBase.getURI().toString() + " Response: " + result); } } return result; }</code><technical_language>log " Response: " + result. is **the** response</technical_language>

Target:
String handleResponse(final HttpRequestBase requestBase, final CloseableHttpResponse response) throws IOException { String result = StringUtils.EMPTY; final HttpEntity entity = response.getEntity(); if (null != entity) { result = EntityUtils.toString(entity); if (response.getStatusLine().getStatusCode() >= 400) { PageObjectLogging.logInfo("Error response:", result); throw new RemoteException("Error while invoking request. " + " Method: " + requestBase.getMethod() + " Url: " + requestBase.getURI().toString() + " Response: " + result); } } return result; }
Source:
<code>public static Cipher getCipher(String cipherSuite, String securityProvider) { Cipher cipher = null; if (cipherSuite.equals("NullCipher")) { cipher = new NullCipher(); } else { try { <START> cipher = Cipher.getInstance(cipherSuite, securityProvider); <END> } catch (NoSuchAlgorithmException e) { log.error(String.format("Accumulo configuration file contained a cipher suite \"%s\" that was not recognized by any providers", cipherSuite)); throw new RuntimeException(e); } catch (NoSuchPaddingException e) { log.error(String.format("Accumulo configuration file contained a cipher, \"%s\" with a padding that was not recognized by any providers", cipherSuite)); throw new RuntimeException(e); } catch (NoSuchProviderException e) { log.error(String.format("Accumulo configuration file contained a provider, \"%s\" an unrecognized provider", securityProvider)); throw new RuntimeException(e); } } return cipher; }</code><technical_language>This override system-wide prioritized crypto providers for Java set system administrator. This in some cases, I this default. I set default null, instead of SunJCE, if is null, call one-parameter version of this method, respects system-wide security settings. specific provider if null. suggesting friendlier system administrators ensure systems compliant organizational requirements. more sense if a single crypto support of algorithms user specified, default behavior is search providers set system administrator find work for a algorithm</technical_language>

Target:
public static Cipher getCipher(String cipherSuite, String securityProvider) { Cipher cipher = null; if (cipherSuite.equals("NullCipher")) { cipher = new NullCipher(); } else { try { if (securityProvider == null || securityProvider.equals("")) { cipher = Cipher.getInstance(cipherSuite); } else { cipher = Cipher.getInstance(cipherSuite, securityProvider); } } catch (NoSuchAlgorithmException e) { log.error(String.format("Accumulo configuration file contained a cipher suite \"%s\" that was not recognized by any providers", cipherSuite)); throw new RuntimeException(e); } catch (NoSuchPaddingException e) { log.error(String.format("Accumulo configuration file contained a cipher, \"%s\" with a padding that was not recognized by any providers", cipherSuite)); throw new RuntimeException(e); } catch (NoSuchProviderException e) { log.error(String.format("Accumulo configuration file contained a provider, \"%s\" an unrecognized provider", securityProvider)); throw new RuntimeException(e); } } return cipher; }
Source:
<code>public static void setup() throws Exception { <START> Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(2); <END> serverProps.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(20)); serverProps.put(QueryServices.MAX_SERVER_METADATA_CACHE_TIME_TO_LIVE_MS_ATTRIB, Long.toString(5)); serverProps.put(QueryServices.EXTRA_JDBC_ARGUMENTS_ATTRIB, QueryServicesOptions.DEFAULT_EXTRA_JDBC_ARGUMENTS); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(2); clientProps.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true)); clientProps.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5)); clientProps.put(QueryServices.TRANSACTIONS_ENABLED, Boolean.TRUE.toString()); clientProps.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, Boolean.TRUE.toString()); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); }</code><technical_language>nit: serverProps 3 elements. this 3 instead of 2? 4 instead of 2 for line 85</technical_language>

Target:
public static void setup() throws Exception { IndexToolIT.setup(); }
Source:
<code>public TogglzFeature setFeatureState(@Selector String featureName, boolean enabled) { <START> final Feature feature = featureProvider.getFeatures().stream() <END> .filter(f -> f.name().equals(featureName)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Could not find feature with name " + featureName)); FeatureState featureState = featureManager.getFeatureState(feature); if (featureState.isEnabled() != enabled) { featureState.setEnabled(enabled); featureManager.setFeatureState(featureState); return new TogglzFeature(feature, featureState); } return null; }</code><technical_language>featureManager.getFeatures() instead</technical_language>

Target:
public TogglzFeature setFeatureState(@Selector String featureName, boolean enabled) { final Feature feature = featureManager.getFeatures().stream() .filter(f -> f.name().equals(featureName)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Could not find feature with name " + featureName)); FeatureState featureState = featureManager.getFeatureState(feature); featureState.setEnabled(enabled); featureManager.setFeatureState(featureState); return new TogglzFeature(feature, featureState); }
Source:
<code>public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + fResult; result = prime * result + ((fType == null) ? 0 : fType.hashCode()); result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); <START> result = prime * result + ((fValueNumber == null) ? 0 : fValueNumber.hashCode()); <END> result = prime * result + ((fValueTimestamp == null) ? 0 : fValueTimestamp.hashCode()); return result; }</code><technical_language>fValueNumber fValueTimestamp derived fValue fType do need considered for hashCode() equals()</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + fResult; result = prime * result + ((fType == null) ? 0 : fType.hashCode()); result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); return result; }