auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testAssignServerIp() throws InterruptedException { assertNodeAvailable(currentServer); currentServer = updateServerStatus(currentServer); List<String> ips = new ArrayList<String>(); ips.add(currentServer.ips().get(0).id()); LoadBalancer.ServerIp.CreateServerIp toAdd = LoadBalancer.ServerIp.CreateServerIp.create(ips); LoadBalancer updateResult = loadBalancerApi().assignServerIp(currentLoadBalancer.id(), toAdd); assertEquals(updateResult.serverIps().get(0).id(), currentServer.ips().get(0).id()); <START> assertNotNull(updateResult); <END> }</code><technical_language>This is redundant here</technical_language>

Target:
public void testAssignServerIp() throws InterruptedException { assertNodeAvailable(currentServer); currentServer = updateServerStatus(currentServer); List<String> ips = new ArrayList<String>(); ips.add(currentServer.ips().get(0).id()); LoadBalancer.ServerIp.CreateServerIp toAdd = LoadBalancer.ServerIp.CreateServerIp.create(ips); LoadBalancer updateResult = loadBalancerApi().assignServerIp(currentLoadBalancer.id(), toAdd); assertEquals(updateResult.serverIps().get(0).id(), currentServer.ips().get(0).id()); }
Source:
<code>private boolean checkWMSLayerMinMaxScale(WMSLayerInfo wmsLayerInfo, double mapScale) { if (wmsLayerInfo.getMinScale() == null && wmsLayerInfo.getMaxScale() == null) return true; <START> if (wmsLayerInfo.getMinScale() != null) <END> if (mapScale < wmsLayerInfo.getMinScale()) return false; if (wmsLayerInfo.getMaxScale() != null) if (mapScale > wmsLayerInfo.getMaxScale()) return false; return true; }</code><technical_language>&& mapScale < wmsLayerInfo.getMinScale() in if, is short-circuit evaluation</technical_language>

Target:
private boolean checkWMSLayerMinMaxScale(WMSLayerInfo wmsLayerInfo, double mapScale) { if (wmsLayerInfo.getMinScale() == null && wmsLayerInfo.getMaxScale() == null) return true; if (wmsLayerInfo.getMinScale() != null && mapScale < wmsLayerInfo.getMinScale()) return false; if (wmsLayerInfo.getMaxScale() != null && mapScale > wmsLayerInfo.getMaxScale()) return false; return true; }
Source:
<code><START> public ITmfTimestampTransform composeWith(ITmfTimestampTransform composeWith) { <END> if (composeWith.equals(TmfTimestampTransform.IDENTITY)) { return this; } else if (composeWith instanceof TmfConstantTransform) { TmfConstantTransform tct = (TmfConstantTransform) composeWith; return new TmfConstantTransform(fOffset.getValue() + tct.fOffset.getValue()); } else if (composeWith instanceof TmfTimestampTransformLinear) { TmfTimestampTransformLinear ttl = (TmfTimestampTransformLinear) composeWith; BigDecimal newBeta = ttl.getOffset().add(new BigDecimal(fOffset.getValue())); return new TmfTimestampTransformLinear(ttl.getSlope(), newBeta); } else { return this; } }</code><technical_language>mentioned, this is a problem other plugins implement timestamp transform. This method compose transforms of kind, for other cases, return a composite transform transforms execute. a bit more resource intensive runtime complicated composition happens, least, API-clean[er]</technical_language>

Target:
public ITmfTimestampTransform composeWith(ITmfTimestampTransform composeWith) { if (composeWith.equals(TmfTimestampTransform.IDENTITY)) { return this; } else if (composeWith instanceof TmfConstantTransform) { TmfConstantTransform tct = (TmfConstantTransform) composeWith; return new TmfConstantTransform(fOffset.getValue() + tct.fOffset.getValue()); } else if (composeWith instanceof TmfTimestampTransformLinear) { throw new UnsupportedOperationException("Cannot compose a constant and linear transform yet"); } else { return this; } }
Source:
<code>public Object convertFromInternal(Message<?> message, Class<?> targetClass) { Object result = null; try { <START> if (isPrettyPrint == false) { <END> result = mapper.writeValueAsString(message.getPayload()); } else { result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(message.getPayload()); } } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); return null; } return buildConvertedMessage(result, message.getHeaders(), MimeTypeUtils.APPLICATION_JSON); }</code><technical_language>swap if(booleanVar) (which I rename prettyPrint)</technical_language>

Target:
public Object convertFromInternal(Message<?> message, Class<?> targetClass) { Object result = null; try { if (prettyPrint) { result = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(message.getPayload()); } else { result = mapper.writeValueAsString(message.getPayload()); } } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); return null; } return buildConvertedMessage(result, message.getHeaders(), MimeTypeUtils.APPLICATION_JSON); }
Source:
<code>private void init(List<HelixRestNamespace> namespaces, int port, String urlPrefix, List<AuditLogger> auditLoggers) { if (namespaces.size() == 0) { throw new IllegalArgumentException( "No namespace specified! Please provide ZOOKEEPER address or namespace manifest."); } _server = new Server(port); _auditLoggers = auditLoggers; _resourceConfigMap = new HashMap<>(); _servletContextHandler = new ServletContextHandler(_server, urlPrefix); _helixNamespaces = namespaces; try { for (HelixRestNamespace namespace : _helixNamespaces) { if (namespace.isDefault()) { <START> LOG.info("Creating default servlet for default namespace."); <END> prepareServlet(namespace, ServletType.DEFAULT_SERVLET); } else { LOG.info("Creating common servlet for namespace: " + namespace.getName()); prepareServlet(namespace, ServletType.COMMON_SERVLET); } } } catch (Exception e) { LOG.error("Failed to initialize helix rest server. Tearing down."); cleanupResourceConfigs(); throw e; } Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { shutdown(); } })); }</code><technical_language>Tip: Changing log message is ideal do want multiple versions of log message for release. debugging difficult. log message is, wrong problematic. For this change, I addition of punctuation, I wonder, this add think</technical_language>

Target:
private void init(List<HelixRestNamespace> namespaces, int port, String urlPrefix, List<AuditLogger> auditLoggers) { if (namespaces.size() == 0) { throw new IllegalArgumentException( "No namespace specified! Please provide ZOOKEEPER address or namespace manifest."); } _port = port; _urlPrefix = urlPrefix; _server = new Server(_port); _auditLoggers = auditLoggers; _resourceConfigMap = new HashMap<>(); _servletContextHandler = new ServletContextHandler(_server, _urlPrefix); _helixNamespaces = namespaces; try { for (HelixRestNamespace namespace : _helixNamespaces) { if (namespace.isDefault()) { LOG.info("Creating default servlet for default namespace"); prepareServlet(namespace, ServletType.DEFAULT_SERVLET); } else { LOG.info("Creating common servlet for namespace {}", namespace.getName()); prepareServlet(namespace, ServletType.COMMON_SERVLET); } } } catch (Exception e) { LOG.error("Failed to initialize helix rest server. Tearing down."); cleanupResourceConfigs(); throw e; } Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { shutdown(); } })); }
Source:
<code>private void setupViewPager() { viewPager = (ViewPager) findViewById(R.id.viewpager); viewPager.setOffscreenPageLimit(PAGE_LIMIT); viewPager.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { getActionBar().setSelectedNavigationItem(position); } } ); viewPager.setAdapter(viewPagerAdapter); <START> viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { <END> @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { postToGoogleAnalytics(position); } @Override public void onPageScrollStateChanged(int state) { } }); }</code><technical_language>remove previous call setOnPageChangeListener a lines re-set well</technical_language>

Target:
private void setupViewPager() { viewPager = (ViewPager) findViewById(R.id.viewpager); viewPager.setOffscreenPageLimit(getOffscreenPageLimit()); viewPager.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { getActionBar().setSelectedNavigationItem(position); postToGoogleAnalytics(position); } } ); viewPager.setAdapter(viewPagerAdapter); }
Source:
<code>private FetchResult fetch(Repository repo, URIish u) throws URISyntaxException, JGitInternalException, InvalidRemoteException, IOException { RemoteConfig config = new RemoteConfig(repo.getConfig(), remote); config.addURI(u); final String dst = Constants.R_REMOTES + config.getName(); RefSpec refSpec = new RefSpec(); refSpec = refSpec.setForceUpdate(true); refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); config.addFetchRefSpec(refSpec); config.update(repo.getConfig()); <START> repo.getConfig().setString("branch", branch, "remote", remote); END> repo.getConfig().setString("branch", branch, "merge", branch); repo.getConfig().save(); FetchCommand command = new FetchCommand(repo); command.setRemote(remote); command.setProgressMonitor(monitor); if (credentialsProvider != null) command.setCredentialsProvider(credentialsProvider); return command.call(); }</code><technical_language>ConfigConstants for "branch" "merge", "remote"</technical_language>

Target:
private FetchResult fetch(Repository repo, URIish u) throws URISyntaxException, JGitInternalException, InvalidRemoteException, IOException { RemoteConfig config = new RemoteConfig(repo.getConfig(), remote); config.addURI(u); final String dst = Constants.R_REMOTES + config.getName(); RefSpec refSpec = new RefSpec(); refSpec = refSpec.setForceUpdate(true); refSpec = refSpec.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); config.addFetchRefSpec(refSpec); config.update(repo.getConfig()); repo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_REMOTE_SECTION, remote); repo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_MERGE, branch); repo.getConfig().save(); FetchCommand command = new FetchCommand(repo); command.setRemote(remote); command.setProgressMonitor(monitor); if (credentialsProvider != null) command.setCredentialsProvider(credentialsProvider); return command.call(); }
Source:
<code>public void call(final Subscriber<? super T> child) { final Worker worker = scheduler.createWorker(); child.add(worker); SkipTimedSubscriber<T> subscriber = new SkipTimedSubscriber<T>(child); <START> worker.schedule(subscriber, time, unit); <END> source.unsafeSubscribe(subscriber); }</code><technical_language>child.add(subscriber) missing</technical_language>

Target:
public void call(final Subscriber<? super T> child) { final Worker worker = scheduler.createWorker(); SkipTimedSubscriber<T> subscriber = new SkipTimedSubscriber<T>(child); subscriber.add(worker); child.add(subscriber); worker.schedule(subscriber, time, unit); source.unsafeSubscribe(subscriber); }
Source:
<code>protected void processResponse(Map<String, Object> response) { Map<String, Object> result = getMap(response, "result"); if (result.containsKey("System.ScreenSaverActive")) { Object o = result.get("System.ScreenSaverActive"); if(o!=null && o instanceof Boolean) { screenSaverActive=(Boolean)o; } } <START> } <END></code><technical_language>please format Eclipse Formatter (CTRL+SHFT+O)</technical_language>

Target:
protected void processResponse(Map<String, Object> response) { Map<String, Object> result = getMap(response, "result"); if (result.containsKey(SYSTEM_SCREEN_SAVER_ACTIVE)) { Object o = result.get(SYSTEM_SCREEN_SAVER_ACTIVE); if (o != null && o instanceof Boolean) { screenSaverActive = (Boolean) o; } } }
Source:
<code>public Collection<Space> getSpaces() { <START> log.info("Getting all spaces units"); <END> return target.path("spaces").request().get(new GenericType<Collection<Space>>() { }); }</code><technical_language>this "Getting spaces"? guess forgot change this message</technical_language>

Target:
public Collection<Space> getSpaces() { log.info("Getting all spaces"); return target.path("spaces").request().get(new GenericType<Collection<Space>>() { }); }
Source:
<code>public ConnectorPageSource pageSource(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { String metadataSqlQuery = getColumnRangesMetadataSqlQuery(sourceTable, indexedRaptorColumns); List<Type> columnTypes = tableMetadata.getColumns().stream() .map(ColumnMetadata::getType) .collect(toImmutableList()); PageListBuilder pageListBuilder = new PageListBuilder(columnTypes); try (Connection connection = dbi.open().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(metadataSqlQuery)) { if (resultSet.next()) { pageListBuilder.beginRow(); for (int i = 0; i < columnTypes.size(); ++i) { Type columnType = columnTypes.get(i); if (columnType.equals(BIGINT) || columnType.equals(DATE) || columnType.equals(TIMESTAMP)) { long value = resultSet.getLong(i + 1); if (!resultSet.wasNull()) { <START> columnType.writeLong(pageListBuilder.nextBlockBuilder(), value); <END> } else { pageListBuilder.nextBlockBuilder().appendNull(); } } else if (columnType.equals(BOOLEAN)) { boolean value = resultSet.getBoolean(i + 1); if (!resultSet.wasNull()) { BOOLEAN.writeBoolean(pageListBuilder.nextBlockBuilder(), value); } else { pageListBuilder.nextBlockBuilder().appendNull(); } } else { throw new VerifyException("Unknown or unsupported column type: " + columnType); } } } } catch (SQLException | DBIException e) { throw metadataError(e); } return new FixedPageSource(pageListBuilder.build()); }</code><technical_language>Call pageListBuilder.nextBlockBuilder() top of loop. This easier verify calling for column</technical_language>

Target:
public ConnectorPageSource pageSource(ConnectorTransactionHandle transactionHandle, ConnectorSession session, TupleDomain<Integer> constraint) { String metadataSqlQuery = getColumnRangesMetadataSqlQuery(sourceTable, indexedRaptorColumns); List<Type> columnTypes = tableMetadata.getColumns().stream() .map(ColumnMetadata::getType) .collect(toImmutableList()); PageListBuilder pageListBuilder = new PageListBuilder(columnTypes); try (Connection connection = dbi.open().getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(metadataSqlQuery)) { if (resultSet.next()) { pageListBuilder.beginRow(); for (int i = 0; i < columnTypes.size(); ++i) { BlockBuilder blockBuilder = pageListBuilder.nextBlockBuilder(); Type columnType = columnTypes.get(i); if (columnType.equals(BIGINT) || columnType.equals(DATE) || columnType.equals(TIMESTAMP)) { long value = resultSet.getLong(i + 1); if (!resultSet.wasNull()) { columnType.writeLong(blockBuilder, value); } else { blockBuilder.appendNull(); } } else if (columnType.equals(BOOLEAN)) { boolean value = resultSet.getBoolean(i + 1); if (!resultSet.wasNull()) { BOOLEAN.writeBoolean(blockBuilder, value); } else { blockBuilder.appendNull(); } } else { throw new VerifyException("Unknown or unsupported column type: " + columnType); } } } } catch (SQLException | DBIException e) { throw metadataError(e); } return new FixedPageSource(pageListBuilder.build()); }
Source:
<code>synchronized void updateLease(Lease newLease) { <START> Preconditions.checkArgument(lease.leaderTime().isComparableWith(newLease.leaderTime()), <END> "Lock leases can only be refreshed by lease owners"); if (this.lease.expiry().isBefore(newLease.expiry())) { this.lease = newLease; } }</code><technical_language>worth safe-logging preconditions args for incorrect leader ids</technical_language>

Target:
synchronized void updateLease(Lease newLease) { Preconditions.checkArgument(lease.leaderTime().isComparableWith(newLease.leaderTime()), "Lock leases can only be refreshed by lease owners. Current leader id: {}, new leader id: {}", SafeArg.of("currentLeaderId", lease.leaderTime().id()), SafeArg.of("newLeaderId", newLease.leaderTime().id())); if (this.lease.expiry().isBefore(newLease.expiry())) { this.lease = newLease; } }
Source:
<code>private String extractOrderBy(Class<?> entityClass, Map<Path, Sorting.SortOrder> sortClauses, SQLSchema schema, Query query) { if (sortClauses.isEmpty()) { return ""; } return " ORDER BY " + sortClauses.entrySet().stream() .map((entry) -> { Path path = entry.getKey(); path = expandJoinToPath(path); Sorting.SortOrder order = entry.getValue(); Path.PathElement last = path.lastElement().get(); String orderByType = FilterPredicate.getTypeAlias(last.getType()) + "." + getColumnName(entityClass, last.getFieldName()); if (last.getType() == entityClass) { Metric currentMetric = schema.getMetric(getColumnName(entityClass, last.getFieldName())); <START> if (currentMetric != null && query.getMetrics().keySet().contains(currentMetric)) { <END> orderByType = currentMetric.getMetricExpression(query.getMetrics().get(currentMetric)); } } return orderByType + (order.equals(Sorting.SortOrder.desc) ? " DESC" : " ASC"); }).collect(Collectors.joining(",")); }</code><technical_language>query.getMetrics().containsKey()</technical_language>

Target:
private String extractOrderBy(Class<?> entityClass, Map<Path, Sorting.SortOrder> sortClauses, SQLSchema schema, Query query) { if (sortClauses.isEmpty()) { return ""; } return " ORDER BY " + sortClauses.entrySet().stream() .map((entry) -> { Path path = entry.getKey(); path = expandJoinToPath(path); Sorting.SortOrder order = entry.getValue(); Path.PathElement last = path.lastElement().get(); String orderByType = FilterPredicate.getTypeAlias(last.getType()) + "." + getColumnName(entityClass, last.getFieldName()); if (last.getType() == entityClass) { Metric currentMetric = schema.getMetric(getColumnName(entityClass, last.getFieldName())); if (currentMetric != null && query.getMetrics().containsKey(currentMetric)) { orderByType = currentMetric.getMetricExpression(query.getMetrics().get(currentMetric)); } } return orderByType + (order.equals(Sorting.SortOrder.desc) ? " DESC" : " ASC"); }).collect(Collectors.joining(",")); }
Source:
<code>public void onNext(T t) { long idx = index.get(); if (idx == Long.MAX_VALUE) { return; } if (!index.compareAndSet(idx, idx + 1)) { return; } Subscription s = task.get(); if (s != null) { s.unsubscribe(); } actual.onNext(t); consumed++; <START> startTimeout(idx + 1); <END> }</code><technical_language>If reading this correctly, I a slight behavior difference this implementation existing one. existing implementation timeout (and switch) if 0 calls onNext timeout. I needs 1 call timer is set. confirm this send a test case I get a chance. Turns out want semantics. other timeout variant mentioned get "have message" semantic firstTimeoutSelector return Observable.never(). If a get behaviors this operator, great</technical_language>

Target:
public void onNext(T t) { long idx = index.get(); if (idx == Long.MAX_VALUE || !index.compareAndSet(idx, idx + 1)) { return; } Subscription s = task.get(); if (s != null) { s.unsubscribe(); } consumed++; actual.onNext(t); startTimeout(idx + 1); }
Source:
<code>public double[] getVotesForInstance(Instance inst) { double v[] = new double[C+1]; try { NearestNeighbourSearch search; if (this.nearestNeighbourSearchOption.getChosenIndex()== 0) { search = new LinearNNSearch(this.window); } else { search = new KDTree(); search.setInstances(this.window); } if (this.window.numInstances()>0) { Instances neighbours = search.kNearestNeighbours(inst,Math.min(kOption.getValue(),this.window.numInstances())); <START> if(inst.classAttribute().isNumeric() && regressionOption.isSet()){ <END> double[] result = new double[1]; double sum = 0; int num = neighbours.numInstances(); if(medianOption.isSet()){ double[] classValues = new double[num]; for(int i=0;i<num;i++){ classValues[i] = neighbours.instance(i).classValue(); } Arrays.sort(classValues); if(classValues.length%2==1){ result[0] = classValues[num/2]; }else{ result[0] = (classValues[num/2 - 1] + classValues[num/2]) / 2; } return result; }else{ for(int i=0;i<num;i++){ sum += neighbours.instance(i).classValue(); } result[0] = sum / num; return result; } }else{ for (int i = 0; i < neighbours.numInstances(); i++) { v[(int) neighbours.instance(i).classValue()]++; } } } } catch(Exception e) { return new double[inst.numClasses()]; } return v; }</code><technical_language>if(inst.classAttribute().isNumeric()) is enough</technical_language>

Target:
public double[] getVotesForInstance(Instance inst) { double v[] = new double[C+1]; try { NearestNeighbourSearch search; if (this.nearestNeighbourSearchOption.getChosenIndex()== 0) { search = new LinearNNSearch(this.window); } else { search = new KDTree(); search.setInstances(this.window); } if (this.window.numInstances()>0) { Instances neighbours = search.kNearestNeighbours(inst,Math.min(kOption.getValue(),this.window.numInstances())); if(inst.classAttribute().isNumeric()){ double[] result = new double[1]; double sum = 0; int num = neighbours.numInstances(); if(medianOption.isSet()){ double[] classValues = new double[num]; for(int i=0;i<num;i++){ classValues[i] = neighbours.instance(i).classValue(); } Arrays.sort(classValues); if(classValues.length%2==1){ result[0] = classValues[num/2]; }else{ result[0] = (classValues[num/2 - 1] + classValues[num/2]) / 2; } return result; }else{ for(int i=0;i<num;i++){ sum += neighbours.instance(i).classValue(); } result[0] = sum / num; return result; } }else{ for (int i = 0; i < neighbours.numInstances(); i++) { v[(int) neighbours.instance(i).classValue()]++; } } } } catch(Exception e) { return new double[inst.numClasses()]; } return v; }
Source:
<code>public void drawScreen( final int mouseX, final int mouseY, final float btn ) { this.updateCPUButtonText(); <START> this.start.enabled = !( this.ccc.isNoCPU() || this.isSimulation() ); <END> this.selectCPU.enabled = !this.isSimulation(); final int gx = ( this.width - this.xSize ) / 2; final int gy = ( this.height - this.ySize ) / 2; this.tooltip = -1; final int offY = 23; int y = 0; int x = 0; for( int z = 0; z <= 4 * 5; z++ ) { final int minX = gx + 9 + x * 67; final int minY = gy + 22 + y * offY; if( minX < mouseX && minX + 67 > mouseX ) { if( minY < mouseY && minY + offY - 2 > mouseY ) { this.tooltip = z; break; } } x++; if( x > 2 ) { y++; x = 0; } } super.drawScreen( mouseX, mouseY, btn ); }</code><technical_language>hasNoCPU</technical_language>

Target:
public void drawScreen( final int mouseX, final int mouseY, final float btn ) { this.updateCPUButtonText(); this.start.enabled = !( this.ccc.hasNoCPU() || this.isSimulation() ); this.selectCPU.enabled = !this.isSimulation(); final int gx = ( this.width - this.xSize ) / 2; final int gy = ( this.height - this.ySize ) / 2; this.tooltip = -1; final int offY = 23; int y = 0; int x = 0; for( int z = 0; z <= 4 * 5; z++ ) { final int minX = gx + 9 + x * 67; final int minY = gy + 22 + y * offY; if( minX < mouseX && minX + 67 > mouseX ) { if( minY < mouseY && minY + offY - 2 > mouseY ) { this.tooltip = z; break; } } x++; if( x > 2 ) { y++; x = 0; } } super.drawScreen( mouseX, mouseY, btn ); }
Source:
<code>private boolean clearContextRelationships(CompileContext compileContext, Long identity, Class endNodeType, DirectedRelationship directedRelationship) { <START> if (directedRelationship.direction().equals(Direction.INCOMING)) { <END> LOGGER.debug("context-del: ({})<-[:{}]-()", identity, directedRelationship.type()); return compileContext.deregisterIncomingRelationships(identity, directedRelationship.type(), endNodeType, metaData.isRelationshipEntity(endNodeType.getName())); } else if (directedRelationship.direction().equals(Direction.OUTGOING)) { LOGGER.debug("context-del: ({})-[:{}]->()", identity, directedRelationship.type()); return compileContext.deregisterOutgoingRelationships(identity, directedRelationship.type(), endNodeType); } else { LOGGER.debug("context-del: ({})<-[:{}]-()", identity, directedRelationship.type()); LOGGER.debug("context-del: ({})-[:{}]->()", identity, directedRelationship.type()); boolean clearedIncoming = compileContext .deregisterIncomingRelationships(identity, directedRelationship.type(), endNodeType, metaData.isRelationshipEntity(endNodeType.getName())); boolean clearedOutgoing = compileContext .deregisterOutgoingRelationships(identity, directedRelationship.type(), endNodeType); return clearedIncoming || clearedOutgoing; } }</code><technical_language>suggestion if (directedRelationship.direction() == Direction.INCOMING) { added benefit of null type safe</technical_language>

Target:
private boolean clearContextRelationships(CompileContext compileContext, Long identity, Class endNodeType, DirectedRelationship directedRelationship) { switch (directedRelationship.direction()) { case INCOMING: LOGGER.debug("context-del: ({})<-[:{}]-()", identity, directedRelationship.type()); return compileContext.deregisterIncomingRelationships(identity, directedRelationship.type(), endNodeType, metaData.isRelationshipEntity(endNodeType.getName())); case OUTGOING: LOGGER.debug("context-del: ({})-[:{}]->()", identity, directedRelationship.type()); return compileContext.deregisterOutgoingRelationships(identity, directedRelationship.type(), endNodeType); default: LOGGER.debug("context-del: ({})<-[:{}]-()", identity, directedRelationship.type()); LOGGER.debug("context-del: ({})-[:{}]->()", identity, directedRelationship.type()); boolean clearedIncoming = compileContext .deregisterIncomingRelationships(identity, directedRelationship.type(), endNodeType, metaData.isRelationshipEntity(endNodeType.getName())); boolean clearedOutgoing = compileContext .deregisterOutgoingRelationships(identity, directedRelationship.type(), endNodeType); return clearedIncoming || clearedOutgoing; } }
Source:
<code>public void matches(PlanMatchPattern pattern) { RuleApplication ruleApplication = applyRule(); TypeProvider types = ruleApplication.types; if (!ruleApplication.wasRuleApplied()) { fail(String.format( "%s did not fire for:\n%s", rule.getClass().getName(), formatPlan(plan, types))); } PlanNode actual = ruleApplication.getTransformedPlan(); if (actual == plan) { fail(String.format( "%s: rule fired but return the original plan:\n%s", rule.getClass().getName(), formatPlan(plan, types))); } if (!ImmutableSet.copyOf(plan.getOutputSymbols()).equals(ImmutableSet.copyOf(actual.getOutputSymbols()))) { fail(String.format( "%s: output schema of transformed and original plans are not equivalent\n" + "\texpected: %s\n" + "\tactual: %s", rule.getClass().getName(), plan.getOutputSymbols(), actual.getOutputSymbols())); } inTransaction(session -> { <START> assertPlan(session, metadata, ruleApplication.statsProvider, new Plan(actual, types, emptyMap(), emptyMap()), ruleApplication.lookup, pattern); <END> return null; }); }</code><technical_language>ImmutableMap.of()</technical_language>

Target:
public void matches(PlanMatchPattern pattern) { RuleApplication ruleApplication = applyRule(); TypeProvider types = ruleApplication.types; if (!ruleApplication.wasRuleApplied()) { fail(String.format( "%s did not fire for:\n%s", rule.getClass().getName(), formatPlan(plan, types))); } PlanNode actual = ruleApplication.getTransformedPlan(); if (actual == plan) { fail(String.format( "%s: rule fired but return the original plan:\n%s", rule.getClass().getName(), formatPlan(plan, types))); } if (!ImmutableSet.copyOf(plan.getOutputSymbols()).equals(ImmutableSet.copyOf(actual.getOutputSymbols()))) { fail(String.format( "%s: output schema of transformed and original plans are not equivalent\n" + "\texpected: %s\n" + "\tactual: %s", rule.getClass().getName(), plan.getOutputSymbols(), actual.getOutputSymbols())); } inTransaction(session -> { assertPlan(session, metadata, ruleApplication.statsProvider, new Plan(actual, types, StatsAndCosts.empty()), ruleApplication.lookup, pattern); return null; }); }
Source:
<code>private static void validateReplicationFactor(String configName, short factor) { if (factor != TopicAdmin.NO_REPLICATION_FACTOR && factor < 1) { throw new ConfigException(configName, factor, <START> "Replication factor must be positive, or -1 to use the broker's default"); <END> } }</code><technical_language>about: suggestion "Replication factor positive larger number of brokers in Kafka cluster, -1 broker's default");</technical_language>

Target:
private static void validateReplicationFactor(String configName, short factor) { if (factor != TopicAdmin.NO_REPLICATION_FACTOR && factor < 1) { throw new ConfigException(configName, factor, "Replication factor must be positive and not larger than the number of brokers in the Kafka cluster, or -1 to use the broker's default"); } }
Source:
<code>public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { <START> if (bean instanceof AbstractMessageChannel) { <END> if (logger.isDebugEnabled()) { logger.debug("Applying global interceptors on channel '" + beanName + "'"); } this.addMatchingInterceptors((AbstractMessageChannel) bean, beanName); } return bean; }</code><technical_language>deal proxies, right? need a new interface InterceptableChannel. This XD case too: <LINK_0></technical_language>

Target:
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof ChannelInterceptorAware && bean instanceof MessageChannel) { if (logger.isDebugEnabled()) { logger.debug("Applying global interceptors on channel '" + beanName + "'"); } this.addMatchingInterceptors((ChannelInterceptorAware) bean, beanName); } return bean; }
Source:
<code>public void handleMessage (Message message) { try { byte[] body = base64.decode(message.getBody()); ByteArrayInputStream bais = new ByteArrayInputStream(body); LittleEndianDataInputStream data = new LittleEndianDataInputStream(bais); char[] header = new char[6]; for (int i = 0; i < 6; i++) { header[i] = (char) data.readByte(); } if (!"ORIGIN".equals(new String(header))) { error = true; LOG.error("Origin not in proper format for query %s"); return; } int version = data.readInt(); if (version != ORIGIN_VERSION) { error = true; LOG.error("Origin version mismatch for query %s, expected {}, found {}", ORIGIN_VERSION, version); } int x = data.readInt(); int y = data.readInt(); int iterations = data.readInt(); <START> ByteArrayOutputStream originData = new ByteArrayOutputStream(iterations * 4); <END> LittleEndianDataOutputStream origin = new LittleEndianDataOutputStream(originData); for (int i = 0, prev = 0; i < iterations; i++) { int current = data.readInt(); origin.writeInt(current - prev); prev = current; } origin.close(); synchronized (this) { if (buffer == null) this.initialize(iterations); long offset = DATA_OFFSET + (y * request.width + x) * 4 * iterations; buffer.seek(offset); buffer.write(originData.toByteArray()); if (++nComplete == nTotal && !error) finish(); } } catch (Exception e) { error = true; LOG.error("Error assembling results for query %s", request.jobId, e); return; } }</code><technical_language>Variable names slightly confusing, impeding reading code. originByteOutputStream, is wrapped originDataOutputStream</technical_language>

Target:
public void handleMessage (Message message) { try { byte[] body = base64.decode(message.getBody()); ByteArrayInputStream bais = new ByteArrayInputStream(body); Origin origin = Origin.read(bais); if (buffer != null && origin.accessibilityPerIteration.length != this.nIterations) { LOG.error("Origin {}, has iterations, expected {}", origin.x, origin.y, origin.accessibilityPerIteration.length, this.nIterations); error = true; } ByteArrayOutputStream pixelByteOutputStream = new ByteArrayOutputStream(origin.accessibilityPerIteration.length * 4); LittleEndianDataOutputStream pixelDataOutputStream = new LittleEndianDataOutputStream(pixelByteOutputStream); for (int i = 0, prev = 0; i < origin.accessibilityPerIteration.length; i++) { int current = origin.accessibilityPerIteration[i]; pixelDataOutputStream.writeInt(current - prev); prev = current; } pixelDataOutputStream.close(); synchronized (this) { if (buffer == null) this.initialize(origin.accessibilityPerIteration.length); long offset = DATA_OFFSET + (origin.y * request.width + origin.x) * 4 * nIterations; buffer.seek(offset); buffer.write(pixelByteOutputStream.toByteArray()); if (++nComplete == nTotal && !error) finish(); } } catch (Exception e) { error = true; LOG.error("Error assembling results for query {}", request.jobId, e); return; } }
Source:
<code>public String stopVM(final Connect conn, final String vmName, final boolean forceStop) { DomainState state = null; Domain dm = null; s_logger.debug("Try to stop the vm at first"); <START> String ret = stopVMInternal(conn, vmName, forceStop); <END> if (ret == Script.ERR_TIMEOUT) { ret = stopVMInternal(conn, vmName, true); } else if (ret != null) { for (int i = 0; i < 3; i++) { try { dm = conn.domainLookupByName(vmName); state = dm.getInfo().state; break; } catch (final LibvirtException e) { s_logger.debug("Failed to get vm status:" + e.getMessage()); } finally { try { if (dm != null) { dm.free(); } } catch (final LibvirtException l) { s_logger.trace("Ignoring libvirt error.", l); } } } if (state == null) { s_logger.debug("Can't get vm's status, assume it's dead already"); return null; } if (state != DomainState.VIR_DOMAIN_SHUTOFF) { s_logger.debug("Try to destroy the vm"); ret = stopVMInternal(conn, vmName, true); if (ret != null) { return ret; } } } return null; }</code><technical_language>@rhtyd line 2733 changed ? if (forceStop) return stopVMInternal(conn, vmName, true);</technical_language>

Target:
public String stopVM(final Connect conn, final String vmName, final boolean forceStop) { DomainState state = null; Domain dm = null; s_logger.debug("Try to stop the vm at first"); if (forceStop) { return stopVMInternal(conn, vmName, true); } String ret = stopVM(conn, vmName, false); if (ret == Script.ERR_TIMEOUT) { ret = stopVMInternal(conn, vmName, true); } else if (ret != null) { for (int i = 0; i < 3; i++) { try { dm = conn.domainLookupByName(vmName); state = dm.getInfo().state; break; } catch (final LibvirtException e) { s_logger.debug("Failed to get vm status:" + e.getMessage()); } finally { try { if (dm != null) { dm.free(); } } catch (final LibvirtException l) { s_logger.trace("Ignoring libvirt error.", l); } } } if (state == null) { s_logger.debug("Can't get vm's status, assume it's dead already"); return null; } if (state != DomainState.VIR_DOMAIN_SHUTOFF) { s_logger.debug("Try to destroy the vm"); ret = stopVMInternal(conn, vmName, true); if (ret != null) { return ret; } } } return null; }
Source:
<code>public Integer replayObserverFromIndex(Integer idx, SubjectObserver<? super T> observer) { int i = idx; <START> while (i < index.get()) { <END> accept(observer, i); i++; } return i; }</code><technical_language>index field read a local variable loop</technical_language>

Target:
public Integer replayObserverFromIndex(Integer idx, SubjectObserver<? super T> observer) { int i = idx; while (i < get()) { accept(observer, i); i++; } return i; }
Source:
<code>public MaximumRetriesExceededException(Retryable task, Throwable cause) { super(task.getName() + " failed after maximum retries" + task.finalMessage == null ? "" : ": " + task.finalMessage, cause); if (task instanceof RetryableTaskReturnsThrows) { <START> finalResult = ((RetryableTaskReturnsThrows) task).getResult(); <END> } }</code><technical_language>constructor for this</technical_language>

Target:
public MaximumRetriesExceededException(Retryable task, Throwable cause) { super(task.getName() + " failed after maximum retries", cause); finalMessage = task.finalMessage; finalData = task.finalData; }
Source:
<code>public void itReturnsProperPagination() throws Exception { DocumentModel docEntry = dirSession.getEntry("test1"); docEntry.setPropertyValue("vocabulary:id", "newtest"); docEntry.setPropertyValue("vocabulary:label", "newlabel"); <START> assertNull(dirSession.getEntry("newtest")); <END> String jsonEntry = getDirectoryEntryAsJson(docEntry); try (CloseableClientResponse response = getResponse(RequestType.POST, "/directory/" + TESTDIRNAME, jsonEntry)) { assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus()); } nextTransaction(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); int maxResults = 5; queryParams.putSingle("pageSize", String.valueOf(maxResults)); queryParams.putSingle("maxResults", String.valueOf(maxResults)); try (CloseableClientResponse response = getResponse(RequestType.GET, "/directory/" + TESTDIRNAME, queryParams)) { String json = response.getEntity(String.class); JsonNode jsonNode = mapper.readTree(json); JsonNode entriesNode = jsonNode.get("entries"); assertTrue(entriesNode.isArray()); ArrayNode entriesArrayNode = (ArrayNode) entriesNode; assertEquals(maxResults, entriesArrayNode.size()); } }</code><technical_language>test1 init bloc</technical_language>

Target:
public void itReturnsProperPagination() throws Exception { DocumentModel docEntry = dirSession.getEntry("foo"); String jsonEntry = getDirectoryEntryAsJson(docEntry); assertNotNull(jsonEntry); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); int maxResults = 5; queryParams.putSingle("pageSize", String.valueOf(maxResults)); queryParams.putSingle("maxResults", String.valueOf(maxResults)); try (CloseableClientResponse response = getResponse(RequestType.GET, "/directory/" + TESTDIRNAME, queryParams)) { String json = response.getEntity(String.class); JsonNode jsonNode = mapper.readTree(json); JsonNode entriesNode = jsonNode.get("entries"); assertTrue(entriesNode.isArray()); ArrayNode entriesArrayNode = (ArrayNode) entriesNode; assertEquals(maxResults, entriesArrayNode.size()); } }
Source:
<code>private void readAndPrintFile(String fileName) { File file = new File(fileName); BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); String line = br.readLine(); while (line != null) { log(" " + line, Project.MSG_INFO); line = br.readLine(); } } catch(IOException ex) { LOGGER.error(ex.getMessage(), ex); } finally { if (br != null) { try { br.close(); } catch (IOException e) { <START> LOGGER.error(e.getMessage(), e); <END> } } } }</code><technical_language>is perfect case for a try-with-resources</technical_language>

Target:
private void readAndPrintFile(String fileName) { try { Files.readAllLines(Paths.get(fileName)).forEach(line -> log(" " + line, Project.MSG_INFO)); } catch (IOException ex) { LOGGER.error(ex.getMessage(), ex); } }
Source:
<code>public void testExternalUserCache() { <START> assertThat(userDetailsService instanceof ConfigurableProviderManager).isTrue(); <END> assertThat(strongboxUserManager.findByUsername(TEST_USER)).isNull(); assertThat(userDetailsService.loadUserByUsername(TEST_USER)).isNotNull(); User externalUser = strongboxUserManager.findByUsername(TEST_USER); assertThat(externalUser).isNotNull(); User externalUserToSave = externalUser; assertThatExceptionOfType(IllegalStateException.class) .isThrownBy(() -> orientDbUserService.save(externalUserToSave)) .withMessageMatching("Can't modify external users."); String newPassword = UUID.randomUUID().toString(); UserDto userToUpdate = new UserDto(); userToUpdate.setUsername(TEST_USER); userToUpdate.setPassword(newPassword); yamlUserService.updateAccountDetailsByUsername(new EncodedPasswordUser(userToUpdate, passwordEncoder)); UserEntry externalUserEntry = (UserEntry) orientDbUserService.findByUsername(TEST_USER); externalUserEntry.setLastUpdate(null); entityManager.persist(externalUserEntry); assertThat(userDetailsService.loadUserByUsername(TEST_USER)).isNotNull(); externalUser = strongboxUserManager.findByUsername(TEST_USER); assertThat(externalUser).isNotNull(); assertThat(passwordEncoder.matches(newPassword, externalUser.getPassword())).isTrue(); }</code><technical_language>assertThat(userDetailsService instanceof ConfigurableProviderManager).isTrue(); => assertThat(userDetailsService).isInstanceof(ConfigurableProviderManager.class) please change instanceof is in in tests</technical_language>

Target:
public void testExternalUserCache() { assertThat(userDetailsService).isInstanceOf(ConfigurableProviderManager.class); assertThat(strongboxUserManager.findByUsername(TEST_USER)).isNull(); assertThat(userDetailsService.loadUserByUsername(TEST_USER)).isNotNull(); User externalUser = strongboxUserManager.findByUsername(TEST_USER); assertThat(externalUser).isNotNull(); User externalUserToSave = externalUser; assertThatExceptionOfType(IllegalStateException.class) .isThrownBy(() -> orientDbUserService.save(externalUserToSave)) .withMessageMatching("Can't modify external users."); String newPassword = UUID.randomUUID().toString(); UserDto userToUpdate = new UserDto(); userToUpdate.setUsername(TEST_USER); userToUpdate.setPassword(newPassword); yamlUserService.updateAccountDetailsByUsername(new EncodedPasswordUser(userToUpdate, passwordEncoder)); UserEntry externalUserEntry = (UserEntry) orientDbUserService.findByUsername(TEST_USER); externalUserEntry.setLastUpdate(null); entityManager.persist(externalUserEntry); assertThat(userDetailsService.loadUserByUsername(TEST_USER)).isNotNull(); externalUser = strongboxUserManager.findByUsername(TEST_USER); assertThat(externalUser).isNotNull(); assertThat(passwordEncoder.matches(newPassword, externalUser.getPassword())).isTrue(); }
Source:
<code>public static void main(String[] args) { try { MessageQueue msgQueue = new MessageQueue(); LOGGER.info("All the TaskGenerators started."); Runnable taskRunnable1 = new TaskGenerator(msgQueue, 5); Runnable taskRunnable2 = new TaskGenerator(msgQueue, 1); Runnable taskRunnable3 = new TaskGenerator(msgQueue, 2); Thread taskGenerator1 = new Thread(taskRunnable1, "Task_Generator_1"); Thread taskGenerator2 = new Thread(taskRunnable2, "Task_Generator_2"); Thread taskGenerator3 = new Thread(taskRunnable3, "Task_Generator_3"); taskGenerator1.start(); taskGenerator2.start(); taskGenerator3.start(); LOGGER.info("Service Executor started."); Runnable srvRunnable = new ServiceExecutor(msgQueue); Thread srvExec = new Thread(srvRunnable, "Service_Executor_Thread"); srvExec.start(); } catch (Exception e) { LOGGER.error(e.getMessage()); <START> } <END> }</code><technical_language>Instead of working Threads is recommended practise [ExecutorService](<LINK_1> instead. For example a this [tutorial](<LINK_0></technical_language>

Target:
public static void main(String[] args) { ExecutorService executor = null; try { MessageQueue msgQueue = new MessageQueue(); LOGGER.info("Submitting TaskGenerators and ServiceExecutor threads."); Runnable taskRunnable1 = new TaskGenerator(msgQueue, 5); Runnable taskRunnable2 = new TaskGenerator(msgQueue, 1); Runnable taskRunnable3 = new TaskGenerator(msgQueue, 2); Runnable srvRunnable = new ServiceExecutor(msgQueue); executor = Executors.newFixedThreadPool(2); executor.submit(taskRunnable1); executor.submit(taskRunnable2); executor.submit(taskRunnable3); executor.submit(srvRunnable); LOGGER.info("Intiating shutdown. Executor will shutdown only after all the Threads are completed."); executor.shutdown(); if ( !executor.awaitTermination(SHUTDOWN_TIME, TimeUnit.SECONDS) ) { LOGGER.info("Executor was shut down and Exiting."); executor.shutdownNow(); } } catch (InterruptedException ie) { LOGGER.error(ie.getMessage()); } catch (Exception e) { LOGGER.error(e.getMessage()); } }
Source:
<code>public void init() { <START> load(FileSystems.getDefault().getPath(EngineLocalConfig.getInstance().getUsrDir().getAbsolutePath(), "osinfo.conf.d")); <END> load(FileSystems.getDefault().getPath(EngineLocalConfig.getInstance().getEtcDir().getAbsolutePath(), "osinfo.conf.d")); }</code><technical_language>left this</technical_language>

Target:
public void init() { load(FileSystems.getDefault().getPath(EngineLocalConfig.getInstance().getEtcDir().getAbsolutePath(), "/conf/osinfo.conf.d")); loadPreferencesFromProperties(); }
Source:
<code>public static int minNonNullValueSize(int nonNullCount) { <START> return max(nonNullCount + 1, 1025); <END> }</code><technical_language>nit: OrcReader.MAX_BATCH_SIZE. max(nonNullCount, MAX_BATCH_SIZE) + 1</technical_language>

Target:
public static int minNonNullValueSize(int nonNullCount) { return max(nonNullCount, MAX_BATCH_SIZE) + 1; }
Source:
<code>public GdbMemoryBlock(DsfMemoryBlockRetrieval retrieval, IMemoryDMContext context, String modelId, String expression, BigInteger address, <START> int word_size, long length, String memorySpaceID) { <END> super(retrieval, context, modelId, expression, address, word_size, length); fMemorySpaceID = (memorySpaceID != null && memorySpaceID.length() > 0) ? memorySpaceID : null; assert memorySpaceID == null || memorySpaceID.length() > 0; }</code><technical_language>right time cleanup this constructor remove memorySpaceID well</technical_language>

Target:
public GdbMemoryBlock(DsfMemoryBlockRetrieval retrieval, IMemoryDMContext context, String modelId, String expression, BigInteger address, int word_size, long length, String memorySpaceID) { super(retrieval, context, modelId, expression, address, word_size, length); fMemorySpaceID = (memorySpaceID != null && !memorySpaceID.isEmpty()) ? memorySpaceID : null; assert memorySpaceID == null || !memorySpaceID.isEmpty(); if(memorySpaceID != null) { assert(context instanceof IMemorySpaceDMContext); assert memorySpaceID.equals(((IMemorySpaceDMContext) context).getMemorySpaceId()); } else { if (context instanceof IMemorySpaceDMContext) { assert ((IMemorySpaceDMContext) context).getMemorySpaceId() == null; } } }
Source:
<code>void onClickRecipientExpander() { recipientMvpView.setCcVisibility(true); recipientMvpView.setBccVisibility(true); <START> if(defaultBccAddress != null) addBccAddresses(defaultBccAddress); <END> updateRecipientExpanderVisibility(); }</code><technical_language>Code style - add a space if a new line {}'s</technical_language>

Target:
void onClickRecipientExpander() { recipientMvpView.setCcVisibility(true); recipientMvpView.setBccVisibility(true); if ( defaultBccAddress != null ) { addBccAddresses(defaultBccAddress); } updateRecipientExpanderVisibility(); }
Source:
<code>public void testOrClause() { String drl = "package org.drools.compiler.integrationtests;\n" + "import " + Person.class.getName() + ";\n" <START> + "import " + HardSoftScoreHolder.class.getName() + ";\n" <END> + "global HardSoftScoreHolder scoreHolder;\n" + "rule R1\n" + "when\n" + " Person( age > 20 )\n" + " or\n" + " Person( name == \"John\")\n" + "then\n" + " scoreHolder.addSoftConstraintMatch(kcontext, -1);\n" + "end"; KieSession ksession = new KieHelper().addContent(drl, ResourceType.DRL) .build() .newKieSession(); ksession.getGlobals().set("scoreHolder",new HardSoftScoreHolder(true)); Person john = new Person("John", 25); ksession.insert(john); int fired = ksession.fireAllRules(); assertEquals(1, fired); }</code><technical_language>please replace HardSoftScoreHolder reference a simple mock avoid declaring a dependency OptaPlanner</technical_language>

Target:
public void testOrClause() { String drl = "package org.drools.compiler.integrationtests;\n" + "import " + Person.class.getName() + ";\n" + "import " + HardSoftScoreHolderMock.class.getName() + ";\n" + "global HardSoftScoreHolderMock scoreHolderMock;\n" + "rule R1\n" + "when\n" + " Person( age > 20 )\n" + " or\n" + " Person( name == \"John\")\n" + "then\n" + " scoreHolderMock.addSoftConstraintMatch(kcontext, -1);\n" + "end"; KieSession ksession = new KieHelper().addContent(drl, ResourceType.DRL) .build() .newKieSession(); ksession.getGlobals().set("scoreHolderMock", new HardSoftScoreHolderMock()); Person john = new Person("John", 25); ksession.insert(john); int fired = ksession.fireAllRules(); assertEquals(1, fired); }