auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private long getTransferSize(DiskImage image, Guid domainId) { if (getParameters().getTransferType() == TransferType.Download) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } <START> <END> if (getParameters().getTransferSize() != 0) { return getParameters().getTransferSize(); } else { boolean isOnBlock = getDiskImage().getStorageTypes().get(0).isBlockDomain(); return isOnBlock ? getDiskImage().getActualSizeInBytes() : getDiskImage().getSize(); } }</code><technical_language>please remove</technical_language>

Target:
private long getTransferSize(DiskImage image, Guid domainId) { if (getParameters().getTransferType() == TransferType.Download) { DiskImage imageInfoFromVdsm = imagesHandler.getVolumeInfoFromVdsm( image.getStoragePoolId(), domainId, image.getId(), image.getImageId()); return imageInfoFromVdsm.getApparentSizeInBytes(); } if (getParameters().getTransferSize() != 0) { return getParameters().getTransferSize(); } boolean isBlockDomain = getDiskImage().getStorageTypes().get(0).isBlockDomain(); return isBlockDomain ? getDiskImage().getActualSizeInBytes() : getDiskImage().getSize(); }
Source:
<code>@Override protected DataSource getDatasourceImpl( String dataSourceName ) throws Exception { <START> IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null ); <END> return datasourceService.getDataSource( dataSourceName ); }</code><technical_language>@jvelasques , Override is in previous line</technical_language>

Target:
protected DataSource getDatasourceImpl( String dataSourceName ) throws Exception { IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get( IDBDatasourceService.class, null ); return datasourceService.getDataSource( dataSourceName ); }
Source:
<code>public void testTCPtoHTTP() throws Exception { Axis2BackEndServerController axis2Server = getAxis2Server(); if (axis2Server == null) { fail("Failed to load the Axis2BackEndServerController"); } assertEquals(0, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder")); String addUrl = "tcp://localhost:6060/services/StockQuoteProxy"; StockQuoteSampleClient client = getStockQuoteClient(); client.placeOrder(addUrl, null, null, "IBM"); <START> Thread.sleep(2000); <END> assertEquals(1, axis2Server.getMessageCount("SimpleStockQuoteService", "placeOrder")); }</code><technical_language>sleep is needed ? a iterator</technical_language>

Target:
public void testTCPtoHTTP() throws Exception { String trpUrl = "tcp://localhost:6060/services/StockQuoteProxy"; StockQuoteSampleClient client = getStockQuoteClient(); SampleClientResult result = client.placeOrder(trpUrl, trpUrl, null, "IBM"); assertResponseReceived(result); }
Source:
<code>public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { mEmailLayout = view.findViewById(R.id.email_layout); mEmailEditText = view.findViewById(R.id.email); mEmailFieldValidator = new EmailFieldValidator(mEmailLayout); mEmailLayout.setOnClickListener(this); mEmailEditText.setOnClickListener(this); ImeHelper.setImeOnDoneListener(mEmailEditText, this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && getFlowParams().enableHints) { mEmailEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO); } view.findViewById(R.id.button_next).setOnClickListener(this); <START> TextView termsText = view.<TextView>findViewById(R.id.email_tos_and_pp_text); <END> TextView footerText = view.<TextView>findViewById(R.id.email_footer_tos_and_pp_text); FlowParameters flowParameters = getFlowParams(); if (flowParameters.isSingleProviderFlow()) { PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(getContext(), getFlowParams(), termsText); } else { PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), getFlowParams(), footerText); } }</code><technical_language>optional style nit: I this: java TextView termsText = (TextView) view.findViewById(R.id.email_tos_and_pp_text); this: java TextView termsText = view.<TextView>findViewById(R.id.email_tos_and_pp_text);</technical_language>

Target:
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { mEmailLayout = view.findViewById(R.id.email_layout); mEmailEditText = view.findViewById(R.id.email); mEmailFieldValidator = new EmailFieldValidator(mEmailLayout); mEmailLayout.setOnClickListener(this); mEmailEditText.setOnClickListener(this); ImeHelper.setImeOnDoneListener(mEmailEditText, this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && getFlowParams().enableHints) { mEmailEditText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO); } view.findViewById(R.id.button_next).setOnClickListener(this); TextView termsText = view.findViewById(R.id.email_tos_and_pp_text); TextView footerText = view.findViewById(R.id.email_footer_tos_and_pp_text); FlowParameters flowParameters = getFlowParams(); if (flowParameters.isSingleProviderFlow()) { PrivacyDisclosureUtils.setupTermsOfServiceAndPrivacyPolicyText(getContext(), flowParameters, termsText); } else { termsText.setVisibility(View.GONE); PrivacyDisclosureUtils.setupTermsOfServiceFooter(getContext(), flowParameters, footerText); } }
Source:
<code>public Map<Object, String> getConstantToAllLabels() { Map<Object, String> named = getConstantToNamedLabel(); Map<Object, Integer> numbered = getConstantToNumberedLabel(); Map<Object, String> combined = new HashMap<Object, String>(named); for (Map.Entry<Object, Integer> entry : numbered.entrySet()) { <START> combined.put(entry.getValue(), entry.getValue().toString()); <END> } return Collections.unmodifiableMap(combined); }</code><technical_language>be: combined.put(entry.getKey(), entry.getValue().toString()); current code I get: Parameter [1] match expected type [java.lang.String (n/a)] fix works fine. I tested Hibernate 5.3.6 querydsl 4.2.1 this pull request applied</technical_language>

Target:
public Map<Object, String> getConstantToAllLabels() { Map<Object, String> namedLabels = getConstantToNamedLabel(); Map<Object, Integer> numberedLabels = getConstantToNumberedLabel(); Map<Object, String> allLabels = new HashMap<Object, String>(namedLabels); for (Map.Entry<Object, Integer> entry : numberedLabels.entrySet()) { allLabels.put(entry.getKey(), entry.getValue().toString()); } return unmodifiableMap(allLabels); }
Source:
<code>public void fail_if_version_name_is_longer_then_100_characters() throws Exception { SnapshotDto snapshotDto = new SnapshotDto(); snapshotDto.setVersion(null); snapshotDto.setVersion("1.0"); <START> snapshotDto.setVersion(IntStream.range(0, 100).mapToObj(i -> "a").collect(Collectors.joining())); <END> expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" is not a valid version name." + " The maximum length of version numbers is 100 characters."); snapshotDto.setVersion(IntStream.range(0, 101).mapToObj(i -> "a").collect(Collectors.joining())); }</code><technical_language>Apache provides utility methods, StringUtils.repeat( ). I overkill stream build a string</technical_language>

Target:
public void fail_if_version_name_is_longer_then_100_characters() throws Exception { SnapshotDto snapshotDto = new SnapshotDto(); snapshotDto.setVersion(null); snapshotDto.setVersion("1.0"); snapshotDto.setVersion(repeat("a", 100)); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Event name length (101) is longer than the maximum authorized (100). " + "'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' was provided."); snapshotDto.setVersion(repeat("a", 101)); }
Source:
<code>private void handle(SmartpayNotification notification) { if (shouldIgnore(notification)) { logger.info("{} notification ignored", PAYMENT_GATEWAY_NAME, notification); return; } logger.info("Verifying notification {}", PAYMENT_GATEWAY_NAME, notification); if (isBlank(notification.getTransactionId())) { logger.error("{} notification failed verification because it has no transaction ID", PAYMENT_GATEWAY_NAME, notification); return; } logger.info("Evaluating notification {}", PAYMENT_GATEWAY_NAME, notification); Optional<ChargeEntity> maybeCharge = chargeDao.findByProviderAndTransactionId(PAYMENT_GATEWAY_NAME, notification.getOriginalReference()); if (!maybeCharge.isPresent()) { <START> logger.info("{} notification could not be evaluated (associated charge entity not found)", <END> PAYMENT_GATEWAY_NAME, notification); return; } ChargeEntity charge = maybeCharge.get(); InterpretedStatus interpretedStatus = interpretStatus(notification, charge); if (interpretedStatus instanceof MappedChargeStatus) { chargeNotificationProcessor.invoke( notification.getPspReference(), charge, interpretedStatus.getChargeStatus(), notification.getEventDate() ); } else if (interpretedStatus instanceof MappedRefundStatus) { refundNotificationProcessor.invoke( SMARTPAY, interpretedStatus.getRefundStatus(), notification.getPspReference(), notification.getOriginalReference() ); } else { logger.error("{} notification unknown", PAYMENT_GATEWAY_NAME, notification); } }</code><technical_language>worth changing this log log transaction id find, this be? odd get notifications for charges exist, interesting gateway account from, set notifications incorrectly..</technical_language>

Target:
private void handle(SmartpayNotification notification) { if (shouldIgnore(notification)) { logger.info("{} notification ignored", PAYMENT_GATEWAY_NAME, notification); return; } logger.info("Verifying notification {}", PAYMENT_GATEWAY_NAME, notification); if (isBlank(notification.getTransactionId())) { logger.error("{} notification failed verification because it has no transaction ID", PAYMENT_GATEWAY_NAME, notification); return; } logger.info("Evaluating notification {}", PAYMENT_GATEWAY_NAME, notification); Optional<ChargeEntity> maybeCharge = chargeDao.findByProviderAndTransactionId(PAYMENT_GATEWAY_NAME, notification.getOriginalReference()); if (!maybeCharge.isPresent()) { logger.error("{} notification could not be evaluated (associated charge entity not found)", PAYMENT_GATEWAY_NAME, notification); return; } ChargeEntity charge = maybeCharge.get(); InterpretedStatus interpretedStatus = interpretStatus(notification, charge); if (interpretedStatus instanceof MappedChargeStatus) { chargeNotificationProcessor.invoke( notification.getPspReference(), charge, interpretedStatus.getChargeStatus(), notification.getEventDate() ); } else if (interpretedStatus instanceof MappedRefundStatus) { refundNotificationProcessor.invoke( SMARTPAY, interpretedStatus.getRefundStatus(), notification.getPspReference(), notification.getOriginalReference() ); } else { logger.error("{} notification unknown", PAYMENT_GATEWAY_NAME, notification); } }
Source:
<code>private void loadMaps() throws CachePersistenceException { try { for (File file : dataDirectory.listFiles((dir, name) -> name.endsWith(HOLDER_FILE_SUFFIX))) { <START> try (FileInputStream fis = new FileInputStream(file)) { <END> try (ObjectInputStream oin = new ObjectInputStream(fis)) { String name = (String) oin.readObject(); Tuple tuple = (Tuple) oin.readObject(); if (nextIndex.get() <= tuple.index) { nextIndex.set(tuple.index + 1); } knownHolders.put(name, tuple); } } } } catch (Exception e) { knownHolders.clear(); throw new CachePersistenceException("Failed to load existing StateRepository data", e); } }</code><technical_language>Collapse</technical_language>

Target:
private void loadMaps() throws CachePersistenceException { try { for (File file : dataDirectory.listFiles((dir, name) -> name.endsWith(HOLDER_FILE_SUFFIX))) { try (FileInputStream fis = new FileInputStream(file); ObjectInputStream oin = new ObjectInputStream(fis)) { String name = (String) oin.readObject(); Tuple tuple = (Tuple) oin.readObject(); if (nextIndex.get() <= tuple.index) { nextIndex.set(tuple.index + 1); } knownHolders.put(name, tuple); } } } catch (Exception e) { knownHolders.clear(); throw new CachePersistenceException("Failed to load existing StateRepository data", e); } }
Source:
<code>private void waitForService(Configuration sourceConfig) throws NotCompliantMBeanException { await("Waiting for service: " + sourceConfig.getPid()) .atMost(MANAGED_SERVICE_TIMEOUT, TimeUnit.MILLISECONDS) .pollDelay(CONFIG_UPDATE_WAIT_INTERVAL_MILLIS, TimeUnit.MILLISECONDS) .until( () -> <START> adminConfig <END> .getAdminConsoleService() .listServices() .stream() .map(Service::getId) .anyMatch( id -> id.equals(sourceConfig.getPid()) || id.equals(sourceConfig.getFactoryPid()))); }</code><technical_language>Time define this lambda block in a private method more readable</technical_language>

Target:
private void waitForService(Configuration sourceConfig) throws NotCompliantMBeanException { await("Waiting for service: " + sourceConfig.getPid()) .atMost(MANAGED_SERVICE_TIMEOUT, TimeUnit.MILLISECONDS) .pollDelay(CONFIG_UPDATE_WAIT_INTERVAL_MILLIS, TimeUnit.MILLISECONDS) .until(() -> isServiceReady(sourceConfig)); }
Source:
<code>public void managePrestartedVmsInAllVmPools() { getVmPoolDao().getAll() .stream() .filter(pool -> pool.getPrestartedVms() > 0) <START> .forEach(this::managePrestartedVmsInPool); <END> }</code><technical_language>is ok formatter</technical_language>

Target:
public void managePrestartedVmsInAllVmPools() { vmPoolDao.getAll() .stream() .filter(pool -> pool.getPrestartedVms() > 0) .forEach(this::managePrestartedVmsInPool); }
Source:
<code>public void start() { synchronized (stateChangeLock) { Preconditions.checkState(!started, "already started"); Preconditions.checkState(!exec.isShutdown(), "already stopped"); try { consumer = getKafkaConsumer(); exec.submit( new Runnable() { @Override public void run() { try { while (!Thread.currentThread().isInterrupted()) { final Notice notice = notices.take(); try { notice.handle(); } catch (Exception e) { log.makeAlert(e, "KafkaSupervisor[%s] failed to handle notice", dataSource) .addData("noticeClass", notice.getClass().getSimpleName()) .emit(); } } } catch (InterruptedException e) { log.info("KafkaSupervisor[%s] interrupted, exiting", dataSource); } } } ); } catch (Exception e) { log.makeAlert(e, "Exception starting KafkaSupervisor[%s]", dataSource) .emit(); throw Throwables.propagate(e); } firstRunTime = DateTime.now().plus(ioConfig.getStartDelay()); scheduledExec.scheduleAtFixedRate( buildRunTask(), ioConfig.getStartDelay().getMillis(), Math.max(ioConfig.getPeriod().getMillis(), MAX_RUN_FREQUENCY_MILLIS), TimeUnit.MILLISECONDS ); started = true; <START> log.info(spec.toString()); <END> log.info("Started KafkaSupervisor[%s], first run in [%s]", dataSource, ioConfig.getStartDelay()); } }</code><technical_language>log.info("%s", spec.toString()) is a safer in case spec string some %'s in it. combine this next line though, this log line is a bit anemic context-free</technical_language>

Target:
public void start() { synchronized (stateChangeLock) { Preconditions.checkState(!started, "already started"); Preconditions.checkState(!exec.isShutdown(), "already stopped"); try { consumer = getKafkaConsumer(); exec.submit( new Runnable() { @Override public void run() { try { while (!Thread.currentThread().isInterrupted()) { final Notice notice = notices.take(); try { notice.handle(); } catch (Exception e) { log.makeAlert(e, "KafkaSupervisor[%s] failed to handle notice", dataSource) .addData("noticeClass", notice.getClass().getSimpleName()) .emit(); } } } catch (InterruptedException e) { log.info("KafkaSupervisor[%s] interrupted, exiting", dataSource); } } } ); } catch (Exception e) { log.makeAlert(e, "Exception starting KafkaSupervisor[%s]", dataSource) .emit(); throw Throwables.propagate(e); } firstRunTime = DateTime.now().plus(ioConfig.getStartDelay()); scheduledExec.scheduleAtFixedRate( buildRunTask(), ioConfig.getStartDelay().getMillis(), Math.max(ioConfig.getPeriod().getMillis(), MAX_RUN_FREQUENCY_MILLIS), TimeUnit.MILLISECONDS ); started = true; log.info( "Started KafkaSupervisor[%s], first run in [%s], with spec: [%s]", dataSource, ioConfig.getStartDelay(), spec.toString() ); } }
Source:
<code>private IBrandingAdvice getBrandingAdvice() { Collection<IBrandingAdvice> <START> advice = <END> info.getAdvice(configSpec, true, null, null, IBrandingAdvice.class); for (IBrandingAdvice iBrandingAdvice : advice) return iBrandingAdvice; return null; }</code><technical_language>rename advices loop var advice</technical_language>

Target:
private IBrandingAdvice getBrandingAdvice() { Collection<IBrandingAdvice> advices = info.getAdvice(configSpec, true, null, null, IBrandingAdvice.class); for (IBrandingAdvice advice : advices) return advice; return null; }
Source:
<code>Iterable<ClusterNetworkModel> getNetworksTableItems() { <START> ListModel<ClusterNetworkModel> tableModel = networks.asEditor().flush(); <END> return tableModel != null ? tableModel.getItems() : new ArrayList<ClusterNetworkModel>(); }</code><technical_language>replace ListModel<ClusterNetworkModel> ClusterNetworkManageModel</technical_language>

Target:
Iterable<ClusterNetworkModel> getNetworksTableItems() { ClusterNetworkManageModel tableModel = networks.asEditor().flush(); return tableModel != null ? tableModel.getItems() : new ArrayList<ClusterNetworkModel>(); }
Source:
<code>private SelectQuery incrementQueryPagination(SelectQuery query, SelectResultValue prevResult) { Map<String, Integer> pagingIdentifiers = prevResult.getPagingIdentifiers(); Map<String, Integer> newPagingIdentifers = new HashMap<>(); for (Map.Entry<String, Integer> entry : pagingIdentifiers.entrySet()) { String segmentId = entry.getKey(); <START> int newOffset = pagingIdentifiers.get(segmentId) + 1; <END> newPagingIdentifers.put(segmentId, newOffset); } return query.withPagingSpec(new PagingSpec(newPagingIdentifers, pagingThreshold)); }</code><technical_language>entry.getValue() + 1</technical_language>

Target:
private SelectQuery incrementQueryPagination(SelectQuery query, SelectResultValue prevResult) { Map<String, Integer> pagingIdentifiers = prevResult.getPagingIdentifiers(); Map<String, Integer> newPagingIdentifers = new HashMap<>(); for (Map.Entry<String, Integer> entry : pagingIdentifiers.entrySet()) { int newOffset = entry.getValue() + 1; pagingIdentifiers.replaceAll((id, offset) -> offset + 1); } return query.withPagingSpec(new PagingSpec(newPagingIdentifers, pagingThreshold)); }
Source:
<code>private void printStream(InputStream inputStream, String messageType, Level logLevel) { try { BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); for (String line = br.readLine(); line != null; line = br.readLine()) { <START> if (Level.DEBUG == logLevel) { <END> logger.debug("token: " + this.token + " " + messageType + ":" + line); } if (Level.WARN == logLevel) { logger.warn("token: " + this.token + " " + messageType + ":" + line); } } } catch (IOException ioe) { } }</code><technical_language>do this in a single line logger.log(logLevel, "token: " + this.token + " " + messageType + ":" + line)</technical_language>

Target:
private void printStream(InputStream inputStream, String messageType, Level logLevel) { try { BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); for (String line = br.readLine(); line != null; line = br.readLine()) { logger.log(logLevel, "token: " + this.token + " " + messageType + ":" + line); } } catch (IOException ioe) { } }
Source:
<code>public BoxPage clickSave() { saveButton.click(); <START> waitWithTimeout().until(titleContains("Box ")); <END> return new BoxPage(getDriver()); }</code><technical_language>Change wait for page refresh</technical_language>

Target:
public BoxPage clickSave() { WebElement html = getHtmlElement(); saveButton.click(); waitForPageRefresh(html); return new BoxPage(getDriver()); }
Source:
<code>public void processStreamControl(String exportSource, List<String> exportTargets, OperationMode operation, VoltTable results) { exportLog.info("Export " + operation + " source:" + exportSource + " targets:" + exportTargets); synchronized (m_dataSourcesByPartition) { for (Map.Entry<Integer, Map<String, ExportDataSource>> partitionDataSourceMap : m_dataSourcesByPartition.entrySet()) { Integer partition = partitionDataSourceMap.getKey(); for (ExportDataSource source : partitionDataSourceMap.getValue().values()) { <START> if (!StringUtil.isEmpty(exportSource) && !source.getTableName().equalsIgnoreCase(exportSource)) { <END> continue; } if (!exportTargets.isEmpty() && !exportTargets.contains(source.getTarget())) { continue; } if (source.processStreamControl(operation)) { results.addRow(source.getTableName(), source.getTarget(), partition, "SUCCESS", ""); } } } } }</code><technical_language>parameter 'exportSource' empty, if empty partition map</technical_language>

Target:
public void processStreamControl(String exportSource, List<String> exportTargets, OperationMode operation, VoltTable results) { exportLog.info("Export " + operation + " source:" + exportSource + " targets:" + exportTargets); synchronized (m_dataSourcesByPartition) { for (Map.Entry<Integer, Map<String, ExportDataSource>> partitionDataSourceMap : m_dataSourcesByPartition.entrySet()) { Integer partition = partitionDataSourceMap.getKey(); for (ExportDataSource source : partitionDataSourceMap.getValue().values()) { if (!source.getTableName().equalsIgnoreCase(exportSource)) { continue; } if (!exportTargets.contains(source.getTarget())) { continue; } if (source.processStreamControl(operation)) { results.addRow(source.getTableName(), source.getTarget(), partition, "SUCCESS", ""); } } } } }
Source:
<code>int getReservedMemoryMb(VirtualMachineTO vmSpec) { if (vmSpec.getDetails().get(VMwareGuru.VmwareReserveMemory.key()).equalsIgnoreCase("true")) { <START> return (int)(vmSpec.getMinRam() / (1024 * 1024)); <END> } return 0; }</code><technical_language>magic nubers</technical_language>

Target:
int getReservedMemoryMb(VirtualMachineTO vmSpec) { if (vmSpec.getDetails().get(VMwareGuru.VmwareReserveMemory.key()).equalsIgnoreCase("true")) { return (int)(vmSpec.getMinRam() / ResourceType.bytesToMiB); } return 0; }
Source:
<code>public static void deleteAll(final SQLiteDatabase db) { <START> db.execSQL("DELETE FROM " + TABLE_NAME); <END> }</code><technical_language>suggest truncate provided another truncate method. other datatypes</technical_language>

Target:
public static void deleteAll(final SQLiteDatabase db) { DatabaseUtils.truncate(db, TABLE_NAME); }
Source:
<code>private void logTimeTakenByPhase(GraphContext graphContext, RulePhase phase, int timeTaken) { if (!timeTakenByPhase.containsKey(phase)) { RulePhaseExecutionStatisticsModel model = graphContext.getService(RulePhaseExecutionStatisticsModel.class) .create(); <START> model.setRulePhase(phase == null ? "Implicit" : phase.toString()); <END> model.setTimeTaken(timeTaken); timeTakenByPhase.put(phase, model); } else { RulePhaseExecutionStatisticsModel model = timeTakenByPhase.get(phase); int prevTimeTaken = model.getTimeTaken(); model.setTimeTaken(prevTimeTaken + timeTaken); } }</code><technical_language>"Implicit" a constant somewhere</technical_language>

Target:
private void logTimeTakenByPhase(GraphContext graphContext, RulePhase phase, int timeTaken) { if (!timeTakenByPhase.containsKey(phase)) { RulePhaseExecutionStatisticsModel model = graphContext.getService(RulePhaseExecutionStatisticsModel.class) .create(); model.setRulePhase(phase.toString()); model.setTimeTaken(timeTaken); timeTakenByPhase.put(phase, model); } else { RulePhaseExecutionStatisticsModel model = timeTakenByPhase.get(phase); int prevTimeTaken = model.getTimeTaken(); model.setTimeTaken(prevTimeTaken + timeTaken); } }
Source:
<code>public RowMap deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { JsonNode node = jsonParser.getCodec().readTree(jsonParser); JsonNode type = node.get("type"); JsonNode database = node.get("database"); JsonNode table = node.get("table"); JsonNode ts = node.get("ts"); JsonNode xid = node.get("xid"); JsonNode data = node.get("data"); JsonNode oldData = node.get("old"); RowMap rowMap = new RowMap( type == null ? null : type.asText(), database == null ? null : database.asText(), table == null ? null : table.asText(), <START> ts == null ? null : ts.asLong(), <END> new ArrayList<String>(), null ); if (xid != null) { rowMap.setXid(xid.asLong()); } if (data instanceof ObjectNode) { Iterator keys = data.fieldNames(); if (keys != null) { while (keys.hasNext()) { String key = (String) keys.next(); JsonNode value = data.get(key); if (value.isValueNode()) { ValueNode valueNode = (ValueNode) value; rowMap.putData(key, getValue(valueNode)); } } } } if (oldData instanceof ObjectNode) { Iterator keys = oldData.fieldNames(); if (keys != null) { while (keys.hasNext()) { String key = (String) keys.next(); JsonNode value = oldData.get(key); if (value.isValueNode()) { ValueNode valueNode = (ValueNode) value; rowMap.putOldData(key, getValue(valueNode)); } } } } return rowMap; }</code><technical_language>4 fields in JSON. passing null unexpected happen road, throw some kind of parse-exception if exist</technical_language>

Target:
public RowMap deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { JsonNode node = jsonParser.getCodec().readTree(jsonParser); JsonNode type = node.get("type"); if (type == null) { throw new ParseException("`type` is required and cannot be null."); } JsonNode database = node.get("database"); if (database == null) { throw new ParseException("`database` is required and cannot be null."); } JsonNode table = node.get("table"); if (table == null) { throw new ParseException("`table` is required and cannot be null."); } JsonNode ts = node.get("ts"); if (ts == null) { throw new ParseException("`ts` is required and cannot be null."); } JsonNode xid = node.get("xid"); JsonNode data = node.get("data"); JsonNode oldData = node.get("old"); RowMap rowMap = new RowMap( type.asText(), database.asText(), table.asText(), ts.asLong(), new ArrayList<String>(), null ); if (xid != null) { rowMap.setXid(xid.asLong()); } if (data instanceof ObjectNode) { Iterator keys = data.fieldNames(); if (keys != null) { while (keys.hasNext()) { String key = (String) keys.next(); JsonNode value = data.get(key); if (value.isValueNode()) { ValueNode valueNode = (ValueNode) value; rowMap.putData(key, getValue(valueNode)); } } } } else { throw new ParseException("`data` is required and cannot be null."); } if (oldData instanceof ObjectNode) { Iterator keys = oldData.fieldNames(); if (keys != null) { while (keys.hasNext()) { String key = (String) keys.next(); JsonNode value = oldData.get(key); if (value.isValueNode()) { ValueNode valueNode = (ValueNode) value; rowMap.putOldData(key, getValue(valueNode)); } } } } return rowMap; }
Source:
<code>long getWord(int index) { if (index == 0) { return elements; } else { <START> return 0L; <END> } }</code><technical_language>this branch exactly, weird for :/ throw exception instead</technical_language>

Target:
long getWord(int index) { if (index == 0) { return elements; } else { throw new IndexOutOfBoundsException(); } }
Source:
<code>public void many_sessions_logout() throws Exception { final String WILL_NOT_BE_SENT = "/will-not-be-sent"; final String LOCALHOST = "localhost"; final String JSESSIONID = "JSESSIONID"; JenkinsRule.WebClient wc = j.createWebClient(); CookieManager manager = wc.getCookieManager(); manager.setCookiesEnabled(true); wc.goTo("login"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date tomorrow = calendar.getTime(); <START> byte[] array = new byte[7]; <END> Collections.nCopies(8, 1) .stream() .forEach(i -> addSessionCookie(manager, LOCALHOST, "/jenkins", tomorrow)); addSessionCookie(manager, LOCALHOST, WILL_NOT_BE_SENT, tomorrow); HtmlPage page = wc.goTo("logout"); int unexpectedSessionCookies = 2; StringBuilder builder = new StringBuilder(); builder.append("Session cookies: "); for (Cookie cookie : manager.getCookies()) { if (cookie.getName().startsWith(JSESSIONID)) { String path = cookie.getPath(); builder.append(cookie.getName()); if (path != null) builder.append("; Path=").append(path); builder.append("\n"); if (WILL_NOT_BE_SENT.equals(path)) { --unexpectedSessionCookies; } else if (JSESSIONID.equals(cookie.getName())) { --unexpectedSessionCookies; } } } System.err.println(builder.toString()); assertThat(unexpectedSessionCookies, is(0)); }</code><technical_language>unused variable suggestion ( time I suggestion feature remove a line)</technical_language>

Target:
public void many_sessions_logout() throws Exception { final String WILL_NOT_BE_SENT = "/will-not-be-sent"; final String LOCALHOST = "localhost"; final String JSESSIONID = "JSESSIONID"; JenkinsRule.WebClient wc = j.createWebClient(); CookieManager manager = wc.getCookieManager(); manager.setCookiesEnabled(true); wc.goTo("login"); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date tomorrow = calendar.getTime(); Collections.nCopies(8, 1) .stream() .forEach(i -> addSessionCookie(manager, LOCALHOST, "/jenkins", tomorrow)); addSessionCookie(manager, LOCALHOST, WILL_NOT_BE_SENT, tomorrow); HtmlPage page = wc.goTo("logout"); int unexpectedSessionCookies = 2; StringBuilder builder = new StringBuilder(); builder.append("Session cookies: "); for (Cookie cookie : manager.getCookies()) { if (cookie.getName().startsWith(JSESSIONID)) { String path = cookie.getPath(); builder.append(cookie.getName()); if (path != null) builder.append("; Path=").append(path); builder.append("\n"); if (WILL_NOT_BE_SENT.equals(path)) { --unexpectedSessionCookies; } else if (JSESSIONID.equals(cookie.getName())) { --unexpectedSessionCookies; } } } System.err.println(builder.toString()); assertThat(unexpectedSessionCookies, is(0)); }
Source:
<code>public AbstractExecutionEnvironment(Config config) { if (config == null) { <START> throw new NullPointerException(); <END> } this.config = config; }</code><technical_language>a SamzaException a message, NPE</technical_language>

Target:
public AbstractExecutionEnvironment(Config config) { if (config == null) { throw new NullPointerException("Parameter 'config' cannot be null."); } this.config = config; }
Source:
<code>public void visitNode(Tree tree) { List<? extends Tree> trees = Collections.emptyList(); switch (tree.kind()) { case INITIALIZER: case STATIC_INITIALIZER: trees = ((BlockTree) tree).body(); break; case VARIABLE: VariableTree variableTree = (VariableTree) tree; <START> trees = visitVariable(variableTree); <END> break; case LAMBDA_EXPRESSION: LambdaExpressionTree lambda = (LambdaExpressionTree) tree; trees = visitLambda(lambda); break; case METHOD: case CONSTRUCTOR: trees = visitMethod((MethodTree) tree); break; case FOR_STATEMENT: case FOR_EACH_STATEMENT: case WHILE_STATEMENT: case DO_STATEMENT: executableLines.add(tree.lastToken().line()); break; default: } computeExecutableLines(trees); }</code><technical_language>Inline variable variableTree</technical_language>

Target:
public void visitNode(Tree tree) { List<? extends Tree> trees = Collections.emptyList(); switch (tree.kind()) { case INITIALIZER: case STATIC_INITIALIZER: trees = ((BlockTree) tree).body(); break; case VARIABLE: trees = visitVariable((VariableTree) tree); break; case LAMBDA_EXPRESSION: trees = visitLambda((LambdaExpressionTree) tree); break; case METHOD: case CONSTRUCTOR: trees = visitMethod((MethodTree) tree); break; case FOR_STATEMENT: case FOR_EACH_STATEMENT: case WHILE_STATEMENT: case DO_STATEMENT: executableLines.add(tree.lastToken().line()); break; default: } computeExecutableLines(trees); }
Source:
<code>public static PipelineTriggerService.MaterialForScheduling fromJSON(JsonReader jsonReader) { <START> if (jsonReader == null) { <END> return null; } String name = jsonReader.getString("fingerprint"); String value = jsonReader.getString("revision"); return new PipelineTriggerService.MaterialForScheduling(name, value); }</code><technical_language>is passing a null reader :)</technical_language>

Target:
public static MaterialForScheduling fromJSON(JsonReader jsonReader) { String name = jsonReader.getString("fingerprint"); String value = jsonReader.getString("revision"); return new MaterialForScheduling(name, value); }
Source:
<code>public String resolveDeploymentContextBasedVipAddresses(String vipAddressMacro) { String result = vipAddressMacro; <START> if (vipAddressMacro == null) { <END> return null; } Matcher matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); while (matcher.find()) { String key = matcher.group(1); String value = DynamicPropertyFactory.getInstance().getStringProperty(key, "").get(); logger.debug("att:" + matcher.group()); logger.debug(", att key:" + key); logger.debug(", att value:" + value); logger.debug(""); result = result.replaceAll("\\$\\{" + key + "\\}", value); matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); } return result; }</code><technical_language>This called result is assigned</technical_language>

Target:
public String resolveDeploymentContextBasedVipAddresses(String vipAddressMacro) { if (vipAddressMacro == null) { return null; } String result = vipAddressMacro; Matcher matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); while (matcher.find()) { String key = matcher.group(1); String value = DynamicPropertyFactory.getInstance().getStringProperty(key, "").get(); logger.debug("att:" + matcher.group()); logger.debug(", att key:" + key); logger.debug(", att value:" + value); logger.debug(""); result = result.replaceAll("\\$\\{" + key + "\\}", value); matcher = VIP_ATTRIBUTES_PATTERN.matcher(result); } return result; }
Source:
<code>private AddIfSystemPropertyDialog invokeDefaultAddIfSystemPropertyDialog(String property){ new ContextMenu().getItem("Add System Property").select(); <START> new WaitUntil(new ShellIsAvailable("Add If System Property")); <END> new DefaultShell("Add If System Property"); return new AddIfSystemPropertyDialog(); }</code><technical_language>need for wait</technical_language>

Target:
private AddIfSystemPropertyDialog invokeDefaultAddIfSystemPropertyDialog(String property){ new ContextMenu().getItem("Add System Property").select(); new DefaultShell("Add If System Property"); return new AddIfSystemPropertyDialog(); }
Source:
<code>private boolean validate() { List<Text> percentTexts = Arrays.asList(allocatedInstances, actionGeneration, sendAction); if (container == null) return false; Optional<String> errorMsg = Arrays.stream(container.getChildren()).filter(Text.class::isInstance) <START> .map(ctrl -> (Text) ctrl).map(text -> { <END> if (percentTexts.contains(text)) return containsPercent(text) ? null : "Enter percentage"; else return containsNonNegativeNumber(text) ? null : "Enter a non-negative integer"; }).filter(msg -> msg != null).findFirst(); setErrorMessage(errorMsg.orElse(null)); return !errorMsg.isPresent(); }</code><technical_language>Do need map operations? readability</technical_language>

Target:
private boolean validate() { List<Text> percentTexts = Arrays.asList(allocatedInstances, actionGeneration, sendAction); if (container == null) return false; Optional<String> errorMsg = Arrays.stream(container.getChildren()).filter(Text.class::isInstance).map(ctrl -> { Text text = (Text) ctrl; if (percentTexts.contains(text)) return containsPercent(text) ? null : "Enter percentage"; else return containsNonNegativeNumber(text) ? null : "Enter a non-negative integer"; }).filter(msg -> msg != null).findFirst(); setErrorMessage(errorMsg.orElse(null)); return !errorMsg.isPresent(); }
Source:
<code>public Request(StreamInput in) throws IOException { super(in); if (in.getVersion().onOrAfter(Version.V_7_8_0)) { this.requestsPerSecond = in.readOptionalFloat(); this.timeout = in.readOptionalTimeValue(); } else { this.requestsPerSecond = null; this.timeout = null; } <START> if (in.getVersion().onOrAfter(Version.CURRENT)) { END> jobId = in.readString(); } }</code><technical_language>suggestion if (in.getVersion().onOrAfter(Version.V_8_0_0)) { // TODO BWC for V_7_9_0</technical_language>

Target:
public Request(StreamInput in) throws IOException { super(in); if (in.getVersion().onOrAfter(Version.V_7_8_0)) { this.requestsPerSecond = in.readOptionalFloat(); this.timeout = in.readOptionalTimeValue(); } else { this.requestsPerSecond = null; this.timeout = null; } if (in.getVersion().onOrAfter(Version.V_8_0_0)) { jobId = in.readString(); } }
Source:
<code>public void testVerticalScrollbar() { SWTBotView viewBot = openView(); List<? extends @NonNull Slider> scrollers = viewBot.bot().widgets(WidgetOfType.widgetOfType(Slider.class)); assertTrue("The view has " + scrollers.size() + " sliders", scrollers.size() >= 2); SWTBotScroller <START> vScroller = <END> new SWTBotScroller(scrollers.get(VERTICAL_SCROLLBAR_INDEX)); Rectangle scrollerRect = vScroller.getBounds(); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class))); Rectangle timegraphRect = tgBot.getBounds(); assertEquals("Incorrect vertical scroller start position", timegraphRect.width, scrollerRect.x); assertEquals("Incorrect vertical scroller height", timegraphRect.height, scrollerRect.height); }</code><technical_language>If end SWTBotSlider, rename vSlider</technical_language>

Target:
public void testVerticalScrollbar() { SWTBotView viewBot = openView(); List<? extends @NonNull Slider> sliders = viewBot.bot().widgets(WidgetOfType.widgetOfType(Slider.class)); assertTrue("The view has " + sliders.size() + " sliders", sliders.size() >= 2); SWTBotScroller vSlider = new SWTBotScroller(sliders.get(VERTICAL_SCROLLBAR_INDEX)); Rectangle scrollerRect = vSlider.getBounds(); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class))); Rectangle timegraphRect = tgBot.getBounds(); assertEquals("Incorrect vertical scroller start position", timegraphRect.width, scrollerRect.x); assertEquals("Incorrect vertical scroller height", timegraphRect.height, scrollerRect.height); }
Source:
<code>public void configurePipeline(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); config.validate(collector); FileFormat fileFormat = getFileFormat(); Schema schema = null; <START> if (fileFormat != null) { <END> ValidatingInputFormatProvider inputFormatProvider = pipelineConfigurer.usePlugin("inputformat", fileFormat.name().toLowerCase(), FORMAT_PLUGIN_ID, config.getProperties()); FormatContext context = new FormatContext(collector, null); validateInputFormatProvider(context, fileFormat, inputFormatProvider); if (inputFormatProvider != null) { schema = inputFormatProvider.getSchema(context); } } validatePathField(collector, schema); pipelineConfigurer.getStageConfigurer().setOutputSchema(schema); }</code><technical_language>this either, format is required</technical_language>

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { FailureCollector collector = pipelineConfigurer.getStageConfigurer().getFailureCollector(); config.validate(collector); FileFormat fileFormat = config.getFormat(); Schema schema = null; ValidatingInputFormat validatingInputFormat = pipelineConfigurer.usePlugin(ValidatingInputFormat.PLUGIN_TYPE, fileFormat.name().toLowerCase(), FORMAT_PLUGIN_ID, config.getProperties()); FormatContext context = new FormatContext(collector, null); validateInputFormatProvider(context, fileFormat, validatingInputFormat); if (validatingInputFormat != null) { schema = validatingInputFormat.getSchema(context); } validatePathField(collector, schema); pipelineConfigurer.getStageConfigurer().setOutputSchema(schema); }
Source:
<code><START> public PageCachedNumberArrayFactory( PageCache pageCache, File storeDir ) <END> { this.pageCache = pageCache; this.storeDir = storeDir; }</code><technical_language>this package private</technical_language>

Target:
PageCachedNumberArrayFactory( PageCache pageCache, File storeDir ) { this.pageCache = pageCache; this.storeDir = storeDir; }
Source:
<code>public void setEventList(List<ITimeEvent> eventList) { <START> fEventList = eventList; <END> }</code><technical_language>Preemptive Sonar warning storing a List directly</technical_language>

Target:
public void setEventList(List<ITimeEvent> eventList) { fEventList = new EventList(eventList, Long.MAX_VALUE, Long.MIN_VALUE); }
Source:
<code>private void generalSendMessage(String jsonMessage) { CloseableHttpClient client = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(this.hookURL); StringEntity entity = null; try { entity = new StringEntity(jsonMessage); } catch (UnsupportedEncodingException e) { LOG.error("Cannot encode json"); } httpPost.setEntity(entity); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); try { <START> CloseableHttpResponse response = client.execute(httpPost); <END> client.close(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { LOG.warn("Did not successfully send notification"); } } catch (IOException e) { LOG.error("Cannot send jsonMessage"); } }</code><technical_language>I this closes client if is exception. (Can try a try resources)</technical_language>

Target:
private void generalSendMessage(String jsonMessage) { HttpPost httpPost = new HttpPost(this.hookURL); StringEntity entity = null; try { entity = new StringEntity(jsonMessage); } catch (UnsupportedEncodingException e) { LOG.error("Cannot encode json"); } httpPost.setEntity(entity); httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); try (CloseableHttpClient client = HttpClients.createDefault()) { CloseableHttpResponse response = client.execute(httpPost); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { LOG.warn("Did not successfully send notification"); } } catch (IOException e) { LOG.error("Cannot send jsonMessage"); } }
Source:
<code>public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaHooks.setOnError(new Action1<Throwable>() { @Override public void call(Throwable t) { list.add(t); } }); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); TestSubscriber<List<Integer>> ts = TestSubscriber.create(); Observable.create(new OnSubscribe<Integer>() { @Override public void call(final Subscriber<? super Integer> sub) { sub.setProducer(new Producer() { @Override public void request(long n) { if (n > 0) { sub.onNext(1); sub.onError(e2); } } }); } }).collect(new Func0<List<Integer>>() { @Override public List<Integer> call() { return new ArrayList<Integer>(); } }, new Action2<List<Integer>, Integer>() { @Override public void call(List<Integer> t1, Integer t2) { throw e1; } }).unsafeSubscribe(ts); assertEquals(Arrays.asList(e1), ts.getOnErrorEvents()); ts.assertNotCompleted(); assertEquals(Arrays.asList(e2), list); } finally { <START> RxJavaHooks.setOnError(null); <END> } }</code><technical_language>call reset RxJavaHooks wont delegate RxJavaPlugins</technical_language>

Target:
public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaHooks.setOnError(new Action1<Throwable>() { @Override public void call(Throwable t) { list.add(t); } }); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); TestSubscriber<List<Integer>> ts = TestSubscriber.create(); Observable.create(new OnSubscribe<Integer>() { @Override public void call(final Subscriber<? super Integer> sub) { sub.setProducer(new Producer() { @Override public void request(long n) { if (n > 0) { sub.onNext(1); sub.onError(e2); } } }); } }).collect(new Func0<List<Integer>>() { @Override public List<Integer> call() { return new ArrayList<Integer>(); } }, new Action2<List<Integer>, Integer>() { @Override public void call(List<Integer> t1, Integer t2) { throw e1; } }).unsafeSubscribe(ts); assertEquals(Arrays.asList(e1), ts.getOnErrorEvents()); ts.assertNotCompleted(); assertEquals(Arrays.asList(e2), list); } finally { RxJavaHooks.reset(); } }
Source:
<code>public Mono<Void> updateCheckpoint(long sequenceNumber, String offset){ Checkpoint checkpoint = new Checkpoint() .consumerGroupName(partitionContext.consumerGroupName()) .eventHubName(partitionContext.eventHubName()) .instanceId(partitionContext.instanceId()) .partitionId(partitionContext.partitionId()) .sequenceNumber(sequenceNumber) .offset(offset) .eTag(eTag); <START> return this.partitionManager.updateCheckpoint(checkpoint).flatMap(eTag -> { <END> this.eTag = eTag; return Mono.empty(); }); }</code><technical_language>flatmap .map()? .flatMap transforms items asynchronously. If flatMap is want this.eTag is in a thread-safe manner. .map().then()? .then() replays complete signal errors</technical_language>

Target:
public Mono<Void> updateCheckpoint(long sequenceNumber, String offset) { String previousETag = this.eTag.get(); Checkpoint checkpoint = new Checkpoint() .consumerGroupName(partitionContext.consumerGroupName()) .eventHubName(partitionContext.eventHubName()) .ownerId(ownerId) .partitionId(partitionContext.partitionId()) .sequenceNumber(sequenceNumber) .offset(offset) .eTag(previousETag); return this.partitionManager.updateCheckpoint(checkpoint) .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) .then(); }
Source:
<code>public ColumnMatchResult validate(Column column, ChecksumResult controlResult, ChecksumResult testResult) { String checksumColumnAlias = getChecksumColumnAlias(column); Object controlChecksum = controlResult.getChecksum(checksumColumnAlias); Object testChecksum = testResult.getChecksum(checksumColumnAlias); String cardinalitySumColumnAlias = getCardinalitySumColumnAlias(column); Object controlCardinalitySum = controlResult.getChecksum(cardinalitySumColumnAlias); Object testCardinalitySum = testResult.getChecksum(cardinalitySumColumnAlias); return new ColumnMatchResult( Objects.equals(controlChecksum, testChecksum) && Objects.equals(controlCardinalitySum, testCardinalitySum), format( <START> "control(checksum: %s, cardinality_sum: %s) test(checksum: %s, cardinality_sum: %s)", <END> controlChecksum, controlCardinalitySum, testChecksum, testCardinalitySum)); }</code><technical_language>separate checksums for keys values</technical_language>

Target:
public List<ColumnMatchResult> validate(Column column, ChecksumResult controlResult, ChecksumResult testResult) { String checksumColumnAlias = getChecksumColumnAlias(column); Object controlChecksum = controlResult.getChecksum(checksumColumnAlias); Object testChecksum = testResult.getChecksum(checksumColumnAlias); String keysChecksumColumnAlias = getKeysChecksumColumnAlias(column); Object controlKeysChecksum = controlResult.getChecksum(keysChecksumColumnAlias); Object testKeysChecksum = testResult.getChecksum(keysChecksumColumnAlias); String valuesChecksumColumnAlias = getValuesChecksumColumnAlias(column); Object controlValuesChecksum = controlResult.getChecksum(valuesChecksumColumnAlias); Object testValuesChecksum = testResult.getChecksum(valuesChecksumColumnAlias); String cardinalitySumColumnAlias = getCardinalitySumColumnAlias(column); Object controlCardinalitySum = controlResult.getChecksum(cardinalitySumColumnAlias); Object testCardinalitySum = testResult.getChecksum(cardinalitySumColumnAlias); return ImmutableList.of(new ColumnMatchResult( Objects.equals(controlChecksum, testChecksum) && Objects.equals(controlKeysChecksum, testKeysChecksum) && Objects.equals(controlValuesChecksum, testValuesChecksum) && Objects.equals(controlCardinalitySum, testCardinalitySum), column, format( "control(checksum: %s, keys_checksum: %s, values_checksum: %s, cardinality_sum: %s) " + "test(checksum: %s, keys_checksum: %s, values_checksum: %s, cardinality_sum: %s)", controlChecksum, controlKeysChecksum, controlValuesChecksum, controlCardinalitySum, testChecksum, testKeysChecksum, testValuesChecksum, testCardinalitySum))); }