auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void visit(GranuleDescriptor granuleDescriptor, SimpleFeature sf) { final Geometry bb = JTS.toGeometry((BoundingBox) mosaicBBox); Geometry inclusionGeometry = granuleDescriptor.getFootprint(); boolean intersects = false; if (inclusionGeometry != null) { CoordinateReferenceSystem granuleCRS = granuleDescriptor.getGranuleEnvelope().getCoordinateReferenceSystem(); CoordinateReferenceSystem mosaicCRS = mosaicBBox.getCoordinateReferenceSystem(); try { if(!CRS.equalsIgnoreMetadata(granuleCRS, mosaicCRS)) { MathTransform mt = CRS.findMathTransform(granuleCRS, mosaicCRS); inclusionGeometry = JTS.transform(inclusionGeometry, mt); } } catch (FactoryException | MismatchedDimensionException | TransformException e) { intersects = true; } <START> intersects = inclusionGeometry.intersects(bb); <END> } if (!footprintBehavior.handleFootprints() || inclusionGeometry == null || (footprintBehavior.handleFootprints() && intersects)) { boolean found = false; for (SubmosaicProducer submosaicProducer : granuleCollectors) { if (submosaicProducer.accept(granuleDescriptor)) { granulesNumber++; found = true; break; } } if (!found && getExcessGranuleRemover() == null) { throw new IllegalStateException("Unable to locate a filter for this granule:\n" + granuleDescriptor.toString()); } } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("We rejected for non ROI inclusion the granule " + granuleDescriptor.toString()); } } }</code><technical_language>move line 339 333 (after IF's closing bracket right catch)? intersects=true line 336 overridden intersects operation line 339 (which involve geometry's CRS right?)</technical_language>

Target:
public void visit(GranuleDescriptor granuleDescriptor, SimpleFeature sf) { final Geometry bb = JTS.toGeometry((BoundingBox) mosaicBBox); Geometry inclusionGeometry = granuleDescriptor.getFootprint(); boolean intersects = false; if (inclusionGeometry != null) { CoordinateReferenceSystem granuleCRS = granuleDescriptor.getGranuleEnvelope().getCoordinateReferenceSystem(); CoordinateReferenceSystem mosaicCRS = mosaicBBox.getCoordinateReferenceSystem(); try { if(!CRS.equalsIgnoreMetadata(granuleCRS, mosaicCRS)) { MathTransform mt = CRS.findMathTransform(granuleCRS, mosaicCRS); inclusionGeometry = JTS.transform(inclusionGeometry, mt); } intersects = inclusionGeometry.intersects(bb); } catch (FactoryException | MismatchedDimensionException | TransformException e) { intersects = true; } } if (!footprintBehavior.handleFootprints() || inclusionGeometry == null || (footprintBehavior.handleFootprints() && intersects)) { boolean found = false; for (SubmosaicProducer submosaicProducer : granuleCollectors) { if (submosaicProducer.accept(granuleDescriptor)) { granulesNumber++; found = true; break; } } if (!found && getExcessGranuleRemover() == null) { throw new IllegalStateException("Unable to locate a filter for this granule:\n" + granuleDescriptor.toString()); } } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("We rejected for non ROI inclusion the granule " + granuleDescriptor.toString()); } } }
Source:
<code>private AuditLogableBase createAuditLog(final VmNic iface) { AuditLogableBase logable = new AuditLogableBase(); <START> logable.setVmId(iface.getVmId()); <END> logable.addCustomValue("MACAddr", iface.getMacAddress()); logable.addCustomValue("IfaceName", iface.getName()); return logable; }</code><technical_language>Is longer a need for VM ID</technical_language>

Target:
private AuditLogableBase createAuditLog(final VmNic iface) { AuditLogableBase logable = new AuditLogableBase(); logable.addCustomValue("MACAddr", iface.getMacAddress()); logable.addCustomValue("IfaceName", iface.getName()); return logable; }
Source:
<code>public Translation getTranslation() { <START> return new SpongeTranslation("itemGroup." + this.tabLabel); <END> }</code><technical_language>Translations lazy loaded</technical_language>

Target:
public Translation getTranslation() { if (this.translation == null) { this.translation = new SpongeTranslation("itemGroup." + this.tabLabel); } return this.translation; }
Source:
<code>private void writeObject(Schema schema, GenericRecord datum) throws Exception { <START> BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(new ByteArrayOutputStream(5), null); <END> GenericDatumWriter<GenericData.Record> writter = new GenericDatumWriter<GenericData.Record>(schema); writter.write(schema, datum, encoder); }</code><technical_language>5? default a good reason to</technical_language>

Target:
private void writeObject(Schema schema, GenericRecord datum) throws Exception { BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(new ByteArrayOutputStream(), null); GenericDatumWriter<GenericData.Record> writer = new GenericDatumWriter<GenericData.Record>(schema); writer.write(schema, datum, encoder); }
Source:
<code>public void init() { if (campaign != null) { tvTitle.setText(campaign.getTitle()); tvDescription.setText(campaign.getDescription()); <START> SimpleDateFormat inputDateFormat = new SimpleDateFormat("yyyy-MM-dd", <END> Locale.getDefault()); SimpleDateFormat outputDateFormat = new SimpleDateFormat("dd MMM", Locale.getDefault()); try { Date startDate = inputDateFormat.parse(campaign.getStartDate()); Date endDate = inputDateFormat.parse(campaign.getEndDate()); tvDates.setText(String.format("%1s - %2s", outputDateFormat.format(startDate), outputDateFormat.format(endDate))); } catch (ParseException e) { e.printStackTrace(); } } }</code><technical_language>Try dateInLocaleFormat instead</technical_language>

Target:
public void init() { if (campaign != null) { tvTitle.setText(campaign.getTitle()); tvDescription.setText(campaign.getDescription()); SimpleDateFormat inputDateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat outputDateFormat = new SimpleDateFormat("dd MMM"); try { Date startDate = inputDateFormat.parse(campaign.getStartDate()); Date endDate = inputDateFormat.parse(campaign.getEndDate()); tvDates.setText(String.format("%1s - %2s", outputDateFormat.format(startDate), outputDateFormat.format(endDate))); } catch (ParseException e) { e.printStackTrace(); } } }
Source:
<code>public static String nameFromCppFilt(String symbol) { try { <START> return (new CPPFilt().getFunction(Objects.requireNonNull(symbol))); <END> } catch (IOException e) { Activator.logError("Error to instantiate the c++filt", e); } return symbol; }</code><technical_language>If CPPFlit().getFunction() return null I check for null. that: String functionName = new CPPFilt().getFunction(symbol); return functionName != null ? functionName : symbol;</technical_language>

Target:
public static @Nullable String nameFromCppFilt(String symbol) { try { String functionName = new CPPFilt().getFunction(symbol); return functionName != null ? functionName : symbol; } catch (IOException e) { Activator.logError("Error to instantiate the c++filt", e); return symbol; } }
Source:
<code>public void read(int length) { this.read += length; if (this.read > this.limit) { <START> throw new IllegalStateException("Readed more than " + this.limit + " bytes from NBT tag"); <END> } }</code><technical_language>Read, readed</technical_language>

Target:
public void read(int length) { this.read += length; if (this.read > this.limit) { throw new IllegalStateException("Read more than " + this.limit + " bytes from NBT tag"); } }
Source:
<code>public JettyIoPool get() { if (pool == null) { JettyIoPoolConfig config = injector.getInstance(keyFromNullable(JettyIoPoolConfig.class, annotation)); pool = new JettyIoPool(name, config); <START> if(injector.getExistingBinding(Key.get(MBeanExporter.class)) != null) <END> { injector.getInstance(MBeanExporter.class) .export(generatedNameOf(QueuedThreadPoolMBean.class) + "_" + name, new QueuedThreadPoolMBean((QueuedThreadPool) get().getExecutor())); } } return pool; }</code><technical_language>need bother unexport. else in Airlift does</technical_language>

Target:
public JettyIoPool get() { if (pool == null) { JettyIoPoolConfig config = injector.getInstance(keyFromNullable(JettyIoPoolConfig.class, annotation)); pool = new JettyIoPool(name, config); } return pool; }
Source:
<code>public void onRequestFilled(AdColonyAdView adColonyAdView) { if (_adapter != null) { <START> _adapter.setAdView(adColonyAdView); <END> notifyAdLoaded(); } }</code><technical_language>setAdView(adColonyAdView) is required here, I setAdView() removed other places ? of interstitial AdListener too</technical_language>

Target:
public void onRequestFilled(AdColonyAdView adColonyAdView) { if (_adapter != null) { _adapter.setAdView(adColonyAdView); _mediationBannerListener.onAdLoaded(_adapter); } }
Source:
<code>public void preRenderProcess(Request request, Response response, RendererEditorState<?> state) { super.preRenderProcess(request,response,state); <START> if (!request.isPartial() && isInited()) <END> EventQueue.queue(new EventQueueElement() { @Override public void fire() { _id=request.getParameter("id"); _setupUI(); } @Override public int getEventPriority() { return 0; } }); }</code><technical_language>check isInited() here. this UI load time visits page this component is on</technical_language>

Target:
public void preRenderProcess(Request request, Response response, RendererEditorState<?> state) { super.preRenderProcess(request,response,state); if (!request.isPartial()) EventQueue.queue(new EventQueueElement() { @Override public void fire() { _slug=request.getParameter("slug"); _setupUI(); } @Override public int getEventPriority() { return 0; } }); }
Source:
<code>public void close() { for (FileObject file : Arrays.asList(this.files)) { <START> monitor.removeFile(file); <END> } executor.shutdownNow(); monitor.stop(); }</code><technical_language>Interesting fix. explain this prevents RuntimeException? Is upgrade 2.3 needed for this change</technical_language>

Target:
public void close() { forEachCatchRTEs(Stream.of(files), o -> { removeFile(o); log.debug("Removing file from monitoring {}", o); }); executor.shutdownNow(); monitor.stop(); }
Source:
<code>private static List<CopyArtifact> getCopiers(AbstractProject<?,?> project) throws IOException { <START> List<CopyArtifact> copiers = CopyArtifact.getCopiers(project); <END> for (CopyArtifact copier : copiers) { copier.upgradeIfNecessary(project); } return copiers; }</code><technical_language>sense, reduce confusion wise pick names for methods</technical_language>

Target:
private static List<CopyArtifact> getCopiers(AbstractProject<?,?> project) throws IOException { List<CopyArtifact> copiers = CopyArtifact.getCopyArtifactsInProject(project); for (CopyArtifact copier : copiers) { copier.upgradeIfNecessary(project); } return copiers; }
Source:
<code>public void testIllegalPackagesAndClassesRegularExpression() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IllegalImportCheck.class); <START> checkConfig.addAttribute("illegalPkgs", "^java\\.util.*"); <END> checkConfig.addAttribute("illegalClasses", "^com\\.puppycrawl\\.tools\\.checkstyle\\.Checker.*"); checkConfig.addAttribute("regexp", "true"); final String[] expected = { "12:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "13:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "16:1: " + getCheckMessage(MSG_KEY, "java.util.Enumeration"), "17:1: " + getCheckMessage(MSG_KEY, "java.util.Arrays"), "34:1: " + getCheckMessage(MSG_KEY, "java.util.Date"), "35:1: " + getCheckMessage(MSG_KEY, "java.util.Calendar"), "36:1: " + getCheckMessage(MSG_KEY, "java.util.BitSet"), "38:1: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.Checker"), "39:1: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.CheckerTest"), }; verify(checkConfig, getPath("InputIllegalImport.java"), expected); }</code><technical_language>user is required add .* a package search regular expression? Original issue example like: sun, java\.awt User need put in .*. example similar issue's show work. @romani Please confirm I right requirements</technical_language>

Target:
public void testIllegalPackagesAndClassesRegularExpression() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IllegalImportCheck.class); checkConfig.addAttribute("illegalPkgs", "java\\.util"); checkConfig.addAttribute("illegalClasses", "^com\\.puppycrawl\\.tools\\.checkstyle\\.Checker.*"); checkConfig.addAttribute("regexp", "true"); final String[] expected = { "12:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "13:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "16:1: " + getCheckMessage(MSG_KEY, "java.util.Enumeration"), "17:1: " + getCheckMessage(MSG_KEY, "java.util.Arrays"), "34:1: " + getCheckMessage(MSG_KEY, "java.util.Date"), "35:1: " + getCheckMessage(MSG_KEY, "java.util.Calendar"), "36:1: " + getCheckMessage(MSG_KEY, "java.util.BitSet"), "38:1: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.Checker"), "39:1: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.CheckerTest"), }; verify(checkConfig, getPath("InputIllegalImport.java"), expected); }
Source:
<code>public String exportVm(VM vm, FullEntityOvfData fullEntityOvfData, Version version) { updateBootOrderOnDevices(vm.getStaticData(), false); final OvfVmWriter vmWriter; if (vm.isHostedEngine()) { Cluster cluster = clusterDao.get(vm.getClusterId()); String cpuVerb = cluster.getCpuVerb(); String engineXml = null; <START> engineXml = <END> generateEngineXml(vm, cpuVerb, cluster.getEmulatedMachine()); vmWriter = new HostedEngineOvfWriter(vm, fullEntityOvfData, version, cluster.getEmulatedMachine(), cpuVerb, osRepository, engineXml); } else { vmWriter = new OvfVmWriter(vm, fullEntityOvfData, version, osRepository, getMemoryDiskForSnapshots(vm)); } return vmWriter.build().getStringRepresentation(); }</code><technical_language>This line</technical_language>

Target:
public String exportVm(VM vm, FullEntityOvfData fullEntityOvfData, Version version) { updateBootOrderOnDevices(vm.getStaticData(), false); final OvfVmWriter vmWriter; if (vm.isHostedEngine()) { Cluster cluster = clusterDao.get(vm.getClusterId()); String cpuVerb = cluster.getCpuVerb(); vmWriter = new HostedEngineOvfWriter(vm, fullEntityOvfData, version, cluster.getEmulatedMachine(), cpuVerb, osRepository, generateEngineXml(vm, cpuVerb, cluster.getEmulatedMachine())); } else { vmWriter = new OvfVmWriter(vm, fullEntityOvfData, version, osRepository, getMemoryDiskForSnapshots(vm)); } return vmWriter.build().getStringRepresentation(); }
Source:
<code>private Future<Boolean> subscribeTransactionStream() { <START> ExecutorService consumer = Executors.newSingleThreadExecutor(); <END> List<CorfuRuntime> consumerRts = new ArrayList<>(); return consumer.submit(() -> { CorfuRuntime consumerRt = CorfuRuntime.fromParameters(CorfuRuntime.CorfuRuntimeParameters .builder() .build()) .parseConfigurationString(standbyEndpoint) .connect(); consumerRts.add(consumerRt); IStreamView txStream = consumerRt.getStreamsView().get(ObjectsView.TRANSACTION_STREAM_ID); int counter = 0; while (!replicationEnded.get()) { List<ILogData> entries = txStream.remaining(); if (!entries.isEmpty()) { log.error("Transaction Log Entry Found. Entries={}", entries); counter++; } } System.out.println("Total Transaction Stream updates, count=" + counter); log.info("Total Tx Stream updates = {}", counter); return counter == 0; }); }</code><technical_language>slightly unrelated this change, do need create multiple runtimes</technical_language>

Target:
private Future<Boolean> subscribeTransactionStream() { ExecutorService consumer = Executors.newSingleThreadExecutor(); List<CorfuRuntime> consumerRts = new ArrayList<>(); return consumer.submit(() -> { CorfuRuntime consumerRt = CorfuRuntime.fromParameters(CorfuRuntime.CorfuRuntimeParameters .builder() .build()) .parseConfigurationString(standbyEndpoint) .connect(); consumerRts.add(consumerRt); IStreamView txStream = consumerRt.getStreamsView().get(ObjectsView.TRANSACTION_STREAM_ID); int counter = 0; while (!replicationEnded.get()) { List<ILogData> entries = txStream.remaining(); if (!entries.isEmpty()) { log.error("Transaction Log Entry Found. Entries={}", entries); counter++; } } System.out.println("Total Transaction Stream updates, count=" + counter); log.info("Total Tx Stream updates = {}", counter); return counter == 1; }); }
Source:
<code>public boolean hasCorrectData() { if (firstTechnology != null && secondTechnology != null) { <START> return true; <END> } return false; }</code><technical_language>simplify this</technical_language>

Target:
public boolean hasCorrectData() { return firstTechnology != null && secondTechnology != null; }
Source:
<code>public ZkBaseDataAccessor(String zkAddress, ZkSerializer zkSerializer) { _zkClient = new ZkClient.Builder() .setConnection(new ZkConnection(zkAddress, ZkClient.DEFAULT_SESSION_TIMEOUT)) <START> .setZkSerializer(zkSerializer).build(); <END> }</code><technical_language>provide public ZkBaseDataAccessor(String zkAddress) well? This default constructor ZnRecordSerializer a custom serializer is needed</technical_language>

Target:
public ZkBaseDataAccessor(String zkAddress, ZkSerializer zkSerializer) { _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), new HelixZkClient.ZkClientConfig().setZkSerializer(zkSerializer)); }
Source:
<code>private ImmutableMap<String, String> parseAttributeAndValuePairs(List<String> pairs) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); pairs .stream() .map(str -> str.split("=", 2)) .filter( (list) -> { <START> if (list.length <= 1) { <END> LOGGER.debug("Filtered out invalid attribute/value pair: {}", list[0]); return false; } return true; }) .forEach(list -> builder.put(list[0].trim(), list[1].trim())); return builder.build(); }</code><technical_language>extract this a separate method</technical_language>

Target:
private ImmutableMap<String, String> parseAttributeAndValuePairs(List<String> pairs) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); pairs .stream() .map(str -> str.split("=", 2)) .filter(AttributeAliasesImpl::isValidConfig) .forEach(list -> builder.put(list[0].trim(), list[1].trim())); return builder.build(); }
Source:
<code>Mono<Response<ConfigurationSetting>> clearReadOnly(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.unlockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnRequest(ignoredValue -> logger.info("Clearing read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Cleared read only ConfigurationSetting - {}", response.getValue())) <START> .doOnError(error -> logger.info("Failed to clear read only ConfigurationSetting - {}", setting, error)); <END> }</code><technical_language>I log levels for error request</technical_language>

Target:
Mono<Response<ConfigurationSetting>> clearReadOnly(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.unlockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnSubscribe(ignoredValue -> logger.verbose("Clearing read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Cleared read only ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to clear read only ConfigurationSetting - {}", setting, error)); }
Source:
<code>public void cancel() { try { Field field = FileWatchdog.class.getDeclaredField("interrupted"); field.setAccessible(true); field.set(this, true); } catch (ReflectiveOperationException cause) { <START> throw new Error("Cannot cancel log4j watchdog", cause); <END> } }</code><technical_language>new Error -> new RuntimeException</technical_language>

Target:
public void cancel() { try { Field field = FileWatchdog.class.getDeclaredField("interrupted"); field.setAccessible(true); field.set(this, true); } catch (ReflectiveOperationException cause) { throw new RuntimeException("Cannot cancel log4j watchdog", cause); } }
Source:
<code>public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (!(receiver instanceof IResource)) return false; IResource res = (IResource) receiver; if ("isShared".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); return mapping != null && mapping.getRepository() != null; } else if ("isSafe".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); <START> return SAFE == mapping.getRepository().getRepositoryState(); <END> } return false; }</code><technical_language>mapping null this point</technical_language>

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (!(receiver instanceof IResource)) return false; IResource res = (IResource) receiver; if ("isShared".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); return mapping != null && mapping.getRepository() != null; } else if ("isSafe".equals(property)) { RepositoryMapping mapping = RepositoryMapping.getMapping(res .getProject()); return mapping != null && SAFE == mapping.getRepository().getRepositoryState(); } return false; }
Source:
<code>public static boolean isNumber(@Nullable ASTNode t) { if (t != null) { String text = t.getText(); char firstChar = text.charAt(0); <START> if (Character.isDigit(firstChar) || '+' == firstChar || '-' == firstChar) { <END> return isInteger(text) || isFloat(text); } } return false; }</code><technical_language>Float written .025 equals 0.025</technical_language>

Target:
public static boolean isNumber(@Nullable ASTNode t) { if (t != null) { String text = t.getText(); char firstChar = text.charAt(0); if (Character.isDigit(firstChar) || '.' == firstChar || '-' == firstChar || '+' == firstChar) { return isInteger(text) || isFloat(text); } } return false; }
Source:
<code>public void returnsMethodIsNotAllowedForUnsupportedMethods() throws IOException { <START> new FtRemote(new TkMethods(new TkEmpty(), "PUT")).exec( <END> url -> new JdkRequest(url) .method("POST") .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_BAD_METHOD) ); }</code><technical_language>@victornoel RqMethod.PUT</technical_language>

Target:
public void returnsMethodIsNotAllowedForUnsupportedMethods() throws IOException { new FtRemote(new TkMethods(new TkEmpty(), RqMethod.PUT)).exec( url -> new JdkRequest(url) .method(RqMethod.POST) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_BAD_METHOD) ); }
Source:
<code><START> public InputStream body() throws IOException { <END> return new ByteArrayInputStream( this.body.getBytes(StandardCharsets.UTF_8) ); }</code><technical_language>@dalifreire this throw IOException anymore now, creating a stream a Strings bytes :)</technical_language>

Target:
public InputStream body() { return new ByteArrayInputStream( this.body.getBytes(StandardCharsets.UTF_8) ); }
Source:
<code>public List<ReplicaId> getPeerReplicaIds() { List<ReplicaId> replicasOfPartition = new ArrayList<>(); for (ReplicaId replicaId : partitionId.getReplicaIds()) { if (replicaId.getDataNodeId().getHostname().equals(dataNodeId.getHostname()) && replicaId.getDataNodeId().getPort() == dataNodeId.getPort()) { continue; } replicasOfPartition.add(replicaId); <START> } <END> return replicasOfPartition; }</code><technical_language>This a stream - filter - collect expression</technical_language>

Target:
public List<ReplicaId> getPeerReplicaIds() { List<ReplicaId> replicasOfPartition = partitionId.getReplicaIds() .stream() .filter(replica -> replica.getDataNodeId().compareTo(dataNodeId) != 0) .collect(Collectors.toList()); return replicasOfPartition; }
Source:
<code>public void test_switchToBranchWithBinaryAttributes() throws Exception { Git git = Git.wrap(db); setupGitAndDoHardReset(AutoCRLF.FALSE, EOL.LF, null, null, "file1.txt binary\nfile2.txt binary\nfile3.txt binary"); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); createAndAddFile(git, ".gitattributes", "file1.txt text\nfile2.txt binary\nfile3.txt binary"); git.commit().setMessage("switchedToTextFor1").call(); recreateWorktree(git); collectRepositoryState(); assertEquals("text", entryCRLF.attrs); checkEntryContent(entryCRLF, <START> CONTENT_LF, CONTENT_LF); <END> assertEquals("binary -diff -merge -text", entryLF.attrs); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); assertEquals("binary -diff -merge -text", entryMixed.attrs); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); git.checkout().setName(db.resolve("HEAD^").getName()).call(); recreateWorktree(git); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); }</code><technical_language>native git expects here. Native git checkout CONTENT_CRLF index CONTENT_LF. I do ... behave differently native git</technical_language>

Target:
public void test_switchToBranchWithBinaryAttributes() throws Exception { Git git = Git.wrap(db); setupGitAndDoHardReset(AutoCRLF.FALSE, EOL.LF, null, null, "file1.txt binary\nfile2.txt binary\nfile3.txt binary"); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); createAndAddFile(git, ".gitattributes", "file1.txt text\nfile2.txt binary\nfile3.txt binary"); gitCommit(git, "switchedToTextFor1"); recreateWorktree(git); collectRepositoryState(); assertEquals("text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_LF, CONTENT_LF); assertEquals("binary -diff -merge -text", entryLF.attrs); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); assertEquals("binary -diff -merge -text", entryMixed.attrs); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); gitCheckout(git, "HEAD^"); recreateWorktree(git); collectRepositoryState(); assertEquals("binary -diff -merge -text", entryCRLF.attrs); checkEntryContent(entryCRLF, CONTENT_CRLF, CONTENT_CRLF); checkEntryContent(entryLF, CONTENT_LF, CONTENT_LF); checkEntryContent(entryMixed, CONTENT_MIXED, CONTENT_MIXED); }
Source:
<code><START> private <T> T getReference(String refName) throws NamingException { <END> if (cachedJNDIReferences.containsKey(refName)) { return (T) cachedJNDIReferences.get(refName); } Object reference = getInitialContext().lookup(refName); cachedJNDIReferences.put(refName, reference); return (T) reference; }</code><technical_language>I this method synchronized, a concurrent hash map, get exposed random bugs</technical_language>

Target:
private synchronized <T> T getReference(String refName) throws NamingException { T reference = (T) cachedJNDIReferences.get(refName); if (reference != null) { return reference; } reference = (T) getInitialContext().lookup(refName); cachedJNDIReferences.put(refName, reference); return reference; }
Source:
<code>public void search() { <START> if (getEntity() != null) <END> super.search(); }</code><technical_language>braces removed</technical_language>

Target:
public void search() { if (getEntity() != null) { super.search(); } }
Source:
<code>public JMXConnection(@Nullable JMXConnector connector, @Nonnull MBeanServerConnection mBeanServerConnection) { this.connector = connector; this.mBeanServerConnection = mBeanServerConnection; this.markedAsDestroyed = false; <START> executor = Executors.newSingleThreadExecutor(); <END> }</code><technical_language>extract executor high MBeanServerConnectionFactory share connections. Keeping a single thread executor is fine for this case (if enough servers in trouble saturate single thread executor, want apply some pressure connection pool anyway, tune in future if need be). This allow of a sameThreadExecutor in test, slightly simpler</technical_language>

Target:
public JMXConnection(@Nullable JMXConnector connector, @Nonnull MBeanServerConnection mBeanServerConnection) { this.connector = connector; this.mBeanServerConnection = mBeanServerConnection; this.markedAsDestroyed = false; }
Source:
<code>public Object execute() throws Exception { final CompletableFuture<Requisition> future = client.requisition() .withRequisitionProviderType(type) .withParameters(parse(parameters)) .withLocation(location) .withSystemId(systemId) .withTimeToLive(ttlInMs) .execute(); while (true) { try { try { Requisition requisition = future.get(1, TimeUnit.SECONDS); if (xmlOutput && !Strings.isNullOrEmpty(requisition.getForeignSource())) { return JaxbUtils.marshal(requisition); } else { return requisition; } } catch (InterruptedException e) { System.out.println("\nInterrupted."); <START> } catch (ExecutionException e) { <END> System.out.printf("\nRequisition retrieval failed with: %s\n", e); } break; } catch (TimeoutException e) { } System.out.print("."); System.out.flush(); } return null; }</code><technical_language>this? printf statement show stack</technical_language>

Target:
public Object execute() throws Exception { final CompletableFuture<Requisition> future = client.requisition() .withRequisitionProviderType(type) .withParameters(parse(parameters)) .withLocation(location) .withSystemId(systemId) .withTimeToLive(ttlInMs) .execute(); while (true) { try { try { Requisition requisition = future.get(1, TimeUnit.SECONDS); if(importRequisition) { System.out.println(); ImportRequisition.sendImportRequisitionEvent(eventForwarder, type, parameters, null); System.out.println(); } if (xmlOutput) { return JaxbUtils.marshal(requisition); } else { return requisition; } } catch (InterruptedException e) { System.out.println("\nInterrupted."); } catch (ExecutionException e) { System.out.printf("\nRequisition retrieval failed with: %s\n", e); e.printStackTrace(); } break; } catch (TimeoutException e) { } System.out.print("."); System.out.flush(); } return null; }
Source:
<code>private void finalizeFile( File file, File processFile ) throws IOException { if ( isKeepBackup() && !isDryRun() ) { File backupFile = FileUtil.getBackupFile( file ); if ( backupFile.exists() ) { FileUtil.deleteFile( backupFile ); } if ( isVerbose() ) { LOG.debug( " - backup original file {}", file ); } Files.copy( file.toPath(), backupFile.toPath(), StandardCopyOption.COPY_ATTRIBUTES ); } if ( isDryRun() ) { FileUtil.deleteFile( processFile ); } else { try { String updatedContent = FileUtil.readAsString( processFile, getEncoding() ); FileUtil.printString( file, updatedContent, getEncoding() ); FileUtil.deleteFile( processFile ); } catch ( IOException e ) { <START> LOG.warn( "Error updating -> {}", processFile, file, e ); <END> } } }</code><technical_language>do expect arg e get rendered? place holders</technical_language>

Target:
private void finalizeFile( File file, File processFile ) throws IOException { if ( isKeepBackup() && !isDryRun() ) { File backupFile = FileUtil.getBackupFile( file ); if ( backupFile.exists() ) { FileUtil.deleteFile( backupFile ); } LOG.debug( " - backup original file {}", file ); Files.copy( file.toPath(), backupFile.toPath(), StandardCopyOption.COPY_ATTRIBUTES ); } if ( isDryRun() ) { FileUtil.deleteFile( processFile ); } else { try { String updatedContent = FileUtil.readAsString( processFile, getEncoding() ); FileUtil.printString( file, updatedContent, getEncoding() ); FileUtil.deleteFile( processFile ); } catch ( IOException e ) { LOG.warn( "Error updating -> {}", processFile, file, e ); } } }
Source:
<code>public List<WorkspaceMetacardImpl> getWorkspaceMetacards() { final QueryRequest queryRequest = createQueryRequestForSubscribedToWorkspaces(); if (queryRequest != null) { try { return createWorkspaceMetacards(query(queryRequest)); } catch (CatalogQueryException e) { <START> LOGGER.warn("Error querying for workspaces", e); <END> } } return Collections.emptyList(); }</code><technical_language>info more appropriate</technical_language>

Target:
public List<WorkspaceMetacardImpl> getWorkspaceMetacards() { return createQueryRequestForSubscribedToWorkspaces() .map(this::queryRequestToWorkspaceMetacards) .orElse(Collections.emptyList()); }
Source:
<code>public TypeSpec createTypeAdapter(ClassName className, ClassName autoValueClassName, List<Property> properties) { ClassName jsonAdapter = ClassName.get(JsonAdapter.class); TypeName typeAdapterClass = ParameterizedTypeName.get(jsonAdapter, autoValueClassName); ImmutableMap<Property, FieldSpec> adapters = createFields(properties); <START> FieldSpec moshiField = FieldSpec.builder(Moshi.class, "moshi", PRIVATE, FINAL).build(); <END> MethodSpec.Builder constructor = MethodSpec.constructorBuilder() .addModifiers(PUBLIC) .addParameter(Moshi.class, "moshi") .addStatement("this.$N = moshi", moshiField); for (Map.Entry<Property, FieldSpec> entry : adapters.entrySet()) { Property prop = entry.getKey(); FieldSpec field = entry.getValue(); if (entry.getKey().type instanceof ParameterizedTypeName) { constructor.addStatement("this.$N = moshi.adapter($L)", field, makeType((ParameterizedTypeName) prop.type)); } else { TypeName type = prop.type.isPrimitive() ? prop.type.box() : prop.type; constructor.addStatement("this.$N = moshi.adapter($T.class)", field, type); } } String customTypeAdapterClass = String.format("AutoValue_%sJsonAdapter", autoValueClassName.simpleName()); TypeSpec.Builder classBuilder = TypeSpec.classBuilder(customTypeAdapterClass) .addModifiers(PUBLIC, STATIC, FINAL) .addModifiers(PUBLIC, STATIC, FINAL) .superclass(typeAdapterClass) .addField(moshiField) .addFields(adapters.values()) .addMethod(constructor.build()) .addMethod(createReadMethod(moshiField, className, autoValueClassName, adapters)) .addMethod(createWriteMethod(moshiField, autoValueClassName, adapters)); return classBuilder.build(); }</code><technical_language>I this unused now. it</technical_language>

Target:
public TypeSpec createTypeAdapter(ClassName className, ClassName autoValueClassName, List<Property> properties) { ClassName jsonAdapter = ClassName.get(JsonAdapter.class); TypeName typeAdapterClass = ParameterizedTypeName.get(jsonAdapter, autoValueClassName); ImmutableMap<Property, FieldSpec> adapters = createFields(properties); MethodSpec.Builder constructor = MethodSpec.constructorBuilder() .addModifiers(PUBLIC) .addParameter(Moshi.class, "moshi"); for (Map.Entry<Property, FieldSpec> entry : adapters.entrySet()) { Property prop = entry.getKey(); FieldSpec field = entry.getValue(); if (entry.getKey().type instanceof ParameterizedTypeName) { constructor.addStatement("this.$N = moshi.adapter($L)", field, makeType((ParameterizedTypeName) prop.type)); } else { TypeName type = prop.type.isPrimitive() ? prop.type.box() : prop.type; constructor.addStatement("this.$N = moshi.adapter($T.class)", field, type); } } String customTypeAdapterClass = String.format("AutoValue_%sJsonAdapter", autoValueClassName.simpleName()); TypeSpec.Builder classBuilder = TypeSpec.classBuilder(customTypeAdapterClass) .addModifiers(PUBLIC, STATIC, FINAL) .addModifiers(PUBLIC, STATIC, FINAL) .superclass(typeAdapterClass) .addFields(adapters.values()) .addMethod(constructor.build()) .addMethod(createReadMethod(className, autoValueClassName, adapters)) .addMethod(createWriteMethod(autoValueClassName, adapters)); return classBuilder.build(); }
Source:
<code>private void addModule(File script, String extension) { final String METHOD_NAME = "addModule(File)"; ScriptEngine engine = scriptEngineManager.getEngineByExtension(extension); if (null == engine) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.WARNING, "Could not find script engine for extension " + extension); return; } try { <START> Reader fileReader = new FileReader(script); <END> engine.eval(fileReader); Iterable<?> plugins = (Iterable<?>) engine.eval("getPlugins()"); for (Object p : plugins) { if (p instanceof MekHQModule) { modules.add((MekHQModule) p); } } fileReader.close(); } catch (IOException | ScriptException e) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.ERROR, "While parsing script " + script.getName()); MekHQ.getLogger().error(getClass(), METHOD_NAME, e); } }</code><technical_language>try-with-resources</technical_language>

Target:
private void addModule(File script, String extension) { final String METHOD_NAME = "addModule(File)"; ScriptEngine engine = scriptEngineManager.getEngineByExtension(extension); if (null == engine) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.WARNING, "Could not find script engine for extension " + extension); return; } try (Reader fileReader = new FileReader(script)) { engine.eval(fileReader); Iterable<?> plugins = (Iterable<?>) engine.eval("getPlugins()"); for (Object p : plugins) { if (p instanceof MekHQModule) { modules.add((MekHQModule) p); } } } catch (IOException | ScriptException e) { MekHQ.getLogger().log(getClass(), METHOD_NAME, LogLevel.ERROR, "While parsing script " + script.getName()); MekHQ.getLogger().error(getClass(), METHOD_NAME, e); } }
Source:
<code>public void setProperty( String key, Object value ) { KernelTransaction transaction = actions.kernelTransaction(); int propertyKeyId; try { propertyKeyId = transaction.tokenWrite().propertyKeyGetOrCreateForName( key ); } catch ( IllegalTokenNameException e ) { throw new IllegalArgumentException( format( "Invalid property key '%s'.", key ), e ); } try ( Statement ignore = transaction.acquireStatement() ) { transaction.dataWrite().relationshipSetProperty( id, propertyKeyId, Values.of( value, false ) ); } catch ( ConstraintValidationException e ) { throw new ConstraintViolationException( e.getUserMessage( new SilentTokenNameLookup( transaction.tokenRead() ) ), e ); } catch ( IllegalArgumentException e ) { actions.failTransaction(); throw e; } catch ( EntityNotFoundException e ) { throw new NotFoundException( e ); } catch ( InvalidTransactionTypeKernelException e ) { throw new ConstraintViolationException( e.getMessage(), e ); } catch ( AutoIndexingKernelException e ) { throw new IllegalStateException( "Auto indexing encountered a failure while setting property: " + e.getMessage(), e ); } catch ( KernelException e ) { <START> throw new ConstraintViolationException( e.getMessage(), e ); <END> } }</code><technical_language>This is strange, I get constraint violation for relationships setting a property? removing I guess violate a existence constraint, checked commit. In general feels more catch clauses necessary..</technical_language>

Target:
public void setProperty( String key, Object value ) { KernelTransaction transaction = actions.kernelTransaction(); int propertyKeyId; try { propertyKeyId = transaction.tokenWrite().propertyKeyGetOrCreateForName( key ); } catch ( IllegalTokenNameException e ) { throw new IllegalArgumentException( format( "Invalid property key '%s'.", key ), e ); } try ( Statement ignore = transaction.acquireStatement() ) { transaction.dataWrite().relationshipSetProperty( id, propertyKeyId, Values.of( value, false ) ); } catch ( IllegalArgumentException e ) { actions.failTransaction(); throw e; } catch ( EntityNotFoundException e ) { throw new NotFoundException( e ); } catch ( InvalidTransactionTypeKernelException e ) { throw new ConstraintViolationException( e.getMessage(), e ); } catch ( AutoIndexingKernelException e ) { throw new IllegalStateException( "Auto indexing encountered a failure while setting property: " + e.getMessage(), e ); } }
Source:
<code><START> public void onStarted(Run<?, ?> build, TaskListener listener) { <END> if (build instanceof MatrixBuild) return; Job<?, ?> proj = Utils.getProject(build); List<LockableResource> required = new ArrayList<LockableResource>(); if (proj != null) { LockableResourcesStruct resources = Utils.requiredResources(proj); if (resources != null) { if (resources.requiredNumber != null || !resources.label.isEmpty()) { required = LockableResourcesManager.get(). getResourcesFromProject(proj.getFullName()); } else { required = resources.required; } if (LockableResourcesManager.get().lock(required, build, null)) { build.addAction(LockedResourcesBuildAction .fromResources(required)); listener.getLogger().printf("%s acquired lock on %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " acquired lock on " + required); if (resources.requiredVar != null) { build.addAction(new ResourceVariableNameAction(new StringParameterValue( resources.requiredVar, required.toString().replaceAll("[\\]\\[]", "")))); } } else { listener.getLogger().printf("%s failed to lock %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " failed to lock " + required); } } } }</code><technical_language>do for non-AbstractBuilds here, a check is needed return in case</technical_language>

Target:
public void onStarted(Run<?, ?> build, TaskListener listener) { if (build instanceof MatrixBuild) return; if (build instanceof AbstractBuild) { Job<?, ?> proj = Utils.getProject(build); List<LockableResource> required = new ArrayList<LockableResource>(); if (proj != null) { LockableResourcesStruct resources = Utils.requiredResources(proj); if (resources != null) { if (resources.requiredNumber != null || !resources.label.isEmpty()) { required = LockableResourcesManager.get(). getResourcesFromProject(proj.getFullName()); } else { required = resources.required; } if (LockableResourcesManager.get().lock(required, build, null)) { build.addAction(LockedResourcesBuildAction .fromResources(required)); listener.getLogger().printf("%s acquired lock on %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " acquired lock on " + required); if (resources.requiredVar != null) { build.addAction(new ResourceVariableNameAction(new StringParameterValue( resources.requiredVar, required.toString().replaceAll("[\\]\\[]", "")))); } } else { listener.getLogger().printf("%s failed to lock %s\n", LOG_PREFIX, required); LOGGER.fine(build.getFullDisplayName() + " failed to lock " + required); } } } } return; }
Source:
<code>private OperationResult applyCommand(long index, long sequence, long timestamp, RaftOperation operation, RaftSessionContext session) { if (nextRevision != null) { switch (nextRevision.revision().propagationStrategy()) { case VERSION: return OperationResult.failed( index, session.getEventIndex(), new RaftException.ReadOnly(serviceName() + " revision " + revision.revision() + " is read-only")); case PROPAGATE: locked = true; <START> nextRevision.applyCommand(index, sequence, timestamp, operation, session); <END> locked = false; break; default: break; } } tick(index, timestamp); Commit<byte[]> commit = new DefaultCommit<>(index, operation.id(), operation.value(), session, timestamp); long eventIndex = session.getEventIndex(); OperationResult result; try { byte[] output = service.apply(commit); result = OperationResult.succeeded(index, eventIndex, output); } catch (Exception e) { result = OperationResult.failed(index, eventIndex, e); } commit(); session.registerResult(sequence, result); session.setCommandSequence(sequence); return result; }</code><technical_language>try finally unlock incase applycommand throws exception</technical_language>

Target:
private OperationResult applyCommand(long index, long sequence, long timestamp, RaftOperation operation, RaftSessionContext session) { if (nextRevision != null) { switch (nextRevision.revision().propagationStrategy()) { case VERSION: return OperationResult.failed( index, session.getEventIndex(), new RaftException.ReadOnly(serviceName() + " revision " + revision.revision() + " is read-only")); case PROPAGATE: locked = true; try { nextRevision.applyCommand(index, sequence, timestamp, operation, session); } finally { locked = false; } break; default: break; } } tick(index, timestamp); Commit<byte[]> commit = new DefaultCommit<>(index, operation.id(), operation.value(), session, timestamp); long eventIndex = session.getEventIndex(); OperationResult result; try { byte[] output = service.apply(commit); result = OperationResult.succeeded(index, eventIndex, output); } catch (Exception e) { result = OperationResult.failed(index, eventIndex, e); } commit(); session.registerResult(sequence, result); session.setCommandSequence(sequence); return result; }
Source:
<code>public void testAppendStreamDoesNotOverwriteTableConfig() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Integer> elements = env.fromElements(1, 2, 3); StreamTableEnvironmentImpl tEnv = getStreamTableEnvironment(env, elements); Time minRetention = Time.minutes(1); Time maxRetention = Time.minutes(10); tEnv.getConfig().setIdleStateRetentionTime(minRetention, maxRetention); Table table = tEnv.fromDataStream(elements); tEnv.toAppendStream(table, Row.class); assertThat( tEnv.getConfig().getMinIdleStateRetentionTime(), equalTo(minRetention.toMilliseconds())); assertThat( tEnv.getConfig().getMaxIdleStateRetentionTime(), <START> equalTo(minRetention.toMilliseconds() * 3 / 2)); <END> }</code><technical_language>Please new method setIdleStateRetentionTime set idle state in tests</technical_language>

Target:
public void testAppendStreamDoesNotOverwriteTableConfig() { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); DataStreamSource<Integer> elements = env.fromElements(1, 2, 3); StreamTableEnvironmentImpl tEnv = getStreamTableEnvironment(env, elements); Duration minRetention = Duration.ofMinutes(1); tEnv.getConfig().setIdleStateRetention(minRetention); Table table = tEnv.fromDataStream(elements); tEnv.toAppendStream(table, Row.class); assertEquals(minRetention, tEnv.getConfig().getIdleStateRetention()); }
Source:
<code>private Sniffer createSniffer(String scopeName, RestClient client, Properties properties) { String propertyPrefix = propertyPrefix( scopeName ); boolean discoveryEnabled = ConfigurationParseHelper.getBooleanValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_ENABLED, ElasticsearchEnvironment.Defaults.DISCOVERY_ENABLED ); if ( discoveryEnabled ) { SnifferBuilder builder = Sniffer.builder( client ) .setSniffIntervalMillis( ConfigurationParseHelper.getIntValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_REFRESH_INTERVAL, ElasticsearchEnvironment.Defaults.DISCOVERY_REFRESH_INTERVAL ) * 1_000 ); String scheme = ConfigurationParseHelper.getString(properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_SCHEME, "http"); if ( scheme.equals(ElasticsearchHostsSniffer.Scheme.HTTPS.toString()) ) { HostsSniffer hostsSniffer = new ElasticsearchHostsSniffer( client, <START> ElasticsearchEnvironment.Defaults.DISCOVERY_REFRESH_INTERVAL * 1_000, <END> ElasticsearchHostsSniffer.Scheme.HTTPS ); builder.setHostsSniffer( hostsSniffer ); } return builder.build(); } else { return null; } }</code><technical_language>mistaken, this ElasticsearchHostsSniffer.DEFAULT_SNIFF_REQUEST_TIMEOUT</technical_language>

Target:
private Sniffer createSniffer(String scopeName, RestClient client, Properties properties) { String propertyPrefix = propertyPrefix( scopeName ); boolean discoveryEnabled = ConfigurationParseHelper.getBooleanValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_ENABLED, ElasticsearchEnvironment.Defaults.DISCOVERY_ENABLED ); if ( discoveryEnabled ) { SnifferBuilder builder = Sniffer.builder( client ) .setSniffIntervalMillis( ConfigurationParseHelper.getIntValue( properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_REFRESH_INTERVAL, ElasticsearchEnvironment.Defaults.DISCOVERY_REFRESH_INTERVAL ) * 1_000 ); String scheme = ConfigurationParseHelper.getString(properties, propertyPrefix + ElasticsearchEnvironment.DISCOVERY_SCHEME, "http"); if ( scheme.equals(ElasticsearchHostsSniffer.Scheme.HTTPS.toString()) ) { HostsSniffer hostsSniffer = new ElasticsearchHostsSniffer( client, ElasticsearchHostsSniffer.DEFAULT_SNIFF_REQUEST_TIMEOUT, ElasticsearchHostsSniffer.Scheme.HTTPS ); builder.setHostsSniffer( hostsSniffer ); } return builder.build(); } else { return null; } }