auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append("propertyName="); sb.append(propertyName); sb.append(",sortOrder="); <START> sb.append(sortOrder); <END> return sb.toString(); }</code><technical_language>suggestion sb.append(sortOrder); sb.append("}");</technical_language>

Target:
public String toString() { return "SortByImpl{" + "propertyName=" + propertyName + ", sortOrder=" + sortOrder + '}'; }
Source:
<code>private EntityMetadataInformation determineSingleEntityMetadataInformation(SessionFactoryImplementor sessionFactory, List<Return> customQueryReturns) { EntityMetadataInformation metadataInformation = null; for ( Return queryReturn : customQueryReturns ) { if ( queryReturn instanceof RootReturn ) { if ( metadataInformation != null ) { return null; } RootReturn rootReturn = (RootReturn) queryReturn; OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( rootReturn.getEntityName() ); metadataInformation = new EntityMetadataInformation( <START> new DefaultEntityKeyMetadata( persister.getTableName(), persister.getRootTableIdentifierColumnNames() ), <END> rootReturn.getEntityName() ); } } return metadataInformation; }</code><technical_language>EKM persister used</technical_language>

Target:
private EntityMetadataInformation determineSingleEntityMetadataInformation(SessionFactoryImplementor sessionFactory, List<Return> customQueryReturns) { EntityMetadataInformation metadataInformation = null; for ( Return queryReturn : customQueryReturns ) { if ( queryReturn instanceof RootReturn ) { if ( metadataInformation != null ) { return null; } RootReturn rootReturn = (RootReturn) queryReturn; OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( rootReturn.getEntityName() ); metadataInformation = new EntityMetadataInformation( persister.getEntityKeyMetadata(), rootReturn.getEntityName() ); } } return metadataInformation; }
Source:
<code>public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.collector = collector; for (int i = 1; i < streamJoinOrder.size(); i++) { <START> hashedInputs.put(streamJoinOrder.get(i), new HashMap<Object, ArrayList<TupleImpl>>()); <END> } if(outputKeys==null) { throw new IllegalArgumentException("Must specify output fields via .select() method."); } }</code><technical_language>I hashedInputs initialized Bolt construction client side well. If needed, remove it</technical_language>

Target:
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { this.collector = collector; int i=0; for ( String stream : joinCriteria.keySet() ) { if(i>0) { hashedInputs.put(stream, new HashMap<Object, ArrayList<Tuple>>()); } ++i; } if(outputKeys==null) { throw new IllegalArgumentException("Must specify output fields via .select() method."); } }
Source:
<code>public ByteArrayLenCodec(final CRAMCodec<Integer> lenCodec, final CRAMCodec<byte[]> byteCodec) { <START> super(); <END> this.lenCodec = lenCodec; this.byteCodec = byteCodec; }</code><technical_language>super(); is unnecessary automatically called</technical_language>

Target:
public ByteArrayLenCodec(final CRAMCodec<Integer> lenCodec, final CRAMCodec<byte[]> byteCodec) { this.lenCodec = lenCodec; this.byteCodec = byteCodec; }
Source:
<code>public RootDSEData(DirContext dirContext) throws NamingException { SearchControls controls = RootDSEQueryInfo.createSearchControls(); String query = RootDSEQueryInfo.ROOT_DSE_LDAP_QUERY; NamingEnumeration<SearchResult> searchResults = dirContext.search("", query, controls); while (searchResults.hasMoreElements()) { SearchResult searchResult = searchResults.nextElement(); Attributes attributes = searchResult.getAttributes(); Attribute attribute = attributes.get(RootDSEQueryInfo.DEFAULT_NAMING_CONTEXT_RESULT_ATTRIBUTE); if (attribute != null) { domainDN = (String) attribute.get(); } else { Attribute namingContextAttribute = attributes.get(RootDSEQueryInfo.NAMING_CONTEXTS_RESULT_ATTRIBUTE); Attribute rhdsAttribute = attributes.get(RootDSEQueryInfo.RHDS_PROPERTY); if (namingContextAttribute != null) { domainDN = getDefaultNamingContextFromNameingContexts(namingContextAttribute); if (rhdsAttribute != null) { ldapProviderType = LdapProviderType.rhds; } else { <START> ldapProviderType = LdapProviderType.ipa; <END> } } } } }</code><technical_language>default provider is AD id rhds attribute is null IPA? elaborate</technical_language>

Target:
public RootDSEData(DirContext dirContext) throws NamingException { SearchControls controls = RootDSEQueryInfo.createSearchControls(); String query = RootDSEQueryInfo.ROOT_DSE_LDAP_QUERY; NamingEnumeration<SearchResult> searchResults = dirContext.search("", query, controls); while (searchResults.hasMoreElements()) { SearchResult searchResult = searchResults.nextElement(); Attributes attributes = searchResult.getAttributes(); Attribute attribute = attributes.get(RootDSEQueryInfo.DEFAULT_NAMING_CONTEXT_RESULT_ATTRIBUTE); if (attribute != null) { domainDN = (String) attribute.get(); ldapProviderType = LdapProviderType.activeDirectory; } else { Attribute namingContextAttribute = attributes.get(RootDSEQueryInfo.NAMING_CONTEXTS_RESULT_ATTRIBUTE); Attribute rhdsAttribute = attributes.get(RootDSEQueryInfo.RHDS_PROPERTY); if (namingContextAttribute != null) { domainDN = getDefaultNamingContextFromNamingContexts(namingContextAttribute); if (rhdsAttribute != null) { ldapProviderType = LdapProviderType.rhds; } else { ldapProviderType = LdapProviderType.ipa; } } } } }
Source:
<code>public void parseManagementInterfaces(final XMLExtendedStreamReader reader, final ModelNode address, final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException { requireNoAttributes(reader); boolean interfaceDefined = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, expectedNs); final Element element = Element.forName(reader.getLocalName()); switch (element) { case NATIVE_INTERFACE: { interfaceDefined = true; switch (expectedNs) { case DOMAIN_1_0: parseNativeManagementInterface1_0(reader, address, list); break; case DOMAIN_1_1: case DOMAIN_1_2: case DOMAIN_1_3: case DOMAIN_1_4: parseManagementInterface1_1(reader, address, false, expectedNs, list); break; default: parseManagementInterface_1_5(reader, address, false, expectedNs, list); } break; } case HTTP_INTERFACE: { interfaceDefined = true; switch (expectedNs) { case DOMAIN_1_0: parseHttpManagementInterface1_0(reader, address, list); break; case DOMAIN_1_1: case DOMAIN_1_2: case DOMAIN_1_3: case DOMAIN_1_4: parseManagementInterface1_1(reader, address, true, expectedNs, list); break; default: parseManagementInterface_1_5(reader, address, true, expectedNs, list); break; } break; } default: { throw unexpectedElement(reader); } } } if (!interfaceDefined) { <START> throw missingRequiredElement(reader, EnumSet.of(Element.NATIVE_INTERFACE, Element.HTTP_INTERFACE)); <END> } }</code><technical_language>a ParseUtils.missingOneOf method for cases of a set of choices present. missingRequiredElement message implies of present</technical_language>

Target:
public void parseManagementInterfaces(final XMLExtendedStreamReader reader, final ModelNode address, final Namespace expectedNs, final List<ModelNode> list) throws XMLStreamException { requireNoAttributes(reader); boolean interfaceDefined = false; while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { requireNamespace(reader, expectedNs); final Element element = Element.forName(reader.getLocalName()); switch (element) { case NATIVE_INTERFACE: { interfaceDefined = true; switch (expectedNs) { case DOMAIN_1_0: parseNativeManagementInterface1_0(reader, address, list); break; case DOMAIN_1_1: case DOMAIN_1_2: case DOMAIN_1_3: case DOMAIN_1_4: parseManagementInterface1_1(reader, address, false, expectedNs, list); break; default: parseManagementInterface_1_5(reader, address, false, expectedNs, list); } break; } case HTTP_INTERFACE: { interfaceDefined = true; switch (expectedNs) { case DOMAIN_1_0: parseHttpManagementInterface1_0(reader, address, list); break; case DOMAIN_1_1: case DOMAIN_1_2: case DOMAIN_1_3: case DOMAIN_1_4: parseManagementInterface1_1(reader, address, true, expectedNs, list); break; default: parseManagementInterface_1_5(reader, address, true, expectedNs, list); break; } break; } default: { throw unexpectedElement(reader); } } } if (!interfaceDefined) { throw missingOneOf(reader, EnumSet.of(Element.NATIVE_INTERFACE, Element.HTTP_INTERFACE)); } }
Source:
<code><START> void activateDeferredProfile() throws ProfileDataException{ <END> }</code><technical_language>Replace exception Exception, test is contained</technical_language>

Target:
void activateDeferredProfile() throws Exception{ }
Source:
<code>private synchronized void activateHomeApp() { try { activateHomepageContext("/home", "homepage/%2Fhome"); activateHomepageContext("/home/api", "homepage/%2F"); } catch (Throwable e) { <START> e.printStackTrace(); <END> auditor.audit(Action.DEPLOY, "home", ResourceType.URI, ActionOutcome.FAILURE); log.failedToDeployTopology("home", e); } }</code><technical_language>This due WIP, throwing stack traces</technical_language>

Target:
private synchronized void activateHomeApp() { try { activateHomepageContext("/", "homepage/%2Fhome"); activateHomepageContext("/homepage", "homepage/%2F"); } catch (Throwable e) { auditor.audit(Action.DEPLOY, "home", ResourceType.URI, ActionOutcome.FAILURE); log.failedToDeployTopology("home", e); } }
Source:
<code>private Champ copyAndMigrateFromNodeToInline(final int bitpos, final Champ node) { final int oldIndex = this.contents.length - 1 - index(nodeMap, bitpos); final int newIndex = index(dataMap, bitpos); final HashPrefixPayload[] src = this.contents; final HashPrefixPayload[] dst = new HashPrefixPayload[src.length]; <START> assert oldIndex >= newIndex; <END> System.arraycopy(src, 0, dst, 0, newIndex); KeyElement[] merged = new KeyElement[node.keyCount()]; int count = 0; for (int i=0; i < node.contents.length; i++) { KeyElement[] toAdd = node.contents[i].mappings; System.arraycopy(toAdd, 0, merged, count, toAdd.length); count += toAdd.length; } Arrays.sort(merged, Comparator.comparing(x -> x.key)); dst[newIndex] = new HashPrefixPayload(merged, null); System.arraycopy(src, newIndex, dst, newIndex + 1, oldIndex - newIndex); System.arraycopy(src, oldIndex + 1, dst, oldIndex + 1, src.length - oldIndex - 1); BitSet newNodeMap = BitSet.valueOf(nodeMap.toByteArray()); newNodeMap.set(bitpos, false); BitSet newDataMap = BitSet.valueOf(dataMap.toByteArray()); newDataMap.set(bitpos, true); return new Champ(newDataMap, newNodeMap, dst); }</code><technical_language>if (oldIndex >= newIndex) throw new RuntimeException("useful message")</technical_language>

Target:
private Champ copyAndMigrateFromNodeToInline(final int bitpos, final Champ node) { final int oldIndex = this.contents.length - 1 - getIndex(nodeMap, bitpos); final int newIndex = getIndex(dataMap, bitpos); final HashPrefixPayload[] src = this.contents; final HashPrefixPayload[] dst = new HashPrefixPayload[src.length]; if (oldIndex > newIndex) throw new IllegalStateException("Invalid champ!"); System.arraycopy(src, 0, dst, 0, newIndex); KeyElement[] merged = new KeyElement[node.keyCount()]; int count = 0; for (int i=0; i < node.contents.length; i++) { KeyElement[] toAdd = node.contents[i].mappings; System.arraycopy(toAdd, 0, merged, count, toAdd.length); count += toAdd.length; } Arrays.sort(merged, Comparator.comparing(x -> x.key)); dst[newIndex] = new HashPrefixPayload(merged); System.arraycopy(src, newIndex, dst, newIndex + 1, oldIndex - newIndex); System.arraycopy(src, oldIndex + 1, dst, oldIndex + 1, src.length - oldIndex - 1); BitSet newNodeMap = BitSet.valueOf(nodeMap.toByteArray()); newNodeMap.set(bitpos, false); BitSet newDataMap = BitSet.valueOf(dataMap.toByteArray()); newDataMap.set(bitpos, true); return new Champ(newDataMap, newNodeMap, dst); }
Source:
<code>public void testDefaultLoadBalancerFirstServerNotAvailable() throws Exception { KieServicesClient client = KieServicesFactory.newKieServicesClient(config); wireMockServer1.stop(); ServiceResponse<KieServerStateInfo> response = client.getServerState(); assertSuccess(response); <START> assertTrue("Response contains containers.", response.getResult().getContainers().isEmpty()); <END> }</code><technical_language>AssertJ collection, instead of plain assertTrue</technical_language>

Target:
public void testDefaultLoadBalancerFirstServerNotAvailable() throws Exception { KieServicesClient client = KieServicesFactory.newKieServicesClient(config); wireMockServer1.stop(); ServiceResponse<KieServerStateInfo> response = client.getServerState(); assertSuccess(response); Assertions.assertThat(response.getResult().getContainers()).isEmpty(); }
Source:
<code>public final synchronized BoundedSource<ResultOutputType> splitAtFraction(double fraction) { ByteKey splitKey; final ByteKeyRange range = source.getConfiguration().toByteKeyRange(); try { splitKey = range.interpolateKey(fraction); } catch (IllegalArgumentException e) { <START> READER_LOG.info("%s: Failed to interpolate key for fraction %s.", range, fraction); <END> return null; } READER_LOG.debug("Proposing to split at fraction (key {})", rangeTracker, fraction, splitKey); if (!rangeTracker.trySplitAtPosition(splitKey)) { return null; } long estimatedSizeBytes = -1; try { estimatedSizeBytes = source.getEstimatedSizeBytes(null); } catch (IOException e) { READER_LOG.info("%s: Failed to get estimated size for key for fraction %s.", range, fraction); return null; } long newEstimatedSize = (long) (fraction * estimatedSizeBytes); byte[] splitKeyBytes = splitKey.getBytes(); SourceWithKeys<ResultOutputType> residual = source.createSourceWithKeys(splitKeyBytes, source.getConfiguration().getZeroCopyStopRow(), estimatedSizeBytes - newEstimatedSize); this.source = this.source.createSourceWithKeys( source.getConfiguration().getZeroCopyStartRow(), splitKeyBytes, newEstimatedSize); return residual; }</code><technical_language>logger %s {}? is more typical in experience</technical_language>

Target:
public final synchronized BoundedSource<ResultOutputType> splitAtFraction(double fraction) { ByteKey splitKey; final ByteKeyRange range = source.getConfiguration().toByteKeyRange(); try { splitKey = range.interpolateKey(fraction); } catch (IllegalArgumentException e) { READER_LOG.info("{}: Failed to interpolate key for fraction {}.", range, fraction); return null; } READER_LOG.debug("Proposing to split at fraction (key {})", rangeTracker, fraction, splitKey); long estimatedSizeBytes = -1; try { estimatedSizeBytes = source.getEstimatedSizeBytes(null); } catch (IOException e) { READER_LOG.info("{}: Failed to get estimated size for key for fraction {}.", range, fraction); return null; } long newEstimatedSize = (long) (fraction * estimatedSizeBytes); byte[] splitKeyBytes = splitKey.getBytes(); SourceWithKeys<ResultOutputType> residual = source.createSourceWithKeys(splitKeyBytes, source.getConfiguration().getZeroCopyStopRow(), estimatedSizeBytes - newEstimatedSize); SourceWithKeys<ResultOutputType> primary = this.source.createSourceWithKeys( source.getConfiguration().getZeroCopyStartRow(), splitKeyBytes, newEstimatedSize); if (!rangeTracker.trySplitAtPosition(splitKey)) { return null; } this.source = primary; return residual; }
Source:
<code>private T getLiveValue() { for (Option option : options) { if <START> (Boolean.TRUE.equals(option.observable.getValue())) <END> return option.value; } return null; }</code><technical_language>This code simplified rely autounboxing</technical_language>

Target:
private T getLiveValue() { for (Option option : options) { if (option.observable.getValue()) return option.value; } return null; }
Source:
<code>private PostActionParameterObject getPostActionParameter(String objectId, String objectKey) { for (PostActionParameterObject postActionParameterObject : postActionParameters) { <START> if (postActionParameterObject.getObjectId().equals(objectId) && <END> postActionParameterObject.getObjectKey().equals(objectKey)) { return postActionParameterObject; } } return null; }</code><technical_language>getObjectId getObjectValue null ? if please adjust this conditions</technical_language>

Target:
private PostActionParameterObject getPostActionParameter(String objectId, String objectKey) { for (PostActionParameterObject postActionParameterObject : postActionParameters) { if (StringUtils.equals(postActionParameterObject.getObjectId(), objectId) && StringUtils.equals(postActionParameterObject.getObjectKey(), objectKey)) { return postActionParameterObject; } } return null; }
Source:
<code>TableStructureAdapter of(ObjList<CharSequence> names, ObjList<TypeAdapter> types) { this.names = names; this.types = types; <START> timestampIndex = names.indexOf(timestampIndexCol); <END> return this; }</code><technical_language>name & type check done here, is example: java TableStructureAdapter of(ObjList<CharSequence> names, ObjList<TypeAdapter> types) throws TextException { this.names = names; this.types = types; if (timestampIndexCol == null) { timestampIndex = -1; } else { timestampIndex = names.indexOf(timestampIndexCol); if (timestampIndex == -1) { throw TextException.$("invalid timestamp column '").put(timestampIndexCol).put('\''); } if (types.getQuick(timestampIndex).getType() != ColumnType.TIMESTAMP) { throw TextException.$("not a timestamp '").put(timestampIndexCol).put('\''); } } return this; }</technical_language>

Target:
TableStructureAdapter of(ObjList<CharSequence> names, ObjList<TypeAdapter> types) throws TextException { this.names = names; this.types = types; if (timestampIndexCol == null) { timestampIndex = -1; } else { timestampIndex = names.indexOf(timestampIndexCol); if (timestampIndex == -1) { throw TextException.$("invalid timestamp column '").put(timestampIndexCol).put('\''); } if (types.getQuick(timestampIndex).getType() != ColumnType.TIMESTAMP) { throw TextException.$("not a timestamp '").put(timestampIndexCol).put('\''); } } return this; }
Source:
<code>private void createDefaultPanels() { GlobalConfig globalConfig = new GlobalConfig(); PanelInfo test1 = new PanelInfo(); PanelInfo test2 = new PanelInfo(); PanelInfo test3 = new PanelInfo(); List<PanelInfo> panels = new ArrayList<>(); panels.add(test1); panels.add(test2); panels.add(test3); globalConfig.setPanelInfo(panels); <START> ConfigFile globalConfigFile = <END> new ConfigFile(Preferences.DIRECTORY, Preferences.TEST_SESSION_CONFIG_FILENAME); globalConfigFile.saveConfig(globalConfig); }</code><technical_language>change variable names in tests globalConfigFile sessionConfigFile? For consistency</technical_language>

Target:
private void createDefaultPanels() { Preferences prefs = TestController.createTestPreferences(); PanelInfo test1 = new PanelInfo(); PanelInfo test2 = new PanelInfo(); PanelInfo test3 = new PanelInfo(); List<PanelInfo> panels = new ArrayList<>(); panels.add(test1); panels.add(test2); panels.add(test3); prefs.setPanelInfo(panels); }
Source:
<code>public void handleRequirement(String rowValue, RoughArtifact roughArtifact) { StringBuffer imageFileList = new StringBuffer(""); <START> getImageList(rowValue, imageFileList); <END> rowValue = normalizeHtml(rowValue); String imageFile = imageFileList.toString(); if (!imageFile.isEmpty()) { String theImage; int comma = 0; int imageNumber = 0; do { String replaceName = ""; comma = imageFile.indexOf(','); if (comma == -1) { theImage = uriDirectoryName + imageFile; replaceName = imageFile; imageFile = " "; } else { theImage = uriDirectoryName + imageFile.substring(0, comma); replaceName = imageFile.substring(0, comma); imageFile = imageFile.substring(comma + 1); } try { URI imageURI = new URI(theImage); roughArtifact.addAttribute(CoreAttributeTypes.ImageContent.getName(), imageURI); rowValue = rowValue.replace(replaceName, IMAGE_BASE_NAME + Integer.toString(imageNumber)); imageNumber++; postProcessGuids.add(roughArtifact.getGuid()); } catch (URISyntaxException e) { e.printStackTrace(); } } while (comma != -1); } if (Strings.isValid(rowValue)) { roughArtifact.addAttribute(CoreAttributeTypes.HTMLContent, rowValue); } }</code><technical_language>get assignment weird this method rename appendImageList writeImageList</technical_language>

Target:
public void handleRequirement(String rowValue, RoughArtifact roughArtifact) { StringBuffer imageFileList = new StringBuffer(""); appendToImageList(rowValue, imageFileList); rowValue = normalizeHtml(rowValue); String imageFile = imageFileList.toString(); if (!imageFile.isEmpty()) { String theImage; int comma = 0; int imageNumber = 0; do { String replaceName = ""; comma = imageFile.indexOf(','); if (comma == -1) { theImage = uriDirectoryName + imageFile; replaceName = imageFile; imageFile = " "; } else { theImage = uriDirectoryName + imageFile.substring(0, comma); replaceName = imageFile.substring(0, comma); imageFile = imageFile.substring(comma + 1); } try { URI imageURI = new URI(theImage); roughArtifact.addAttribute(CoreAttributeTypes.ImageContent.getName(), imageURI); rowValue = rowValue.replace(replaceName, IMAGE_BASE_NAME + Integer.toString(imageNumber)); imageNumber++; postProcessGuids.add(roughArtifact.getGuid()); } catch (URISyntaxException e) { if (logger != null) { logger.log(e); } } } while (comma != -1); } if (Strings.isValid(rowValue)) { roughArtifact.addAttribute(CoreAttributeTypes.HTMLContent, rowValue); } }
Source:
<code>private Iterable<SAMRecord> getSortedRecordsFromReader(final SamReader reader) { if (reader.getFileHeader().getSortOrder() == SAMFileHeader.SortOrder.queryname) { return reader; } log.info("Input file isn't queryname sorted. Sorting into temp space."); <START> final Path[] tmpPaths = TMP_DIR.stream() <END> .map(File::toPath) .toArray(Path[]::new); final ProgressLogger sortProgress = new ProgressLogger(log, (int) 1e6, "Read into sorter"); final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(reader.getFileHeader()), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM, tmpPaths); for (final SAMRecord rec : reader) { alignmentSorter.add(rec); sortProgress.record(rec); } return alignmentSorter; }</code><technical_language>If this is done in more CLP, sense move CommandLineProgram. (Also, is odd File is deprecated in SortingCollection in SortingLongCollection)</technical_language>

Target:
private Iterator<SAMRecord> getSortedRecordsFromReader(final SamReader reader) { if (reader.getFileHeader().getSortOrder() == SAMFileHeader.SortOrder.queryname) { return reader.iterator(); } log.info("Input file isn't queryname sorted. Sorting into temp space."); final ProgressLogger sortProgress = new ProgressLogger(log, (int) 1e6, "Read into sorter"); final SortingCollection<SAMRecord> alignmentSorter = SortingCollection.newInstance(SAMRecord.class, new BAMRecordCodec(reader.getFileHeader()), new SAMRecordQueryNameComparator(), MAX_RECORDS_IN_RAM); for (final SAMRecord rec : reader) { alignmentSorter.add(rec); sortProgress.record(rec); } final CloseableIterator<SAMRecord> iterator = alignmentSorter.iterator(); alignmentSorter.cleanup(); return iterator; }
Source:
<code>public void withdrawPatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); <START> ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", "true"); <END> ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); String tokenAdmin = getAuthToken(eperson.getEmail(), password); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(false))) .andExpect(jsonPath("$.inArchive", Matchers.is(true))); }</code><technical_language>official true instead "true"</technical_language>

Target:
public void withdrawPatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", true); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); String tokenAdmin = getAuthToken(eperson.getEmail(), password); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(false))) .andExpect(jsonPath("$.inArchive", Matchers.is(true))); }
Source:
<code>public void testMixClass() throws Exception { final Injector injector = Guice.createInjector( <START> new AbstractModule() { <END> @Override protected void configure() }); final MixClass i1 = injector.getInstance(MixClass.class); final MixClass i2 = injector.getInstance(MixClass.class); assertSame(i1, i2); }</code><technical_language>call Injector injector = Guice.createInjector(); module for value</technical_language>

Target:
public void testMixClass() { final Injector injector = Guice.createInjector(); final MixClass i1 = injector.getInstance(MixClass.class); final MixClass i2 = injector.getInstance(MixClass.class); assertSame(i1, i2); }
Source:
<code>protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } <START> } else if (UIEvents.UILifeCycle.BUSY.equals(attName)) { <END> updateBusyIndicator(cti, part, (Boolean) newValue); } }</code><technical_language>a model tag, initialize EventHandler in org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.init() method</technical_language>

Target:
protected void updateTab(CTabItem cti, MPart part, String attName, Object newValue) { if (UIEvents.UILabel.LABEL.equals(attName)) { String newName = (String) newValue; cti.setText(getLabel(part, newName)); } else if (UIEvents.UILabel.ICONURI.equals(attName)) { cti.setImage(getImage(part)); } else if (UIEvents.UILabel.TOOLTIP.equals(attName)) { String newTTip = (String) newValue; cti.setToolTipText(newTTip); } else if (UIEvents.Dirtyable.DIRTY.equals(attName)) { Boolean dirtyState = (Boolean) newValue; String text = cti.getText(); boolean hasAsterisk = text.length() > 0 && text.charAt(0) == '*'; if (dirtyState.booleanValue()) { if (!hasAsterisk) { cti.setText('*' + text); } } else if (hasAsterisk) { cti.setText(text.substring(1)); } } else if (UIEvents.UILifeCycle.BUSY.equals(attName)) { setCSSInfo(part, cti); reapplyStyles(cti); } }
Source:
<code>private boolean lockRoot(DecisionMaker<? super V> decisionMaker, RootReference rootReference, int attempt, int contention) { boolean success = lockRoot(rootReference); if (!success) { decisionMaker.reset(); if(attempt > 4) { if (attempt <= 24) { Thread.yield(); } else { try { Thread.sleep(0, 100 / contention + 50); <START> } catch (InterruptedException ignore) { } <END> } } } return success; }</code><technical_language>this throw close store throw a RuntimeException, is kill</technical_language>

Target:
private boolean lockRoot(DecisionMaker<? super V> decisionMaker, RootReference rootReference, int attempt, int contention) { boolean success = lockRoot(rootReference); if (!success) { decisionMaker.reset(); if(attempt > 4) { if (attempt <= 24) { Thread.yield(); } else { try { Thread.sleep(0, 100 / contention + 50); } catch (InterruptedException ex) { throw new RuntimeException(ex); } } } } return success; }
Source:
<code>public Map<Integer, GermplasmPedigreeTreeNode> getDirectParentsForStudy(final int studyId) { final GermplasmDAO dao = this.getGermplasmDao(); final Map<Integer, Map<GermplasmNameType, Name>> namesMap = dao.getGermplasmParentNamesForStudy(studyId); final List<Germplasm> germs = dao.getGermplasmParentsForStudy(studyId); final Map<Integer, GermplasmPedigreeTreeNode> germNodes = new HashMap<>(); for (final Germplasm germ : germs) { final GermplasmPedigreeTreeNode root = new GermplasmPedigreeTreeNode(); root.setGermplasm(germ); final List<GermplasmPedigreeTreeNode> parents = new ArrayList<>(); Map<GermplasmNameType, Name> names = namesMap.get(germ.getGpid1()); final GermplasmPedigreeTreeNode femaleNode = createGermplasmPedigreeTreeNode(germ.getGpid1(), names); names = namesMap.get(germ.getGpid2()); final GermplasmPedigreeTreeNode maleNode = createGermplasmPedigreeTreeNode(germ.getGpid2(), names); <START> parents.add(femaleNode); <END> parents.add(maleNode); root.setLinkedNodes(parents); germNodes.put(germ.getGid(), root); } return germNodes; }</code><technical_language>end potentially adding null values a list. This happen. Please check add null values</technical_language>

Target:
public Map<Integer, GermplasmPedigreeTreeNode> getDirectParentsForStudy(final int studyId) { final GermplasmDAO dao = this.getGermplasmDao(); final Map<Integer, Map<GermplasmNameType, Name>> namesMap = dao.getGermplasmParentNamesForStudy(studyId); final List<Germplasm> germs = dao.getGermplasmParentsForStudy(studyId); final Map<Integer, GermplasmPedigreeTreeNode> germNodes = new HashMap<>(); for (final Germplasm germ : germs) { final GermplasmPedigreeTreeNode root = new GermplasmPedigreeTreeNode(); root.setGermplasm(germ); Map<GermplasmNameType, Name> names = namesMap.get(germ.getGpid1()); final GermplasmPedigreeTreeNode femaleNode = createGermplasmPedigreeTreeNode(germ.getGpid1(), names); names = namesMap.get(germ.getGpid2()); final GermplasmPedigreeTreeNode maleNode = createGermplasmPedigreeTreeNode(germ.getGpid2(), names); root.setFemaleParent(femaleNode); root.setMaleParent(maleNode); if (femaleNode != null) { root.getLinkedNodes().add(femaleNode); } if (maleNode != null) { root.getLinkedNodes().add(maleNode); } germNodes.put(germ.getGid(), root); } return germNodes; }
Source:
<code>private void lookupRenderers(String defaultUUID) { Collection<SyncBeanDef<RendererLibrary>> beanDefs = beanManager.lookupBeans(RendererLibrary.class); if (defaultUUID != null && ! defaultUUID.isEmpty()) { beanDefs.stream() .map(SyncBeanDef::getInstance) .filter(render -> render.getUUID().equals(defaultUUID)) .findFirst().ifPresent(rend -> rend.getSupportedTypes().forEach(c -> renderersDefault.put(c, rend)) ); <START> } <END> for (SyncBeanDef<RendererLibrary> beanDef : beanDefs) { RendererLibrary lib = beanDef.getInstance(); renderersList.add(lib); for (DisplayerType displayerType : DisplayerType.values()) { if (lib.isDefault(displayerType)) { renderersDefault.putIfAbsent(displayerType, lib); } } List<DisplayerType> types = lib.getSupportedTypes(); if (types != null && !types.isEmpty()) { for (DisplayerType type : types) { List<RendererLibrary> set = renderersByType.get(type); if (set == null) { set = new ArrayList<>(); renderersByType.put(type, set); } set.add(lib); List<DisplayerSubType> subTypes = lib.getSupportedSubtypes(type); if (subTypes != null && !subTypes.isEmpty()) { for (DisplayerSubType subType : subTypes) { List<RendererLibrary> subset = renderersBySubType.get(subType); if (subset == null) { subset = new ArrayList<>(); renderersBySubType.put(subType, subset); } subset.add(lib); } } } } } }</code><technical_language>wondering happen if of renderers uuid matching user-selected default? E.g. user sets -Dorg.dashbuilder.renderer.default=nonexistentUUID? scenario is ok, code.</technical_language>

Target:
protected void lookupRenderers(String defaultUUID) { Collection<SyncBeanDef<RendererLibrary>> beanDefs = beanManager.lookupBeans(RendererLibrary.class); if (defaultUUID != null && ! defaultUUID.isEmpty()) { beanDefs.stream() .map(SyncBeanDef::getInstance) .filter(render -> render.getUUID().equals(defaultUUID)) .findFirst().ifPresent(rend -> rend.getSupportedTypes().forEach(c -> renderersDefault.put(c, rend)) ); } for (SyncBeanDef<RendererLibrary> beanDef : beanDefs) { RendererLibrary lib = beanDef.getInstance(); renderersList.add(lib); for (DisplayerType displayerType : DisplayerType.values()) { if (lib.isDefault(displayerType)) { renderersDefault.putIfAbsent(displayerType, lib); } } List<DisplayerType> types = lib.getSupportedTypes(); if (types != null && !types.isEmpty()) { for (DisplayerType type : types) { List<RendererLibrary> set = renderersByType.get(type); if (set == null) { set = new ArrayList<>(); renderersByType.put(type, set); } set.add(lib); List<DisplayerSubType> subTypes = lib.getSupportedSubtypes(type); if (subTypes != null && !subTypes.isEmpty()) { for (DisplayerSubType subType : subTypes) { List<RendererLibrary> subset = renderersBySubType.get(subType); if (subset == null) { subset = new ArrayList<>(); renderersBySubType.put(subType, subset); } subset.add(lib); } } } } } }
Source:
<code>private void addOsTypes(VersionCaps version) { version.setOsTypes(new OsTypes()); <START> version.getOsTypes().getOsTypes().addAll(OsTypeUtils.getAllValues()); <END> }</code><technical_language>this addOsTypes() method called in versions of /capabilities resource, creating differentiation older versions VERSION_3_3 new OSs supported</technical_language>

Target:
private void addOsTypes(VersionCaps version) { version.setOsTypes(new OsTypes()); if (VersionUtils.greaterOrEqual(version, VERSION_3_3)) { version.getOsTypes().getOsTypes().addAll(OsTypeUtils.getAllValues()); } else { for (OsType type : OsType.values()) { version.getOsTypes().getOsTypes().add(type.name()); } } }
Source:
<code>private IMember[] getMembersToDelete(final IProgressMonitor monitor) throws JavaModelException { try { final IMember[] typesToDelete= getMembers(fMembersToMove, IJavaElement.TYPE); final IMember[] matchingElements= getMatchingElements(monitor, false); final IMember[] matchingFields= getMembers(matchingElements, IJavaElement.FIELD); List<IMember> toDelete= new ArrayList<>(); IMember[] all= JavaElementUtil.merge(matchingFields, typesToDelete); <START> for(IMember member : all) { for(IMember moveMember : fMembersToMove) { if(member.equals(moveMember)) { toDelete.add(moveMember); } } } <END> return JavaElementUtil.merge(toDelete.toArray(new IMember[0]), fDeletedMethods); } finally { monitor.done(); } }</code><technical_language>considered : toDelete.addAll(Arrays.asList(fMembersToMove)); toDelete.retainAll(Arrays.asList(all)); retainAll() elements in a collection (toDelete) present in list passed in argument (all)</technical_language>

Target:
private IMember[] getMembersToDelete(final IProgressMonitor monitor) throws JavaModelException { try { final IMember[] typesToDelete= getMembers(fMembersToMove, IJavaElement.TYPE); final IMember[] matchingElements= getMatchingElements(monitor, false); final IMember[] matchingFields= getMembers(matchingElements, IJavaElement.FIELD); List<IMember> toDelete= new ArrayList<>(); IMember[] all= JavaElementUtil.merge(matchingFields, typesToDelete); toDelete.addAll(Arrays.asList(fMembersToMove)); toDelete.retainAll(Arrays.asList(all)); return JavaElementUtil.merge(toDelete.toArray(new IMember[0]), fDeletedMethods); } finally { monitor.done(); } }
Source:
<code>private void addNetworkSecurityGroup() { int ports[] = options.getInboundPorts(); if ((ports != null) && (ports.length > 0)) { variables.put("networkSecurityGroupName", name + "nsg"); variables.put("networkSecurityGroupNameReference", "[resourceId('Microsoft.Network/networkSecurityGroups',variables('networkSecurityGroupName'))]"); List<NetworkSecurityRule> rules = new ArrayList<NetworkSecurityRule>(); for (int i = 0; i < ports.length; i++) { NetworkSecurityRuleProperties ruleProperties = NetworkSecurityRuleProperties.builder() .description("default-allow-port-" + ports[i]) .protocol(NetworkSecurityRuleProperties.Protocol.All) .access(NetworkSecurityRuleProperties.Access.Allow) .sourcePortRange("*") .destinationPortRange("*") .sourceAddressPrefix("*") .destinationAddressPrefix("*") .priority(1234 + i) .direction(NetworkSecurityRuleProperties.Direction.Inbound) .build(); NetworkSecurityRule networkSecurityRule = NetworkSecurityRule.create( "default-allow-port-" + ports[i], null, null, <START> ruleProperties); <END> rules.add(networkSecurityRule); } NetworkSecurityGroupProperties networkSecurityGroupProperties = NetworkSecurityGroupProperties.builder() .securityRules(rules) .build(); ResourceDefinition networkSecurityGroup = ResourceDefinition.builder() .name("[variables('networkSecurityGroupName')]") .type("Microsoft.Network/networkSecurityGroups").location(location) .apiVersion(STORAGE_API_VERSION) .properties(networkSecurityGroupProperties) .build(); resources.add(networkSecurityGroup); } }</code><technical_language>Hmmm do set port opened</technical_language>

Target:
private void addNetworkSecurityGroup() { int ports[] = options.getInboundPorts(); if ((ports != null) && (ports.length > 0)) { variables.put("networkSecurityGroupName", name + "nsg"); variables.put("networkSecurityGroupNameReference", "[resourceId('Microsoft.Network/networkSecurityGroups',variables('networkSecurityGroupName'))]"); List<NetworkSecurityRule> rules = new ArrayList<NetworkSecurityRule>(); for (int i = 0; i < ports.length; i++) { NetworkSecurityRuleProperties ruleProperties = NetworkSecurityRuleProperties.builder() .description("default-allow-port-" + ports[i]) .protocol(NetworkSecurityRuleProperties.Protocol.All) .access(NetworkSecurityRuleProperties.Access.Allow) .sourcePortRange("*") .destinationPortRange(Integer.toString(ports[i])) .sourceAddressPrefix("*") .destinationAddressPrefix("*") .priority(1234 + i) .direction(NetworkSecurityRuleProperties.Direction.Inbound) .build(); NetworkSecurityRule networkSecurityRule = NetworkSecurityRule.create( "default-allow-port-" + ports[i], null, null, ruleProperties); rules.add(networkSecurityRule); } NetworkSecurityGroupProperties networkSecurityGroupProperties = NetworkSecurityGroupProperties.builder() .securityRules(rules) .build(); ResourceDefinition networkSecurityGroup = ResourceDefinition.builder() .name("[variables('networkSecurityGroupName')]") .type("Microsoft.Network/networkSecurityGroups").location(location) .apiVersion(STORAGE_API_VERSION) .properties(networkSecurityGroupProperties) .build(); resources.add(networkSecurityGroup); } }
Source:
<code>private long heartbeatTimeoutPeriod() { <START> return heartbeatInterval + heartbeatInterval / 5; <END> }</code><technical_language>20% range from? more clear if is a constant percentage initialized in TNatsServiceTransport() other parameters heartbeats</technical_language>

Target:
private long heartbeatTimeoutPeriod() { return heartbeatInterval + HEARTBEAT_GRACE_PERIOD; }
Source:
<code>public <T> LinkedHashSet<T> loadJavaServices(Class<T> serviceContract) { <START> LinkedHashSet<T> services = new LinkedHashSet<T>( hibernateClassLoaderService.loadJavaServices( serviceContract ) ); <END> if ( services.size() == 0 ) { services = internalClassLoaderService.loadJavaServices( serviceContract ); } return services; }</code><technical_language>If for approach ORM + ClassLoaderService implementation, I this method needs change. is enough check loadJavaServices returns results. need call loadJavaServices methods de-duplicate results. A bit of a pita. +1 > I tempted say, check in of methods internalClassLoaderService first. wondering if - in case loading internal extension/service allow override, CLService parent classloaderservice. In case want lookup in both, correct for external overrides first</technical_language>

Target:
public <T> LinkedHashSet<T> loadJavaServices(Class<T> serviceContract) { LinkedHashSet<T> servicesFromORMCLassLoader = new LinkedHashSet<T>( hibernateClassLoaderService.loadJavaServices( serviceContract ) ); LinkedHashSet<T> services = new LinkedHashSet<T>( internalClassLoaderService.loadJavaServices( serviceContract ) ); for ( T serviceInstance : servicesFromORMCLassLoader ) { if ( !contains( services, serviceInstance ) ) { services.add( serviceInstance ); } } return services; }
Source:
<code><START> public InFormExpressionCacher expressionCacher() { <END> return expressionCacher; }</code><technical_language>Super nitpicky, "InForm" feels awkward for this based v. "MainInstance" (IE: rooted '/'), vocabulary is generally referred in EvaluationContext</technical_language>

Target:
public ExpressionCacher expressionCacher() { return expressionCacher; }
Source:
<code><START> public void setInBatchMode(boolean inBatchMode) <END> { this.inBatchMode = inBatchMode; }</code><technical_language>this exposed public setter</technical_language>

Target:
protected void setInBatchMode(boolean inBatchMode) { this.inBatchMode = inBatchMode; }
Source:
<code>public void testPushForMasterWithHashtags() throws GitAPIException, OrmException, IOException, RestApiException { <START> if (!notesMigration.enabled()) { return; } <END> String hashtag1 = "tag1"; List<String> expected = Arrays.asList(hashtag1); PushOneCommit.Result r = pushTo("refs/for/master%hashtag=" + hashtag1); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); String changeId = r.getChangeId(); RestResponse response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); String hashtag2 = "tag2"; expected = Arrays.asList(hashtag1, hashtag2); r = pushTo("refs/for/master%hashtag=" + hashtag1 + ",hashtag=" + hashtag2); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); changeId = r.getChangeId(); response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); }</code><technical_language>JUnit skip some test methods unit tests (compared ignore tests. in case Assume is in @Before method, ins case test methods skipped) is Assume in method (that introduced year in GWTORM): assumeThat(notesMigration.enabled(), is(true())); // normal test code follow assumption is met, tests is executed test is skipped. question is: Buck support it</technical_language>

Target:
public void testPushForMasterWithHashtags() throws GitAPIException, OrmException, IOException, RestApiException { assumeThat(notesMigration.enabled(), is(true)); String hashtag1 = "tag1"; List<String> expected = Arrays.asList(hashtag1); PushOneCommit.Result r = pushTo("refs/for/master%hashtag=" + hashtag1); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); String changeId = r.getChangeId(); RestResponse response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); String hashtag2 = "tag2"; expected = Arrays.asList(hashtag1, hashtag2); r = pushTo("refs/for/master%hashtag=" + hashtag1 + ",hashtag=" + hashtag2); r.assertOkStatus(); r.assertChange(Change.Status.NEW, null); changeId = r.getChangeId(); response = adminSession.get("/changes/" + changeId + "/hashtags/"); assertResultList(response, expected); }
Source:
<code>public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { ArrayList<String> roles; boolean haveAccess = false; <START> haveAccess = wsSecurityManager.checkIsWorkspaceAssociated(userName); <END> if (!haveAccess) { if (userRoles.length > 0) { roles = getAccessRoleList(userRoles); for (String role : roles) { haveAccess = wsSecurityManager.chkIsCollaboratorWorkspaceAssociated(userName, role); if (haveAccess) break; } } } return haveAccess; }</code><technical_language>defined</technical_language>

Target:
public boolean chkAuthorizationByRole(String userName, String[] userRoles) throws QuadrigaStorageException, QuadrigaAccessException { if (wsSecurityManager.checkIsWorkspaceAssociated(userName)) { return true; } else { if (userRoles.length > 0) { List<String> roles = Arrays.asList(userRoles); for (String role : roles) { if (wsSecurityManager.chkIsCollaboratorWorkspaceAssociated(userName, role)) { return true; } } } } return false; }
Source:
<code>public void testSearchWithNullValueInDimension() throws Exception { IncrementalIndex<Aggregator> index = new OnheapIncrementalIndex.Builder() .setIncrementalIndexSchema( new IncrementalIndexSchema.Builder() .withQueryGranularity(Granularities.NONE) .withMinTimestamp(new DateTime("2011-01-12T00:00:00.000Z").getMillis()) .build() ) <START> .setReportParseExceptions(true) <END> .setMaxRowCount(10) .build(); index.add( new MapBasedInputRow( 1481871600000L, Arrays.asList("name", "host"), ImmutableMap.<String, Object>of("name", "name1", "host", "host") ) ); index.add( new MapBasedInputRow( 1481871670000L, Arrays.asList("name", "table"), ImmutableMap.<String, Object>of("name", "name2", "table", "table") ) ); SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new DefaultDimensionSpec("table", "table") ) .dataSource(QueryRunnerTestHelper.dataSource) .granularity(QueryRunnerTestHelper.allGran) .intervals(QueryRunnerTestHelper.fullOnInterval) .context(ImmutableMap.<String, Object>of("searchStrategy", "cursorOnly")) .build(); QueryRunnerFactory factory = new SearchQueryRunnerFactory( selector, toolChest, QueryRunnerTestHelper.NOOP_QUERYWATCHER ); QueryRunner runner = factory.createRunner(new QueryableIndexSegment("asdf", TestIndex.persistRealtimeAndLoadMMapped(index))); List<SearchHit> expectedHits = Lists.newLinkedList(); expectedHits.add(new SearchHit("table", "table", 1)); expectedHits.add(new SearchHit("table", "", 1)); checkSearchQuery(searchQuery, runner, expectedHits); }</code><technical_language>ReportParseExceptions is true default</technical_language>

Target:
public void testSearchWithNullValueInDimension() throws Exception { IncrementalIndex<Aggregator> index = new IncrementalIndex.Builder() .setIndexSchema( new IncrementalIndexSchema.Builder() .withMinTimestamp(new DateTime("2011-01-12T00:00:00.000Z").getMillis()) .build() ) .setMaxRowCount(10) .buildOnheap(); index.add( new MapBasedInputRow( 1481871600000L, Arrays.asList("name", "host"), ImmutableMap.<String, Object>of("name", "name1", "host", "host") ) ); index.add( new MapBasedInputRow( 1481871670000L, Arrays.asList("name", "table"), ImmutableMap.<String, Object>of("name", "name2", "table", "table") ) ); SearchQuery searchQuery = Druids.newSearchQueryBuilder() .dimensions( new DefaultDimensionSpec("table", "table") ) .dataSource(QueryRunnerTestHelper.dataSource) .granularity(QueryRunnerTestHelper.allGran) .intervals(QueryRunnerTestHelper.fullOnInterval) .context(ImmutableMap.<String, Object>of("searchStrategy", "cursorOnly")) .build(); QueryRunnerFactory factory = new SearchQueryRunnerFactory( selector, toolChest, QueryRunnerTestHelper.NOOP_QUERYWATCHER ); QueryRunner runner = factory.createRunner(new QueryableIndexSegment("asdf", TestIndex.persistRealtimeAndLoadMMapped(index))); List<SearchHit> expectedHits = Lists.newLinkedList(); expectedHits.add(new SearchHit("table", "table", 1)); expectedHits.add(new SearchHit("table", "", 1)); checkSearchQuery(searchQuery, runner, expectedHits); }