auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void applyNextRunConfiguration() { Snapshot runSnap = snapshotDao.get(getVmId(), SnapshotType.NEXT_RUN); if (runSnap != null) { log.debug("Attempt to apply NEXT_RUN snapshot for VM '{}'", getVmId()); EngineLock updateVmLock = createUpdateVmLock(); <START> if (lockManager.acquireLock(updateVmLock).getFirst()) { <END> try { snapshotDao.remove(runSnap.getId()); Date originalCreationDate = getVm().getVmCreationDate(); snapshotsManager.updateVmFromConfiguration(getVm(), runSnap.getVmConfiguration()); getVm().setVmCreationDate(originalCreationDate); VdcReturnValueBase result = runInternalAction(VdcActionType.UpdateVm, createUpdateVmParameters(), ExecutionHandler.createInternalJobContext(updateVmLock)); if (result.getActionReturnValue() != null && result.getActionReturnValue() .equals(VdcActionType.UpdateVmVersion)) { templateVersionChanged = true; } } finally { lockManager.releaseLock(updateVmLock); } } else { log.warn("Could not acquire lock for UpdateVmCommand to apply Next Run Config of VM '{}'", getVmId()); } } }</code><technical_language>in general, is problematic locks handling VM down. imagine case: 1. create a snapshot for VM - locking 2. VM crashes 3. storage sample tasks in 30 secs, monitoring detect VM is call ProcessDownVm -> attempt acquire a lock in flow of ProcessDownVm fail CreateAllVmSnapshots releases lock.. this problem exists this change solve reported issue,</technical_language>

Target:
private void applyNextRunConfiguration() { Snapshot runSnap = snapshotDao.get(getVmId(), SnapshotType.NEXT_RUN); if (runSnap != null) { log.debug("Attempt to apply NEXT_RUN snapshot for VM '{}'", getVmId()); EngineLock updateVmLock = createUpdateVmLock(); if (lockManager.acquireLock(updateVmLock).getFirst()) { snapshotDao.remove(runSnap.getId()); Date originalCreationDate = getVm().getVmCreationDate(); snapshotsManager.updateVmFromConfiguration(getVm(), runSnap.getVmConfiguration()); getVm().setVmCreationDate(originalCreationDate); VdcReturnValueBase result = runInternalAction(VdcActionType.UpdateVm, createUpdateVmParameters(), ExecutionHandler.createInternalJobContext(updateVmLock)); if (result.getActionReturnValue() != null && result.getActionReturnValue() .equals(VdcActionType.UpdateVmVersion)) { templateVersionChanged = true; } } else { log.warn("Could not acquire lock for UpdateVmCommand to apply Next Run Config of VM '{}'", getVmId()); } } }
Source:
<code>void coordinates(CoordinateSequence coordinates, char cs, char ts, StringBuffer sb) { sb.setLength(0); int n = coordinates.size(); int dim = CoordinateSequences.coordinateDimension(coordinates); for (int i = 0; i < n; i++) { coordFormatter.format(coordinates.getX(i), sb).append(cs); coordFormatter.format(coordinates.getY(i), sb); if (dim > 2) { <START> int totalDimensions = <END> encodeCoordinatesMeasures ? dim : dim - coordinates.getMeasures(); for (int j = 2; j < totalDimensions; j++) { sb.append(cs); coordFormatter.format(coordinates.getOrdinate(i, j), sb); } } sb.append(ts); } sb.setLength(sb.length() - 1); }</code><technical_language>This idea referenced "geometryDimension" in SFSQL, is dimension of spatial ordinates. XYM data dimension 3 geometry dimension of 2</technical_language>

Target:
void coordinates(CoordinateSequence coordinates, char cs, char ts, StringBuffer sb) { sb.setLength(0); int n = coordinates.size(); int dim = CoordinateSequences.coordinateDimension(coordinates); for (int i = 0; i < n; i++) { coordFormatter.format(coordinates.getX(i), sb).append(cs); coordFormatter.format(coordinates.getY(i), sb); if (dim > 2) { int totalDimensions = encodeMeasures ? dim : dim - coordinates.getMeasures(); for (int j = 2; j < totalDimensions; j++) { sb.append(cs); coordFormatter.format(coordinates.getOrdinate(i, j), sb); } } sb.append(ts); } sb.setLength(sb.length() - 1); }
Source:
<code>public static RequiredShuffle hash(int[] keys) { <START> if (keys.length == 0) { <END> return new RequiredShuffle(ShuffleType.ANY, keys); } else { return new RequiredShuffle(ShuffleType.HASH, keys); } }</code><technical_language>require keys is empty here</technical_language>

Target:
public static RequiredShuffle hash(int[] keys) { Preconditions.checkArgument(keys.length > 0, "Hash keys must no be empty."); return new RequiredShuffle(ShuffleType.HASH, keys); }
Source:
<code>private static String getRulesForCommitMessageFormatting() { return "Proper commit message should adhere to the following rules:\n" <START> + "\t1) Must match one of the following patterns:\n" <END> + "\t\t" + ISSUE_COMMIT_MESSAGE_REGEX_PATTERN + "\n" + "\t\t" + PR_COMMIT_MESSAGE_REGEX_PATTERN + "\n" + "\t\t" + OTHER_COMMIT_MESSAGE_REGEXPATTERN + "\n" + "\t2) It contains only one line"; }</code><technical_language>I tabs. spaces instead :)</technical_language>

Target:
private static String getRulesForCommitMessageFormatting() { return "Proper commit message should adhere to the following rules:\n" + " 1) Must match one of the following patterns:\n" + " " + ISSUE_COMMIT_MESSAGE_REGEX_PATTERN + "\n" + " " + PR_COMMIT_MESSAGE_REGEX_PATTERN + "\n" + " " + OTHER_COMMIT_MESSAGE_REGEXPATTERN + "\n" + " 2) It contains only one line"; }
Source:
<code>private static Field getFieldByReflection(Class cls, String fieldName) { Field field = null; try { field = cls.getDeclaredField(fieldName); field.setAccessible(true); } catch (Exception e) { <START> log.error("Unable to read [%s] field from [%s]", fieldName, cls.getName()); <END> } return field; }</code><technical_language>this is recoverable, info</technical_language>

Target:
private static Field getFieldByReflection(Class cls, String fieldName) { Field field = null; try { field = cls.getDeclaredField(fieldName); field.setAccessible(true); } catch (Exception e) { log.warn("Unable to read [%s] field from [%s]", fieldName, cls.getName()); } return field; }
Source:
<code>private FaultResponseDto faultResponseForException(final Exception exception, final List<FaultResponseParameterDto> parameters, final String defaultMessage) { <START> if (exception instanceof FunctionalException || exception instanceof TechnicalException) { <END> return this.faultResponseForFunctionalOrTechnicalException((OsgpException) exception, parameters); } return new FaultResponseDto(null, defaultMessage, ComponentType.DOMAIN_SMART_METERING.name(), exception.getClass().getName(), exception.getMessage(), new FaultResponseParametersDto(parameters)); }</code><technical_language>Is a special reason OsgpException is used</technical_language>

Target:
protected FaultResponseDto faultResponseForException(final Exception exception, final List<FaultResponseParameterDto> parameters, final String defaultMessage) { final FaultResponseParametersDto faultResponseParameters = this.faultResponseParametersForList(parameters); if (exception instanceof FunctionalException || exception instanceof TechnicalException) { return this.faultResponseForFunctionalOrTechnicalException((OsgpException) exception, faultResponseParameters, defaultMessage); } return new FaultResponseDto(null, defaultMessage, ComponentType.DOMAIN_SMART_METERING.name(), exception.getClass().getName(), exception.getMessage(), faultResponseParameters); }
Source:
<code>private void createRefreshJob() { refreshJob = new WorkbenchJob("filter") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (filterText.isDisposed()) { return Status.CANCEL_STATUS; } String text = filterText.getText(); text = text.trim(); if (!previousFilterText.equals(text)) { previousFilterText = text; filterPattern = createPattern(previousFilterText); if (clearFilterTextControl != null) { <START> clearFilterTextControl.setVisible(previousFilterText.trim() != null && !previousFilterText.isEmpty()); <END> } createBodyContents(); } return Status.OK_STATUS; } }; refreshJob.setSystem(true); }</code><technical_language>!previousFilterText.trim().isEmpty() //previousFilterText.trim() null</technical_language>

Target:
private void createRefreshJob() { refreshJob = new WorkbenchJob("filter") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (filterText.isDisposed()) { return Status.CANCEL_STATUS; } String text = filterText.getText(); text = text.trim(); if (!previousFilterText.equals(text)) { previousFilterText = text; filterPattern = createPattern(previousFilterText); if (clearFilterTextControl != null) { clearFilterTextControl.setVisible(previousFilterText != null && !previousFilterText.isEmpty()); } createBodyContents(); } return Status.OK_STATUS; } }; refreshJob.setSystem(true); }
Source:
<code>private static LinkAttributes parseLinkNode(final Node node) { final Element elem = (Element)node; NamedNodeMap attributes = elem.getAttributes(); URI href = null; Map<String, String> params = new HashMap<>(attributes.getLength()-1); <START> if (attributes != null) { <END> for (int i = 0; i < attributes.getLength(); i++) { final Node attribute = attributes.item(i); final String name = attribute.getNodeName(); final String value = attribute.getNodeValue(); if ("href".equalsIgnoreCase(name)) { if (value != null) { try { href = new URI(value); } catch (URISyntaxException e) { LOGGER.warn("Invalid URI in link href attribute: " + value); } } else { LOGGER.warn("Unexpected null value for Link href attribute"); } } else { if (name != null && value != null) { params.put(name, value); } } } LinkAttributes linkAttributes = new LinkAttributes(href); linkAttributes.setParams(params); return linkAttributes; } else { return null; } }</code><technical_language>Swap preceding line? attributes.getLength() a NPE</technical_language>

Target:
private static LinkAttributes parseLinkNode(final Node node) { final Element elem = (Element)node; NamedNodeMap attributes = elem.getAttributes(); URI href = null; Map<String, String> params = new HashMap<>(attributes.getLength()); if (attributes != null) { for (int i = 0; i < attributes.getLength(); i++) { final Node attribute = attributes.item(i); final String name = attribute.getNodeName(); final String value = attribute.getNodeValue(); if ("href".equalsIgnoreCase(name)) { if (value != null) { try { href = new URI(value); } catch (URISyntaxException e) { LOGGER.warn("Invalid URI in link href attribute: " + value); } } else { LOGGER.warn("Unexpected null value for Link href attribute"); } } else { if (name != null && value != null) { params.put(name, value); } } } LinkAttributes linkAttributes = new LinkAttributes(href); linkAttributes.setParams(params); return linkAttributes; } else { return null; } }
Source:
<code>private void setDeletable() { <START> getListView().setOnItemLongClickListener( <END> new LongClickDeleteListener(this, new LongClickDeleteListener.OnDeleteListener() { @Override public void onDelete(int position) { if (getListView().getItemAtPosition(position) == null) return; longPressedItemPosition = itemPositionForListViewPosition(position); ExpenseClaimDetailController.DetailItem.ItemType type = controller.getItemType(longPressedItemPosition); startDeleteAlertDialog(type); } }, new LongClickDeleteListener.SetStatus() { @Override public boolean set(int position) { longPressedItemPosition = itemPositionForListViewPosition(position); ExpenseClaimDetailController.DetailItem.ItemType type = controller.getItemType(longPressedItemPosition); if (editable ||type == ExpenseClaimDetailController.DetailItem.ItemType.TAG) { return true; } return false; } } )); }</code><technical_language>This eventually refactored part of LongClickDeleteListener leave this for if want</technical_language>

Target:
private void setDeletable() { getListView().setOnItemLongClickListener(new LongClickDeleteListener(this, new LongClickDeleteListener.OnDeleteListener() { @Override public void onDelete(int position) { if (getListView().getItemAtPosition(position) == null) return; ExpenseClaimDetailController.DetailItem.ItemType type = getTypeAt(position); startDeleteAlertDialog(type); } @Override public boolean shouldDelete(int position) { ExpenseClaimDetailController.DetailItem.ItemType type = getTypeAt(position); if (editable ||type == ExpenseClaimDetailController.DetailItem.ItemType.TAG) { return true; } return false; } })); }
Source:
<code>protected static Optional<StandardUsernamePasswordCredentials> findCredentials( Item item, String credentialsId, String uri) { if (StringUtils.isEmpty(credentialsId)) { <START> return null; <END> } return Optional.ofNullable( CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, item, item instanceof Queue.Task ? Tasks.getAuthenticationOf( (Queue.Task) item) : ACL.SYSTEM, URIRequirementBuilder.fromUri(uri).build()), CredentialsMatchers.withId(credentialsId) )); }</code><technical_language>return null Optionals</technical_language>

Target:
protected static Optional<StandardUsernamePasswordCredentials> findCredentials( Item item, String credentialsId, String uri) { return Optional.ofNullable( CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, item, item instanceof Queue.Task ? Tasks.getAuthenticationOf( (Queue.Task) item) : ACL.SYSTEM, URIRequirementBuilder.fromUri(uri).build()), CredentialsMatchers.withId(credentialsId) )); }
Source:
<code>protected void readTextValueFromXml(EwsServiceXmlReader reader) throws XMLStreamException, ServiceXmlDeserializationException { <START> boolean keepWhiteSpace = this.getBodyType() == BodyType.Text; <END> this.text = reader.readValue(keepWhiteSpace); }</code><technical_language>need store this variable. put method below. Also, is safer equals instead of ==</technical_language>

Target:
protected void readTextValueFromXml(EwsServiceXmlReader reader) throws XMLStreamException, ServiceXmlDeserializationException { if (log.isDebugEnabled()) { log.debug("Reading text value from XML. BodyType = " + this.getBodyType() + ", keepWhiteSpace = " + ((this.getBodyType() == BodyType.Text) ? "true." : "false.")); } this.text = reader.readValue(this.getBodyType() == BodyType.Text); if (log.isDebugEnabled()) { log.debug("Text value read:\n---\n" + this.text + "\n---"); } }
Source:
<code>public CompletionStage<MetricsQueryResponse> queryMetrics(final MetricsQuery metricsQuery) { final Metrics metrics = _metricsFactory.create(); final Timer timer = metrics.createTimer("kairosService/queryMetrics/request"); final ImmutableSet<String> requestedTags = metricsQuery.getMetrics() .stream() .flatMap(m -> m.getTags().keySet().stream()) .collect(ImmutableSet.toImmutableSet()); return getMetricNames(metrics) .thenApply(names -> useAvailableRollups(names, metricsQuery, _metricsQueryConfig, metrics)) .whenComplete((query, throwable) -> { <START> if (throwable != null) { return; } _rewrittenQueryConsumer.accept(query); <END> }) .thenCompose(_kairosDbClient::queryMetrics) .thenApply(response -> filterExcludedTags(response, requestedTags)) .whenComplete((result, error) -> { timer.stop(); metrics.incrementCounter("kairosService/queryMetrics/success", error == null ? 1 : 0); metrics.close(); }); }</code><technical_language>suggestion if (throwable == null) { _rewrittenQueryConsumer.accept(query); }</technical_language>

Target:
public CompletionStage<MetricsQueryResponse> queryMetrics(final MetricsQuery metricsQuery) { final Metrics metrics = _metricsFactory.create(); final Timer timer = metrics.createTimer("kairosService/queryMetrics/request"); final ImmutableSet<String> requestedTags = metricsQuery.getMetrics() .stream() .flatMap(m -> m.getTags().keySet().stream()) .collect(ImmutableSet.toImmutableSet()); return getMetricNames(metrics) .thenApply(names -> useAvailableRollups(names, metricsQuery, _metricsQueryConfig, metrics)) .whenComplete((query, throwable) -> { if (throwable == null) { _rewrittenQueryConsumer.accept(query); } }) .thenCompose(_kairosDbClient::queryMetrics) .thenApply(response -> filterExcludedTags(response, requestedTags)) .whenComplete((result, error) -> { timer.stop(); metrics.incrementCounter("kairosService/queryMetrics/success", error == null ? 1 : 0); metrics.close(); }); }
Source:
<code>protected Session doCreateSession( SessionContext context ) { Session session = newSessionInstance( context ); if ( log.isTraceEnabled() ) { log.trace( "Creating session for host {}", session.getHost() ); } if( WebUtils.isHttp( context ) ) { HttpServletRequest request = WebUtils.getHttpRequest( context ); if ( isStatelessClient( request ) ) { ( (SimpleSession) session ).setId( fakeSessionIdGenerator.generateId( session ) ); <START> log.debug( "Stateless client sesion is not persisted.", session.getId() ); <END> } else { create( session ); } if ( log.isTraceEnabled() ) { log.trace( "Session was created for User-Agent {}", session.getId(), getUserAgent( request ) ); } } return session; }</code><technical_language>typo</technical_language>

Target:
protected Session doCreateSession( SessionContext context ) { Session session = newSessionInstance( context ); if ( log.isTraceEnabled() ) { log.trace( "Creating session for host {}", session.getHost() ); } if( WebUtils.isHttp( context ) ) { HttpServletRequest request = WebUtils.getHttpRequest( context ); if ( isStatelessClient( request ) ) { ( (SimpleSession) session ).setId( fakeSessionIdGenerator.generateId( session ) ); log.debug( "Stateless client session is not persisted.", session.getId() ); } else { create( session ); } if ( log.isTraceEnabled() ) { log.trace( "Session was created for User-Agent {}", session.getId(), getUserAgent( request ) ); } } return session; }
Source:
<code>public String getMessage() { return getCause().getMessage() + <START> "\n <END> Please verify the property: " + prop.getName() + " is correct."; }</code><technical_language>return line. line report</technical_language>

Target:
public String getMessage() { return getCause().getMessage() + " needed by property " + prop.getName(); }
Source:
<code>private void updateLastBuild(final RefreshRequest request, IBuildPlan plan, IBuild build, Date refreshDate) { if (plan.getLastBuild() != null) { request.getModel() .getBuilds() .stream() .filter(b -> b.getId().equals(plan.getLastBuild().getId())) .findFirst() .ifPresent(remove -> request.getModel().getBuilds().remove(remove)); } plan.setLastBuild(build); build.setPlan(plan); <START> if (plan.getServer() == null && plan.getParent() != null) { <END> plan.setServer(plan.getParent().getServer()); } build.setServer(plan.getServer()); build.setRefreshDate(refreshDate); request.getModel().getBuilds().add(build); }</code><technical_language>covering this do merge</technical_language>

Target:
private void updateLastBuild(final RefreshRequest request, IBuildPlan plan, IBuild build, Date refreshDate) { if (plan.getLastBuild() != null) { request.getModel() .getBuilds() .stream() .filter(b -> b.getId().equals(plan.getLastBuild().getId())) .findFirst() .ifPresent(remove -> request.getModel().getBuilds().remove(remove)); } plan.setLastBuild(build); build.setPlan(plan); build.setServer(plan.getServer()); build.setRefreshDate(refreshDate); request.getModel().getBuilds().add(build); plan.getChildren().forEach(child -> { updateLastBuild(request, child, child.getLastBuild(), refreshDate); }); }
Source:
<code><START> PRED_commit_author_3(Term a1, Term a2, Term a3, Operation n) { <END> super(a1, a2, a3, n); }</code><technical_language>public</technical_language>

Target:
public PRED_commit_author_3(Term a1, Term a2, Term a3, Operation n) { super(a1, a2, a3, n); }
Source:
<code>public final void authenticateURNWithEmptyUser() { final AuthKeys authKeys = new AuthKeys(); final String user = ""; final String password = ""; MatcherAssert.assertThat( authKeys.authenticate(user, password) .name(), <START> Matchers.equalTo(Identity.ANONYMOUS.name()) <END> ); }</code><technical_language>This line shifted 4 chars left</technical_language>

Target:
public final void authenticateURNWithEmptyUser() throws Exception { final AuthKeys authKeys = new AuthKeys(); MatcherAssert.assertThat( authKeys.authenticate("", "").name(), Matchers.equalTo(Identity.ANONYMOUS.name()) ); }
Source:
<code>public String saveToFile(String content, String label) { FileOutputStream fop = null; File file; String fileName = null; try { file = new File(getFilePath(label)); fop = new FileOutputStream(file); if (!file.exists()) { file.createNewFile(); } fileName = file.getName(); byte[] contentInBytes = content.getBytes(); fop.write(contentInBytes); fop.flush(); fop.close(); } catch (IOException e) { System.out.println("=== Error create file : " + e.getMessage()); e.printStackTrace(); } finally { try { if (fop != null) { fop.close(); } } catch (IOException e) { <START> e.printStackTrace(); <END> } return fileName; } }</code><technical_language>Please log exception. Do print it. Log this: logger.error("Some message..." + e);</technical_language>

Target:
public String saveToFile(String content, String label) { FileOutputStream fop = null; File file; String fileName = null; try { file = new File(getFilePath(label)); fop = new FileOutputStream(file); if (!file.exists()) { file.createNewFile(); } fileName = file.getName(); byte[] contentInBytes = content.getBytes(); fop.write(contentInBytes); fop.flush(); fop.close(); } catch (IOException e) { logger.error("Error creating file : ", e); } finally { try { if (fop != null) { fop.close(); } } catch (IOException e) { logger.error("Error closing output stream : ", e); } return fileName; } }
Source:
<code>public void close() { if (isClosed()) { return; } <START> LOG.info("Closing {}.", FEDERATED_ZK_CLIENT); <END> synchronized (_zkRealmToZkClientMap) { _zkRealmToZkClientMap.values().forEach(ZkClient::close); _zkRealmToZkClientMap.clear(); _isClosed = true; } }</code><technical_language>Nit: put log end. move end of this method FederatedZkClient closed successfully</technical_language>

Target:
public void close() { if (isClosed()) { return; } _isClosed = true; synchronized (_zkRealmToZkClientMap) { Iterator<Map.Entry<String, ZkClient>> iterator = _zkRealmToZkClientMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, ZkClient> entry = iterator.next(); String zkRealm = entry.getKey(); ZkClient zkClient = entry.getValue(); try { zkClient.close(); } catch (Exception e) { LOG.error("Exception thrown when closing ZkClient for ZkRealm: {}!", zkRealm, e); } iterator.remove(); } } LOG.info("{} is successfully closed.", FEDERATED_ZK_CLIENT); }
Source:
<code>public AggregateServerConnectionDialogForm() { $$$setupUI$$$(); setContentPane(dialog); setModal(true); pack(); setLocationRelativeTo(null); setTitle("Aggregate Server Configuration"); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapterBuilder().onClosing(e -> dispose()).build()); dialog.registerKeyboardAction(e -> dispose(), getKeyStroke(VK_ESCAPE, 0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); cancelButton.addActionListener(e -> dispose()); connectButton.addActionListener(__ -> { connectButton.setEnabled(false); cancelButton.setEnabled(false); <START> Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); <END> triggerConnect(); }); }</code><technical_language>I this be: java setCursor(Cursor.getPredefinedCursor(WAIT_CURSOR));</technical_language>

Target:
public AggregateServerConnectionDialogForm() { $$$setupUI$$$(); setContentPane(dialog); setPreferredSize(new Dimension(500, 175)); setModal(true); pack(); setLocationRelativeTo(null); setTitle("Aggregate Server Configuration"); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapterBuilder().onClosing(e -> dispose()).build()); dialog.registerKeyboardAction(e -> dispose(), getKeyStroke(VK_ESCAPE, 0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); cancelButton.addActionListener(e -> dispose()); connectButton.addActionListener(__ -> { connectButton.setEnabled(false); cancelButton.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); triggerConnect(); }); getRootPane().setDefaultButton(connectButton); }
Source:
<code>public SunPhaseJob(String thingUID, SunPhaseName sunPhaseName) { <START> checkNotNull(thingUID, "Thing UID cannot be null"); <END> checkNotNull(sunPhaseName, "Sun Phase Name cannot be null"); this.thingUID = thingUID; this.sunPhaseName = sunPhaseName; }</code><technical_language>Please remove</technical_language>

Target:
public SunPhaseJob(String thingUID, SunPhaseName sunPhaseName) { checkArgument(thingUID != null, "Thing UID cannot be null"); checkArgument(sunPhaseName != null, "Sun Phase Name cannot be null"); this.thingUID = thingUID; this.sunPhaseName = sunPhaseName; }
Source:
<code>public static Properties defaultProperties() { Properties properties = new Properties(); properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS); properties.setProperty(SERVICE_TYPE, "networks"); properties.setProperty(PROPERTY_REGIONS, "ORD,DFW,IAD,SYD,HKG"); properties.setProperty(PROPERTY_REGIONS, "IAD"); properties.setProperty(PROPERTY_REGION + ".ORD." + ISO3166_CODES, "US-IL"); properties.setProperty(PROPERTY_REGION + ".DFW." + ISO3166_CODES, "US-TX"); properties.setProperty(PROPERTY_REGION + ".IAD." + ISO3166_CODES, "US-VA"); properties.setProperty(PROPERTY_REGION + ".SYD." + ISO3166_CODES, "AU-NSW"); <START> properties.setProperty(PROPERTY_REGION + ".HKG." + ISO3166_CODES, "HK"); <END> return properties; }</code><technical_language>Australia HK in a provider</technical_language>

Target:
public static Properties defaultProperties() { Properties properties = new Properties(); properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS); properties.setProperty(SERVICE_TYPE, "networks"); properties.setProperty(PROPERTY_REGIONS, "ORD,DFW,IAD,SYD,HKG"); properties.setProperty(PROPERTY_REGION + ".ORD." + ISO3166_CODES, "US-IL"); properties.setProperty(PROPERTY_REGION + ".DFW." + ISO3166_CODES, "US-TX"); properties.setProperty(PROPERTY_REGION + ".IAD." + ISO3166_CODES, "US-VA"); properties.setProperty(PROPERTY_REGION + ".SYD." + ISO3166_CODES, "AU-NSW"); properties.setProperty(PROPERTY_REGION + ".HKG." + ISO3166_CODES, "HK"); return properties; }
Source:
<code>public WriteBehindDecoratorLoaderWriterProvider create(ServiceConfiguration<WriteBehindDecoratorLoaderWriterProvider> serviceConfiguration, ServiceLocator serviceLocator) { return new WriteBehindDecoratorLoaderWriterProvider() { @Override public void stop() { } @Override public void start(ServiceConfiguration<?> config, ServiceProvider serviceProvider) { if (config != null) { throw new IllegalArgumentException("WriteBehind configuration must not be provided at CacheManager level"); } } @Override public <K, V> WriteBehindDecoratorLoaderWriter<K, V> createWriteBehindDecoratorLoaderWriter(CacheLoaderWriter<K, V> cacheLoaderWriter, WriteBehindConfiguration configuration) { if (cacheLoaderWriter == null) { <START> throw new RuntimeException("WriteBehind requires non null CacheLoaderWriter."); <END> } loaderWriter = new WriteBehindDecoratorLoaderWriter<K, V>(cacheLoaderWriter, configuration); return (WriteBehindDecoratorLoaderWriter<K, V>)loaderWriter; } @Override public void releaseWriteBehindDecoratorCacheLoaderWriter(CacheLoaderWriter<?, ?> cacheLoaderWriter) { if(loaderWriter != null) loaderWriter.getWriteBehindQueue().stop(); } }; }</code><technical_language>A NullPointerException is a simple runtime - message added information</technical_language>

Target:
public WriteBehindDecoratorLoaderWriterProvider create(ServiceConfiguration<WriteBehindDecoratorLoaderWriterProvider> serviceConfiguration, ServiceLocator serviceLocator) { return new WriteBehindDecoratorLoaderWriterProvider() { @Override public void stop() { } @Override public void start(ServiceConfiguration<?> config, ServiceProvider serviceProvider) { if (config != null) { throw new IllegalArgumentException("WriteBehind configuration must not be provided at CacheManager level"); } } @Override public <K, V> WriteBehindDecoratorLoaderWriter<K, V> createWriteBehindDecoratorLoaderWriter(CacheLoaderWriter<K, V> cacheLoaderWriter, WriteBehindConfiguration configuration) { if (cacheLoaderWriter == null) { throw new NullPointerException("WriteBehind requires non null CacheLoaderWriter."); } loaderWriter = new WriteBehindDecoratorLoaderWriter<K, V>(cacheLoaderWriter, configuration); return (WriteBehindDecoratorLoaderWriter<K, V>)loaderWriter; } @Override public void releaseWriteBehindDecoratorCacheLoaderWriter(CacheLoaderWriter<?, ?> cacheLoaderWriter) { if(loaderWriter != null) loaderWriter.getWriteBehindQueue().stop(); } }; }
Source:
<code>protected void configure() { bind(ConnectorConfiguration.class).toInstance(configuration); bind(Environment.class).toInstance(environment); bind(CardExecutorService.class).in(Singleton.class); bind(NotifyClientProvider.class).in(Singleton.class); bind(PaymentProviders.class).in(Singleton.class); bind(EntityBuilder.class); bind(HashUtil.class); <START> bind(RequestValidator.class).in(Singleton.class); <END> bind(GatewayAccountRequestValidator.class).in(Singleton.class); install(jpaModule(configuration)); }</code><technical_language>I this is required. a no-arg constructor. Guice able inject this</technical_language>

Target:
protected void configure() { bind(ConnectorConfiguration.class).toInstance(configuration); bind(Environment.class).toInstance(environment); bind(CardExecutorService.class).in(Singleton.class); bind(PaymentProviders.class).in(Singleton.class); bind(EntityBuilder.class); bind(HashUtil.class); bind(RequestValidator.class); bind(GatewayAccountRequestValidator.class).in(Singleton.class); install(jpaModule(configuration)); install(new FactoryModuleBuilder().build(NotifyClientFactoryProvider.class)); }
Source:
<code>public synchronized Connection getDatabaseConnection(boolean needWritable) throws SQLException { if (activeConnection != null && !activeConnection.isValid(5)) { reset(); activeConnection = null; connectedEndpoint = null; } if (activeConnection != null && !isBetterEndpoint(sortedDbEndpoints.get(0), connectedEndpoint)) { return activeConnection; } Pair<DbEndpoint, Connection> endpointConnectionPair = connectToBestAvailableEndpoint(needWritable); if (connectedEndpoint == endpointConnectionPair.getFirst()) { logger.debug("Still connected to {}", connectedEndpoint.getUrl()); } else { connectedEndpoint = endpointConnectionPair.getFirst(); String qualifier = connectedEndpoint.isWriteable() ? "writable" : "read-only"; logger.info("Connected to enpoint: {}", qualifier, connectedEndpoint.getUrl()); <START> closeQuietly(activeConnection); END> activeConnection = endpointConnectionPair.getSecond(); } return activeConnection; }</code><technical_language>Yeah, reset() needed clear PreparedStatements in 'statementCache' this connection closed</technical_language>

Target:
public synchronized Connection getDatabaseConnection(boolean needWritable) throws SQLException { if (activeConnection != null && !activeConnection.isValid(5)) { closeActiveConnection(); activeConnection = null; connectedEndpoint = null; } if (activeConnection != null && !isBetterEndpoint(sortedDbEndpoints.get(0), connectedEndpoint)) { return activeConnection; } Pair<DbEndpoint, Connection> endpointConnectionPair = connectToBestAvailableEndpoint(needWritable); if (connectedEndpoint == endpointConnectionPair.getFirst()) { logger.debug("Still connected to {}", connectedEndpoint.getUrl()); } else { connectedEndpoint = endpointConnectionPair.getFirst(); String qualifier = connectedEndpoint.isWriteable() ? "writable" : "read-only"; logger.info("Connected to enpoint: {}", qualifier, connectedEndpoint.getUrl()); closeActiveConnection(); activeConnection = endpointConnectionPair.getSecond(); } return activeConnection; }
Source:
<code>private Consumer<OcflObjectUpdater> constructCommitUpdater(final boolean updatingObject) { final DIGEST_ALGORITHM fcrepoDigestAlg = getObjectDigestAlgorithm(); final DigestAlgorithm ocflDigestAlg = translateFedoraDigestToOcfl(fcrepoDigestAlg); final OcflOption[] ocflOptions; if (updatingObject) { ocflOptions = new OcflOption[] { MOVE_SOURCE, OVERWRITE }; } else { ocflOptions = new OcflOption[] { MOVE_SOURCE }; } return updater -> { if (updatingObject) { deletePaths.forEach(updater::removeFile); } if (isStagingEmpty()) { return; } try { <START> Files.walk(stagingPath) <END> .filter(Files::isRegularFile) .forEach(filePath -> { final var relativePath = stagingPath.relativize(filePath); final var subpath = FileUtil.pathToStringStandardSeparator(relativePath); updater.addPath(filePath, subpath, ocflOptions); final var digest = subpathToDigest.get(subpath); if (digest != null) { try { updater.addFileFixity(subpath, ocflDigestAlg, digest); } catch (final FixityCheckException e) { throw new PersistentStorageRuntimeException("Transmission of file " + filePath + " failed due to fixity check failure: " + e.getMessage()); } } }); } catch (final IOException e) { log.error("Failed to read staging path {}", stagingPath, e); } }; }</code><technical_language>I need walk staged files, want to. able add entire staging directory, iterate map of digests, calling addFileFixity for each</technical_language>

Target:
private Consumer<OcflObjectUpdater> constructCommitUpdater(final boolean updatingObject) { final DIGEST_ALGORITHM fcrepoDigestAlg = getObjectDigestAlgorithm(); final DigestAlgorithm ocflDigestAlg = translateFedoraDigestToOcfl(fcrepoDigestAlg); final OcflOption[] ocflOptions; if (updatingObject) { ocflOptions = new OcflOption[] { MOVE_SOURCE, OVERWRITE }; } else { ocflOptions = new OcflOption[] { MOVE_SOURCE }; } return updater -> { if (updatingObject) { deletePaths.forEach(updater::removeFile); } if (isStagingEmpty()) { return; } updater.addPath(stagingPath, ocflOptions); subpathToDigest.forEach((subpath, digest) -> { final String normalizedPath = FileUtil.pathToStringStandardSeparator(Paths.get(subpath)); try { updater.addFileFixity(normalizedPath, ocflDigestAlg, digest); } catch (final FixityCheckException e) { throw new PersistentStorageRuntimeException("Transmission of file " + subpath + " failed due to fixity check failure: " + e.getMessage()); } }); }; }
Source:
<code>public boolean updateParams(HashMap<String, Object> params) { if (this.parameters == null){ this.parameters = new HashMap<String, Object>(); } this.parameters = JainSipConfiguration.mergeParameters(this.parameters, params); if (storageManagerPreferences == null){ storageManagerPreferences = new StorageManagerPreferences(this); } saveParams(storageManagerPreferences, parameters); if (signalingClient != null) { signalingClient.reconfigure(params); registerForPush(true); } else { this.clearPushData = true; <START> connectSignaling(parameters); <END> / / } return true; }</code><technical_language>I lost here. elaborate case updateParams() called signaling connected? discuss more in daily</technical_language>

Target:
public boolean updateParams(HashMap<String, Object> params) { this.parameters = JainSipConfiguration.mergeParameters(this.parameters, params); if (storageManagerPreferences == null){ storageManagerPreferences = new StorageManagerPreferences(this); } saveParams(storageManagerPreferences, parameters); signalingClient.reconfigure(params); registerForPush(true); return true; }
Source:
<code>public TestClass(Class<?> klass) { fClass = klass; if (klass != null && klass.getConstructors().length > 1) { throw new IllegalArgumentException( "Test class can only have one constructor"); } Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkMethod>>(); Map<Class<? extends Annotation>, List<FrameworkField>> fieldsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkField>>(); for (Class<?> eachClass : getSuperClasses(fClass)) { for (Method eachMethod : MethodSorter.getDeclaredMethods(eachClass)) { addToAnnotationLists(new FrameworkMethod(eachMethod), methodsForAnnotations); } for (Field eachField : getSortedDeclaredFields(eachClass)) { addToAnnotationLists(new FrameworkField(eachField), fieldsForAnnotations); } } <START> Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotationsWithUnmodifiableLists = <END> new LinkedHashMap<Class<? extends Annotation>, List<FrameworkMethod>>(); convertListValuesToBeUnmodifiable(methodsForAnnotations, methodsForAnnotationsWithUnmodifiableLists); Map<Class<? extends Annotation>, List<FrameworkField>> fieldsForAnnotationsWithUnmodifiableLists = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkField>>(); convertListValuesToBeUnmodifiable(fieldsForAnnotations, fieldsForAnnotationsWithUnmodifiableLists); fMethodsForAnnotations = Collections.unmodifiableMap(methodsForAnnotationsWithUnmodifiableLists); fFieldsForAnnotations = Collections.unmodifiableMap(fieldsForAnnotationsWithUnmodifiableLists); }</code><technical_language>reduce duplication here, generics get hairy</technical_language>

Target:
public TestClass(Class<?> klass) { fClass = klass; if (klass != null && klass.getConstructors().length > 1) { throw new IllegalArgumentException( "Test class can only have one constructor"); } Map<Class<? extends Annotation>, List<FrameworkMethod>> methodsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkMethod>>(); Map<Class<? extends Annotation>, List<FrameworkField>> fieldsForAnnotations = new LinkedHashMap<Class<? extends Annotation>, List<FrameworkField>>(); for (Class<?> eachClass : getSuperClasses(fClass)) { for (Method eachMethod : MethodSorter.getDeclaredMethods(eachClass)) { addToAnnotationLists(new FrameworkMethod(eachMethod), methodsForAnnotations); } for (Field eachField : getSortedDeclaredFields(eachClass)) { addToAnnotationLists(new FrameworkField(eachField), fieldsForAnnotations); } } fMethodsForAnnotations = makeDeeplyUnmodifiable(methodsForAnnotations); fFieldsForAnnotations = makeDeeplyUnmodifiable(fieldsForAnnotations); }
Source:
<code>private void validateSchemaOrSurveyExists(SharedModuleMetadata metadata) { SharedModuleType type = metadata.getModuleType(); if (type == SharedModuleType.SCHEMA) { String schemaId = metadata.getSchemaId(); int schemaRevision = metadata.getSchemaRevision(); try { uploadSchemaService.getUploadSchemaByIdAndRev(SHARED_STUDY_ID, schemaId, schemaRevision); } catch (EntityNotFoundException e) { throw new BadRequestException("Upload schema " + schemaId + " referred does not exist: " + e); } } else if (type == SharedModuleType.SURVEY) { String surveyGuid = metadata.getSurveyGuid(); long createdOn = metadata.getSurveyCreatedOn(); Survey survey = surveyService.getSurvey(null, new GuidCreatedOnVersionHolderImpl(surveyGuid, createdOn), false, false); <START> if (survey == null) { <END> throw new BadRequestException("Survey " + surveyGuid + " referred does not exist."); } } }</code><technical_language>I intent is shared modules point surveys in shared study. (Based a similar pattern in previous branch for schemas.) I lack of study checking in original version of code a bug</technical_language>

Target:
private void validateSchemaOrSurveyExists(SharedModuleMetadata metadata) { SharedModuleType type = metadata.getModuleType(); if (type == SharedModuleType.SCHEMA) { String schemaId = metadata.getSchemaId(); int schemaRevision = metadata.getSchemaRevision(); try { uploadSchemaService.getUploadSchemaByIdAndRev(SHARED_STUDY_ID, schemaId, schemaRevision); } catch (EntityNotFoundException e) { throw new BadRequestException("Upload schema " + schemaId + " referred does not exist: " + e); } } else if (type == SharedModuleType.SURVEY) { String surveyGuid = metadata.getSurveyGuid(); long createdOn = metadata.getSurveyCreatedOn(); Survey survey = surveyService.getSurvey(SHARED_STUDY_ID, new GuidCreatedOnVersionHolderImpl(surveyGuid, createdOn), false, false); if (survey == null) { throw new BadRequestException("Survey " + surveyGuid + " referred does not exist."); } } }
Source:
<code>public void onHeaderCheck(final ApiResult result, final URL apiURL) { if (!WIKIPEDIA_ZERO_DEV_MODE_ON || acquiringCarrierMessage) { return; } new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { boolean responseZeroState = result.getHeaders().containsKey("X-CS"); if (responseZeroState) { String xcs = result.getHeaders().get("X-CS").get(0); if (!xcs.equals(carrierString)) { identifyZeroCarrier(xcs); } <START> } else if (zeroEnabled && supportsZeroHeaders(apiURL.getHost())) { <END> carrierString = ""; carrierMessage = null; zeroEnabled = false; app.getBus().post(new WikipediaZeroStateChangeEvent()); } } }); }</code><technical_language>put right hand side of && conditional beginning of run() method? skip cracking open headers unnecessarily</technical_language>

Target:
public void onHeaderCheck(final ApiResult result, final URL apiURL) { if (!WIKIPEDIA_ZERO_DEV_MODE_ON || acquiringCarrierMessage) { return; } new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (hostSupportsZeroHeaders(apiURL.getHost())) { boolean responseZeroState = result.getHeaders().containsKey("X-CS"); if (responseZeroState) { String xcs = result.getHeaders().get("X-CS").get(0); if (!xcs.equals(carrierString)) { identifyZeroCarrier(xcs); } } else if (zeroEnabled) { carrierString = ""; carrierMessage = null; zeroEnabled = false; app.getBus().post(new WikipediaZeroStateChangeEvent()); } } } }); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JsonArrayEntry other = (JsonArrayEntry) obj; if (booleanValue == null) { if (other.booleanValue != null) return false; } else if (!booleanValue.equals(other.booleanValue)) return false; if (floatValue == null) { if (other.floatValue != null) return false; } else if (!floatValue.equals(other.floatValue)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (objectLinkValue == null) { if (other.objectLinkValue != null) return false; } else if (!objectLinkValue.equals(other.objectLinkValue)) return false; if (stringValue == null) { if (other.stringValue != null) return false; <START> } else if (!stringValue.equals(other.stringValue)) <END> return false; if (!Objects.equals(time, other.time)) return false; return true; }</code><technical_language>is a mistake here, this method modified manually. regenerated eclipse : java if (time == null) { if (other.time != null) return false; } else if (!time.equals(other.time)) return false;</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JsonArrayEntry other = (JsonArrayEntry) obj; if (booleanValue == null) { if (other.booleanValue != null) return false; } else if (!booleanValue.equals(other.booleanValue)) return false; if (floatValue == null) { if (other.floatValue != null) return false; } else if (!floatValue.equals(other.floatValue)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (objectLinkValue == null) { if (other.objectLinkValue != null) return false; } else if (!objectLinkValue.equals(other.objectLinkValue)) return false; if (stringValue == null) { if (other.stringValue != null) return false; } else if (!stringValue.equals(other.stringValue)) return false; if (time == null) { if (other.time != null) return false; } else if (!time.equals(other.time)) return false; return true; }
Source:
<code>public void start() throws IOException { server = new MockWebServer(); server.play(); ApiContext<ProfitBricksApi> ctx = ContextBuilder.newBuilder("profitbricks-rest") <START> .credentials("", MOCK_BEARER_TOKEN) <END> .endpoint(url("")) .modules(modules) .overrides(overrides()) .build(); json = ctx.utils().injector().getInstance(Json.class); api = ctx.getApi(); }</code><technical_language>provider basic auth. mock values; oauth token</technical_language>

Target:
public void start() throws IOException { server = new MockWebServer(); server.play(); ApiContext<ProfitBricksApi> ctx = ContextBuilder.newBuilder("profitbricks-rest") .credentials("username", "password") .endpoint(url("")) .modules(modules) .overrides(overrides()) .build(); json = ctx.utils().injector().getInstance(Json.class); api = ctx.getApi(); }
Source:
<code>public void whenUnableToAcquireShardOnLastTaskRescheduleAfterMaxPause() throws Exception { ScalingSweepTaskScheduler schedulerWithRealDelay = createScheduler(new SweepDelay(1L), Duration.ZERO); when(sweepIteration.call()).thenReturn(SweepIterationResults.unableToAcquireShard(), SUCCESS_MEDIUM); schedulerWithRealDelay.start(1); deterministicScheduler.tick(INITIAL_DELAY + SweepDelay.DEFAULT_MAX_PAUSE_MILLIS + 2, TimeUnit.MILLISECONDS); <START> verify(sweepIteration, times(1 + 3)).call(); <END> }</code><technical_language>In general for tests this one, want tick ticker a bit less, check retriggered yet, tick required</technical_language>

Target:
public void whenUnableToAcquireShardOnLastTaskRescheduleAfterMaxPause() throws Exception { when(sweepIteration.call()).thenReturn(SweepIterationResults.unableToAcquireShard()); schedulerWithDelay.start(10); runSweepIterations(1 + 9, SweepDelay.DEFAULT_MAX_PAUSE_MILLIS); verify(sweepIteration, times(10 + 9 * 1)).call(); }
Source:
<code>private boolean close(final long timeoutMs) { if (!setState(State.PENDING_SHUTDOWN)) { ENDING_SHUTDOWN log.info("Already in the pending shutdown state, wait to complete shutdown"); } else { stateDirCleaner.shutdownNow(); final Thread shutdownThread = new Thread(() -> { for (final StreamThread thread : threads) { thread.shutdown(); } for (final StreamThread thread : threads) { try { if (!thread.isRunning()) { thread.join(); } } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); } } if (globalStreamThread != null) { globalStreamThread.shutdown(); } if (globalStreamThread != null && !globalStreamThread.stillRunning()) { try { globalStreamThread.join(); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } globalStreamThread = null; } adminClient.close(); metrics.close(); setState(State.NOT_RUNNING); }, "kafka-streams-close-thread"); <START> if (RecordingLevel.forName(config.getString(METRICS_RECORDING_LEVEL_CONFIG)) == RecordingLevel.DEBUG) { <END> rocksDBMetricsRecordingTriggerThread.shutdownNow(); } shutdownThread.setDaemon(true); shutdownThread.start(); } if (waitOnState(State.NOT_RUNNING, timeoutMs)) { log.info("Streams client stopped completely"); return true; } else { log.info("Streams client cannot stop completely within the timeout"); return false; } }</code><technical_language>IIUC, rocksDBMetricsRecordingTriggerThread is null meet criteria for creating thread is null create it. that, checking for null is a nicer determine if need shutdown long a thread, of condition created (e.g. RecordingLevel.DEBUG), shut down. This is safer if creation conditions change forget update here</technical_language>

Target:
private boolean close(final long timeoutMs) { if (!setState(State.PENDING_SHUTDOWN)) { ENDING_SHUTDOWN log.info("Already in the pending shutdown state, wait to complete shutdown"); } else { stateDirCleaner.shutdownNow(); if (rocksDBMetricsRecordingService != null) { rocksDBMetricsRecordingService.shutdownNow(); } final Thread shutdownThread = new Thread(() -> { for (final StreamThread thread : threads) { thread.shutdown(); } for (final StreamThread thread : threads) { try { if (!thread.isRunning()) { thread.join(); } } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); } } if (globalStreamThread != null) { globalStreamThread.shutdown(); } if (globalStreamThread != null && !globalStreamThread.stillRunning()) { try { globalStreamThread.join(); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } globalStreamThread = null; } adminClient.close(); metrics.close(); setState(State.NOT_RUNNING); }, "kafka-streams-close-thread"); shutdownThread.setDaemon(true); shutdownThread.start(); } if (waitOnState(State.NOT_RUNNING, timeoutMs)) { log.info("Streams client stopped completely"); return true; } else { log.info("Streams client cannot stop completely within the timeout"); return false; } }