auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static <T> Digraph<T> buildFilteredDigraph(Digraph<T> initialGraph, Predicate<T> filterOut, Class<T> clazz) { Digraph<T> res = new Digraph<>(clazz); Set<Vertex<T>> toRemove = new LinkedHashSet<>(); for (Vertex<T> vertex : initialGraph.vertexList) { if (!filterOut.test(vertex.id)) { res.addVertex(vertex.id); } else { toRemove.add(vertex); } } Set<Edge<T>> edges = new LinkedHashSet<>(initialGraph.getEdges()); for (Vertex<T> vertexToRemove : toRemove) { Set<Edge<T>> incoming = edges.stream().filter(edge -> edge.to == <START> vertexToRemove.id).collect(Collectors.toSet()); <END> Set<Edge<T>> outgoing = edges.stream().filter(edge -> edge.from == vertexToRemove.id).collect(Collectors.toSet()); edges.removeAll(incoming); edges.removeAll(outgoing); incoming.forEach(incomingEdge -> outgoing.forEach(outgoingEdge -> edges.add(new Edge<>(incomingEdge.from, outgoingEdge.to)))); } edges.forEach(edge -> res.addEdge(edge.from, edge.to)); return res; }</code><technical_language>HashSet is returned. I prefer Collectors.toCollection(LinkedHashSet::new)</technical_language>

Target:
public static <T> Digraph<T> buildFilteredDigraph(Digraph<T> initialGraph, Predicate<T> filterOut, Class<T> clazz) { Digraph<T> res = new Digraph<>(clazz); Set<Vertex<T>> toRemove = new LinkedHashSet<>(); for (Vertex<T> vertex : initialGraph.vertexList) { if (!filterOut.test(vertex.id)) { res.addVertex(vertex.id); } else { toRemove.add(vertex); } } Set<Edge<T>> edges = new LinkedHashSet<>(initialGraph.getEdges()); for (Vertex<T> vertexToRemove : toRemove) { Set<Edge<T>> incoming = edges.stream().filter(edge -> edge.to == vertexToRemove.id).collect(Collectors.toCollection(LinkedHashSet::new)); Set<Edge<T>> outgoing = edges.stream().filter(edge -> edge.from == vertexToRemove.id).collect(Collectors.toCollection(LinkedHashSet::new)); edges.removeAll(incoming); edges.removeAll(outgoing); incoming.forEach(incomingEdge -> outgoing.forEach(outgoingEdge -> edges.add(new Edge<>(incomingEdge.from, outgoingEdge.to)))); } edges.forEach(edge -> res.addEdge(edge.from, edge.to)); return res; }
Source:
<code>public VelocityContext getConfiguredVelocityContext() { Properties p = new Properties(); p.setProperty(RuntimeConstants.RESOURCE_LOADER, "file, class"); <START> p.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, "/etc/sw360"); <END> p.setProperty("file.resource.loader.class", FileResourceLoader.class.getName()); p.setProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName()); Velocity.init(p); ToolManager velocityToolManager = new ToolManager(); velocityToolManager.configure(VELOCITY_TOOLS_FILE); return new VelocityContext(velocityToolManager.createContext()); }</code><technical_language>"/etc/sw360" is surely defined a constant. CommonUtils.SYSTEM_CONFIGURATION_PATH, for example. public</technical_language>

Target:
public VelocityContext getConfiguredVelocityContext() { Properties p = new Properties(); p.setProperty(RuntimeConstants.RESOURCE_LOADER, "file, class"); p.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, CommonUtils.SYSTEM_CONFIGURATION_PATH); p.setProperty("file.resource.loader.class", FileResourceLoader.class.getName()); p.setProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName()); Velocity.init(p); ToolManager velocityToolManager = new ToolManager(); velocityToolManager.configure(VELOCITY_TOOLS_FILE); return new VelocityContext(velocityToolManager.createContext()); }
Source:
<code>protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { stderr.println("The Jenkins instance has not been started, or was already shut down!"); return -1; } final HashSet<String> hs = new HashSet<String>(); hs.addAll(nodes); for (String node_s : hs) { Node node = null; try { node = jenkins.getNode(node_s); if(node == null) { stderr.format("No such node '%s'\n", node_s); errorOccurred = true; continue; } try { <START> node.checkPermission(Computer.DELETE); <END> } catch (Exception e) { stderr.println(e.getMessage()); errorOccurred = true; continue; } jenkins.removeNode(node); } catch (Exception e) { stderr.format("Unexpected exception occurred during deletion of node '%s': %s\n", node == null ? "(null)" : node.toComputer().getName(), e.getMessage() ); errorOccurred = true; continue; } } return errorOccurred ? -1 : 0; }</code><technical_language>hasPermission()</technical_language>

Target:
protected int run() throws Exception { boolean errorOccurred = false; final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { stderr.println("The Jenkins instance has not been started, or was already shut down!"); return -1; } final HashSet<String> hs = new HashSet<String>(); hs.addAll(nodes); for (String node_s : hs) { Node node = null; try { node = jenkins.getNode(node_s); if(node == null) { stderr.format("No such node '%s'\n", node_s); errorOccurred = true; continue; } try { node.checkPermission(Computer.DELETE); } catch (Exception e) { stderr.println(e.getMessage()); errorOccurred = true; continue; } jenkins.removeNode(node); } catch (Exception e) { final String errorMsg = String.format("Unexpected exception occurred during deletion of node '%s': %s", node == null ? "(null)" : node.toComputer().getName(), e.getMessage()); stderr.println(errorMsg); LOGGER.warning(errorMsg); errorOccurred = true; continue; } } return errorOccurred ? -1 : 0; }
Source:
<code>public void setWillNotDraw(boolean willNotDraw) { <START> if (willNotDraw) { <END> throw new DeveloperError("setWillNotDraw(true) is not compatible with custom drawing."); } super.setWillNotDraw(false); }</code><technical_language>This totally disallowed, for consistency rest of views, revert change in ctor</technical_language>

Target:
public void setWillNotDraw(boolean willNotDraw) { throw new DeveloperError("Changing setWillNotDraw() is not compatible with custom drawing."); }
Source:
<code>protected void run() throws UnloggedFailure, Failure, Exception { for (AccountGroup.Id groupId : groups) { GroupResource resource = toResource(groupId); if (!accountsToRemove.isEmpty()) { <START> deleteMembers.apply(resource, fromMembers(accountsToRemove)); <END> } if (!groupsToRemove.isEmpty()) { deleteIncludedGroups.apply(resource, fromGroups(groupsToRemove)); } if (!accountsToAdd.isEmpty()) { reportMembersAdded(resource.getName(), addMembers.apply(resource, fromMembers(accountsToAdd))); } if (!groupsToInclude.isEmpty()) { reportGroupsAdded(resource.getName(), addIncludedGroups.apply(resource, fromGroups(groupsToInclude))); } } }</code><technical_language>this is unexpected user added members/included groups printed out, is output for deletion of members / exclusion of groups</technical_language>

Target:
protected void run() throws UnloggedFailure, Failure, Exception { for (AccountGroup.UUID groupUuid : groups) { GroupResource resource = groupsCollection.parse(TopLevelResource.INSTANCE, IdString.fromUrl(groupUuid.get())); if (!accountsToRemove.isEmpty()) { deleteMembers.get().apply(resource, fromMembers(accountsToRemove)); reportMembersAction("removed from", resource, accountsToRemove); } if (!groupsToRemove.isEmpty()) { deleteIncludedGroups.get().apply(resource, fromGroups(groupsToRemove)); reportGroupsAction("excluded from", resource, groupsToRemove); } if (!accountsToAdd.isEmpty()) { addMembers.get().apply(resource, fromMembers(accountsToAdd)); reportMembersAction("added to", resource, accountsToAdd); } if (!groupsToInclude.isEmpty()) { addIncludedGroups.get().apply(resource, fromGroups(groupsToInclude)); reportGroupsAction("included to", resource, groupsToInclude); } } }
Source:
<code>public <B extends RenderedReport.Builder<B, ?>> CompletionStage<B> render( final S source, final F format, final TimeRange timeRange, final B builder, final Duration timeout ) { LOGGER.debug() .setMessage("rendering") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); final CompletableFuture<DevToolsService> createDts = CompletableFuture.supplyAsync(() -> _devToolsFactory.create(getIgnoreCertificateErrors(source), _chromeArgs) ); final CompletableFuture<B> result = createDts.thenCompose(dts -> dts.navigate(getUri(source).toString()).thenCompose(nothing -> { LOGGER.debug() .setMessage("page load completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); return whenLoaded(dts, source, format, timeRange, builder); }) ).toCompletableFuture(); result.whenComplete((x, e) -> { LOGGER.debug() .setMessage("rendering completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .addData("result", x) .addData("exception", e) .log(); <START> createDts.thenAccept(DevToolsService::close); <END> }); _timeoutExecutor.schedule(() -> result.cancel(true), timeout.toNanos(), TimeUnit.NANOSECONDS); return result; }</code><technical_language>This moved immediately createDts is created clear this is a cleanup operation. ~That appears valid a future runs independently of other downstream futures in reporting chain.~ Edit: I realized this work want operation complete close it, changing this close immediately</technical_language>

Target:
public <B extends RenderedReport.Builder<B, ?>> CompletionStage<B> render( final S source, final F format, final TimeRange timeRange, final B builder, final Duration timeout ) { LOGGER.debug() .setMessage("rendering") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); final CompletableFuture<DevToolsService> createDts = CompletableFuture.supplyAsync( () -> _devToolsFactory.create(getIgnoreCertificateErrors(source), _chromeArgs), _executor ); final CompletableFuture<B> result = createDts.thenCompose(dts -> dts.navigate(getUri(source).toString(), _executor).thenCompose(nothing -> { LOGGER.debug() .setMessage("page load completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .log(); return whenLoaded(dts, source, format, timeRange, builder); }) ).toCompletableFuture(); result.whenComplete((x, e) -> { LOGGER.debug() .setMessage("rendering completed") .addData("source", source) .addData("format", format) .addData("timeRange", timeRange) .addData("result", x) .addData("exception", e) .log(); createDts.thenAccept(DevToolsService::close); }); _executor.schedule(() -> result.cancel(true), timeout.toNanos(), TimeUnit.NANOSECONDS); return result; }
Source:
<code>public void addReport(IOnDemandAnalysisReport report) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); <START> IPath nodePath = this.getResource().getFullPath(); <END> String reportDisplayName = report.getName(); if (fCurrentReports.containsKey(reportDisplayName)) { reportDisplayName = reportDisplayName + " #2"; for (int nb = 3; fCurrentReports.containsKey(reportDisplayName); nb++) { Matcher matcher = DIGITS_AT_END_PATTERN.matcher(reportDisplayName); reportDisplayName = matcher.replaceFirst(String.valueOf(nb)); } } fCurrentReports.put(reportDisplayName, report); IFolder analysisRes = checkNotNull(root.getFolder(nodePath.append(reportDisplayName))); TmfReportElement elem = new TmfReportElement(reportDisplayName, analysisRes, this, report); addChild(elem); refresh(); }</code><technical_language>remove this</technical_language>

Target:
public void addReport(IOnDemandAnalysisReport report) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath nodePath = getResource().getFullPath(); String reportDisplayName = report.getName(); int i = 1; while (fCurrentReports.containsKey(reportDisplayName)) { i++; reportDisplayName = report.getName() + " #" + i; } fCurrentReports.put(reportDisplayName, report); IFolder analysisRes = checkNotNull(root.getFolder(nodePath.append(reportDisplayName))); TmfReportElement elem = new TmfReportElement(reportDisplayName, analysisRes, this, report); addChild(elem); refresh(); }
Source:
<code>private void emptyQueue() { if (restRequestInfoQueue.size() > 0) { logger.warn("There were residual RestRequestInfos in queue during shutdown", restRequestInfoQueue.size()); restServerMetrics.asyncRequestHandlerResidualQueueSize.inc(restRequestInfoQueue.size()); <START> RestRequestInfo dequeuedPart = restRequestInfoQueue.poll(); <END> while (dequeuedPart != null) { queuingTimeTracker.stopTracking(dequeuedPart, false); if (dequeuedPart.getRestRequestContent() != null) { dequeuedPart.getRestRequestContent().release(); } if (dequeuedPart.isFirstPart()) { requestsInFlight.putIfAbsent(dequeuedPart.getRestRequestMetadata(), true); } dequeuedPart = restRequestInfoQueue.poll(); } } logger.info("There were requests in flight when the DequeuedRequestHandler was shut down", requestsInFlight.size()); Iterator<Map.Entry<RestRequestMetadata, Boolean>> requestMetadata = requestsInFlight.entrySet().iterator(); while (requestMetadata.hasNext()) { requestMetadata.next().getKey().release(); requestMetadata.remove(); } }</code><technical_language>oops, sry. I meant instead of "dequeuedPart" name variable "residualRequestInfo"</technical_language>

Target:
private void emptyQueue() { if (restRequestInfoQueue.size() > 0) { logger.warn("There were residual RestRequestInfos in queue during shutdown", restRequestInfoQueue.size()); restServerMetrics.asyncRequestHandlerResidualQueueSize.inc(restRequestInfoQueue.size()); RestRequestInfo residualRestRequestInfo = restRequestInfoQueue.poll(); while (residualRestRequestInfo != null) { queuingTimeTracker.stopTracking(residualRestRequestInfo); if (residualRestRequestInfo.getRestRequestContent() != null) { residualRestRequestInfo.getRestRequestContent().release(); } if (residualRestRequestInfo.isFirstPart()) { requestsInFlight.putIfAbsent(residualRestRequestInfo.getRestRequestMetadata(), true); } residualRestRequestInfo = restRequestInfoQueue.poll(); } } logger.info("There were requests in flight when the AsyncRequestHandler was shut down", requestsInFlight.size()); Iterator<Map.Entry<RestRequestMetadata, Boolean>> requestMetadata = requestsInFlight.entrySet().iterator(); while (requestMetadata.hasNext()) { requestMetadata.next().getKey().release(); requestMetadata.remove(); } }
Source:
<code>public PaymentMethod(String code, LocalizedString description) { super(); setBennu(Bennu.getInstance()); setCode(code); setDescription(description); <START> createLog(Bundle.MESSAGING, "log.paymentMethod.created", code, description.getContent(I18N.getLocale())); <END> }</code><technical_language>this log description of current locale</technical_language>

Target:
public PaymentMethod(String code, LocalizedString description) { super(); setBennu(Bennu.getInstance()); setCode(code); setDescription(description); createLog(Bundle.MESSAGING, "log.paymentMethod.created", code, getFormattedDescriptionForLog(description)); }
Source:
<code>private void validateVnicMappings(Action action) { <START> if (!(action.isSetVnicProfileMappings() && action.getVnicProfileMappings().isSetVnicProfileMappings())) { return; } action.getVnicProfileMappings().getVnicProfileMappings().forEach(this::validateVnicProfileMapping); <END> }</code><technical_language>please negate condition move #121 'then-clause'</technical_language>

Target:
private void validateVnicMappings(Action action) { if (action.isSetVnicProfileMappings() && action.getVnicProfileMappings().isSetVnicProfileMappings()) { action.getVnicProfileMappings().getVnicProfileMappings().forEach(this::validateVnicProfileMapping); } }
Source:
<code>public static IndexedFixtureIndex lookupIndexedFixturePaths(SQLiteDatabase db, String fixtureName) { Cursor c = db.query(INDEXED_FIXTURE_PATHS_TABLE, new String[]{INDEXED_FIXTURE_PATHS_COL_BASE, INDEXED_FIXTURE_PATHS_COL_CHILD, INDEXED_FIXTURE_PATHS_COL_ATTRIBUTES}, INDEXED_FIXTURE_PATHS_COL_NAME + "=?", new String[]{fixtureName}, null, null, null); try { if (c.getCount() == 0) { return null; } else { c.moveToFirst(); TreeElement attrsHolder = null; byte[] attrsBlob = c.getBlob(c.getColumnIndexOrThrow(INDEXED_FIXTURE_PATHS_COL_ATTRIBUTES)); if (attrsBlob != null) { <START> attrsHolder = SerializationUtil.deserialize(attrsBlob, TreeElement.class); <END> } return new IndexedFixtureIndex(fixtureName, c.getString(c.getColumnIndexOrThrow(INDEXED_FIXTURE_PATHS_COL_BASE)), c.getString(c.getColumnIndexOrThrow(INDEXED_FIXTURE_PATHS_COL_CHILD)), attrsHolder); } } finally { c.close(); } }</code><technical_language>I need prototype factory here. I relevant today, avoid deserializing available</technical_language>

Target:
public static IndexedFixtureIdentifier lookupIndexedFixturePaths(SQLiteDatabase db, String fixtureName) { Cursor c = db.query(INDEXED_FIXTURE_PATHS_TABLE, new String[]{INDEXED_FIXTURE_PATHS_COL_BASE, INDEXED_FIXTURE_PATHS_COL_CHILD, INDEXED_FIXTURE_PATHS_COL_ATTRIBUTES}, INDEXED_FIXTURE_PATHS_COL_NAME + "=?", new String[]{fixtureName}, null, null, null); try { if (c.getCount() == 0) { return null; } else { c.moveToFirst(); return new IndexedFixtureIdentifier( c.getString(c.getColumnIndexOrThrow(INDEXED_FIXTURE_PATHS_COL_BASE)), c.getString(c.getColumnIndexOrThrow(INDEXED_FIXTURE_PATHS_COL_CHILD)), c.getBlob(c.getColumnIndexOrThrow(INDEXED_FIXTURE_PATHS_COL_ATTRIBUTES))); } } finally { c.close(); } }
Source:
<code>public SimpleScript(URL url, Serializable[] parameters) throws InvalidScriptException { <START> super(url, parameters, !PASharedProperties.LAZY_FETCH_SCRIPT.getValueAsBoolean()); <END> }</code><technical_language>worthy put this eval in attribute of Script abstract class ? => property evaluate (and failed if user valid), ease re-usability in other formats class</technical_language>

Target:
public SimpleScript(URL url, Serializable[] parameters) throws InvalidScriptException { super(url, parameters, !isLazyFetch()); }
Source:
<code>public Job createJob(InputStream workflowStream, Map<String, String> replacementVariables, Map<String, String> replacementGenericInfos) throws JobCreationException { try { File temporaryJobContentFile = File.createTempFile("jobContent" + workflowStream.toString().replaceAll("\\W+", ""), ".tmp"); FileUtils.copyInputStreamToFile(workflowStream, temporaryJobContentFile); <START> return createJob(temporaryJobContentFile, replacementVariables, replacementGenericInfos); <END> } catch (JobCreationException jce) { throw jce; } catch (Exception e) { throw new JobCreationException(e); } }</code><technical_language>want add finally temporaryJobContentFile.delete()</technical_language>

Target:
public Job createJob(InputStream workflowStream, Map<String, String> replacementVariables, Map<String, String> replacementGenericInfos) throws JobCreationException { try { return createJobFromInputStream(workflowStream, replacementVariables, replacementGenericInfos); } catch (JobCreationException jce) { throw jce; } catch (Exception e) { throw new JobCreationException(e); } }
Source:
<code>public void finishTree(DetailAST ast) { if (!defined) { if (ast == null) { <START> log(1, 0, MSG_KEY_MISSING); <END> } else { log(ast, MSG_KEY_MISSING); } } }</code><technical_language>in case fall of logging a line number throw exception</technical_language>

Target:
public void finishTree(DetailAST ast) { if (!defined) { if (ast == null) { log(DEFAULT_LINE_NUMBER, MSG_KEY_MISSING); } else { log(ast, MSG_KEY_MISSING); } } }
Source:
<code><START> public void testRuleFlowGroup() throws Exception { <END> }</code><technical_language>Is Jira for this one? tested feature? If not, I vote for erasing this test</technical_language>

Target:
public void testRuleFlowGroup() throws Exception { TrackingAgendaEventListener agenda = new TrackingAgendaEventListener(); RuntimeManager manager = deploymentService.getRuntimeManager(kieJar); RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get()); engine.getKieSession().addEventListener(agenda); Long processInstanceId = startProcessInstance(PROCESS_ID); UserTransaction ut = InitialContext.doLookup(USER_TRANSACTION_NAME); ut.begin(); processService.signalProcessInstance(processInstanceId, "start", "rfg"); Assertions.assertThat(hasNodeLeft(processInstanceId, "rfg")).isTrue(); ut.rollback(); agenda.clear(); processService.execute(kieJar, new FireAllRulesCommand()); Assertions.assertThat(agenda.isRuleFired("dummyRule")).isFalse(); agenda.clear(); ut = InitialContext.doLookup(USER_TRANSACTION_NAME); ut.begin(); processService.signalProcessInstance(processInstanceId, "start", "rfg"); ut.commit(); Assertions.assertThat(hasNodeLeft(processInstanceId, "rfg")).isTrue(); processService.execute(kieJar, new FireAllRulesCommand()); processService.signalProcessInstance(processInstanceId, "finish", null); Assertions.assertThat(agenda.isRuleFired("dummyRule")).isTrue(); Assertions.assertThat(hasProcessInstanceCompleted(processInstanceId)).isTrue(); }
Source:
<code>public void waitOrganizationName(String name) { <START> WaitUtils.sleepQuietly(1); <END> redrawUiElementsTimeout.until( (WebDriver driver) -> driver .findElement(By.xpath(Locators.ORGANIZATION_NAME)) .getAttribute("value") .equals(name)); }</code><technical_language>wait for non-empty attribute return then? avoid WaitUtils.sleepQuietly(1);</technical_language>

Target:
public void waitOrganizationName(String name) { redrawUiElementsTimeout.until( ExpectedConditions.attributeToBeNotEmpty(organizationName, "value")); redrawUiElementsTimeout.until( (WebDriver driver) -> driver .findElement(By.xpath(Locators.ORGANIZATION_NAME)) .getAttribute("value") .equals(name)); }
Source:
<code>public Set<Xid> getInflightXids(String parentNodeName) { Iterator<TransactionImpleHolder> iterator = _transactions.values().iterator(); Set<Xid> toReturn = new HashSet<Xid>(); while (iterator.hasNext()) { TransactionImpleHolder next = iterator.next(); TransactionImple imported = null; try { imported = next.getImported(); } catch (InterruptedException e) { <START> throw new RuntimeException(e); <END> } if (imported != null && imported.getParentNodeName().equals(parentNodeName)) { toReturn.add(imported.baseXid()); } } return toReturn; }</code><technical_language>need re-set interrupted status of thread calling Thread.currentThread().interrupt(). Also, wrapping InterruptedException is generally a good idea; a message "operation interrupted" something</technical_language>

Target:
public Set<Xid> getInflightXids(String parentNodeName) { Iterator<AtomicReference<TransactionImple>> iterator = _transactions.values().iterator(); Set<Xid> toReturn = new HashSet<Xid>(); while (iterator.hasNext()) { AtomicReference<TransactionImple> holder = iterator.next(); TransactionImple imported = holder.get(); if (imported != null && imported.getParentNodeName().equals(parentNodeName)) { toReturn.add(imported.baseXid()); } } return toReturn; }
Source:
<code>public RealmObjectSchema create(String className) { checkEmpty(className, EMPTY_STRING_MSG); String internalTableName = Table.getTableNameForClass(className); if (internalTableName.length() > Table.TABLE_MAX_LENGTH) { throw new IllegalArgumentException("Class name is too long. Limit is 56 characters: " + className.length()); } <START> if (realm.getSharedRealm().hasTable(internalTableName)) { <END> throw new IllegalArgumentException("Class already exists: " + className); } return new StandardRealmObjectSchema(realm, this, realm.getSharedRealm().createTable(internalTableName)); }</code><technical_language>I skip this test if createTable() throws a proper exception name conflict</technical_language>

Target:
public RealmObjectSchema create(String className) { checkEmpty(className, EMPTY_STRING_MSG); String internalTableName = Table.getTableNameForClass(className); if (internalTableName.length() > Table.TABLE_MAX_LENGTH) { throw new IllegalArgumentException("Class name is too long. Limit is 56 characters: " + className.length()); } return new StandardRealmObjectSchema(realm, this, realm.getSharedRealm().createTable(internalTableName)); }
Source:
<code>public String toString() { String name = getName(); if (name == null) { name = Participant.UNKNOWN_NAME; } StringBuilder sb = new StringBuilder(name); sb.append(": "); if (!alternatives.isEmpty()) { sb.append('[') <START> .append(alternatives.get(0).getConfidence()) <END> .append("] ") .append(alternatives.get(0).getTranscription()); } return sb.toString(); }</code><technical_language>note default confidence</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(getName()); sb.append(": "); if (!alternatives.isEmpty()) { sb.append('[') .append(alternatives.get(0).getConfidence()) .append("] ") .append(alternatives.get(0).getTranscription()); } return sb.toString(); }
Source:
<code>public void setStreak(FeedData.Streak streak) { mStreak = streak; <START> init(); <END> }</code><technical_language>Call init: <LINK_0></technical_language>

Target:
public void setStreak(FeedData.Streak streak) { mStreak = streak; if(mStreak != null) { setOrientation(LinearLayout.VERTICAL); setGravity(Gravity.CENTER_VERTICAL); mLayoutContainer = (LinearLayout) getChildAt(0); mStreakBarContainer = (RelativeLayout) mLayoutContainer.getChildAt(0); mStreakBar = mStreakBarContainer.getChildAt(0); setBarHeight(mStreak.getCount()); mImageContainer = (RelativeLayout) mLayoutContainer.getChildAt(1); mStreakCheckImage = (ImageView) mImageContainer.getChildAt(0); mStreakDay = (TextView) mLayoutContainer.getChildAt(2); mStreakDay.setText(mStreak.getDayAbbrev()); if (!mStreak.completed()) { mStreakCheckImage.setVisibility(View.INVISIBLE); } } }
Source:
<code>public Map<Dependency, FileValidationStatus> getValidationStatuses(final Set<Dependency> deps, final String validationKey) throws SQLException { Map<Dependency, FileValidationStatus> depValidationStatuses = new HashMap<>(); if (deps.size() == 0) { return depValidationStatuses; } Map<String, Dependency> hashAndFileNameToDep = new HashMap<>(); <START> PreparedStatement stmnt = this.dbOperator.getDataSource().getConnection().prepareStatement( "select file_name, file_sha1, validation_status from validated_dependencies where validation_key = ? and (" + makeStrWithQuestionMarks(deps.size()) + ")"); <END> stmnt.setString(1, validationKey); int index = 2; for (Dependency d : deps) { stmnt.setString(index++, d.getFileName()); stmnt.setString(index++, d.getSHA1()); hashAndFileNameToDep.put(d.getFileName() + d.getSHA1(), d); } ResultSet rs = stmnt.executeQuery(); while (rs.next()) { Dependency d = hashAndFileNameToDep.remove(rs.getString(1) + rs.getString(2)); FileValidationStatus v = FileValidationStatus.valueOf(rs.getInt(3)); depValidationStatuses.put(d, v); } hashAndFileNameToDep.values().stream().forEach(d -> depValidationStatuses.put(d, FileValidationStatus.NEW)); return depValidationStatuses; }</code><technical_language>parameterize this query String.format() instead? a hard read</technical_language>

Target:
public Map<Dependency, FileValidationStatus> getValidationStatuses(final Set<Dependency> deps, final String validationKey) throws SQLException { Map<Dependency, FileValidationStatus> depValidationStatuses = new HashMap<>(); if (deps.isEmpty()) { return depValidationStatuses; } Map<String, Dependency> hashAndFileNameToDep = new HashMap<>(); PreparedStatement stmnt = this.dbOperator.getDataSource().getConnection().prepareStatement( String.format("SELECT file_name, file_sha1, validation_status FROM validated_dependencies " + "WHERE validation_key = ? AND (%s)", makeStrWithQuestionMarks(deps.size()))); stmnt.setString(1, validationKey); int index = 2; for (Dependency d : deps) { stmnt.setString(index++, d.getFileName()); stmnt.setString(index++, d.getSHA1()); hashAndFileNameToDep.put(d.getFileName() + d.getSHA1(), d); } ResultSet rs = stmnt.executeQuery(); while (rs.next()) { Dependency d = hashAndFileNameToDep.remove(rs.getString(1) + rs.getString(2)); FileValidationStatus v = FileValidationStatus.valueOf(rs.getInt(3)); depValidationStatuses.put(d, v); } hashAndFileNameToDep.values().stream().forEach(d -> depValidationStatuses.put(d, FileValidationStatus.NEW)); return depValidationStatuses; }
Source:
<code>public void shouldHaveHealthMetricConfiguredGloballyOnSystemProperty() throws Exception { assertThat("if used .ADD_HEALTH_METRICS system property, global configuration should have all folder health metrics", AbstractFolderConfiguration.get().getHealthMetrics(), hasSize((int) FolderHealthMetricDescriptor.all().stream().filter(d -> d.createDefault() != null).count())); Folder folder = j.jenkins.createProject(Folder.class, "myFolder"); DescribableList<FolderHealthMetric, FolderHealthMetricDescriptor> healthMetrics = folder.getHealthMetrics(); assertThat("a new created folder should have all the folder health metrics configured globally", healthMetrics.toList(), containsInAnyOrder(AbstractFolderConfiguration.get().getHealthMetrics().toArray())); AbstractFolderConfiguration.get().setHealthMetrics(null); folder = j.jenkins.createProject(Folder.class, "myFolder2"); healthMetrics = folder.getHealthMetrics(); assertThat("a new created folder should have all the folder health metrics configured globally", healthMetrics, iterableWithSize(0)); <START> System.clearProperty(AbstractFolderConfiguration.class.getName() + ".ADD_HEALTH_METRICS"); <END> }</code><technical_language>This is necessary anymore, right</technical_language>

Target:
public void shouldHaveHealthMetricConfiguredGloballyOnSystemProperty() throws Exception { assertThat("if used .ADD_HEALTH_METRICS system property, global configuration should have all folder health metrics", AbstractFolderConfiguration.get().getHealthMetrics(), hasSize((int) FolderHealthMetricDescriptor.all().stream().filter(d -> d.createDefault() != null).count())); Folder folder = j.jenkins.createProject(Folder.class, "myFolder"); DescribableList<FolderHealthMetric, FolderHealthMetricDescriptor> healthMetrics = folder.getHealthMetrics(); assertThat("a new created folder should have all the folder health metrics configured globally", healthMetrics.toList(), containsInAnyOrder(AbstractFolderConfiguration.get().getHealthMetrics().toArray())); AbstractFolderConfiguration.get().setHealthMetrics(null); folder = j.jenkins.createProject(Folder.class, "myFolder2"); healthMetrics = folder.getHealthMetrics(); assertThat("a new created folder should have all the folder health metrics configured globally", healthMetrics, iterableWithSize(0)); }
Source:
<code>private void includeGlobalResources(Config config) { PageFactory pageFactory = Context.getRegisteredComponents(PageFactory.class).get(0); GlobalResourceIncluder globalResourceIncluder = new GlobalResourceIncluder(); String cssResourcePath = "styles/".concat(config.getCountry().name().toLowerCase()).concat(".").concat(Resource.CATEGORY_CSS); String jsResourcePath = "scripts/".concat(config.getCountry().name().toLowerCase()).concat(".").concat(Resource.CATEGORY_JS); globalResourceIncluder.addResource(new Resource(Resource.CATEGORY_CSS, MirebalaisConstants.MIREBALAIS_MODULE_ID, cssResourcePath, -100)); globalResourceIncluder.addResource(new Resource(Resource.CATEGORY_JS, MirebalaisConstants.MIREBALAIS_MODULE_ID, jsResourcePath, null)); <START> pageFactory.getModelConfigurators().add(globalResourceIncluder); <END> }</code><technical_language>Oh... I -100 is in webModuleApplicationContext in PIH Core for pihcore.css... I remember if a reason picked that... :)</technical_language>

Target:
private void includeGlobalResources(Config config) { String cssResourcePath = "styles/".concat(config.getCountry().name().toLowerCase()).concat(".").concat(Resource.CATEGORY_CSS); String providerName = MirebalaisConstants.MIREBALAIS_MODULE_ID; ResourceFactory resourceFactory = ResourceFactory.getInstance(); File resource = resourceFactory.getResource(providerName, cssResourcePath); if (resource != null) { PageFactory pageFactory = Context.getRegisteredComponents(PageFactory.class).get(0); GlobalResourceIncluder globalResourceIncluder = new GlobalResourceIncluder(); globalResourceIncluder.addResource(new Resource(Resource.CATEGORY_CSS, providerName, cssResourcePath, -100)); pageFactory.getModelConfigurators().add(globalResourceIncluder); } }
Source:
<code>public ChannelSetBuilder(Type type, Optional<Integer> hashChannel, int expectedPositions, OperatorContext operatorContext, JoinCompiler joinCompiler) { List<Type> types = ImmutableList.of(type); this.hash = createGroupByHash( types, HASH_CHANNELS, hashChannel, expectedPositions, isDictionaryAggregationEnabled(operatorContext.getSession()), joinCompiler, this::updateMemoryReservation); <START> this.operatorContext = operatorContext; <END> this.nullBlockPage = new Page(type.createBlockBuilder(new BlockBuilderStatus(), 1, UNKNOWN.getFixedSize()).appendNull().build()); }</code><technical_language>put requireNonNull this</technical_language>

Target:
public ChannelSetBuilder(Type type, Optional<Integer> hashChannel, int expectedPositions, OperatorContext operatorContext, JoinCompiler joinCompiler) { List<Type> types = ImmutableList.of(type); this.hash = createGroupByHash( types, HASH_CHANNELS, hashChannel, expectedPositions, isDictionaryAggregationEnabled(operatorContext.getSession()), joinCompiler, this::updateMemoryReservation); this.nullBlockPage = new Page(type.createBlockBuilder(new BlockBuilderStatus(), 1, UNKNOWN.getFixedSize()).appendNull().build()); this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.localMemoryContext = operatorContext.localUserMemoryContext(); }
Source:
<code>protected IManageablePage getPersistedPage(String sessionIdentifier, int id) { IMap<Integer, SerializedPage> map = hazelcast.getMap(sessionIdentifier); if (map != null) { SerializedPage page = map.get(id); <START> if (LOGGER.isDebugEnabled()) <END> { LOGGER.debug("Got for session '{}' and page id '{}'", page, sessionIdentifier, id); } if (page != null) { return page; } } return null; }</code><technical_language>I checks this if is loop heavy</technical_language>

Target:
protected IManageablePage getPersistedPage(String sessionIdentifier, int id) { IMap<Integer, SerializedPage> map = hazelcast.getMap(sessionIdentifier); if (map != null) { SerializedPage page = map.get(id); LOGGER.debug("Got for session '{}' and page id '{}'", page, sessionIdentifier, id); if (page != null) { return page; } } return null; }
Source:
<code>private CompletionStage<String> convertId(String input, RestRequest restRequest) throws RestServiceException, IOException { CompletionStage<String> conversionFuture; if (input.startsWith(NAMED_BLOB_PREFIX)) { String[] slashFields = parseInput(input); conversionFuture = get(slashFields[2], slashFields[3], slashFields[4]); } else if (restRequest.getRestMethod().equals(RestMethod.PUT) && restRequest.getUri().startsWith(NAMED_BLOB_PREFIX)) { String[] slashFields = parseInput(restRequest.getPath()); <START> StoreKey blobId = new BlobId(RestUtils.stripSlashAndExtensionFromId(input), clusterMap); <END> conversionFuture = put(slashFields[2], slashFields[3], slashFields[4], blobId); } else { String decryptedInput = parseSignedIdIfRequired(restRequest, input.startsWith("/") ? input.substring(1) : input); conversionFuture = CompletableFuture.completedFuture(RestUtils.stripSlashAndExtensionFromId(decryptedInput)); } return conversionFuture; }</code><technical_language>Apologies for communicating this, I changed interface for NamedBlobDb require a BlobId object. (it in base64 string). This means pass in clustermap IdConverter</technical_language>

Target:
private CompletionStage<String> convertId(String input, RestRequest restRequest) throws RestServiceException { CompletionStage<String> conversionFuture; if (input.startsWith(NAMED_BLOB_PREFIX)) { NamedBlobPath namedBlobPath = RestUtils.parseInput(input); conversionFuture = get(namedBlobPath.getAccountName(), namedBlobPath.getContainerName(), namedBlobPath.getBlobName()); } else if (restRequest.getRestMethod().equals(RestMethod.PUT) && restRequest.getUri() .startsWith(NAMED_BLOB_PREFIX)) { NamedBlobPath namedBlobPath = RestUtils.parseInput(RestUtils.getRequestPath(restRequest).getOperationOrBlobId(false)); String blobId = RestUtils.stripSlashAndExtensionFromId(input); conversionFuture = put(namedBlobPath.getAccountName(), namedBlobPath.getContainerName(), namedBlobPath.getBlobName(), blobId); } else { String decryptedInput = parseSignedIdIfRequired(restRequest, input.startsWith("/") ? input.substring(1) : input); conversionFuture = CompletableFuture.completedFuture(RestUtils.stripSlashAndExtensionFromId(decryptedInput)); } return conversionFuture; }
Source:
<code>protected void writeJson(HttpServletRequest req, HttpServletResponse res, JsonNode json) throws IOException { String type = getParam(req, "type", "json"); res.setCharacterEncoding("UTF-8"); boolean debug = getBooleanParam(req, "debug", false) || getBooleanParam(req, "pretty", false); if ("jsonp".equals(type)) { res.setContentType("application/javascript"); if (!jsonpAllowed) { writeError(res, SC_BAD_REQUEST, "Server is not configured to allow jsonp!"); return; } String callbackName = getParam(req, "callback", null); if (callbackName == null) { writeError(res, SC_BAD_REQUEST, "No callback provided, necessary if type=jsonp"); return; } if (debug) writeResponse(res, callbackName + "(" + objectMapper.writeValueAsString(json) + ")"); else writeResponse(res, callbackName + "(" + objectMapper.writeValueAsString(json) + ")"); } else { res.setContentType("application/json"); if (debug) <START> writeResponse(res, objectMapper.writeValueAsString(json) ); <END> else writeResponse(res, objectMapper.writeValueAsString(json) ); } }</code><technical_language>need additional "pretty" objectMapper: java @Provides @Singleton @Named("prettyprint") ObjectMapper createPrettyObjectMapper() { ObjectMapper prettyOM = createObjectMapper(); prettyOM.enable(SerializationFeature.INDENT_OUTPUT); return prettyOM; }</technical_language>

Target:
protected void writeJson(HttpServletRequest req, HttpServletResponse res, JsonNode json) throws IOException { String type = getParam(req, "type", "json"); res.setCharacterEncoding("UTF-8"); final boolean indent = getBooleanParam(req, "debug", false) || getBooleanParam(req, "pretty", false); ObjectWriter objectWriter = indent ? objectMapper.writer().with(SerializationFeature.INDENT_OUTPUT) : objectMapper.writer(); if ("jsonp".equals(type)) { res.setContentType("application/javascript"); if (!jsonpAllowed) { writeError(res, SC_BAD_REQUEST, "Server is not configured to allow jsonp!"); return; } String callbackName = getParam(req, "callback", null); if (callbackName == null) { writeError(res, SC_BAD_REQUEST, "No callback provided, necessary if type=jsonp"); return; } writeResponse(res, callbackName + "(" + objectWriter.writeValueAsString(json) + ")"); } else { res.setContentType("application/json"); writeResponse(res, objectWriter.writeValueAsString(json)); } }
Source:
<code>public HDFSDDFManager(String fsUri) throws DDFException { assert !Strings.isNullOrEmpty(fsUri); this.fsUri = fsUri; try { Configuration conf; if (fsUri.equals("hdfs:;")) { conf = SparkHadoopUtil.get().conf(); } else { conf = new Configuration(); conf.set("fs.defaultFS", fsUri); } this.fs = FileSystem.get(conf); } catch (Exception e) { throw new DDFException(e); } Logger.getLogger(HDFSDDFManager.class).info("Init HDFSDDFManager( fsUri="+fsUri +")"); Logger.getLogger(HDFSDDFManager.class).info("-- FS Scheme:"+fs.getScheme()+")"); <START> Logger.getLogger(HDFSDDFManager.class).info("-- FS URI:"+fs.getUri()+")"); <END> }</code><technical_language>This right, calling Logger.getLogger</technical_language>

Target:
public HDFSDDFManager(String fsUri) throws DDFException { assert !Strings.isNullOrEmpty(fsUri); this.fsUri = fsUri; try { Configuration conf; if (fsUri.equals("hdfs:;")) { conf = SparkHadoopUtil.get().conf(); } else { conf = new Configuration(); conf.set("fs.defaultFS", fsUri); } this.fs = FileSystem.get(conf); } catch (Exception e) { throw new DDFException(e); } }
Source:
<code>private Map<SystemStreamPartition, TaskSideInputStorageManager> createSideInputStorageManagers(Clock clock) { Map<SystemStreamPartition, TaskSideInputStorageManager> sideInputStorageManagers = new HashMap<>(); containerModel.getTasks().forEach((taskName, taskModel) -> { <START> if (!sideInputSystemStreams.isEmpty()) { <END> Map<String, StorageEngine> sideInputStores = getSideInputStores(taskName); Map<String, Set<SystemStreamPartition>> sideInputStoresToSSPs = new HashMap<>(); for (String storeName : sideInputStores.keySet()) { Set<SystemStreamPartition> storeSSPs = taskSideInputSSPs.get(taskName).get(storeName); sideInputStoresToSSPs.put(storeName, storeSSPs); } TaskSideInputStorageManager taskSideInputStorageManager = new TaskSideInputStorageManager(taskName, taskModel.getTaskMode(), streamMetadataCache, loggedStoreBaseDirectory, sideInputStores, taskSideInputProcessors.get(taskName), sideInputStoresToSSPs, systemAdmins, config, clock); sideInputStoresToSSPs.values().stream().flatMap(Set::stream).forEach(ssp -> { sideInputStorageManagers.put(ssp, taskSideInputStorageManager); }); LOG.info("Created taskSideInputStorageManager for task {}, sideInputStores and loggedStoreBaseDirectory {}", taskName, sideInputStores, loggedStoreBaseDirectory); } }); return sideInputStorageManagers; }</code><technical_language>move forEach short circuit earlier</technical_language>

Target:
private Map<SystemStreamPartition, TaskSideInputStorageManager> createSideInputStorageManagers(Clock clock) { Map<TaskName, Map<String, SideInputsProcessor>> taskSideInputProcessors = createSideInputProcessors(new StorageConfig(config), this.containerModel, this.sideInputSystemStreams, this.taskInstanceMetrics); Map<SystemStreamPartition, TaskSideInputStorageManager> sideInputStorageManagers = new HashMap<>(); if (sideInputsPresent()) { containerModel.getTasks().forEach((taskName, taskModel) -> { Map<String, StorageEngine> sideInputStores = getSideInputStores(taskName); Map<String, Set<SystemStreamPartition>> sideInputStoresToSSPs = new HashMap<>(); for (String storeName : sideInputStores.keySet()) { Set<SystemStreamPartition> storeSSPs = taskSideInputSSPs.get(taskName).get(storeName); sideInputStoresToSSPs.put(storeName, storeSSPs); } TaskSideInputStorageManager taskSideInputStorageManager = new TaskSideInputStorageManager(taskName, taskModel.getTaskMode(), streamMetadataCache, loggedStoreBaseDirectory, sideInputStores, taskSideInputProcessors.get(taskName), sideInputStoresToSSPs, systemAdmins, config, clock); sideInputStoresToSSPs.values().stream().flatMap(Set::stream).forEach(ssp -> { sideInputStorageManagers.put(ssp, taskSideInputStorageManager); }); LOG.info("Created taskSideInputStorageManager for task {}, sideInputStores and loggedStoreBaseDirectory {}", taskName, sideInputStores, loggedStoreBaseDirectory); }); } return sideInputStorageManagers; }
Source:
<code>public static void main(String[] args) { Configuration config = new Configuration(args); try { if (!config.validate()) { System.exit(-1); } else { if (config.m_startAction == StartAction.GET) { cli(config); } else { initialize(config); instance().run(); } } } catch (OutOfMemoryError e) { <START> new VoltLogger("HOST").fatal("VoltDB has encountered an OutOfMemory error."); <END> String errmsg = "VoltDB Main thread: ran out of Java memory. This node will shut down."; VoltDB.crashLocalVoltDB(errmsg, false, e); } }</code><technical_language>remove this logging here. I handled now. "crashLocalVoltDB" "HOST" log write fatal message</technical_language>

Target:
public static void main(String[] args) { Configuration config = new Configuration(args); try { if (!config.validate()) { System.exit(-1); } else { if (config.m_startAction == StartAction.GET) { cli(config); } else { initialize(config); instance().run(); } } } catch (OutOfMemoryError e) { String errmsg = "VoltDB Main thread: ran out of Java memory. This node will shut down."; VoltDB.crashLocalVoltDB(errmsg, false, e); } }
Source:
<code>public void start() throws Exception { for (TrackerServer server: serverList) { try { server.start(); } catch (BindException e) { <START> LOGGER.warn("One of the protocols is disabled due to port conflict: " + server.getPort()); <END> } } }</code><technical_language>Please change this "Port XXX is disabled due conflict"</technical_language>

Target:
public void start() throws Exception { for (TrackerServer server: serverList) { try { server.start(); } catch (BindException e) { LOGGER.warn("Port %d is disabled due to conflict", server.getPort()); } } }
Source:
<code>protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application .showBanner(true) <START> .sources(ResourceServer.class); <END> }</code><technical_language>docs state for this method: > Add more sources (configuration classes components) this application is this necessary? this class is indirectly annotated @Configuration @SpringBootApplication</technical_language>

Target:
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { application.application().setDefaultProperties(NAMING_STRATEGY); return application.sources(ResourceServer.class); }
Source:
<code>public void updateUsage(List<Quota> quotaList) { <START> lock.writeLock().lock(); <END> try { for (Quota quotaExternal : quotaList) { Quota quota = null; for (Map<Guid, Quota> quotaMap : storagePoolQuotaMap.values()) { quota = quotaMap.get(quotaExternal.getId()); if (quota != null) { break; } } if (quota == null) { quota = getQuotaDAO().getById(quotaExternal.getId()); if (quota != null) { if (!storagePoolQuotaMap.containsKey(quota.getStoragePoolId())) { storagePoolQuotaMap.put(quota.getStoragePoolId(), new HashMap<Guid, Quota>()); } storagePoolQuotaMap.get(quota.getStoragePoolId()).put(quota.getId(), quota); } } copyUsageData(quota, quotaExternal); } } finally { lock.writeLock().unlock(); } }</code><technical_language>this lock all!!! this method is called search- for engine user. please change</technical_language>

Target:
public void updateUsage(List<Quota> quotaList) { List<Quota> needToCache = new ArrayList<Quota>(); lock.readLock().lock(); try { for (Quota quotaExternal : quotaList) { Quota quota = null; for (Map<Guid, Quota> quotaMap : storagePoolQuotaMap.values()) { quota = quotaMap.get(quotaExternal.getId()); if (quota != null) { break; } } if (quota == null) { needToCache.add(quotaExternal); } else { copyUsageData(quota, quotaExternal); } } } finally { lock.readLock().unlock(); } if (!needToCache.isEmpty()) { lock.writeLock().lock(); try { for (Quota quotaExternal : needToCache) { Quota quota = null; for (Map<Guid, Quota> quotaMap : storagePoolQuotaMap.values()) { quota = quotaMap.get(quotaExternal.getId()); if (quota != null) { break; } } if (quota == null) { quota = getQuotaDAO().getById(quotaExternal.getId()); if (quota != null) { if (!storagePoolQuotaMap.containsKey(quota.getStoragePoolId())) { storagePoolQuotaMap.put(quota.getStoragePoolId(), new HashMap<Guid, Quota>()); } storagePoolQuotaMap.get(quota.getStoragePoolId()).put(quota.getId(), quota); } } copyUsageData(quota, quotaExternal); } } finally { lock.writeLock().unlock(); } } }
Source:
<code>private void placeFunctionAndOperands(FilterFunction function) { int functionIdx = 0; int[] channels = function.getInputChannels(); for (int channel : channels) { int idx = findChannelIdx(channel); if (idx >= firstNonFilter) { <START> if (idx > firstNonFilter) { <END> StreamReader temp = sortedStreamReaders[idx]; System.arraycopy(sortedStreamReaders, firstNonFilter, sortedStreamReaders, firstNonFilter + 1, idx - firstNonFilter); sortedStreamReaders[firstNonFilter] = temp; } idx = firstNonFilter++; } functionIdx = Math.max(functionIdx, idx); } installFilterFunction(functionIdx, function); }</code><technical_language>suggestion if (idx > firstNonFilter) { // Move this position firstNonFilter. StreamReader temp = sortedStreamReaders[idx]; System.arraycopy(sortedStreamReaders, firstNonFilter, sortedStreamReaders, firstNonFilter + 1, idx - firstNonFilter); sortedStreamReaders[firstNonFilter] = temp; } if (idx >= firstNonFilter) { idx = firstNonFilter++; }</technical_language>

Target:
private void placeFunctionAndOperands(FilterFunction function) { int functionIdx = 0; int[] channels = function.getInputChannels(); for (int channel : channels) { int idx = findChannelIdx(channel); if (idx > firstNonFilter) { StreamReader temp = sortedStreamReaders[idx]; System.arraycopy(sortedStreamReaders, firstNonFilter, sortedStreamReaders, firstNonFilter + 1, idx - firstNonFilter); sortedStreamReaders[firstNonFilter] = temp; } if (idx >= firstNonFilter) { idx = firstNonFilter++; } functionIdx = Math.max(functionIdx, idx); } installFilterFunction(functionIdx, function); }