auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private synchronized void connectToCassandra() { Cluster.Builder clusterBuilder = Cluster.builder().addContactPoint(config.getHost()) .withPort(config.getPort().intValue()); keyspace = config.getKeyspace(); table = config.getTable(); if (!Strings.isNullOrEmpty(config.getUser()) && !Strings.isNullOrEmpty(config.getPassword())) { cluster = clusterBuilder.withCredentials(config.getUser(), config.getPassword()).build(); } else { cluster = clusterBuilder.build(); } Metadata metadata = cluster.getMetadata(); if (Objects.isNull(metadata.getKeyspace(keyspace))) { LOGGER.info("Keyspace does not exist. Creating Keyspace", keyspace); <START> Map<String, Object> replication = new HashMap<String, Object>(); <END> replication.put("class", "SimpleStrategy"); replication.put("replication_factor", 1); String createKeyspaceStmt = SchemaBuilder.createKeyspace(keyspace).with() .replication(replication).getQueryString(); cluster.connect().execute(createKeyspaceStmt); } session = cluster.connect(keyspace); KeyspaceMetadata ks = metadata.getKeyspace(keyspace); TableMetadata tableMetadata = ks.getTable(table); if (Objects.isNull(tableMetadata)) { LOGGER.info("Table does not exist in Keyspace {}. Creating Table", table, keyspace); String createTableStmt = SchemaBuilder.createTable(table) .addPartitionKey(config.getPartitionKeyColumn(), DataType.varchar()) .addColumn(config.getColumn(), DataType.blob()).getQueryString(); session.execute(createTableStmt); } }</code><technical_language>please Java 8 conventions - need types RHS</technical_language>

Target:
private synchronized void connectToCassandra() { Cluster.Builder clusterBuilder = Cluster.builder() .addContactPoints(config.getHost().toArray(new String[config.getHost().size()])) .withPort(config.getPort().intValue()); keyspace = config.getKeyspace(); table = config.getTable(); if (StringUtils.isNotEmpty(config.getUser()) && StringUtils.isNotEmpty(config.getPassword())) { cluster = clusterBuilder.withCredentials(config.getUser(), config.getPassword()).build(); } else { cluster = clusterBuilder.build(); } Metadata metadata = cluster.getMetadata(); if (Objects.isNull(metadata.getKeyspace(keyspace))) { LOGGER.info("Keyspace does not exist. Creating Keyspace", keyspace); Map<String, Object> replication = new HashMap<>(); replication.put("class", "SimpleStrategy"); replication.put("replication_factor", 1); String createKeyspaceStmt = SchemaBuilder.createKeyspace(keyspace).with() .replication(replication).getQueryString(); cluster.connect().execute(createKeyspaceStmt); } session = cluster.connect(keyspace); KeyspaceMetadata ks = metadata.getKeyspace(keyspace); TableMetadata tableMetadata = ks.getTable(table); if (Objects.isNull(tableMetadata)) { LOGGER.info("Table does not exist in Keyspace {}. Creating Table", table, keyspace); String createTableStmt = SchemaBuilder.createTable(table) .addPartitionKey(config.getPartitionKeyColumn(), DataType.varchar()) .addColumn(config.getColumn(), DataType.blob()).getQueryString(); session.execute(createTableStmt); } }
Source:
<code><START> private <I, T extends I> @Nullable I getSingleServiceInstance(Class<T> clazz, final List<I> filteredServices) { <END> if (filteredServices.size() > 1) { Assert.fail("More than 1 service matching the filter is registered."); } if (filteredServices.isEmpty()) { new MissingServiceAnalyzer(System.out, bundleContext).printMissingServiceDetails(clazz); return null; } else { return filteredServices.get(0); } }</code><technical_language>this is wrong private <T, I extends T> @Nullable I getSingleServiceInstance(Class<T> clazz, final List<I> filteredServices)</technical_language>

Target:
private <T, I extends T> @Nullable I getSingleServiceInstance(Class<T> clazz, final List<I> filteredServices) { if (filteredServices.size() > 1) { Assert.fail("More than 1 service matching the filter is registered."); } if (filteredServices.isEmpty()) { new MissingServiceAnalyzer(System.out, bundleContext).printMissingServiceDetails(clazz); return null; } else { return filteredServices.get(0); } }
Source:
<code>public static synchronized EmailEventAdapter getEmailEventAdapter(Map<String, String> dynamicProperties) { if (emailAdapter == null) { emailAdapter = new EmailEventAdapter(null, dynamicProperties); } try { emailAdapter.init(); } catch (OutputEventAdapterException e) { <START> log.error("unable to initialize adapter"+ emailAdapter + e); <END> } return emailAdapter; }</code><technical_language>Error logged log.error("unable initialize adapter + emailAdapter, e);</technical_language>

Target:
public static synchronized EmailEventAdapter getEmailEventAdapter(Map<String, String> dynamicProperties) { if (emailAdapter == null) { emailAdapter = new EmailEventAdapter(null, dynamicProperties); } try { emailAdapter.init(); } catch (OutputEventAdapterException e) { log.error("Unable to initialize email adapter.", e); } return emailAdapter; }
Source:
<code>private void updateOriginalTemplateNameOnDerivedVms() { if (!getParameters().isImportAsNewEntity()) { <START> DbFacade.getInstance().getVmDao().updateOriginalTemplateName(getVmTemplate().getId(), getVmTemplate().getName()); <END> } }</code><technical_language>I remember change names cloning. btw, interesting do for clone..</technical_language>

Target:
private void updateOriginalTemplateNameOnDerivedVms() { if (!getParameters().isImportAsNewEntity()) { getVmDAO().updateOriginalTemplateName(getVmTemplate().getId(), getVmTemplate().getName()); } }
Source:
<code><START> public void testNewTempFile() { <END> int CREATE_CNT = 1500; Collection<File> folders = new ArrayList<File>(CREATE_CNT); try { for (int i = 0; i < CREATE_CNT; i++) { try { folders.add(Os.newTempFile(OsTest.class, "test")); } catch (IllegalStateException e) { log.warn("testNewTempFile failed at " + i + " iteration."); Exceptions.propagate(e); } } } finally { for (File folder : folders) { folder.delete(); } } }</code><technical_language>groups="Integration" file system is fast</technical_language>

Target:
public void testNewTempFile() { int CREATE_CNT = 5000; Collection<File> folders = new ArrayList<File>(CREATE_CNT); try { for (int i = 0; i < CREATE_CNT; i++) { try { folders.add(Os.newTempFile(OsTest.class, "test")); } catch (IllegalStateException e) { log.warn("testNewTempFile failed at " + i + " iteration."); Exceptions.propagate(e); } } } finally { for (File folder : folders) { folder.delete(); } } }
Source:
<code>public void test4_11DeleteTraceFromExperiment() { SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); traceItem.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, <START> TRACE_NAME)); <END> fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("ExampleCustomTxt.log [1]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "ExampleCustomTxt.log [1]"); expItem.expand(); SWTBotTreeItem expTrace = expItem.getNode("ExampleCustomTxt.log"); expTrace.contextMenu("Delete").click(); fBot.waitUntil(Conditions.shellIsActive("Confirm Delete")); SWTBotShell shell = fBot.shell("Confirm Delete"); shell.bot().button("Yes").click(); fBot.waitUntil(Conditions.shellCloses(shell)); fBot.waitWhile(new ConditionHelpers.ActiveEventsEditor(fBot, null)); SWTBotUtils.waitUntil(exp -> exp.getItems().length == 0, experimentsItem, "Failed to delete the trace from the experiment"); fBot.waitUntil(new TraceDeletedCondition()); }</code><technical_language>Open Experiment experiment name trace is trace selected. this condition right original trace is opened. I suggest closeAllEditors step of 4_11 4_12. condition wait for experiment opened</technical_language>

Target:
public void test4_11DeleteTraceFromExperiment() { fBot.closeAllEditors(); SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); traceItem.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, TRACE_NAME)); fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("ExampleCustomTxt.log [1]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "ExampleCustomTxt.log [1]"); expItem.expand(); SWTBotTreeItem expTrace = expItem.getNode(TRACE_NAME); expTrace.contextMenu("Delete").click(); fBot.waitUntil(Conditions.shellIsActive("Confirm Delete")); SWTBotShell shell = fBot.shell("Confirm Delete"); shell.bot().button("Yes").click(); fBot.waitUntil(Conditions.shellCloses(shell)); fBot.waitWhile(new ConditionHelpers.ActiveEventsEditor(fBot, null)); SWTBotUtils.waitUntil(exp -> exp.getItems().length == 0, experimentsItem, "Failed to delete the trace from the experiment"); fBot.waitUntil(new TraceDeletedCondition()); }
Source:
<code>public void testDeletionOfReleasesWithNonMatchingTarget() throws Exception { fillInRepo(); releases.setAccessManager( new OpenAccessManager() ); targetRegistry.addRepositoryTarget( new Target( "test", "test", new Maven2ContentClass(), Lists.newArrayList( ".*/com/sonatype/.*" ) ) ); targetRegistry.commitChanges(); ReleaseRemovalResult releaseRemovalResult = defaultNexus.removeReleases( new ReleaseRemovalRequest( releases.getId(), 2, "test" ) ); assertThat( releaseRemovalResult.getDeletedFileCount(), is( 0 ) ); assertThat( releaseRemovalResult.isSuccessful(), is( true ) ); try { StorageItem storageItem = releases.retrieveItem( new ResourceStoreRequest( "org/sonatype/test/1.0" ) ); } catch ( ItemNotFoundException e ) { <START> Assert.fail(); <END> } }</code><technical_language>carry a message failed</technical_language>

Target:
public void testDeletionOfReleasesWithNonMatchingTarget() throws Exception { fillInRepo(); releases.setAccessManager( new OpenAccessManager() ); targetRegistry.addRepositoryTarget( new Target( "test", "test", new Maven2ContentClass(), Lists.newArrayList( ".*/com/sonatype/.*" ) ) ); targetRegistry.commitChanges(); ReleaseRemovalResult releaseRemovalResult = releaseRemover.removeReleases( new ReleaseRemovalRequest( releases.getId(), 2, "test" ) ); assertThat( releaseRemovalResult.getDeletedFileCount(), is( 0 ) ); assertThat( releaseRemovalResult.isSuccessful(), is( true ) ); try { StorageItem storageItem = releases.retrieveItem( new ResourceStoreRequest( "org/sonatype/test/1.0" ) ); } catch ( ItemNotFoundException e ) { Assert.fail("Files should not have been deleted, but we can't find them now"); } }
Source:
<code><START> public static <END> boolean hasPackageJson(IProject project){ IFile packageJsonFile = project.getFile(NodeConstants.PACKAGE_JSON); if (packageJsonFile != null && packageJsonFile.isAccessible()) { return true; } return false; }</code><technical_language>need 'public static'? Is this method outside</technical_language>

Target:
private boolean hasPackageJson(IProject project){ IFile packageJsonFile = project.getFile(NodeConstants.PACKAGE_JSON); if (packageJsonFile != null && packageJsonFile.isAccessible()) { return true; } return false; }
Source:
<code>public void onMouseEnterUsername() { if (player == null || player.getChatOnly() || usernameLabel.getTooltip() != null) { return; } Tooltip userTooltip = new Tooltip(); usernameLabel.setTooltip(userTooltip); userTooltip.textProperty().bind(Bindings.createStringBinding( () -> String.format("%s\n%s", i18n.get("userInfo.ratingFormat", getGlobalRating(player), getLeaderboardRating(player)), <START> i18n.get("userInfo.idleTimeFormat", Duration.between(player.getIdleSince(), Instant.now()).toMinutes())), <END> player.leaderboardRatingMeanProperty(), player.leaderboardRatingDeviationProperty(), player.globalRatingMeanProperty(), player.globalRatingDeviationProperty(), player.idleSinceProperty() )); }</code><technical_language>If want implementation supports minutes ("Idle since: 224 min") com.faforever.client.util.TimeService#shortDuration build a string "Idle since: 30min 42s" "Idle since: 3h 44min" com.faforever.client.util.TimeService#timeAgo build a "Last active: 3h 44min ago". If want that, I do :P</technical_language>

Target:
public void onMouseEnterUsername() { if (player == null || player.getChatOnly() || usernameLabel.getTooltip() != null) { return; } Tooltip userTooltip = new Tooltip(); usernameLabel.setTooltip(userTooltip); userTooltip.textProperty().bind(Bindings.createStringBinding( () -> String.format("%s\n%s", i18n.get("userInfo.ratingFormat", getGlobalRating(player), getLeaderboardRating(player)), i18n.get("userInfo.idleTimeFormat", timeService.timeAgo(player.getIdleSince()))), player.leaderboardRatingMeanProperty(), player.leaderboardRatingDeviationProperty(), player.globalRatingMeanProperty(), player.globalRatingDeviationProperty(), player.idleSinceProperty() )); }
Source:
<code>private void setTripDetails(ObaTripDetailsResponse data) { mTripInfo = data; final int code = mTripInfo.getCode(); if (code == ObaApi.OBA_OK) { setEmptyText(""); } else { setEmptyText(UIUtils.getRouteErrorString(getActivity(), code)); return; } setUpHeader(); final ListView listView = getListView(); if (mAdapter == null) { mAdapter = new TripDetailsAdapter(); getListView().setDivider(null); setListAdapter(mAdapter); <START> if (mScrollMode != null && mScrollMode.equals("vehicle")) { <END> final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } else if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } } else { if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } else { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } } } mAdapter.notifyDataSetChanged(); } else { int index = listView.getFirstVisiblePosition(); View v = listView.getChildAt(0); int top = (v == null) ? 0 : v.getTop(); mAdapter.notifyDataSetChanged(); listView.setSelectionFromTop(index, top); } }</code><technical_language>simplify this section of code, this be: if (mScrollMode == null) { // automatically scroll stop vehicle icon return; } So, if scroll mode is provided, do nothing. do a switch for scroll modes. This switch in private method avoid cluttering this much</technical_language>

Target:
private void setTripDetails(ObaTripDetailsResponse data) { mTripInfo = data; final int code = mTripInfo.getCode(); if (code == ObaApi.OBA_OK) { setEmptyText(""); } else { setEmptyText(UIUtils.getRouteErrorString(getActivity(), code)); return; } setUpHeader(); final ListView listView = getListView(); if (mAdapter == null) { mAdapter = new TripDetailsAdapter(); getListView().setDivider(null); setListAdapter(mAdapter); setScroller(listView); } else { int index = listView.getFirstVisiblePosition(); View v = listView.getChildAt(0); int top = (v == null) ? 0 : v.getTop(); mAdapter.notifyDataSetChanged(); listView.setSelectionFromTop(index, top); } }
Source:
<code>protected void setAuthentication(okhttp3.Request.Builder builder) { if (getApiKey() == null) { throw new IllegalArgumentException("api_key needs to be specified. Use setApiKey()"); } if (endPointChanged && !getEndPoint().equals(URL)) { <START> super.setAuthentication(builder); <END> } final okhttp3.HttpUrl url = okhttp3.HttpUrl.parse(builder.build().url().toString()); if ((url.query() == null) || url.query().isEmpty()) { builder.url(builder.build().url() + "?api_key=" + getApiKey()); } else { builder.url(builder.build().url() + "&api_key=" + getApiKey()); } }</code><technical_language>wrong set this authentication header if request is targeting a public instance of VR? If not, supply code simple. if is a problem, I worry endpoint changed is for a service instance in a region. In case, want provide this authorization header</technical_language>

Target:
protected void setAuthentication(okhttp3.Request.Builder builder) { if (getUsername() != null && getPassword() != null) { super.setAuthentication(builder); } else if (getApiKey() != null) { final okhttp3.HttpUrl url = okhttp3.HttpUrl.parse(builder.build().url().toString()); if ((url.query() == null) || url.query().isEmpty()) { builder.url(builder.build().url() + "?api_key=" + getApiKey()); } else { builder.url(builder.build().url() + "&api_key=" + getApiKey()); } } else { throw new IllegalArgumentException( "Credentials need to be specified. Use setApiKey() or setUsernameAndPassword()"); } }
Source:
<code>protected Device findActiveDevice(final String deviceIdentification) throws FunctionalException { Device device; try { device = this.deviceDomainService.searchActiveDevice(deviceIdentification); } catch (final UnregisteredDeviceException e) { throw new FunctionalException(FunctionalExceptionType.UNREGISTERED_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } catch (final InactiveDeviceException e) { <START> throw new FunctionalException(FunctionalExceptionType.INACTIVE_DEVICE, ComponentType.DOMAIN_CORE, e); <END> } catch (final UnknownEntityException e) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } return device; }</code><technical_language>Component type for inactive device exception DOMAIN_PUBLIC_LIGHTING here</technical_language>

Target:
protected Device findActiveDevice(final String deviceIdentification) throws FunctionalException { Device device; try { device = this.deviceDomainService.searchActiveDevice(deviceIdentification); } catch (final UnregisteredDeviceException e) { throw new FunctionalException(FunctionalExceptionType.UNREGISTERED_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } catch (final InactiveDeviceException e) { throw new FunctionalException(FunctionalExceptionType.INACTIVE_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } catch (final UnknownEntityException e) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICE, ComponentType.DOMAIN_PUBLIC_LIGHTING, e); } return device; }
Source:
<code>public INDArray doForward(boolean training, LayerWorkspaceMgr workspaceMgr) { if(sameDiff == null){ doInit(); } try(MemoryWorkspace ws = Nd4j.getWorkspaceManager().scopeOutOfWorkspaces()) { for(int i=0; i<inputs.length; i++ ){ String name = config.getVertexParams().getInputs().get(i); sameDiff.associateArrayWithVariable(inputs[i].dup(), sameDiff.getVariable(name)); } if(maskArrays != null){ for(int i=0; i<maskArrays.length; i++ ){ String name = config.getVertexParams().getInputs().get(i); sameDiff.associateArrayWithVariable(maskArrays[i++].dup(), name + "_mask"); } <START> } <END> if(paramTable != null && paramTable.size() > 0) { for (String s : paramTable.keySet()) { sameDiff.associateArrayWithVariable(paramTable.get(s), s); } } Map<String,INDArray> out = sameDiff.exec(null, outputKey); INDArray result = out.get(outputKey); return workspaceMgr.dup(ArrayType.ACTIVATIONS, result); } }</code><technical_language>concern I this block: mix masks masks in minibatches. mask is equivalent ones, some iterators omit a mask array for case. risk incorrectly retaining masks minibatch if current masks. And, hypothetically (though rare) masks for inputs, some of them? for a solution - good question... I associate a INDArrays ([mb, seqLength], based input shape) if maskArray is null</technical_language>

Target:
public INDArray doForward(boolean training, LayerWorkspaceMgr workspaceMgr) { if(sameDiff == null){ doInit(); } try(MemoryWorkspace ws = Nd4j.getWorkspaceManager().scopeOutOfWorkspaces()) { config.validateInput(inputs); for(int i=0; i<inputs.length; i++ ){ String name = config.getVertexParams().getInputs().get(i); final String maskName = name + "_mask"; sameDiff.associateArrayWithVariable(inputs[i].dup(), sameDiff.getVariable(name)); if(maskArrays != null && maskArrays[i] != null) { sameDiff.associateArrayWithVariable(maskArrays[i].dup(), maskName); }else{ sameDiff.associateArrayWithVariable(createMask(inputs[i].shape()), maskName); } } if(paramTable != null && paramTable.size() > 0) { for (String s : paramTable.keySet()) { sameDiff.associateArrayWithVariable(paramTable.get(s), s); } } Map<String,INDArray> out = sameDiff.exec(null, outputKey); INDArray result = out.get(outputKey); return workspaceMgr.dup(ArrayType.ACTIVATIONS, result); } }
Source:
<code>protected void initParametersForExternalNetworks(VDS vds, boolean isMigration) { if (getVm().getInterfaces().isEmpty()) { return; } Map<VmDeviceId, VmDevice> nicDevices = Entities.businessEntitiesById(vmDeviceDao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceGeneralType.INTERFACE)); for (VmNic iface : getVm().getInterfaces()) { VnicProfile vnicProfile = vnicProfileDao.get(iface.getVnicProfileId()); Network network = networkHelper.getNetworkByVnicProfile(vnicProfile); VmDevice <START> vmDevice = <END> nicDevices.get(new VmDeviceId(iface.getId(), getVmId())); if (network != null && network.isExternal() && vmDevice.isPlugged()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); Map<String, String> deviceProperties = providerProxy.allocate( network, vnicProfile, iface, vds, isMigration); getVm().getRuntimeDeviceCustomProperties().put(vmDevice.getId(), deviceProperties); } } }</code><technical_language>This object is redundant mind in a bugfix</technical_language>

Target:
protected void initParametersForExternalNetworks(VDS vds, boolean isMigration) { for (VmNetworkInterface iface : getVm().getInterfaces()) { VnicProfile vnicProfile = vnicProfileDao.get(iface.getVnicProfileId()); Network network = networkHelper.getNetworkByVnicProfile(vnicProfile); if (network != null && network.isExternal() && iface.isPlugged()) { Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = providerProxyFactory.create(provider); Map<String, String> deviceProperties = providerProxy.allocate( network, vnicProfile, iface, vds, isMigration); getVm().getRuntimeDeviceCustomProperties().put( new VmDeviceId(iface.getId(), getVmId()), deviceProperties); } } }
Source:
<code>public void onComplete(Result result) { final long requestTime = System.currentTimeMillis() - start; try { emitter.emit( DruidMetrics.makeQueryTimeMetric(jsonMapper, query, req.getRemoteAddr()) .build("query/time", requestTime) ); requestLogger.log( new RequestLogLine( new DateTime(), req.getRemoteAddr(), query, new QueryStats( ImmutableMap.<String, Object>of( "query/time", requestTime, "success", <START> result.isSucceeded() && result.getResponse().getStatus() == 200 <END> ) ) ) ); } catch (Exception e) { log.error(e, "Unable to log query [%s]!", query); } super.onComplete(result); }</code><technical_language>this changed? some existing static variable http libs instead of 200</technical_language>

Target:
public void onComplete(Result result) { final long requestTime = System.currentTimeMillis() - start; try { emitter.emit( DruidMetrics.makeQueryTimeMetric(jsonMapper, query, req.getRemoteAddr()) .build("query/time", requestTime) ); requestLogger.log( new RequestLogLine( new DateTime(), req.getRemoteAddr(), query, new QueryStats( ImmutableMap.<String, Object>of( "query/time", requestTime, "success", result.isSucceeded() && result.getResponse().getStatus() == javax.ws.rs.core.Response.Status.OK.getStatusCode() ) ) ) ); } catch (Exception e) { log.error(e, "Unable to log query [%s]!", query); } super.onComplete(result); }
Source:
<code>void unpackId(String id) { if (id != null && id.length() > 0) { this.id = id; try { URL url = new URL(id); String[] tokens = url.getPath().split("/"); this.name = (tokens.length >= 3 ? tokens[2] : null); this.version = (tokens.length >= 4 ? tokens[3] : null); } catch (MalformedURLException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>logging this</technical_language>

Target:
void unpackId(String id) { if (id != null && id.length() > 0) { this.id = id; try { URL url = new URL(id); String[] tokens = url.getPath().split("/"); this.name = (tokens.length >= 3 ? tokens[2] : null); this.version = (tokens.length >= 4 ? tokens[3] : null); } catch (MalformedURLException e) { logger.error("Received Malformed Secret Id URL from KV Service"); } } }
Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { String jobUuid = context.getJobDetail().getKey().getName(); long startTime = System.currentTimeMillis(); try { MDC.put("requestType", "job"); <START> MDC.put("requestUuid", jobUuid); <END> } catch (NullPointerException npe) { } if (logExecutionTime()) { log.info("Starting job: {}", getClass().getName()); } boolean startedUow = startUnitOfWork(); try { toExecute(context); if (eventSinkProvider != null) { eventSinkProvider.get().sendEvents(); } } catch (PersistenceException e) { refireCheck(context, e); } catch (RetryJobException e) { refireCheck(context, e); } finally { if (startedUow) { endUnitOfWork(); } if (logExecutionTime()) { long executionTime = System.currentTimeMillis() - startTime; log.info("Job completed: time={}", executionTime); } } }</code><technical_language>moving this of try/catch, 15 unit tests NPE</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { long startTime = System.currentTimeMillis(); try { MDC.put("requestType", "job"); MDC.put("requestUuid", context.getJobDetail().getKey().getName()); } catch (NullPointerException npe) { } if (logExecutionTime()) { log.info("Starting job: {}", getClass().getName()); } boolean startedUow = startUnitOfWork(); try { toExecute(context); if (eventSinkProvider != null) { eventSinkProvider.get().sendEvents(); } } catch (PersistenceException e) { refireCheck(context, e); } catch (RetryJobException e) { refireCheck(context, e); } finally { if (startedUow) { endUnitOfWork(); } if (logExecutionTime()) { long executionTime = System.currentTimeMillis() - startTime; log.info("Job completed: time={}", executionTime); } } }
Source:
<code>private boolean inTouchableArea(float x, float y) { <START> if(mDisableCircularTransformation) { <END> return true; } return Math.pow(x - mBorderRect.centerX(), 2) + Math.pow(y - mBorderRect.centerY(), 2) <= Math.pow(mBorderRadius, 2); }</code><technical_language>a space if</technical_language>

Target:
private boolean inTouchableArea(float x, float y) { if(mDisableCircularTransformation || mBitmap == null) { return true; } return Math.pow(x - mBorderRect.centerX(), 2) + Math.pow(y - mBorderRect.centerY(), 2) <= Math.pow(mBorderRadius, 2); }
Source:
<code>public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0}}, {"0\\n1", new int[] {0, 1}}, {"0 1\\n2 3", new int[] {0, 2}}, <START> {"0 1 2\\n3 4 5\\n6 7 8", new int[] {0, 3, 6}} <END> }); }</code><technical_language>I if format matrices in a more intuitive way? (last row example): java @Parameterized.Parameters(name = "{index}: checking row of matrix constructed string \"{0}\".") public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0, 1}}, {"0\n1", new int[] {0}}, {"0 1\n2 3", new int[] {0, 1}}, { "0 1 2\n" + "3 4 5\n" + "6 7 8", new int[] {0, 1, 2}} }); } I find a easier draw connection input expected output formatting, others disagree...</technical_language>

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0}}, { "0\n" + "1", new int[] {0, 1}}, { "0 1\n" + "2 3", new int[] {0, 2}}, { "0 1 2\n" + "3 4 5\n" + "6 7 8", new int[] {0, 3, 6}} }); }
Source:
<code>public void removeTicket() { Long id = persistTicket().getId(); Ticket ticket = ticketService.removeTicket(id); <START> assertEquals(id, ticket.getId()); <END> }</code><technical_language>for this test, is checking for id retrieval. check if ticket is removal. If is not, test succeeded. This is testing spring/hibernate</technical_language>

Target:
public void removeTicket() { Long id = persistTicket().getId(); Ticket ticket = ticketService.removeTicket(id); assertEquals(id, ticket.getId()); assertNull(ticketRepository.findOne(id)); }
Source:
<code>private void refresh(boolean archived) { if (!NetworkUtils.isInternetConnectionEstablished(this)) { progressBar.setVisibility(View.GONE); Snackbar.make(relativeLayout, R.string.no_internet, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.retry, view -> refresh(archived)).show(); } else { if (getSupportActionBar() != null) { if (archived) { getSupportActionBar().setTitle(R.string.archived_notifications); } else { getSupportActionBar().setTitle(R.string.notifications); } } addNotifications(archived); <START> }progressBar.setVisibility(View.VISIBLE); <END> no_notification.setVisibility(View.GONE); relativeLayout.setVisibility(View.VISIBLE); }</code><technical_language>next line</technical_language>

Target:
private void refresh(boolean archived) { if (!NetworkUtils.isInternetConnectionEstablished(this)) { progressBar.setVisibility(View.GONE); Snackbar.make(relativeLayout, R.string.no_internet, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.retry, view -> refresh(archived)).show(); } else { addNotifications(archived); } progressBar.setVisibility(View.VISIBLE); no_notification.setVisibility(View.GONE); relativeLayout.setVisibility(View.VISIBLE); }
Source:
<code>public boolean popMessage(String processorName) throws Exception { try { <START> if (processorName != null) { <END> return stub.popMessage(processorName); } return false; } catch (Exception e) { handleException(e); return false; } }</code><technical_language>processor name null</technical_language>

Target:
public boolean popMessage(String processorName) throws Exception { try { return stub.popMessage(processorName); } catch (Exception e) { throw createException("Failed to pop the message from the queue", e); } }
Source:
<code>public OrmException convertError(String op, String entity, SQLException err) { <START> return fallbackConvertError(op, entity, err); <END> }</code><technical_language>purpose of this change overwrite convertError() message in MySQL dialect. this implementation call base method. bug is claimed fixed in commit message fixed</technical_language>

Target:
public OrmException convertError(String op, String entity, SQLException err) { switch (err.getErrorCode()) { case 1022: case 1062: case 1169: return new OrmDuplicateKeyException(entity, err); default: return fallbackConvertError(op, entity, err); } }
Source:
<code><START> public void setConnection(IRemoteConnection connection) throws CoreException { <END> fSelectionListernersEnabled = false; if (fLocalButton != null && connection != null && connection.getConnectionType() == fRemoteServicesManager.getLocalConnectionType()) { fLocalButton.setSelection(true); handleButtonSelected(); } else { handleRemoteServiceSelected(connection); } handleConnectionSelected(); updateEnablement(); fSelectionListernersEnabled = true; }</code><technical_language>I reason throw CoreException here</technical_language>

Target:
public void setConnection(IRemoteConnection connection) { fSelectionListernersEnabled = false; if (fLocalButton != null && connection != null && connection.getConnectionType() == fRemoteServicesManager.getLocalConnectionType()) { fLocalButton.setSelection(true); handleButtonSelected(); } else { handleRemoteServiceSelected(connection); } handleConnectionSelected(); updateEnablement(); fSelectionListernersEnabled = true; }
Source:
<code>@Override public void publish(LogRecord record) { for (Map.Entry<String,LogRecorder> entry : logRecorders.entrySet()) { for (LogRecorder.Target target : entry.getValue().targets) { if (target.includes(record)) { try { String name = entry.getKey(); LogFile logFile; synchronized (logFiles) { logFile = logFiles.get(name); if (logFile == null) { logFile = new LogFile(name); logFiles.put(name, logFile); } } logFile.publish(record); } catch (IOException x) { <START> x.printStackTrace(); END> } } } } }</code><technical_language>this removed then</technical_language>

Target:
@Override public void publish(LogRecord record) { for (Map.Entry<String,LogRecorder> entry : logRecorders.entrySet()) { for (LogRecorder.Target target : entry.getValue().targets) { if (target.includes(record)) { String name = entry.getKey(); try { LogFile logFile; synchronized (logFiles) { logFile = logFiles.get(name); if (logFile == null) { logFile = new LogFile(name); logFiles.put(name, logFile); } } logFile.publish(record); } catch (IOException x) { LOGGER.warning("Error while publishing log records for '" + name); } } } } }
Source:
<code>public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception { EssentialsWarpEvent event = new EssentialsWarpEvent(teleportee, warp); Bukkit.getServer().getPluginManager().callEvent(event); <START> if(event.isCancelled()){ <END> return; } Location loc = ess.getWarps().getWarp(warp); teleportee.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); if (!teleportee.equals(teleportOwner)) { teleportOwner.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } teleport(teleportee, new LocationTarget(loc), chargeFor, cause); }</code><technical_language>This spaced out</technical_language>

Target:
public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception { UserWarpEvent event = new UserWarpEvent(teleportee, warp, chargeFor); Bukkit.getServer().getPluginManager().callEvent(event); if(event.isCancelled()) { return; } warp = event.getWarp(); Location loc = ess.getWarps().getWarp(warp); teleportee.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); if (!teleportee.equals(teleportOwner)) { teleportOwner.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } teleport(teleportee, new LocationTarget(loc), chargeFor, cause); }
Source:
<code>public void serialize(DataOutputStream out) throws IOException, IllegalStateException { out.writeLong(entryLogId); out.writeLong(totalSize); out.writeLong(remainingSize); out.writeLong(ledgersMap.size()); ledgersMap.forEach((ledgerId, size) -> { try { out.writeLong(ledgerId); out.writeLong(size); } catch (IOException e) { throw new IllegalStateException("Failed to serialize entryLogMetadata", e); } }); <START> out.writeLong(remainingSize); <END> }</code><technical_language>is this a duplicate of item</technical_language>

Target:
public void serialize(DataOutputStream out) throws IOException, IllegalStateException { out.writeShort(DEFAULT_SERIALIZATION_VERSION); out.writeLong(entryLogId); out.writeLong(totalSize); out.writeLong(remainingSize); out.writeLong(ledgersMap.size()); ledgersMap.forEach((ledgerId, size) -> { try { out.writeLong(ledgerId); out.writeLong(size); } catch (IOException e) { throw new IllegalStateException("Failed to serialize entryLogMetadata", e); } }); out.flush(); }
Source:
<code>public NewStreamsResponse(DataInputStream inNet) throws IOException { byte[] data = new byte[size()]; inNet.readFully(data); ByteBuffer bb = ByteBuffer.wrap(data); bb.order(ByteOrder.BIG_ENDIAN); fStatus = NewStreamsReturnCode.values()[bb.getInt() - 1]; fNbStreams = bb.getInt(); List<StreamResponse> sl = new ArrayList<>(fNbStreams); if (getStatus().equals(NewStreamsReturnCode.LTTNG_VIEWER_NEW_STREAMS_OK)) { for (int stream = 0; stream < fNbStreams; stream++) { sl.add(stream, new StreamResponse(inNet)); } } <START> fStreamList = ImmutableList.copyOf(sl); <END> }</code><technical_language>too, ImmutableList.Builder</technical_language>

Target:
public NewStreamsResponse(DataInputStream inNet) throws IOException { byte[] data = new byte[size()]; inNet.readFully(data); ByteBuffer bb = ByteBuffer.wrap(data); bb.order(ByteOrder.BIG_ENDIAN); fStatus = NewStreamsReturnCode.values()[bb.getInt() - 1]; fNbStreams = bb.getInt(); ImmutableList.Builder<StreamResponse> sl = new ImmutableList.Builder<>(); if (getStatus().equals(NewStreamsReturnCode.LTTNG_VIEWER_NEW_STREAMS_OK)) { for (int stream = 0; stream < fNbStreams; stream++) { sl.add(new StreamResponse(inNet)); } } fStreamList = sl.build(); }
Source:
<code>public void testLeft() throws Exception { ResultSet rs; String sql = "select left(name, cut, 'short') from (" + "values ('hello world', 5), ('hey dude', 20)" + ") tb(name, cut);"; List<String> expected = new ArrayList<String>(2); expected.add("hello"); expected.add("hey dudeshortshortsh"); rs = methodWatcher.executeQuery(sql); int i = 0; while (rs.next()) { <START> Assert.assertEquals(expected.get(i), rs.getInt(1)); <END> i += 1; } }</code><technical_language>executed myself, curious rs.getInt(1). int equal String in this (test) case</technical_language>

Target:
public void testLeft() throws Exception { ResultSet rs; methodWatcher.execute("create table ta(name VARCHAR(128), cut INT)"); methodWatcher.execute( "insert into ta(name, cut) " + "values ('hello world', 5), ('hey dude', 20), (null, 10), ('cute string', null)" ); String sql = "select left(name, cut) from ta"; rs = methodWatcher.executeQuery(sql); methodWatcher.execute("drop table ta"); List<String> expected = new ArrayList<>(2); expected.add("hello"); expected.add("hey dude"); expected.add(null); expected.add(null); for (String s: expected) { Assert.assertTrue(rs.next()); Assert.assertEquals(s, rs.getString(1)); } Assert.assertFalse(rs.next()); }
Source:
<code>protected boolean canDoAction() { boolean result = true; if (!canDoSnapshot(getVm())) { return false; } List<DiskImage> disksList = getDisksList(); if (disksList.size() > 0) { VmValidator vmValidator = new VmValidator(getVm()); SnapshotsValidator snapshotValidator = new SnapshotsValidator(); result = validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()) && validate(vmValidator.vmNotIlegal()) && ImagesHandler.PerformImagesChecks( getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, true, true, true, true, disksList) && validate(vmValidator.vmNotLocked()) <START> && validate(vmValidator.vmNotSavingRestoring()); <END> } return result; }</code><technical_language>please move this PerformImagesChecks() perform vdsm call. is this relevant disks? if disks? if relevant disks, please put if</technical_language>

Target:
protected boolean canDoAction() { boolean result = validateVM(); List<DiskImage> disksList = getDisksList(); if (result && disksList.size() > 0) { VmValidator vmValidator = new VmValidator(getVm()); SnapshotsValidator snapshotValidator = new SnapshotsValidator(); result = validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()) && validate(vmValidator.vmNotIlegal()) && ImagesHandler.PerformImagesChecks( getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, true, true, true, true, disksList) && validate(vmValidator.vmNotLocked()); } return result; }
Source:
<code>public void run() { try { this.connection = getConnection(); } catch (Exception e) { logger.finest(e); future.onFailure(e); connectionsInProgress.remove(target); return; } try { <START> authenticateAsync(); <END> } catch (Exception e) { future.onFailure(e); connection.close("Failed to authenticate connection", e); connectionsInProgress.remove(target); } }</code><technical_language>I prefer connection passed a parameter making field of class. is easier follow logic. is a class field needs aware of methods assigned/changed in of methods</technical_language>

Target:
public void run() { ClientConnection connection; try { connection = getConnection(); } catch (Exception e) { logger.finest(e); future.onFailure(e); connectionsInProgress.remove(target); return; } try { authenticateAsync(connection); } catch (Exception e) { future.onFailure(e); connection.close("Failed to authenticate connection", e); connectionsInProgress.remove(target); } }
Source:
<code>public CompletionStage<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { Map<String, List<Field>> fields = parameters.fields(); Map<String, Object> results = new LinkedHashMap<>(); for (String fieldName : fields.keySet()) { List<Field> fieldList = fields.get(fieldName); ExecutionPath fieldPath = parameters.path().segment(fieldName); ExecutionStrategyParameters newParameters = parameters.transform(builder -> builder.path(fieldPath)); try { ExecutionResult resolvedResult = resolveField(executionContext, newParameters, fieldList).toCompletableFuture().join(); results.put(fieldName, resolvedResult != null ? resolvedResult.getData() : null); } catch (NonNullableFieldWasNullException e) { assertNonNullFieldPrecondition(e); results = null; break; } } <START> return CompletableFuture.completedFuture(new ExecutionResultImpl(results, executionContext.getErrors())); <END> }</code><technical_language>Notice a materialised ExecutionResult wrap a completed Future asynch promise? I of here. allows thenApply style composition nots async down. I guess allows other strategies more asynch signature is in right shape. I type this, this is useful</technical_language>

Target:
public CompletionStage<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { Map<String, List<Field>> fields = parameters.fields(); final Map<String, CompletableFuture<ExecutionResult>> results = new LinkedHashMap<>(); List<CompletableFuture<ExecutionResult>> futures = new ArrayList<>(); for (String fieldName : fields.keySet()) { List<Field> fieldList = fields.get(fieldName); ExecutionPath fieldPath = parameters.path().segment(fieldName); ExecutionStrategyParameters newParameters = parameters.transform(builder -> builder.path(fieldPath)); try { CompletableFuture<ExecutionResult> future = resolveField(executionContext, newParameters, fieldList).toCompletableFuture(); futures.add(future); results.put(fieldName, future); } catch (NonNullableFieldWasNullException e) { assertNonNullFieldPrecondition(e); return CompletableFuture.completedFuture(null); } } return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])).thenApply((ignored) -> { Map<String, ExecutionResult> realResults = new LinkedHashMap<>(); for (String field : results.keySet()) { realResults.put(field, results.get(field).join()); } return new ExecutionResultImpl(realResults, executionContext.getErrors()); }); }
Source:
<code>protected void executeQueryCommand() { List<ManagedBlockStorage> allCinderDomainsList = cinderStorageDao.getAll(); List<ManagedBlockStorage> <START> resDomainsList = allCinderDomainsList.stream() .filter(cinderStorage -> isDriverOptionEquals(cinderStorage.getDriverOptions()) && isDriverSensitiveOptionEquals(cinderStorage.getDriverSensitiveOptions())) .collect(Collectors.toList()); <END> getQueryReturnValue().setReturnValue(resDomainsList); }</code><technical_language>This is inefficient, create a new query get domains options sensitive options</technical_language>

Target:
protected void executeQueryCommand() { List<ManagedBlockStorage> allCinderDomainsList = cinderStorageDao.getCinderStorageByDrivers(getParameters().getDriverOption()); List<ManagedBlockStorage> resDomainsList = allCinderDomainsList.stream() .filter(managedBlockStorage -> managedBlockStorage.getDriverSensitiveOptions() .equals(getParameters().getDriverSensitiveOption())) .collect(Collectors.toList()); getQueryReturnValue().setReturnValue(resDomainsList); }
Source:
<code>public Optional<AuthorData> build(DataView container) throws InvalidDataException { DataUtil.checkDataExists(container, Keys.BOOK_AUTHOR.getQuery()); final String json = DataUtil.getData(container, Keys.BOOK_AUTHOR, String.class); <START> final Text author = Texts.json().fromUnchecked(json); <END> return Optional.<AuthorData>of(new SpongeAuthorData(author)); }</code><technical_language>surround try catch throw InvalidDataException if Text throw exceptions</technical_language>

Target:
public Optional<AuthorData> build(DataView container) { if (container.contains(Keys.BOOK_AUTHOR.getQuery())) { final String json = DataUtil.getData(container, Keys.BOOK_AUTHOR, String.class); final Text author = Texts.json().fromUnchecked(json); return Optional.<AuthorData>of(new SpongeAuthorData(author)); } else { return Optional.empty(); } }
Source:
<code>public String[] transform(final InputRow inputRow) { StringBuilder builder = new StringBuilder(); int length = 0; for (final InputColumn<?> column : _columns) { final Object value = inputRow.getValue(column); if (value != null && !value.toString().isEmpty()) { final String stringValue = value.toString(); length += stringValue.length(); builder.append(stringValue); } } <START> return new String[] { hash(builder.toString().getBytes()), ""+length }; <END> }</code><technical_language>Integer.toString(length) String.valueOf(length) a more clear me</technical_language>

Target:
public String[] transform(final InputRow inputRow) { final StringBuilder builder = new StringBuilder(); int length = 0; for (final InputColumn<?> column : _columns) { final Object value = inputRow.getValue(column); if (value != null && !value.toString().isEmpty()) { final String stringValue = value.toString(); length += stringValue.length(); builder.append(stringValue); } } return new String[] { hash(builder.toString().getBytes()), String.valueOf(length) }; }
Source:
<code>void peekBatchWithSequenceNumberMessages() { final int numberOfEvents = 2; final int fromSequenceNumber = 10; when(managementNode.peekBatch(numberOfEvents, fromSequenceNumber)) .thenReturn(Flux.fromArray(new ServiceBusReceivedMessage[]{message1, message2})); <START> StepVerifier.create(consumer.peekBatch(numberOfEvents, fromSequenceNumber)) <END> .expectNextCount(numberOfEvents) .verifyComplete(); }</code><technical_language>Instead of asserting number of events, I try assert messages I expect back. (ie. message 1 message 2)</technical_language>

Target:
void peekBatchWithSequenceNumberMessages() { final int numberOfEvents = 2; final int fromSequenceNumber = 10; when(managementNode.peekBatch(numberOfEvents, fromSequenceNumber)) .thenReturn(Flux.fromArray(new ServiceBusReceivedMessage[]{receivedMessage, receivedMessage2})); StepVerifier.create(consumer.peekBatch(numberOfEvents, fromSequenceNumber)) .expectNext(receivedMessage, receivedMessage2) .verifyComplete(); }
Source:
<code>public boolean eval(Row row) { List<String> dimRowValList = row.getDimension(this.dimension); String extracted; if (dimRowValList == null || dimRowValList.isEmpty()) { return Strings.isNullOrEmpty(value); } for (String rowVal : dimRowValList) { if (this.getExtractionFn() != null) { <START> extracted = this.getExtractionFn().apply(rowVal); <END> } else { extracted = rowVal; } if (this.value != null && this.value.equals(extracted)) { return true; } if (extracted == null || extracted.isEmpty()) { return Strings.isNullOrEmpty(value); } } return false; }</code><technical_language>If I extraction function applied in dimension here, this extraction applied twice</technical_language>

Target:
public boolean eval(Row row) { List<String> dimRowValList = row.getDimension(dimension); if (dimRowValList == null || dimRowValList.isEmpty()) { return Strings.isNullOrEmpty(value); } for (String rowVal : dimRowValList) { String extracted = getExtractionFn().apply(rowVal); if (value != null && value.equals(extracted)) { return true; } if (extracted == null || extracted.isEmpty()) { return Strings.isNullOrEmpty(value); } } return false; }