auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Optional<Argument> find(String name) { if (name.startsWith(prefix)) { String propertyName = name.substring(prefix.length()); for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (propertyName.equals(descriptor.getName())) { try { return ctx.findArgumentFor( descriptor.getReadMethod().getGenericReturnType(), descriptor.getReadMethod().invoke(bean)); } catch (IllegalAccessException e) { <START> throw new UnableToCreateStatementException(String.format("Access exception invoking getter for " + <END> "bean property [%s] on [%s]", propertyName, bean), e, ctx); } catch (InvocationTargetException e) { throw new UnableToCreateStatementException(String.format("Invocation target exception invoking " + "getter for bean property [%s] on [%s]", propertyName, bean), e, ctx); } } } } return Optional.empty(); }</code><technical_language>a test for this exception</technical_language>

Target:
public Optional<Argument> find(String name) { if (name.startsWith(prefix)) { String propertyName = name.substring(prefix.length()); for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (propertyName.equals(descriptor.getName())) { Method getter = descriptor.getReadMethod(); if (getter == null) { throw new UnableToCreateStatementException(String.format("No getter method found for " + "bean property [%s] on [%s]", propertyName, bean), ctx); } try { return ctx.findArgumentFor(getter.getGenericReturnType(), getter.invoke(bean)); } catch (IllegalAccessException e) { throw new UnableToCreateStatementException(String.format("Access exception invoking getter for " + "bean property [%s] on [%s]", propertyName, bean), e, ctx); } catch (InvocationTargetException e) { throw new UnableToCreateStatementException(String.format("Invocation target exception invoking " + "getter for bean property [%s] on [%s]", propertyName, bean), e, ctx); } } } } return Optional.empty(); }
Source:
<code>private ConnectorTableMetadata getTableMetadata(KuduTableHandle tableHandle) { KuduTable table = tableHandle.getTable(clientSession); Schema schema = table.getSchema(); List<ColumnMetadata> columnsMetaList = schema.getColumns().stream() <START> .filter(col -> !col.isKey() || !col.getName().equals(KuduColumnHandle.ROW_ID)) <END> .map(col -> { StringBuilder extra = new StringBuilder(); if (col.isKey()) { extra.append("key, "); } else if (col.isNullable()) { extra.append("nullable, "); } if (col.getEncoding() != null) { extra.append("encoding=").append(col.getEncoding().name()).append(", "); } if (col.getCompressionAlgorithm() != null) { extra.append("compression=").append(col.getCompressionAlgorithm().name()).append(", "); } if (extra.length() > 2) { extra.setLength(extra.length() - 2); } Type prestoType = TypeHelper.fromKuduColumn(col); return new ColumnMetadata(col.getName(), prestoType, null, extra.toString(), false); }).collect(toImmutableList()); Map<String, Object> properties = clientSession.getTableProperties(tableHandle); return new ConnectorTableMetadata(tableHandle.getSchemaTableName(), columnsMetaList, properties); }</code><technical_language>s/col/column</technical_language>

Target:
private ConnectorTableMetadata getTableMetadata(KuduTableHandle tableHandle) { KuduTable table = tableHandle.getTable(clientSession); Schema schema = table.getSchema(); List<ColumnMetadata> columnsMetaList = schema.getColumns().stream() .filter(column -> !column.isKey() || !column.getName().equals(KuduColumnHandle.ROW_ID)) .map(this::getColumnMetadata) .collect(toImmutableList()); Map<String, Object> properties = clientSession.getTableProperties(tableHandle); return new ConnectorTableMetadata(tableHandle.getSchemaTableName(), columnsMetaList, properties); }
Source:
<code>public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if (bindingConfig == null) { logger.debug("binding-configuration is currently not set for item: " + item.getName()); } String itemName = null; Matcher mItemName = Pattern.compile(REGEX_ITEM_NAME).matcher(bindingConfig); if (mItemName.find()) { itemName = mItemName.group(1); } String typeString = null; Matcher mType = Pattern.compile(REGEX_TYPE).matcher(bindingConfig); if (mType.find()) { typeString = mType.group(1); } CalDavType type = null; try { type = CalDavType.valueOf(typeString); } catch (IllegalArgumentException e) { <START> throw new BindingConfigParseException("cannot read required parameter 'type'"); <END> } logger.debug("adding item: {}", item.getName()); this.bindingConfigs.put(item.getName(), new CalDavNextEventConfig(item.getName(), itemName, type)); }</code><technical_language>please enhance description give administrator good information identify problem. e.g. add item name description</technical_language>

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if (bindingConfig == null) { logger.debug("binding-configuration is currently not set for item: " + item.getName()); } String itemName = null; Matcher mItemName = Pattern.compile(REGEX_ITEM_NAME).matcher(bindingConfig); if (mItemName.find()) { itemName = mItemName.group(1); } String typeString = null; Matcher mType = Pattern.compile(REGEX_TYPE).matcher(bindingConfig); if (mType.find()) { typeString = mType.group(1); } CalDavType type = null; try { type = CalDavType.valueOf(typeString); } catch (IllegalArgumentException e) { throw new BindingConfigParseException("cannot read required parameter 'type' for item: " + item.getName()); } logger.debug("adding item: {}", item.getName()); this.addBindingConfig(item, new CalDavNextEventConfig(item.getName(), itemName, type)); }
Source:
<code>protected Iterable<KeyPair> getDefaultKeys(@NonNull File sshDir) { if(keyPair == null) { List<Path> defaultIdentities = this.getDefaultIdentities(sshDir); <START> return (Iterable) this.defaultKeys.computeIfAbsent(new Tuple(defaultIdentities.toArray(new Path[0])), (t) -> { <END> return new CachingKeyPairProvider(defaultIdentities, this.getKeyCache()); }); } else { return (Iterable) Arrays.asList(keyPair); } }</code><technical_language>cast necessary</technical_language>

Target:
protected Iterable<KeyPair> getDefaultKeys(@NonNull File sshDir) { if(keyPair == null) { List<Path> defaultIdentities = this.getDefaultIdentities(sshDir); return this.defaultKeys.computeIfAbsent(new Tuple(defaultIdentities.toArray(new Path[0])), (t) -> new CachingKeyPairProvider(defaultIdentities, this.getKeyCache())); } else { return Collections.singletonList(keyPair); } }
Source:
<code>private void signalIfFinished() { if (mBackupStatus.isFinished()) { mFinishedBackups.put(mBackupStatus.getBackupId(), mBackupStatus.setEntryCount(mEntryCounter.get())); } if (mBackupStatus.isCompleted()) { mCompletion.set(null); <START> AlluxioEvent.BackupFinished.fire(mBackupStatus.getBackupId()); <END> } else if (mBackupStatus.isFailed()) { mCompletion.setException(mBackupStatus.getError()); AlluxioEvent.BackupFailed.fire(mBackupStatus.getBackupId()); } }</code><technical_language>label int values in output</technical_language>

Target:
private void signalIfFinished() { if (mBackupStatus.isFinished()) { mFinishedBackups.put(mBackupStatus.getBackupId(), mBackupStatus.setEntryCount(mEntryCounter.get())); } if (mBackupStatus.isCompleted()) { mCompletion.set(null); AlluxioEvent.BackupFinished.fire(new Pair<>("BackupId", mBackupStatus.getBackupId())); } else if (mBackupStatus.isFailed()) { mCompletion.setException(mBackupStatus.getError()); AlluxioEvent.BackupFailed.fire(new Pair<>("BackupId", mBackupStatus.getBackupId())); } }
Source:
<code>protected String getRequestTokenParams(final Request request, final Configuration c) { <START> return Constants.CONSUMER_KEY + "=" <END> + c.getString(SettingKeys.CONSUMER_KEY) + "&" + getRedirectUriKey() + "=" + getRedirectUrl(request); }</code><technical_language>List<NameValuePair> cleaner here, I think</technical_language>

Target:
protected List<NameValuePair> getRequestTokenParams(final Request request, final Configuration c) { final List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair(PocketConstants.CONSUMER_KEY, c.getString(SettingKeys.CONSUMER_KEY))); params.add(new BasicNameValuePair(getRedirectUriKey(), getRedirectUrl(request))); return params; }
Source:
<code>private synchronized void shrinkWriteOperationQueue() throws IOException { <START> outputStreamStatistics.queueShrinked(); <END> try { while (writeOperations.peek() != null && writeOperations.peek().task.isDone()) { writeOperations.peek().task.get(); lastTotalAppendOffset += writeOperations.peek().length; writeOperations.remove(); } } catch (Exception e) { if (e.getCause() instanceof AzureBlobFileSystemException) { lastError = (AzureBlobFileSystemException) e.getCause(); } else { lastError = new IOException(e); } throw lastError; } }</code><technical_language>I understand benifits of capturing this metric</technical_language>

Target:
private synchronized void shrinkWriteOperationQueue() throws IOException { try { while (writeOperations.peek() != null && writeOperations.peek().task.isDone()) { writeOperations.peek().task.get(); lastTotalAppendOffset += writeOperations.peek().length; writeOperations.remove(); outputStreamStatistics.queueShrunk(); } } catch (Exception e) { if (e.getCause() instanceof AzureBlobFileSystemException) { lastError = (AzureBlobFileSystemException) e.getCause(); } else { lastError = new IOException(e); } throw lastError; } }
Source:
<code>getIndex(String indexName, FieldDescriptor fieldDescriptor) { return new Index<>( () -> indexName, (CorfuTable.IndexFunction<Message, CorfuRecord<Message, Message>, T>) (key, val) -> (T) val.getPayload().getField(fieldDescriptor)); <START> } <END></code><technical_language>please create a (domain) interface (that extend Comparable<T>) interface name explain is that. right completely unclear Comparable</technical_language>

Target:
getIndex(String indexName, FieldDescriptor fieldDescriptor) { return new Index<>( () -> indexName, (CorfuTable.IndexFunction<Message, CorfuRecord<Message, Message>, T>) (key, val) -> ClassUtils.cast(val.getPayload().getField(fieldDescriptor))); }
Source:
<code>public void showList() throws Exception { final ProjectMigrationPresenter.View view = mock(ProjectMigrationPresenter.View.class); doReturn(view).when(projectListAssetsPresenter).getView(); final HTMLElement element = mock(HTMLElement.class); doReturn(element).when(view).getElement(); final WorkspaceProject project = new WorkspaceProject(mock(OrganizationalUnit.class), mock(Repository.class), mock(Branch.class), mock(KieModule.class)); doReturn(project).when(projectContext).getActiveWorkspaceProject(); doReturn(true).when(libraryService).hasAssets(project); screen.onStartup(); verify(projectDetailEvent).fire(projectDetailEventArgumentCaptor.capture()); assertEquals(project, projectDetailEventArgumentCaptor.getValue().getProject()); verify(projectListAssetsPresenter).show(project); verify(this.view).setContent(element); <START> } <END></code><technical_language>please fix this</technical_language>

Target:
public void showList() throws Exception { final ProjectMigrationPresenter.View view = mock(ProjectMigrationPresenter.View.class); doReturn(view).when(workspaceProjectListAssetsPresenter).getView(); final HTMLElement element = mock(HTMLElement.class); doReturn(element).when(view).getElement(); final WorkspaceProject project = new WorkspaceProject(mock(OrganizationalUnit.class), mock(Repository.class), mock(Branch.class), mock(KieModule.class)); doReturn(project).when(projectContext).getActiveWorkspaceProject(); doReturn(true).when(libraryService).hasAssets(project); screen.onStartup(); verify(projectDetailEvent).fire(projectDetailEventArgumentCaptor.capture()); assertEquals(project, projectDetailEventArgumentCaptor.getValue().getProject()); verify(workspaceProjectListAssetsPresenter).show(project); verify(this.view).setContent(element); }
Source:
<code>static public OutputStream openOutputFileEx(String filename) throws FileNotFoundException,IOException { if ( filename == null || filename.equals("-") ) return System.out ; if ( filename.startsWith("file:") ) { filename = filename.substring("file:".length()) ; filename = IRILib.decode(filename) ; } OutputStream out = new FileOutputStream(filename) ; <START> String ext = FileOps.extension(filename); <END> switch ( ext ) { case "": return out; case "gz": return new GZIPOutputStream(out) ; case "bz2": return new BZip2CompressorOutputStream(out); case "sz": throw new UnsupportedOperationException("Snappy output"); } return out ; }</code><technical_language>Digressing; FilenameUtils.getExtension() in classpath, commons-io, this marked deprecated</technical_language>

Target:
static public OutputStream openOutputFileEx(String filename) throws FileNotFoundException,IOException { if ( filename == null || filename.equals("-") ) return System.out ; if ( filename.startsWith("file:") ) { filename = filename.substring("file:".length()) ; filename = IRILib.decode(filename) ; } OutputStream out = new FileOutputStream(filename) ; String ext = FilenameUtils.getExtension(filename); switch ( ext ) { case "": return out; case "gz": return new GZIPOutputStream(out) ; case "bz2": return new BZip2CompressorOutputStream(out); case "sz": throw new UnsupportedOperationException("Snappy output"); } return out ; }
Source:
<code><START> public static int runTasksOnce(List<VirtualFSInterface> vfss) { <END> log.debug("Starting DiskUsageService runTasksOnce ..."); ExecutorService executor = Executors.newSingleThreadExecutor(); vfss.forEach(vfs -> { DiskUsageTask task = new DiskUsageTask(vfs); log.debug("Run task {}", task); executor.submit(task); }); log.debug("Submitted tasks", vfss.size()); executor.shutdown(); return vfss.size(); }</code><technical_language>is this needed</technical_language>

Target:
public static synchronized int runTasksOnce(List<VirtualFSInterface> vfss) { log.debug("Starting DiskUsageService runTasksOnce ..."); ExecutorService executor = Executors.newSingleThreadExecutor(); vfss.forEach(vfs -> { DiskUsageTask task = new DiskUsageTask(vfs); log.debug("Run task {}", task); executor.submit(task); }); log.debug("Submitted tasks", vfss.size()); executor.shutdown(); return vfss.size(); }
Source:
<code>public void scheduleTimeout(Channel channel) { assert timeoutFuture == null; <START> this.timeoutFuture = channel.eventLoop().schedule(new TimeoutRunnable(channel), channelFactory.socketTimeout(), TimeUnit.MILLISECONDS); <END> }</code><technical_language>Meh, means a new allocation in operation :-/ I mess storing channel in HotRodOperation</technical_language>

Target:
public void scheduleTimeout(Channel channel) { assert timeoutFuture == null; this.channel = channel; this.timeoutFuture = channel.eventLoop().schedule(this, channelFactory.socketTimeout(), TimeUnit.MILLISECONDS); }
Source:
<code>public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.renderingConfig = context.get(Config.class).getRendering(); this.shaderManager = context.get(ShaderManager.class); vrProvider = OpenVRProvider.getInstance(); if (renderingConfig.isVrSupport()) { context.put(OpenVRProvider.class, vrProvider); if (vrProvider.init()) { playerCamera = new OpenVRStereoCamera(vrProvider, worldProvider, renderingConfig); vrProvider.getState().setGroundPlaneYOffset( GROUND_PLANE_HEIGHT_DISPARITY - context.get(Config.class).getPlayer().getEyeHeight()); currentRenderingStage = RenderingStage.LEFT_EYE; } else { playerCamera = new PerspectiveCamera(worldProvider, renderingConfig, context.get(DisplayDevice.class)); currentRenderingStage = RenderingStage.MONO; } } else { playerCamera = new PerspectiveCamera(worldProvider, renderingConfig, context.get(DisplayDevice.class)); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera); renderQueues = renderableWorld.getRenderQueues(); initRenderingSupport(); <START> MethodCommand.registerAvailable(this, context.get(Console.class), context); <END> }</code><technical_language>This is neat! remember elsewhere!! :smiley:</technical_language>

Target:
public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.renderingConfig = context.get(Config.class).getRendering(); this.shaderManager = context.get(ShaderManager.class); vrProvider = OpenVRProvider.getInstance(); if (renderingConfig.isVrSupport()) { context.put(OpenVRProvider.class, vrProvider); if (vrProvider.init()) { playerCamera = new OpenVRStereoCamera(vrProvider, worldProvider, renderingConfig); vrProvider.getState().setGroundPlaneYOffset( GROUND_PLANE_HEIGHT_DISPARITY - context.get(Config.class).getPlayer().getEyeHeight()); currentRenderingStage = RenderingStage.LEFT_EYE; } else { playerCamera = new PerspectiveCamera(worldProvider, renderingConfig, context.get(DisplayDevice.class)); currentRenderingStage = RenderingStage.MONO; } } else { playerCamera = new PerspectiveCamera(worldProvider, renderingConfig, context.get(DisplayDevice.class)); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera); renderQueues = renderableWorld.getRenderQueues(); initRenderingSupport(); console = context.get(Console.class); MethodCommand.registerAvailable(this, console, context); }
Source:
<code><START> private void writeDevelopers(IndentingWriter writer, MavenBuildSettings settings) { <END> writeElement(writer, "developers", () -> { if (settings.getDevelopers() == null) { writer.println("<developer />"); } }); }</code><technical_language>For consistency do if list is empty. other containers currently operate I changing for elements is misleading. Rather, find a define "empty" license "empty" developer lead creation of empty element. decision applied spring boot parent is want generate elements for projects (typically conventions)</technical_language>

Target:
private void writeDevelopers(IndentingWriter writer, MavenBuildSettings settings) { if (settings.getDevelopers().isEmpty()) { return; } writeElement(writer, "developers", () -> writeCollection(writer, settings.getDevelopers(), this::writeDeveloper)); }
Source:
<code>protected Control renderControl(SWTGridCell cell, Composite parent) throws NoPropertyDescriptorFoundExeption, NoRendererFoundException { if (rendererGridDescription.getColumns() == 1) { return renderMultiAttributeControl(cell, parent); } if (cell.getColumn() == 0 && rendererGridDescription.getColumns() > 1) { validationIcon = createValidationIcon(parent); GridDataFactory.fillDefaults().hint(16, 17).grab(false, false).applyTo(validationIcon); return validationIcon; } final Composite composite = new Composite(parent, SWT.NONE); composite.setBackground(parent.getBackground()); try { final IObservableList list = getEMFFormsDatabinding().getObservableList( getVElement().getDomainModelReference(), getViewModelContext().getDomainModel()); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite); final Control multiAttributeComposite = renderMultiAttributeControl(cell, composite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(multiAttributeComposite); buttonComposite = createButtonComposite(composite, list); GridDataFactory.fillDefaults().align(SWT.END, SWT.BEGINNING).grab(false, false).applyTo(buttonComposite); initButtons(list); <START> applyEnable(); <END> applyReadOnly(); } catch (final DatabindingFailedException ex) { getReportService().report(new RenderingFailedReport(ex)); return createErrorLabel(composite, ex); } return composite; }</code><technical_language>apply enable apply readonly called in postinit call? is late</technical_language>

Target:
protected Control renderControl(SWTGridCell cell, Composite parent) throws NoPropertyDescriptorFoundExeption, NoRendererFoundException { if (rendererGridDescription.getColumns() == 1) { return renderMultiAttributeControl(cell, parent); } if (cell.getColumn() == 0 && rendererGridDescription.getColumns() > 1) { validationIcon = createValidationIcon(parent); GridDataFactory.fillDefaults().hint(16, 17).grab(false, false).applyTo(validationIcon); return validationIcon; } final Composite composite = new Composite(parent, SWT.NONE); composite.setBackground(parent.getBackground()); try { final IObservableList list = getEMFFormsDatabinding().getObservableList( getVElement().getDomainModelReference(), getViewModelContext().getDomainModel()); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite); final Control multiAttributeComposite = renderMultiAttributeControl(cell, composite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(multiAttributeComposite); final Composite buttonComposite = createButtonComposite(composite, list); GridDataFactory.fillDefaults().align(SWT.END, SWT.BEGINNING).grab(false, false).applyTo(buttonComposite); initButtons(list); } catch (final DatabindingFailedException ex) { getReportService().report(new RenderingFailedReport(ex)); return createErrorLabel(composite, ex); } return composite; }
Source:
<code>public void shouldKillStreamAppWhenZooKeeperDiesBeforeLeaderReElection() throws InterruptedException { ApplicationConfig applicationConfig1 = buildStreamApplicationConfig(SYSTEM, inputKafkaTopic, outputKafkaTopic, NUM_KAFKA_EVENTS, PROCESSOR_IDS[0], testStreamAppName, testStreamAppId); ApplicationConfig applicationConfig2 = buildStreamApplicationConfig(SYSTEM, inputKafkaTopic, outputKafkaTopic, NUM_KAFKA_EVENTS, PROCESSOR_IDS[1], testStreamAppName, testStreamAppId); StreamApplication streamApp1 = new TestStreamApplication(inputKafkaTopic, outputKafkaTopic, PROCESSOR_IDS[0], null, null); StreamApplication streamApp2 = new TestStreamApplication(inputKafkaTopic, outputKafkaTopic, PROCESSOR_IDS[1], null, null); LocalApplicationRunner applicationRunner1 = new LocalApplicationRunner(applicationConfig1); LocalApplicationRunner applicationRunner2 = new LocalApplicationRunner(applicationConfig2); applicationRunner1.run(streamApp1); applicationRunner2.run(streamApp2); applicationRunner1.kill(streamApp1); zookeeper().shutdown(); <START> Thread.sleep(6000); <END> assertEquals(ApplicationStatus.UnsuccessfulFinish, applicationRunner1.status(streamApp2)); }</code><technical_language>No</technical_language>

Target:
public void shouldKillStreamAppWhenZooKeeperDiesBeforeLeaderReElection() throws InterruptedException { StreamApplication streamApp1 = new TestStreamApplication(inputKafkaTopic, outputKafkaTopic, null, null, null); StreamApplication streamApp2 = new TestStreamApplication(inputKafkaTopic, outputKafkaTopic, null, null, null); applicationRunner1.run(streamApp1); applicationRunner2.run(streamApp2); applicationRunner1.kill(streamApp1); applicationRunner1.waitForFinish(); assertEquals(ApplicationStatus.SuccessfulFinish, applicationRunner1.status(streamApp2)); zookeeper().shutdown(); applicationRunner1 = new LocalApplicationRunner(applicationConfig1); applicationRunner1.run(streamApp1); applicationRunner1.waitForFinish(); }
Source:
<code>private String extractConnectionKey(final iOSVariant iOSVariant) { <START> final StringBuilder sb = new StringBuilder() <END> .append(iOSVariant.getVariantID()) .append(iOSVariant.isProduction() ? "-prod" : "-dev"); return sb.toString(); }</code><technical_language>need assign a temporary variable</technical_language>

Target:
private String extractConnectionKey(final iOSVariant iOSVariant) { return new StringBuilder() .append(iOSVariant.getVariantID()) .append(iOSVariant.isProduction() ? "-prod" : "-dev") .toString(); }
Source:
<code>protected boolean validatePayeeAchAccountExistence(PayeeACHAccount payeeAchAccount, String routingNumber, String accountNumber) { boolean isValid = true; <START> if (ObjectUtils.isNull(payeeAchAccount) && (StringUtils.isEmpty(routingNumber) || StringUtils.isEmpty(accountNumber))) { <END> GlobalVariables.getMessageMap().putError("payeeAchAccount", KFSKeyConstants.ERROR_CUSTOM, "No existing Payee ACH Account, routing number and account number required"); isValid = false; } return isValid; }</code><technical_language>whitespace characters valid, this StringUtils.isBlank instead of StringUtils.isEmpty (here elsewhere)</technical_language>

Target:
protected boolean validatePayeeAchAccountExistence(PayeeACHAccount payeeAchAccount, String routingNumber, String accountNumber) { boolean valid = true; if (ObjectUtils.isNull(payeeAchAccount) && (StringUtils.isBlank(routingNumber) || StringUtils.isBlank(accountNumber))) { GlobalVariables.getMessageMap().putError("payeeAchAccount", KFSKeyConstants.ERROR_CUSTOM, "No existing Payee ACH Account, routing number and account number required"); valid = false; } return valid; }
Source:
<code>public void setLegacycidInChangeTable(boolean legacycidInChangeTable) { this.legacycidInChangeTable = legacycidInChangeTable; <START> <END> public PreselectDiffAgainst getPreselectRevision() { if (preselectRevision == null) { return PreselectDiffAgainst.BASE; } return PreselectDiffAgainst.valueOf(preselectRevision); } public void setPreselectRevision(PreselectDiffAgainst preselectRevision) { this.preselectRevision = preselectRevision.name(); } public void resetToDefaults() { maximumPageSize = DEFAULT_PAGESIZE; showSiteHeader = true; useFlashClipboard = true; copySelfOnEmail = false; reversePatchSetOrder = false; showUserInReview = false; downloadUrl = null; downloadCommand = null; dateFormat = null; timeFormat = null; relativeDateInChangeTable = false; commentVisibilityStrategy = null; diffView = null; changeScreen = null; sizeBarInChangeTable = true; legacycidInChangeTable = false; preselectRevision = null; } }</code><technical_language>missing closing brace here</technical_language>

Target:
public void setLegacycidInChangeTable(boolean legacycidInChangeTable) { this.legacycidInChangeTable = legacycidInChangeTable; }
Source:
<code>protected final void stopRewriteSessionOnPartitioners(DocumentRewriteSession session) { if (fDocumentPartitioners != null) { DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); for (Entry<String, IDocumentPartitioner> entry : fDocumentPartitioners.entrySet()) { String partitioning = entry.getKey(); IDocumentPartitioner partitioner= <START> fDocumentPartitioners.get(partitioning); <END> if (partitioner instanceof IDocumentPartitionerExtension3) { IDocumentPartitionerExtension3 extension= (IDocumentPartitionerExtension3) partitioner; extension.stopRewriteSession(session); event.setPartitionChange(partitioning, 0, getLength()); } } if (!event.isEmpty()) fireDocumentPartitioningChanged(event); } }</code><technical_language>entry.getValue()</technical_language>

Target:
protected final void stopRewriteSessionOnPartitioners(DocumentRewriteSession session) { if (fDocumentPartitioners != null) { DocumentPartitioningChangedEvent event= new DocumentPartitioningChangedEvent(this); for (Entry<String, IDocumentPartitioner> entry : fDocumentPartitioners.entrySet()) { String partitioning = entry.getKey(); IDocumentPartitioner partitioner= entry.getValue(); if (partitioner instanceof IDocumentPartitionerExtension3) { IDocumentPartitionerExtension3 extension= (IDocumentPartitionerExtension3) partitioner; extension.stopRewriteSession(session); event.setPartitionChange(partitioning, 0, getLength()); } } if (!event.isEmpty()) fireDocumentPartitioningChanged(event); } }
Source:
<code>public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { return builder <START> .withValue(TaskContract.Tasks.DUE, mDue.getTimestamp()) <END> .withValue(TaskContract.Tasks.DTSTART, null) .withValue(TaskContract.Tasks.DURATION, null) .withValue(TaskContract.Tasks.RDATE, null) .withValue(TaskContract.Tasks.RRULE, null) .withValue(TaskContract.Tasks.EXDATE, null); }</code><technical_language>set allday flag time zone</technical_language>

Target:
public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { return builder .withValue(TaskContract.Tasks.DUE, mDue.getTimestamp()) .withValue(TaskContract.Tasks.TZ, mDue.isAllDay() ? "UTC" : mDue.getTimeZone().getID()) .withValue(TaskContract.Tasks.IS_ALLDAY, mDue.isAllDay() ? 1 : 0) .withValue(TaskContract.Tasks.DTSTART, null) .withValue(TaskContract.Tasks.DURATION, null) .withValue(TaskContract.Tasks.RDATE, null) .withValue(TaskContract.Tasks.RRULE, null) .withValue(TaskContract.Tasks.EXDATE, null); }
Source:
<code>public boolean fileApprovedAmountsMatchHeaderApprovedAmount(ConcurRequestExtractFile requestExtractFile) { double detailLinesApprovedAmountSum = 0; <START> List<ConcurRequestExtractRequestDetailFileLine> requestDetailLines = requestExtractFile.getRequestDetails(); <END> for (ConcurRequestExtractRequestDetailFileLine detailLine : requestDetailLines) { detailLinesApprovedAmountSum = detailLinesApprovedAmountSum + detailLine.getRequestAmount().doubleValue(); } KualiDecimal detailLinesAmountSumKualiDecimal = new KualiDecimal(detailLinesApprovedAmountSum); if (detailLinesAmountSumKualiDecimal.doubleValue() == requestExtractFile.getTotalApprovedAmount().doubleValue()) { return true; } else { LOG.error("Header amount validation failed. Header amount was =" +requestExtractFile.getTotalApprovedAmount().toString()+"= while file calculated amount was =" +detailLinesAmountSumKualiDecimal.toString()+ "="); return false; } }</code><technical_language>extract this code in a separate method calculate total in check for matching totals</technical_language>

Target:
private boolean fileApprovedAmountsMatchHeaderApprovedAmount(ConcurRequestExtractFile requestExtractFile) { KualiDecimal detailLinesAmountSumKualiDecimal = getTotalRequestFileRequestAmount(requestExtractFile); if (detailLinesAmountSumKualiDecimal.equals(requestExtractFile.getTotalApprovedAmount())) { return true; } else { LOG.error("Header amount validation failed. Header amount was =" + requestExtractFile.getTotalApprovedAmount().toString() + "= while file calculated amount was =" + detailLinesAmountSumKualiDecimal.toString() + "="); return false; } }
Source:
<code>public StringPatternConnection openConnection(DataCleanerConfiguration configuration) { return new StringPatternConnection() { private final Pattern _pattern = Pattern.compile(_expression); @Override public boolean matches(String string) { if (string == null) { return false; } <START> Matcher matcher = _pattern.matcher(string); <END> if (matcher.find()) { if (_matchEntireString) { int s = matcher.start(); if (s == 0) { int e = matcher.end(); if (e == string.length()) { return true; } } return false; } return true; } return false; } @Override public void close() { } }; }</code><technical_language>final</technical_language>

Target:
public StringPatternConnection openConnection(DataCleanerConfiguration configuration) { return new StringPatternConnection() { private final Pattern _pattern = Pattern.compile(_expression); @Override public boolean matches(String string) { if (string == null) { return false; } final Matcher matcher = _pattern.matcher(string); if (matcher.find()) { if (_matchEntireString) { int s = matcher.start(); if (s == 0) { int e = matcher.end(); if (e == string.length()) { return true; } } return false; } return true; } return false; } @Override public void close() { } }; }
Source:
<code>protected boolean isPage200(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.NOTFOUND_404) || isCustomPage(msg, CustomPage.Type.ERROR_500)) { <START> return false; <END> } return isCustomPage(msg, CustomPage.Type.OK_200) ? true : parent.getAnalyser().isFileExist(msg); }</code><technical_language>This case is covered</technical_language>

Target:
protected boolean isPage200(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.NOTFOUND_404) || isCustomPage(msg, CustomPage.Type.ERROR_500)) { return false; } if (isCustomPage(msg, CustomPage.Type.OK_200)) { return true; } return parent.getAnalyser().isFileExist(msg); }
Source:
<code>public ProxyIterator( ProxyClient<S> client, PartitionId partitionId, OpenFunction<S> openFunction, NextFunction<S, T> nextFunction, CloseFunction<S> closeFunction) { this.client = client; this.partitionId = partitionId; this.nextFunction = nextFunction; this.closeFunction = closeFunction; <START> this.openFuture = client.applyOn(partitionId, openFunction::open); <END> this.batch = CompletableFuture.completedFuture( new IteratorBatch<T>(0, Collections.emptyList())); }</code><technical_language>is this ordered future</technical_language>

Target:
public ProxyIterator( ProxyClient<S> client, PartitionId partitionId, OpenFunction<S> openFunction, NextFunction<S, T> nextFunction, CloseFunction<S> closeFunction) { this.client = client; this.partitionId = partitionId; this.nextFunction = nextFunction; this.closeFunction = closeFunction; this.openFuture = OrderedFuture.wrap(client.applyOn(partitionId, openFunction::open)); this.batch = CompletableFuture.completedFuture( new IteratorBatch<T>(0, Collections.emptyList())); }
Source:
<code><START> public static Observable<Location> findLocationByName(String name) { <END> return createObservableIO(() -> { if(!StringUtils.notNull(name)){ return null; } Location location = new Location(); String where = String.format("%s = ?", LocationTable.Column.DISPLAY); String[] whereArgs = new String[]{name}; DBOpenHelper helper = OpenMRSDBOpenHelper.getInstance().getDBOpenHelper(); final Cursor cursor = helper.getReadableDatabase().query(LocationTable.TABLE_NAME, null, where, whereArgs, null, null, null); if (null != cursor) { try { if (cursor.moveToFirst()) { location = cursorToLocation(cursor); } } finally { cursor.close(); } } return location; }); }</code><technical_language>revert this :)</technical_language>

Target:
public Location findLocationByName(String name) { if(!StringUtils.notNull(name)){ return null; } Location location = new Location(); String where = String.format("%s = ?", LocationTable.Column.DISPLAY); String[] whereArgs = new String[]{name}; DBOpenHelper helper = OpenMRSDBOpenHelper.getInstance().getDBOpenHelper(); final Cursor cursor = helper.getReadableDatabase().query(LocationTable.TABLE_NAME, null, where, whereArgs, null, null, null); if (null != cursor) { try { if (cursor.moveToFirst()) { location = cursorToLocation(cursor); } } finally { cursor.close(); } } return location; }
Source:
<code>private void assertBadTableName(String tableName){ boolean failed = false; try { createTable(TableName.valueOf(tableName)); <START> } catch (Exception ex) { <END> failed = true; } Assert.assertTrue("Should fail as table name: '" + tableName + "'", failed); }</code><technical_language>Add this in try block: Assert.fail("Should fail table name: '" + tableName + "'"); remove assertTrue</technical_language>

Target:
private void assertBadTableName(String tableName){ try { createTable(TableName.valueOf(tableName)); Assert.fail("Should fail as table name: '" + tableName + "'"); } catch (Exception ex) { } }
Source:
<code>private static boolean checkImageConfiguration(StorageDomainStatic storageDomain, VolumeType volumeType, VolumeFormat volumeFormat, DiskBackup diskBackup) { return !((volumeType == VolumeType.Preallocated && volumeFormat == VolumeFormat.COW && diskBackup != DiskBackup.Incremental) || <START> volumeFormat == VolumeFormat.RAW && diskBackup == DiskBackup.Incremental <END> || (storageDomain.getStorageType().isBlockDomain() && volumeType == VolumeType.Sparse && volumeFormat == VolumeFormat.RAW) || volumeFormat == VolumeFormat.Unassigned || volumeType == VolumeType.Unassigned); }</code><technical_language>Surround (): (volumeFormat == VolumeFormat.RAW && diskBackup == DiskBackup.Incremental) similar 1 line below. required due operators' precedence, in readability save bugs in future</technical_language>

Target:
private static boolean checkImageConfiguration(StorageDomainStatic storageDomain, VolumeType volumeType, VolumeFormat volumeFormat, DiskBackup diskBackup) { return !((volumeType == VolumeType.Preallocated && volumeFormat == VolumeFormat.COW && diskBackup != DiskBackup.Incremental) || (volumeFormat == VolumeFormat.RAW && diskBackup == DiskBackup.Incremental) || (storageDomain.getStorageType().isBlockDomain() && volumeType == VolumeType.Sparse && volumeFormat == VolumeFormat.RAW) || volumeFormat == VolumeFormat.Unassigned || volumeType == VolumeType.Unassigned); }
Source:
<code>public void ksEventReceived(KSEvent ksEvent) { if (!processing) { this.isSTTServerAborting = false; if (ksEvent instanceof KSpottedEvent) { toggleProcessing(true); if (stt != null) { try { this.sttServiceHandle = stt.recognize(this, source.getInputStream(format), this.locale, new HashSet<String>()); } catch (STTException | AudioException e) { <START> logger.error("Error during recognition", e); <END> say("Error during recognition: " + e.getMessage()); } } } else if (ksEvent instanceof KSErrorEvent) { KSErrorEvent kse = (KSErrorEvent) ksEvent; say("Encountered error spotting keywords, " + kse.getMessage()); } } }</code><technical_language>Is this a "software bug" situation requires error logging a stack trace</technical_language>

Target:
public void ksEventReceived(KSEvent ksEvent) { if (!processing) { this.isSTTServerAborting = false; if (ksEvent instanceof KSpottedEvent) { toggleProcessing(true); if (stt != null) { try { this.sttServiceHandle = stt.recognize(this, source.getInputStream(format), this.locale, new HashSet<String>()); } catch (STTException e) { say("Error during recognition: " + e.getMessage()); } catch (AudioException e) { logger.error("Error creating the audio stream", e); } } } else if (ksEvent instanceof KSErrorEvent) { KSErrorEvent kse = (KSErrorEvent) ksEvent; say("Encountered error spotting keywords, " + kse.getMessage()); } } }
Source:
<code>public void testFatalErrorOnCanceling() throws Exception { final CompletableFuture<Throwable> fatalErrorFuture = new CompletableFuture<>(); final TestingTaskManagerActions taskManagerActions = TestingTaskManagerActions.newBuilder() .setNotifyFatalErrorConsumer((s, throwable) -> fatalErrorFuture.complete(throwable)) .build(); final Configuration config = new Configuration(); config.setLong(TaskManagerOptions.TASK_CANCELLATION_INTERVAL, 5); config.setLong(TaskManagerOptions.TASK_CANCELLATION_TIMEOUT, 50); final Task task = spy(createTaskBuilder() .setInvokable(InvokableBlockingWithTrigger.class) .setTaskManagerConfig(config) .setTaskManagerActions(taskManagerActions) .build()); final Class<OutOfMemoryError> fatalErrorType = OutOfMemoryError.class; doThrow(fatalErrorType).when(task).cancelOrFailAndCancelInvokableInternal(eq(ExecutionState.CANCELING), eq(null)); try { task.startTaskThread(); awaitLatch.await(); task.cancelExecution(); final Throwable fatalError = fatalErrorFuture.join(); assertThat(fatalError, instanceOf(fatalErrorType)); } catch (Throwable t) { <START> fail("No exception is expected to be thrown by fatal error handling"); <END> } finally { triggerLatch.trigger(); } }</code><technical_language>Explicitly failing test unnecessarily verbose</technical_language>

Target:
public void testFatalErrorOnCanceling() throws Exception { final CompletableFuture<Throwable> fatalErrorFuture = new CompletableFuture<>(); final TestingTaskManagerActions taskManagerActions = TestingTaskManagerActions.newBuilder() .setNotifyFatalErrorConsumer((s, throwable) -> fatalErrorFuture.complete(throwable)) .build(); final Configuration config = new Configuration(); config.setLong(TaskManagerOptions.TASK_CANCELLATION_INTERVAL, 5); config.setLong(TaskManagerOptions.TASK_CANCELLATION_TIMEOUT, 50); final Task task = spy(createTaskBuilder() .setInvokable(InvokableBlockingWithTrigger.class) .setTaskManagerConfig(config) .setTaskManagerActions(taskManagerActions) .build()); final Class<OutOfMemoryError> fatalErrorType = OutOfMemoryError.class; doThrow(fatalErrorType).when(task).cancelOrFailAndCancelInvokableInternal(eq(ExecutionState.CANCELING), eq(null)); try { task.startTaskThread(); awaitLatch.await(); task.cancelExecution(); final Throwable fatalError = fatalErrorFuture.join(); assertThat(fatalError, instanceOf(fatalErrorType)); } finally { triggerLatch.trigger(); } }
Source:
<code>private Optional<PendingTaskManagerSlot> allocateResource(ResourceProfile requestedSlotResourceProfile) { if (getNumberPendingTaskManagerSlots() + getNumberRegisteredSlots() + numSlotsPerWorker > maxSlotNum) { <START> LOG.warn("Could not allocate more slots since the number of slots already reach maximum {}.", <END> getNumberPendingTaskManagerSlots() + getNumberRegisteredSlots(), maxSlotNum); return Optional.empty(); } if (!defaultSlotResourceProfile.isMatching(requestedSlotResourceProfile)) { return Optional.empty(); } if (!resourceActions.allocateResource(defaultWorkerResourceSpec)) { return Optional.empty(); } PendingTaskManagerSlot pendingTaskManagerSlot = null; for (int i = 0; i < numSlotsPerWorker; ++i) { pendingTaskManagerSlot = new PendingTaskManagerSlot(defaultSlotResourceProfile); pendingSlots.put(pendingTaskManagerSlot.getTaskManagerSlotId(), pendingTaskManagerSlot); } return Optional.of(Preconditions.checkNotNull(pendingTaskManagerSlot, "At least one pending slot should be created.")); }</code><technical_language>mention slots allocate. E.g., numSlotsPerWorker is 3, a log following. > allocate more slots number of slots 9 reach maximum 10. This confusing 9 is reaching 10</technical_language>

Target:
private Optional<PendingTaskManagerSlot> allocateResource(ResourceProfile requestedSlotResourceProfile) { final int numRegisteredSlots = getNumberRegisteredSlots(); final int numPendingSlots = getNumberPendingTaskManagerSlots(); if (isMaxSlotNumExceededAfterAdding(numSlotsPerWorker)) { LOG.warn("Could not allocate more slots. The number of registered and pending slots is {}, while the maximum is {}.", numSlotsPerWorker, numPendingSlots + numRegisteredSlots, maxSlotNum); return Optional.empty(); } if (!defaultSlotResourceProfile.isMatching(requestedSlotResourceProfile)) { return Optional.empty(); } if (!resourceActions.allocateResource(defaultWorkerResourceSpec)) { return Optional.empty(); } PendingTaskManagerSlot pendingTaskManagerSlot = null; for (int i = 0; i < numSlotsPerWorker; ++i) { pendingTaskManagerSlot = new PendingTaskManagerSlot(defaultSlotResourceProfile); pendingSlots.put(pendingTaskManagerSlot.getTaskManagerSlotId(), pendingTaskManagerSlot); } return Optional.of(Preconditions.checkNotNull(pendingTaskManagerSlot, "At least one pending slot should be created.")); }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.form_entry_patient_list_menu, menu); final SearchView findPatientView; MenuItem mFindPatientMenuItem = menu.findItem(R.id.actionSearchRemoteFormEntry); <START> findPatientView = (SearchView) MenuItemCompat.getActionView(mFindPatientMenuItem); <END> findPatientView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { findPatientView.clearFocus(); return true; } @Override public boolean onQueryTextChange(String query) { mPresenter.setQuery(query); mPresenter.updatePatientsList(); return true; } }); return true; }</code><technical_language>This is line of code else branch. version is honeycomb findPatientView = (SearchView) mFindPatientMenuItem.getActionView(); if branch</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.form_entry_patient_list_menu, menu); final SearchView findPatientView; MenuItem mFindPatientMenuItem = menu.findItem(R.id.actionSearchRemoteFormEntry); findPatientView = (SearchView) mFindPatientMenuItem.getActionView(); findPatientView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { findPatientView.clearFocus(); return true; } @Override public boolean onQueryTextChange(String query) { mPresenter.setQuery(query); mPresenter.updatePatientsList(); return true; } }); return true; }
Source:
<code>public void setUp() throws Exception { sponsoredMembershipInOrganizationsAttrDef.setId(100); group1.setId(1); group2.setId(2); <START> sess = mock(PerunSessionImpl.class); PerunBl perunBl = mock(PerunBl.class); when(sess.getPerunBl()).thenReturn(perunBl); AttributesManagerBl am = mock(AttributesManagerBl.class); GroupsManagerBl gm = mock(GroupsManagerBl.class); MembersManagerBl mm = mock(MembersManagerBl.class); when(sess.getPerunBl().getAttributesManagerBl()).thenReturn(am); when(sess.getPerunBl().getGroupsManagerBl()).thenReturn(gm); when(sess.getPerunBl().getMembersManagerBl()).thenReturn(mm); <END> when(sess.getPerunBl().getGroupsManagerBl().getGroupsWhereMemberIsActive(sess, member1)).thenReturn(Arrays.asList(group1)); when(sess.getPerunBl().getGroupsManagerBl().getGroupsWhereMemberIsActive(sess, member2)).thenReturn(Arrays.asList(group2)); when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group1, organizationIdentifierAttrName)).thenReturn(groupAttr1); when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group2, organizationIdentifierAttrName)).thenReturn(groupAttr2); when(sess.getPerunBl().getMembersManagerBl().getMembersByUserWithStatus(sess, user, Status.VALID)).thenReturn(Arrays.asList(member1, member2)); }</code><technical_language>suggestion sess = mock(PerunSessionImpl.class, RETURNS_DEEP_STUBS);</technical_language>

Target:
public void setUp() throws Exception { sponsoredMembershipInOrganizationsAttrDef.setId(100); group1.setId(1); group2.setId(2); sess = mock(PerunSessionImpl.class, RETURNS_DEEP_STUBS); when(sess.getPerunBl().getGroupsManagerBl().getGroupsWhereMemberIsActive(sess, member1)) .thenReturn(Arrays.asList(group1)); when(sess.getPerunBl().getGroupsManagerBl().getGroupsWhereMemberIsActive(sess, member2)) .thenReturn(Arrays.asList(group2)); when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group1, organizationIdentifierAttrName)) .thenReturn(groupAttr1); when(sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group2, organizationIdentifierAttrName)) .thenReturn(groupAttr2); when(sess.getPerunBl().getMembersManagerBl().getMembersByUserWithStatus(sess, user, Status.VALID)) .thenReturn(Arrays.asList(member1, member2)); }
Source:
<code>public void addOutputStream(Stream stream) { <START> declaredOutputStreams.add(stream); <END> }</code><technical_language>declaredOuputStreams is verbose. variable/method outputStreams/addOutputStream</technical_language>

Target:
public void addOutputStream(Stream stream) { outputStreams.add(stream); }