auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void applyPaddingStrategy(TimelineMetric metric, TemporalInfo temporalInfo) { if (strategy.equals(PADDING_STRATEGY.NONE) || temporalInfo == null) { return; } TreeMap<Long, Double> values = metric.getMetricValues(); if (values==null || values.isEmpty()) { return; } long intervalStartTime = longToMillis(temporalInfo.getStartTime()); long intervalEndTime = longToMillis(temporalInfo.getEndTime()); long dataStartTime = longToMillis(values.firstKey()); long dataEndTime = longToMillis(values.lastKey()); <START> if (intervalEndTime < 0) { <END> intervalEndTime = values.lastKey(); } long dataInterval = getTimelineMetricInterval(values, intervalStartTime, intervalEndTime); if (dataInterval == -1 || dataInterval < MINIMUM_STEP_INTERVAL) { dataInterval = temporalInfo.getStep() != null ? temporalInfo.getStep() : -1; } if (dataInterval == -1) { return; } Double paddingValue = 0.0d; if (strategy.equals(PADDING_STRATEGY.NULLS)) { paddingValue = null; } for (long counter = intervalStartTime; counter < dataStartTime; counter += dataInterval) { values.put(counter, paddingValue); } for (long counter = dataEndTime + dataInterval; counter <= intervalEndTime; counter += dataInterval) { values.put(counter, paddingValue); } metric.setMetricValues(values); }</code><technical_language>start < end is verified pre-condition already</technical_language>

Target:
public void applyPaddingStrategy(TimelineMetric metric, TemporalInfo temporalInfo) { if (strategy.equals(PADDING_STRATEGY.NONE) || temporalInfo == null) { return; } TreeMap<Long, Double> values = metric.getMetricValues(); if (values==null || values.isEmpty()) { return; } long intervalStartTime = longToMillis(temporalInfo.getStartTime()); long intervalEndTime = longToMillis(temporalInfo.getEndTime()); long dataStartTime = longToMillis(values.firstKey()); long dataEndTime = longToMillis(values.lastKey()); if (intervalEndTime < 0) { intervalEndTime = dataEndTime; } if (intervalStartTime > intervalEndTime) { return; } long dataInterval = getTimelineMetricInterval(values, intervalStartTime, intervalEndTime); if (dataInterval == -1 || dataInterval < MINIMUM_STEP_INTERVAL) { dataInterval = temporalInfo.getStep() != null ? temporalInfo.getStep() : -1; } if (dataInterval == -1) { return; } Double paddingValue = 0.0d; if (strategy.equals(PADDING_STRATEGY.NULLS)) { paddingValue = null; } for (long counter = intervalStartTime; counter < dataStartTime; counter += dataInterval) { values.put(counter, paddingValue); } for (long counter = dataEndTime + dataInterval; counter <= intervalEndTime; counter += dataInterval) { values.put(counter, paddingValue); } metric.setMetricValues(values); }
Source:
<code>protected void onEditTextChanged() { Dialog dlg = getDialog(); if(dlg instanceof AlertDialog) { AlertDialog alertDlg = (AlertDialog)dlg; Button btn = alertDlg.getButton(AlertDialog.BUTTON_POSITIVE); <START> boolean enable = Patterns.WEB_URL.matcher(getEditText().getText().toString()).matches(); <END> btn.setEnabled(enable); if(!enable) { this.getEditText().setError("Invalid URL"); } } }</code><technical_language>this slow end devices</technical_language>

Target:
protected void onEditTextChanged() { Dialog dlg = getDialog(); if(dlg instanceof AlertDialog) { AlertDialog alertDlg = (AlertDialog)dlg; Button btn = alertDlg.getButton(AlertDialog.BUTTON_POSITIVE); boolean enable = Patterns.WEB_URL.matcher(getEditText().getText().toString()).matches(); btn.setEnabled(enable); } }
Source:
<code>public void nonEmptyListOfObjectsToNullableArrayOfStrings() { List<Object> list = new ArrayList<Object>(3); list.add(1); list.add(null); list.add(3); String[] array = InternalQueries.nullableArrayOfStrings(list); assertThat(array).isNotNull(); <START> assertThat(array.length).isEqualTo(list.size()); <END> assertThat(array[0]).isEqualTo("1"); assertThat(array[1]).isEqualTo("null"); assertThat(array[2]).isEqualTo("3"); }</code><technical_language>assertThat(array).hasSameSizeAs</technical_language>

Target:
public void nonEmptyListOfObjectsToNullableArrayOfStrings() { List<Object> list = new ArrayList<Object>(3); list.add(1); list.add(null); list.add(3); String[] array = InternalQueries.nullableArrayOfStrings(list); assertThat(array).containsExactly("1", "null", "3"); }
Source:
<code><START> public AnnotationMetadata(String vepVersion, String cacheVersion) { <END> this.vepVersion = vepVersion; this.cacheVersion = cacheVersion; }</code><technical_language>_id a combination of attributes, ensure consistency enforced application layer</technical_language>

Target:
public AnnotationMetadata(String vepVersion, String cacheVersion) { this.id = vepVersion + "_" + cacheVersion; this.vepVersion = vepVersion; this.cacheVersion = cacheVersion; }
Source:
<code>public static EmbeddedForeignKeyDescriptor buildEmbeddedForeignKeyDescriptor( EmbeddableValuedModelPart fkTarget, AbstractAttributeMapping attributeMapping, Value bootValueMapping, Dialect dialect, MappingModelCreationProcess creationProcess) { final List<String> keyColumnExpressions = new ArrayList<>(); bootValueMapping.getColumnIterator().forEachRemaining( column -> keyColumnExpressions.add( column.getText( dialect ) ) ); final List<String> targetColumnExpressions = new ArrayList<>(); fkTarget.getMappedColumnExpressions().forEach( column -> targetColumnExpressions.add( column ) ); <START> return new EmbeddedForeignKeyDescriptor( <END> (EmbeddedIdentifierMappingImpl) fkTarget, getTableIdentifierExpression( bootValueMapping.getTable(), creationProcess ), keyColumnExpressions, fkTarget.getContainingTableExpression(), targetColumnExpressions, creationProcess ); }</code><technical_language>ArrayList size in constructor avoid performance memory overhead, a big deal</technical_language>

Target:
public static EmbeddedForeignKeyDescriptor buildEmbeddedForeignKeyDescriptor( EmbeddableValuedModelPart fkTarget, AbstractAttributeMapping attributeMapping, Value bootValueMapping, Dialect dialect, MappingModelCreationProcess creationProcess) { final List<String> keyColumnExpressions = new ArrayList<>(bootValueMapping.getColumnSpan()); bootValueMapping.getColumnIterator().forEachRemaining( column -> keyColumnExpressions.add( column.getText( dialect ) ) ); final List<String> mappedColumnExpressions = fkTarget.getMappedColumnExpressions(); final List<String> targetColumnExpressions = new ArrayList<>( mappedColumnExpressions.size() ); mappedColumnExpressions.forEach( column -> targetColumnExpressions.add( column ) ); return new EmbeddedForeignKeyDescriptor( (EmbeddedIdentifierMappingImpl) fkTarget, getTableIdentifierExpression( bootValueMapping.getTable(), creationProcess ), keyColumnExpressions, fkTarget.getContainingTableExpression(), targetColumnExpressions, creationProcess ); }
Source:
<code><START> public void sendEmailsForWorkspace(WorkspaceMetacardImpl workspaceMetacard, Long hitCount) { <END> subscriptionsPersistentStore .getEmails(workspaceMetacard.getId()) .forEach(email -> sendEmailForWorkspace(workspaceMetacard, hitCount, email)); }</code><technical_language>This protected package-private</technical_language>

Target:
void sendEmailsForWorkspace(WorkspaceMetacardImpl workspaceMetacard, Long hitCount) { subscriptionsPersistentStore .getEmails(workspaceMetacard.getId()) .forEach(email -> sendEmailForWorkspace(workspaceMetacard, hitCount, email)); }
Source:
<code>public static String getCssIdentifier(String string) { Pattern pattern = Pattern.create("(^[a-zA-Z][a-zA-Z0-9\\-\\_]+$)|(^-[a-zA-Z][a-zA-Z0-9\\-\\_]+$)"); <START> if (pattern.test(string)) <END> return string; else { StringBuilder builder = new StringBuilder(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (c == '_' || c > 0x00A0 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (i > 0 && (c == '-' || (c >= '0' && c <= '9')))) builder.append(c); else builder.append("x"); } return builder.toString(); } }</code><technical_language>nit: a matter of style, I include braces branch of if-else, include them. (Otherwise easy miss in a refactor)</technical_language>

Target:
public static String getCssIdentifier(String string) { Pattern pattern = Pattern.create("(^-?[a-zA-Z_][a-zA-Z0-9\\-_]+$)"); if (pattern.test(string)) return string; else { StringBuilder builder = new StringBuilder(); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); if (c == '_' || c > 0x00A0 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (i > 0 && (c == '-' || (c >= '0' && c <= '9')))) builder.append(c); else builder.append("_"); } return builder.toString(); } }
Source:
<code>private RuntimeEnvironment() { configuration = new Configuration(); configLock = new ReentrantReadWriteLock(); <START> authFrameworkLock = new ReentrantLock(); <END> watchDog = new WatchDogService(); lzIndexerParallelizer = LazilyInstantiate.using(() -> new IndexerParallelizer(this)); lzSearchExecutor = LazilyInstantiate.using(() -> newSearchExecutor()); }</code><technical_language>i this new Object() synchronize object</technical_language>

Target:
private RuntimeEnvironment() { configuration = new Configuration(); configLock = new ReentrantReadWriteLock(); watchDog = new WatchDogService(); lzIndexerParallelizer = LazilyInstantiate.using(() -> new IndexerParallelizer(this)); lzSearchExecutor = LazilyInstantiate.using(() -> newSearchExecutor()); }
Source:
<code>public final void retrievesKeys() throws Exception { final PublicKeys keys = this.keys(); MatcherAssert.assertThat( keys.iterate(), <START> Matchers.<PublicKey>iterableWithSize(2) <END> ); }</code><technical_language>hm... two? get this number</technical_language>

Target:
public final void retrievesKeys() throws Exception { final PublicKeys keys = this.keys(); final PublicKey key = keys.create("key", "ssh 1AA"); MatcherAssert.assertThat( keys.iterate(), Matchers.hasItem(key) ); keys.remove(key.number()); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); if (gfRepo == null) { return null; } InputDialog inputDialog = new StartDialog( HandlerUtil.getActiveShell(event), UIText.FeatureStartHandler_provideFeatureName, UIText.FeatureStartHandler_pleaseProvideANameForTheNewFeature, "", new FeatureNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return null; } final String featureName = inputDialog.getValue(); int timeout = Activator.getDefault().getPreferenceStore() .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT); FeatureStartOperation featureStartOperation = new FeatureStartOperation( gfRepo, featureName, timeout); JobUtil.scheduleUserWorkspaceJob(featureStartOperation, UIText.FeatureStartHandler_startingNewFeature, JobFamilies.GITFLOW_FAMILY); IJobManager jobMan = Job.getJobManager(); try { jobMan.join(GITFLOW_FAMILY, null); } catch (OperationCanceledException | InterruptedException e) { return error(e.getMessage(), e); <START> } <END> BranchOperationUI.handleSingleRepositoryCheckoutOperationResult( gfRepo.getRepository(), featureStartOperation.getCheckoutResult(), gfRepo.getConfig().getFullFeatureBranchName(featureName)); return null; }</code><technical_language>good; this blocks UI thread. point running operation in a background job then</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); if (gfRepo == null) { return null; } InputDialog inputDialog = new StartDialog( HandlerUtil.getActiveShell(event), UIText.FeatureStartHandler_provideFeatureName, UIText.FeatureStartHandler_pleaseProvideANameForTheNewFeature, "", new FeatureNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return null; } final String featureName = inputDialog.getValue(); int timeout = Activator.getDefault().getPreferenceStore() .getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT); GitFlowOperation operation = new FeatureStartOperation( gfRepo, featureName, timeout); String fullBranchName = gfRepo.getConfig() .getFullFeatureBranchName(featureName); JobUtil.scheduleUserWorkspaceJob(operation, UIText.FeatureStartHandler_startingNewFeature, JobFamilies.GITFLOW_FAMILY, new PostBranchCheckoutUiTask(gfRepo, fullBranchName, operation)); return null; }
Source:
<code>private RetryRegistry createRetryRegistry( RetryConfigurationProperties retryConfigurationProperties, RegistryEventConsumer<Retry> retryRegistryEventConsumer, CompositeCustomizer<RetryConfigCustomizer> compositeRetryCustomizer) { Map<String, RetryConfig> configs = retryConfigurationProperties.getConfigs() .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> retryConfigurationProperties .createRetryConfig(entry.getValue(), compositeRetryCustomizer, entry.getKey()))); <START> return RetryRegistry.of(configs, retryRegistryEventConsumer, retryConfigurationProperties.getTags()); <END> }</code><technical_language>I create a defensive copy of Map</technical_language>

Target:
private RetryRegistry createRetryRegistry( RetryConfigurationProperties retryConfigurationProperties, RegistryEventConsumer<Retry> retryRegistryEventConsumer, CompositeCustomizer<RetryConfigCustomizer> compositeRetryCustomizer) { Map<String, RetryConfig> configs = retryConfigurationProperties.getConfigs() .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> retryConfigurationProperties .createRetryConfig(entry.getValue(), compositeRetryCustomizer, entry.getKey()))); return RetryRegistry.of(configs, retryRegistryEventConsumer, Map.copyOf(retryConfigurationProperties.getTags())); }
Source:
<code>public void testUpgradeNotAllowed() throws Exception { setOldTimestampToInduceUpgrade = true; SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver = firstConnectionNSMappingServerEnabledClientEnabled(); driver.resetCQS(); Properties clientProps = getClientProperties(true, true); UpgradeUtil.doNotUpgradeOnFirstConnection(clientProps); setOldTimestampToInduceUpgrade = false; try { driver.getConnectionQueryServices(getJdbcUrl(), clientProps); } catch (Exception e) { assertTrue(e instanceof UpgradeRequiredException); } assertEquals(hbaseTables, getHBaseTables()); assertEquals(1, countUpgradeAttempts); assertEquals(0, actualSysCatUpgrades); Connection conn = driver.getConnectionQueryServices(getJdbcUrl(), new Properties()).connect(getJdbcUrl(), new Properties()); try { conn.createStatement().execute(EXECUTE_UPGRADE_COMMAND); assertEquals(1, actualSysCatUpgrades); <START> } catch (Exception e) { <END> fail("EXECUTE UPGRADE should not fail"); } finally { conn.close(); } }</code><technical_language>remove catch block</technical_language>

Target:
public void testUpgradeNotAllowed() throws Exception { setOldTimestampToInduceUpgrade = true; SystemCatalogCreationOnConnectionIT.PhoenixSysCatCreationTestingDriver driver = firstConnectionNSMappingServerEnabledClientEnabled(); driver.resetCQS(); Properties clientProps = getClientProperties(true, true); UpgradeUtil.doNotUpgradeOnFirstConnection(clientProps); setOldTimestampToInduceUpgrade = false; try { driver.getConnectionQueryServices(getJdbcUrl(), clientProps); } catch (Exception e) { assertTrue(e instanceof UpgradeRequiredException); } assertEquals(hbaseTables, getHBaseTables()); assertEquals(1, countUpgradeAttempts); assertEquals(0, actualSysCatUpgrades); Connection conn = driver.getConnectionQueryServices(getJdbcUrl(), new Properties()).connect(getJdbcUrl(), new Properties()); try { conn.createStatement().execute(EXECUTE_UPGRADE_COMMAND); assertEquals(1, actualSysCatUpgrades); } finally { conn.close(); } }
Source:
<code>public SSLConfig build() { final String sniProxyProperty = System.getProperty(GEMFIRE_PREFIX + "security.sni-proxy"); final InetSocketAddress sniProxyAddress; if (sniProxyProperty == null) { sniProxyAddress = null; } else { try { <START> final URL parser = new URL("http://" + sniProxyProperty); <END> final String host = parser.getHost(); final int port = parser.getPort(); sniProxyAddress = new InetSocketAddress(host, port); } catch (MalformedURLException e) { throw new RuntimeException(e); } } return new SSLConfig(endpointIdentification, useDefaultSSLContext, enabled, protocols, ciphers, requireAuth, keystore, keystoreType, keystorePassword, truststore, truststorePassword, truststoreType, alias, securableCommunicationChannel, properties, sslParameterExtension, sniProxyAddress); }</code><technical_language>is purpose of passing http URL here? I parsers in Geode for splitting host:port</technical_language>

Target:
public SSLConfig build() { return new SSLConfig(endpointIdentification, useDefaultSSLContext, enabled, protocols, ciphers, requireAuth, keystore, keystoreType, keystorePassword, truststore, truststorePassword, truststoreType, alias, securableCommunicationChannel, properties, sslParameterExtension, getSniProxyAddress()); }
Source:
<code><START> public void onDestroy() { <END> if (mBannerSpot != null) { mBannerSpot.destroy(); mBannerSpot = null; } }</code><technical_language>mInterstitialContext cleared here. if (mInterstitialContext != null) { mInterstitialContext.clear(); mInterstitialContext = null; }</technical_language>

Target:
public void onDestroy() { if (mBannerSpot != null) { mBannerSpot.destroy(); mBannerSpot = null; } if (mInterstitialSpot != null) { mInterstitialSpot.destroy();; mInterstitialSpot = null; } if (mInterstitialContext != null) { mInterstitialContext.clear(); mInterstitialContext = null; } }
Source:
<code>private void checkAuth(SentinelServersConfig cfg) { boolean connected = false; for (String address : cfg.getSentinelAddresses()) { RedisURI addr = new RedisURI(address); scheme = addr.getScheme(); addr = applyNatMap(addr); RedisClient client = createClient(NodeType.SENTINEL, addr, this.config.getConnectTimeout(), this.config.getTimeout(), null); try { RedisConnection c = client.connect(); connected = true; c.sync(RedisCommands.PING); break; <START> } catch (RedisAuthRequiredException e) { <END> usePassword = true; } catch (RedisConnectionException e) { log.warn("Can't connect to sentinel server. {}", e.getMessage()); } catch (Exception e) { } finally { client.shutdown(); } } if (!connected) { stopThreads(); StringBuilder list = new StringBuilder(); for (String address : cfg.getSentinelAddresses()) { list.append(address).append(", "); } throw new RedisConnectionException("Unable to connect to Redis sentinel servers: " + list); } }</code><technical_language>clarify this change help</technical_language>

Target:
private void checkAuth(SentinelServersConfig cfg) { boolean connected = checkConnection(cfg); if (!connected) { stopThreads(); StringBuilder list = new StringBuilder(); for (String address : cfg.getSentinelAddresses()) { list.append(address).append(", "); } throw new RedisConnectionException("Unable to connect to Redis sentinel servers: " + list); } }
Source:
<code>public void locksAndUnlocks() throws Exception { final MkStorage storage = new MkStorage.InFile(); final ExecutorService executor = Executors.newSingleThreadExecutor(); <START> final Runnable secondThread = new Runnable() { <END> @Override public void run() { try { storage.lock(); } catch (IOException ex) { throw new IllegalStateException(ex); } } }; storage.lock(); Future<?> future = executor.submit(secondThread); try { future.get(1, TimeUnit.SECONDS); MatcherAssert.assertThat("timeout should happen", false); } catch (TimeoutException ex) { future.cancel(true); } storage.unlock(); future = executor.submit(secondThread); try { future.get(1, TimeUnit.SECONDS); } catch (TimeoutException ex) { MatcherAssert.assertThat("timeout should NOT happen", false); } }</code><technical_language>I some doubts variable name. Checkstyle shout it</technical_language>

Target:
public void locksAndUnlocks() throws Exception { final MkStorage storage = new MkStorage.InFile(); final ExecutorService executor = Executors.newSingleThreadExecutor(); final Runnable second = new Runnable() { @Override public void run() { try { storage.lock(); } catch (IOException ex) { throw new IllegalStateException(ex); } } }; storage.lock(); Future<?> future = executor.submit(second); try { future.get(1, TimeUnit.SECONDS); MatcherAssert.assertThat("timeout SHOULD happen", false); } catch (TimeoutException ex) { future.cancel(true); } finally { storage.unlock(); } future = executor.submit(second); try { future.get(1, TimeUnit.SECONDS); } catch (TimeoutException ex) { MatcherAssert.assertThat("timeout SHOULD NOT happen", false); future.cancel(true); } executor.shutdown(); }
Source:
<code>public synchronized < T > void removeSource( final Source< T > source ) { final int currentSourceIndex = this.sources.indexOf( source ); <START> if ( this.states.get( source ).typeProperty().get() == TYPE.LABEL ) <END> this.states.get( source ).meshManagerProperty().get().removeAllNeurons(); this.states.remove( source ); this.sources.remove( source ); this.currentSource.set( this.sources.size() == 0 ? null : this.sources.get( Math.max( currentSourceIndex - 1, 0 ) ) ); this.composites.remove( source ); this.removedSources.add( source ); }</code><technical_language>replace this if Optional.ofNullable( this.states.get( source ).meshManagerProperty().get() ).ifPresent( MeshManager::removeAllNeurons ); in future MeshManagers for non-label sources</technical_language>

Target:
public synchronized < T > void removeSource( final Source< T > source ) { final int currentSourceIndex = this.sources.indexOf( source ); Optional.ofNullable( this.states.get( source ).meshManagerProperty().get() ).ifPresent( MeshManager::removeAllNeurons ); this.states.remove( source ); this.sources.remove( source ); this.currentSource.set( this.sources.size() == 0 ? null : this.sources.get( Math.max( currentSourceIndex - 1, 0 ) ) ); this.composites.remove( source ); this.removedSources.add( source ); }
Source:
<code><START> public BruteForce getBruteForce(ScanTarget target) { <END> return this.bruteForceMap.get(target); }</code><technical_language>This (and others ScanTarget) package visible expose ScanTarget, methods ID of scan enough</technical_language>

Target:
BruteForce getBruteForce(ScanTarget target) { return this.bruteForceMap.get(target); }
Source:
<code>public List<SlotExecutionVertexAssignment> allocateSlotsFor( final List<ExecutionVertexSchedulingRequirements> executionVertexSchedulingRequirements) { validateSchedulingRequirements(executionVertexSchedulingRequirements); validateNoCoLocationConstraint(executionVertexSchedulingRequirements); <START> final Set<ExecutionVertexID> allExecutionVertexIds = executionVertexSchedulingRequirements.stream() .map(ExecutionVertexSchedulingRequirements::getExecutionVertexId) .collect(Collectors.toSet()); final Map<ExecutionVertexID, SlotRequestId> executionVertexSlotRequestIds = generateExecutionVertexSlotRequestIds(allExecutionVertexIds); final List<SlotExecutionVertexAssignment> slotExecutionVertexAssignments = createSlotExecutionVertexAssignments(executionVertexSchedulingRequirements, executionVertexSlotRequestIds); final List<CompletableFuture<PhysicalSlotRequest>> physicalSlotRequestFutures = createPhysicalSlotRequestFutures( executionVertexSchedulingRequirements, allExecutionVertexIds, executionVertexSlotRequestIds); allocateSlotsForAssignments( physicalSlotRequestFutures, slotExecutionVertexAssignments, executionVertexSlotRequestIds); return slotExecutionVertexAssignments; <END> }</code><technical_language>suggestion final Map<SlotRequestId, SlotExecutionVertexAssignment> slotExecutionVertexAssignments = createSlotExecutionVertexAssignments(executionVertexSchedulingRequirements); final Map<ExecutionVertexID, SlotRequestId> executionVertexSlotRequestIds = slotExecutionVertexAssignments .entrySet() .stream() .collect(Collectors.toMap(e -> e.getValue().getExecutionVertexId(), Map.Entry::getKey)); final List<CompletableFuture<PhysicalSlotRequest>> physicalSlotRequestFutures = createPhysicalSlotRequestFutures( executionVertexSchedulingRequirements, executionVertexSlotRequestIds); allocateSlotsForAssignments( physicalSlotRequestFutures, slotExecutionVertexAssignments); return new ArrayList<>(slotExecutionVertexAssignments.values()); This a bit indexing... implies some simplification of called private methods</technical_language>

Target:
public List<SlotExecutionVertexAssignment> allocateSlotsFor( final List<ExecutionVertexSchedulingRequirements> executionVertexSchedulingRequirements) { validateSchedulingRequirements(executionVertexSchedulingRequirements); validateNoCoLocationConstraint(executionVertexSchedulingRequirements); final LinkedHashMap<SlotRequestId, SlotExecutionVertexAssignment> slotExecutionVertexAssignments = createSlotExecutionVertexAssignments(executionVertexSchedulingRequirements); final Map<ExecutionVertexID, SlotRequestId> executionVertexSlotRequestIds = slotExecutionVertexAssignments .entrySet() .stream() .collect(Collectors.toMap(e -> e.getValue().getExecutionVertexId(), Map.Entry::getKey)); final List<CompletableFuture<PhysicalSlotRequest>> physicalSlotRequestFutures = createPhysicalSlotRequestFutures( executionVertexSchedulingRequirements, executionVertexSlotRequestIds); allocateSlotsForAssignments( physicalSlotRequestFutures, slotExecutionVertexAssignments); return Collections.unmodifiableList(new ArrayList<>(slotExecutionVertexAssignments.values())); }
Source:
<code>public void setReviewPattern(String reviewPattern) throws PatternSyntaxException { if (!reviewPattern.matches(".*\\([^\\)]*\\).*")) { <START> throw new PatternSyntaxException("The pattern must contain at least one group.", reviewPattern, 0); <END> } this.reviewPattern = Pattern.compile(reviewPattern).toString(); }</code><technical_language>similarly cases - review bug pattern share error reporting</technical_language>

Target:
public void setReviewPattern(String reviewPattern) throws PatternSyntaxException { if (!reviewPattern.matches(PATTERN_SINGLE_GROUP)) { throw new PatternSyntaxException(PATTERN_MUST_CONTAIN_GROUP, reviewPattern, 0); } this.reviewPattern = Pattern.compile(reviewPattern).toString(); }
Source:
<code>private void updateGradleSyncState() { if (!myUsingCachedProjectData) { GradleProjectSyncData.save(myProject); GradleSyncState.getInstance(myProject).syncEnded(); } else { long lastSyncTimestamp = myLastSyncTimestamp; <START> if (lastSyncTimestamp < 0) { <END> lastSyncTimestamp = System.currentTimeMillis(); } GradleSyncState.getInstance(myProject).syncSkipped(lastSyncTimestamp); } myUsingCachedProjectData = DEFAULT_USING_CACHED_PROJECT_DATA; myLastSyncTimestamp = DEFAULT_LAST_SYNC_TIMESTAMP; }</code><technical_language>This is case startup, right? == -1L instead</technical_language>

Target:
private void updateGradleSyncState() { if (!myUsingCachedProjectData) { GradleProjectSyncData.save(myProject); GradleSyncState.getInstance(myProject).syncEnded(); } else { long lastSyncTimestamp = myLastSyncTimestamp; if (lastSyncTimestamp == DEFAULT_LAST_SYNC_TIMESTAMP) { lastSyncTimestamp = System.currentTimeMillis(); } GradleSyncState.getInstance(myProject).syncSkipped(lastSyncTimestamp); } myUsingCachedProjectData = DEFAULT_USING_CACHED_PROJECT_DATA; myLastSyncTimestamp = DEFAULT_LAST_SYNC_TIMESTAMP; }
Source:
<code>public LogUnitServerCache(LogUnitServerConfig config, StreamLog streamLog) { this.streamLog = streamLog; this.dataCache = Caffeine.newBuilder() <START> .<Long, ILogData>weigher((addr, logData) -> logData.getSizeEstimate() + <END> (int)(sizeOf.deepSizeOf(logData.getMetadataMap()))) .maximumWeight(config.getMaxCacheSize()) .removalListener(this::handleEviction) .build(this::handleRetrieval); }</code><technical_language>Add 8 bytes for key</technical_language>

Target:
public LogUnitServerCache(LogUnitServerConfig config, StreamLog streamLog) { this.streamLog = streamLog; this.dataCache = Caffeine.newBuilder() .<Long, ILogData>weigher((addr, logData) -> getLogDataTotalSize(logData)) .maximumWeight(config.getMaxCacheSize()) .removalListener(this::handleEviction) .build(this::handleRetrieval); }
Source:
<code>public boolean isSelected() { <START> return getRoot().getAttribute("class").contains("cellTableSelectedRow"); <END> }</code><technical_language>defined constant here</technical_language>

Target:
public boolean isSelected() { return getRoot().getAttribute("class").contains(ROW_SELECTED_CLASS); }
Source:
<code>public void loadSystems(ModuleEnvironment environment, NetworkMode netMode) { DisplayDevice displayDevice = CoreRegistry.get(DisplayDevice.class); boolean isHeadless = displayDevice.isHeadless(); ListMultimap<Name, Class<?>> systemsByModule = ArrayListMultimap.create(); for (Class<?> type : environment.getTypesAnnotatedWith(RegisterSystem.class)) { if (!ComponentSystem.class.isAssignableFrom(type)) { logger.error("Cannot load {}, must be a subclass of ComponentSystem", type.getSimpleName()); continue; } Name moduleId = environment.getModuleProviding(type); RegisterSystem registerInfo = type.getAnnotation(RegisterSystem.class); if (registerInfo.value().isValidFor(netMode, isHeadless)) { systemsByModule.put(moduleId, type); } } for (Module module : environment.getModulesOrderedByDependencies()) { for (Class<?> system : systemsByModule.get(module.getId())) { String id = module.getId() + ":" + system.getSimpleName(); logger.debug("Registering system {}", id); try { ComponentSystem newSystem = (ComponentSystem) system.newInstance(); InjectionHelper.share(newSystem); register(newSystem, id); logger.debug("Loaded system {}", id); <START> } catch (Throwable t) { <END> logger.error("Failed to load system {}", id, t); } } } }</code><technical_language>is a bad practice catch Throwable (can maintenance issues if api changes new caught exceptions, want a caught exception bubble up). catch RuntimeException other specific exceptions</technical_language>

Target:
public void loadSystems(ModuleEnvironment environment, NetworkMode netMode) { DisplayDevice displayDevice = CoreRegistry.get(DisplayDevice.class); boolean isHeadless = displayDevice.isHeadless(); ListMultimap<Name, Class<?>> systemsByModule = ArrayListMultimap.create(); for (Class<?> type : environment.getTypesAnnotatedWith(RegisterSystem.class)) { if (!ComponentSystem.class.isAssignableFrom(type)) { logger.error("Cannot load {}, must be a subclass of ComponentSystem", type.getSimpleName()); continue; } Name moduleId = environment.getModuleProviding(type); RegisterSystem registerInfo = type.getAnnotation(RegisterSystem.class); if (registerInfo.value().isValidFor(netMode, isHeadless)) { systemsByModule.put(moduleId, type); } } for (Module module : environment.getModulesOrderedByDependencies()) { for (Class<?> system : systemsByModule.get(module.getId())) { String id = module.getId() + ":" + system.getSimpleName(); logger.debug("Registering system {}", id); try { ComponentSystem newSystem = (ComponentSystem) system.newInstance(); InjectionHelper.share(newSystem); register(newSystem, id); logger.debug("Loaded system {}", id); } catch (RuntimeException | IllegalAccessException | InstantiationException e) { logger.error("Failed to load system {}", id, e); } } } }
Source:
<code>private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { <START> log.error("failed to parse a given ovf configuration: \n{}", ovfEntityData.getOvfData()); <END> log.error("Exception", e); } } }</code><technical_language>need space new line avoid new line in this case</technical_language>

Target:
private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration:\n{}", ovfEntityData.getOvfData()); log.error("Exception", e); } } }
Source:
<code>public static boolean setUseEureka2(boolean useEureka2) { <START> boolean lastValue = Eureka2Clients.useEureka2; <END> Eureka2Clients.useEureka2 = useEureka2; return lastValue; }</code><technical_language>AtomicBoolean.getAndSet()</technical_language>

Target:
public static boolean setUseEureka2(boolean useEureka2) { return Eureka2Clients.useEureka2.getAndSet(useEureka2); }
Source:
<code>public StatusListener(String intf, int port, String publicIntf) { m_resolvedIntf = resolveInterface(intf, ""); m_publicIntf = resolveInterface(publicIntf, m_resolvedIntf); <START> initServer(m_resolvedIntf, port); <END> }</code><technical_language>I discourage real work in a constructor. This bugs constructor throws exception a partially initialized class correctly cleaned up</technical_language>

Target:
public StatusListener(String intf, int port, String publicIntf) throws InitException { m_resolvedIntf = resolveInterface(intf, ""); m_publicIntf = resolveInterface(publicIntf, m_resolvedIntf); initServer(m_resolvedIntf, port); }
Source:
<code>protected void doTest(Location loc) throws Exception { final MongoDBShardedDeployment deployment = app.createAndManageChild(EntitySpec.create(MongoDBShardedDeployment.class) .configure(MongoDBShardedDeployment.INITIAL_ROUTER_CLUSTER_SIZE, ROUTER_CLUSTER_SIZE) .configure(MongoDBShardedDeployment.SHARD_REPLICASET_SIZE,REPLICASET_SIZE) .configure(MongoDBShardedDeployment.INITIAL_SHARD_CLUSTER_SIZE, SHARD_CLUSTER_SIZE)); app.start(ImmutableList.of(loc)); Entities.dumpInfo(app); Asserts.succeedsEventually(ImmutableMap.of("timeout", TIMEOUT), new Callable<Boolean>() { @Override public Boolean call() throws Exception { Assert.assertEquals(deployment.getRouterCluster().getCurrentSize(), ROUTER_CLUSTER_SIZE); Assert.assertEquals(deployment.getShardCluster().getCurrentSize(), SHARD_CLUSTER_SIZE); Assert.assertEquals(deployment.getConfigCluster().getCurrentSize(), MongoDBShardedDeployment.CONFIG_CLUSTER_SIZE.getDefaultValue()); for (Entity entity : deployment.getShardCluster().getMembers()) { Assert.assertEquals(((MongoDBReplicaSet)entity).getCurrentSize(), REPLICASET_SIZE); } <START> return true; <END> } }); }</code><technical_language>new Runnable() {...} need a return</technical_language>

Target:
protected void doTest(Location loc) throws Exception { final MongoDBShardedDeployment deployment = app.createAndManageChild(EntitySpec.create(MongoDBShardedDeployment.class) .configure(MongoDBShardedDeployment.INITIAL_ROUTER_CLUSTER_SIZE, ROUTER_CLUSTER_SIZE) .configure(MongoDBShardedDeployment.SHARD_REPLICASET_SIZE,REPLICASET_SIZE) .configure(MongoDBShardedDeployment.INITIAL_SHARD_CLUSTER_SIZE, SHARD_CLUSTER_SIZE)); app.start(ImmutableList.of(loc)); Entities.dumpInfo(app); Asserts.succeedsEventually(ImmutableMap.of("timeout", TIMEOUT), new Runnable() { public void run() { Assert.assertEquals(deployment.getRouterCluster().getCurrentSize(), ROUTER_CLUSTER_SIZE); Assert.assertEquals(deployment.getShardCluster().getCurrentSize(), SHARD_CLUSTER_SIZE); Assert.assertEquals(deployment.getConfigCluster().getCurrentSize(), MongoDBShardedDeployment.CONFIG_CLUSTER_SIZE.getDefaultValue()); for (Entity entity : deployment.getShardCluster().getMembers()) { Assert.assertEquals(((MongoDBReplicaSet) entity).getCurrentSize(), REPLICASET_SIZE); } } }); }
Source:
<code>public ImmutableValue<Boolean> exactTeleport() { <START> return new ImmutableSpongeValue<>(Keys.EXACT_TELEPORT, false, this.exactTeleport); <END> }</code><technical_language>This ImmutableDataCachingUtil</technical_language>

Target:
public ImmutableValue<Boolean> exactTeleport() { return this.exactTeleportValue; }
Source:
<code>private static Uri getFileUriFromMediaStoreUri(@NonNull Context context, @NonNull Uri photoUri) { final Cursor cursor = context.getContentResolver().query(photoUri, new String[]{MediaStore.Images.ImageColumns.DATA}, null, null, null); if (null == cursor) { return null; } try { <START> cursor.moveToFirst(); <END> if (cursor.getCount() <= 0 || cursor.getColumnCount() <= 0) { return null; } final String data = cursor.getString(0); if (TextUtils.isEmpty(data)) { return null; } return Uri.fromFile(new File(data)); } finally { cursor.close(); } }</code><technical_language>more optimized function. @Nullable private static Uri getFileUriFromMediaStoreUri(@NonNull Context context, @NonNull Uri photoUri) { final Cursor cursor = context.getContentResolver().query(photoUri, new String[]{MediaStore.Images.ImageColumns.DATA}, null, null, null); if (null == cursor) { return null; } try { if (cursor.moveToFirst()) { final String data = cursor.getString(0); if (TextUtils.isEmpty(data)) { return null; } return Uri.fromFile(new File(data)); } } finally { cursor.close(); } return null; }</technical_language>

Target:
private static Uri getFileUriFromMediaStoreUri(@NonNull Context context, @NonNull Uri photoUri) { final Cursor cursor = context.getContentResolver().query(photoUri, new String[]{MediaStore.Images.ImageColumns.DATA}, null, null, null); if (null == cursor) { return null; } try { if (cursor.moveToFirst() && cursor.getColumnCount() > 0) { final String data = cursor.getString(0); if (TextUtils.isEmpty(data)) { return null; } return Uri.fromFile(new File(data)); } } finally { cursor.close(); } return null; }
Source:
<code>public JavaFileObject toJavaFileObject() { <START> TypeSpec firstTypeSpec = typeSpecs.get(0); <END> URI uri = URI.create((packageName.isEmpty() ? firstTypeSpec.name : packageName.replace('.', '/') + '/' + firstTypeSpec.name) + Kind.SOURCE.extension); return new SimpleJavaFileObject(uri, Kind.SOURCE) { private final long lastModified = System.currentTimeMillis(); @Override public String getCharContent(boolean ignoreEncodingErrors) { return JavaFile.this.toString(); } @Override public InputStream openInputStream() throws IOException { return new ByteArrayInputStream(getCharContent(true).getBytes(UTF_8)); } @Override public long getLastModified() { return lastModified; } }; }</code><technical_language>Again, public</technical_language>

Target:
public JavaFileObject toJavaFileObject() { URI uri = URI.create((packageName.isEmpty() ? typeSpec.name : packageName.replace('.', '/') + '/' + typeSpec.name) + Kind.SOURCE.extension); return new SimpleJavaFileObject(uri, Kind.SOURCE) { private final long lastModified = System.currentTimeMillis(); @Override public String getCharContent(boolean ignoreEncodingErrors) { return JavaFile.this.toString(); } @Override public InputStream openInputStream() throws IOException { return new ByteArrayInputStream(getCharContent(true).getBytes(UTF_8)); } @Override public long getLastModified() { return lastModified; } }; }
Source:
<code>public QueryBuilder make(EsHint hint, String fieldName, Object value) { MatchPhraseQueryBuilder matchPhraseQuery = QueryBuilders.matchPhraseQuery(fieldName, value); if (hint.analyzer != null) { <START> matchPhraseQuery.analyzer(hint.analyzer); <END> } return matchPhraseQuery; }</code><technical_language>need for null check</technical_language>

Target:
public QueryBuilder make(EsHint hint, String fieldName, Object value) { return QueryBuilders.matchPhraseQuery(fieldName, value).analyzer(hint.analyzer); }
Source:
<code>public void onConstruction(CallbackInfo ci) { final Optional<net.minecraft.world.DimensionType> optDimensionType = DimensionManager.getDimensionType((Class<? extends WorldProvider>) (Object) getClass()); if (!optDimensionType.isPresent()) { <START> throw new RuntimeException("Attempt was made to create an instance of a WorldProvider who has no registered type!"); <END> } this.dimensionType = optDimensionType.get(); }</code><technical_language>Optional.orElseThrow</technical_language>

Target:
public void onConstruction(CallbackInfo ci) { this.dimensionType = DimensionManager.getDimensionType((Class<? extends WorldProvider>) (Object) getClass()).orElseThrow(() -> new RuntimeException("Attempt was made to create an instance of a WorldProvider who has no " + "registered type!")); }
Source:
<code>private MultiKeyOperation(final List keys, final OpName o) { Object firstKey = (keys != null) ? keys.get(0) : null; if(firstKey != null) { if (firstKey instanceof String) { this.keys = keys; this.binaryKeys = null; } else if (firstKey instanceof byte[]) { this.keys = null; this.binaryKeys = keys; } else { this.keys = null; this.binaryKeys = null; } } else { <START> this.keys = null; <END> this.binaryKeys = null; } this.op = o; }</code><technical_language>Is a case firstKey is null rest not</technical_language>

Target:
private MultiKeyOperation(final List keys, final OpName o) { Object firstKey = (keys != null && keys.size() > 0) ? keys.get(0) : null; if(firstKey != null) { if (firstKey instanceof String) { this.keys = keys; this.binaryKeys = null; } else if (firstKey instanceof byte[]) { this.keys = null; this.binaryKeys = keys; } else { this.keys = null; this.binaryKeys = null; } } else { this.keys = null; this.binaryKeys = null; } this.op = o; }
Source:
<code>public void testCloseNoInterrupt() throws Exception { byte[] cf1 = Bytes.toBytes("CF1"); byte[][] families = { cf1 }; <START> Configuration conf = HBaseConfiguration.create(); <END> conf.setBoolean(HRegion.CLOSE_WAIT_ABORT, false); region = initHRegion(tableName, method, conf, families); final CountDownLatch latch = new CountDownLatch(1); final AtomicBoolean holderInterrupted = new AtomicBoolean(); Thread holder = new Thread(new Runnable() { @Override public void run() { try { LOG.info("Starting region operation holder"); region.startRegionOperation(Operation.SCAN); latch.countDown(); try { Thread.sleep(10*1000); } catch (InterruptedException e) { LOG.info("Interrupted"); holderInterrupted.set(true); } } catch (Exception e) { throw new RuntimeException(e); } finally { try { region.closeRegionOperation(); } catch (IOException e) { } LOG.info("Stopped region operation holder"); } } }); holder.start(); latch.await(); region.close(); region = null; assertFalse("Region lock holder should not have been interrupted", holderInterrupted.get()); }</code><technical_language>config HBTU? new Configuration(TEST_UTIL.getConfiguration())</technical_language>

Target:
public void testCloseNoInterrupt() throws Exception { byte[] cf1 = Bytes.toBytes("CF1"); byte[][] families = { cf1 }; final int SLEEP_TIME = 10 * 1000; Configuration conf = new Configuration(CONF); conf.setBoolean(HRegion.CLOSE_WAIT_ABORT, false); conf.setInt(HRegion.CLOSE_WAIT_INTERVAL, 1000); region = initHRegion(tableName, method, conf, families); final CountDownLatch latch = new CountDownLatch(1); final AtomicBoolean holderInterrupted = new AtomicBoolean(); Thread holder = new Thread(new Runnable() { @Override public void run() { try { LOG.info("Starting region operation holder"); region.startRegionOperation(Operation.SCAN); latch.countDown(); try { Thread.sleep(SLEEP_TIME); } catch (InterruptedException e) { LOG.info("Interrupted"); holderInterrupted.set(true); } } catch (Exception e) { throw new RuntimeException(e); } finally { try { region.closeRegionOperation(); } catch (IOException e) { } LOG.info("Stopped region operation holder"); } } }); holder.start(); latch.await(); region.close(); region = null; holder.join(); assertFalse("Region lock holder should not have been interrupted", holderInterrupted.get()); }
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()) .setCancelable(false) .setTitle(getString(R.string.storage_permission_required)); if (getArguments().getBoolean("shouldShowRationale")) { builder.setIcon(R.mipmap.ic_launcher) .setMessage(getString(R.string.permission_must_be_granted)) <START> .setNeutralButton(getString(R.string.ok), null); <END> } else { builder.setIcon(R.drawable.ic_error_outline_24dp) .setMessage(getString(R.string.approve_permission)) .setNegativeButton(getString(R.string.no), null) .setPositiveButton(getString(R.string.yes), (dialogInterface, i) -> { final Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse("package:" + getContext().getPackageName())); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); getContext().startActivity(intent); }); } return builder.create(); }</code><technical_language>setPositiveButton instead. special motivation for it, I Google styles positive primary colors</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()) .setCancelable(false) .setTitle(getString(R.string.storage_permission_required)); if (getArguments().getBoolean("shouldShowRationale")) { builder.setIcon(R.mipmap.ic_launcher) .setMessage(getString(R.string.permission_must_be_granted)) .setPositiveButton(getString(R.string.ok), null); } else { builder.setIcon(R.drawable.ic_error_outline_24dp) .setMessage(getString(R.string.approve_permission)) .setNegativeButton(getString(R.string.no), null) .setPositiveButton(getString(R.string.yes), (dialogInterface, i) -> { final Intent intent = new Intent(); intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse("package:" + getContext().getPackageName())); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); getContext().startActivity(intent); }); } return builder.create(); }
Source:
<code>public Optional<ByteSource> streamTaskReports(final String taskId) { final ZkWorker zkWorker = findWorkerRunningTask(taskId); if (zkWorker == null) { return Optional.absent(); } else { <START> Worker worker = runningTasks.get(taskId).getWorker(); <END> TaskLocation taskLocation = runningTasks.get(taskId).getLocation(); final URL url = TaskRunnerUtils.makeTaskLocationURL( taskLocation, "/druid/worker/v1/chat/%s/liveReports", taskId ); return Optional.of( new ByteSource() { @Override public InputStream openStream() throws IOException { try { return httpClient.go( new Request(HttpMethod.GET, url), new InputStreamResponseHandler() ).get(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { Throwables.propagateIfPossible(e.getCause(), IOException.class); throw new RuntimeException(e); } } } ); } }</code><technical_language>Spotbugs is flagging this line: [ERROR] Dead store worker in org.apache.druid.indexing.overlord.RemoteTaskRunner.streamTaskReports(String) [org.apache.druid.indexing.overlord.RemoteTaskRunner] RemoteTaskRunner.java:[line 651] DLS_DEAD_LOCAL_STORE</technical_language>

Target:
public Optional<ByteSource> streamTaskReports(final String taskId) { final ZkWorker zkWorker = findWorkerRunningTask(taskId); if (zkWorker == null) { return Optional.absent(); } else { TaskLocation taskLocation = runningTasks.get(taskId).getLocation(); final URL url = TaskRunnerUtils.makeTaskLocationURL( taskLocation, "/druid/worker/v1/chat/%s/liveReports", taskId ); return Optional.of( new ByteSource() { @Override public InputStream openStream() throws IOException { try { return httpClient.go( new Request(HttpMethod.GET, url), new InputStreamResponseHandler() ).get(); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { Throwables.propagateIfPossible(e.getCause(), IOException.class); throw new RuntimeException(e); } } } ); } }