auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int getPotentiallyStuckProcessors() { DateTime now = now(); int potentiallyStuck = 0; synchronized (processingInstances) { for (Entry<Integer, DateTime> entry : processingInstances.entrySet()) { int processingTimeMinutes = minutesBetween(entry.getValue(), now).getMinutes(); <START> if (processingTimeMinutes > 5) { <END> potentiallyStuck++; logger.warn("Workflow instance has been processed for minutes, it may be stuck.", entry.getKey(), processingTimeMinutes); } } } return potentiallyStuck; }</code><technical_language>configurable</technical_language>

Target:
public int getPotentiallyStuckProcessors() { long currentTimeSeconds = currentTimeMillis() / 1000; int potentiallyStuck = 0; for (WorkflowStateProcessor processor : processingInstances.values()) { long processingTimeSeconds = currentTimeSeconds - processor.getStartTimeSeconds(); if (processingTimeSeconds > stuckThreadThresholdSeconds) { potentiallyStuck++; processor.logPotentiallyStuck(processingTimeSeconds); } } return potentiallyStuck; }
Source:
<code>@Test public void testSelectNullWithInsertFromJoin() { String query = "insert into " + "\"account\"(\"account_id\",\"account_parent\",\"account_type\",\"account_rollup\")" + "\tselect \"product\".\"product_id\", \n" + "\tcast(NULL AS INT), \n" <START> + "\tcast(\"product\".\"product_id\" as varchar), \n" <END> + "\tcast(\"sales_fact_1997\".\"store_id\" as varchar)\n" + " from \"product\"\n" + " inner join \"sales_fact_1997\"\n" + " on \"product\".\"product_id\" = \"sales_fact_1997\".\"product_id\""; final String expected = "INSERT INTO \"foodmart\".\"account\" " + "(\"account_id\", \"account_parent\", \"account_description\", " + "\"account_type\", \"account_rollup\", \"Custom_Members\")\n" + "(SELECT \"product\".\"product_id\" AS \"account_id\", " + "CAST(NULL AS INTEGER) AS \"account_parent\", CAST(NULL AS VARCHAR" + "(30) CHARACTER SET \"ISO-8859-1\") AS \"account_description\", " + "CAST(\"product\".\"product_id\" AS VARCHAR CHARACTER SET " + "\"ISO-8859-1\") AS \"account_type\", " + "CAST(\"sales_fact_1997\".\"store_id\" AS VARCHAR CHARACTER SET \"ISO-8859-1\") AS " + "\"account_rollup\", " + "CAST(NULL AS VARCHAR(255) CHARACTER SET \"ISO-8859-1\") AS \"Custom_Members\"\n" + "FROM \"foodmart\".\"product\"\n" + "INNER JOIN \"foodmart\".\"sales_fact_1997\" " + "ON \"product\".\"product_id\" = \"sales_fact_1997\".\"product_id\")"; sql(query).ok(expected); sql(expected).exec(); }</code><technical_language>replace "\t" "\n" ? put a "\n" end of sql statement line</technical_language>

Target:
@Test public void testSelectNullWithInsertFromJoin() { String query = "insert into \n" + "\"account\"(\"account_id\",\"account_parent\",\n" + "\"account_type\",\"account_rollup\")\n" + "select \"product\".\"product_id\", \n" + "cast(NULL AS INT), \n" + "cast(\"product\".\"product_id\" as varchar), \n" + "cast(\"sales_fact_1997\".\"store_id\" as varchar)\n" + "from \"product\"\n" + "inner join \"sales_fact_1997\"\n" + "on \"product\".\"product_id\" = \"sales_fact_1997\".\"product_id\""; final String expected = "INSERT INTO \"foodmart\".\"account\" " + "(\"account_id\", \"account_parent\", \"account_description\", " + "\"account_type\", \"account_rollup\", \"Custom_Members\")\n" + "(SELECT \"product\".\"product_id\" AS \"account_id\", " + "CAST(NULL AS INTEGER) AS \"account_parent\", CAST(NULL AS VARCHAR" + "(30) CHARACTER SET \"ISO-8859-1\") AS \"account_description\", " + "CAST(\"product\".\"product_id\" AS VARCHAR CHARACTER SET " + "\"ISO-8859-1\") AS \"account_type\", " + "CAST(\"sales_fact_1997\".\"store_id\" AS VARCHAR CHARACTER SET \"ISO-8859-1\") AS " + "\"account_rollup\", " + "CAST(NULL AS VARCHAR(255) CHARACTER SET \"ISO-8859-1\") AS \"Custom_Members\"\n" + "FROM \"foodmart\".\"product\"\n" + "INNER JOIN \"foodmart\".\"sales_fact_1997\" " + "ON \"product\".\"product_id\" = \"sales_fact_1997\".\"product_id\")"; sql(query).ok(expected); sql(expected).exec(); }
Source:
<code>public static boolean isRecoveredFromCrash() { <START> return sharedPreferences != null && sharedPreferences.getBoolean(RECOVERED_FROM_CRASH, false); <END> }</code><technical_language>Remove static</technical_language>

Target:
private boolean isRecoveredFromCrash() { return PreferenceManager.getDefaultSharedPreferences(this).getBoolean(RECOVERED_FROM_CRASH, false); }
Source:
<code>private String generateOvfReaderErrorMessage(OvfReader ovf, Exception ex) { StringBuilder message = new StringBuilder(); message.append("OVF error: ") <START> .append(ovf.getName()) <END> .append(": cannot read '") .append(ovf.getLastReadEntry()) .append("' with value: ") .append(ex.getMessage()); return message.toString(); }</code><technical_language>i ovf null (looking previous code)</technical_language>

Target:
private String generateOvfReaderErrorMessage(OvfReader ovf, Exception ex) { StringBuilder message = new StringBuilder(); if (ovf == null) { message.append("Error loading ovf, message") .append(ex.getMessage()); } else { message.append("OVF error: ") .append(ovf.getName()) .append(": cannot read '") .append(ovf.getLastReadEntry()) .append("' with value: ") .append(ex.getMessage()); } return message.toString(); }
Source:
<code>private void prepareNextIterator() { final Set<Node<E>> difference = new LinkedHashSet<Node<E>>(); for (Node<E> node : nextIterable) { if (!consumedNodes.contains(node)) { difference.add(node); } } currentIterator = Iterators.filter(difference.iterator(), new Predicate<Node<E>>() { public boolean apply(Node<E> input) { <START> Set<Node<E>> parents = input.getParents(); <END> for (Node<E> parent : parents) { if (!consumedNodes.contains(parent) && !input.getChildren().contains(parent)) { return false; } } return true; } }); nextIterable.clear(); }</code><technical_language>more optimized compute difference parents - children return consumed nodes 'true' parents: Set<Node<E>> trueParents = Sets.difference(input.getParents(), input.getChildren()); return consumedNodes.containsAll(trueParents); not... please analyze that</technical_language>

Target:
private void prepareNextIterator() { final Set<Node<E>> difference = new LinkedHashSet<Node<E>>(); for (Node<E> node : nextIterable) { if (!consumedNodes.contains(node)) { difference.add(node); } } currentIterator = Iterators.filter(difference.iterator(), new Predicate<Node<E>>() { public boolean apply(Node<E> input) { SetView<Node<E>> trueParents = Sets.difference(input.getParents(), input.getChildren()); return consumedNodes.containsAll(trueParents); } }); nextIterable.clear(); }
Source:
<code>protected void javac(StringList args, FileList files) { println("Compiling " + files.size() + " classes"); StringList params = new StringList(); params.addAll(args); String encoding = null; for(int i = 0, size = params.size(); i < size; ++i){ if("-encoding".equals(params.get(i))){ encoding = params.get(i + 1); break; } } if(encoding == null){ encoding = StandardCharsets.UTF_8.name(); params.add("-encoding"); params.add(encoding); } <START> println("Using encoding " + encoding); <END> params.addAll(getPaths(files.keep(".java"))); String[] array = params.array(); int result; PrintStream old = System.err; try { Class<?> clazz = Class.forName("com.sun.tools.javac.Main"); if (quiet) { System.setErr(filter(System.err, new String[] { "Note:" })); } Method compile = clazz.getMethod("compile", new Class<?>[] { String[].class }); Object instance = clazz.getDeclaredConstructor().newInstance(); result = (Integer) invoke(compile, instance, new Object[] { array }); } catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); } finally { System.setErr(old); } if (result != 0) { throw new RuntimeException("An error occurred"); } }</code><technical_language>Do need name of encoding in build output? useless. characters in H2 sources ASCII, if changed UTF-8 used</technical_language>

Target:
protected void javac(StringList args, FileList files) { println("Compiling " + files.size() + " classes"); StringList params = new StringList(); params.addAll(args); params.addAll(getPaths(files.keep(".java"))); String[] array = params.array(); int result; PrintStream old = System.err; try { Class<?> clazz = Class.forName("com.sun.tools.javac.Main"); if (quiet) { System.setErr(filter(System.err, new String[] { "Note:" })); } Method compile = clazz.getMethod("compile", new Class<?>[] { String[].class }); Object instance = clazz.getDeclaredConstructor().newInstance(); result = (Integer) invoke(compile, instance, new Object[] { array }); } catch (Exception e) { e.printStackTrace(); result = exec("javac", new StringList(array)); } finally { System.setErr(old); } if (result != 0) { throw new RuntimeException("An error occurred"); } }
Source:
<code>public Plan visitSetStatement(AnalyzedSetStatement setStatement, PlannerContext context) { switch (setStatement.scope()) { case LICENSE: LOGGER.warn("SET LICENSE STATEMENT WILL BE IGNORED: {}", setStatement.settings()); return NoopPlan.INSTANCE; case LOCAL: LOGGER.warn("SET LOCAL STATEMENT WILL BE IGNORED: {}", setStatement.settings()); return NoopPlan.INSTANCE; case SESSION_TRANSACTION_MODE: LOGGER.warn("'SET SESSION CHARACTERISTICS AS TRANSACTION' STATEMENT WILL BE IGNORED"); return NoopPlan.INSTANCE; case SESSION: return new SetSessionPlan(setStatement.settings()); case GLOBAL: if (setStatement.isPersistent()) { return new UpdateSettingsPlan(setStatement.settings(), true); } else { return new UpdateSettingsPlan( Collections.emptyMap(), setStatement.settings(), true ); } default: if (setStatement.isPersistent()) { return new UpdateSettingsPlan(setStatement.settings(), false); } else { return new UpdateSettingsPlan( Collections.emptyMap(), setStatement.settings(), <START> false <END> ); } } }</code><technical_language>GLOBAL impl, setStatement.scope() == GLOBAL for UpdateSettingsPlan</technical_language>

Target:
public Plan visitSetStatement(AnalyzedSetStatement setStatement, PlannerContext context) { switch (setStatement.scope()) { case LICENSE: throw new AssertionError( "`AnalyzedSetStatement` with scope `LICENSE` should have been converted to `AnalyzedSetLicenseStatement` by the analyzer"); case LOCAL: LOGGER.info( "SET LOCAL `{}` statement will be ignored. " + "CrateDB has no transactions, so any `SET LOCAL` change would be dropped in the next statement.", setStatement.settings()); return NoopPlan.INSTANCE; case SESSION_TRANSACTION_MODE: LOGGER.info("'SET SESSION CHARACTERISTICS AS TRANSACTION' statement will be ignored."); return NoopPlan.INSTANCE; case SESSION: return new SetSessionPlan(setStatement.settings()); case GLOBAL: default: return new UpdateSettingsPlan(setStatement.settings(), setStatement.isPersistent()); } }
Source:
<code>public void updateExclusiveConsumer(String queueName, boolean isExclusiveConsumer) throws QueueManagerException{ try { MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); ObjectName objectName = new ObjectName("org.wso2.andes:type=VirtualHost.VirtualHostManager,VirtualHost=\"carbon\""); String operationName = "updateExclusiveConsumerValue"; Object[] parameters = new Object[]{queueName, isExclusiveConsumer}; String[] signature = new String[]{String.class.getName(), boolean.class.getName()}; mBeanServer.invoke( objectName, operationName, parameters, signature); } catch (MalformedObjectNameException e) { <START> e.printStackTrace(); <END> }catch (JMException e) { throw new QueueManagerException("Error checking if queue " + queueName + " exists.", e); } }</code><technical_language>Dont "e.printStackTrace();' , throw exception here</technical_language>

Target:
public void updateExclusiveConsumer(String queueName, boolean isExclusiveConsumer) throws QueueManagerException, MalformedObjectNameException { try { MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); ObjectName objectName = new ObjectName("org.wso2.andes:type=VirtualHost.VirtualHostManager,VirtualHost=\"carbon\""); String operationName = "updateExclusiveConsumerValue"; Object[] parameters = new Object[]{queueName, isExclusiveConsumer}; String[] signature = new String[]{String.class.getName(), boolean.class.getName()}; mBeanServer.invoke( objectName, operationName, parameters, signature); } catch (MalformedObjectNameException e1) { log.error("Malformed object name Error in updating exclusive consumer value", e1); throw new MalformedObjectNameException("Error in updating exclusive consumer value."); } catch (JMException e2) { log.error("MBean invoking error in updating exclusive consumer value", e2); throw new QueueManagerException("Error checking if queue " + queueName + " exists.", e2); } }
Source:
<code>private static boolean assertIDNotEmpty(String id) { if (id == null || "".equals(id)) { <START> if (log.isDebugEnabled()) { <END> log.debug("Provided id is empty or null ,returning a null as JsonPath"); } return false; } return true; }</code><technical_language>id.isEmpty()</technical_language>

Target:
private static boolean assertIDNotEmpty(String id) { if (id == null || id.isEmpty()) { if (log.isDebugEnabled()) { log.debug("Provided id is empty or null ,returning a null as JsonPath"); } return false; } return true; }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case LOGIN: <START> this.showFirebaseLoginPrompt(); <END> return true; case LOGOUT: this.logout(); return true; } return super.onOptionsItemSelected(item); }</code><technical_language>showFirebaseLoginDialog? that, awesome idea</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.login_menu_item: this.showFirebaseLoginPrompt(); return true; case R.id.logout_menu_item: this.logout(); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); final Set<EndpointLogLine> endpointLogLines = new TreeSet<>(new EndpointComparator()); msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResourcesClasses = new HashSet<>(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResourcesClasses.add(clazz); } } for (Class<?> klass : allResourcesClasses) { new EndpointLogger(urlPattern, klass).populate(endpointLogLines); } final Set<Resource> allResources = this.getResources(); for (Resource res : allResources) { <START> if (containsAny(allResourcesClasses, res.getHandlerClasses())) { <END> continue; } for (Resource childRes : res.getChildResources()) { for (Class<?> childResHandlerClass : childRes.getHandlerClasses()) { EndpointLogger epl = new EndpointLogger(urlPattern, childResHandlerClass); epl.populate(cleanUpPath(res.getPath() + epl.rootPath), epl.klass, false, childRes, endpointLogLines); } } } if (!endpointLogLines.isEmpty()) { for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }</code><technical_language>I avoid creating a helper method a declarative approach Guava's Iterables. Iterables.any(res.getHandlerClasses(), allResourcesClasses::contains)</technical_language>

Target:
public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); final Set<EndpointLogLine> endpointLogLines = new TreeSet<>(new EndpointComparator()); msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResourcesClasses = new HashSet<>(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResourcesClasses.add(clazz); } } for (Class<?> klass : allResourcesClasses) { new EndpointLogger(urlPattern, klass).populate(endpointLogLines); } final Set<Resource> allResources = this.getResources(); for (Resource res : allResources) { for (Resource childRes : res.getChildResources()) { for (Class<?> childResHandlerClass : childRes.getHandlerClasses()) { EndpointLogger epl = new EndpointLogger(urlPattern, childResHandlerClass); epl.populate(cleanUpPath(res.getPath() + epl.rootPath), epl.klass, false, childRes, endpointLogLines); } } } if (!endpointLogLines.isEmpty()) { for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }
Source:
<code>private @Nullable AmmoStorage findSpareAmmo(AmmoType ammoType) { return (AmmoStorage) getWarehouse().findSparePart(part -> { <START> if (!isAvailableAsSpareAmmo(part)) { return false; } return ((AmmoStorage) part).isSameAmmoType(ammoType); <END> }); }</code><technical_language>This refactored a single return statement easily</technical_language>

Target:
private @Nullable AmmoStorage findSpareAmmo(AmmoType ammoType) { return (AmmoStorage) getWarehouse().findSparePart(part -> { return isAvailableAsSpareAmmo(part) && ((AmmoStorage) part).isSameAmmoType(ammoType); }); }
Source:
<code>private double getMinimumWidthOfPeers() { final GridCellTuple parent = ((RelationGrid) gridWidget).getParentInformation(); final GridData parentUiModel = parent.getGridData(); final int parentUiRowIndex = parent.getRowIndex(); final int parentUiColumnIndex = parent.getColumnIndex(); double minimumWidth = super.getMinimumWidth(); for (int uiRowIndex = 0; uiRowIndex < parentUiModel.getRowCount(); uiRowIndex++) { if (uiRowIndex != parentUiRowIndex) { final GridRow row = parentUiModel.getRow(uiRowIndex); final GridCell<?> cell = row.getCells().get(parentUiColumnIndex); if (cell != null) { final GridCellValue<?> value = cell.getValue(); if (value instanceof ExpressionCellValue) { final ExpressionCellValue ecv = (ExpressionCellValue) value; final Optional<BaseExpressionGrid> editor = ecv.getValue(); <START> final double padding = editor.map(BaseExpressionGrid::getPadding).orElse(0.0); <END> minimumWidth = Math.max(minimumWidth, ecv.getMinimumWidth().orElse(0.0) + padding * 2); } } } } return minimumWidth; }</code><technical_language>question for ExpressionEditorColumn class</technical_language>

Target:
private double getMinimumWidthOfPeers() { final GridCellTuple parent = ((RelationGrid) gridWidget).getParentInformation(); final GridData parentUiModel = parent.getGridData(); final int parentUiRowIndex = parent.getRowIndex(); final int parentUiColumnIndex = parent.getColumnIndex(); double minimumWidth = super.getMinimumWidth(); for (int uiRowIndex = 0; uiRowIndex < parentUiModel.getRowCount(); uiRowIndex++) { if (uiRowIndex != parentUiRowIndex) { final GridRow row = parentUiModel.getRow(uiRowIndex); final GridCell<?> cell = row.getCells().get(parentUiColumnIndex); if (cell != null) { final GridCellValue<?> value = cell.getValue(); if (value instanceof ExpressionCellValue) { final ExpressionCellValue ecv = (ExpressionCellValue) value; final Optional<BaseExpressionGrid> editor = ecv.getValue(); final double padding = editor.map(BaseExpressionGrid::getPadding).get(); minimumWidth = Math.max(minimumWidth, ecv.getMinimumWidth().orElse(0.0) + padding * 2); } } } } return minimumWidth; }
Source:
<code>private void addStateSystem(@Nullable IProgressMonitor monitor, ITmfStateSystem ss, long parentId) { String ssName = ss.getSSID(); EntryModelBuilder entry = fEntryBuilder.get(parentId, ssName); StateSystemEntryModel.Builder stateSystemEntryModel; Long startTime = ss.getStartTime(); Long endTime = ss.getCurrentEndTime(); <START> if (entry != null && entry instanceof ModuleEntryModel.Builder) { <END> stateSystemEntryModel = (StateSystemEntryModel.Builder) entry; } else { long id = ENTRY_ID.getAndIncrement(); stateSystemEntryModel = new StateSystemEntryModel.Builder(id, parentId, ssName, startTime, endTime, ss); fEntryBuilder.put(parentId, ssName, stateSystemEntryModel); } long ssId = stateSystemEntryModel.getId(); stateSystemEntryModel.setEndTime(endTime); fEntryBuilder.put(parentId, ssName, stateSystemEntryModel); fSsToId.put(ss, ssId); for (Integer attrib : ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false)) { if (monitor != null) { if (monitor.isCanceled()) { return; } } addSubAttributes(monitor, ssId, startTime, endTime, ss, attrib); } }</code><technical_language>check for StateSystemEntryModel.Builder</technical_language>

Target:
private void addStateSystem(@Nullable IProgressMonitor monitor, ITmfStateSystem ss, long parentId) { String ssName = ss.getSSID(); EntryModelBuilder entry = fEntryBuilder.get(parentId, ssName); StateSystemEntryModel.Builder stateSystemEntryModel; Long startTime = ss.getStartTime(); Long endTime = ss.getCurrentEndTime(); if (entry != null && entry instanceof StateSystemEntryModel.Builder) { stateSystemEntryModel = (StateSystemEntryModel.Builder) entry; } else { long id = ENTRY_ID.getAndIncrement(); stateSystemEntryModel = new StateSystemEntryModel.Builder(id, parentId, ssName, startTime, endTime, ss); fEntryBuilder.put(parentId, ssName, stateSystemEntryModel); } long ssId = stateSystemEntryModel.getId(); stateSystemEntryModel.setEndTime(endTime); fEntryBuilder.put(parentId, ssName, stateSystemEntryModel); fSsToId.put(ss, ssId); for (Integer attrib : ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false)) { if (monitor != null) { if (monitor.isCanceled()) { return; } } addSubAttributes(monitor, ssId, startTime, endTime, ss, attrib); } }
Source:
<code>public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException { <START> upload.setForFailedJobs(true); <END> try { upload.perform(getCredentialsId(), run, workspace, listener); } catch (UploadException e) { throw new IOException("Could not perform upload", e); } }</code><technical_language>I this is needed this is a new build step type older jobs correct</technical_language>

Target:
public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException { try { upload.perform(getCredentialsId(), run, workspace, listener); } catch (UploadException e) { throw new IOException(Messages.StdoutUpload_FailToUpload(), e); } }
Source:
<code>private <K, V> void processKeyValueAndVerifyPlainCount(final K key, final List<KeyValue<Integer, Object>> expectedStoreContent) throws Exception { IntegrationTestUtils.produceKeyValuesSynchronously( inputStream, singletonList(KeyValue.pair(key, 0)), TestUtils.producerConfig(CLUSTER.bootstrapServers(), IntegerSerializer.class, IntegerSerializer.class), CLUSTER.time); TestUtils.waitForCondition( () -> { try { final ReadOnlyKeyValueStore<K, V> store = IntegrationTestUtils.getStore(STORE_NAME, kafkaStreams, QueryableStoreTypes.keyValueStore()); <START> if (store == null) return false; <END> try (final KeyValueIterator<K, V> all = store.all()) { final List<KeyValue<K, V>> storeContent = new LinkedList<>(); while (all.hasNext()) { storeContent.add(all.next()); } return storeContent.equals(expectedStoreContent); } } catch (final Exception swallow) { swallow.printStackTrace(); System.err.println(swallow.getMessage()); return false; } }, 60_000L, "Could not get expected result in time."); }</code><technical_language>a huge deal, technically, brackets</technical_language>

Target:
private <K, V> void processKeyValueAndVerifyPlainCount(final K key, final List<KeyValue<Integer, Object>> expectedStoreContent) throws Exception { IntegrationTestUtils.produceKeyValuesSynchronously( inputStream, singletonList(KeyValue.pair(key, 0)), TestUtils.producerConfig(CLUSTER.bootstrapServers(), IntegerSerializer.class, IntegerSerializer.class), CLUSTER.time); TestUtils.waitForCondition( () -> { try { final ReadOnlyKeyValueStore<K, V> store = IntegrationTestUtils.getStore(STORE_NAME, kafkaStreams, QueryableStoreTypes.keyValueStore()); if (store == null) { return false; } try (final KeyValueIterator<K, V> all = store.all()) { final List<KeyValue<K, V>> storeContent = new LinkedList<>(); while (all.hasNext()) { storeContent.add(all.next()); } return storeContent.equals(expectedStoreContent); } } catch (final Exception swallow) { swallow.printStackTrace(); System.err.println(swallow.getMessage()); return false; } }, 60_000L, "Could not get expected result in time."); }
Source:
<code>public void push(RowMap r) throws Exception { if (r instanceof DDLMap && !outputDDL) { return; <START> } <END> String key = r.pkToJson(keyFormat); String value = r.toJSON(outputConfig); if ( value == null ) { inflightMessages.addMessage(r.getPosition()); BinlogPosition newPosition = inflightMessages.completeMessage(r.getPosition()); if ( newPosition != null ) { context.setPosition(newPosition); } return; } ProducerRecord<String, String> record; if (r instanceof DDLMap) { record = new ProducerRecord<>(ddlTopic, this.ddlPartitioner.kafkaPartition(r, this.numPartitions), key, value); } else { record = new ProducerRecord<>(topic, this.partitioner.kafkaPartition(r, this.numPartitions), key, value); } if ( r.isTXCommit() ) inflightMessages.addMessage(r.getPosition()); if ( !KafkaCallback.LOGGER.isDebugEnabled() ) value = null; KafkaCallback callback = new KafkaCallback(inflightMessages, r.getPosition(), r.isTXCommit(), this.context, key, value); kafka.send(record, callback); }</code><technical_language>loose contract put in place for HeartbeatRowMap here: if a row output, return null toJSON; this producers honor outputDDL flag (implicitly) modify producer. more succintly: put outputDDL MaxwellOutputConfig, DDLRowMap return null toJSON if output it. (that fix failing tests, too)</technical_language>

Target:
public void push(RowMap r) throws Exception { String key = r.pkToJson(keyFormat); String value = r.toJSON(outputConfig); if ( value == null ) { inflightMessages.addMessage(r.getPosition()); BinlogPosition newPosition = inflightMessages.completeMessage(r.getPosition()); if ( newPosition != null ) { context.setPosition(newPosition); } return; } ProducerRecord<String, String> record; if (r instanceof DDLMap) { record = new ProducerRecord<>(ddlTopic, this.ddlPartitioner.kafkaPartition(r, this.numPartitions), key, value); } else { record = new ProducerRecord<>(topic, this.partitioner.kafkaPartition(r, this.numPartitions), key, value); } if ( r.isTXCommit() ) inflightMessages.addMessage(r.getPosition()); if ( !KafkaCallback.LOGGER.isDebugEnabled() ) value = null; KafkaCallback callback = new KafkaCallback(inflightMessages, r.getPosition(), r.isTXCommit(), this.context, key, value); kafka.send(record, callback); }
Source:
<code>protected void mergeCluster(String cacheName) { getLog().debugf("Merging cluster"); partition(0).merge(partition(1)); <START> TestingUtil.waitForRehashToComplete(caches(cacheName)); <END> getLog().debugf("Cluster merged"); }</code><technical_language>remove TestingUtil. prefix import</technical_language>

Target:
protected void mergeCluster(String cacheName) { getLog().debugf("Merging cluster"); partition(0).merge(partition(1)); waitForRehashToComplete(caches(cacheName)); getLog().debugf("Cluster merged"); }
Source:
<code>public void test2GhzHighQuality5GhzAvailable() { testStayOrSwitch(mThresholdQualifiedRssi2G <START> + 1, false, <END> mThresholdSaturatedRssi5G, true, true); }</code><technical_language>delete</technical_language>

Target:
public void test2GhzHighQuality5GhzAvailable() { testStayOrSwitch(mThresholdQualifiedRssi2G, false, mThresholdQualifiedRssi5G - 1, true, true); }
Source:
<code><START> private void createDanglingObjectHandler() <END> { poolOfString.take(); }</code><technical_language>remove this method simply poolsOfString.take() this method is called</technical_language>

Target:
private String createDanglingObjectHandler() { return poolOfString.take().get(); }
Source:
<code>public ValidationResult isDomainHasSpaceForRequest(final long requestedSize, final boolean useThresHold) { <START> long size = useThresHold ? getLowDiskSpaceThreshold() : 0; <END> if (storageDomain.getavailable_disk_size() != null && storageDomain.getavailable_disk_size() - requestedSize < size) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN, storageName()); } return ValidationResult.VALID; }</code><technical_language>save promotion, a long literal - 0L</technical_language>

Target:
public ValidationResult isDomainHasSpaceForRequest(final long requestedSize, final boolean useThresHold) { long size = useThresHold ? getLowDiskSpaceThreshold() : 0l; if (storageDomain.getavailable_disk_size() != null && storageDomain.getavailable_disk_size() - requestedSize < size) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN, storageName()); } return ValidationResult.VALID; }
Source:
<code>protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { Provider provider = getProviderDao().get(Guid.createGuidFromString(storageDomain.getStorage())); List<LibvirtSecret> libvirtSecrets = getLibvirtSecretDao().getAllByProviderId(provider.getId()); VDS vds = getVdsDao().get(vdsId); if (!isLibrbdAvailable(vds)) { log.error("Couldn't found librbd1 package on vds (needed for storage domain {}).", vds.getName(), storageDomain.getName()); <START> StorageHelperBase.addMessageToAuditLog(AuditLogType.NO_LIBRBD_PACKAGE_AVAILABLE_ON_VDS, null, vds.getName()); <END> return new Pair<>(false, null); } return registerLibvirtSecrets(storageDomain, vds, libvirtSecrets); }</code><technical_language>fully-qualified notation is redundant, adds noise this patch</technical_language>

Target:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { Provider provider = getProviderDao().get(Guid.createGuidFromString(storageDomain.getStorage())); List<LibvirtSecret> libvirtSecrets = getLibvirtSecretDao().getAllByProviderId(provider.getId()); VDS vds = getVdsDao().get(vdsId); if (!isLibrbdAvailable(vds)) { log.error("Couldn't found librbd1 package on vds (needed for storage domain {}).", vds.getName(), storageDomain.getName()); addMessageToAuditLog(AuditLogType.NO_LIBRBD_PACKAGE_AVAILABLE_ON_VDS, null, vds.getName()); return new Pair<>(false, null); } return registerLibvirtSecrets(storageDomain, vds, libvirtSecrets); }
Source:
<code>default S locales(Locale... locales) { locales( new HashSet<>( Arrays.asList( locales ) ) ); <START> return (S) this; <END> }</code><technical_language>do this instead, avoid unchecked cast: return locales( new HashSet<>( Arrays.asList( locales ) ) );</technical_language>

Target:
default S locales(Locale... locales) { return locales( new HashSet<>( Arrays.asList( locales ) ) ); }
Source:
<code>public JsonElement serialize(TmfStateInterval src, @Nullable Type typeOfSrc, @Nullable JsonSerializationContext context) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(TmfIntervalStrings.START, src.getStartTime()); jsonObject.addProperty(TmfIntervalStrings.END, src.getEndTime()); jsonObject.addProperty(TmfIntervalStrings.QUARK, src.getAttribute()); Object value = src.getValue(); if (value == null) { String nullString = TmfIntervalStrings.NULL; jsonObject.addProperty(TmfIntervalStrings.TYPE, <START> nullString); <END> return jsonObject; } if(value.getClass().isInstance(CustomStateValue.class)) { jsonObject.addProperty(TmfIntervalStrings.TYPE, TmfIntervalStrings.CUSTOM); } else { jsonObject.addProperty(TmfIntervalStrings.TYPE, value.getClass().getName()); } if (value instanceof CustomStateValue) { CustomStateValue customValue = (CustomStateValue) value; int size = customValue.getSerializedSize(); ByteBuffer buffer = ByteBuffer.allocate(size); buffer.clear(); ISafeByteBufferWriter sbbw = SafeByteBufferFactory.wrapWriter(buffer, size); customValue.serialize(sbbw); byte[] serializedValue = buffer.array(); jsonObject.addProperty(TmfIntervalStrings.VALUE, Base64.getEncoder().encodeToString(serializedValue)); } else if (value instanceof Number) { Number number = (Number) value; jsonObject.addProperty(TmfIntervalStrings.VALUE, number); } else if (value instanceof String) { jsonObject.addProperty(TmfIntervalStrings.VALUE, (String)value); } else { jsonObject.addProperty(TmfIntervalStrings.VALUE, value.toString()); } return jsonObject; }</code><technical_language>inline</technical_language>

Target:
public JsonElement serialize(TmfStateInterval src, @Nullable Type typeOfSrc, @Nullable JsonSerializationContext context) { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(TmfIntervalStrings.START, src.getStartTime()); jsonObject.addProperty(TmfIntervalStrings.END, src.getEndTime()); jsonObject.addProperty(TmfIntervalStrings.QUARK, src.getAttribute()); Object value = src.getValue(); if (value == null) { jsonObject.addProperty(TmfIntervalStrings.TYPE, TmfIntervalStrings.NULL); return jsonObject; } if (value.getClass().isInstance(CustomStateValue.class)) { jsonObject.addProperty(TmfIntervalStrings.TYPE, TmfIntervalStrings.CUSTOM); } else { jsonObject.addProperty(TmfIntervalStrings.TYPE, value.getClass().getName()); } if (value instanceof CustomStateValue) { CustomStateValue customValue = (CustomStateValue) value; int size = customValue.getSerializedSize(); ByteBuffer buffer = ByteBuffer.allocate(size); buffer.clear(); ISafeByteBufferWriter sbbw = SafeByteBufferFactory.wrapWriter(buffer, size); customValue.serialize(sbbw); byte[] serializedValue = buffer.array(); jsonObject.addProperty(TmfIntervalStrings.VALUE, Base64.getEncoder().encodeToString(serializedValue)); } else if (value instanceof Number) { Number number = (Number) value; jsonObject.addProperty(TmfIntervalStrings.VALUE, number); } else if (value instanceof String) { jsonObject.addProperty(TmfIntervalStrings.VALUE, (String) value); } else { jsonObject.addProperty(TmfIntervalStrings.VALUE, value.toString()); } return jsonObject; }
Source:
<code>private void testAbortStatement() throws Exception { deleteDb("sessionsLocks"); Connection conn = getConnection("sessionsLocks"); Statement stat = conn.createStatement(); ResultSet rs; <START> rs = stat.executeQuery("select session_id() as ID from dual"); <END> rs.next(); int sessionId = rs.getInt("ID"); Connection conn2 = getConnection("sessionsLocks"); Statement stat2 = conn2.createStatement(); stat2.execute("create table test(id int primary key, name varchar)"); conn2.setAutoCommit(false); stat2.execute("insert into test values(1, 'Hello')"); conn2.commit(); stat2.executeUpdate("update test set name = 'Again' where id = 1"); rs = stat2.executeQuery("select session_id() as ID from dual"); rs.next(); int otherId = rs.getInt("ID"); assertTrue(otherId != sessionId); assertFalse(rs.next()); int lockCount = getLockCountForSession(stat, otherId); assertTrue(lockCount > 0); rs = stat.executeQuery("CALL ABORT_SESSION(" + otherId + ")"); rs.next(); assertTrue(rs.getBoolean(1)); lockCount = getLockCountForSession(stat, otherId); assertTrue(lockCount == 0); rs = stat.executeQuery("CALL ABORT_SESSION(" + otherId + ")"); rs.next(); if (rs.getBoolean(1)) { new Error("Session is expected to be already aborted").printStackTrace(); } try { rs = stat2.executeQuery("select count(*) from test"); new Error("Connection for aborted session is expected to throw an exception").printStackTrace(); } catch (SQLException sqe) { } conn2.close(); conn.close(); }</code><technical_language>DUAL needed below, H2 is Oracle. leave it, however, H2 accepts syntax too</technical_language>

Target:
private void testAbortStatement() throws Exception { deleteDb("sessionsLocks"); Connection conn = getConnection("sessionsLocks"); Statement stat = conn.createStatement(); ResultSet rs; rs = stat.executeQuery("select session_id() as ID"); rs.next(); int sessionId = rs.getInt("ID"); Connection conn2 = getConnection("sessionsLocks"); Statement stat2 = conn2.createStatement(); stat2.execute("create table test(id int primary key, name varchar)"); conn2.setAutoCommit(false); stat2.execute("insert into test values(1, 'Hello')"); conn2.commit(); stat2.executeUpdate("update test set name = 'Again' where id = 1"); rs = stat2.executeQuery("select session_id() as ID"); rs.next(); int otherId = rs.getInt("ID"); assertTrue(otherId != sessionId); assertFalse(rs.next()); assertEquals(1, getLockCountForSession(stat, otherId)); rs = stat.executeQuery("CALL ABORT_SESSION(" + otherId + ")"); rs.next(); assertTrue(rs.getBoolean(1)); assertEquals(0, getLockCountForSession(stat, otherId)); rs = stat.executeQuery("CALL ABORT_SESSION(" + otherId + ")"); rs.next(); assertFalse("Session is expected to be already aborted", rs.getBoolean(1)); assertThrows(config.networked ? ErrorCode.CONNECTION_BROKEN_1 : ErrorCode.DATABASE_CALLED_AT_SHUTDOWN, stat2) .executeQuery("select count(*) from test"); conn2.close(); conn.close(); }
Source:
<code>private Node createNodeForElement(Object element) { NodeDescriptor nodeDescriptor = mDOMProvider.getNodeDescriptor(element); Node node = new Node(); node.nodeId = getOrCreateNodeIdForElement(element); node.nodeType = nodeDescriptor.getNodeType(element).getValue(); node.nodeName = nodeDescriptor.getNodeName(element); node.localName = nodeDescriptor.getLocalName(element); node.nodeValue = nodeDescriptor.getNodeValue(element); node.children = getChildNodesForElement(element); node.childNodeCount = node.children.size(); int attributeCount = nodeDescriptor.getAttributeCount(element); if (attributeCount > 0) { <START> node.attributes = new ArrayList<>(attributeCount * 2); <END> NodeAttribute attribute = new NodeAttribute(); for (int i = 0; i < attributeCount; ++i) { nodeDescriptor.getAttributeAt(element, i, attribute); if (attribute.name == null || attribute.value == null) { throw new IllegalArgumentException(); } node.attributes.add(attribute.name); node.attributes.add(attribute.value); attribute.name = null; attribute.value = null; } } return node; }</code><technical_language>Danger. resolved #44. I tackle this if want, needs a precursor</technical_language>

Target:
private Node createNodeForElement(Object element) { NodeDescriptor descriptor = mDOMProvider.getNodeDescriptor(element); Node node = new Node(); node.nodeId = mObjectIdMapper.putObject(element); node.nodeType = descriptor.getNodeType(element); node.nodeName = descriptor.getNodeName(element); node.localName = descriptor.getLocalName(element); node.nodeValue = descriptor.getNodeValue(element); node.children = getChildNodesForElement(element); node.childNodeCount = node.children.size(); int attributeCount = descriptor.getAttributeCount(element); if (attributeCount > 0) { node.attributes = new ArrayList<String>(attributeCount * 2); NodeAttribute attribute = new NodeAttribute(); for (int i = 0; i < attributeCount; ++i) { descriptor.copyAttributeAt(element, i, attribute); node.attributes.add(attribute.name); node.attributes.add(attribute.value); attribute.name = null; attribute.value = null; } } return node; }
Source:
<code>protected int getNumberOfPages(File file) { int result = 0; if(file != null) { try (InputStream inStream = new FileInputStream(file)){ Document doc = new Document(inStream); result = doc.getPages().size(); <START> System.out.println(" get number of pages has ben executed "+result); <END> } catch (IOException e) { System.out.println(e); } } return result; }</code><technical_language>Code System.out.println(). Please remove occurrences, replace logging</technical_language>

Target:
protected int getNumberOfPages(File file) throws IOException { int result = 0; if(file != null) { try (InputStream inStream = new FileInputStream(file)){ Document doc = new Document(inStream); result = doc.getPages().size(); } catch (IOException e) { throw e; } } return result; }
Source:
<code>private void closeTempFile() throws IOException { for (String encodedPartition: tempFiles.keySet()) { closeTempFile(encodedPartition); } <START> lastRotate = System.currentTimeMillis(); <END> }</code><technical_language>Is this right time do this? wondering if end closing file, running issue takes awhile get file committed (e.g. happen hit HDFS issues then). I period processing messages for long effectively started here. I other: if set lastRotate finished rotation, do immediately start (resulting behavior: rotate rotateIntervalMs of long committing takes), wait set lastRotate absolutely finished committing (resulting behavior: process messages for rotateIntervalMs rotating, of long commits take)</technical_language>

Target:
private void closeTempFile() throws IOException { for (String encodedPartition: tempFiles.keySet()) { closeTempFile(encodedPartition); } }
Source:
<code><START> public int hashCode() { <END> final int prime = 31; int result = super.hashCode(); result = prime * result + ((this.helper == null) ? 0 : this.helper.hashCode()); result = prime * result + ((this.ssldRepository == null) ? 0 : this.ssldRepository.hashCode()); return result; }</code><technical_language>java.util.Objects</technical_language>

Target:
public int hashCode() { return super.hashCode() + Objects.hash(this.helper, this.ssldRepository); }
Source:
<code>public PatientData<List<OntologyTerm>> load(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { throw new NullPointerException("The patient does not have a PatientClass"); } Map<String, List<OntologyTerm>> result = new LinkedHashMap<>(); for (String propertyName : getProperties()) { Object propertyValue = data.get(propertyName); List<OntologyTerm> holder = new LinkedList<>(); if (propertyValue instanceof StringProperty) { String propertyValueString = data.getStringValue(propertyName); addTerms(propertyValueString, holder); } else if (propertyValue instanceof DBStringListProperty) { for (String item : ((DBStringListProperty) propertyValue).getList()) { addTerms(item, holder); } } result.put(propertyName, holder); } <START> return new DictionaryPatientData<>(GlobalQualifiersController.DATA_NAME, result); <END> } catch (Exception e) { this.logger.error("Could not find requested document"); } return null; }</code><technical_language>this change</technical_language>

Target:
public PatientData<List<OntologyTerm>> load(Patient patient) { try { XWikiDocument doc = (XWikiDocument) this.documentAccessBridge.getDocument(patient.getDocument()); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { throw new NullPointerException("The patient does not have a PatientClass"); } Map<String, List<OntologyTerm>> result = new LinkedHashMap<>(); for (String propertyName : getProperties()) { Object propertyValue = data.get(propertyName); List<OntologyTerm> holder = new LinkedList<>(); if (propertyValue instanceof StringProperty) { String propertyValueString = data.getStringValue(propertyName); addTerms(propertyValueString, holder); } else if (propertyValue instanceof DBStringListProperty) { for (String item : ((DBStringListProperty) propertyValue).getList()) { addTerms(item, holder); } } result.put(propertyName, holder); } return new DictionaryPatientData<>(DATA_NAME, result); } catch (Exception e) { this.logger.error("Could not find requested document"); } return null; }
Source:
<code>protected void onPublish(final IMediaStream stream, final String entryId) { if(stream.getClientId() < 0){ logger.debug("Stream [" + stream.getName() + "] entry [" + entryId + "] is a transcoded rendition"); return; } String streamName = stream.getName(); logger.debug("Stream [" + streamName + "] entry [" + entryId + "]"); <START> ILiveStreamManager liveManager = KalturaServer.getManager(ILiveStreamManager.class); <END> liveManager.addReferrer(entryId, this); final Timer t; synchronized (streams) { if (streams.containsKey(stream)) { logger.debug("Stream with name " + streamName + " already exists in streams map"); t = streams.get(stream); } else { logger.debug("Stream with name " + streamName + " does not exist in streams map. creating a new map entry."); t = new Timer(); streams.put(stream, t); } } logger.debug("Running timer to create sync points for stream " + streamName); startSyncPoints(t, stream, entryId); }</code><technical_language>member inherited KalturaCuePointsManager (although I understand in place)</technical_language>

Target:
protected void onPublish(final IMediaStream stream, final String entryId) { if(stream.getClientId() < 0){ logger.debug("Stream [" + stream.getName() + "] entry [" + entryId + "] is a transcoded rendition"); return; } String streamName = stream.getName(); logger.debug("Stream [" + streamName + "] entry [" + entryId + "]"); liveManager.addReferrer(entryId, this); final Timer t; synchronized (streams) { if (streams.containsKey(streamName)) { logger.error("Stream with name " + streamName + " already exists in streams map"); t = streams.get(streamName); } else { logger.debug("Stream with name " + streamName + " does not exist in streams map. creating a new map entry."); t = new Timer(); streams.put(streamName, t); } } logger.debug("Running timer to create sync points for stream " + streamName); startSyncPoints(t, stream, entryId); }
Source:
<code>private void setBulkOptions(BulkRequest bulkRequest, BulkOptions bulkOptions) { <START> if (bulkOptions != null) { <END> if (bulkOptions.getTimeout() != null) { bulkRequest.timeout(bulkOptions.getTimeout()); } if (bulkOptions.getRefreshPolicy() != null) { bulkRequest.setRefreshPolicy(bulkOptions.getRefreshPolicy()); } if (bulkOptions.getWaitForActiveShards() != null) { bulkRequest.waitForActiveShards(bulkOptions.getWaitForActiveShards()); } if (bulkOptions.getPipeline() != null) { bulkRequest.pipeline(bulkOptions.getPipeline()); } if (bulkOptions.getRoutingId() != null) { bulkRequest.routing(bulkOptions.getRoutingId()); } } }</code><technical_language>reduce scope do earlier return if bulkOptions is null</technical_language>

Target:
private void setBulkOptions(BulkRequest bulkRequest, BulkOptions bulkOptions) { if (bulkOptions.getTimeout() != null) { bulkRequest.timeout(bulkOptions.getTimeout()); } if (bulkOptions.getRefreshPolicy() != null) { bulkRequest.setRefreshPolicy(bulkOptions.getRefreshPolicy()); } if (bulkOptions.getWaitForActiveShards() != null) { bulkRequest.waitForActiveShards(bulkOptions.getWaitForActiveShards()); } if (bulkOptions.getPipeline() != null) { bulkRequest.pipeline(bulkOptions.getPipeline()); } if (bulkOptions.getRoutingId() != null) { bulkRequest.routing(bulkOptions.getRoutingId()); } }
Source:
<code>private void initializeServices(boolean persisting) throws ServiceLifecycleException, GatewayConfigurationException { <START> GatewayConfig config = getGatewayConfig(); <END> Map<String,String> options = new HashMap<>(); options.put(GatewayCommandLine.PERSIST_LONG, Boolean.toString(persisting)); if (master != null) { options.put("master", master); } services.init(config, options); }</code><technical_language>KnoxCLI need fail if server's Kerberos config is correct</technical_language>

Target:
private void initializeServices(boolean persisting) throws ServiceLifecycleException { GatewayConfig config = getGatewayConfig(); Map<String,String> options = new HashMap<>(); options.put(GatewayCommandLine.PERSIST_LONG, Boolean.toString(persisting)); if (master != null) { options.put("master", master); } services.init(config, options); }
Source:
<code>private StatementStats execute(ClientSession session, String query, Consumer<QueryData> queryDataConsumer, Consumer<QueryError> queryErrorConsumer) { try (StatementClient client = new StatementClient(okHttpClient, session, query)) { <START> while (client.isRunning() && client.advance()) { <END> queryDataConsumer.accept(client.currentData()); } if (client.isAborted()) { throw new IllegalStateException("Query aborted by user"); } if (client.isCommunicationFailure()) { throw new IllegalStateException("Query is gone (server restarted?)"); } QueryError resultsError = client.finalStatusInfo().getError(); if (resultsError != null) { queryErrorConsumer.accept(resultsError); } return client.finalStatusInfo().getStats(); } }</code><technical_language>This originally wrong. call advance() eagerly, miss page of data</technical_language>

Target:
private StatementStats execute(ClientSession session, String query, Consumer<QueryData> queryDataConsumer, Consumer<QueryError> queryErrorConsumer) { try (StatementClient client = new StatementClient(okHttpClient, session, query)) { while (client.isRunning()) { queryDataConsumer.accept(client.currentData()); if (!client.advance()) { break; } } if (client.isClientAborted()) { throw new IllegalStateException("Query aborted by user"); } if (client.isClientError()) { throw new IllegalStateException("Query is gone (server restarted?)"); } verify(client.isFinished()); QueryError resultsError = client.finalStatusInfo().getError(); if (resultsError != null) { queryErrorConsumer.accept(resultsError); } return client.finalStatusInfo().getStats(); } }