auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean doBuild(TopologyBuilder bldr, Set<String> stageNames) { setDefaultNameIfNone(StreamletNamePrefix.REDUCE, stageNames); GeneralReduceByKeyAndWindowOperator<K, V, VR> bolt = new GeneralReduceByKeyAndWindowOperator<K, V, VR>(keyExtractor, identity, reduceFn); <START> bolt.applyWindowConfig(windowCfg); <END> bldr.setBolt(getName(), bolt, getNumPartitions()) .customGrouping(parent.getName(), parent.getStreamId(), new ReduceByKeyAndWindowCustomGrouping<K, V>(keyExtractor)); return true; }</code><technical_language>applyWindowConfig attachWindowConfig redundant other. call windowCfg.attachWIndowConfig(bolt) right</technical_language>

Target:
public boolean doBuild(TopologyBuilder bldr, Set<String> stageNames) { setDefaultNameIfNone(StreamletNamePrefix.REDUCE, stageNames); GeneralReduceByKeyAndWindowOperator<K, V, VR> bolt = new GeneralReduceByKeyAndWindowOperator<K, V, VR>(keyExtractor, identity, reduceFn); windowCfg.applyTo(bolt); bldr.setBolt(getName(), bolt, getNumPartitions()) .customGrouping(parent.getName(), parent.getStreamId(), new ReduceByKeyAndWindowCustomGrouping<K, V>(keyExtractor)); return true; }
Source:
<code>public HostGeoInfo getHostGeoInfo(InetAddress address) throws Exception { HostGeoInfo result; try { if (HOMELESS_IP.equals(address.getHostAddress())) { result = null; } else { result = delegate.getHostGeoInfo(address); } LOG.info("StubHostGeoLookup.getHostGeoInfo queried: address="+address+"; hostAddress="+address.getHostAddress()+"; result="+result); return result; <START> } catch (Throwable t) { <END> LOG.error("StubHostGeoLookup.getHostGeoInfo encountered problem (rethrowing): address="+address+"; hostAddress="+address.getHostAddress(), t); throw Exceptions.propagate(t); } }</code><technical_language>Bit paranoid, methinks. Catching Throwable, I mean</technical_language>

Target:
public HostGeoInfo getHostGeoInfo(InetAddress address) throws Exception { try { HostGeoInfo result; if (HOMELESS_IP.equals(address.getHostAddress())) { result = null; } else { result = delegate.getHostGeoInfo(address); } LOG.info("StubHostGeoLookup.getHostGeoInfo queried: address="+address+"; hostAddress="+address.getHostAddress()+"; result="+result); return result; } catch (Throwable t) { LOG.error("StubHostGeoLookup.getHostGeoInfo encountered problem (rethrowing): address="+address+"; hostAddress="+address.getHostAddress(), t); throw Exceptions.propagate(t); } }
Source:
<code>private Broadcast setCommonDetails(ProgData progData, Channel channel, DateTimeZone zone, Item episode, Timestamp updatedAt) { <START> if (episode.getTitle() == null || (!channel.getUri().contains("wales"))) { <END> if (progData.getEpisodeTitle() != null) { episode.setTitle(progData.getEpisodeTitle()); } else { episode.setTitle(progData.getTitle()); } } setDescription(progData, episode, channel); episode.setMediaType(channel.getMediaType()); episode.setSpecialization(specialization(progData, channel)); setGenres(progData, episode); if (progData.getCountry() != null) { episode.setCountriesOfOrigin(countryMap.parseCountries(progData.getCountry())); } if (progData.getAttr() != null) { episode.setBlackAndWhite(getBooleanValue(progData.getAttr().getBw())); } selectImages(progData.getPictures(), episode, PA_PICTURE_TYPE_EPISODE, PA_PICTURE_TYPE_SERIES, Maybe.just(PA_PICTURE_TYPE_BRAND)); episode.setPeople(people(progData)); Version version = findBestVersion(episode.getVersions()); version.set3d(getBooleanValue(progData.getAttr().getThreeD())); Duration duration = Duration.standardMinutes(Long.valueOf(progData.getDuration())); version.setDuration(duration); setCertificate(progData, episode); Broadcast broadcast = broadcast(progData, channel, zone, updatedAt); addBroadcast(version, broadcast); return broadcast; }</code><technical_language>add brackets</technical_language>

Target:
private Broadcast setCommonDetails(ProgData progData, Channel channel, DateTimeZone zone, Item episode, Timestamp updatedAt) { if (episode.getTitle() == null || !channel.getUri().contains("wales")) { if (progData.getEpisodeTitle() != null) { episode.setTitle(progData.getEpisodeTitle()); } else { episode.setTitle(progData.getTitle()); } } setDescription(progData, episode, channel); episode.setMediaType(channel.getMediaType()); episode.setSpecialization(specialization(progData, channel)); setGenres(progData, episode); if (progData.getCountry() != null) { episode.setCountriesOfOrigin(countryMap.parseCountries(progData.getCountry())); } if (progData.getAttr() != null) { episode.setBlackAndWhite(getBooleanValue(progData.getAttr().getBw())); } selectImages(progData.getPictures(), episode, PA_PICTURE_TYPE_EPISODE, PA_PICTURE_TYPE_SERIES, Maybe.just(PA_PICTURE_TYPE_BRAND)); episode.setPeople(people(progData)); Version version = findBestVersion(episode.getVersions()); version.set3d(getBooleanValue(progData.getAttr().getThreeD())); Duration duration = Duration.standardMinutes(Long.valueOf(progData.getDuration())); version.setDuration(duration); setCertificate(progData, episode); Broadcast broadcast = broadcast(progData, channel, zone, updatedAt); addBroadcast(version, broadcast); return broadcast; }
Source:
<code>public void tearDown() throws Exception { <START> super.tearDown(); <END> }</code><technical_language>need reset this property in a @Before block</technical_language>

Target:
public void tearDown() throws Exception { System.clearProperty(ServerCnxnFactory.ZOOKEEPER_SERVER_CNXN_FACTORY); for (ZooKeeper zk : zks) { zk.close(); } super.tearDown(); }
Source:
<code>private void displayNav() { DiffApi.diff(idSideB, patchKey.getFileName()).base(idSideA) .get(new GerritCallback<DiffInfo>() { @Override public void onSuccess(DiffInfo diffInfo) { <START> topNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); bottomNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); <END> } }); }</code><technical_language>Wrap long lines</technical_language>

Target:
private void displayNav() { DiffApi.diff(idSideB, patchKey.getFileName()) .base(idSideA) .webLinksOnly() .get(new GerritCallback<DiffInfo>() { @Override public void onSuccess(DiffInfo diffInfo) { topNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); bottomNav.display(patchIndex, getPatchScreenType(), fileList, getLinks(), getWebLinks(diffInfo)); } }); }
Source:
<code>void enableAutoRow(final TargetEnvironment env) { final GroupRow autoGroupRow = new GroupRow(true, true, 0, env.getGuideEnvironment().automaticGroup(), Collections.emptyList()); rows.set(1, autoGroupRow); <START> fireTableRowsUpdated(1, 1); <END> }</code><technical_language>Is this running swing thread</technical_language>

Target:
void enableAutoRow(final TargetEnvironment env) { final GroupRow autoGroupRow = new GroupRow(true, false, 0, env.getGuideEnvironment().automaticGroup(), Collections.emptyList()); rows.set(1, autoGroupRow); fireTableRowsUpdated(1, 1); }
Source:
<code>private void checkAlignment(String <START> errorMessage, int <END> expectedAlignment, int actualAlignment) { switch (expectedAlignment) { case PositionConstants.LEFT: assertEquals("wrong text wrap alignment.", PositionConstants.LEFT, actualAlignment); break; case PositionConstants.RIGHT: assertEquals("wrong text wrap alignment.", PositionConstants.RIGHT, actualAlignment); break; case PositionConstants.CENTER: assertEquals("wrong text wrap alignment.", PositionConstants.CENTER, actualAlignment); break; default: break; }; }</code><technical_language>this parameter replace hard coded texts</technical_language>

Target:
private void checkAlignment(String errorMessage, int expectedAlignment, int actualAlignment) { switch (expectedAlignment) { case PositionConstants.LEFT: assertEquals(errorMessage, PositionConstants.LEFT, actualAlignment); break; case PositionConstants.RIGHT: assertEquals(errorMessage, PositionConstants.RIGHT, actualAlignment); break; case PositionConstants.CENTER: assertEquals(errorMessage, PositionConstants.CENTER, actualAlignment); break; default: break; }; }
Source:
<code><START> public void OriginAtCenter(boolean b) { <END> originAtCenter = b; }</code><technical_language>thinking this protected inadvertently called subclass explicitly public provides right Simple annotations</technical_language>

Target:
protected void OriginAtCenter(boolean b) { originAtCenter = b; }
Source:
<code>private Widget prepareWorlflowInformationWidget() { <START> String widgetIcon = "Please add an icon to the workflow <br>"; <END> String widgetDocumentation = "Please add a documentation link to the workflow <br>"; String widgetBucketName = "Please add a bucket name to the workflow"; if (icon != null) { widgetIcon = "<img src=" + icon + " height=40px width=40px> <br>"; } if (documentation != null) { widgetDocumentation = "<b>Documentation :</b> <a href=" + documentation + " target=_blank>" + documentation + " </a><br>"; } if (bucketNameGI != null) { widgetBucketName = "<b> Bucket name :</b> " + bucketNameGI; } return new HTML("<center> " + widgetIcon + widgetDocumentation + widgetBucketName + " </center>"); }</code><technical_language>Is add icon this interface? If not, I showing a solution this message</technical_language>

Target:
private Widget prepareWorlflowInformationWidget() { String widgetIcon = "No icone <br>"; String widgetDocumentation = "No documentation <br>"; String widgetBucketName = "No bucket name"; if (icon != null) { widgetIcon = "<img src=" + icon + " height=40px width=40px> <br>"; } if (documentation != null) { widgetDocumentation = "<b>Documentation :</b> <a href=" + documentation + " target=_blank>" + documentation + " </a><br>"; } if (bucketNameGI != null) { widgetBucketName = "<b> Bucket name :</b> " + bucketNameGI; } return new HTML("<center> " + widgetIcon + widgetDocumentation + widgetBucketName + " </center>"); }
Source:
<code>public void testBindingsAreBoundOnlyWhenEvaluation() { GroovyScriptEngine groovyScriptEngine = new GroovyScriptEngine(); String groovyExpression = "temperature > 10 && humidity < 30"; GroovyScript<Boolean> groovyScript = new GroovyScript<Boolean>(groovyExpression, groovyScriptEngine); HashMap<String, Object> fieldsAndValue = new HashMap<>(); fieldsAndValue.put("temperature", 20); fieldsAndValue.put("humidity", 10); try { <START> groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1")); <END> } catch (ScriptException e) { e.printStackTrace(); Assert.fail("It shouldn't throw ScriptException"); } fieldsAndValue.clear(); fieldsAndValue.put("no_related_field", 3); try { groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1")); Assert.fail("It should not evaluate correctly"); } catch (ScriptException e) { } }</code><technical_language>I assert evaluates true, throw exception</technical_language>

Target:
public void testBindingsAreBoundOnlyWhenEvaluation() { GroovyScriptEngine groovyScriptEngine = new GroovyScriptEngine(); String groovyExpression = "temperature > 10 && humidity < 30"; GroovyScript<Boolean> groovyScript = new GroovyScript<Boolean>(groovyExpression, groovyScriptEngine); HashMap<String, Object> fieldsAndValue = new HashMap<>(); fieldsAndValue.put("temperature", 20); fieldsAndValue.put("humidity", 10); try { assertTrue(groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1"))); } catch (ScriptException e) { e.printStackTrace(); Assert.fail("It shouldn't throw ScriptException"); } fieldsAndValue.clear(); fieldsAndValue.put("no_related_field", 3); try { groovyScript.evaluate(new IotasEventImpl(fieldsAndValue, "1")); Assert.fail("It should not evaluate correctly"); } catch (ScriptException e) { } }
Source:
<code>public boolean ShouldEndAction() { synchronized (_listTasks) { java.util.ArrayList<EntityAsyncTask> CurrentActionTypeTasks = GetCurrentActionTypeTasks(); for (EntityAsyncTask task : CurrentActionTypeTasks) { if (task.getState() != AsyncTaskState.Ended) { <START> log.infoFormat("Task ID: '{0}' is in state {1}. End action for entity {2} will be procceeded when all the tasks will be in end state.", <END> task.getTaskID(), task.getState(), getContainerId()); return false; } } } return true; }</code><technical_language>Vered - Good catch. s/proceeded/processed endAction is handled tasks for entity completed (actually, usage of word "all" is 100% correct, get corner cases :) )</technical_language>

Target:
public boolean ShouldEndAction() { synchronized (_listTasks) { java.util.ArrayList<EntityAsyncTask> CurrentActionTypeTasks = GetCurrentActionTypeTasks(); for (EntityAsyncTask task : CurrentActionTypeTasks) { if (task.getState() != AsyncTaskState.Ended) { log.infoFormat("Task ID: '{0}' is in state {1}. End action for entity {2} will proceed when all the entity tasks will be completed.", task.getTaskID(), task.getState(), getContainerId()); return false; } } } return true; }
Source:
<code>public void testGetQuery() { <START> ParseQuery query = ParseRole.getQuery(); <END> assertEquals(ParseCorePlugins.getInstance().getSubclassingController().getClassName(ParseRole.class), query.getBuilder().getClassName()); }</code><technical_language>add <?> here</technical_language>

Target:
public void testGetQuery() { ParseQuery<?> query = ParseRole.getQuery(); assertEquals(ParseCorePlugins.getInstance().getSubclassingController().getClassName(ParseRole.class), query.getBuilder().getClassName()); }
Source:
<code>private void triggerFlushInPrimaryRegion(final HRegion region) { if (ServerRegionReplicaUtil.isDefaultReplica(region.getRegionInfo())) { return; } TableName tn = region.getTableDescriptor().getTableName(); if (!ServerRegionReplicaUtil.isRegionReplicaReplicationEnabled(region.conf, tn) || !ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(region.conf)) { region.setReadsEnabled(true); return; } region.setReadsEnabled(false); if (this.executorService != null) { EventHandler eh = new RegionReplicaFlushHandler(this, clusterConnection, rpcRetryingCallerFactory, rpcControllerFactory, operationTimeout, region); if (this.executorService.hasExecutor(eh.getEventType())) { this.executorService.submit(eh); } else { Threads.setDaemonThreadRunning(new Thread(() -> eh.run()), "FlushRegionReplicaPrimary." + region.getRegionInfo().getEncodedName(), new UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LOG.warn("{}", t.getName(), e); } }); } } else { LOG.info("Executor is null; not running flush of primary region replica for {}", region.getRegionInfo()); <START> } <END> }</code><technical_language>I this is correct here. add executor for this event type executorService in startServices method</technical_language>

Target:
private void triggerFlushInPrimaryRegion(final HRegion region) { if (ServerRegionReplicaUtil.isDefaultReplica(region.getRegionInfo())) { return; } TableName tn = region.getTableDescriptor().getTableName(); if (!ServerRegionReplicaUtil.isRegionReplicaReplicationEnabled(region.conf, tn) || !ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(region.conf)) { region.setReadsEnabled(true); return; } region.setReadsEnabled(false); if (this.executorService != null) { this.executorService.submit(new RegionReplicaFlushHandler(this, clusterConnection, rpcRetryingCallerFactory, rpcControllerFactory, operationTimeout, region)); } else { LOG.info("Executor is null; not running flush of primary region replica for {}", region.getRegionInfo()); } }
Source:
<code>private Map<VmDevice, Integer> vmDeviceUnitMapForController(VmDevice vmDevice, Map<Integer, Map<VmDevice, Integer>> vmDeviceUnitMap) { int numOfDisks = <START> getVm().getDiskMap() != null ? <END> getVm().getDiskMap().values().size() : 0; int controllerId = vmInfoBuildUtils.getControllerForScsiDisk(vmDevice, getVm(), numOfDisks); if (!vmDeviceUnitMap.containsKey(controllerId)) { return new HashMap<>(); } return vmDeviceUnitMap.get(controllerId); }</code><technical_language>true</technical_language>

Target:
private Map<VmDevice, Integer> vmDeviceUnitMapForController(VmDevice vmDevice, Map<Integer, Map<VmDevice, Integer>> vmDeviceUnitMap) { int numOfDisks = getVm().getDiskMap().values().size(); int controllerId = vmInfoBuildUtils.getControllerForScsiDisk(vmDevice, getVm(), numOfDisks); if (!vmDeviceUnitMap.containsKey(controllerId)) { return new HashMap<>(); } return vmDeviceUnitMap.get(controllerId); }
Source:
<code>public <T, K, V> void onPreExecute(Callable<T> task, Cache<K, V> inputDataCache) { try { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; ContextInputCache.set(inputDataCache); preInject(bm, task); if (task instanceof RunnableAdapter) { preInject(bm, ((RunnableAdapter) task).getTask()); } } catch (Exception e) { <START> throw new IllegalStateException("Injcting input caches failed. This may result in NullPointerExceptions in client code", e); <END> } finally { ContextInputCache.clean(); } }</code><technical_language>Typo: Injcting Also, I continuing run task throwing IllegalStateException a bug, NPE in user code hide ISE</technical_language>

Target:
public <T, K, V> void onPreExecute(Callable<T> task, Cache<K, V> inputDataCache) { BeanManager bm = CDIHelper.getBeanManager(); if (bm == null) return; ContextInputCache.set(inputDataCache); preInject(bm, task); if (task instanceof RunnableAdapter) { preInject(bm, ((RunnableAdapter) task).getTask()); } }
Source:
<code>public Mono<PagedResponse<ListContainerItemInner>> listSinglePageAsync( <START> String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { <END> if (this.client.getHost() == null) { return Mono .error(new IllegalArgumentException("Parameter this.client.getHost() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (accountName == null) { return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } return FluxUtil .withContext( context -> service .list( this.client.getHost(), resourceGroupName, accountName, this.client.getApiVersion(), this.client.getSubscriptionId(), maxpagesize, filter, include, context)) .<PagedResponse<ListContainerItemInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }</code><technical_language>suggestion String resourceGroupName, String accountName, String maxPageSize, String filter, ListSharesExpand include) {</technical_language>

Target:
public Mono<PagedResponse<ListContainerItemInner>> listSinglePageAsync( String resourceGroupName, String accountName, String maxpagesize, String filter, ListSharesExpand include) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (accountName == null) { return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), resourceGroupName, accountName, this.client.getApiVersion(), this.client.getSubscriptionId(), maxpagesize, filter, include, context)) .<PagedResponse<ListContainerItemInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
Source:
<code>private boolean actuallyFits(int powerTwo, RandomAccessFile headerFile) throws IOException { long lastValueOffset = 0; long currentValueOffset = 0; long valueBytesWritten = valuesOut.getCount(); long headerIndex = 0; long bagSize = 1L << powerTwo; while (lastValueOffset < valueBytesWritten) { if (headerIndex + bagSize <= numWritten) { headerFile.seek((headerIndex + bagSize - 1) * Longs.BYTES); currentValueOffset = headerFile.readLong(); } else if (headerIndex < numWritten && numWritten < (headerIndex + bagSize)) { headerFile.seek((numWritten - 1) * Longs.BYTES); currentValueOffset = headerFile.readLong(); <START> } <END> if (currentValueOffset - lastValueOffset <= fileSizeLimit) { lastValueOffset = currentValueOffset; headerIndex = headerIndex + bagSize; } else { return false; } } return true; }</code><technical_language>else, if headerIndex + bagSize <= numWritten is false headerIndex < numWritten && numWritten < (headerIndex + bagSize) is false</technical_language>

Target:
private boolean actuallyFits(int powerTwo, RandomAccessFile headerFile) throws IOException { long lastValueOffset = 0; long currentValueOffset = 0; long valueBytesWritten = valuesOut.getCount(); long headerIndex = 0; long bagSize = 1L << powerTwo; while (lastValueOffset < valueBytesWritten) { if (headerIndex >= numWritten) { return true; } else if (headerIndex + bagSize <= numWritten) { headerFile.seek((headerIndex + bagSize - 1) * Longs.BYTES); currentValueOffset = Long.reverseBytes(headerFile.readLong()); } else if (numWritten < headerIndex + bagSize) { headerFile.seek((numWritten - 1) * Longs.BYTES); currentValueOffset = Long.reverseBytes(headerFile.readLong()); } if (currentValueOffset - lastValueOffset <= fileSizeLimit) { lastValueOffset = currentValueOffset; headerIndex = headerIndex + bagSize; } else { return false; } } return true; }
Source:
<code>public void testDecisionTableWithCalculatedResult_parallel() throws Throwable { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime( "calculation1.dmn", this.getClass() ); Runnable task = () -> { final DMNModel dmnModel = runtime.getModel( "<LINK_0>", "Calculation1" ); assertThat( dmnModel, notNullValue() ); final DMNContext context = DMNFactory.newContext(); context.set( "MonthlyDeptPmt", BigDecimal.valueOf( 200 ) ); context.set( "MonthlyPmt", BigDecimal.valueOf( 100 ) ); context.set( "MonthlyIncome", BigDecimal.valueOf( 600 ) ); final DMNResult dmnResult = runtime.evaluateAll( dmnModel, context ); assertThat( dmnResult.hasErrors(), is( false ) ); final DMNContext result = dmnResult.getContext(); <START> assertThat( ((BigDecimal) result.get( "Logique de décision 1" )).setScale( 1, RoundingMode.CEILING ), is( BigDecimal.valueOf( 0.5 ) ) ); <END> }; List<Throwable> problems = new ArrayList<>(); List<CompletableFuture<Void>> tasks = new ArrayList<>(); for ( int i=0 ; i<10_000; i++) { CompletableFuture<Void> newtask = CompletableFuture.runAsync(task).exceptionally(t -> {problems.add(t); return null;}); tasks.add( newtask ); } CompletableFuture.allOf(tasks.toArray(new CompletableFuture<?>[]{})).get(10, TimeUnit.SECONDS); for ( Throwable t : problems ) { throw t; } }</code><technical_language>please extract some separate method please? I is duplicated</technical_language>

Target:
public void testDecisionTableWithCalculatedResult_parallel() throws Throwable { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime( "calculation1.dmn", this.getClass() ); Runnable task = () -> { checkDecisionTableWithCalculatedResult(runtime); }; List<Throwable> problems = Collections.synchronizedList(new ArrayList<>()); List<CompletableFuture<Void>> tasks = new ArrayList<>(); for ( int i=0 ; i<10_000; i++) { CompletableFuture<Void> newtask = CompletableFuture.runAsync(task).exceptionally(t -> {problems.add(t); return null;}); tasks.add( newtask ); } CompletableFuture.allOf(tasks.toArray(new CompletableFuture<?>[]{})).get(10, TimeUnit.SECONDS); for ( Throwable t : problems ) { throw t; } }
Source:
<code>public void testIpAddressToVarcharCast() { assertFunction("CAST(IPADDRESS'::ffff:1.2.3.4' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS'::ffff:102:304' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS'2001:0db8:0000:0000:0000:ff00:0042:8329' AS VARCHAR)", VARCHAR, "2001:db8:0:0:0:ff00:42:8329"); <START> assertFunction("CAST(IPADDRESS'2001:db8::ff00:42:8329' AS VARCHAR)", VARCHAR, "2001:db8:0:0:0:ff00:42:8329"); <END> assertFunction("CAST(CAST('1.2.3.4' AS IPADDRESS) AS VARCHAR)", VARCHAR, "1.2.3.4"); }</code><technical_language>2001:db8::ff00:42:8329 is canonical representation</technical_language>

Target:
public void testIpAddressToVarcharCast() { assertFunction("CAST(IPADDRESS '::ffff:1.2.3.4' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS '::ffff:102:304' AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(IPADDRESS '2001:0db8:0000:0000:0000:ff00:0042:8329' AS VARCHAR)", VARCHAR, "2001:db8::ff00:42:8329"); assertFunction("CAST(IPADDRESS '2001:db8::ff00:42:8329' AS VARCHAR)", VARCHAR, "2001:db8::ff00:42:8329"); assertFunction("CAST(IPADDRESS '2001:db8:0:0:1:0:0:1' AS VARCHAR)", VARCHAR, "2001:db8::1:0:0:1"); assertFunction("CAST(CAST('1.2.3.4' AS IPADDRESS) AS VARCHAR)", VARCHAR, "1.2.3.4"); assertFunction("CAST(CAST('2001:db8:0:0:1::1' AS IPADDRESS) AS VARCHAR)", VARCHAR, "2001:db8::1:0:0:1"); assertFunction("CAST(CAST('64:ff9b::10.0.0.0' AS IPADDRESS) AS VARCHAR)", VARCHAR, "64:ff9b::a00:0"); }
Source:
<code>public static String languageCodeToWikiLanguageCode(String code) { switch (code) { case "iw": return "he"; case "in": return "id"; case "ji": return "yi"; case "zh": if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { <START> String script = Locale.getDefault().getScript(); <END> return "Hant".equals(script) ? AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE : AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE; } return isTraditionalChinesePredominantInCountry(Locale.getDefault().getCountry()) ? AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE : AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE; default: return code; } }</code><technical_language>Locale.getDefault().getDisplayVariant() works for getScript() returns empty string</technical_language>

Target:
public static String languageCodeToWikiLanguageCode(String code) { switch (code) { case "iw": return "he"; case "in": return "id"; case "ji": return "yi"; case "zh": return chineseLanguageCodeToWikiLanguageCode(); default: return code; } }
Source:
<code>public void dispose() { super.dispose(); <START> for (Resource disposable : this.disposables) { <END> disposable.dispose(); } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
public void dispose() { super.dispose(); for (Resource disposable : this.disposables) disposable.dispose(); }
Source:
<code>public ConnectedChannel checkOutConnection(String host, Port port, long timeout) throws IOException, InterruptedException, ConnectionPoolTimeoutException { if (port.getPortType() == PortType.PLAINTEXT) { return new MockConnection(host, port.getPortNo(), messageInfoList.get(host + port.getPortNo()), byteBufferList.get(host + port.getPortNo()), maxEntriesToReturn); } else { return new MockSSLConnection(host, port.getPortNo(), messageInfoList.get(host + port.getPortNo()), <START> byteBufferList.get(host + port.getPortNo()), maxEntriesToReturn); <END> } }</code><technical_language>a MockSSLConnection do</technical_language>

Target:
public ConnectedChannel checkOutConnection(String host, Port port, long timeout) throws IOException, InterruptedException, ConnectionPoolTimeoutException { return new MockConnection(host, port.getPort(), messageInfoList.get(host + port), byteBufferList.get(host + port), maxEntriesToReturn); }
Source:
<code>public static boolean downloadAvailablePlansForSite(boolean force, final Blog blog, final AvailablePlansListener listener) { <START> if (!PlansUtils.isPlanFeatureAvailableForBlog(blog)) { <END> return false; } if (!force && PlansUtils.getAvailablePlansForSite(blog) != null) { return false; } Map<String, String> params = getDefaultRestCallParameters(); WordPress.getRestClientUtils().get("sites/" + blog.getDotComBlogId() + "/plans", params, null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (response != null) { AppLog.d(AppLog.T.PLANS, response.toString()); List<SitePlan> plans = new ArrayList<>(); try { JSONArray planIDs = response.names(); if (planIDs != null) { for (int i=0; i < planIDs.length(); i ++) { String currentKey = planIDs.getString(i); JSONObject currentPlanJSON = response.getJSONObject(currentKey); SitePlan currentPlan = new SitePlan(Long.valueOf(currentKey), currentPlanJSON, blog); plans.add(currentPlan); } } availablePlansForSites.put(blog.getLocalTableBlogId(), plans); if (listener!= null) { listener.onResponse(plans); } } catch (JSONException e) { AppLog.e(AppLog.T.PLANS, "Can't parse the plans list returned from the server", e); if (listener!= null) { listener.onError(e); } } } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(AppLog.T.UTILS, "Error", volleyError); if (listener!= null) { listener.onError(volleyError); } } }); return true; }</code><technical_language>For safety check for a null blog here</technical_language>

Target:
public static boolean downloadAvailablePlansForSite(boolean force, final Blog blog, final AvailablePlansListener listener) { if (blog == null || !PlansUtils.isPlanFeatureAvailableForBlog(blog)) { return false; } if (!force && PlansUtils.getAvailablePlansForSite(blog) != null) { return false; } Map<String, String> params = getDefaultRestCallParameters(); WordPress.getRestClientUtils().get("sites/" + blog.getDotComBlogId() + "/plans", params, null, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (response != null) { AppLog.d(AppLog.T.PLANS, response.toString()); List<SitePlan> plans = new ArrayList<>(); try { JSONArray planIDs = response.names(); if (planIDs != null) { for (int i=0; i < planIDs.length(); i ++) { String currentKey = planIDs.getString(i); JSONObject currentPlanJSON = response.getJSONObject(currentKey); SitePlan currentPlan = new SitePlan(Long.valueOf(currentKey), currentPlanJSON, blog); plans.add(currentPlan); } } availablePlansForSites.put(blog.getLocalTableBlogId(), plans); if (listener!= null) { listener.onResponse(plans); } } catch (JSONException e) { AppLog.e(AppLog.T.PLANS, "Can't parse the plans list returned from the server", e); if (listener!= null) { listener.onError(e); } } } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(AppLog.T.UTILS, "Error", volleyError); if (listener!= null) { listener.onError(volleyError); } } }); return true; }
Source:
<code><START> protected void completeNode() { <END> if (nodeBuilder == null) { return; } nodeBuilder.setOperation(getOperationName()); nodeBuilder.setDuration(Duration.between(getStart(), Instant.now()).toMillis()); traceContext.getNodeProcessors().forEach( np -> np.process(this, nodeBuilder)); traceContext.endProcessingNode(); nodeBuilder = null; }</code><technical_language>this private</technical_language>

Target:
private void completeNode() { if (nodeBuilder == null) { return; } nodeBuilder.setOperation(getOperationName()); nodeBuilder.setDuration(Duration.between(getStart(), Instant.now()).toNanos()); traceContext.getNodeProcessors().forEach( np -> np.process(traceContext, this, nodeBuilder)); traceContext.endProcessingNode(); nodeBuilder = null; }
Source:
<code>private Document makeEnhancementOperationBody(String userid, String filePath, String mimeType, Boolean force) { Document msg = new Document(); Element entry = new Element("entry", ATOM_NS); entry.addContent(new Element("author", ATOM_NS) .addContent(new Element("name", ATOM_NS).setText(userid))); entry.addContent(new Element("pid", ATOM_NS).setText(filePath)); entry.addContent(new Element("mimeType", ATOM_NS).setText(mimeType)); if (force) { Element paramForce = new Element("force", CDR_MESSAGE_NS); <START> paramForce.setText("force"); <END> } msg.addContent(entry); return msg; }</code><technical_language>matter much, submit "true"</technical_language>

Target:
private Document makeEnhancementOperationBody(String userid, String filePath, String mimeType, Boolean force) { Document msg = new Document(); Element entry = new Element("entry", ATOM_NS); entry.addContent(new Element("author", ATOM_NS) .addContent(new Element("name", ATOM_NS).setText(userid))); entry.addContent(new Element("pid", ATOM_NS).setText(filePath)); entry.addContent(new Element("mimeType", ATOM_NS).setText(mimeType)); if (force) { Element paramForce = new Element("force", CDR_MESSAGE_NS); paramForce.setText("true"); } msg.addContent(entry); return msg; }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getArtUuid() == null) ? 0 : getArtUuid().hashCode()); <START> result = prime * result + ((getBranchId().isInvalid()) ? 0 : getBranchId().hashCode()); <END> return result; }</code><technical_language>result = prime * result + getBranchId().hashCode(); BranchId's hashCode method branchId is allowed null work id is valid</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getArtUuid() == null) ? 0 : getArtUuid().hashCode()); result = prime * result + getBranchId().hashCode(); return result; }
Source:
<code>public void setDecoderResult(DecoderResult decoderResult) { ObjectUtil.checkNotNull(decoderResult, "decoderResult"); <START> this.decoderResult = decoderResult; <END> }</code><technical_language>nit: merge lines checkNotNull return argument</technical_language>

Target:
public void setDecoderResult(DecoderResult decoderResult) { this.decoderResult = ObjectUtil.checkNotNull(decoderResult, "decoderResult"); }
Source:
<code>public static boolean <START> treatAsClick(MouseEvent <END> downEvent, MouseEvent upEvent) { if ((upEvent.time - downEvent.time) < 150) { return true; } else if (((upEvent.x > (downEvent.x + 5)) || (upEvent.x < (downEvent.x - 5))) || ((upEvent.y > (downEvent.y + 5)) || (upEvent.y < (downEvent.y - 5)))) { return false; } return true; }</code><technical_language>implement a click sounds more definition of a "swipe". a click defined down/up event a pixel area only? matter long user decides wait releases mouse "breaches" confines of click-area (e.g. 5x5 pixels). if time account clicks, events click-area, more of a swipe gesture a click..</technical_language>

Target:
public static boolean treatAsClick(MouseEvent downEvent, MouseEvent upEvent) { if (((upEvent.x > (downEvent.x + 5)) || (upEvent.x < (downEvent.x - 5))) || ((upEvent.y > (downEvent.y + 5)) || (upEvent.y < (downEvent.y - 5)))) { return false; } return true; }
Source:
<code>String[] getExecutorCommand() { String topologyDefFile = getTopologyDefnFile(); Topology topology = getTopology(topologyDefFile); Config config = SchedulerConfigUtils.loadConfig(cluster, role, env, topologyJar, topologyDefFile, verboseMode, topology, <START> "0", "20"); <END> List<Integer> freePorts = new ArrayList<>(SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR); for (int i = 0; i < SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR; i++) { freePorts.add(SysUtils.getFreePort()); } Config runtime = Config.newBuilder() .put(Key.COMPONENT_RAMMAP, componentRamMap) .put(Key.TOPOLOGY_DEFINITION, topology) .build(); String[] executorCmd = SchedulerUtils.executorCommand(config, runtime, heronExecutorId, freePorts); LOG.info("Executor command line: " + Arrays.toString(executorCmd)); return executorCmd; }</code><technical_language>hard coded strings represent integers</technical_language>

Target:
String[] getExecutorCommand() { String topologyDefFile = getTopologyDefnFile(); Topology topology = getTopology(topologyDefFile); Config config = SchedulerConfigUtils.loadConfig(cluster, role, env, topologyJar, topologyDefFile, verboseMode, topology); List<Integer> freePorts = new ArrayList<>(SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR); for (int i = 0; i < SchedulerUtils.PORTS_REQUIRED_FOR_EXECUTOR; i++) { freePorts.add(SysUtils.getFreePort()); } Config runtime = Config.newBuilder() .put(Key.COMPONENT_RAMMAP, componentRamMap) .put(Key.TOPOLOGY_DEFINITION, topology) .build(); String[] executorCmd = SchedulerUtils.executorCommand(config, runtime, heronExecutorId, freePorts); LOG.info("Executor command line: " + Arrays.toString(executorCmd)); return executorCmd; }
Source:
<code>public void onTextChanged(CharSequence s, int start, int before, int count) { _after = String.valueOf(s.subSequence(start, start + count)); _afterlen = _after.length(); <START> currentMessageMillis = System.currentTimeMillis(); <END> if (lastMessageMillis == 0) { lastMessageMillis = currentMessageMillis; } if (_afterlen > _beforelen) { if (_after.startsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(_before.length(), _after.length())); addTextEvent(changedPart, start + _before.length()); } else if (_after.endsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(0, _after.length() - _before.length())); addTextEvent(changedPart, start); } else { addEraseEvent(before, start + before); addTextEvent(_after, start); } } else if (_afterlen == _beforelen) { addEraseEvent(before, start + before); addTextEvent(_after, start); } else { if (_before.startsWith(_after)) { addEraseEvent(_beforelen - _afterlen, start + _beforelen); } else if (_before.endsWith(_after)) { addEraseEvent(_beforelen - _afterlen, start + _beforelen - _afterlen); } else { addEraseEvent(before, start + before); addTextEvent(_after, start); } } }</code><technical_language>for catching this earlier. need [SystemClock.elapsedRealtime()](<LINK_0> System.currentTimeMillis() change if set phones clock</technical_language>

Target:
public void onTextChanged(CharSequence s, int start, int before, int count) { if (!conversationFragment.ignoreOneEvent.get()) { int position; _after = String.valueOf(s.subSequence(start, start + count)); currentMessageMillis = SystemClock.elapsedRealtime(); if (lastMessageMillis == 0) { lastMessageMillis = currentMessageMillis; } if (_after.length() > _before.length()) { if (_after.startsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(_before.length(), _after.length())); position = start + _before.length(); addTextEvent(changedPart, position == length_before ? null : position); } else if (_after.endsWith(_before)) { String changedPart = String.valueOf(_after.subSequence(0, _after.length() - _before.length())); position = start; addTextEvent(changedPart, position == length_before ? null : position); } else { position = start + before; addEraseEvent(before, position == length_before ? null : position); addTextEvent(_after, start); } } else if (_after.length() == _before.length()) { position = start + before; addEraseEvent(before, position == length_before ? null : position); addTextEvent(_after, start); } else { if (_before.startsWith(_after)) { position = start + _before.length(); addEraseEvent(_before.length() - _after.length(), position == length_before ? null : position); } else if (_before.endsWith(_after)) { position = start + _before.length() - _after.length(); addEraseEvent(_before.length() - _after.length(), position == length_before ? null : position); } else { position = start + before; addEraseEvent(before, position == length_before ? null : position); addTextEvent(_after, start); } } } }
Source:
<code>public Result<Void> deleteStorage(final String id) { if (!storageDbRepository.getStorage(id).isPresent()) { return Result.notFound("No storage with ID " + id); } if (storageDbRepository.isStorageUsed(id)) { return Result.forbidden("Storage " + id + " is in use"); } try { storageDbRepository.deleteStorage(id); <START> } catch (DataAccessException e) { <END> return Result.problem(Problem.valueOf(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage())); } return Result.ok(); }</code><technical_language>For this is a bit mixing of layers. I DataAccessException caught repository level throw more business-ish exception</technical_language>

Target:
public Result<Void> deleteStorage(final String id) { try { if (!storageDbRepository.getStorage(id).isPresent()) { return Result.notFound("No storage with ID " + id); } if (storageDbRepository.isStorageUsed(id)) { return Result.forbidden("Storage " + id + " is in use"); } storageDbRepository.deleteStorage(id); } catch (InternalNakadiException e) { return Result.problem(Problem.valueOf(INTERNAL_SERVER_ERROR, e.getMessage())); } return Result.ok(); }
Source:
<code>public default NodalCurve shiftedBy(List<ValueAdjustment> adjustments) { double[] yValues = getYValues(); <START> double[] shifted = new double[yValues.length]; <END> int minSize = Math.min(yValues.length, adjustments.size()); for (int i = 0; i < minSize; i++) { shifted[i] = adjustments.get(i).adjust(yValues[i]); } return withYValues(shifted); }</code><technical_language>This double[] shifted = yValues.clone(); existing logic loses Y values adjusted replaces zeros</technical_language>

Target:
public default NodalCurve shiftedBy(List<ValueAdjustment> adjustments) { double[] yValues = getYValues(); double[] shifted = yValues.clone(); int minSize = Math.min(yValues.length, adjustments.size()); for (int i = 0; i < minSize; i++) { shifted[i] = adjustments.get(i).adjust(yValues[i]); } return withYValues(shifted); }
Source:
<code>private Map<String, String> getVars(@Nonnull String content, @Nonnull Map<String, String> currentEnvVars) throws EnvInjectException { String escapedContent = content; <START> escapedContent = escapedContent.replaceAll("(?<=[^\\\\])\\\\(?=[^n])(?=[^\\\\])(?=[^\n])", "\\\\\\\\"); <END> Map<String, String> result = new LinkedHashMap<String, String>(); StringReader stringReader = new StringReader(escapedContent); Properties properties = new Properties(); try { properties.load(stringReader); } catch (IOException ioe) { throw new EnvInjectException("Problem occurs on loading content", ioe); } finally { stringReader.close(); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { result.put(processElement(entry.getKey(), currentEnvVars), processElement(entry.getValue(), currentEnvVars)); } return result; }</code><technical_language>suggestion escapedContent = escapedContent.replaceAll("(?<=[^\\\\])\\\\(?![n|:|*|?|\"|<|>|\\||\\/])(?![\\\\])(?![\n])", "\\\\\\\\"); If do this change github example incompatibility</technical_language>

Target:
private Map<String, String> getVars(@Nonnull String content, @Nonnull Map<String, String> currentEnvVars) throws EnvInjectException { String escapedContent = content; escapedContent = escapedContent.replaceAll("(?<=[^\\\\])\\\\(?![n|:|*|?|\"|<|>|\\||\\/])(?![\\\\])(?![\n])", "\\\\\\\\"); Map<String, String> result = new LinkedHashMap<String, String>(); StringReader stringReader = new StringReader(escapedContent); Properties properties = new Properties(); try { properties.load(stringReader); } catch (IOException ioe) { throw new EnvInjectException("Problem occurs on loading content", ioe); } finally { stringReader.close(); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { result.put(processElement(entry.getKey(), currentEnvVars), processElement(entry.getValue(), currentEnvVars)); } return result; }
Source:
<code><START> public String[] getFileSuffixes() { <END> String[] suffixes = configuration.getStringArray(FILE_SUFFIXES_KEY); if (suffixes == null || suffixes.length == 0) { suffixes = StringUtils.split(FILE_SUFFIXES_DEFVALUE, ","); } return suffixes; }</code><technical_language>simplify this implementation done for TS</technical_language>

Target:
public String[] getFileSuffixes() { return configuration.getStringArray(FILE_SUFFIXES_KEY); }
Source:
<code>public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { this.className = name; super.visit(version, access, name, signature, superName, interfaces); <START> if(class_out != null) <END> class_out.println(className + " References:"); }</code><technical_language>Missing a bracket</technical_language>

Target:
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { this.className = name; super.visit(version, access, name, signature, superName, interfaces); if(class_out != null) { class_out.println(className + " References:"); } }
Source:
<code>public void throwsWhenNullValueInResponse() { assertThrows(AzureException.class, () -> { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); values.put(ManagementChannel.MANAGEMENT_RESULT_CREATED_AT, createdAtAsDate); values.put(ManagementChannel.MANAGEMENT_RESULT_PARTITION_IDS, null); final AmqpValue amqpValue = new AmqpValue(values); final Message message = Proton.message(); message.setBody(amqpValue); <START> serializer.deserialize(message, EventHubProperties.class); <END> }); }</code><technical_language>this line in assertThrows(() -> {}), scope expect error be</technical_language>

Target:
public void throwsWhenNullValueInResponse() { final String eventHubName = "event-hub-name-test"; final Date createdAtAsDate = new Date(1569275540L); final Map<String, Object> values = new HashMap<>(); values.put(ManagementChannel.MANAGEMENT_ENTITY_NAME_KEY, eventHubName); values.put(ManagementChannel.MANAGEMENT_RESULT_CREATED_AT, createdAtAsDate); values.put(ManagementChannel.MANAGEMENT_RESULT_PARTITION_IDS, null); final AmqpValue amqpValue = new AmqpValue(values); final Message message = Proton.message(); message.setBody(amqpValue); assertThrows(AzureException.class, () -> { serializer.deserialize(message, EventHubProperties.class); }); }
Source:
<code>public void init() { String remoteHost = String.format(EVENTHUB_REMOTE_HOST_FORMAT, eventHubNamespace); try { ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder() .setNamespaceName(eventHubNamespace) .setEventHubName(entityPath) .setSasKeyName(sasKeyName) .setSasKey(sasKey); eventHubClient = EventHubClient.createSync(connectionStringBuilder.toString(), retryPolicy, <START> Executors.newFixedThreadPool(numClientThreads)); <END> } catch (IOException | EventHubException e) { String msg = String.format("Creation of EventHub client failed for eventHub EntityPath: %s on remote host %s:%d", entityPath, remoteHost, ClientConstants.AMQPS_PORT); LOG.error(msg, e); throw new SamzaException(msg, e); } }</code><technical_language>this need shut this client is stopped? Do threads need daemon? name threads in this pool. Convention: "Samza EventHubClient Thread-%d"</technical_language>

Target:
public void init() { String remoteHost = String.format(EVENTHUB_REMOTE_HOST_FORMAT, eventHubNamespace); try { ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder() .setNamespaceName(eventHubNamespace) .setEventHubName(entityPath) .setSasKeyName(sasKeyName) .setSasKey(sasKey); ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder().setNameFormat("Samza EventHubClient Thread-%d"); eventHubClientExecutor = Executors.newFixedThreadPool(numClientThreads, threadFactoryBuilder.build()); eventHubClient = EventHubClient.createSync(connectionStringBuilder.toString(), retryPolicy, eventHubClientExecutor); } catch (IOException | EventHubException e) { String msg = String.format("Creation of EventHub client failed for eventHub EntityPath: %s on remote host %s:%d", entityPath, remoteHost, ClientConstants.AMQPS_PORT); LOG.error(msg, e); throw new SamzaException(msg, e); } }