auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
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(); if (processingTimeMinutes > 5) { potentiallyStuck++; logger.warn("Workflow instance has been processed for minutes, it may be stuck.", entry.getKey(), processingTimeMinutes); } } } return potentiallyStuck; }

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:
@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" + "\tcast(\"product\".\"product_id\" as varchar), \n" + "\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(); }

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:
public static boolean isRecoveredFromCrash() { return sharedPreferences != null && sharedPreferences.getBoolean(RECOVERED_FROM_CRASH, false); }

Target:
private boolean isRecoveredFromCrash() { return PreferenceManager.getDefaultSharedPreferences(this).getBoolean(RECOVERED_FROM_CRASH, false); }
Source:
private String generateOvfReaderErrorMessage(OvfReader ovf, Exception ex) { StringBuilder message = new StringBuilder(); message.append("OVF error: ") .append(ovf.getName()) .append(": cannot read '") .append(ovf.getLastReadEntry()) .append("' with value: ") .append(ex.getMessage()); return message.toString(); }

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:
public GridDhtPartitionDemander(CacheGroupContext grp) { assert grp != null; this.grp = grp; ctx = grp.shared(); log = ctx.logger(getClass()); boolean enabled = grp.rebalanceEnabled() && !ctx.kernalContext().clientNode(); rebalanceFut = new RebalanceFuture(); if (!enabled) { rebalanceFut.onDone(true); syncFut.onDone(); } Map<Integer, Object> tops = new HashMap<>(); rebalanceTopic = GridCachePartitionExchangeManager.rebalanceTopic(0); String metricGroupName = metricName(CACHE_GROUP_METRICS_PREFIX, grp.cacheOrGroupName()); MetricRegistry mreg = grp.shared().kernalContext().metric().registry(metricGroupName); mreg.register("RebalancingPartitionsLeft", () -> rebalanceFut.remaining.values().stream() .map(IgniteDhtDemandedPartitionsMap::fullSet) .mapToInt(Collection::size) .sum(), "Number of rebalanced partitions left."); mreg.register("RebalancingReceivedKeys", () -> rebalanceFut.rebalancingReceivedKeys.get(), "Number of already rebalanced keys."); mreg.register("RebalancingReceivedBytes", () -> rebalanceFut.rebalancingReceivedBytes.get(), "Number of already rebalanced bytes."); mreg.register("RebalancingStartTime", () -> rebalanceFut.rebalancingStartTime, "Rebalancing start time."); mreg.register("RebalancingFinishTime", () -> rebalanceFut.rebalancingFinishTime, "Rebalancing finish time."); }

Target:
public GridDhtPartitionDemander(CacheGroupContext grp) { assert grp != null; this.grp = grp; ctx = grp.shared(); log = ctx.logger(getClass()); boolean enabled = grp.rebalanceEnabled() && !ctx.kernalContext().clientNode(); rebalanceFut = new RebalanceFuture(); if (!enabled) { rebalanceFut.onDone(true); syncFut.onDone(); } Map<Integer, Object> tops = new HashMap<>(); rebalanceTopic = GridCachePartitionExchangeManager.rebalanceTopic(0); String metricGroupName = metricName(CACHE_GROUP_METRICS_PREFIX, grp.cacheOrGroupName()); MetricRegistry mreg = grp.shared().kernalContext().metric().registry(metricGroupName); mreg.register("RebalancingPartitionsLeft", () -> rebalanceFut.partitionsLeft.get(), "The number of cache group partitions left to be rebalanced."); mreg.register("RebalancingReceivedKeys", () -> rebalanceFut.receivedKeys.get(), "The number of currently rebalanced keys for the whole cache group."); mreg.register("RebalancingReceivedBytes", () -> rebalanceFut.receivedBytes.get(), "The number of currently rebalanced bytes of this cache group."); mreg.register("RebalancingStartTime", () -> rebalanceFut.startTime, "The time the first partition " + "demand message was sent. If there are no messages to send, the rebalancing time will be undefined."); mreg.register("RebalancingEndTime", () -> rebalanceFut.endTime, "The time the rebalancing was " + "completed. If the rebalancing completed with an error, was cancelled, or the start time was undefined, " + "the rebalancing end time will be undefined."); mreg.register("RebalancingLastCancelledTime", () -> lastCancelledTime.get(), "The time the " + "rebalancing was completed with an error or was cancelled. If there were several such cases, the metric " + "stores the last time. The metric displays the value even if there is no rebalancing process."); }
Source:
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) { Set<Node<E>> parents = input.getParents(); for (Node<E> parent : parents) { if (!consumedNodes.contains(parent) && !input.getChildren().contains(parent)) { return false; } } return true; } }); nextIterable.clear(); }

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:
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); } println("Using encoding " + encoding); 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"); } }

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:
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(), false ); } } }

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:
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) { e.printStackTrace(); }catch (JMException e) { throw new QueueManagerException("Error checking if queue " + queueName + " exists.", e); } }

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:
private static boolean assertIDNotEmpty(String id) { if (id == null || "".equals(id)) { if (log.isDebugEnabled()) { log.debug("Provided id is empty or null ,returning a null as JsonPath"); } return false; } return true; }

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:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case LOGIN: this.showFirebaseLoginPrompt(); return true; case LOGOUT: this.logout(); return true; } return super.onOptionsItemSelected(item); }

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:
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) { if (containsAny(allResourcesClasses, res.getHandlerClasses())) { 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(); }

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:
private @Nullable AmmoStorage findSpareAmmo(AmmoType ammoType) { return (AmmoStorage) getWarehouse().findSparePart(part -> { if (!isAvailableAsSpareAmmo(part)) { return false; } return ((AmmoStorage) part).isSameAmmoType(ammoType); }); }

Target:
private @Nullable AmmoStorage findSpareAmmo(AmmoType ammoType) { return (AmmoStorage) getWarehouse().findSparePart(part -> { return isAvailableAsSpareAmmo(part) && ((AmmoStorage) part).isSameAmmoType(ammoType); }); }
Source:
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).orElse(0.0); minimumWidth = Math.max(minimumWidth, ecv.getMinimumWidth().orElse(0.0) + padding * 2); } } } } return minimumWidth; }

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:
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 ModuleEntryModel.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); } }

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:
public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException { upload.setForFailedJobs(true); try { upload.perform(getCredentialsId(), run, workspace, listener); } catch (UploadException e) { throw new IOException("Could not perform upload", e); } }

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:
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."); }

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:
public void push(RowMap r) throws Exception { if (r instanceof DDLMap && !outputDDL) { return; } 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); }

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:
protected void mergeCluster(String cacheName) { getLog().debugf("Merging cluster"); partition(0).merge(partition(1)); TestingUtil.waitForRehashToComplete(caches(cacheName)); getLog().debugf("Cluster merged"); }

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

Target:
public void test2GhzHighQuality5GhzAvailable() { testStayOrSwitch(mThresholdQualifiedRssi2G, false, mThresholdQualifiedRssi5G - 1, true, true); }
Source:
private void createDanglingObjectHandler() { poolOfString.take(); }

Target:
private String createDanglingObjectHandler() { return poolOfString.take().get(); }
Source:
public ValidationResult isDomainHasSpaceForRequest(final long requestedSize, final boolean useThresHold) { long size = useThresHold ? getLowDiskSpaceThreshold() : 0; 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; }

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:
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()); StorageHelperBase.addMessageToAuditLog(AuditLogType.NO_LIBRBD_PACKAGE_AVAILABLE_ON_VDS, null, vds.getName()); return new Pair<>(false, null); } return registerLibvirtSecrets(storageDomain, vds, libvirtSecrets); }

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:
default S locales(Locale... locales) { locales( new HashSet<>( Arrays.asList( locales ) ) ); return (S) this; }

Target:
default S locales(Locale... locales) { return locales( new HashSet<>( Arrays.asList( locales ) ) ); }
Source:
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, nullString); 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; }

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:
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 from dual"); 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(); }

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:
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) { node.attributes = new ArrayList<>(attributeCount * 2); 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; }

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:
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(); System.out.println(" get number of pages has ben executed "+result); } catch (IOException e) { System.out.println(e); } } return result; }

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:
private void closeTempFile() throws IOException { for (String encodedPartition: tempFiles.keySet()) { closeTempFile(encodedPartition); } lastRotate = System.currentTimeMillis(); }

Target:
private void closeTempFile() throws IOException { for (String encodedPartition: tempFiles.keySet()) { closeTempFile(encodedPartition); } }
Source:
public int hashCode() { 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; }

Target:
public int hashCode() { return super.hashCode() + Objects.hash(this.helper, this.ssldRepository); }
Source:
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<>(GlobalQualifiersController.DATA_NAME, result); } catch (Exception e) { this.logger.error("Could not find requested document"); } return null; }

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:
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 + "]"); ILiveStreamManager liveManager = KalturaServer.getManager(ILiveStreamManager.class); 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); }

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:
private void setBulkOptions(BulkRequest bulkRequest, BulkOptions bulkOptions) { if (bulkOptions != null) { 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()); } } }

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:
private void initializeServices(boolean persisting) throws ServiceLifecycleException, GatewayConfigurationException { 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); }

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:
private StatementStats execute(ClientSession session, String query, Consumer<QueryData> queryDataConsumer, Consumer<QueryError> queryErrorConsumer) { try (StatementClient client = new StatementClient(okHttpClient, session, query)) { while (client.isRunning() && client.advance()) { 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(); } }

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(); } }
Source:
public void canDoubleClickOnStyledText() throws Exception { bot.checkBox("Listen").select(); styledText = bot.styledTextInGroup("StyledText"); styledText.setText("This is sample text"); bot.button("Clear").click(); SWTBotText text = bot.textInGroup("Listeners"); styledText.doubleClick(0, 1); verifyNotifyClick(); assertEventMatches(text, "MouseDown [3]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.NONE, styledText.widget) + " x=0 y=0 count=2"); assertEventMatches(text, "MouseDoubleClick [8]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.NONE, styledText.widget) + " x=0 y=0 count=2}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.BUTTON1, styledText.widget) + " x=0 y=0 count=2"); }

Target:
public void canDoubleClickOnStyledText() throws Exception { final int line = 0, column = 6; bot.checkBox("Listen").select(); styledText = bot.styledTextInGroup("StyledText"); styledText.setText("This is sample text"); bot.button("Clear").click(); styledText.doubleClick(line, column); assertEquals(new Position(line, column - 1), styledText.cursorPosition(true)); assertEquals(styledText.getSelection(), "is"); verifyNotifyClick(0); SWTBotText text = bot.textInGroup("Listeners"); assertEventMatches(text, "MouseDown [3]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.NONE, styledText.widget) + " x=0 y=0 count=2"); assertEventMatches(text, "MouseDoubleClick [8]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.NONE, styledText.widget) + " x=0 y=0 count=2}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.BUTTON1, styledText.widget) + " x=0 y=0 count=2"); }