auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void postCollectionSubmittersGroupCreateSubmittersGroupUnAuthorized() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); getClient().perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); <START> <END> }</code><technical_language>double check group created</technical_language>

Target:
public void postCollectionSubmittersGroupCreateSubmittersGroupUnAuthorized() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); groupRest.setMetadata(metadataRest); getClient().perform(post("/api/core/collections/" + collection.getID() + "/submittersGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isNoContent()); }
Source:
<code>public SpongeDataRegistrationBuilder reset() { super.reset(); this.dataProviderMap = new HashMap<>(); <START> this.dataStoreMap = new HashMap<>(); <END> this.keys = new ArrayList<>(); return this; }</code><technical_language>suggestion this.dataStoreMap = new IdentityHashMap<>();</technical_language>

Target:
public SpongeDataRegistrationBuilder reset() { super.reset(); this.dataProviderMap = new HashMap<>(); this.dataStoreMap = new IdentityHashMap<>(); this.keys = new ArrayList<>(); return this; }
Source:
<code>private ConceptReferenceTerm getConceptReferenceTermByConceptSource(Concept concept, ConceptSource conceptSource) { Collection<ConceptMap> conceptMappings = concept.getConceptMappings(); if(conceptMappings != null && conceptSource != null) { for (ConceptMap cm : conceptMappings) { ConceptReferenceTerm term = cm.getConceptReferenceTerm(); <START> if (term.getConceptSource() != null && term.getConceptSource().equals(conceptSource)) { <END> return term; } } } return null; }</code><technical_language>need test for nullity of term.getConceptSource() if do this: java if (conceptSource.equals(term.getConceptSource())) { ... this point conceptSource is null</technical_language>

Target:
private ConceptReferenceTerm getConceptReferenceTermByConceptSource(Concept concept, ConceptSource conceptSource) { Collection<ConceptMap> conceptMappings = concept.getConceptMappings(); if(conceptMappings != null && conceptSource != null) { for (ConceptMap cm : conceptMappings) { ConceptReferenceTerm term = cm.getConceptReferenceTerm(); if (conceptSource.equals(term.getConceptSource())) { return term; } } } return null; }
Source:
<code>public void execute(String[] args, Console console) { if (args.length > 0) { final String subCommand = args[0]; switch (subCommand) { case SUBCMD_APPROVE: if (args.length > 2) { String label = args[2]; try { ThingUID thingUID = new ThingUID(args[1]); List<DiscoveryResult> results = inbox.get(new InboxFilterCriteria(thingUID, null)); if (results.isEmpty()) { console.println("No matching inbox entry could be found."); return; } inbox.approve(thingUID, label); } catch (Exception e) { console.println(e.getMessage()); } } else { console.println("Specify thing id to approve: inbox approve <thingUID> <label>"); } break; case SUBCMD_IGNORE: if (args.length > 1) { try { ThingUID thingUID = new ThingUID(args[1]); PersistentInbox persistentInbox = (PersistentInbox) inbox; persistentInbox.setFlag(thingUID, DiscoveryResultFlag.IGNORED); } catch (IllegalArgumentException e) { console.println("'" + args[1] + "' is no valid thing UID."); } } else { console.println("Cannot approve thing as managed thing provider is missing."); } break; case SUBCMD_LIST_IGNORED: printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.IGNORED))); break; case SUBCMD_CLEAR: <START> clearInboxEntries(console, inbox.getAll()); <END> break; default: break; } } else { printInboxEntries(console, inbox.get(new InboxFilterCriteria(DiscoveryResultFlag.NEW))); } }</code><technical_language>IMHO</technical_language>

Target:
public void execute(String[] args, Console console) { if (args.length > 0) { final String subCommand = args[0]; switch (subCommand) { case SUBCMD_APPROVE: if (args.length > 2) { String label = args[2]; try { ThingUID thingUID = new ThingUID(args[1]); List<DiscoveryResult> results = inbox.stream().filter(forThingUID(thingUID)) .collect(Collectors.toList()); if (results.isEmpty()) { console.println("No matching inbox entry could be found."); return; } inbox.approve(thingUID, label); } catch (Exception e) { console.println(e.getMessage()); } } else { console.println("Specify thing id to approve: inbox approve <thingUID> <label>"); } break; case SUBCMD_IGNORE: if (args.length > 1) { try { ThingUID thingUID = new ThingUID(args[1]); PersistentInbox persistentInbox = (PersistentInbox) inbox; persistentInbox.setFlag(thingUID, DiscoveryResultFlag.IGNORED); } catch (IllegalArgumentException e) { console.println("'" + args[1] + "' is no valid thing UID."); } } else { console.println("Cannot approve thing as managed thing provider is missing."); } break; case SUBCMD_LIST_IGNORED: printInboxEntries(console, inbox.stream().filter(withFlag((DiscoveryResultFlag.IGNORED))) .collect(Collectors.toList())); break; case SUBCMD_CLEAR: clearInboxEntries(console, inbox.getAll()); break; default: break; } } else { printInboxEntries(console, inbox.stream().filter(withFlag((DiscoveryResultFlag.NEW))) .collect(Collectors.toList())); } }
Source:
<code>public SearchBox(ThemeManager themeManager, Consumer<String> onSearch, Runnable onClear) { this.searchField = new TextField(); this.searchField.getStyleClass().add("searchBar"); this.searchField.prefHeightProperty().bind(this.prefHeightProperty()); this.searchField.prefWidthProperty().bind(this.prefWidthProperty()); <START> this.searchField.setOnAction(event -> onSearch.accept(getText())); <END> AnchorPane.setLeftAnchor(searchField, 0.0); AnchorPane.setRightAnchor(searchField, 0.0); this.clearButton = new Button(); this.clearButton.getStyleClass().add("searchCleanButton"); this.clearButton.styleProperty().set( "-fx-graphic: url('" + themeManager.getResourceUrl(SearchBox.cleanButtonIcon) + "');"); this.clearButton.setOnMouseClicked(event -> { this.searchField.clear(); onClear.run(); }); AnchorPane.setRightAnchor(clearButton, 0.0); this.getChildren().addAll(searchField, clearButton); }</code><technical_language>I delayed search. noticeable search is performed new/removed character a fast computer. However, notice a slow computer. is useless computation</technical_language>

Target:
public SearchBox(ThemeManager themeManager, Consumer<String> onSearch, Runnable onClear) { this.searchField = new TextField(); this.searchField.getStyleClass().add("searchBar"); this.searchField.prefHeightProperty().bind(this.prefHeightProperty()); this.searchField.prefWidthProperty().bind(this.prefWidthProperty()); this.searchField.textProperty().addListener(event -> onSearch.accept(getText())); AnchorPane.setLeftAnchor(searchField, 0.0); AnchorPane.setRightAnchor(searchField, 0.0); this.clearButton = new Button(); this.clearButton.getStyleClass().add("searchCleanButton"); this.clearButton.styleProperty().set( "-fx-graphic: url('" + themeManager.getResourceUrl(SearchBox.cleanButtonIcon) + "');"); this.clearButton.setOnMouseClicked(event -> { this.searchField.clear(); onClear.run(); }); AnchorPane.setRightAnchor(clearButton, 0.0); this.getChildren().addAll(searchField, clearButton); }
Source:
<code>private static void verifySameSpatialReference(OGCGeometry leftGeometry, OGCGeometry rightGeometry) { <START> checkArgument(Objects.equals(leftGeometry.getEsriSpatialReference(), rightGeometry.getEsriSpatialReference()), "Input Geometries Spatial Reference do not match"); <END> }</code><technical_language>This error message is confusing. "Geometries" possessive? Also, "References" plural? is capitalized</technical_language>

Target:
private static void verifySameSpatialReference(OGCGeometry leftGeometry, OGCGeometry rightGeometry) { checkArgument(Objects.equals(leftGeometry.getEsriSpatialReference(), rightGeometry.getEsriSpatialReference()), "Input geometries must have same spatial reference"); }
Source:
<code>private Action getImportMappingAction(final Composite parent) { if (fImportMappingAction != null) { return fImportMappingAction; } fImportMappingAction = new Action() { @Override public void run() { FileDialog dialog = new FileDialog(parent.getShell()); dialog.setText(Messages.CallStackView_ImportMappingDialogTitle); String filePath = dialog.open(); if (filePath == null) { return; } fNameMapping = FunctionNameMapper.mapFromNmTextFile(new File(filePath)); <START> buildThreadList(fTrace, new NullProgressMonitor()); <END> redraw(); } }; fImportMappingAction.setText(Messages.CallStackView_ImportMappingButtonText); fImportMappingAction.setToolTipText(Messages.CallStackView_ImportMappingButtonTooltip); fImportMappingAction.setImageDescriptor(null); return fImportMappingAction; }</code><technical_language>buildThreadList is a long running operation block UI thread for a while. is a class BuildThread simpler call loadTrace. If mapFromNmTextFile moved nice file big. filePath a member var if null initialize mapping in BuildThread.run</technical_language>

Target:
private Action getImportMappingAction(final Composite parent) { if (fImportMappingAction != null) { return fImportMappingAction; } fImportMappingAction = new Action() { @Override public void run() { FileDialog dialog = new FileDialog(parent.getShell()); dialog.setText(Messages.CallStackView_ImportMappingDialogTitle); String filePath = dialog.open(); if (filePath == null) { return; } Job job = new ImportMappingJob(new File(filePath)); job.schedule(); } }; fImportMappingAction.setText(Messages.CallStackView_ImportMappingButtonText); fImportMappingAction.setToolTipText(Messages.CallStackView_ImportMappingButtonTooltip); fImportMappingAction.setImageDescriptor(null); return fImportMappingAction; }
Source:
<code>public void testConsumerReadSplitResults() throws Exception { final Map<String, Object> headers = new HashMap<>(); String endpoint = "olingo4://read/People?consumer.splitResult=true"; int expectedEntities = 20; final ClientEntitySet entities = (ClientEntitySet)requestBodyAndHeaders(endpoint, null, headers); assertNotNull(entities); assertEquals(expectedEntities, entities.getEntities().size()); int expectedMsgCount = 3; <START> MockEndpoint mockEndpoint = getMockEndpoint("mock:consumer-splitresult"); <END> mockEndpoint.expectedMinimumMessageCount(expectedMsgCount); mockEndpoint.assertIsSatisfied(); for (int i = 0; i < expectedMsgCount; ++i) { Object body = mockEndpoint.getExchanges().get(i).getIn().getBody(); assertTrue(body instanceof ClientEntity); ClientEntity entity = (ClientEntity)body; ClientProperty nameProperty = entity.getProperty("UserName"); assertNotNull(nameProperty); switch(i) { case 0: assertEquals("russellwhyte", nameProperty.getValue().toString()); break; case 1: assertEquals("scottketchum", nameProperty.getValue().toString()); break; case 2: assertEquals("ronaldmundy", nameProperty.getValue().toString()); break; } } }</code><technical_language>set mock expectations send data Camel, move lines in beginning of test method, send data, assert mock. Do in other unit tests</technical_language>

Target:
public void testConsumerReadSplitResults() throws Exception { final Map<String, Object> headers = new HashMap<>(); String endpoint = "olingo4://read/People?consumer.splitResult=true"; int expectedEntities = 20; int expectedMsgCount = 3; MockEndpoint mockEndpoint = getMockEndpoint("mock:consumer-splitresult"); mockEndpoint.expectedMinimumMessageCount(expectedMsgCount); final ClientEntitySet entities = (ClientEntitySet)requestBodyAndHeaders(endpoint, null, headers); assertNotNull(entities); assertEquals(expectedEntities, entities.getEntities().size()); mockEndpoint.assertIsSatisfied(); for (int i = 0; i < expectedMsgCount; ++i) { Object body = mockEndpoint.getExchanges().get(i).getIn().getBody(); assertTrue(body instanceof ClientEntity); ClientEntity entity = (ClientEntity)body; ClientProperty nameProperty = entity.getProperty("UserName"); assertNotNull(nameProperty); switch(i) { case 0: assertEquals("russellwhyte", nameProperty.getValue().toString()); break; case 1: assertEquals("scottketchum", nameProperty.getValue().toString()); break; case 2: assertEquals("ronaldmundy", nameProperty.getValue().toString()); break; default: } } }
Source:
<code>public long getArrivalTime() { <START> long multiplier = 1000000; <END> if (this.pcapGlobalHeader.timestampsInNs()) { multiplier = multiplier*1000; } return this.pcapHeader.getTimeStampSeconds() * multiplier + this.pcapHeader.getTimeStampMicroOrNanoSeconds(); }</code><technical_language>nit; this final final long multiplier = pcapGlobalHeader.timestampsInNs() ? 1000000000 : 1000000</technical_language>

Target:
public long getArrivalTime() { final long multiplier = pcapGlobalHeader.timestampsInNs() ? 1000000000 : 1000000; return this.pcapHeader.getTimeStampSeconds() * multiplier + this.pcapHeader.getTimeStampMicroOrNanoSeconds(); }
Source:
<code>private ConnectorPageSink createPageSink(HiveWritableTableHandle handle, boolean isCreateTable, ConnectorSession session) { OptionalInt bucketCount = OptionalInt.empty(); List<SortingColumn> sortedBy = ImmutableList.of(); if (handle.getBucketProperty().isPresent()) { bucketCount = OptionalInt.of(handle.getBucketProperty().get().getBucketCount()); sortedBy = handle.getBucketProperty().get().getSortedBy(); } HiveWriterFactory writerFactory = new HiveWriterFactory( fileWriterFactories, handle.getSchemaName(), handle.getTableName(), isCreateTable, handle.getInputColumns(), handle.getTableStorageFormat(), handle.getPartitionStorageFormat(), bucketCount, sortedBy, handle.getLocationHandle(), locationService, handle.getFilePrefix(), new HivePageSinkMetadataProvider(handle.getPageSinkMetadata(), metastore), typeManager, hdfsEnvironment, pageSorter, writerSortBufferSize, maxOpenSortFiles, immutablePartitions, session, nodeManager, eventClient, hiveSessionProperties, hiveWriterStats); return new HivePageSink( writerFactory, handle.getInputColumns(), handle.getBucketProperty(), pageIndexerFactory, typeManager, hdfsEnvironment, <START> hiveSessionProperties.getMaxPartitionsPerWriter(session), <END> writeVerificationExecutor, partitionUpdateCodec, session); }</code><technical_language>this is a static method</technical_language>

Target:
private ConnectorPageSink createPageSink(HiveWritableTableHandle handle, boolean isCreateTable, ConnectorSession session) { OptionalInt bucketCount = OptionalInt.empty(); List<SortingColumn> sortedBy = ImmutableList.of(); if (handle.getBucketProperty().isPresent()) { bucketCount = OptionalInt.of(handle.getBucketProperty().get().getBucketCount()); sortedBy = handle.getBucketProperty().get().getSortedBy(); } HiveWriterFactory writerFactory = new HiveWriterFactory( fileWriterFactories, handle.getSchemaName(), handle.getTableName(), isCreateTable, handle.getInputColumns(), handle.getTableStorageFormat(), handle.getPartitionStorageFormat(), bucketCount, sortedBy, handle.getLocationHandle(), locationService, handle.getFilePrefix(), new HivePageSinkMetadataProvider(handle.getPageSinkMetadata(), metastore), typeManager, hdfsEnvironment, pageSorter, writerSortBufferSize, maxOpenSortFiles, immutablePartitions, session, nodeManager, eventClient, hiveSessionProperties, hiveWriterStats); return new HivePageSink( writerFactory, handle.getInputColumns(), handle.getBucketProperty(), pageIndexerFactory, typeManager, hdfsEnvironment, getMaxPartitionsPerWriter(session), writeVerificationExecutor, partitionUpdateCodec, session); }
Source:
<code>public <T extends IResource> T stub(String kind, String name, String namespace) { String[] elements = ResourceKind.parse(kind); IVersionedType type = client.adapt(IApiTypeMapper.class).getType(elements[0], elements[1]); if (type != null) { <START> KubernetesResource resource = (KubernetesResource) create(type.getApiGroupNameAndVersion(), elements[1]); <END> resource.setName(name); resource.setNamespace(namespace); if (StringUtils.isNotEmpty(namespace)) { resource.setNamespace(namespace); } return (T) resource; } else { throw new ResourceFactoryException(null, "Unable to create resource from kind %s", kind); } }</code><technical_language>unnecessary cast (KubernetesResource)</technical_language>

Target:
public <T extends IResource> T stub(String kind, String name, String namespace) { String[] elements = ResourceKind.parse(kind); IVersionedType type = client.adapt(IApiTypeMapper.class).getType(elements[0], elements[1]); if (type != null) { KubernetesResource resource = create(type.getApiGroupNameAndVersion(), elements[1]); resource.setName(name); resource.setNamespace(namespace); if (StringUtils.isNotEmpty(namespace)) { resource.setNamespace(namespace); } return (T) resource; } else { throw new ResourceFactoryException(null, "Unable to create resource from kind %s", kind); } }
Source:
<code>public ColumnWriterV2( ColumnDescriptor path, PageWriter pageWriter, ParquetProperties parquetProps, int pageSize) { this.path = path; this.pageWriter = pageWriter; resetStatistics(); this.repetitionLevelColumn = new RunLengthBitPackingHybridEncoder(getWidthFromMaxInt(path.getMaxRepetitionLevel()), MIN_SLAB_SIZE, pageSize, pageWriter.getAllocator()); this.definitionLevelColumn = new RunLengthBitPackingHybridEncoder(getWidthFromMaxInt(path.getMaxDefinitionLevel()), MIN_SLAB_SIZE, pageSize, pageWriter.getAllocator()); <START> <END> int initialSlabSize = CapacityByteArrayOutputStream.initialSlabSizeHeuristic(MIN_SLAB_SIZE, pageSize, 10); this.dataColumn = parquetProps.getValuesWriter(path, initialSlabSize, pageSize); }</code><technical_language>getAllocator() here. properly pass dependency a constructor parameter</technical_language>

Target:
public ColumnWriterV2( ColumnDescriptor path, PageWriter pageWriter, ParquetProperties parquetProps, int pageSize) { this.path = path; this.pageWriter = pageWriter; resetStatistics(); this.repetitionLevelColumn = new RunLengthBitPackingHybridEncoder( getWidthFromMaxInt(path.getMaxRepetitionLevel()), MIN_SLAB_SIZE, pageSize, parquetProps.getAllocator()); this.definitionLevelColumn = new RunLengthBitPackingHybridEncoder( getWidthFromMaxInt(path.getMaxDefinitionLevel()), MIN_SLAB_SIZE, pageSize, parquetProps.getAllocator()); int initialSlabSize = CapacityByteArrayOutputStream.initialSlabSizeHeuristic(MIN_SLAB_SIZE, pageSize, 10); this.dataColumn = parquetProps.getValuesWriter(path, initialSlabSize, pageSize); }
Source:
<code>protected QuantileResult quantile(double level, DoubleArray sample, boolean isExtrapolated) { ArgChecker.isTrue(level > 0, "Quantile should be above 0."); ArgChecker.isTrue(level < 1, "Quantile should be below 1."); int sampleSize = sampleCorrection(sample.size()); double adjustedLevel = checkIndex(level * sampleSize + indexCorrection(), sample.size(), isExtrapolated); double[] order = createIndexArray(sample.size()); double[] s = sample.toArray(); DoubleArrayMath.sortPairs(s, order); int lowerIndex = (int) Math.floor(adjustedLevel); int upperIndex = (int) Math.ceil(adjustedLevel); double lowerWeight = upperIndex - adjustedLevel; double upperWeight = 1d - lowerWeight; return QuantileResult.of( lowerWeight * s[lowerIndex - 1] + upperWeight * s[upperIndex - 1], <START> new int[]{(int) order[(int) Math.floor(adjustedLevel) - 1], (int) order[(int) Math.ceil(adjustedLevel) - 1]}, <END> DoubleArray.of(lowerWeight, upperWeight)); }</code><technical_language>(int) Math.floor(adjustedLevel) (int) Math.ceil(adjustedLevel) computed in 35 36, respectively</technical_language>

Target:
protected QuantileResult quantile(double level, DoubleArray sample, boolean isExtrapolated) { ArgChecker.isTrue(level > 0, "Quantile should be above 0."); ArgChecker.isTrue(level < 1, "Quantile should be below 1."); int sampleSize = sampleCorrection(sample.size()); double adjustedLevel = checkIndex(level * sampleSize + indexCorrection(), sample.size(), isExtrapolated); double[] order = createIndexArray(sample.size()); double[] s = sample.toArray(); DoubleArrayMath.sortPairs(s, order); int lowerIndex = (int) Math.floor(adjustedLevel); int upperIndex = (int) Math.ceil(adjustedLevel); double lowerWeight = upperIndex - adjustedLevel; double upperWeight = 1d - lowerWeight; return QuantileResult.of( lowerWeight * s[lowerIndex - 1] + upperWeight * s[upperIndex - 1], new int[]{(int) order[lowerIndex - 1], (int) order[upperIndex - 1]}, DoubleArray.of(lowerWeight, upperWeight)); }
Source:
<code>public void testReaperReapsAnEmptyGroupAfterConfiguredDelay() throws Exception { final MessageGroupStore groupStore = new SimpleMessageStore(); AggregatingMessageHandler handler = new AggregatingMessageHandler(group -> group, groupStore); final List<Message<?>> outputMessages = new ArrayList<Message<?>>(); handler.setOutputChannel((message, timeout) -> { outputMessages.add(message); return true; }); handler.setReleaseStrategy(group -> group.size() == 1); Message<String> message = MessageBuilder.withPayload("foo") .setCorrelationId("bar") .build(); handler.handleMessage(message); handler.setMinimumTimeoutForEmptyGroups(100); assertEquals(1, outputMessages.size()); assertEquals(1, TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size()); groupStore.expireMessageGroups(0); assertEquals(1, TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size()); int n = 0; <START> while (n++ < 100) { <END> groupStore.expireMessageGroups(0); if (TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size() > 0) { Thread.sleep(50); } else { break; } } assertTrue(n < 100); assertEquals(0, TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size()); }</code><technical_language>200 s/50/100/ - 10 seconds 5 is enough for Bamboo</technical_language>

Target:
public void testReaperReapsAnEmptyGroupAfterConfiguredDelay() throws Exception { final MessageGroupStore groupStore = new SimpleMessageStore(); AggregatingMessageHandler handler = new AggregatingMessageHandler(group -> group, groupStore); final List<Message<?>> outputMessages = new ArrayList<Message<?>>(); handler.setOutputChannel((message, timeout) -> { outputMessages.add(message); return true; }); handler.setReleaseStrategy(group -> group.size() == 1); Message<String> message = MessageBuilder.withPayload("foo") .setCorrelationId("bar") .build(); handler.handleMessage(message); handler.setMinimumTimeoutForEmptyGroups(100); assertEquals(1, outputMessages.size()); assertEquals(1, TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size()); groupStore.expireMessageGroups(0); assertEquals(1, TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size()); int n = 0; while (n++ < 200) { groupStore.expireMessageGroups(0); if (TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size() > 0) { Thread.sleep(50); } else { break; } } assertTrue(n < 200); assertEquals(0, TestUtils.getPropertyValue(handler, "messageStore.groupIdToMessageGroup", Map.class).size()); }
Source:
<code>public int getCommentID(String content) { <START> this.commentsList = getDriver().findElements(By.className("xwikicomment")); <END> for (int i = 0; i < this.commentsList.size(); i++) { if (this.commentsList.get(i).findElement(By.className("commentcontent")).getText().equals(content)) { return Integer .parseInt(this.commentsList.get(i).getAttribute("id").substring("xwikicomment_".length())); } } return -1; }</code><technical_language>changing that</technical_language>

Target:
public int getCommentID(String content) { this.commentsList = getDriver().findElementsWithoutWaiting(By.className("xwikicomment")); for (int i = 0; i < this.commentsList.size(); i++) { if (this.commentsList.get(i).findElement(By.className("commentcontent")).getText().equals(content)) { return Integer .parseInt(this.commentsList.get(i).getAttribute("id").substring("xwikicomment_".length())); } } return -1; }
Source:
<code>public boolean shouldStreamEntireSSTable() { if (!isZeroCopySSTableTransfersEnabled || ref.get().getSSTableMetadata().hasLegacyCounterShards) return false; ColumnFamilyStore cfs = ColumnFamilyStore.getIfExists(getTableId()); if (cfs == null) return false; AbstractCompactionStrategy compactionStrategy = cfs.getCompactionStrategyManager() .getCompactionStrategyFor(ref.get()); if (compactionStrategy instanceof LeveledCompactionStrategy) return contained(ranges, ref.get()); if (compactionStrategy instanceof SizeTieredCompactionStrategy) { return (ranges != null && ranges.size() == 1 && ranges.get(0) <START> .contains(new Range<>(ref.get().first.getToken(), <END> ref.get().last.getToken()))); } return false; }</code><technical_language>Bounds for sstable, range is (first, last] sstable contains [first, last] (thanks @krummas). a higher level note, stick LCS for now, enable STCS commit CASSANDRA-14568? do in 4.0, this temporary special case a release \_()_/</technical_language>

Target:
public boolean shouldStreamEntireSSTable() { if (!DatabaseDescriptor.isZeroCopySSTableTransfersEnabled() || ref.get().getSSTableMetadata().hasLegacyCounterShards) return false; ColumnFamilyStore cfs = ColumnFamilyStore.getIfExists(getTableId()); if (cfs == null) return false; AbstractCompactionStrategy compactionStrategy = cfs.getCompactionStrategyManager() .getCompactionStrategyFor(ref.get()); if (compactionStrategy instanceof LeveledCompactionStrategy) return contained(ranges, ref.get()); return false; }
Source:
<code>public synchronized Map<String, DbColumnType> getMetadata(final String name) throws DatabaseEngineException { final Map<String, DbColumnType> metaMap = new LinkedHashMap<>(); Statement s = null; ResultSet rsColumns = null; try { getConnection(); s = conn.createStatement(); rsColumns = s.executeQuery(format( "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION FROM ALL_TAB_COLS WHERE TABLE_NAME = '%s' AND OWNER = '%s'", name, this.currentSchema )); while (rsColumns.next()) { <START> String columnName = rsColumns.getString("COLUMN_NAME"); <END> if (!columnName.toUpperCase().startsWith("SYS_")) { final String dataPrecision = rsColumns.getString("DATA_PRECISION"); final DbColumnType value = toPdbType( dataPrecision == null ? rsColumns.getString("DATA_TYPE") : (rsColumns.getString("DATA_TYPE") + dataPrecision) ); if (value != DbColumnType.UNMAPPED) { metaMap.put(columnName, value); } } } return metaMap; } catch (Exception e) { throw new DatabaseEngineException("Could not get metadata", e); } finally { try { if (rsColumns != null) { rsColumns.close(); } } catch (Exception a) { logger.trace("Error closing result set.", a); } try { if (s != null) { s.close(); } } catch (Exception a) { logger.trace("Error closing statement.", a); } } }</code><technical_language>if call getSchema is null</technical_language>

Target:
public synchronized Map<String, DbColumnType> getMetadata(final String name) throws DatabaseEngineException { final Map<String, DbColumnType> metaMap = new LinkedHashMap<>(); Statement s = null; ResultSet rsColumns = null; try { getConnection(); s = conn.createStatement(); rsColumns = s.executeQuery(format( "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION FROM ALL_TAB_COLS WHERE TABLE_NAME = '%s' AND OWNER = '%s'", name, this.currentSchema )); while (rsColumns.next()) { String columnName = rsColumns.getString("COLUMN_NAME"); if (!columnName.toUpperCase().startsWith("SYS_")) { final String dataPrecision = rsColumns.getString("DATA_PRECISION"); final DbColumnType value = toPdbType( dataPrecision == null ? rsColumns.getString("DATA_TYPE") : (rsColumns.getString("DATA_TYPE") + dataPrecision) ); if (value != DbColumnType.UNMAPPED) { metaMap.put(columnName, value); } } } return metaMap; } catch (final Exception e) { throw new DatabaseEngineException("Could not get metadata", e); } finally { try { if (rsColumns != null) { rsColumns.close(); } } catch (final Exception a) { logger.trace("Error closing result set.", a); } try { if (s != null) { s.close(); } } catch (final Exception a) { logger.trace("Error closing statement.", a); } } }
Source:
<code>public void deserialize(InputStream input) throws IOException { byte[] bytes = new byte[1024]; int read = 0; ByteArrayOutputStream out = new ByteArrayOutputStream(); <START> while((read = input.read(bytes)) > 0) <END> out.write(bytes, 0, read); this.setString(out.toString()); }</code><technical_language>put brackets while</technical_language>

Target:
public void deserialize(InputStream input) throws IOException { byte[] bytes = new byte[1024]; int read = 0; ByteArrayOutputStream out = new ByteArrayOutputStream(); while((read = input.read(bytes)) > 0) { out.write(bytes, 0, read); } this.setString(out.toString()); }
Source:
<code>private void validateConfigOptions(ReadableConfig config) { config.getOptional(URL).orElseThrow(() -> new IllegalArgumentException( String.format("Could not find required property: %s", URL.key()))); config.getOptional(TABLE_NAME).orElseThrow(() -> new IllegalArgumentException( <START> String.format("Could not find required property: %s", TABLE_NAME.key()))); <END> String jdbcUrl = config.get(URL); final Optional<JdbcDialect> dialect = JdbcDialects.get(jdbcUrl); checkState(dialect.isPresent(), "Cannot handle such jdbc url: " + jdbcUrl); if (config.getOptional(USERNAME).isPresent()) { checkState(config.getOptional(PASSWORD).isPresent(), "Database username must be provided when database password is provided"); } checkAllOrNone(config, new ConfigOption[]{ SCAN_PARTITION_COLUMN, SCAN_PARTITION_NUM, SCAN_PARTITION_LOWER_BOUND, SCAN_PARTITION_UPPER_BOUND }); if (config.getOptional(SCAN_PARTITION_LOWER_BOUND).isPresent() && config.getOptional(SCAN_PARTITION_UPPER_BOUND).isPresent()) { checkState(config.get(SCAN_PARTITION_LOWER_BOUND) <= config.get(SCAN_PARTITION_UPPER_BOUND), String.format("%s must not be larger than %s", SCAN_PARTITION_LOWER_BOUND.key(), SCAN_PARTITION_UPPER_BOUND.key())); } checkAllOrNone(config, new ConfigOption[]{ LOOKUP_CACHE_MAX_ROWS, LOOKUP_CACHE_TTL }); }</code><technical_language>suggestion String.format("Could find required option: %s", TABLE_NAME.key())));</technical_language>

Target:
private void validateConfigOptions(ReadableConfig config) { config.getOptional(URL).orElseThrow(() -> new IllegalArgumentException( String.format("Could not find required option: %s", URL.key()))); config.getOptional(TABLE_NAME).orElseThrow(() -> new IllegalArgumentException( String.format("Could not find required option: %s", TABLE_NAME.key()))); String jdbcUrl = config.get(URL); final Optional<JdbcDialect> dialect = JdbcDialects.get(jdbcUrl); checkState(dialect.isPresent(), "Cannot handle such jdbc url: " + jdbcUrl); if (config.getOptional(USERNAME).isPresent()) { checkState(config.getOptional(PASSWORD).isPresent(), "Database username must be provided when database password is provided"); } checkAllOrNone(config, new ConfigOption[]{ SCAN_PARTITION_COLUMN, SCAN_PARTITION_NUM, SCAN_PARTITION_LOWER_BOUND, SCAN_PARTITION_UPPER_BOUND }); if (config.getOptional(SCAN_PARTITION_LOWER_BOUND).isPresent() && config.getOptional(SCAN_PARTITION_UPPER_BOUND).isPresent()) { checkState(config.get(SCAN_PARTITION_LOWER_BOUND) <= config.get(SCAN_PARTITION_UPPER_BOUND), String.format("%s must not be larger than %s", SCAN_PARTITION_LOWER_BOUND.key(), SCAN_PARTITION_UPPER_BOUND.key())); } checkAllOrNone(config, new ConfigOption[]{ LOOKUP_CACHE_MAX_ROWS, LOOKUP_CACHE_TTL }); }
Source:
<code>public void testCreateListenerIllegalStateException() throws Exception { final Method method = Main.class.getDeclaredMethod("createListener", String.class, String.class); final LocalizedMessage loadPropertiesMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "Main.createListener", <START> new String[] {"myformat", "plain", "xml"}, null, getClass(), null); <END> method.setAccessible(true); try { method.invoke(null, "myformat", null); fail("InvocationTargetException is expected"); } catch (InvocationTargetException ex) { assertEquals(loadPropertiesMessage.getMessage(), ex.getCause().getLocalizedMessage()); assertTrue(ex.getCause() instanceof IllegalStateException); } }</code><technical_language>please move close usage possible</technical_language>

Target:
public void testCreateListenerIllegalStateException() throws Exception { final Method method = Main.class.getDeclaredMethod("createListener", String.class, String.class); method.setAccessible(true); try { method.invoke(null, "myformat", null); fail("InvocationTargetException is expected"); } catch (InvocationTargetException ex) { final LocalizedMessage loadPropertiesMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, "Main.createListener", new String[] {"myformat", "plain", "xml"}, null, getClass(), null); assertEquals(loadPropertiesMessage.getMessage(), ex.getCause().getLocalizedMessage()); assertTrue(ex.getCause() instanceof IllegalStateException); } }
Source:
<code>private boolean isAllNulls(ColumnChunkMetaData column) { <START> return (column.getStatistics().isEmpty()) || (column.getStatistics().getNumNulls() == column.getValueCount()); <END> }</code><technical_language>Is empty row group records in it? In this case, a binary column null statistics values, isAllNulls/hasNulls return true, is semantically wrong</technical_language>

Target:
private boolean isAllNulls(ColumnChunkMetaData column) { return column.getStatistics().getNumNulls() == column.getValueCount(); }
Source:
<code>private Row internalNext() { if (cache == null && !yielder.isDone()) { cache = yielder.get(); yielder = yielder.next(cache); cacheIter = cache.getRows().iterator(); } Row r = null; if (cacheIter != null) { if (cacheIter.hasNext()) { r = cacheIter.next(); Map<String, Object> key = MovingAverageHelper.getDimKeyFromRow(dims, r); seenKeys.add(key); r = computeMovingAverage(key, r, false); if (r != null) { return r; } else { throw new NoSuchElementException(); } } else { Set<Map<String, Object>> averagerKeys = new HashSet<>(averagers.keySet()); averagerKeys.removeAll(seenKeys); averagersKeysIter = averagerKeys.iterator(); cacheIter = null; } } if (averagersKeysIter != null) { while (averagersKeysIter.hasNext()) { Map<String, Object> dims = averagersKeysIter.next(); Map<String, Object> fakeEventsCopy = new HashMap<>(fakeEvents); dims.forEach((dim, value) -> { fakeEventsCopy.put(dim, value); }); r = computeMovingAverage(dims, new MapBasedRow(cache.getDateTime(), fakeEventsCopy), true); if (r != null) { return r; } } seenKeys.clear(); averagersKeysIter = null; cache = null; } <START> if (cacheIter == null && averagersKeysIter == null && yielder.isDone()) { <END> throw new NoSuchElementException(); } return internalNext(); }</code><technical_language>averagersKeysIter is null here</technical_language>

Target:
private Row internalNext() { while (true) { if (cache == null && !yielder.isDone()) { cache = yielder.get(); yielder = yielder.next(cache); cacheIter = cache.getRows().iterator(); } Row r; if (cacheIter != null) { if (cacheIter.hasNext()) { r = cacheIter.next(); Map<String, Object> key = MovingAverageHelper.getDimKeyFromRow(dims, r); seenKeys.add(key); r = computeMovingAverage((MapBasedRow) r, false); if (r != null) { return r; } else { throw new NoSuchElementException(); } } else { Set<Map<String, Object>> averagerKeys = new HashSet<>(averagers.keySet()); averagerKeys.removeAll(seenKeys); averagersKeysIter = averagerKeys.iterator(); cacheIter = null; } } if (averagersKeysIter != null) { while (averagersKeysIter.hasNext()) { Map<String, Object> dims = averagersKeysIter.next(); Map<String, Object> emptyEventsCopy = new HashMap<>(emptyEvents); dims.forEach((dim, value) -> emptyEventsCopy.put(dim, value)); r = computeMovingAverage(new MapBasedRow(cache.getDateTime(), emptyEventsCopy), true); if (r != null) { return r; } } seenKeys.clear(); averagersKeysIter = null; cache = null; } if (cacheIter == null && yielder.isDone()) { return null; } } }
Source:
<code>public static boolean anyRunning() { IConsole ic[] = ConsolePlugin.getDefault().getConsoleManager().getConsoles(); ScriptConsole console; for(int i=0; i<ic.length; i++) { if (ic[i] instanceof ScriptConsole){ console = (ScriptConsole)ic[i]; if(console.isRunning()) <START> return true; <END> } } return false; }</code><technical_language>Please for line if clauses</technical_language>

Target:
public static boolean anyRunning() { IConsole ic[] = ConsolePlugin.getDefault().getConsoleManager().getConsoles(); ScriptConsole console; for(int i=0; i<ic.length; i++) { if (ic[i] instanceof ScriptConsole){ console = (ScriptConsole)ic[i]; if(console.isRunning()){ return true; } } } return false; }
Source:
<code>public void testCompactFooterModifiedSchemaRegistration() throws Exception { try (Ignite ignite = Ignition.start(Config.getServerConfiguration())) { ignite.getOrCreateCache(Config.DEFAULT_CACHE_NAME); try (IgniteClient client1 = Ignition.startClient(new ClientConfiguration().setAddresses(Config.SERVER) <START> .setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(true))); <END> IgniteClient client2 = Ignition.startClient(new ClientConfiguration().setAddresses(Config.SERVER) .setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(true))) ) { ClientCache<Integer, Object> cache1 = client1.cache(Config.DEFAULT_CACHE_NAME).withKeepBinary(); ClientCache<Integer, Object> cache2 = client2.cache(Config.DEFAULT_CACHE_NAME).withKeepBinary(); String type = "Person"; BinaryObjectBuilder builder1 = client1.binary().builder(type); BinaryObject val1 = builder1.setField("Name", "Person 1").build(); cache1.put(1, val1); assertEquals("Person 1", ((BinaryObject)cache2.get(1)).field("Name")); BinaryObjectBuilder builder2 = client1.binary().builder(type); BinaryObject val2 = builder2.setField("Name", "Person 2").setField("Age", 2).build(); cache1.put(2, val2); assertEquals("Person 2", ((BinaryObject)cache2.get(2)).field("Name")); assertEquals((Integer)2, ((BinaryObject)cache2.get(2)).field("Age")); } } }</code><technical_language>move ClientConfiguration separate variable</technical_language>

Target:
public void testCompactFooterModifiedSchemaRegistration() throws Exception { try (Ignite ignite = Ignition.start(Config.getServerConfiguration())) { ignite.getOrCreateCache(Config.DEFAULT_CACHE_NAME); ClientConfiguration cfg = new ClientConfiguration().setAddresses(Config.SERVER) .setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(true)); try (IgniteClient client1 = Ignition.startClient(cfg); IgniteClient client2 = Ignition.startClient(cfg)) { ClientCache<Integer, Object> cache1 = client1.cache(Config.DEFAULT_CACHE_NAME).withKeepBinary(); ClientCache<Integer, Object> cache2 = client2.cache(Config.DEFAULT_CACHE_NAME).withKeepBinary(); String type = "Person"; BinaryObjectBuilder builder = client1.binary().builder(type); BinaryObject val1 = builder.setField("Name", "Person 1").build(); cache1.put(1, val1); assertEquals("Person 1", ((BinaryObject)cache2.get(1)).field("Name")); BinaryObject val2 = builder.setField("Name", "Person 2").setField("Age", 2).build(); cache1.put(2, val2); assertEquals("Person 2", ((BinaryObject)cache2.get(2)).field("Name")); assertEquals((Integer)2, ((BinaryObject)cache2.get(2)).field("Age")); } } }
Source:
<code>public View newView(Context context, Cursor cursor, ViewGroup parent) { <START> return ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)) <END> .inflate(android.R.layout.simple_list_item_1, parent, false); }</code><technical_language>a billion of LayoutInflater methods I LayoutInflater.from(context) is for this circumstance</technical_language>

Target:
public View newView(Context context, Cursor cursor, ViewGroup parent) { return LayoutInflater.from(context) .inflate(android.R.layout.simple_list_item_1, parent, false); }
Source:
<code>public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException { return root.retrieve() <START> .method("POST") <END> .with("subscribed", subscribed) .with("ignored", ignored) .method("PUT") .withUrlPath(getApiTailUrl("subscription")) .to(GHSubscription.class) .wrapUp(this); }</code><technical_language>Multiple method(*) methods</technical_language>

Target:
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException { return root.createRequest() .method("PUT") .with("subscribed", subscribed) .with("ignored", ignored) .withUrlPath(getApiTailUrl("subscription")) .fetch(GHSubscription.class) .wrapUp(this); }
Source:
<code>public void onLivingAttack(LivingAttackEvent event) { if (event.getEntity() instanceof EntityPlayer) { if (!FactionPlayerHandler.get((EntityPlayer) event.getEntity()).onEntityAttacked(event.getSource(), event.getAmount())) { event.setCanceled(true); } <START> <END> if (VampirePlayer.get((EntityPlayer) event.getEntity()).getSpecialAttributes().half_invulnerable) { if (event.getAmount() >= event.getEntityLiving().getMaxHealth() * Balance.vpa.HALINVULNERABLE_BORDER && event.getAmount() < 10000) event.setCanceled(true); } } }</code><technical_language>This moved VampirePlayer#onEntityAttacked. I guess is fine</technical_language>

Target:
public void onLivingAttack(LivingAttackEvent event) { if (event.getEntity() instanceof EntityPlayer) { if (!FactionPlayerHandler.get((EntityPlayer) event.getEntity()).onEntityAttacked(event.getSource(), event.getAmount())) { event.setCanceled(true); } } }
Source:
<code>public void refresh(ExtensionComponentSet delta) { synchronized (getLoadLock()) { if (extensions==null) return; Collection<ExtensionComponent<T>> found = load(delta); if (!found.isEmpty()) { List<ExtensionComponent<T>> l = Lists.newArrayList(extensions); l.addAll(found); extensions = sort(l); <START> fireOnChangeListeners(); <END> } } }</code><technical_language>exposing lock listeners</technical_language>

Target:
public void refresh(ExtensionComponentSet delta) { boolean fireOnChangeListeners = false; synchronized (getLoadLock()) { if (extensions==null) return; Collection<ExtensionComponent<T>> found = load(delta); if (!found.isEmpty()) { List<ExtensionComponent<T>> l = Lists.newArrayList(extensions); l.addAll(found); extensions = sort(l); fireOnChangeListeners = true; } } if (fireOnChangeListeners) { fireOnChangeListeners(); } }
Source:
<code>protected void runOneIteration() { for (Map.Entry<JobId, Job> entry : masterModel.getJobs().entrySet()) { JobId jobId = entry.getKey(); Job job = entry.getValue(); if (job.getExpires() == null) { continue; } else if (job.getExpires().getTime() <= System.currentTimeMillis()) { final JobStatus status = masterModel.getJobStatus(jobId); <START> List<String> hosts = ImmutableList.copyOf(status.getDeployments().keySet()); <END> for (String host : hosts) { try { masterModel.undeployJob(host, jobId); } catch (HostNotFoundException e) { log.error("couldn't undeploy job from host when it hit deadline", jobId, host, e); } catch (JobNotDeployedException e) { log.debug("job was already undeployed when it hit deadline", jobId, e); } } try { masterModel.removeJob(jobId); } catch (JobDoesNotExistException e) { log.debug("job was already removed when it hit deadline", jobId, e); } catch (JobStillDeployedException e) { log.debug("job still deployed on some host(s) after expiry reap", jobId, e); } } } }</code><technical_language>final</technical_language>

Target:
protected void runOneIteration() { for (Entry<JobId, Job> entry : masterModel.getJobs().entrySet()) { JobId jobId = entry.getKey(); Job job = entry.getValue(); if (job.getExpires() == null) { continue; } else if (job.getExpires().getTime() <= System.currentTimeMillis()) { final JobStatus status = masterModel.getJobStatus(jobId); final List<String> hosts = ImmutableList.copyOf(status.getDeployments().keySet()); for (String host : hosts) { try { masterModel.undeployJob(host, jobId); } catch (HostNotFoundException e) { log.error("couldn't undeploy job from host when it hit deadline", jobId, host, e); } catch (JobNotDeployedException e) { log.debug("job was already undeployed when it hit deadline", jobId, e); } } try { masterModel.removeJob(jobId); } catch (JobDoesNotExistException e) { log.debug("job was already removed when it hit deadline", jobId, e); } catch (JobStillDeployedException e) { log.debug("job still deployed on some host(s) after expiry reap", jobId, e); } } } }
Source:
<code>public String toPythonCode() { final StringBuilder builder = new StringBuilder(); <START> builder.append("if self.response.status == ").append(code).append(":\n") <END> .append(pythonIndent(3)) .append("self.result = response.read()"); return builder.toString(); }</code><technical_language>put text of append statement constructor of StringBuilder</technical_language>

Target:
public String toPythonCode() { final StringBuilder builder = new StringBuilder("if self.response.status == "); builder.append(code).append(":\n") .append(pythonIndent(3)) .append("self.result = response.read()"); return builder.toString(); }
Source:
<code>public void discoverPackageDependencies() { if (discoveringDependencies_) return; if (sentinel_ == null) return; discoveringDependencies_ = true; server_.discoverPackageDependencies( sentinel_.getId(), docDisplay_.getFileType().getDefaultExtension(), new ServerRequestCallback<JsArrayString>() { @Override public void onResponseReceived(JsArrayString response) { discoveringDependencies_ = false; if (response.length() > 0) target_.showRequiredPackagesMissingWarning(JsUtil.toList(response)); <START> } <END> @Override public void onError(ServerError error) { discoveringDependencies_ = false; Debug.logError(error); } }); }</code><technical_language>this works for R files present, I run for R files (as library() calls in other file types pretty guaranteed false positives)</technical_language>

Target:
public void discoverPackageDependencies() { if (discoveringDependencies_) return; if (sentinel_ == null) return; boolean canDiscoverDependencies = docDisplay_.getFileType().isR() || docDisplay_.getFileType().isRmd() || docDisplay_.getFileType().isRnw(); if (!canDiscoverDependencies) return; discoveringDependencies_ = true; server_.discoverPackageDependencies( sentinel_.getId(), docDisplay_.getFileType().getDefaultExtension(), new ServerRequestCallback<AvailablePackagesReadyEvent.Data>() { @Override public void onResponseReceived(AvailablePackagesReadyEvent.Data response) { discoveringDependencies_ = false; if (!response.isReady()) return; JsArrayString packages = response.getPackages(); if (packages.length() > 0) target_.showRequiredPackagesMissingWarning(JsUtil.toList(packages)); } @Override public void onError(ServerError error) { discoveringDependencies_ = false; Debug.logError(error); } }); }
Source:
<code>public CreateRequest processPreCreate(CreateRequest input) { ddf.security.Subject subject = setSubjectOnRequestProperties(input); if (input.getMetacards() != null && subject != null) { input .getMetacards() .stream() <START> .filter(metacard -> metacard.getAttribute(Metacard.POINT_OF_CONTACT) == null) <END> .forEach( metacard -> { String id = subjectIdentity.getUniqueIdentifier(subject); if ((metacard.getTags().isEmpty() || metacard.getTags().contains("resource")) && StringUtils.isNotBlank(id)) { metacard.setAttribute(new AttributeImpl(Metacard.POINT_OF_CONTACT, id)); } }); } return input; }</code><technical_language>original intent of this plugin impossible for create a metacard a point of contact other subject creating it? I able do this if breaking some assumption/requirement somewhere</technical_language>

Target:
public CreateRequest processPreCreate(CreateRequest input) { ddf.security.Subject subject = setSubjectOnRequestProperties(input); if (input.getMetacards() != null && subject != null) { input .getMetacards() .stream() .filter(metacard -> metacard.getAttribute(Metacard.POINT_OF_CONTACT) == null) .forEach( metacard -> { String id = subjectIdentity.getUniqueIdentifier(subject); if ((metacard.getTags().isEmpty() || metacard.getTags().contains(Metacard.DEFAULT_TAG)) && StringUtils.isNotBlank(id)) { metacard.setAttribute(new AttributeImpl(Metacard.POINT_OF_CONTACT, id)); } }); } return input; }