auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void fillOperationResponses(Definition definition, org.restlet.ext.apispark.internal.model.Operation operation, Operation operationSwagger) { for (org.restlet.ext.apispark.internal.model.Response response : operation.getResponses()) { Response responseSwagger = new Response(); String message = response.getMessage(); String autoGeneratedMessage = Status.isSuccess(response.getCode()) ? "Success" <START> : "Error " + response.getCode(); <END> responseSwagger.setDescription(message == null ? autoGeneratedMessage : message); if (response.getOutputPayLoad() != null && response.getOutputPayLoad().getType() != null) { PayLoad entity = response.getOutputPayLoad(); final Representation representation = definition.getContract() .getRepresentation(entity.getType()); if (representation != null && representation.isRaw()) { FileProperty fileProperty = new FileProperty(); fileProperty .setDescription(representation.getDescription()); responseSwagger.setSchema(fileProperty); } else if (entity.isArray()) { ArrayProperty arrayProperty = new ArrayProperty(); arrayProperty .setItems(newPropertyForType(entity.getType())); responseSwagger.setSchema(arrayProperty); } else { responseSwagger.setSchema(newPropertyForType(entity .getType())); } } operationSwagger.addResponse(String.valueOf(response.getCode()), responseSwagger); } }</code><technical_language>"Error" is for errors only. test if error, "Status ..." otherwise</technical_language>

Target:
private static void fillOperationResponses(Definition definition, org.restlet.ext.apispark.internal.model.Operation operation, Operation operationSwagger) { for (org.restlet.ext.apispark.internal.model.Response response : operation.getResponses()) { Response responseSwagger = new Response(); String message = response.getMessage(); responseSwagger.setDescription(message == null ? ConversionUtils.generateResponseName(response.getCode()) : message); if (response.getOutputPayLoad() != null && response.getOutputPayLoad().getType() != null) { PayLoad entity = response.getOutputPayLoad(); final Representation representation = definition.getContract() .getRepresentation(entity.getType()); if (representation != null && representation.isRaw()) { FileProperty fileProperty = new FileProperty(); fileProperty .setDescription(representation.getDescription()); responseSwagger.setSchema(fileProperty); } else if (entity.isArray()) { ArrayProperty arrayProperty = new ArrayProperty(); arrayProperty .setItems(newPropertyForType(entity.getType())); responseSwagger.setSchema(arrayProperty); } else { responseSwagger.setSchema(newPropertyForType(entity .getType())); } } operationSwagger.addResponse(String.valueOf(response.getCode()), responseSwagger); } }
Source:
<code><START> public Mono<Void> afterPostRunAsync(boolean isGroupFaulted) { return Mono.just(true) .map(aBoolean -> { postRunTasks = null; return aBoolean; }).then(); } <END></code><technical_language>java postRunTasks = null; return Mono.empty();</technical_language>

Target:
public Mono<Void> afterPostRunAsync(boolean isGroupFaulted) { postRunTasks = null; return Mono.empty(); }
Source:
<code>private void taskComplete( HttpRemoteTaskRunnerWorkItem taskRunnerWorkItem, WorkerHolder workerHolder, TaskStatus taskStatus ) { <START> Preconditions.checkArgument(!Thread.holdsLock(statusLock), "Current thread must not hold statusLock."); <END> Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkNotNull(taskStatus, "taskStatus"); if (workerHolder != null) { log.info( "Worker[%s] completed task[%s] with status[%s]", workerHolder.getWorker().getHost(), taskStatus.getId(), taskStatus.getStatusCode() ); workerHolder.setLastCompletedTaskTime(DateTimes.nowUtc()); } taskRunnerWorkItem.setResult(taskStatus); TaskRunnerUtils.notifyStatusChanged(listeners, taskStatus.getId(), taskStatus); if (workerHolder != null) { blacklistWorkerIfNeeded(taskStatus, workerHolder); } synchronized (statusLock) { statusLock.notifyAll(); } }</code><technical_language>nit: checkState is more here</technical_language>

Target:
private void taskComplete( HttpRemoteTaskRunnerWorkItem taskRunnerWorkItem, WorkerHolder workerHolder, TaskStatus taskStatus ) { Preconditions.checkState(!Thread.holdsLock(statusLock), "Current thread must not hold statusLock."); Preconditions.checkNotNull(taskRunnerWorkItem, "taskRunnerWorkItem"); Preconditions.checkNotNull(taskStatus, "taskStatus"); if (workerHolder != null) { log.info( "Worker[%s] completed task[%s] with status[%s]", workerHolder.getWorker().getHost(), taskStatus.getId(), taskStatus.getStatusCode() ); workerHolder.setLastCompletedTaskTime(DateTimes.nowUtc()); } taskRunnerWorkItem.setResult(taskStatus); TaskRunnerUtils.notifyStatusChanged(listeners, taskStatus.getId(), taskStatus); if (workerHolder != null) { blacklistWorkerIfNeeded(taskStatus, workerHolder); } synchronized (statusLock) { statusLock.notifyAll(); } }
Source:
<code>public static GlusterBrick map(GlusterBrickEntity fromBrick, GlusterBrick toBrick) { GlusterBrick brick = (toBrick == null) ? new GlusterBrick() : toBrick; if(fromBrick.getId() != null) { brick.setId(fromBrick.getId().toString()); } if(fromBrick.getServerId() != null) { brick.setServerId(fromBrick.getServerId().toString()); } if(fromBrick.getBrickDirectory() != null) { brick.setBrickDir(fromBrick.getBrickDirectory()); } if(fromBrick.getStatus() != null) { <START> brick.setState(fromBrick.getStatus().name().toLowerCase()); <END> } if(fromBrick.getVolumeId() != null) { brick.setGlusterVolume(new GlusterVolume()); brick.getGlusterVolume().setId(fromBrick.getVolumeId().toString()); } return brick; }</code><technical_language>string matching. Write a mapper for status here</technical_language>

Target:
public static GlusterBrick map(GlusterBrickEntity fromBrick, GlusterBrick toBrick) { GlusterBrick brick = (toBrick == null) ? new GlusterBrick() : toBrick; if(fromBrick.getId() != null) { brick.setId(fromBrick.getId().toString()); } if(fromBrick.getServerId() != null) { brick.setServerId(fromBrick.getServerId().toString()); } if(fromBrick.getBrickDirectory() != null) { brick.setBrickDir(fromBrick.getBrickDirectory()); } if(fromBrick.getStatus() != null) { brick.setState(map(fromBrick.getStatus(), null).toLowerCase()); } if(fromBrick.getVolumeId() != null) { brick.setGlusterVolume(new GlusterVolume()); brick.getGlusterVolume().setId(fromBrick.getVolumeId().toString()); } return brick; }
Source:
<code>public List<String> getAllGatewayPublishedAPIArtifacts(String label) throws APIManagementException { List<String> gatewayRuntimeArtifactsArray = new ArrayList<>(); <START> try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); <END> PreparedStatement statement = connection.prepareStatement(SQLConstants.GET_ALL_API_ARTIFACT)) { statement.setString(1, label); statement.setString(2, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); ResultSet rs = statement.executeQuery(); while (rs.next()) { try (InputStream inputStream = rs.getBinaryStream(1)) { String gatewayRuntimeArtifacts = IOUtils.toString(inputStream, APIConstants.DigestAuthConstants.CHARSET); gatewayRuntimeArtifactsArray.add(gatewayRuntimeArtifacts); } catch (IOException e) { handleException("Error in generating gatewayRuntimeArtifacts ", e); } } } catch (SQLException e) { handleException("Failed to get artifacts " , e); } return gatewayRuntimeArtifactsArray; }</code><technical_language>a practice a good idea call commit a connection is returned pool performing a SELECT operation. This ensures uncommitted data returned DB. pattern be, try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); connection.setAutoCommit(false); connection.commit(); PreparedStatement statement = connection.prepareStatement("SELECT ...")) { }</technical_language>

Target:
public List<String> getAllGatewayPublishedAPIArtifacts(String label) throws APIManagementException { ResultSet rs =null; List<String> gatewayRuntimeArtifactsArray = new ArrayList<>(); try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); PreparedStatement statement = connection.prepareStatement(SQLConstants.GET_ALL_API_ARTIFACT)) { connection.setAutoCommit(false); connection.commit(); statement.setString(1, label); statement.setString(2, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); rs = statement.executeQuery(); while (rs.next()) { try (InputStream inputStream = rs.getBinaryStream(1)) { String gatewayRuntimeArtifacts = IOUtils.toString(inputStream, APIConstants.DigestAuthConstants.CHARSET); gatewayRuntimeArtifactsArray.add(gatewayRuntimeArtifacts); } catch (IOException e) { handleException("Error in generating gatewayRuntimeArtifacts ", e); } } } catch (SQLException e) { handleException("Failed to get artifacts " , e); } finally { GatewayArtifactsMgtDBUtil.closeResultSet(rs); } return gatewayRuntimeArtifactsArray; }
Source:
<code><START> private synchronized IntArrayList partitionPage(Page page, IntPredicate spillPartitionMask) <END> { IntArrayList unspilledPositions = new IntArrayList(); for (int position = 0; position < page.getPositionCount(); position++) { int partition = partitionGenerator.getPartition(position, page); if (!spillPartitionMask.test(partition)) { unspilledPositions.add(position); continue; } spilledPartitions.add(partition); PageBuilder pageBuilder = pageBuilders[partition]; pageBuilder.declarePosition(); for (int channel = 0; channel < types.size(); channel++) { Type type = types.get(channel); type.appendTo(page.getBlock(channel), position, pageBuilder.getBlockBuilder(channel)); } } return unspilledPositions; }</code><technical_language>nit: BitSet instead IntPredicate</technical_language>

Target:
private synchronized IntArrayList partitionPage(Page page, IntPredicate spillPartitionMask) { IntArrayList unspilledPositions = new IntArrayList(); for (int position = 0; position < page.getPositionCount(); position++) { int partition = partitionFunction.getPartition(page, position); if (!spillPartitionMask.test(partition)) { unspilledPositions.add(position); continue; } spilledPartitions.add(partition); PageBuilder pageBuilder = pageBuilders[partition]; pageBuilder.declarePosition(); for (int channel = 0; channel < types.size(); channel++) { Type type = types.get(channel); type.appendTo(page.getBlock(channel), position, pageBuilder.getBlockBuilder(channel)); } } return unspilledPositions; }
Source:
<code>private boolean isInvalidJDBCConnection(IRepositoryNode repNode) { Property property = repNode.getObject().getProperty(); if (property != null && property.getItem() != null) { DatabaseConnectionItem connectionItem = (DatabaseConnectionItem) property.getItem(); if (connectionItem != null) { DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection(); String databaseType = connection.getDatabaseType(); if ((ConnectionUtils.isTcompJdbc(databaseType) || databaseType <START> .equalsIgnoreCase(SupportDBUrlType.GENERICJDBCDEFAULTURL.getDBKey())) <END> && (StringUtils.isBlank(connection.getDriverJarPath()))) { return true; } } } return false; }</code><technical_language>Is SupportDBUrlType.GENERICJDBCDEFAULTURL.getDBKey().equalsIgnoreCase(databaseType)</technical_language>

Target:
private boolean isInvalidJDBCConnection(IRepositoryNode repNode) { Property property = repNode.getObject().getProperty(); if (property != null && property.getItem() != null) { DatabaseConnectionItem connectionItem = (DatabaseConnectionItem) property.getItem(); if (connectionItem != null) { DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection(); String databaseType = connection.getDatabaseType(); if ((ConnectionUtils.isTcompJdbc(databaseType) || SupportDBUrlType.GENERICJDBCDEFAULTURL .getDBKey() .equalsIgnoreCase(databaseType)) && StringUtils.isBlank(connection.getDriverJarPath())) { return true; } } } return false; }
Source:
<code>public void testOptimizedCreateStandardSyncTasksWithTransient() { List<TreeResponse> treeResponses = Arrays.asList(treeResponse(addr1, range1, "same", range2, "same", range3, "same"), treeResponse(addr2, range1, "different", range2, "same", range3, "different"), treeResponse(addr3, range1, "same", range2, "same", range3, "same")); RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), UUID.randomUUID(), "ks", "cf", Arrays.asList()); Map<SyncNodePair, SyncTask> tasks = toMap(RepairJob.createOptimisedSyncingSyncTasks(desc, treeResponses, addr1, ep -> ep.equals(addr3), addr -> "DC1", false, PreviewKind.ALL)); assertEquals(3, tasks.size()); SyncTask task = tasks.get(pair(addr1, addr2)); assertTrue(task.isLocal()); assertElementEquals(Arrays.asList(range1, range3), task.rangesToSync); assertTrue(((LocalSyncTask)task).requestRanges); assertFalse(((LocalSyncTask)task).transferRanges); <START> task = tasks.get(pair(addr2, addr1)); <END> assertFalse(task.isLocal()); assertElementEquals(Arrays.asList(range3), task.rangesToSync); task = tasks.get(pair(addr2, addr3)); assertFalse(task.isLocal()); assertElementEquals(Arrays.asList(range1), task.rangesToSync); }</code><technical_language>above, addr2 stream range3 addr1 addr3</technical_language>

Target:
public void testOptimizedCreateStandardSyncTasksWithTransient() { List<TreeResponse> treeResponses = Arrays.asList(treeResponse(addr1, range1, "same", range2, "same", range3, "same"), treeResponse(addr2, range1, "different", range2, "same", range3, "different"), treeResponse(addr3, range1, "same", range2, "same", range3, "same")); RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), UUID.randomUUID(), "ks", "cf", Arrays.asList()); Map<SyncNodePair, SyncTask> tasks = toMap(RepairJob.createOptimisedSyncingSyncTasks(desc, treeResponses, addr1, ep -> ep.equals(addr3), addr -> "DC1", false, PreviewKind.ALL)); assertEquals(3, tasks.size()); SyncTask task = tasks.get(pair(addr1, addr2)); assertTrue(task.isLocal()); assertElementEquals(Arrays.asList(range1, range3), task.rangesToSync); assertTrue(((LocalSyncTask)task).requestRanges); assertFalse(((LocalSyncTask)task).transferRanges); assertStreamRangeFromEither(tasks, Arrays.asList(range3), addr2, addr1, addr3); task = tasks.get(pair(addr2, addr3)); assertFalse(task.isLocal()); assertElementEquals(Arrays.asList(range1), task.rangesToSync); }
Source:
<code>public Integer getPageSize() { <START> return pageSize; <END> }</code><technical_language>OSGP code conventions (missing this. referencing a field)</technical_language>

Target:
public Integer getPageSize() { return this.pageSize; }
Source:
<code>public boolean removePermission(String permissionId) { if (permissionId == null) { throw new IllegalArgumentException("permissionId is null"); } if (this.permissions != null) { Iterator<PermissionBlueprintDTO> iterator = this.permissions.iterator(); while (iterator.hasNext()) { PermissionBlueprintDTO existing = iterator.next(); if (permissionId.equals(existing.getId())) { iterator.remove(); } <START> } <END> } return false; }</code><technical_language>return true some point? code could</technical_language>

Target:
public boolean removePermission(String permissionId) { if (permissionId == null) { throw new IllegalArgumentException("permissionId is null"); } boolean removed = false; if (this.permissions != null) { Iterator<PermissionBlueprintDTO> iterator = this.permissions.iterator(); while (iterator.hasNext()) { PermissionBlueprintDTO existing = iterator.next(); if (permissionId.equals(existing.getId())) { iterator.remove(); removed = true; } } } return removed; }
Source:
<code>public java.util.Iterator<Cache.Entry<K, V>> iterator() { checkClosed(); final java.util.Iterator<org.ehcache.Cache.Entry<K, V>> specIterator = jsr107Cache.specIterator(); return new java.util.Iterator<Entry<K, V>>() { @Override public boolean hasNext() { checkClosed(); return specIterator.hasNext(); } @Override public Entry<K, V> next() { checkClosed(); <START> return new WrappedEhcacheEntry<K, V>(specIterator.next()); <END> } @Override public void remove() { checkClosed(); specIterator.remove(); } }; }</code><technical_language>longer get a null here</technical_language>

Target:
public Iterator<Entry<K, V>> iterator() { checkClosed(); final Iterator<org.ehcache.Cache.Entry<K, V>> specIterator = jsr107Cache.specIterator(); return new Iterator<Entry<K, V>>() { @Override public boolean hasNext() { checkClosed(); return specIterator.hasNext(); } @Override public Entry<K, V> next() { checkClosed(); org.ehcache.Cache.Entry<K, V> next = specIterator.next(); return next == null ? null : new WrappedEhcacheEntry<K, V>(next); } @Override public void remove() { checkClosed(); specIterator.remove(); } }; }
Source:
<code>private void generateResourceDeletionActivity(@NotNull VirtualFileEvent virtualFileEvent) { assert enabled : "the before file deletion listener was triggered while it was disabled"; VirtualFile deletedVirtualFile = virtualFileEvent.getFile(); if (LOG.isTraceEnabled()) { LOG.trace("Reacting before resource deletion: " + deletedVirtualFile); } SPath path = VirtualFileConverter.convertToSPath(project, deletedVirtualFile); IResource resource = intelliJReferencePointManager.getSarosResource( path.getReferencePoint(), path.getProjectRelativePath()); <START> IFile file = resource.adaptTo(IntelliJFileImpl.class); <END> if (path == null || !session.isShared(file)) { if (LOG.isTraceEnabled()) { LOG.trace("Ignoring non-shared resource deletion: " + deletedVirtualFile); } return; } User user = session.getLocalUser(); IActivity activity; if (deletedVirtualFile.isDirectory()) { activity = new FolderDeletedActivity(user, path); } else { activity = new FileActivity( user, Type.REMOVED, FileActivity.Purpose.ACTIVITY, path, null, null, null); editorManager.removeAllEditorsForPath(path); annotationManager.removeAnnotations(file); } dispatchActivity(activity); }</code><technical_language>This resource a file. This casting is unnecessary. IResource reference. logic differentiates files folders starts in line 409</technical_language>

Target:
private void generateResourceDeletionActivity(@NotNull VirtualFileEvent virtualFileEvent) { assert enabled : "the before file deletion listener was triggered while it was disabled"; VirtualFile deletedVirtualFile = virtualFileEvent.getFile(); if (LOG.isTraceEnabled()) { LOG.trace("Reacting before resource deletion: " + deletedVirtualFile); } SPath path = VirtualFileConverter.convertToSPath(project, deletedVirtualFile); IResource resource = intelliJReferencePointManager.getSarosResource( path.getReferencePoint(), path.getProjectRelativePath()); if (path == null || !session.isShared(resource)) { if (LOG.isTraceEnabled()) { LOG.trace("Ignoring non-shared resource deletion: " + deletedVirtualFile); } return; } User user = session.getLocalUser(); IActivity activity; if (deletedVirtualFile.isDirectory()) { activity = new FolderDeletedActivity(user, path); } else { activity = new FileActivity( user, Type.REMOVED, FileActivity.Purpose.ACTIVITY, path, null, null, null); editorManager.removeAllEditorsForPath(path); IFile file = resource.adaptTo(IntelliJFileImpl.class); annotationManager.removeAnnotations(file); } dispatchActivity(activity); }
Source:
<code>private PopupMenuExportContextURLs getPopupContextTreeMenuExportUrls() { if (popupContextTreeMenuExportUrls == null) { popupContextTreeMenuExportUrls = new PopupMenuExportContextURLs( Constant.messages.getString("context.export.urls.menu")) { private static final long serialVersionUID = 1L; @Override <START> public boolean isEnableForComponent(Component invoker) { <END> return invoker.getName().equals(SiteMapPanel.CONTEXT_TREE_COMPONENT_NAME); } }; popupContextTreeMenuExportUrls.setExtension( (ExtensionHistory) Control.getSingleton().getExtensionLoader().getExtension(ExtensionHistory.NAME)); } return popupContextTreeMenuExportUrls; }</code><technical_language>This could/should done in PopupMenuExportContextURLs class</technical_language>

Target:
private PopupMenuExportContextURLs getPopupContextTreeMenuExportUrls() { if (popupContextTreeMenuExportUrls == null) { popupContextTreeMenuExportUrls = new PopupMenuExportContextURLs( Constant.messages.getString("context.export.urls.menu")); popupContextTreeMenuExportUrls.setExtension( Control.getSingleton().getExtensionLoader().getExtension(ExtensionHistory.class)); } return popupContextTreeMenuExportUrls; }
Source:
<code>public APIResult unregisterExtension(String extensionName) { try { return localExtensionManager.unRegisterExtension(extensionName); } catch (FalconException e) { <START> throw new FalconCLIException("Failed in unRegistering the exnteison"+ e.getMessage()); <END> } }</code><technical_language>Fix typos</technical_language>

Target:
public APIResult unregisterExtension(String extensionName) { try { return localExtensionManager.unRegisterExtension(extensionName); } catch (FalconException e) { throw new FalconCLIException("Failed in unRegistering the extension"+ e.getMessage()); } }
Source:
<code>public void waitForAssertShouldRunAfterLastCall_whenAssertionFails() { Runnable allwaysFailAssertion = mock(Runnable.class); doAnswer(invocation -> { throw new AssertionError(); }).when(allwaysFailAssertion).run(); Runnable afterLastCall = mock(Runnable.class); try { javaTest.waitForAssert(allwaysFailAssertion, null, afterLastCall, 10, 5); <START> fail("NPE from mock is expected during last execution."); <END> } catch (AssertionError e) { } verify(afterLastCall, times(1)).run(); }</code><technical_language>please adapt fail message</technical_language>

Target:
public void waitForAssertShouldRunAfterLastCall_whenAssertionFails() { Runnable afterLastCall = mock(Runnable.class); try { javaTest.waitForAssert(() -> assertTrue(false), null, afterLastCall, 1000, 50); } catch (final AssertionError ex) { } verify(afterLastCall, times(1)).run(); }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GetClientDefaultsAnswer that = (GetClientDefaultsAnswer) o; if (_apiRetryCount != null ? !_apiRetryCount.equals(that._apiRetryCount) : that._apiRetryCount != null) return false; if (_apiRetryInterval != null ? !_apiRetryInterval.equals(that._apiRetryInterval) : that._apiRetryInterval != null) return false; if (_currentApiVersion != null ? !_currentApiVersion.equals(that._currentApiVersion) : that._currentApiVersion != null) return false; return true; }</code><technical_language>This equals implementation include attributes Answer super class</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof GetClientDefaultsAnswer)) return false; if (!super.equals(o)) return false; GetClientDefaultsAnswer that = (GetClientDefaultsAnswer) o; if (_apiRetryCount != null ? !_apiRetryCount.equals(that._apiRetryCount) : that._apiRetryCount != null) return false; if (_apiRetryInterval != null ? !_apiRetryInterval.equals(that._apiRetryInterval) : that._apiRetryInterval != null) return false; if (_currentApiVersion != null ? !_currentApiVersion.equals(that._currentApiVersion) : that._currentApiVersion != null) return false; return true; }
Source:
<code>public void doPostCleanup(BibEntry entry) { new FieldFormatterCleanup(StandardField.ABSTRACT, new RemoveNewlinesFormatter()).cleanup(entry); new FieldFormatterCleanup(StandardField.ABSTRACT, new ReplaceTabsBySpaceFormater()).cleanup(entry); new FieldFormatterCleanup(StandardField.ABSTRACT, new RemoveRedundantSpacesFormatter()).cleanup(entry); new FieldFormatterCleanup(StandardField.EDITOR, new RemoveDigitsFormatter()).cleanup(entry); UnknownField identifierField = new UnknownField("identifier"); entry.getField(identifierField) .stream() <START> .flatMap(value -> Arrays.stream(value.split("; "))) <END> .forEach(identifierKeyValue -> { String[] identifierKeyValueSplit = identifierKeyValue.split(" "); if (identifierKeyValueSplit.length == 1) { identifierKeyValueSplit = identifierKeyValue.split(":"); } int length = identifierKeyValueSplit.length; if (length < 2) { return; } String key = identifierKeyValueSplit[length - 2]; String value = identifierKeyValueSplit[length - 1]; entry.setField(FieldFactory.parseField(key), value); }); entry.clearField(identifierField); }</code><technical_language>a regex / more flexible this manual string splitting</technical_language>

Target:
public void doPostCleanup(BibEntry entry) { new FieldFormatterCleanup(StandardField.ABSTRACT, new RemoveNewlinesFormatter()).cleanup(entry); new FieldFormatterCleanup(StandardField.ABSTRACT, new ReplaceTabsBySpaceFormater()).cleanup(entry); new FieldFormatterCleanup(StandardField.ABSTRACT, new RemoveRedundantSpacesFormatter()).cleanup(entry); new FieldFormatterCleanup(StandardField.EDITOR, new RemoveDigitsFormatter()).cleanup(entry); UnknownField identifierField = new UnknownField("identifier"); entry.getField(identifierField) .stream() .flatMap(value -> Arrays.stream(value.split("; "))) .forEach(identifierKeyValue -> { String[] identifierKeyValueSplit = identifierKeyValue.split(" "); if (identifierKeyValueSplit.length == 1) { identifierKeyValueSplit = identifierKeyValue.split(":"); } int length = identifierKeyValueSplit.length; if (length < 2) { return; } String key = identifierKeyValueSplit[length - 2]; String value = identifierKeyValueSplit[length - 1]; Field field = FieldFactory.parseField(key); if (!entry.hasField(field)) { entry.setField(field, value); } }); entry.clearField(identifierField); }
Source:
<code>public WindowFunctionSupplier getWindowFunctionImplementation(Signature signature) { try { <START> return operatorNamespace.getWindowFunctionImplementation(signature); <END> } catch (PrestoException e) { } if (!signature.getCatalog().isPresent() || !signature.getSchema().isPresent()) { throw new PrestoException(NOT_FOUND, format("Signature %s does not have both catalog and schema set for resolution", signature)); } return functionNamespaces.get(signature.getCatalog().get()).getWindowFunctionImplementation(signature); }</code><technical_language>do in of methods: - try resolving in operator namespace - exception, try function namespace Is easy get rid of this behavior? (I remember/know check operator namespace for functions)</technical_language>

Target:
public WindowFunctionSupplier getWindowFunctionImplementation(Signature signature) { return globalFunctionNamespace.getWindowFunctionImplementation(signature); }
Source:
<code><START> public Range<Double> getScanningRange() { <END> return null; }</code><technical_language>This parsed mzML: <scanList count="1"> <cvParam cvRef="MS" accession="MS:1000795" name="no combination" value=""/> <scan> <cvParam cvRef="MS" accession="MS:1000016" name="scan start time" value="0.0028779136" unitCvRef="UO" unitAccession="UO:0000031" unitName="minute"/> <cvParam cvRef="MS" accession="MS:1000512" name="filter string" value="FTMS + p ESI Full ms [118.00-1750.00]"/> <cvParam cvRef="MS" accession="MS:1000616" name="preset scan configuration" value="1"/> <cvParam cvRef="MS" accession="MS:1000927" name="ion injection time" value="50.000000745058" unitCvRef="UO" unitAccession="UO:0000028" unitName="millisecond"/> <scanWindowList count="1"> <scanWindow> <cvParam cvRef="MS" accession="MS:1000501" name="scan window limit" value="118.0" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z"/> <cvParam cvRef="MS" accession="MS:1000500" name="scan window upper limit" value="1750.0" unitCvRef="MS" unitAccession="MS:1000040" unitName="m/z"/> </scanWindow> </scanWindowList> </scan> </scanList> Check "scan window limit" "scan window upper limit" accession. If is present in file, return of getMzRange()</technical_language>

Target:
public Range<Double> getScanningRange() { Range<Double> scanRange = null; try { scanRange = Range.closed(Double.valueOf(getCVValue(MzMLCV.cvScanWindowLowerLimit)), Double.valueOf(getCVValue(MzMLCV.cvScanWindowUpperLimit))); } catch (Exception e) { e.printStackTrace(); } if (scanRange == null) getMzRange(); return scanRange; }
Source:
<code>public void unmarshallWithValidationError() throws Exception { tested = spy(new DiagramMarshaller() { @Override <START> public Graph unmarshall(Metadata metadata, InputStream input) throws IOException { <END> throw new RuntimeException(MESSAGE); } @Override public String marshall(Diagram diagram) throws IOException { return null; } @Override public DiagramMetadataMarshaller getMetadataMarshaller() { return null; } }); final MarshallingResponse response = tested.unmarshallWithValidation(request); verify(tested).unmarshall(metadata, input); assertFalse(response.getResult().isPresent()); assertEquals(response.getState(), MarshallingResponse.State.ERROR); assertEquals(response.getMessages().size(), 1); final MarshallingMessage marshallingMessage = (MarshallingMessage) response.getMessages().stream().findFirst().get(); assertEquals(marshallingMessage.getMessage(), MESSAGE); }</code><technical_language>IOException is thrown here. removed</technical_language>

Target:
public void unmarshallWithValidationError() throws Exception { tested = spy(new DiagramMarshaller() { @Override public Graph unmarshall(Metadata metadata, InputStream input) { throw new RuntimeException(MESSAGE); } @Override public String marshall(Diagram diagram) { return null; } @Override public DiagramMetadataMarshaller getMetadataMarshaller() { return null; } }); final MarshallingResponse response = tested.unmarshallWithValidation(request); verify(tested).unmarshall(metadata, input); assertFalse(response.getResult().isPresent()); assertEquals(response.getState(), MarshallingResponse.State.ERROR); assertEquals(response.getMessages().size(), 1); final MarshallingMessage marshallingMessage = (MarshallingMessage) response.getMessages().stream().findFirst().get(); assertEquals(marshallingMessage.getMessage(), MESSAGE); }
Source:
<code>public boolean isShareable(Class<?> entityClass) { <START> return entityHasChecksForPermission( <END> entityClass, SharePermission.class ) && getAnnotation(entityClass, SharePermission.class).sharable(); }</code><technical_language>part of this statement sense anymore explicitly _marked_ shareable now</technical_language>

Target:
public boolean isShareable(Class<?> entityClass) { return getAnnotation(entityClass, SharePermission.class) != null && getAnnotation(entityClass, SharePermission.class).sharable(); }
Source:
<code>private void createLauncher(Properties properties) { if (group.equals("spark")) { if (properties.getProperty("master") != null && properties.getProperty("master").startsWith("k8s")) { this.launcher = new SparkK8InterpreterLauncher(this.conf); } else { this.launcher = new SparkInterpreterLauncher(this.conf); } <START> } else { <END> this.launcher = new ShellScriptLauncher(this.conf); } }</code><technical_language>@zjffdu - I need a fast abstract out launchers, instead of bringing in (plus artifacts kubernetes-client). Do thought that</technical_language>

Target:
private void createLauncher(Properties properties) { if (group.equals("spark")) { String deployMode = properties.getProperty("spark.submit.deployMode"); String masterUrl = properties.getProperty("master"); if (deployMode != null && deployMode.equals("cluster") && masterUrl != null && masterUrl.startsWith("k8s://")) { this.launcher = new SparkK8SInterpreterLauncher(this.conf, this.recoveryStorage); } else { this.launcher = new SparkInterpreterLauncher(this.conf, this.recoveryStorage); } } else { this.launcher = new ShellScriptLauncher(this.conf, this.recoveryStorage); } }
Source:
<code>public static void incrementAttributeLong(ITmfStateSystemBuilder ssb, long t, int attributeQuark, long increment) { <START> @Nullable <END> Object stateValue = ssb.queryOngoing(attributeQuark); long prevValue = 0; if (stateValue != null && stateValue instanceof Long) { prevValue = (long) stateValue; } ssb.modifyAttribute(t, prevValue + increment, attributeQuark); }</code><technical_language>write nullable line write</technical_language>

Target:
public static void incrementAttributeLong(ITmfStateSystemBuilder ssb, long t, int attributeQuark, long increment) { Object stateValue = ssb.queryOngoing(attributeQuark); long prevValue = 0; if (stateValue != null && stateValue instanceof Long) { prevValue = (long) stateValue; } ssb.modifyAttribute(t, prevValue + increment, attributeQuark); }
Source:
<code>public TrustManagerFactory getTrustMgr(String serverName) { try { <START> KeyStore trustStore = trustMgrMap.get(serverName); <END> if (trustStore != null) { TrustManagerFactory fact = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); fact.init(trustStore); return fact; } return null; } catch (NoSuchAlgorithmException | KeyStoreException e) { throw new RuntimeException(e); } }</code><technical_language>I prefer this code done in KeyStoreHelper constructor a Map<String, TrustManagerFactory > detected this moment this is do for SNI key manager mapping</technical_language>

Target:
public TrustManagerFactory getTrustMgr(String serverName) { return trustMgrMap.get(serverName); }
Source:
<code>public void testSupportsTextAttribute() { <START> assertTrue("Should return true for supported token typs", <END> XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.IDENT))); assertTrue("Should return true for supported token typs", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.NUM_INT))); assertTrue("Should return true for supported token typs", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.STRING_LITERAL))); assertTrue("Should return true for supported token typs", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.CHAR_LITERAL))); assertTrue("Should return true for supported token typs", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.NUM_DOUBLE))); assertFalse("Should return false for unsupported token typs", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.VARIABLE_DEF))); assertFalse("Should return false for unsupported token typs", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.OBJBLOCK))); assertFalse("Should return true for supported token typs", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.LITERAL_CHAR))); }</code><technical_language>typs => types This test a bunch of these</technical_language>

Target:
public void testSupportsTextAttribute() { assertTrue("Should return true for supported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.IDENT))); assertTrue("Should return true for supported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.NUM_INT))); assertTrue("Should return true for supported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.STRING_LITERAL))); assertTrue("Should return true for supported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.CHAR_LITERAL))); assertTrue("Should return true for supported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.NUM_DOUBLE))); assertFalse("Should return false for unsupported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.VARIABLE_DEF))); assertFalse("Should return false for unsupported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.OBJBLOCK))); assertFalse("Should return true for supported token types", XpathUtil.supportsTextAttribute(createDetailAST(TokenTypes.LITERAL_CHAR))); }
Source:
<code>public ArrayList<String> getRecentSearches() { Object object = getProperty(RECENT_SEARCHES_KEY); if (object instanceof JSONArray) { JSONArray recents = (JSONArray) object; <START> if (recents == null) { <END> recents = new JSONArray(); } ArrayList<String> recentsList = new ArrayList<>(recents.length()); for (int i = 0; i < recents.length(); i++) { String recent = recents.optString(i); if (!recent.isEmpty()) { recentsList.add(recent); } } return recentsList; } else { return new ArrayList<>(); } }</code><technical_language>Minor ( ): Consider removing this null check. this check is longer necessary passes if (object instanceof JSONArray) { ... } check, guarantees object longer null. Wdyt</technical_language>

Target:
public ArrayList<String> getRecentSearches() { Object object = getProperty(RECENT_SEARCHES_KEY); if (object instanceof JSONArray) { JSONArray recents = (JSONArray) object; ArrayList<String> recentsList = new ArrayList<>(recents.length()); for (int i = 0; i < recents.length(); i++) { String recent = recents.optString(i); if (!recent.isEmpty()) { recentsList.add(recent); } } return recentsList; } else { return new ArrayList<>(); } }
Source:
<code>private ValidationResult validateRangesSyntax(List<String[]> rangesBoundaries) { for (String[] rangeBoundaries : rangesBoundaries) { for (String rangeBoundary : rangeBoundaries) { ValidationResult startPartValidation = validateRangePart(rangeBoundary); if (!startPartValidation.isOk()) { return startPartValidation; } } long from = MacAddressRangeUtils.macToLong(rangeBoundaries[0]); long to = MacAddressRangeUtils.macToLong(rangeBoundaries[1]); if (from > to) { return new ValidationResult(false, String.format("The entered range is invalid. " + "Range should be specified as " + "<lowerBoundMAC>"+ MacAddressRangeUtils.BOUNDARIES_DELIMITER +"<upperBoundMAC>." <START> + " Did you mean %s?", <END> MacAddressRangeUtils.boundariesToRangeString(from, to), MacAddressRangeUtils.boundariesToRangeString(to, from))); } } return new ValidationResult(true); }</code><technical_language>i miss - a mismatch number if arguments notated "%s"</technical_language>

Target:
private ValidationResult validateRangesSyntax(List<String[]> rangesBoundaries) { for (String[] rangeBoundaries : rangesBoundaries) { for (String rangeBoundary : rangeBoundaries) { ValidationResult startPartValidation = validateRangePart(rangeBoundary); if (!startPartValidation.isOk()) { return startPartValidation; } } long from = MacAddressRangeUtils.macToLong(rangeBoundaries[0]); long to = MacAddressRangeUtils.macToLong(rangeBoundaries[1]); if (from > to) { return new ValidationResult(false, String.format("The entered range is invalid. " + "Range should be specified as " + "<lowerBoundMAC>"+ MacAddressRangeUtils.BOUNDARIES_DELIMITER +"<upperBoundMAC>." + " Did you mean %s?", MacAddressRangeUtils.boundariesToRangeString(to, from))); } } return new ValidationResult(true); }
Source:
<code><START> public static boolean containsTerminalInstallerWithoutExec(List<String> installers) { <END> return new InstallerFqn("org.eclipse.che.terminal").in(installers) && !(new InstallerFqn("org.eclipse.che.exec").in(installers)); }</code><technical_language>Is anywhere</technical_language>

Target:
private static boolean containsTerminalInstallerWithoutExec(List<String> installers) { return InstallerFqn.idInKeyList("org.eclipse.che.terminal", installers) && !(InstallerFqn.idInKeyList("org.eclipse.che.exec", installers)); }
Source:
<code>public Long execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup(KieSession.class); ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); if (processInstance == null) { throw new ProcessInstanceNotFoundException("No process instance found with id " + processInstanceId); } DynamicNodeInstance dynamicContext = (DynamicNodeInstance) ((WorkflowProcessInstanceImpl) processInstance).getNodeInstances(true).stream() .filter(ni -> (ni instanceof DynamicNodeInstance) && stageId.equals(ni.getNode().getMetaData().get("UniqueId"))) .findFirst() .orElse(null); if (dynamicContext == null) { throw new StageNotFoundException("No stage found with id " + stageId); } CaseEventSupport caseEventSupport = getCaseEventSupport(context); caseEventSupport.fireBeforeDynamicProcessAdded(caseId, processInstanceId, processId, parameters); long subProcessInstanceId = DynamicUtils.addDynamicSubProcess(dynamicContext, ksession, processId, parameters); if (subProcessInstanceId < 0) { <START> throw new ProcessDefinitionNotFoundException("No process definition found with id: " + processId); <END> } caseEventSupport.fireAfterDynamicProcessAdded(caseId, processInstanceId, processId, parameters, subProcessInstanceId); return subProcessInstanceId; }</code><technical_language>catch rethow ProcessDefinitionNotFoundException</technical_language>

Target:
public Long execute(Context context) { KieSession ksession = ((RegistryContext) context).lookup(KieSession.class); ProcessInstance processInstance = ksession.getProcessInstance(processInstanceId); if (processInstance == null) { throw new ProcessInstanceNotFoundException("No process instance found with id " + processInstanceId); } DynamicNodeInstance dynamicContext = (DynamicNodeInstance) ((WorkflowProcessInstanceImpl) processInstance).getNodeInstances(true).stream() .filter(ni -> (ni instanceof DynamicNodeInstance) && stageId.equals(ni.getNode().getMetaData().get("UniqueId"))) .findFirst() .orElse(null); if (dynamicContext == null) { throw new StageNotFoundException("No stage found with id " + stageId); } try { CaseEventSupport caseEventSupport = getCaseEventSupport(context); caseEventSupport.fireBeforeDynamicProcessAdded(caseId, processInstanceId, processId, parameters); long subProcessInstanceId = DynamicUtils.addDynamicSubProcess(dynamicContext, ksession, processId, parameters); if (subProcessInstanceId < 0) { throw new ProcessDefinitionNotFoundException("No process definition found with id: " + processId); } caseEventSupport.fireAfterDynamicProcessAdded(caseId, processInstanceId, processId, parameters, subProcessInstanceId); return subProcessInstanceId; } catch (IllegalArgumentException e) { throw new ProcessDefinitionNotFoundException(e.getMessage()); } }
Source:
<code>@Test public void concurrentLazyAccess() throws Exception { final List<Future<Integer>> futures = new ArrayList<Future<Integer>>(); final ObjectGraph graph = ObjectGraph.create(new LatchingModule(latch)); final LazyEntryPoint lep = graph.get(LazyEntryPoint.class); <START> for (int i = 0 ; i < PERCALE ; i++) { <END> futures.add(es.submit(new Callable<Integer>() { @Override public Integer call() { latch.countDown(); return lep.lazy.get(); } })); } latch.countDown(); for (Future<Integer> future : futures) { assertThat(future.get(1, TimeUnit.SECONDS)) .overridingErrorMessage("Lock failure - count should never increment") .isEqualTo(0); } }</code><technical_language>Sadly checkstyle strict I like. do a custom regex for it</technical_language>

Target:
@Test public void concurrentLazyAccess() throws Exception { final List<Future<Integer>> futures = new ArrayList<Future<Integer>>(); final ObjectGraph graph = ObjectGraph.create(new LatchingModule(latch)); final LazyEntryPoint lep = graph.get(LazyEntryPoint.class); for (int i = 0; i < THREAD_COUNT; i++) { futures.add(es.submit(new Callable<Integer>() { @Override public Integer call() { latch.countDown(); return lep.lazy.get(); } })); } latch.countDown(); for (Future<Integer> future : futures) { assertThat(future.get(1, TimeUnit.SECONDS)) .overridingErrorMessage("Lock failure - count should never increment") .isEqualTo(0); } }
Source:
<code>protected void modified(Map<String, Object> config) { if (config != null) { <START> this.keyword = config.containsKey("keyword") ? config.get("keyword").toString() : "Wakeup"; <END> this.defaultSource = config.containsKey("defaultSource") ? config.get("defaultSource").toString() : null; this.defaultSink = config.containsKey("defaultSink") ? config.get("defaultSink").toString() : null; this.defaultTTS = config.containsKey("defaultTTS") ? config.get("defaultTTS").toString() : null; this.defaultSTT = config.containsKey("defaultSTT") ? config.get("defaultSTT").toString() : null; this.defaultKS = config.containsKey("defaultKS") ? config.get("defaultKS").toString() : null; this.defaultHLI = config.containsKey("defaultHLI") ? config.get("defaultHLI").toString() : null; for (String key : config.keySet()) { if (key.startsWith("defaultVoice.")) { String tts = key.substring("defaultVoice.".length()); defaultVoices.put(tts, config.get(key).toString()); } } } }</code><technical_language>string constants</technical_language>

Target:
protected void modified(Map<String, Object> config) { if (config != null) { this.keyword = config.containsKey(CONFIG_KEYWORD) ? config.get(CONFIG_KEYWORD).toString() : DEFAULT_KEYWORD; this.defaultSource = config.containsKey(CONFIG_DEFAULT_SOURCE) ? config.get(CONFIG_DEFAULT_SOURCE).toString() : null; this.defaultSink = config.containsKey(CONFIG_DEFAULT_SINK) ? config.get(CONFIG_DEFAULT_SINK).toString() : null; this.defaultTTS = config.containsKey(CONFIG_DEFAULT_TTS) ? config.get(CONFIG_DEFAULT_TTS).toString() : null; this.defaultSTT = config.containsKey(CONFIG_DEFAULT_STT) ? config.get(CONFIG_DEFAULT_STT).toString() : null; this.defaultKS = config.containsKey(CONFIG_DEFAULT_KS) ? config.get(CONFIG_DEFAULT_KS).toString() : null; this.defaultHLI = config.containsKey(CONFIG_DEFAULT_HLI) ? config.get(CONFIG_DEFAULT_HLI).toString() : null; for (String key : config.keySet()) { if (key.startsWith(CONFIG_PREFIX_DEFAULT_VOICE)) { String tts = key.substring(CONFIG_PREFIX_DEFAULT_VOICE.length()); defaultVoices.put(tts, config.get(key).toString()); } } } }
Source:
<code>public boolean equals(Object obj) { <START> if (obj == null || obj.getClass() != getClass()) { <END> return false; } final Attribute attribute = (Attribute) obj; return CompareUtils.areEqual(key, attribute.getKey()) && CompareUtils.areEqual(value, attribute.getValue()); }</code><technical_language>prefer write: if (obj instanceof Attribute) { Attribute other = (Attribute)obj; ... } return false; this null test type test time. permits compare a subclass current semantics</technical_language>

Target:
public boolean equals(Object obj) { if (obj instanceof Attribute) { final Attribute attribute = (Attribute) obj; return CompareUtils.areEqual(key, attribute.getKey()) && CompareUtils.areEqual(value, attribute.getValue()); } return false; }
Source:
<code>public static Set<String> getBrokers(Set<String> zkHost){ ZkClient zkclient = new ZkClient(StringUtils.join(zkHost, ',') ,30000, 30000, ZKStringSerializer$.MODULE$); Set<String> brokerHosts = new HashSet<String>(); for (Broker b : JavaConversions.asJavaIterable(ZkUtils.getAllBrokersInCluster(zkclient))) { <START> brokerHosts.add(b.connectionString()); <END> } zkclient.close(); return brokerHosts; }</code><technical_language>this line of change</technical_language>

Target:
public static Set<String> getBrokers(Set<String> zkHost){ ZkClient zkclient = new ZkClient(zkHost.iterator().next(), 30000, 30000, ZKStringSerializer$.MODULE$); Set<String> brokerHosts = new HashSet<String>(); for (Broker b : JavaConversions.asJavaIterable(ZkUtils.getAllBrokersInCluster(zkclient))) { brokerHosts.add(b.connectionString()); } zkclient.close(); return brokerHosts; }
Source:
<code>public Map<FactoryContainer, Attributes> getAllContainers() { Map<FactoryContainer, Attributes> map = new <START> LinkedHashMap<>(_path.size()); <END> synchronized (_path) { for (Entry<FactoryContainer, Attributes> entry : getReversed(_path.entrySet())) { map.put(entry.getKey(), new Attributes(entry.getValue())); } } return map; }</code><technical_language>a common misconception size a hash map this way. Guava computation compensate for deficiency of HashMap constructor: static int capacity(int expectedSize) { if (expectedSize < 3) { checkNonnegative(expectedSize, "expectedSize"); return expectedSize + 1; } if (expectedSize < Ints.MAX_POWER_OF_TWO) { // This is calculation in JDK8 resize a putAll // happens; conservative calculation // make. 0.75 is default load factor. return (int) ((float) expectedSize / 0.75F + 1.0F); } return Integer.MAX_VALUE; // large }</technical_language>

Target:
public Map<FactoryContainer, Attributes> getAllContainers() { Map<FactoryContainer, Attributes> map = new LinkedHashMap<>(_path.size()); synchronized (_path) { for (Map.Entry<FactoryContainer, Attributes> entry : getReversed(_path.entrySet())) { map.put(entry.getKey(), new Attributes(entry.getValue())); } } return map; }