auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static ThemeSource<?> parseThemeSource(Map<String, ?> map) { String type = (String) map.get("type"); if (type == null) throw new RuntimeException("Theme source must have type"); <START> if (type.equals("filesystem")) { <END> String path = (String) map.get("path"); if (path == null) throw new RuntimeException("Filesystem theme source must have path"); return new FilesystemThemeSource(new File(path)); } else { throw new RuntimeException("Unrecognized theme source type: " + type); } }</code><technical_language>Slightly confused 'type' means here. is case for other types, add enum something</technical_language>

Target:
private static ThemeSource<?> parseThemeSource(Map<String, ?> map) { String typeStr = (String) map.get("type"); if (typeStr == null) throw new RuntimeException("Theme source must have type"); ThemeSourceType sourceType = ThemeSourceType.BY_TYPE.get(typeStr); if (sourceType == null) throw new RuntimeException("Unrecognized theme source type: " + typeStr); return sourceType.build(map); }
Source:
<code>protected AgentInstance(Agent agent, AgentType agentType, SystemEnvironment systemEnvironment, AgentStatusChangeListener agentStatusChangeListener) { this.systemEnvironment = systemEnvironment; this.agentRuntimeInfo = AgentRuntimeInfo.initialState(agent); this.agentStatusChangeListener = agentStatusChangeListener; this.agentConfigStatus = AgentConfigStatus.Pending; <START> this.agent = agent; <END> this.agentType = agentType; this.timeProvider = new TimeProvider(); }</code><technical_language>a representation of Agent is in DB, do need this class AgentInstance? sense combine AgentInstance Agent a single class</technical_language>

Target:
protected AgentInstance(Agent agent, AgentType agentType, SystemEnvironment systemEnvironment, AgentStatusChangeListener agentStatusChangeListener) { this.systemEnvironment = systemEnvironment; this.agentRuntimeInfo = AgentRuntimeInfo.initialState(agent); this.agentStatusChangeListener = agentStatusChangeListener; this.agentConfigStatus = Pending; this.agent = agent; this.agentType = agentType; this.timeProvider = new TimeProvider(); }
Source:
<code>public void execute() { if (analysisMetadataHolder.isFirstAnalysis()) { LOG.debug("First analysis. Do nothing."); return; } Map<String, DbComponent> dbFilesByKey = getDbFilesByKey(); if (dbFilesByKey.isEmpty()) { LOG.debug("Previous snapshot has no file. Do nothing."); return; } Map<String, Component> reportFilesByKey = getReportFilesByKey(this.rootHolder.getRoot()); if (reportFilesByKey.isEmpty()) { LOG.debug("No files in report. Do nothing."); return; } <START> Set<String> addedFileKeys = Sets.difference(reportFilesByKey.keySet(), dbFilesByKey.keySet()); <END> Set<String> removedFileKeys = Sets.difference(dbFilesByKey.keySet(), reportFilesByKey.keySet()); if (addedFileKeys.isEmpty() || removedFileKeys.isEmpty()) { LOG.debug("Either no files added or no files removed. Do nothing."); return; } Map<String, File> reportFileSourcesByKey = getReportFileSourcesByKey(reportFilesByKey, addedFileKeys); ScoreMatrix scoreMatrix = computeScoreMatrix(dbFilesByKey, removedFileKeys, reportFileSourcesByKey); printIfDebug(scoreMatrix); if (scoreMatrix.getMaxScore() < MIN_REQUIRED_SCORE) { LOG.debug("max score in matrix is less than min required score (%s). Do nothing.", MIN_REQUIRED_SCORE); return; } MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix); ElectedMatches electedMatches = electMatches(removedFileKeys, reportFileSourcesByKey, matchesByScore); registerMatches(dbFilesByKey, reportFilesByKey, electedMatches); }</code><technical_language>warning: optimisation Sets.difference returns a view means difference is computed times in code (eg. calling addedFileKeys.isEmpty() iterating it)</technical_language>

Target:
public void execute() { if (analysisMetadataHolder.isFirstAnalysis()) { LOG.debug("First analysis. Do nothing."); return; } Map<String, DbComponent> dbFilesByKey = getDbFilesByKey(); if (dbFilesByKey.isEmpty()) { LOG.debug("Previous snapshot has no file. Do nothing."); return; } Map<String, Component> reportFilesByKey = getReportFilesByKey(this.rootHolder.getRoot()); if (reportFilesByKey.isEmpty()) { LOG.debug("No files in report. Do nothing."); return; } Set<String> addedFileKeys = ImmutableSet.copyOf(Sets.difference(reportFilesByKey.keySet(), dbFilesByKey.keySet())); Set<String> removedFileKeys = ImmutableSet.copyOf(Sets.difference(dbFilesByKey.keySet(), reportFilesByKey.keySet())); if (addedFileKeys.isEmpty() || removedFileKeys.isEmpty()) { LOG.debug("Either no files added or no files removed. Do nothing."); return; } Map<String, File> reportFileSourcesByKey = getReportFileSourcesByKey(reportFilesByKey, addedFileKeys); ScoreMatrix scoreMatrix = computeScoreMatrix(dbFilesByKey, removedFileKeys, reportFileSourcesByKey); printIfDebug(scoreMatrix); if (scoreMatrix.getMaxScore() < MIN_REQUIRED_SCORE) { LOG.debug("max score in matrix is less than min required score (%s). Do nothing.", MIN_REQUIRED_SCORE); return; } MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix); ElectedMatches electedMatches = electMatches(removedFileKeys, reportFileSourcesByKey, matchesByScore); registerMatches(dbFilesByKey, reportFilesByKey, electedMatches); }
Source:
<code>public synchronized void close() { _zkClient.close(); try { _forwardHttpClient.close(); } catch (IOException e) { <START> LOG.error("HttpClient fails to close. ", e); <END> } }</code><technical_language>Nit: "failed"</technical_language>

Target:
public synchronized void close() { _zkClient.close(); try { _forwardHttpClient.close(); } catch (IOException e) { LOG.error("HttpClient failed to close. ", e); } }
Source:
<code>public void handle(FailureContext context) { try { String failingOperationDescription = context.getFailingOperation().toString(); Throwable throwable = context.getThrowable(); } catch (Throwable t) { <START> } <END> }</code><technical_language>leave burden of capturing exception user</technical_language>

Target:
public void handle(FailureContext context) { String failingOperationDescription = context.getFailingOperation().toString(); Throwable throwable = context.getThrowable(); }
Source:
<code>private boolean isVisible(long txnId) throws IOException{ TxnView toCompare=fetchTransaction(txnId); if(toCompare == null) { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "Transaction %d cannot be found. Splice assumes it is visible.", txnId); } <START> } <END> return toCompare != null ? myTxn.canSee(toCompare) : true; }</code><technical_language>I do if some special parameter is set, splice.transactions.ignore.missing that. I feel comfortable silently ignoring transactions Txn table</technical_language>

Target:
private boolean isVisible(long txnId) throws IOException{ TxnView toCompare=fetchTransaction(txnId); if(toCompare == null && ignoreMissingTxns) { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "Transaction %d cannot be found. Splice assumes it is visible.", txnId); } } return toCompare != null ? myTxn.canSee(toCompare) : (ignoreMissingTxns ? true :false); }
Source:
<code>public void sendPluginResult(PluginResult pluginResult) { synchronized (this) { if (finished) { <START> return; <END> } else { finished = true; } } JSONObject event = new JSONObject(); JSONObject pluginResultObject = new JSONObject(); try { pluginResultObject.put("pluginServiceName", this.serviceName); pluginResultObject.put("pluginStatus", PluginResult.StatusMessages[pluginResult.getStatus()]); event.put("action", "resume"); event.put("pendingResult", pluginResultObject); } catch (JSONException e) { LOG.e(TAG, "Unable to create resume object for Activity Result"); } PluginResult eventResult = new PluginResult(PluginResult.Status.OK, event); List<PluginResult> result = new ArrayList<PluginResult>(); result.add(eventResult); result.add(pluginResult); CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result)); }</code><technical_language>a warning here, in base class implementation</technical_language>

Target:
public void sendPluginResult(PluginResult pluginResult) { synchronized (this) { if (finished) { LOG.w(TAG, serviceName + " attempted to send a second callback to ResumeCallback\nResult was: " + pluginResult.getMessage()); return; } else { finished = true; } } JSONObject event = new JSONObject(); JSONObject pluginResultObject = new JSONObject(); try { pluginResultObject.put("pluginServiceName", this.serviceName); pluginResultObject.put("pluginStatus", PluginResult.StatusMessages[pluginResult.getStatus()]); event.put("action", "resume"); event.put("pendingResult", pluginResultObject); } catch (JSONException e) { LOG.e(TAG, "Unable to create resume object for Activity Result"); } PluginResult eventResult = new PluginResult(PluginResult.Status.OK, event); List<PluginResult> result = new ArrayList<PluginResult>(); result.add(eventResult); result.add(pluginResult); CoreAndroid appPlugin = (CoreAndroid) pluginManager.getPlugin(CoreAndroid.PLUGIN_NAME); appPlugin.sendResumeEvent(new PluginResult(PluginResult.Status.OK, result)); }
Source:
<code>private HeaderChannelBuffer(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) { this.channel = channel; <START> this.buffer = ByteBuffer.allocate(maxPageBytes).order(ByteOrder.LITTLE_ENDIAN); <END> this.remaining = capacity; }</code><technical_language>I a compare capacity maxPageBytes is reasonable - capacity > maxPageBytes is true here. ensure private HeaderChannelBuffer constructor is called in create. called else someday? A compare redundant decouple private constructor create</technical_language>

Target:
private HeaderChannelBuffer(final ReadableByteChannel channel, final long capacity, final int maxPageBytes) { this.channel = channel; int limit = (int) Math.min(maxPageBytes, capacity); this.buffer = ByteBuffer.allocate(limit).order(ByteOrder.LITTLE_ENDIAN); this.remaining = capacity; }
Source:
<code>private Iterable<String> urisFor(String csvIds) { if (Strings.isNullOrEmpty((csvIds))) { return ImmutableSet.of(); } Iterable<Long> ids = StreamSupport.stream(commaSplitter.split(csvIds).spliterator(), false) .map(input -> codec.decode(input).longValue()) .collect(Collectors.toList()); return StreamSupport.stream(lookupEntryStore.entriesForIds(ids).spliterator(), false) <START> .map(LookupEntry.TO_ID::apply) <END> .collect(Collectors.toList()); }</code><technical_language>constant functions a bit confusing give ID back, a uri. getters in LookupEntry class .map(LookupEntry::uri) a lot clearer happening</technical_language>

Target:
private Iterable<String> urisFor(String csvIds) { if (Strings.isNullOrEmpty((csvIds))) { return ImmutableSet.of(); } Iterable<Long> ids = StreamSupport.stream(commaSplitter.split(csvIds).spliterator(), false) .map(input -> codec.decode(input).longValue()) .collect(Collectors.toList()); return StreamSupport.stream(lookupEntryStore.entriesForIds(ids).spliterator(), false) .map(LookupEntry::uri) .collect(Collectors.toList()); }
Source:
<code>public void patientVoided_shouldVoidMemberships() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); Patient voidedPatient = new Patient(7); <START> voidedPatient.setVoided(true); <END> CohortMembership newMemberContainingVoidedPatient = new CohortMembership(voidedPatient); cohort.addMembership(newMemberContainingVoidedPatient); assertTrue(cohort.contains(newMemberContainingVoidedPatient)); service.patientVoided(voidedPatient); assertNotNull(newMemberContainingVoidedPatient.getEndDate()); assertTrue(newMemberContainingVoidedPatient.getVoided()); assertNotNull(newMemberContainingVoidedPatient.getDateVoided()); assertNotNull(newMemberContainingVoidedPatient.getVoidedBy()); assertNotNull(newMemberContainingVoidedPatient.getVoidReason()); }</code><technical_language>need set dateVoided voidedBy voidReason copy memberships for reason, nice add a special translated message "Voided a result of patient voided"</technical_language>

Target:
public void patientVoided_shouldVoidMemberships() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(2); Patient voidedPatient = new Patient(7); voidedPatient.setVoided(true); voidedPatient.setDateVoided(new Date()); voidedPatient.setVoidedBy(Context.getAuthenticatedUser()); voidedPatient.setVoidReason("Voided as a result of the associated patient getting voided"); CohortMembership newMemberContainingVoidedPatient = new CohortMembership(voidedPatient); cohort.addMembership(newMemberContainingVoidedPatient); assertTrue(cohort.contains(voidedPatient)); service.patientVoided(voidedPatient); assertTrue(newMemberContainingVoidedPatient.getVoided()); assertEquals(voidedPatient.getDateVoided(), newMemberContainingVoidedPatient.getDateVoided()); assertEquals(voidedPatient.getVoidedBy(), newMemberContainingVoidedPatient.getVoidedBy()); assertEquals(voidedPatient.getVoidReason(), newMemberContainingVoidedPatient.getVoidReason()); }
Source:
<code>public FacadeBlockStateInfo(IBlockState state, ItemStack requiredStack, ImmutableSet<IProperty<?>> varyingProperties) { this.state = Objects.requireNonNull(state, "state must not be null!"); Objects.requireNonNull(state.getBlock(), "state.getBlock must not be null!"); Objects.requireNonNull(state.getBlock().getRegistryName(), "state.getBlock.getRegistryName() must not be null!"); this.requiredStack = requiredStack; this.varyingProperties = varyingProperties; this.isTransparent = !state.isOpaqueCube(); this.isVisible = !requiredStack.isEmpty(); IBlockAccess access = new SingleBlockAccess(state); for (EnumFacing side : EnumFacing.VALUES) { <START> isSideSolid[side.ordinal()] = state.isSideSolid(access, BlockPos.ORIGIN, side) || state.getBlockFaceShape(access, BlockPos.ORIGIN, side) == BlockFaceShape.SOLID; <END> } }</code><technical_language>sort of states this a difference for</technical_language>

Target:
public FacadeBlockStateInfo(IBlockState state, ItemStack requiredStack, ImmutableSet<IProperty<?>> varyingProperties) { this.state = Objects.requireNonNull(state, "state must not be null!"); Objects.requireNonNull(state.getBlock(), "state.getBlock must not be null!"); Objects.requireNonNull(state.getBlock().getRegistryName(), "state.getBlock.getRegistryName() must not be null!"); this.requiredStack = requiredStack; this.varyingProperties = varyingProperties; this.isTransparent = !state.isOpaqueCube(); this.isVisible = !requiredStack.isEmpty(); IBlockAccess access = new SingleBlockAccess(state); for (EnumFacing side : EnumFacing.VALUES) { isSideSolid[side.ordinal()] = state.isSideSolid(access, BlockPos.ORIGIN, side); blockFaceShape[side.ordinal()] = state.getBlockFaceShape(access, BlockPos.ORIGIN, side); } }
Source:
<code>public void start() { <START> try { <END> startStopLock.writeLock().lockInterruptibly(); } catch (InterruptedException e) { throw Throwables.propagate(e); } try { if (!started.getAndSet(true)) { if (lookupSnapshotTaker != null) { final List<LookupBean> lookupBeanList = lookupSnapshotTaker.pullExistingSnapshot(); for (LookupBean lookupBean : lookupBeanList) { this.put(lookupBean.name, lookupBean.factory); } } LOGGER.info("Started lookup factory references manager"); } } finally { startStopLock.writeLock().unlock(); } }</code><technical_language>do need a read write lock, ? synchronized a variable is enough ? is advantage</technical_language>

Target:
public void start() { startStopLock.writeLock().lock(); try { if (!started.getAndSet(true)) { if (lookupSnapshotTaker != null) { final List<LookupBean> lookupBeanList = lookupSnapshotTaker.pullExistingSnapshot(); for (LookupBean lookupBean : lookupBeanList) { this.put(lookupBean.name, lookupBean.factory); } } LOGGER.info("Started lookup factory references manager"); } } finally { startStopLock.writeLock().unlock(); } }
Source:
<code>private void runManagement() { while (true) { if (Thread.interrupted()) { LOG.debug("Coordinator interrupted."); break; } BlockManagementTask currentTask; try { if (mBackoffStrategy == BackoffStrategy.ANY && mLoadTracker.loadDetected(BlockStoreLocation.anyTier())) { LOG.debug("Load detected. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } final BlockManagementTask nextTask = getNextTask(); if (nextTask == null) { LOG.debug("No management task pending. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } currentTask = nextTask; LOG.debug("Running task of type:{}", currentTask.getClass().getSimpleName()); try { BlockManagementTaskResult result = currentTask.run(); LOG.debug("Management task: finished with result: {}", <START> currentTask.getClass().getSimpleName(), result); <END> if (result.noProgress()) { LOG.debug("Task made no progress due to failures/back-offs. Sleeping {}ms", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); } } catch (Exception e) { LOG.error("Management task failed: {}. Error: {}", currentTask.getClass().getSimpleName(), e); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } catch (Throwable t) { LOG.error("Unexpected error during block management: {}", t); } } LOG.debug("Block management coordinator exited."); }</code><technical_language>I fine, add a template raise log level of this class if is noisy</technical_language>

Target:
private void runManagement() { while (true) { if (Thread.interrupted()) { LOG.debug("Coordinator interrupted."); break; } BlockManagementTask currentTask; try { if (mBackoffStrategy == BackoffStrategy.ANY && mLoadTracker.loadDetected(BlockStoreLocation.anyTier())) { LOG.debug("Load detected. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } final BlockManagementTask nextTask = getNextTask(); if (nextTask == null) { LOG.debug("No management task pending. Sleeping {}ms.", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); continue; } currentTask = nextTask; LOG.debug("Running task of type:{}", currentTask.getClass().getSimpleName()); try { BlockManagementTaskResult result = currentTask.run(); LOG.info("{} finished with result: {}", currentTask.getClass().getSimpleName(), result); if (result.noProgress()) { LOG.debug("Task made no progress due to failures/back-offs. Sleeping {}ms", mLoadDetectionCoolDownMs); Thread.sleep(mLoadDetectionCoolDownMs); } } catch (Exception e) { LOG.error("Management task failed: {}. Error: {}", currentTask.getClass().getSimpleName(), e); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } catch (Throwable t) { LOG.error("Unexpected error during block management: {}", t); } } LOG.debug("Block management coordinator exited."); }
Source:
<code><START> private void populateReviews(List<TaskReview> reviewContainers) throws NumberFormatException { <END> for (ITask review : reviews) { reviewContainers.add(new TaskReview(review)); } }</code><technical_language>This throw NumberFormatException anymore</technical_language>

Target:
private void populateReviews(List<TaskReview> reviewContainers) { for (ITask review : reviews) { reviewContainers.add(new TaskReview(review)); } }
Source:
<code>public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); try { monitor.beginTask("Submitting_task", IProgressMonitor.UNKNOWN); BugzillaRestClient client = connector.getClient(repository); try { IOperationMonitor progress = OperationUtil.convert(monitor, "post taskdata", 3); <START> progress.addFlag(OperationFlag.BACKGROUND); <END> return client.postTaskData(taskData, oldAttributes, progress); } catch (BugzillaRestException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, 2, "Error post taskdata.\n\n" + e.getMessage(), e)); } } finally { monitor.done(); } }</code><technical_language>this flag set caller depending operation invoked user not? set here</technical_language>

Target:
public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); try { monitor.beginTask("Submitting_task", IProgressMonitor.UNKNOWN); BugzillaRestClient client = connector.getClient(repository); try { IOperationMonitor progress = OperationUtil.convert(monitor, "post taskdata", 3); return client.postTaskData(taskData, oldAttributes, progress); } catch (BugzillaRestException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, 2, "Error post taskdata.\n\n" + e.getMessage(), e)); } } finally { monitor.done(); } }
Source:
<code>private void setUsbConfig(long config, boolean chargingFunctions) { if (true) Slog.d(TAG, "setUsbConfig(" + config + ") request:" + ++mCurrentRequest); removeMessages(MSG_FUNCTION_SWITCH_TIMEOUT); removeMessages(MSG_SET_FUNCTIONS_TIMEOUT); removeMessages(MSG_SET_CHARGING_FUNCTIONS); synchronized (mGadgetProxyLock) { if (mGadgetProxy == null) { Slog.e(TAG, "setUsbConfig mGadgetProxy is null"); return; } try { UsbGadgetCallback usbGadgetCallback = new UsbGadgetCallback(mCurrentRequest, config, chargingFunctions); <START> mGadgetProxy.setCurrentUsbFunctions(UsbManager.FUNCTION_NONE, <END> usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); if ((config & UsbManager.FUNCTION_ADB) != 0) { setSystemProperty(CTL_START, ADBD); } else { setSystemProperty(CTL_STOP, ADBD); } mGadgetProxy.setCurrentUsbFunctions(config, usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); sendMessageDelayed(MSG_SET_FUNCTIONS_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS); sendMessageDelayed(MSG_FUNCTION_SWITCH_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS + ENUMERATION_TIME_OUT_MS); if (DEBUG) Slog.d(TAG, "timeout message queued"); } catch (RemoteException e) { Slog.e(TAG, "Remoteexception while calling setCurrentUsbFunctions", e); } } }</code><technical_language>This is a asynchronous call. wait for callback return (or timeout) calling in 1935. functions set hal implementation level setting new one. (For reference, Return<void> UsbGadget::setCurrentUsbFunctions @ <LINK_0> Do a similar HAL implementation</technical_language>

Target:
private void setUsbConfig(long config, boolean chargingFunctions) { if (true) Slog.d(TAG, "setUsbConfig(" + config + ") request:" + ++mCurrentRequest); removeMessages(MSG_FUNCTION_SWITCH_TIMEOUT); removeMessages(MSG_SET_FUNCTIONS_TIMEOUT); removeMessages(MSG_SET_CHARGING_FUNCTIONS); synchronized (mGadgetProxyLock) { if (mGadgetProxy == null) { Slog.e(TAG, "setUsbConfig mGadgetProxy is null"); return; } try { UsbGadgetCallback usbGadgetCallback = new UsbGadgetCallback(mCurrentRequest, config, chargingFunctions); isCbReceived.close(); mGadgetProxy.setCurrentUsbFunctions(UsbManager.FUNCTION_NONE, usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); boolean isThreadOpened = isCbReceived.block(SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); if (!isThreadOpened) { Slog.e(TAG, "Callback was received with unsuccessful status"); } if ((config & UsbManager.FUNCTION_ADB) != 0) { setSystemProperty(CTL_START, ADBD); } else { setSystemProperty(CTL_STOP, ADBD); } mGadgetProxy.setCurrentUsbFunctions(config, usbGadgetCallback, SET_FUNCTIONS_TIMEOUT_MS - SET_FUNCTIONS_LEEWAY_MS); sendMessageDelayed(MSG_SET_FUNCTIONS_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS); sendMessageDelayed(MSG_FUNCTION_SWITCH_TIMEOUT, chargingFunctions, SET_FUNCTIONS_TIMEOUT_MS + ENUMERATION_TIME_OUT_MS); if (DEBUG) Slog.d(TAG, "timeout message queued"); } catch (RemoteException e) { Slog.e(TAG, "Remoteexception while calling setCurrentUsbFunctions", e); } } }
Source:
<code>private static RetryOptions.Builder createRetryOptions(Configuration configuration) { RetryOptions.Builder retryOptionsBuilder = new RetryOptions.Builder(); boolean enableRetries = configuration.getBoolean( ENABLE_GRPC_RETRIES_KEY, ENABLE_GRPC_RETRIES_DEFAULT); LOG.debug("gRPC retries enabled: %s", enableRetries); retryOptionsBuilder.setEnableRetries(enableRetries); boolean retryOnDeadlineExceeded = configuration.getBoolean( ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_KEY, ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_DEFAULT); LOG.debug("gRPC retry on deadline exceeded enabled: %s", retryOnDeadlineExceeded); retryOptionsBuilder.setRetryOnDeadlineExceeded(retryOnDeadlineExceeded); int maxElapsedBackoffMillis = configuration.getInt( MAX_ELAPSED_BACKOFF_MILLIS_KEY, MAX_ELAPSED_BACKOFF_MILLIS_DEFAULT); LOG.debug("gRPC retry maxElapsedBackoffMillis: %d", maxElapsedBackoffMillis); <START> retryOptionsBuilder.setMaxElapsedBackoffMillis(maxElapsedBackoffMillis); END> return retryOptionsBuilder; }</code><technical_language>remove // 3 minutes</technical_language>

Target:
private static RetryOptions createRetryOptions(Configuration configuration) { RetryOptions.Builder retryOptionsBuilder = new RetryOptions.Builder(); boolean enableRetries = configuration.getBoolean( ENABLE_GRPC_RETRIES_KEY, ENABLE_GRPC_RETRIES_DEFAULT); LOG.debug("gRPC retries enabled: %s", enableRetries); retryOptionsBuilder.setEnableRetries(enableRetries); boolean retryOnDeadlineExceeded = configuration.getBoolean( ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_KEY, ENABLE_GRPC_RETRY_DEADLINEEXCEEDED_DEFAULT); LOG.debug("gRPC retry on deadline exceeded enabled: %s", retryOnDeadlineExceeded); retryOptionsBuilder.setRetryOnDeadlineExceeded(retryOnDeadlineExceeded); int maxElapsedBackoffMillis = configuration.getInt( MAX_ELAPSED_BACKOFF_MILLIS_KEY, MAX_ELAPSED_BACKOFF_MS_DEFAULT); LOG.debug("gRPC retry maxElapsedBackoffMillis: %d", maxElapsedBackoffMillis); retryOptionsBuilder.setMaxElapsedBackoffMillis(maxElapsedBackoffMillis); return retryOptionsBuilder.build(); }
Source:
<code>private void onDelegateException( RuntimeException e ) { if ( isUnrecoverableErrorsOccurred( e ) ) { unrecoverableErrorsOccurred = true; if( isClusterError( e ) ) { e = new ClientException( "The driver and server are incompatible. " + "1.0 driver does not support running statements against a 3.1+ core edge cluster. " + <START> "Please upgrade to 1.1 driver and use `bolt+cluster` scheme to run statements directly" + <END> " against a 3.1+ core edge cluster.", e ); } } else { ackFailure(); } if( onError != null ) { onError.run(); } throw e; }</code><technical_language>bolt+routing</technical_language>

Target:
private void onDelegateException( RuntimeException e ) { if ( isUnrecoverableErrorsOccurred( e ) ) { unrecoverableErrorsOccurred = true; if( isClusterError( e ) ) { e = new ClientException( format( "Failed to run a statement on a 3.1+ Neo4j core-edge cluster server. %n" + "Please retry the statement if you have defined your own routing strategy to route driver messages to the cluster. " + "Note: 1.0 java driver does not support routing statements to a 3.1+ Neo4j core edge cluster. " + "Please upgrade to 1.1 driver and use `bolt+routing` scheme to route and run statements " + "directly to a 3.1+ core edge cluster." ), e ); } } else { ackFailure(); } if( onError != null ) { onError.run(); } throw e; }
Source:
<code>private void handleRemoteRequest(JsonRpcPeer peer, JSONObject requestNode) throws MessageHandlingException { JsonRpcRequest request; request = mObjectMapper.convertValue( requestNode, JsonRpcRequest.class); JSONObject result = null; JSONObject error = null; try { result = mMethodDispatcher.dispatch(peer, request.method, request.params); } catch (JsonRpcException e) { logDispatchException(e); error = mObjectMapper.convertValue(e.getErrorMessage(), JSONObject.class); } if (request.id != null) { JsonRpcResponse response = new JsonRpcResponse(); response.id = request.id; response.result = result; response.error = error; JSONObject jsonObject = mObjectMapper.convertValue(response, JSONObject.class); String responseString; try { responseString = jsonObject.toString(); } catch (OutOfMemoryError e) { <START> throw new MessageHandlingException(e); <END> } peer.getWebSocket().sendText(responseString); } }</code><technical_language>This close socket, dismissing inspector window. Instead, convert response error (similar catch (JsonRpcException) clause a lines it)</technical_language>

Target:
private void handleRemoteRequest(JsonRpcPeer peer, JSONObject requestNode) throws MessageHandlingException { JsonRpcRequest request; request = mObjectMapper.convertValue( requestNode, JsonRpcRequest.class); JSONObject result = null; JSONObject error = null; try { result = mMethodDispatcher.dispatch(peer, request.method, request.params); } catch (JsonRpcException e) { logDispatchException(e); error = mObjectMapper.convertValue(e.getErrorMessage(), JSONObject.class); } if (request.id != null) { JsonRpcResponse response = new JsonRpcResponse(); response.id = request.id; response.result = result; response.error = error; JSONObject jsonObject = mObjectMapper.convertValue(response, JSONObject.class); String responseString; try { responseString = jsonObject.toString(); } catch (OutOfMemoryError e) { response.result = null; response.error = mObjectMapper.convertValue(e.getMessage(), JSONObject.class); jsonObject = mObjectMapper.convertValue(response, JSONObject.class); responseString = jsonObject.toString(); } peer.getWebSocket().sendText(responseString); } }
Source:
<code>protected AnnotationDescriptor<A> createAnnotationDescriptor() { <START> AnnotationDescriptor.Builder<A> annotationDescriptorBuilder = new AnnotationDescriptor.Builder<>( annotationType ); <END> for ( Map.Entry<String, Object> parameter : parameters.entrySet() ) { annotationDescriptorBuilder.setAttribute( parameter.getKey(), parameter.getValue() ); } for ( Map.Entry<String, List<AnnotationDef<?, ?>>> annotationAsParameter : annotationsAsParameters.entrySet() ) { annotationDescriptorBuilder.setAttribute( annotationAsParameter.getKey(), toAnnotationParameterArray( annotationAsParameter.getValue(), annotationsAsParametersTypes.get( annotationAsParameter.getKey() ) ) ); } try { return annotationDescriptorBuilder.build(); } catch (RuntimeException e) { throw LOG.getUnableToCreateAnnotationForConfiguredConstraintException( e ); } }</code><technical_language>nice builder in place, builder field get rid of some/all of intermediary maps</technical_language>

Target:
protected AnnotationDescriptor<A> createAnnotationDescriptor() { for ( Map.Entry<String, List<AnnotationDef<?, ?>>> annotationAsParameter : annotationsAsParameters.entrySet() ) { annotationDescriptorBuilder.setAttribute( annotationAsParameter.getKey(), toAnnotationParameterArray( annotationAsParameter.getValue(), annotationsAsParametersTypes.get( annotationAsParameter.getKey() ) ) ); } try { return annotationDescriptorBuilder.build(); } catch (RuntimeException e) { throw LOG.getUnableToCreateAnnotationForConfiguredConstraintException( e ); } }
Source:
<code>private void populateSourceContextData(AbstractFile sourceFile) throws NoCurrentCaseException, TskCoreException { SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase(); boolean foundASource = false; for (BlackboardArtifact.ARTIFACT_TYPE artifactType : SOURCE_CONTEXT_ARTIFACTS) { List<BlackboardArtifact> artifactsList = tskCase.getBlackboardArtifacts(artifactType, sourceFile.getId()); if (!artifactsList.isEmpty()) { <START> foundASource = true; <END> } for (BlackboardArtifact contextArtifact : artifactsList) { addSourceEntry(contextArtifact); } } if (foundASource == false) { setSourceName("Unknown"); showSourceText(false); } }</code><technical_language>simplify this setting foundAsSource = !artifactsList.isEmpty();</technical_language>

Target:
private void populateSourceContextData(AbstractFile sourceFile) throws NoCurrentCaseException, TskCoreException { SleuthkitCase tskCase = Case.getCurrentCaseThrows().getSleuthkitCase(); boolean foundASource = false; for (BlackboardArtifact.ARTIFACT_TYPE artifactType : SOURCE_CONTEXT_ARTIFACTS) { List<BlackboardArtifact> artifactsList = tskCase.getBlackboardArtifacts(artifactType, sourceFile.getId()); foundASource = !artifactsList.isEmpty(); for (BlackboardArtifact contextArtifact : artifactsList) { addSourceEntry(contextArtifact); } } if (foundASource == false) { setSourceName("Unknown"); showSourceText(false); } }
Source:
<code>public static String distanceToString(float distance, Resources resources) { if (distance < 100) <START> return String.format("%d %s", Math.round(distance), <END> resources.getString(R.string.trackmgr_distance_meters)); else if (distance < 1000) return String.format("%d %s", 10*Math.round(distance/10), resources.getString(R.string.trackmgr_distance_meters)); else if (distance < 10000) return String.format("%.1f %s", distance/1000, resources.getString(R.string.trackmgr_distance_kilometers)); else return String.format("%d %s", Math.round(distance/1000), resources.getString(R.string.trackmgr_distance_kilometers)); }</code><technical_language>Need placeholders for</technical_language>

Target:
public static String distanceToString(float distance, Resources resources) { if (distance < 100) { return resources.getString(R.string.trackmgr_distance_in_meters).replace("{0}", String.valueOf(Math.round(distance))); } else if (distance < 1000) { return resources.getString(R.string.trackmgr_distance_in_meters).replace("{0}", String.valueOf(10 * Math.round(distance / 10))); } else if (distance < STOP_SHOWING_DECIMALS_AFTER*1000) { return resources.getString(R.string.trackmgr_distance_in_kilometers).replace("{0}", String.format("%.1f", distance / 1000)); } else { return resources.getString(R.string.trackmgr_distance_in_kilometers).replace("{0}", String.valueOf(Math.round(distance / 1000))); } }
Source:
<code><START> private QuotedStringTokenizer(boolean forceLenient) { <END> this.forceLenient = forceLenient; }</code><technical_language>Leave this package private avoid creation of synthetic methods please</technical_language>

Target:
QuotedStringTokenizer(boolean forceLenient) { this.forceLenient = forceLenient; }
Source:
<code>public String transformStatement(String statement) { <START> return filterFullLineComments(statement); <END> }</code><technical_language>this <LINK_0> rows starting '#'</technical_language>

Target:
public String transformStatement(String statement) { return statement; }
Source:
<code><START> public String getName() { <END> if (StringUtils.isEmpty(name)) { this.name = getNewRuleAnnotationClauseName(); } return this.name; }</code><technical_language>this private (or package protected)? this class</technical_language>

Target:
private String getName() { return this.name; }
Source:
<code>private static void logCorruptPackError(IOException e, PackFile p) { StringBuilder buf = new StringBuilder(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile().getAbsolutePath())); <START> buf.append('\n'); <END> StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); buf.append(sw.toString()); System.err.println(buf.toString()); }</code><technical_language>is newline needed beginning? If this line stay move 565 566</technical_language>

Target:
private static void logCorruptPackError(IOException e, PackFile p) { StringBuilder buf = new StringBuilder(MessageFormat.format( JGitText.get().exceptionWhileReadingPack, p.getPackFile().getAbsolutePath())); StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); buf.append('\n'); buf.append(sw.toString()); System.err.println(buf.toString()); }
Source:
<code>private void initializeRankOfDictionaryIds() { final int dictionarySize = dictionary.size(); rankOfDictionaryIds = IntStream.range(0, dictionarySize).toArray(); IntArrays.quickSort( rankOfDictionaryIds, <START> new IntComparator() <END> { @Override public int compare(int i1, int i2) { return dictionary.get(i1).compareTo(dictionary.get(i2)); } @Override public int compare(Integer o1, Integer o2) { return compare(o1.intValue(), o2.intValue()); } } ); inverse(rankOfDictionaryIds); }</code><technical_language>This condensed one-line lambda, if updated latest version of fastutil library</technical_language>

Target:
private void initializeRankOfDictionaryIds() { final int dictionarySize = dictionary.size(); rankOfDictionaryIds = IntStream.range(0, dictionarySize).toArray(); IntArrays.quickSort( rankOfDictionaryIds, new IntComparator() { @Override public int compare(int i1, int i2) { return dictionary.get(i1).compareTo(dictionary.get(i2)); } @Override public int compare(Integer o1, Integer o2) { return compare(o1.intValue(), o2.intValue()); } } ); IntArrayUtils.inverse(rankOfDictionaryIds); }
Source:
<code>public static <T> Class<T> loadClass(String className, ResourceLoader resourceLoader) { try { return cast(resourceLoader.classForName(className)); } catch (ResourceLoadingException e) { return null; <START> } catch (AccessControlException e) { <END> return null; } catch (SecurityException e) { return null; } }</code><technical_language>ACE is a subclass of SecurityException</technical_language>

Target:
public static <T> Class<T> loadClass(String className, ResourceLoader resourceLoader) { try { return cast(resourceLoader.classForName(className)); } catch (ResourceLoadingException e) { return null; } catch (SecurityException e) { return null; } }
Source:
<code>public Mutation(byte[] row, int start, int length, int initialBufferSize) { this.row = new byte[length]; System.arraycopy(row, start, this.row, 0, length); buffer = new UnsynchronizedBuffer.Writer(initialBufferSize); <START> estimatedSize = length + SERIALIZATION_OVERHEAD; <END> }</code><technical_language>Nice, included row</technical_language>

Target:
public Mutation(byte[] row, int start, int length, int initialBufferSize) { this.row = new byte[length]; System.arraycopy(row, start, this.row, 0, length); buffer = new UnsynchronizedBuffer.Writer(initialBufferSize); estRowAndLargeValSize = length + SERIALIZATION_OVERHEAD; }
Source:
<code>private boolean compactionRunning(List<Integer> jobIds) { if (jobIds.isEmpty()) { return false; <START> } <END> Integer jobId = jobIds.get(0); Option<SparkJobInfo> op = SpliceSpark.getContext().sc().statusTracker().getJobInfo(jobId); if (op.isEmpty()) { return false; } SparkJobInfo jobInfo = op.get(); if (jobInfo.status().equals(JobExecutionStatus.RUNNING)) { return true; } if (jobInfo.status().equals(JobExecutionStatus.SUCCEEDED)) { return true; } return false; }</code><technical_language>This function checks compaction started (or completed) execution, this change returns true is scheduled, tasks start running. new API need call getStageInfo() activeTasks completedTasks information checking API. get stageId jobInfo object (there's stage for compactions) pass statusTracker.getStageInfo()</technical_language>

Target:
private boolean compactionRunning(List<Integer> jobIds) { if (jobIds.isEmpty()) { return false; } Integer jobId = jobIds.get(0); SparkStatusTracker statusTracker = SpliceSpark.getContext().sc().statusTracker(); Option<SparkJobInfo> op = statusTracker.getJobInfo(jobId); if (op.isEmpty()) { return false; } SparkJobInfo jobInfo = op.get(); Integer stageIds = jobInfo.stageIds()[0]; Option<SparkStageInfo> stageInfoOp = statusTracker.getStageInfo(stageIds); if(stageInfoOp.isEmpty()) { return false; } SparkStageInfo stageInfo = stageInfoOp.get(); return stageInfo.numActiveTasks() > 0 || stageInfo.numCompletedTasks() > 0; }
Source:
<code><START> public final Set<CfgBlock> exits() { <END> return loopBlocks.stream().filter(this::isAnExit).collect(Collectors.toSet()); }</code><technical_language>@inverno public</technical_language>

Target:
final Set<CfgBlock> exits() { return loopBlocks.stream().filter(this::isExit).collect(Collectors.toSet()); }
Source:
<code>public void fillTextareaToEditResponseComment(int sessionIdx, int questionIdx, int responseIdx, int commentIdx, String text) { String editorId = "responsecommenttext-" + sessionIdx + "-" + questionIdx + "-" + responseIdx + "-" + commentIdx; WebElement textarea = browser.driver.findElement( By.id(editorId)); waitForRichTextEditorToLoad(editorId); <START> fillTextBox(textarea, text); <END> }</code><technical_language>is this fillRichTextEditor</technical_language>

Target:
public void fillTextareaToEditResponseComment(int sessionIdx, int questionIdx, int responseIdx, int commentIdx, String text) { WebElement textarea = browser.driver.findElement( By.id("responsecommenttext-" + sessionIdx + "-" + questionIdx + "-" + responseIdx + "-" + commentIdx)); click(textarea); textarea.clear(); textarea.sendKeys(text); }
Source:
<code><START> public AppResourceCommon(MavenProperties mavenProperties, ResourceLoader resourceLoader) { <END> this.mavenProperties = mavenProperties; this.resourceLoader = resourceLoader; }</code><technical_language>add null asserts for props loader</technical_language>

Target:
public AppResourceCommon(MavenProperties mavenProperties, ResourceLoader resourceLoader) { Assert.notNull(mavenProperties, "Non null Maven Properties are required!"); this.mavenProperties = mavenProperties; this.metadataResourceLoader = resourceLoader; }
Source:
<code>public void triggerEditMessageArea() { setStyle(firstMessageMenu, "block"); scrollAndClick(driver.findElement(firstMessageWrapperBy).findElement(moreButtonBy)); scrollAndClick(driver.findElement(firstMessageWrapperBy).findElement(editButtonBy)); <START> setStyle(firstMessageMenu, "none"); <END> }</code><technical_language>log ()</technical_language>

Target:
public void triggerEditMessageArea() { setDisplayStyle(firstMessageMenu, "block"); scrollAndClick(driver.findElement(firstMessageWrapperBy).findElement(moreButtonBy)); scrollAndClick(driver.findElement(firstMessageWrapperBy).findElement(editButtonBy)); setDisplayStyle(firstMessageMenu, "none"); PageObjectLogging.log("triggerEditMessageArea", "edit message area triggered", true); }
Source:
<code>public Void call() throws Exception { Objects.requireNonNull(acl, "ACL to be removed not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureBucketAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().removeAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", result ? "ACL removed successfully" : <START> "ACL not removed"); <END> client.close(); return null; }</code><technical_language>RemoveAcl returns false, passedAcl is existing, removed. Do need reword this convey this</technical_language>

Target:
public Void call() throws Exception { Objects.requireNonNull(acl, "ACL to be removed not specified."); OzoneAddress address = new OzoneAddress(uri); address.ensureBucketAddress(); OzoneClient client = address.createClient(createOzoneConfiguration()); String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); if (isVerbose()) { System.out.printf("Volume Name : %s%n", volumeName); System.out.printf("Bucket Name : %s%n", bucketName); } OzoneObj obj = OzoneObjInfo.Builder.newBuilder() .setBucketName(bucketName) .setVolumeName(volumeName) .setResType(OzoneObj.ResourceType.BUCKET) .setStoreType(storeType == null ? OZONE : OzoneObj.StoreType.valueOf(storeType)) .build(); boolean result = client.getObjectStore().removeAcl(obj, OzoneAcl.parseAcl(acl)); System.out.printf("%s%n", "Acl removed successfully: " + result); client.close(); return null; }
Source:
<code>private static String getUnifiedPath(String path) { String newPath = new Path(path).toString(); <START> newPath = newPath.replaceAll("/$", ""); END> return newPath; }</code><technical_language>I IPath.removeTrailingSeparator work here. new Path(path).removeTrailingSeparator().toString();</technical_language>

Target:
private static String getUnifiedPath(String path) { return new Path(path).removeTrailingSeparator().toString(); }
Source:
<code>public String getItemString(ITmfEvent event) { for (ITmfEventAspect<?> aspect : fAspects) { String eventString = NonNullUtils.nullToEmptyString(aspect.resolve(event)); <START> if (eventString != EMPTY_STRING) { <END> return eventString; } } return EMPTY_STRING; }</code><technical_language>I missed this before, if (!eventString.isEmpty())</technical_language>

Target:
public String getItemString(ITmfEvent event) { for (ITmfEventAspect<?> aspect : fAspects) { String eventString = NonNullUtils.nullToEmptyString(aspect.resolve(event)); if (!eventString.isEmpty()) { return eventString; } } return EMPTY_STRING; }
Source:
<code>public void setSiteMode() { <START> Framework.getRuntime().setProperty(SnapshotManager.PROPERTY_SITE_MODE, Boolean.toString(true)); <END> }</code><technical_language>"true" is simpler :)</technical_language>

Target:
public void setSiteMode() { Framework.getRuntime().setProperty(SnapshotManager.PROPERTY_SITE_MODE, "true"); }
Source:
<code>private void handleTableViewerKeyPressed(KeyEvent event) { if (event.keyCode == SWT.F2 && event.stateMask == 0) { <START> IStructuredSelection selection = (IStructuredSelection) list.getSelection(); <END> if (selection.size() == 1) { Object o = selection.getFirstElement(); if (o instanceof IPerspectiveDescriptor) { String description = ((IPerspectiveDescriptor) o).getDescription(); if (description.length() == 0) description = WorkbenchMessages.SelectPerspective_noDesc; popUp(description); } } } }</code><technical_language>getStructuredSelection</technical_language>

Target:
private void handleTableViewerKeyPressed(KeyEvent event) { if (event.keyCode == SWT.F2 && event.stateMask == 0) { IStructuredSelection selection = list.getStructuredSelection(); if (selection.size() == 1) { Object o = selection.getFirstElement(); if (o instanceof IPerspectiveDescriptor) { String description = ((IPerspectiveDescriptor) o).getDescription(); if (description.length() == 0) { description = WorkbenchMessages.SelectPerspective_noDesc; } popUp(description); } } } }
Source:
<code>private List<RuleResult<Patient>> patientsWithMoreThanOneEncounterOnTheSameDate() { log.info("Executing rule to find patients with more than one encounters on a single date"); <START> String queryString = "SELECT visit FROM Encounter e WHERE e.encounterType.uuid='8d5b2be0-c2cc-11de-8d13-0010c6dffd0f' GROUP BY e.encounterType.encounterTypeId, e.visit.visitId HAVING count(e.visit.visitId) > 1"; <END> Query query = getSession().createQuery(queryString); List<Visit> visitList = query.list(); log.info("There are " + visitList.size() + " visits with more than one encounter page"); List<RuleResult<Patient>> ruleResults = new ArrayList<>(); for (Visit visit : visitList) { RuleResult<Patient> ruleResult = new RuleResult<>(); ruleResult.setActionUrl("coreapps/patientdashboard/patientDashboard.page?patientId=" + visit.getPatient().getPatientId() + "&visitId=" + visit.getVisitId()); ruleResult.setNotes("Client #" + getHIVClinicNumber(visit.getPatient()) + " has more than one encounter on " + getDateFormatter().format(visit.getStartDatetime())); ruleResult.setEntity(visit.getPatient()); ruleResults.add(ruleResult); } return ruleResults; }</code><technical_language>@slubwama add checing for encounters voided (especially deleted) other data validation queries ensure this is care of (the voiding I mean)</technical_language>

Target:
private List<RuleResult<Patient>> patientsWithMoreThanOneEncounterOnTheSameDate() { log.info("Executing rule to find patients with more than one encounters on a single date"); String queryString = "SELECT visit FROM Encounter e WHERE e.voided = false AND e.encounterType.uuid='8d5b2be0-c2cc-11de-8d13-0010c6dffd0f' GROUP BY e.encounterType.encounterTypeId, e.visit.visitId HAVING count(e.visit.visitId) > 1"; Query query = getSession().createQuery(queryString); List<Visit> visitList = query.list(); log.info("There are " + visitList.size() + " visits with more than one encounter page"); List<RuleResult<Patient>> ruleResults = new ArrayList<>(); for (Visit visit : visitList) { RuleResult<Patient> ruleResult = new RuleResult<>(); ruleResult.setActionUrl("coreapps/patientdashboard/patientDashboard.page?patientId=" + visit.getPatient().getPatientId() + "&visitId=" + visit.getVisitId()); ruleResult.setNotes("Client #" + getHIVClinicNumber(visit.getPatient()) + " has more than one encounter on " + getDateFormatter().format(visit.getStartDatetime())); ruleResult.setEntity(visit.getPatient()); ruleResults.add(ruleResult); } return ruleResults; }