auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private MediaModel getMediaFromQueueById(int id) { <START> if (mQueue != null && mQueue.size() > 0) { <END> for (MediaModel media : mQueue) { if (media.getId() == id) return media; } } return null; }</code><technical_language>getUploadQueue() instead of mQueue for consistency (like in getNextMediaToUpload() below)</technical_language>

Target:
private MediaModel getMediaFromQueueById(int id) { List<MediaModel> queue = getUploadQueue(); for (MediaModel media : queue) { if (media.getId() == id) return media; } return null; }
Source:
<code>protected boolean checkHash(ByteBuffer data) throws NoSuchAlgorithmException { byte[] calculatedHash = Torrent.hash(data); int torrentHashPosition = getIndex() * Torrent.PIECE_HASH_SIZE; for (int i = 0; i < Torrent.PIECE_HASH_SIZE; i++) { <START> byte value = this.torrentHash.get(torrentHashPosition + i); <END> if (value != calculatedHash[i]) { return false; } } return true; }</code><technical_language>Fetching byte byte a direct buffer is faster fetching</technical_language>

Target:
protected boolean checkHash(ByteBuffer data) throws NoSuchAlgorithmException { byte[] calculatedHash = Torrent.hash(data); int torrentHashPosition = getIndex() * Torrent.PIECE_HASH_SIZE; ByteBuffer torrentHash = this.torrent.getPiecesHashes(); for (int i = 0; i < Torrent.PIECE_HASH_SIZE; i++) { byte value = torrentHash.get(torrentHashPosition + i); if (value != calculatedHash[i]) { return false; } } return true; }
Source:
<code>protected PojoMapper<?> createNestedMapper(StatementContext ctx, PojoProperty<T> property, String nestedPrefix) { final Type propertyType = property.getQualifiedType().getType(); return new PojoMapper( GenericTypes.getErasedType(propertyType), ctx.getConfig(PojoTypes.class).propertiesOf(type) <START> .orElseThrow(() -> new UnableToProduceResultException("Couldn't find properties for nested type " + propertyType, ctx)), <END> nestedPrefix); }</code><technical_language>Whoa, this mix match pojo types for nested mappers? ![](<LINK_0></technical_language>

Target:
protected PojoMapper<?> createNestedMapper(StatementContext ctx, PojoProperty<T> property, String nestedPrefix) { final Type propertyType = property.getQualifiedType().getType(); return new PojoMapper( GenericTypes.getErasedType(propertyType), ctx.getConfig(PojoTypes.class).findFor(type) .orElseThrow(() -> new UnableToProduceResultException("Couldn't find properties for nested type " + propertyType, ctx)), nestedPrefix); }
Source:
<code><START> public CloseableIterator<SAMRecord> query(QueryInterval[] intervals, boolean contained) { throw new RuntimeException("query is not implemented."); } <END></code><technical_language>UnsupportedOperationException</technical_language>

Target:
public CloseableIterator<SAMRecord> query(QueryInterval[] intervals, boolean contained) { BAMFileSpan span = new BAMFileSpan(); BrowseableBAMIndex index = getBrowseableIndex(); for (QueryInterval interval : intervals) { BAMFileSpan intervalSpan; if (!contained) { intervalSpan = index.getSpanOverlapping(interval.referenceIndex, interval.start, interval.end); } else { intervalSpan = getSpanContained(interval.referenceIndex, interval.start, interval.end); } span.add(intervalSpan); } return getIterator(span); }
Source:
<code>protected boolean approveMoveRequest(MoveRequest request) { boolean result = request.getElementsToMove().size() > 0; StateMachine targetSM = StateMachineUtils.getStateMachine(request.getTargetContainer()); for (Object e : request.getElementsToMove().keySet()) { if (!(e instanceof Vertex) || (((Vertex) e).eContainer() != null && targetSM != <START> StateMachineUtils.getStateMachine((Vertex) <END> e))) { result = false; break; } } return result; }</code><technical_language>Vertex API a containingStateMachine() operation already</technical_language>

Target:
protected boolean approveMoveRequest(MoveRequest request) { boolean result = request.getElementsToMove().size() > 0; if (request.getTargetContainer() instanceof StateMachine) { StateMachine targetSM = (StateMachine) request.getTargetContainer(); for (Object e : request.getElementsToMove().keySet()) { if (!(e instanceof Vertex) || (((Vertex) e).eContainer() != null && targetSM != ((Vertex) e).containingStateMachine())) { result = false; break; } } } return result; }
Source:
<code>public boolean isEnabled() { return getProjectsInRepositoryOfSelectedResources().length > 0 <START> && selectionMapsToSingleRepository(); <END> }</code><technical_language>This regresses in longer works for multiple repositories</technical_language>

Target:
public boolean isEnabled() { return getProjectsInRepositoryOfSelectedResources().length > 0; }
Source:
<code>public void clone(Long serverID, BinlogPosition position) throws SchemaStoreException { List<ResolvedSchemaChange> empty = Collections.emptyList(); try (Connection c = maxwellConnectionPool.getConnection()) { getSchema(); MysqlSavedSchema cloned = new MysqlSavedSchema(serverID, caseSensitivity, getSchema(), position, savedSchema.getSchemaID(), empty); Long schemaId = cloned.save(c); String logMessage = "clone schema @" + position + " based on id " + savedSchema.getSchemaID(); if (schemaId != null) { logMessage += ", new schema id is " + schemaId; } <START> LOGGER.info(logMessage); <END> } catch ( SQLException e ) { throw new SchemaStoreException(e); } }</code><technical_language>String.valueOf(schemaId) (and above) if care is avoiding NPE</technical_language>

Target:
public void clone(Long serverID, BinlogPosition position) throws SchemaStoreException { List<ResolvedSchemaChange> empty = Collections.emptyList(); try (Connection c = maxwellConnectionPool.getConnection()) { getSchema(); MysqlSavedSchema cloned = new MysqlSavedSchema(serverID, caseSensitivity, getSchema(), position, savedSchema.getSchemaID(), empty); Long schemaId = cloned.save(c); LOGGER.info("clone schema @" + position + " based on id " + savedSchema.getSchemaID() + ", new schema id is " + schemaId); } catch ( SQLException e ) { throw new SchemaStoreException(e); } }
Source:
<code>private static void readAndAssertBytesRead(FSDataInputStream inputStream, int bytesToRead) throws IOException { <START> assertEquals("S3AInputStream#read did not read the correct number of " + <END> "bytes", bytesToRead, inputStream.read(new byte[bytesToRead])); }</code><technical_language>ABFS</technical_language>

Target:
private static void readAndAssertBytesRead(FSDataInputStream inputStream, int bytesToRead) throws IOException { assertEquals("AbfsInputStream#read did not read the correct number of " + "bytes", bytesToRead, inputStream.read(new byte[bytesToRead])); }
Source:
<code>public Response toResponse(JsonProcessingException exception) { if (exception instanceof JsonGenerationException || exception instanceof InvalidDefinitionException) { return super.toResponse(exception); } <START> if (LOGGER.isDebugEnabled()) { <END> LOGGER.debug("Unable to process JSON", exception); } final String message = exception.getOriginalMessage(); final ErrorMessage errorMessage = new ErrorMessage(Response.Status.BAD_REQUEST.getStatusCode(), "Unable to process JSON", showDetails ? message : null); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON_TYPE) .entity(errorMessage) .build(); }</code><technical_language>me, fancy is log format, isDebugEnabled is necessary, considering debug calls isDebugEnabled logging</technical_language>

Target:
public Response toResponse(JsonProcessingException exception) { if (exception instanceof JsonGenerationException || exception instanceof InvalidDefinitionException) { return super.toResponse(exception); } LOGGER.debug("Unable to process JSON", exception); final String message = exception.getOriginalMessage(); final ErrorMessage errorMessage = new ErrorMessage(Response.Status.BAD_REQUEST.getStatusCode(), "Unable to process JSON", showDetails ? message : null); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON_TYPE) .entity(errorMessage) .build(); }
Source:
<code>Integer throwsException() { <START> if ((random ^ random) == 0) throw new RuntimeException(); <END> return 1; }</code><technical_language>random ^ random == false ... <LINK_0></technical_language>

Target:
Integer throwsException() { throw new RuntimeException(); }
Source:
<code>private long callApplyBinaryLogEE(ByteBuffer paramBuffer, long txnId, long spHandle, long uniqueId, int remoteClusterId, long remoteUniqueId) throws EEException { try { return m_ee.applyBinaryLog(paramBuffer, txnId, spHandle, m_lastCommittedSpHandle, uniqueId, remoteClusterId, getNextUndoToken(m_currentTxnId)); } catch(DRTableNotFoundException e) { <START> DRTableNotFoundException tableNotFound = (DRTableNotFoundException) e; <END> tableNotFound.setRemoteTxnUniqueId(remoteUniqueId); tableNotFound.setCatalogVersion(getSystemProcedureExecutionContext().getCatalogVersion()); throw e; } }</code><technical_language>This cast necessary catch declaration guarantees type in this block</technical_language>

Target:
private long callApplyBinaryLogEE(ByteBuffer paramBuffer, long txnId, long spHandle, long uniqueId, int remoteClusterId, long remoteUniqueId) throws EEException { try { return m_ee.applyBinaryLog(paramBuffer, txnId, spHandle, m_lastCommittedSpHandle, uniqueId, remoteClusterId, getNextUndoToken(m_currentTxnId)); } catch(DRTableNotFoundException e) { e.setRemoteTxnUniqueId(remoteUniqueId); e.setCatalogVersion(getSystemProcedureExecutionContext().getCatalogVersion()); throw e; } }
Source:
<code>protected void Perform() { final VM vm = getVm(); setSucceeded(Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.VmLogoff, new VmLogoffVDSCommandParameters(getVdsId(), vm.getvm_guid(), mForce)).getSucceeded()); if (getSucceeded()) { vm.setguest_cur_user_name(null); vm.setguest_cur_user_id(null); <START> DbFacade.getInstance().getVmDynamicDAO().update(vm.getDynamicData()); <END> } }</code><technical_language>i succeeded set true db update</technical_language>

Target:
protected void Perform() { final VM vm = getVm(); final boolean sentToVM = Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.VmLogoff, new VmLogoffVDSCommandParameters(getVdsId(), vm.getvm_guid(), mForce)).getSucceeded(); if (sentToVM) { vm.setguest_cur_user_name(null); vm.setguest_cur_user_id(null); DbFacade.getInstance().getVmDynamicDAO().update(vm.getDynamicData()); } setSucceeded(sentToVM); }
Source:
<code>public void destroy() { if (out != null) { <START> IOUtils.closeQuietly(out); <END> } FileUtils.deleteQuietly(tempData); super.destroy(); }</code><technical_language>I closeQuietly accepts a null parameter, if necessary</technical_language>

Target:
public void destroy() { IOUtils.closeQuietly(out); FileUtils.deleteQuietly(tempData); super.destroy(); }
Source:
<code>private void parseSuite(String suitePath) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("suiteXmlPath: \"" + suitePath + "\""); } try { Collection<XmlSuite> allSuites = Parser.parse(suitePath, getProcessor()); for (XmlSuite s : allSuites) { s.setParallel(this.m_parallelMode); s.setThreadCount(this.m_threadCount); if (m_testNames != null) { XmlSuiteUtils.cloneIfContainsTestsWithNamesMatchingAny(s, m_testNames); List<String> missMatchedTestname = XmlSuiteUtils.getMissMatchedTestNames(m_testNames); if (CollectionUtils.hasElements(missMatchedTestname)) { XmlSuiteUtils.resetField(); <START> throw new TestNGException("The test(s) <" + Arrays.toString(missMatchedTestname.toArray()) <END> + "> cannot be found."); } else { m_suites.addAll(XmlSuiteUtils.getCloneSuite()); XmlSuiteUtils.resetField(); } } else { m_suites.add(s); } } } catch (IOException e) { e.printStackTrace(System.out); } catch (Exception ex) { Throwable t = ex; while (t.getCause() != null) { t = t.getCause(); } if (t instanceof TestNGException) { throw (TestNGException) t; } throw new TestNGException(t); } }</code><technical_language>I remove Arrays.toString() call here. List.toString() sufficient</technical_language>

Target:
private void parseSuite(String suitePath) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("suiteXmlPath: \"" + suitePath + "\""); } try { Collection<XmlSuite> allSuites = Parser.parse(suitePath, getProcessor()); for (XmlSuite s : allSuites) { s.setParallel(this.m_parallelMode); s.setThreadCount(this.m_threadCount); if (m_testNames == null) { m_suites.add(s); continue; } TestNamesMatcher testNamesMatcher = new TestNamesMatcher(s, m_testNames); List<String> missMatchedTestname = testNamesMatcher.getMissMatchedTestNames(); if (!missMatchedTestname.isEmpty()) { throw new TestNGException("The test(s) <" + missMatchedTestname + "> cannot be found."); } m_suites.addAll(testNamesMatcher.getSuitesMatchingTestNames()); } } catch (IOException e) { e.printStackTrace(System.out); } catch (Exception ex) { Throwable t = ex; while (t.getCause() != null) { t = t.getCause(); } if (t instanceof TestNGException) { throw (TestNGException) t; } throw new TestNGException(t); } }
Source:
<code>protected void doValidate(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, BugzillaRestException { int statusCode = response.getStatusCode(); <START> if (statusCode != 400 && statusCode != 200) { <END> if (statusCode == HttpStatus.SC_NOT_FOUND) { throw new BugzillaRestResourceNotFoundException( NLS.bind("Requested resource ''{0}'' does not exist", response.getRequestPath())); } throw new BugzillaRestException(NLS.bind("Unexpected response from Bugzilla REST server for ''{0}'': {1}", response.getRequestPath(), HttpUtil.getStatusText(statusCode))); } }</code><technical_language>do handle 400 differently other errors</technical_language>

Target:
protected void doValidate(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, BugzillaRestException { int statusCode = response.getStatusCode(); if (statusCode != HttpURLConnection.HTTP_BAD_REQUEST && statusCode != HttpURLConnection.HTTP_OK) { if (statusCode == HttpStatus.SC_NOT_FOUND) { throw new BugzillaRestResourceNotFoundException( NLS.bind("Requested resource ''{0}'' does not exist", response.getRequestPath())); } throw new BugzillaRestException(NLS.bind("Unexpected response from Bugzilla REST server for ''{0}'': {1}", response.getRequestPath(), HttpUtil.getStatusText(statusCode))); } }
Source:
<code>public URI getUri() { <START> return UriBuilder.fromUri(getBaseUri()) .path(ResourceUris.DHCPV6_HOSTS) .path(clientIdToUri(clientId)) .build(); <END> }</code><technical_language>Nit: this be: absoluteUri(DHCPV6_HOSTS, clientId)</technical_language>

Target:
public URI getUri() { return absoluteUri(ResourceUris.DHCPV6_HOSTS, clientIdToUri(clientId)); }
Source:
<code>private static boolean isRetryable(Throwable error) { <START> if (!(error instanceof RetrofitError)) { <END> return false; } RetrofitError retrofitError = (RetrofitError) error; if (retrofitError.getKind() == Kind.NETWORK) { return true; } if (retrofitError.getKind() == Kind.HTTP && retrofitError.getResponse().getStatus() != HttpStatus.BAD_REQUEST.value()) { return true; } return false; }</code><technical_language>Extra space instanceof</technical_language>

Target:
private static boolean isRetryable(Throwable error) { if (!(error instanceof RetrofitError)) { return false; } RetrofitError retrofitError = (RetrofitError) error; if (retrofitError.getKind() == Kind.NETWORK) { return true; } if (retrofitError.getKind() == Kind.HTTP) { Response response = retrofitError.getResponse(); return (response != null && response.getStatus() != HttpStatus.BAD_REQUEST.value()); } return false; }
Source:
<code>public void sendEndOfStream(SystemStream systemStream, int taskCount) { log.info("Send end-of-stream messages to all partitions of " + systemStream); String stream = systemStream.getStream(); <START> SystemStreamMetadata metadata = sysAdmins.get(systemStream.getSystem()) <END> .getSystemStreamMetadata(Collections.singleton(stream)) .get(stream); int partitionCount = metadata.getSystemStreamPartitionMetadata().size(); for (int i = 0; i < partitionCount; i++) { String key = String.format(EOS_KEY_FORMAT, stream, taskName); EndOfStreamMessage message = new EndOfStreamMessage(taskName, taskCount); OutgoingMessageEnvelope envelopeOut = new OutgoingMessageEnvelope(systemStream, i, key, message); collector.send(envelopeOut); } }</code><technical_language>So, instead of passing in map of SystemAdmins in constructor, StreamMetadataCache here? include a bunch of error handling code well, null pointer validation etc. Otherwise, need repeat error handling code well</technical_language>

Target:
void sendEndOfStream(SystemStream systemStream, int taskCount) { log.info("Send end-of-stream messages with upstream task count to all partitions of {}", taskCount, systemStream); final EndOfStreamMessage message = new EndOfStreamMessage(taskName, taskCount); ControlMessageUtils.sendControlMessage(message, systemStream, metadataCache, collector); }
Source:
<code>private Map<Guid, List<AsyncTasks>> groupTasksByRootCommandId(List<AsyncTasks> tasksInDB) { Map<Guid, List<AsyncTasks>> rootCommandIdToCommandsMap = new HashMap<>(); for (AsyncTasks task : tasksInDB) { Guid rootCommandId = task.getRootCommandId(); if (!rootCommandIdToCommandsMap.containsKey(rootCommandId)) { rootCommandIdToCommandsMap.put(rootCommandId, new ArrayList<AsyncTasks>()); } <START> rootCommandIdToCommandsMap.get(rootCommandId).add(task); <END> } return rootCommandIdToCommandsMap; }</code><technical_language>MultiValueMapUtils</technical_language>

Target:
private Map<Guid, List<AsyncTasks>> groupTasksByRootCommandId(List<AsyncTasks> tasksInDB) { Map<Guid, List<AsyncTasks>> rootCommandIdToCommandsMap = new HashMap<>(); for (AsyncTasks task : tasksInDB) { Guid rootCommandId = task.getRootCommandId(); if (!rootCommandIdToCommandsMap.containsKey(rootCommandId)) { rootCommandIdToCommandsMap.put(rootCommandId, new ArrayList<AsyncTasks>()); } MultiValueMapUtils.addToMap(rootCommandId, task, rootCommandIdToCommandsMap); } return rootCommandIdToCommandsMap; }
Source:
<code>public void migrate(Connection connection) throws Exception { <START> long viewId = VIEW_SERVICE.getDefaultViewId(); <END> makeInsert(viewId,connection); }</code><technical_language>Note this add bundle system default view. role-specific views views users saved. layers in sample app this bundle? another example for thing, code relevant views: <LINK_0></technical_language>

Target:
public void migrate(Connection connection) throws Exception { if(PropertyUtil.getOptional("flyway.sample.1_0_12.skip", true)) { return; } long viewId = VIEW_SERVICE.getDefaultViewId(); makeInsert(viewId,connection); }
Source:
<code>private boolean allow(Message message) { <START> MessageContent messageContent = new MessageContent.Builder() <END> .withContentType(message.getContentType()) .withSchema(message.getSchema()) .withData(message.getData()) .build(); FilterResult result = filterChain.apply(messageContent); filteredMessageHandler.handle(result, message, subscription, (offset) -> receiver.commit(singleton(offset))); return !result.isFiltered(); }</code><technical_language>this extracted a method</technical_language>

Target:
private boolean allow(Message message) { FilterResult result = filterChain.apply(getMessageContent(message)); filteredMessageHandler.handle(result, message, subscription); return !result.isFiltered(); }
Source:
<code>public void setSessionTimeout(Duration duration) { <START> throw new NotImplementedException("operation not supported by JettyReactiveWebServerFactory"); <END> }</code><technical_language>I guess this is fine, UnsupportedOperationException is default exception in this situation</technical_language>

Target:
public void setSessionTimeout(Duration duration) { throw new UnsupportedOperationException("operation not supported by JettyReactiveWebServerFactory"); }
Source:
<code>protected void executeImport(ImportVmFromExportDomainModel importVmModel) { importVmModel.importVms( new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { <START> VmListModel.this.setWindow(null); <END> } }, cloneObjectMap); }</code><technical_language>call setWindow(null) whithout explicit reference outer this</technical_language>

Target:
protected void executeImport(ImportVmFromExportDomainModel importVmModel) { importVmModel.importVms( new IFrontendMultipleActionAsyncCallback() { @Override public void executed(FrontendMultipleActionAsyncResult result) { setWindow(null); } }, cloneObjectMap); }
Source:
<code>public ProcessTaskWrapper<Integer> stopIptablesAsync(final SshMachineLocation machine) { log.info("Stopping iptables for at {}", entity(), machine); List<String> cmds = ImmutableList.<String>of(); <START> if (isLocationFirewalldEnabled(machine)) { <END> cmds = ImmutableList.of(IptablesCommands.firewalldServiceStop(), IptablesCommands.firewalldServiceStatus()); } else { cmds = ImmutableList.of(IptablesCommands.iptablesServiceStop(), IptablesCommands.iptablesServiceStatus()); } ProcessTaskFactory<Integer> stopIptables = SshTasks.newSshExecTaskFactory(machine, cmds.toArray(new String[cmds.size()])) .summary("stop iptables"); return DynamicTasks.queue(stopIptables); }</code><technical_language>convert this a task</technical_language>

Target:
public Task<Void> stopIptablesAsync(final SshMachineLocation machine) { return DynamicTasks.queue("stop iptables", new Runnable() { public void run() { stopIptablesImpl(machine); } }); }
Source:
<code>public Collection<BaragonConfigFile> generateConfigsForProject(ServiceContext snapshot) throws MissingTemplateException { final Collection<BaragonConfigFile> files = Lists.newArrayList(); <START> String templateName = snapshot.getService().getTemplate() != null ? snapshot.getService().getTemplate() : "default"; <END> List<LbConfigTemplate> matchingTemplates = templates.get(templateName); if (templates.get(templateName) != null) { for (LbConfigTemplate template : matchingTemplates) { final String filename = String.format(template.getFilename(), snapshot.getService().getServiceId()); final StringWriter sw = new StringWriter(); try { template.getTemplate().apply(snapshot, sw); } catch (Exception e) { throw Throwables.propagate(e); } files.add(new BaragonConfigFile(String.format("%s/%s", loadBalancerConfiguration.getRootPath(), filename), sw.toString())); } } else { throw new MissingTemplateException(String.format("MissingTemplateException : Template %s could not be found", templateName)); } return files; }</code><technical_language>consider making template field optional -- do getTemplate().or("default")</technical_language>

Target:
public Collection<BaragonConfigFile> generateConfigsForProject(ServiceContext snapshot) throws MissingTemplateException { final Collection<BaragonConfigFile> files = Lists.newArrayList(); String templateName = snapshot.getService().getTemplateName().or(BaragonAgentServiceModule.DEFAULT_TEMPLATE_NAME); List<LbConfigTemplate> matchingTemplates = templates.get(templateName); if (templates.get(templateName) != null) { for (LbConfigTemplate template : matchingTemplates) { final String filename = String.format(template.getFilename(), snapshot.getService().getServiceId()); final StringWriter sw = new StringWriter(); try { template.getTemplate().apply(snapshot, sw); } catch (Exception e) { throw Throwables.propagate(e); } files.add(new BaragonConfigFile(String.format("%s/%s", loadBalancerConfiguration.getRootPath(), filename), sw.toString())); } } else { throw new MissingTemplateException(String.format("MissingTemplateException : Template %s could not be found", templateName)); } return files; }
Source:
<code>private void enterCustomOrganizationKey() { while (true) { String organizationKey = Messages.showInputDialog(panel, "Please enter the organization key", "Add Another Organization", null); if (StringUtil.isNotEmpty(organizationKey)) { boolean found = selectOrganizationIfExists(organizationKey); if (!found) { GetOrganizationTask task = new GetOrganizationTask(model.createServerWithoutOrganization(), organizationKey); ProgressManager.getInstance().run(task); if (task.organization() != null) { listModel.add(0, task.organization()); orgList.setSelectedIndex(0); orgList.ensureIndexIsVisible(0); } else if (task.getException() != null) { Messages.showErrorDialog("Failed to fetch organization from SonarQube server: " + task.getException().getMessage(), "Connection Failure"); continue; } else { Messages.showErrorDialog(String.format("Organization '%s' not found. Please enter the key of an existing organization.", organizationKey), "Organization Not Found"); continue; } } } <START> break; <END> } }</code><technical_language>This a matter of taste, I find simpler explicitly break ready. is, if (found) break reduce nesting, task.organization() != null break. 2 continue dropped</technical_language>

Target:
private void enterCustomOrganizationKey() { while (true) { String organizationKey = Messages.showInputDialog(panel, "Please enter the organization key", "Add Another Organization", null); if (StringUtil.isNotEmpty(organizationKey)) { boolean found = selectOrganizationIfExists(organizationKey); if (found) { break; } GetOrganizationTask task = new GetOrganizationTask(model.createServerWithoutOrganization(), organizationKey); ProgressManager.getInstance().run(task); if (task.organization() != null) { listModel.add(0, task.organization()); orgList.setSelectedIndex(0); orgList.ensureIndexIsVisible(0); break; } else if (task.getException() != null) { Messages.showErrorDialog("Failed to fetch organization from SonarQube server: " + task.getException().getMessage(), "Connection Failure"); } else { Messages.showErrorDialog(String.format("Organization '%s' not found. Please enter the key of an existing organization.", organizationKey), "Organization Not Found"); } } } }
Source:
<code>private Optional<CommonTokenStream> getTokenStream(File input) { try { FileInputStream inputStream = new FileInputStream(input); SwiftLexer lexer = new SwiftLexer(new ANTLRInputStream(inputStream)); if (!configuration.debugFlagSet()) { lexer.removeErrorListeners(); lexer.addErrorListener(new ErrorListener()); } <START> inputStream.close(); <END> return Optional.of(new CommonTokenStream(lexer)); } catch (IOException e) { handleIOException(e); } catch (CLIArgumentParserException e) { handleCLIException(e); } return Optional.empty(); }</code><technical_language>move this a finally block I</technical_language>

Target:
private Optional<CommonTokenStream> getTokenStream(File input) { try (FileInputStream inputStream = new FileInputStream(input)) { SwiftLexer lexer = new SwiftLexer(new ANTLRInputStream(inputStream)); if (!configuration.debugFlagSet()) { lexer.removeErrorListeners(); lexer.addErrorListener(new ErrorListener()); } return Optional.of(new CommonTokenStream(lexer)); } catch (IOException e) { handleIOException(e); } catch (CLIArgumentParserException e) { handleCLIException(e); } return Optional.empty(); }
Source:
<code>public void run() { if (WatchDogGlobals.isActive) { long executionDate = System.currentTimeMillis(); long delta = executionDate - previousExecutionDate; boolean deltaIsWithinReasonableBoundaries = delta >= UPDATE_RATE && delta <= UPDATE_RATE * 1.16; if (!deltaIsWithinReasonableBoundaries) { WatchDogLogger.getInstance().logInfo( "System suspend detected!"); intervalManager.closeAllIntervals(new Date( previousExecutionDate + UPDATE_RATE)); intervalManager.generateAndSetSessionSeed(); eventManager.update(new WatchDogEvent(this, EventType.START_IDE)); <START> <END> PerspectiveInterval perspectiveInt = intervalManager .getInterval(PerspectiveInterval.class); if(perspectiveInt != null) { eventManager.update(new WatchDogEvent(perspectiveInt.getPerspectiveType(), EventType.START_PERSPECTIVE)); } } } startTimeCheckerOnce(); previousExecutionDate = System.currentTimeMillis(); }</code><technical_language>Hm, I I this change this part of functionality client side, core (have a classes of TimeSynchronityChecker?). Another solution create additional (possibly empty) method in EventManagerBase is overriden classes</technical_language>

Target:
public void run() { if (WatchDogGlobals.isActive) { long executionDate = System.currentTimeMillis(); long delta = executionDate - previousExecutionDate; boolean deltaIsWithinReasonableBoundaries = delta >= UPDATE_RATE && delta <= UPDATE_RATE * 1.16; if (!deltaIsWithinReasonableBoundaries) { WatchDogLogger.getInstance().logInfo( "System suspend detected!"); intervalManager.closeAllIntervals(new Date( previousExecutionDate + UPDATE_RATE)); intervalManager.generateAndSetSessionSeed(); eventManager.update(new WatchDogEvent(this, EventType.START_IDE)); eventManager.updatePerspectiveInterval(); } } startTimeCheckerOnce(); previousExecutionDate = System.currentTimeMillis(); }
Source:
<code>public DeviceInfoReturn attachManagedBlockStorageVolume(Guid volumeId, Map<String, Object> connectionInfo) { JsonRpcRequest request = new RequestBuilder("ManagedVolume.attach_volume") .withParameter("vol_id", <START> volumeId) <END> .withParameter("connection_info", connectionInfo) .build(); Map<String, Object> response = new FutureMap(this.client, request); Map<String, Object> info = (Map<String, Object>) response.get("info"); return new DeviceInfoReturn(info); }</code><technical_language>for detach</technical_language>

Target:
public DeviceInfoReturn attachManagedBlockStorageVolume(Guid volumeId, Map<String, Object> connectionInfo) { JsonRpcRequest request = new RequestBuilder("ManagedVolume.attach_volume") .withParameter("vol_id", volumeId.toString()) .withParameter("connection_info", connectionInfo) .build(); Map<String, Object> response = new FutureMap(this.client, request); Map<String, Object> info = (Map<String, Object>) response.get("info"); return new DeviceInfoReturn(info); }
Source:
<code><START> public String getBriefDescription() { <END> return briefDescription; }</code><technical_language>adding a new column</technical_language>

Target:
public String getBriefDescription() { return this.briefDescription; }
Source:
<code>private void rollbackTransaction(Connection dbConnection) { try { <START> if (dbConnection != null) { <END> dbConnection.rollback(); } } catch (SQLException e) { log.error("An error occurred while rolling back transactions.", e); } }</code><technical_language>check autocommit is false</technical_language>

Target:
private void rollbackTransaction(Connection dbConnection) { try { if (dbConnection != null && !dbConnection.getAutoCommit()) { dbConnection.rollback(); } } catch (SQLException e) { log.error("An error occurred while transaction rollback.", e); } }
Source:
<code>private static String getTrimmedLabel(IMarkerEvent marker) { String label = marker.getLabel(); if (label == null) { return null; } return label.substring(0, <START> Math.min(label.indexOf('\n') != <END> -1 ? label.indexOf('\n') : label.length(), MAX_LABEL_LENGTH)); }</code><technical_language>constant lineseparator system</technical_language>

Target:
private static String getTrimmedLabel(IMarkerEvent marker) { String label = marker.getLabel(); if (label == null) { return null; } return label.substring(0, Math.min(label.indexOf(SWT.LF) != -1 ? label.indexOf(SWT.LF) : label.length(), MAX_LABEL_LENGTH)); }
Source:
<code>public void put(RevObject obj) { <START> byte[] value = encode(obj); <END> byte[] prev = map.putIfAbsent(obj.getId(), value); if (prev == null) { sizeTracker.inserted(obj.getId(), value); } }</code><technical_language>want check if object is in map (before encoding work). (not of use-case if this a difference)</technical_language>

Target:
public void put(RevObject obj) { if (!map.containsKey(obj.getId())) { byte[] value = encode(obj); byte[] prev = map.putIfAbsent(obj.getId(), value); if (prev == null) { sizeTracker.inserted(obj.getId(), value); } } }
Source:
<code>private boolean methodOpeningResource(MethodInvocationTree mit) { return !excludedByRuleOption(mit.symbolType()) <START> && !isWithinTryHeader(mit) <END> && !handledByFramework(mit) && (JDBC_RESOURCE_CREATIONS.anyMatch(mit) || STREAMS_BACKED_BY_RESOURCE.anyMatch(mit) || (needsClosing(mit.symbolType()) && !CLOSEABLE_EXCEPTIONS.anyMatch(mit) && mitHeuristics(mit))); }</code><technical_language>switching order of short circuit</technical_language>

Target:
private boolean methodOpeningResource(MethodInvocationTree mit) { return !isWithinTryHeader(mit) && !excludedByRuleOption(mit.symbolType()) && !handledByFramework(mit) && (JDBC_RESOURCE_CREATIONS.anyMatch(mit) || STREAMS_BACKED_BY_RESOURCE.anyMatch(mit) || (needsClosing(mit.symbolType()) && !CLOSEABLE_EXCEPTIONS.anyMatch(mit) && mitHeuristics(mit))); }
Source:
<code>private static <T> T getField(Object object, String fieldName) { try { Field field = object.getClass().getDeclaredField(fieldName); T result = null; if (field.isAccessible()) { result = (T) field.get(object); } else { field.setAccessible(true); result = (T) field.get(object); field.setAccessible(false); } return result; } catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { <START> throw new RuntimeException("Unable to hack client", e); <END> } }</code><technical_language>improve this message</technical_language>

Target:
private static <T> T getField(Object object, String fieldName) { try { Field field = object.getClass().getDeclaredField(fieldName); T result = null; if (field.isAccessible()) { result = (T) field.get(object); } else { field.setAccessible(true); result = (T) field.get(object); field.setAccessible(false); } return result; } catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Unable to access field " + fieldName + " through reflection", e); } }
Source:
<code><START> public String getNameKey() { <END> return nameKey; }</code><technical_language>package accessible, for tests</technical_language>

Target:
String getNameKey() { return nameKey; }
Source:
<code>public void setup() { metricsManager = MetricsManagers.createForTests(); legacyMetrics = SweepOutcomeMetrics.registerLegacy(metricsManager); targetedSweepMetrics = TargetedSweepMetrics .create(metricsManager, mock(TimelockService.class), new InMemoryKeyValueService(true), Long.MAX_VALUE); SweepOutcomeMetrics.LEGACY_OUTCOMES.forEach(outcome -> { assertThat(metricsManager).hasNotRegisteredLegacyOutcome(outcome); }); SweepOutcomeMetrics.TARGETED_OUTCOMES.forEach(outcome -> { assertThat(metricsManager).hasNotRegisteredTargetedOutcome(CONSERVATIVE, outcome); assertThat(metricsManager).hasNotRegisteredTargetedOutcome(THOROUGH, outcome); <START> }); <END> }</code><technical_language>assertions run test method - this is problematic, prefer a separate test do checks these</technical_language>

Target:
public void setup() { metricsManager = MetricsManagers.createForTests(); legacyMetrics = SweepOutcomeMetrics.registerLegacy(metricsManager); targetedSweepMetrics = TargetedSweepMetrics .create(metricsManager, mock(TimelockService.class), new InMemoryKeyValueService(true), Long.MAX_VALUE); }
Source:
<code>protected void internalReceiveUpdate(String itemName, State newState) { <START> if (newState != UnDefType.UNDEF) <END> { for (ExpireBindingProvider provider : providers) { if (provider.providesBindingFor(itemName)) { long expireAfterMs = provider.getExpiresAfterMs(itemName); nextExpireTsMap.put(itemName, System.currentTimeMillis() + expireAfterMs); break; } } } }</code><technical_language>this check for config.getExpiredState() instead of UNDEF</technical_language>

Target:
protected void internalReceiveUpdate(String itemName, State newState) { for (ExpireBindingProvider provider : providers) { if (provider.providesBindingFor(itemName)) { State expiredState = provider.getExpiredState(itemName); if (expiredState.equals(newState)) { nextExpireTsMap.put(itemName, Long.MAX_VALUE); } else { long expireAfterMs = provider.getExpiresAfterMs(itemName); nextExpireTsMap.put(itemName, System.currentTimeMillis() + expireAfterMs); } break; } } }
Source:
<code>public static Plan plan(AnalyzedUpdateStatement update, Functions functions, PlannerContext plannerCtx, SubqueryPlanner subqueryPlanner) { if (!update.returnValues().isEmpty()) { <START> if (!plannerCtx.clusterState().getNodes().getMinNodeVersion().onOrAfter(Version.V_4_2_0)) { <END> throw new UnsupportedFeatureException(RETURNING_VERSION_ERROR_MSG); } } AbstractTableRelation table = update.table(); Plan plan; if (table instanceof DocTableRelation) { DocTableRelation docTable = (DocTableRelation) table; plan = plan(docTable, update.assignmentByTargetCol(), update.query(), functions, plannerCtx, update.returnValues(), update.fields()); } else { plan = new Update((plannerContext, params, subQueryValues) -> sysUpdate( plannerContext, (TableRelation) table, update.assignmentByTargetCol(), update.query(), params, subQueryValues, update.returnValues(), update.fields() ) ); } Map<LogicalPlan, SelectSymbol> subQueries = subqueryPlanner.planSubQueries(update); return MultiPhasePlan.createIfNeeded(plan, subQueries); }</code><technical_language>merge this previous if condition</technical_language>

Target:
public static Plan plan(AnalyzedUpdateStatement update, Functions functions, PlannerContext plannerCtx, SubqueryPlanner subqueryPlanner) { if (!update.returnValues().isEmpty() && !plannerCtx.clusterState().getNodes().getMinNodeVersion().onOrAfter(Version.V_4_2_0)) { throw new UnsupportedFeatureException(RETURNING_VERSION_ERROR_MSG); } AbstractTableRelation table = update.table(); Plan plan; if (table instanceof DocTableRelation) { DocTableRelation docTable = (DocTableRelation) table; plan = plan(docTable, update.assignmentByTargetCol(), update.query(), functions, plannerCtx, update.returnValues(), update.fields()); } else { plan = new Update((plannerContext, params, subQueryValues) -> sysUpdate( plannerContext, (TableRelation) table, update.assignmentByTargetCol(), update.query(), params, subQueryValues, update.returnValues(), update.fields() ) ); } Map<LogicalPlan, SelectSymbol> subQueries = subqueryPlanner.planSubQueries(update); return MultiPhasePlan.createIfNeeded(plan, subQueries); }
Source:
<code>protected boolean canDoAction() { if (getVds().getKdumpStatus() != KdumpStatus.ENABLED) { <START> log.infoFormat("Kdump detection support is not configured on host {0}({1}).", <END> getVdsName(), getVdsId()); return false; } return getVds().isPmKdumpDetection(); }</code><technical_language>add proper message do action messages (as done in other commands returning false canDoAction)</technical_language>

Target:
protected boolean canDoAction() { if (getVds().getKdumpStatus() != KdumpStatus.ENABLED) { addCanDoActionMessage(VdcBllMessages.KDUMP_DETECTION_NOT_CONFIGURED_ON_VDS); return false; } boolean detectionEnabled = getVds().isPmKdumpDetection(); if (!detectionEnabled) { addCanDoActionMessage(VdcBllMessages.KDUMP_DETECTION_NOT_ENABLED_FOR_VDS); } return detectionEnabled; }
Source:
<code>public void startWorkload(Map<NodeId, Integer> poolSize) { Preconditions.checkState(progress == Progress.IDLE, "Workload should be idle to get started"); log.debug("Workload start requested"); for (NodeId nodeId : remotes.keySet()) { threads.put(nodeId, 0); delays.put(nodeId, 0); if (classesUrl != null) { RemoteExecutor executor = remotes.get(nodeId); AddUrlClassLoader addUrlClassLoaderCommand = AddUrlClassLoader.create(sessionId, classesUrl); log.info("Sending command to add a class loader with classes url to node {}", classesUrl, nodeId); executor.runSyncWithTimeout(addUrlClassLoaderCommand, Coordination.<Command>doNothing(), <START> timeoutsConfiguration.getWorkloadStopTimeout()); <END> log.info("Class loader with classes url has been added to node {}", classesUrl, nodeId); } } this.poolSize = poolSize; progress = Progress.STARTED; }</code><technical_language>stop timeout</technical_language>

Target:
public void startWorkload(Map<NodeId, Integer> poolSize) { Preconditions.checkState(progress == Progress.IDLE, "Workload should be idle to get started"); log.debug("Workload start requested"); for (NodeId nodeId : remotes.keySet()) { threads.put(nodeId, 0); delays.put(nodeId, 0); if (classesUrl != null) { RemoteExecutor executor = remotes.get(nodeId); AddUrlClassLoader addUrlClassLoaderCommand = AddUrlClassLoader.create(sessionId, classesUrl); log.info("Sending command to add a class loader with classes url to node {}", classesUrl, nodeId); executor.runSyncWithTimeout(addUrlClassLoaderCommand, Coordination.<Command>doNothing(), timeoutsConfiguration.getWorkloadStartTimeout()); log.info("Class loader with classes url has been added to node {}", classesUrl, nodeId); } } this.poolSize = poolSize; progress = Progress.STARTED; }
Source:
<code>public boolean useOnBlock(World world, BlockPos pos, IBlockState state, Vec3d hitPos, EnumFacing side, EntityPlayer player) { if (colour != null && usesLeft <= 0) { return false; } EnumActionResult result = CustomPaintHelper.INSTANCE.attemptPaintBlock(world, pos, state, hitPos, side, colour); if (result == EnumActionResult.SUCCESS) { ParticleUtil.showChangeColour(world, hitPos, colour); SoundUtil.playChangeColour(world, pos, colour); boolean isHolderCreative = player.isCreative(); <START> if (!isHolderCreative) { <END> usesLeft--; } if (usesLeft <= 0) { colour = null; usesLeft = 0; } return true; } return false; }</code><technical_language>Bit minor, for this, inline isHolderCreative if statement</technical_language>

Target:
public boolean useOnBlock(World world, BlockPos pos, IBlockState state, Vec3d hitPos, EnumFacing side, EntityPlayer player) { if (colour != null && usesLeft <= 0) { return false; } EnumActionResult result = CustomPaintHelper.INSTANCE.attemptPaintBlock(world, pos, state, hitPos, side, colour); if (result == EnumActionResult.SUCCESS) { ParticleUtil.showChangeColour(world, hitPos, colour); SoundUtil.playChangeColour(world, pos, colour); if (!player.isCreative()) { usesLeft--; } if (usesLeft <= 0) { colour = null; usesLeft = 0; } return true; } return false; }
Source:
<code>public Page getPage(Post op) { if (op == null) { return null; } Pages pages = getPages(op.board); <START> if (pages == null) { <END> return null; } else { for (Page page : pages.pages) { for (ThreadTime threadTime : page.threads) { if (op.no == threadTime.no) { return page; } } } } return null; }</code><technical_language>dedupe code here? a method Pages model? pages.findPageForThread(ThreadTime threadTime) hide this logic</technical_language>

Target:
public Page getPage(Post op) { if (op == null) { return null; } return findPage(op.board, op.no); }
Source:
<code>public void testBigIntTypeWithNulls() throws Exception { try (TempFile tempFile = new TempFile()) { int rows = 10000; createSingleColumnFileWithNullValues(tempFile.getFile(), rows); try (OrcRecordReader reader = createCustomOrcRecordReader(tempFile, ORC, OrcPredicate.TRUE, BIGINT)) { <START> assertEquals(reader.getReaderRowCount(), rows); <END> assertEquals(reader.getReaderPosition(), 0); assertEquals(reader.getStreamReaderRetainedSizeInBytes(), 0); assertEquals(reader.getSystemMemoryUsage(), 0); while (true) { int batchSize = reader.nextBatch(); if (batchSize == -1) { break; } System.out.println("batchSize: " + batchSize); Block block = reader.readBlock(BIGINT, 0); System.out.println("block.getPositionCount(): " + block.getPositionCount()); assertEquals(block.getPositionCount(), batchSize); if (batchSize < MAX_BATCH_SIZE) { continue; } System.out.println("reader.getStreamReaderRetainedSizeInBytes() " + reader.getStreamReaderRetainedSizeInBytes()); System.out.println("reader.getCurrentStripeRetainedSizeInBytes() " + reader.getCurrentStripeRetainedSizeInBytes()); assertEquals(reader.getStreamReaderRetainedSizeInBytes(), batchSize * SIZE_OF_BYTE); assertBetweenInclusive(reader.getCurrentStripeRetainedSizeInBytes(), 3600L, 3700L); assertEquals(reader.getStreamReaderRetainedSizeInBytes() + reader.getCurrentStripeRetainedSizeInBytes(), reader.getSystemMemoryUsage()); } assertEquals(reader.nextBatch(), -1); assertEquals(reader.getReaderPosition(), rows); assertEquals(reader.getFilePosition(), reader.getReaderPosition()); } } }</code><technical_language>reader is closed memory usage 0, assert for (you convert try-with-resources try-finally): assertEquals(reader.getStreamReaderRetainedSizeInBytes(), 0); assertEquals(reader.getCurrentStripeRetainedSizeInBytes(), 0); assertEquals(reader.getSystemMemoryUsage(), 0);</technical_language>

Target:
public void testBigIntTypeWithNulls() throws Exception { int rows = 10000; OrcRecordReader reader = null; try (TempFile tempFile = createSingleColumnFileWithNullValues(rows)) { reader = createCustomOrcRecordReader(tempFile, ORC, OrcPredicate.TRUE, BIGINT, INITIAL_BATCH_SIZE); assertInitialRetainedSizes(reader, rows); long stripeReaderRetainedSize = reader.getCurrentStripeRetainedSizeInBytes(); long streamReaderRetainedSize = reader.getStreamReaderRetainedSizeInBytes(); long readerRetainedSize = reader.getRetainedSizeInBytes(); long readerSystemMemoryUsage = reader.getSystemMemoryUsage(); while (true) { int batchSize = reader.nextBatch(); if (batchSize == -1) { break; } Block block = reader.readBlock(BIGINT, 0); assertEquals(block.getPositionCount(), batchSize); if (batchSize < MAX_BATCH_SIZE) { continue; } assertGreaterThan(reader.getCurrentStripeRetainedSizeInBytes(), stripeReaderRetainedSize); assertGreaterThanOrEqual(reader.getStreamReaderRetainedSizeInBytes() - streamReaderRetainedSize, 1024L); assertGreaterThan(reader.getRetainedSizeInBytes() - readerRetainedSize, 1024L); assertGreaterThan(reader.getSystemMemoryUsage() - readerSystemMemoryUsage, 1024L); } } finally { if (reader != null) { reader.close(); } } assertClosedRetainedSizes(reader); }
Source:
<code><START> private static String getAbbreviation(String name, String token) { StringBuilder abbrev = new StringBuilder(); if (name != null) { List<String> nameList = new ArrayList<String>(); for (String t : name.split(token)) { nameList.add(t); } RegExp re = RegExp.compile("[A-Za-z]+"); if (!re.test(nameList.get(0))) { abbrev.append(nameList.get(0).toUpperCase()); if (nameList.size() > 1) { abbrev.append(" ("+ nameList.get(nameList.size()-1).substring(0, 1).toUpperCase()+ ")"); } } else { for (String t : nameList) { abbrev.append(t.substring(0, 1).toUpperCase()); } } } return abbrev.toString(); } <END></code><technical_language>Sorry, I revert this previous implementation leave non-latin names unsupported for now</technical_language>

Target:
private static String getAbbreviation(String name, String token) { StringBuilder abbrev = new StringBuilder(); if (name != null) { for (String t : name.split(token)) { abbrev.append(t.substring(0, 1).toUpperCase()); } } return abbrev.toString(); }
Source:
<code>public List<DavResource> list(String url, int depth, boolean allProp) throws IOException { if (allProp) { Propfind body = new Propfind(); body.setAllprop(new Allprop()); return list(url, depth, body); } else { <START> return list(url, depth, new HashMap()); <END> } }</code><technical_language><LINK_0></technical_language>

Target:
public List<DavResource> list(String url, int depth, boolean allProp) throws IOException { if (allProp) { Propfind body = new Propfind(); body.setAllprop(new Allprop()); return list(url, depth, body); } else { return list(url, depth, Collections.<QName>emptySet()); } }
Source:
<code>protected boolean checkDescription(final String description, final List<String> resultList) { for (final String item : resultList) { <START> if (description != null && !description.contains(item)) { <END> return false; } } return true; }</code><technical_language>Put "if (description == null) return true;" for loop check in loop simpler</technical_language>

Target:
protected boolean checkDescription(final String description, final List<String> resultList) { if (description == null) { return true; } for (final String item : resultList) { if (!description.contains(item)) { return false; } } return true; }
Source:
<code>public int read(int offset, int[] positions, int positionCount) { outputPositions = initializeOutputPositions(outputPositions, positions, positionCount); <START> outputPositionCount = positionCount; <END> return outputPositionCount; }</code><technical_language>outputPositionCount variable is used; remove return positionCount;</technical_language>

Target:
public int read(int offset, int[] positions, int positionCount) { outputPositions = initializeOutputPositions(outputPositions, positions, positionCount); return positionCount; }