auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void sortProcessInstancesVarsByNameTest() { List<ProcessVariableSummary> varList = VariableHelper.adaptCollection(variables, properties, processInstanceId, deploymentId, serverTemplateId, COL_PROCESS_INSTANCE_VAR_ID, false); assertEquals(4, varList.size()); assertEquals(processDefaultVar_name, varList.get(0).getName()); assertEquals(processDefinitionVar1Name, varList.get(1).getName()); assertEquals(processDefinitionVar2Name, varList.get(2).getName()); assertEquals(processDefinitionVar3Name, varList.get(3).getName()); varList = VariableHelper.adaptCollection(variables, properties, processInstanceId, deploymentId, serverTemplateId, COL_PROCESS_INSTANCE_VAR_ID, true); assertEquals(processDefaultVar_name, varList.get(3).getName()); assertEquals(processDefinitionVar1Name, varList.get(2).getName()); assertEquals(processDefinitionVar2Name, varList.get(1).getName()); assertEquals(processDefinitionVar3Name, varList.get(0).getName()); }

Target:
public void sortProcessInstancesVarsByNameTest() { List<ProcessVariableSummary> varList = VariableHelper.adaptCollection(variables, properties, processInstanceId, deploymentId, serverTemplateId, COL_PROCESS_INSTANCE_VAR_ID, true); assertEquals(4, varList.size()); assertEquals(processDefaultVar_name, varList.get(0).getName()); assertEquals(processDefinitionVar1Name, varList.get(1).getName()); assertEquals(processDefinitionVar2Name, varList.get(2).getName()); assertEquals(processDefinitionVar3Name, varList.get(3).getName()); varList = VariableHelper.adaptCollection(variables, properties, processInstanceId, deploymentId, serverTemplateId, COL_PROCESS_INSTANCE_VAR_ID, false); assertEquals(processDefaultVar_name, varList.get(3).getName()); assertEquals(processDefinitionVar1Name, varList.get(2).getName()); assertEquals(processDefinitionVar2Name, varList.get(1).getName()); assertEquals(processDefinitionVar3Name, varList.get(0).getName()); }
Source:
public MyPlacesLayersServiceMybatisImpl(DataSource dataSource) { if (dataSource == null) { LOG.error("Couldn't get datasource for userlayer"); } else { this.factory = initializeMyBatis(dataSource); } }

Target:
public MyPlacesLayersServiceMybatisImpl(DataSource dataSource) { if (dataSource == null) { LOG.error("Couldn't get datasource for myplaces"); } else { this.factory = initializeMyBatis(dataSource); } }
Source:
public List<Tree.Kind> nodesToVisit() { return ImmutableList.of(Tree.Kind.METHOD, Tree.Kind.METHOD_INVOCATION); }

Target:
public List<Tree.Kind> nodesToVisit() { return Collections.singletonList(Tree.Kind.METHOD_INVOCATION); }
Source:
public void onCreate() { super.onCreate(); initExceptionHandling(); Fresco.initialize(this); bus = new Bus(); registerSavedPageObserver(); refreshSavedPages(); final Resources resources = getResources(); ViewAnimations.init(resources); screenDensity = resources.getDisplayMetrics().density; currentTheme = unmarshalCurrentTheme(); appLanguageState = new AppLanguageState(this); funnelManager = new FunnelManager(this); sessionFunnel = new SessionFunnel(this); editTokenStorage = new EditTokenStorage(this); cookieManager = new SharedPreferenceCookieManager(); database = new Database(this); enableWebViewDebugging(); Api.setConnectionFactory(new OkHttpConnectionFactory(this)); zeroHandler = new WikipediaZeroHandler(this); pageCache = new PageCache(this); AccountUtil.createAccountForLoggedInUser(); }

Target:
public void onCreate() { super.onCreate(); initExceptionHandling(); Fresco.initialize(this); bus = new Bus(); final Resources resources = getResources(); ViewAnimations.init(resources); screenDensity = resources.getDisplayMetrics().density; currentTheme = unmarshalCurrentTheme(); appLanguageState = new AppLanguageState(this); funnelManager = new FunnelManager(this); sessionFunnel = new SessionFunnel(this); editTokenStorage = new EditTokenStorage(this); cookieManager = new SharedPreferenceCookieManager(); database = new Database(this); enableWebViewDebugging(); Api.setConnectionFactory(new OkHttpConnectionFactory(this)); zeroHandler = new WikipediaZeroHandler(this); pageCache = new PageCache(this); AccountUtil.createAccountForLoggedInUser(); }
Source:
public boolean callFinishWithBatch(T batch) { try { finish(batch); return true; }catch (Exception e){ return false; } }

Target:
public boolean callFinishWithBatch(T batch) { finish(batch); return true; }
Source:
public Map<String, Optional<?>> getResolvedAttributes(String nodeId, Alien4CloudApplication toscaApplication) { Map<String, Optional<?>> resolvedAttributes = MutableMap.of(); Optional<PaaSNodeTemplate> optionalPaaSNodeTemplate = getPaasNodeTemplate(nodeId, toscaApplication); if (optionalPaaSNodeTemplate.isPresent()) { Map<String, PaaSNodeTemplate> allNodes = getAllNodes(toscaApplication); final Map<String, IValue> attributes = getIndexedNodeTemplate(nodeId, toscaApplication).getAttributes(); for (Map.Entry<String, IValue> attribute : attributes.entrySet()) { String key = attribute.getKey().replaceAll("\\s+", "."); Object value = resolveAttribute(attribute, toscaApplication, nodeId, optionalPaaSNodeTemplate.get(), allNodes); resolvedAttributes.put(key, Optional.fromNullable(value)); } } return resolvedAttributes; }

Target:
public Map<String, Object> getResolvedAttributes(String nodeId, Alien4CloudApplication toscaApplication) { Map<String, Object> resolvedAttributes = MutableMap.of(); Optional<PaaSNodeTemplate> optionalPaaSNodeTemplate = getPaasNodeTemplate(nodeId, toscaApplication); if (optionalPaaSNodeTemplate.isPresent()) { Map<String, PaaSNodeTemplate> allNodes = getAllNodes(toscaApplication); final Map<String, IValue> attributes = getIndexedNodeTemplate(nodeId, toscaApplication).getAttributes(); for (Map.Entry<String, IValue> attribute : attributes.entrySet()) { String key = attribute.getKey().replaceAll("\\s+", "."); Object value = resolveAttribute(attribute, toscaApplication, nodeId, optionalPaaSNodeTemplate.get(), allNodes); if (value == null) { LOG.warn("Unable to resolve value for attribute {}", key); continue; } resolvedAttributes.put(key, value); } } return resolvedAttributes; }
Source:
private static String generateThreadDump() { StringBuilder threadDumps = new StringBuilder(); ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(threadMXBean.getAllThreadIds(), 100); for (ThreadInfo t : threadInfos) { threadDumps.append(t); } return threadDumps.toString(); }

Target:
private static String generateThreadDump() { StringBuilder threadDumps = new StringBuilder(); ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true); for (ThreadInfo t : threadInfos) { threadDumps.append(t); } return threadDumps.toString(); }
Source:
ScriptEngine getEngineForScript(ScriptMetadata metadata) { return metadata.language().map( (language) -> { return scriptEnginesByLanguage.computeIfAbsent(language, (lang) -> { ScriptEngine engine = scriptEngineManager.getEngineByName(lang); if (engine == null) { throw log.noEngineForScript(metadata.name()); } else { return engine; } }); }).orElseGet(() -> { return scriptEnginesByExtension.computeIfAbsent(metadata.extension(), (ext) -> { ScriptEngine engine = scriptEngineManager.getEngineByExtension(ext); if (engine == null) { throw log.noEngineForScript(metadata.name()); } else { return engine; } }); }); }

Target:
ScriptEngine getEngineForScript(ScriptMetadata metadata) { ScriptEngine engine; if (metadata.language().isPresent()) { engine = scriptEnginesByLanguage.computeIfAbsent(metadata.language().get(), scriptEngineManager::getEngineByName); } else { engine = scriptEnginesByExtension.computeIfAbsent(metadata.extension(), scriptEngineManager::getEngineByExtension); } if (engine == null) { throw log.noEngineForScript(metadata.name()); } else { return engine; } }
Source:
public String getExternalMetadata() throws JsonProcessingException { return MAPPER.writeValueAsString(externalMetadata); }

Target:
public Map<String, Object> getExternalMetadata() { return externalMetadata; }
Source:
private void assertDomainN(String domain, String... executables) throws FileNotFoundException { List<ProcessDetails> procs = ProcessDetails.getProcessMap().get(domain); String msg = "Expected 1 or more processes in SELinux domain \"" + domain + "\"" + " Found \"" + procs + "\""; assertNotNull(msg, procs); outer: for (ProcessDetails p : procs) { for (String executable : executables) { if (executable.equals(p.procTitle)) { continue outer; } } fail(p.procTitle + " not in allowed executable list " + Arrays.toString(executables)); } }

Target:
private void assertDomainN(String domain, String... executables) throws FileNotFoundException { List<ProcessDetails> procs = ProcessDetails.getProcessMap().get(domain); String msg = "Expected 1 or more processes in SELinux domain \"" + domain + "\"" + " Found \"" + procs + "\""; assertNotNull(msg, procs); Set<String> execList = new HashSet<String>(Arrays.asList(executables)); for (ProcessDetails p : procs) { msg = "Expected one of \"" + execList + "\" in SELinux domain \"" + domain + "\"" + " Found: \"" + p + "\""; assertTrue(msg, execList.contains(p.procTitle)); } }
Source:
private void deleteStagedFiles(Model m) { NodeIterator ni = m.listObjectsOfProperty(CdrDeposit.stagingLocation); try { while (ni.hasNext()) { RDFNode n = ni.nextNode(); URI stagingUri = URI.create(n.asLiteral().getString()); CleanupPolicy cleanupPolicy = stagingManager.getCleanupPolicy(stagingUri); switch (cleanupPolicy) { case DO_NOTHING: break; case DELETE_INGESTED_FILES: deleteFile(stagingUri); break; case DELETE_INGESTED_FILES_EMPTY_FOLDERS: File parent = deleteFile(stagingUri); if (parent != null && parent.exists()) { if (parent.list().length == 0) { try { Files.delete(parent.toPath()); LOG.info("Deleted parent folder: {}", parent.toPath()); } catch (IOException e) { LOG.error( "Cannot delete an empty staging directory: " + parent.getAbsolutePath(), e); } } } else { LOG.warn("Unable to cleanup parent directory " + parent.getAbsolutePath() + " because it does not exist"); } default: break; } } } finally { ni.close(); } }

Target:
private void deleteStagedFiles(Model m) { NodeIterator ni = m.listObjectsOfProperty(CdrDeposit.stagingLocation); try { while (ni.hasNext()) { RDFNode n = ni.nextNode(); URI stagingUri = URI.create(n.asLiteral().getString()); CleanupPolicy cleanupPolicy = stagingPolicyManager.getCleanupPolicy(stagingUri); switch (cleanupPolicy) { case DO_NOTHING: break; case DELETE_INGESTED_FILES: deleteFile(stagingUri); break; case DELETE_INGESTED_FILES_EMPTY_FOLDERS: File parent = deleteFile(stagingUri); try { if (parent != null) { Files.delete(parent.toPath()); LOG.info("Deleted parent folder: {}", parent.toPath()); } } catch (DirectoryNotEmptyException e) { LOG.debug("Parent directory not cleaned up because it is not empty", parent.getAbsolutePath()); } catch (NoSuchFileException e) { LOG.info("Unable to cleanup parent directory because it does not exist", parent.getAbsolutePath()); } catch (IOException e) { failJob(e, "Failed to delete staging directory: {0}", parent.getAbsolutePath()); } default: break; } } } finally { ni.close(); } }
Source:
private boolean isRequestFresh(CruiseConfig cruiseConfig) { EnvironmentConfig config = cruiseConfig.getEnvironments().find(new CaseInsensitiveString(oldEnvironmentName)); boolean freshRequest = hashingService.md5ForEntity(config).equals(md5); if (!freshRequest) { result.stale(LocalizedMessage.string("STALE_RESOURCE_CONFIG", "Environment", oldEnvironmentName)); } return freshRequest; }

Target:
private boolean isRequestFresh(CruiseConfig cruiseConfig) { EnvironmentConfig config = cruiseConfig.getEnvironments().find(oldEnvironmentName); boolean freshRequest = hashingService.md5ForEntity(config).equals(md5); if (!freshRequest) { result.stale(LocalizedMessage.string("STALE_RESOURCE_CONFIG", "environment", oldEnvironmentName)); } return freshRequest; }
Source:
private void updateSwimStatus(final EntityRef entity,LocationComponent location, CharacterMovementComponent movementComp) { Vector3f worldPos = location.getWorldPosition(); boolean topUnderwater = false; boolean bottomUnderwater = false; Vector3f top = new Vector3f(worldPos); Vector3f bottom = new Vector3f(worldPos); top.y += 0.25f * movementComp.height; bottom.y -= 0.25f * movementComp.height; topUnderwater = worldProvider.getBlock(top).isLiquid(); final Block bottomBlock= worldProvider.getBlock(bottom); bottomUnderwater = bottomBlock.isLiquid(); boolean newSwimming = topUnderwater && bottomUnderwater; if (!newSwimming && movementComp.isSwimming && movementComp.getVelocity().y > 0) { float len = movementComp.getVelocity().length(); movementComp.getVelocity().scale((len + 8) / len); } if(movementComp.isSwimming != newSwimming){ if(movementComp.isSwimming) entity.send(new FromLiquidEvent(bottomBlock,worldPos)); else entity.send(new IntoLiquidEvent(bottomBlock,worldPos)); } movementComp.isSwimming = newSwimming; }

Target:
private void updateSwimStatus(final EntityRef entity,LocationComponent location, CharacterMovementComponent movementComp) { Vector3f worldPos = location.getWorldPosition(); boolean topUnderwater = false; boolean bottomUnderwater = false; Vector3f top = new Vector3f(worldPos); Vector3f bottom = new Vector3f(worldPos); top.y += 0.25f * movementComp.height; bottom.y -= 0.25f * movementComp.height; topUnderwater = worldProvider.getBlock(top).isLiquid(); final Block bottomBlock= worldProvider.getBlock(bottom); bottomUnderwater = bottomBlock.isLiquid(); boolean newSwimming = topUnderwater && bottomUnderwater; if (!newSwimming && movementComp.isSwimming && movementComp.getVelocity().y > 0) { float len = movementComp.getVelocity().length(); movementComp.getVelocity().scale((len + 8) / len); } if(movementComp.isSwimming != newSwimming){ if (movementComp.isSwimming) { entity.send(new FromLiquidEvent(bottomBlock, worldPos)); } else { entity.send(new IntoLiquidEvent(bottomBlock, worldPos)); } } movementComp.isSwimming = newSwimming; }
Source:
public KeycloakApplication() { try { logger.infov("Using PlatformProvider: {0}", platform.getClass().getName()); logger.debugv("RestEasy provider: {0}", Resteasy.getProvider().getClass().getName()); ServletContext context = Resteasy.getContextData(ServletContext.class); loadConfig(); this.sessionFactory = createSessionFactory(); Resteasy.pushDefaultContextObject(KeycloakApplication.class, this); Resteasy.pushContext(KeycloakApplication.class, this); context.setAttribute(KeycloakSessionFactory.class.getName(), this.sessionFactory); singletons.add(new RobotsResource()); singletons.add(new RealmsResource()); singletons.add(new AdminRoot()); classes.add(ThemeResource.class); classes.add(JsResource.class); classes.add(KeycloakTransactionCommitter.class); classes.add(KeycloakErrorHandler.class); singletons.add(new ObjectMapperResolver(Boolean.parseBoolean(System.getProperty("keycloak.jsonPrettyPrint", "false")))); singletons.add(new WelcomeResource()); platform.onStartup(this::startup); platform.onShutdown(this::shutdown); } catch (Throwable t) { platform.exit(t); } }

Target:
public KeycloakApplication() { try { logger.debugv("PlatformProvider: {0}", platform.getClass().getName()); logger.debugv("RestEasy provider: {0}", Resteasy.getProvider().getClass().getName()); ServletContext context = Resteasy.getContextData(ServletContext.class); loadConfig(); this.sessionFactory = createSessionFactory(); Resteasy.pushDefaultContextObject(KeycloakApplication.class, this); Resteasy.pushContext(KeycloakApplication.class, this); context.setAttribute(KeycloakSessionFactory.class.getName(), this.sessionFactory); singletons.add(new RobotsResource()); singletons.add(new RealmsResource()); singletons.add(new AdminRoot()); classes.add(ThemeResource.class); classes.add(JsResource.class); classes.add(KeycloakTransactionCommitter.class); classes.add(KeycloakErrorHandler.class); singletons.add(new ObjectMapperResolver(Boolean.parseBoolean(System.getProperty("keycloak.jsonPrettyPrint", "false")))); singletons.add(new WelcomeResource()); platform.onStartup(this::startup); platform.onShutdown(this::shutdown); } catch (Throwable t) { platform.exit(t); } }
Source:
private static Double priority(final String text) { final String[] parts = MediaType.split(text); final Double priority; if (parts.length > 1) { final String num = CLEANER.matcher(parts[1]).replaceAll(""); if (num.isEmpty()) { priority = 0.0d; } else { priority = Double.parseDouble(num); } } else { priority = 1.0d; } return priority; }

Target:
private static Double priority(final String text) { final String[] parts = MediaType.split(text); final Double priority; if (parts.length > 1) { final String num = MediaType.NON_DIGITS.matcher(parts[1]).replaceAll(""); if (num.isEmpty()) { priority = 0.0d; } else { priority = Double.parseDouble(num); } } else { priority = 1.0d; } return priority; }
Source:
public void dispose() { connectionsFactory.close(); if (this.selectedConnection != null) { selectedConnection.enablePromptCredentials(true); } }

Target:
public void dispose() { connectionsFactory.close(); if (this.selectedConnection != null) { selectedConnection.enablePromptCredentials(enablePromptCredentialsBackup); } }
Source:
public boolean isRecycleBinOptionsDisplayed() { return this.getDriver().findElementsWithoutWaiting(By.cssSelector("input[name='shouldSkipRecycleBin']")).size() == 2; }

Target:
public boolean isRecycleBinOptionsDisplayed() { try { return this.optionSkipRecycleBin.isDisplayed() && this.optionSkipRecycleBin.isDisplayed(); } catch (NoSuchElementException e) { return false; } }
Source:
public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof BrowserInformationControlInput, input != null ? input.getClass().getName() : ""); if (input instanceof String) { setInformation((String)input); return; } fInput= (BrowserInformationControlInput)input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); String[] styles= null; if (RTL && resizable) styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; else if (RTL && !resizable) styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; else if (!resizable) styles= new String[] { "overflow:hidden;" }; else styles= new String[] { "overflow:scroll;" }; StringBuffer buffer= new StringBuffer(content); HTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); fCompleted= false; fBrowser.setText(content); for (IInputChangedListener listener : fInputChangeListeners) { listener.inputChanged(fInput); } }

Target:
public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof BrowserInformationControlInput, input != null ? input.getClass().getName() : null); if (input instanceof String) { setInformation((String)input); return; } fInput= (BrowserInformationControlInput)input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); String[] styles= null; if (RTL && resizable) styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; else if (RTL && !resizable) styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; else if (!resizable) styles= new String[] { "overflow:hidden;" }; else styles= new String[] { "overflow:scroll;" }; StringBuffer buffer= new StringBuffer(content); HTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); fCompleted= false; fBrowser.setText(content); for (IInputChangedListener listener : fInputChangeListeners) { listener.inputChanged(fInput); } }
Source:
public boolean isEnumerated() { return enumerators != null && enumerators.length > 0; }

Target:
public boolean isEnumerated() { return type == Value.ENUM; }
Source:
private void onEditExpenseResult(Intent data) { ExpenseClaim claim = (ExpenseClaim)data.getSerializableExtra(ExpenseClaimDetailActivity.EXTRA_EXPENSE_CLAIM); int position = data.getIntExtra(ExpenseClaimDetailActivity.EXTRA_EXPENSE_CLAIM_INDEX, -1); listModel.set(position, claim); if(checkFilteredTags()) { setFilteredClaims(); } }

Target:
private void onEditExpenseResult(Intent data) { ExpenseClaim claim = (ExpenseClaim)data.getSerializableExtra(ExpenseClaimDetailActivity.EXTRA_EXPENSE_CLAIM); int position = data.getIntExtra(ExpenseClaimDetailActivity.EXTRA_EXPENSE_CLAIM_INDEX, -1); listModel.set(position, claim); if (!filteredTagsList.isEmpty()) { setFilteredClaims(); } }
Source:
public List<Page> findPageByURI(Locale fullLocale, Locale languageOnlyLocale, String uri) { Query query; if (languageOnlyLocale == null) { languageOnlyLocale = fullLocale; } query = em.createNamedQuery("BC_READ_PAGE_BY_URI"); query.setParameter("fullLocale", fullLocale); query.setParameter("languageOnlyLocale", languageOnlyLocale); query.setParameter("uri", uri); query.setHint(QueryHints.HINT_CACHEABLE, true); try { return query.getResultList(); } catch (NoResultException | EntityNotFoundException e) { return new ArrayList<>(); } }

Target:
public List<Page> findPageByURI(Locale fullLocale, Locale languageOnlyLocale, String uri) { Query query; if (languageOnlyLocale == null) { languageOnlyLocale = fullLocale; } query = em.createNamedQuery("BC_READ_PAGE_BY_URI"); query.setParameter("fullLocale", fullLocale); query.setParameter("languageOnlyLocale", languageOnlyLocale); query.setParameter("uri", uri); query.setHint(QueryHints.HINT_CACHEABLE, true); try { return query.getResultList(); } catch (NoResultException | EntityNotFoundException e) { return Collections.emptyList(); } }
Source:
protected synchronized boolean ensureCoordinatorReady(final Timer timer) { if (!coordinatorUnknown()) return true; do { if (findCoordinatorException != null && !(findCoordinatorException instanceof RetriableException)) { final RuntimeException fatalException = findCoordinatorException; findCoordinatorException = null; throw fatalException; } final RequestFuture<Void> future = lookupCoordinator(); client.poll(future, timer); if (!future.isDone()) { future.addListener(new RequestFutureListener<Void>() { @Override public void onSuccess(Void value) @Override public void onFailure(RuntimeException e) { findCoordinatorException = e; } }); break; } if (future.failed()) { if (future.isRetriable()) { log.debug("Coordinator discovery failed, refreshing metadata"); client.awaitMetadataUpdate(timer); } else throw future.exception(); } else if (coordinator != null && client.isUnavailable(coordinator)) { markCoordinatorUnknown(); timer.sleep(rebalanceConfig.retryBackoffMs); } } while (coordinatorUnknown() && timer.notExpired()); return !coordinatorUnknown(); }

Target:
protected synchronized boolean ensureCoordinatorReady(final Timer timer) { if (!coordinatorUnknown()) return true; do { if (findCoordinatorException != null && !(findCoordinatorException instanceof RetriableException)) { final RuntimeException fatalException = findCoordinatorException; findCoordinatorException = null; throw fatalException; } final RequestFuture<Void> future = lookupCoordinator(); client.poll(future, timer); if (!future.isDone()) { break; } if (future.failed()) { if (future.isRetriable()) { log.debug("Coordinator discovery failed, refreshing metadata"); client.awaitMetadataUpdate(timer); } else throw future.exception(); } else if (coordinator != null && client.isUnavailable(coordinator)) { markCoordinatorUnknown(); timer.sleep(rebalanceConfig.retryBackoffMs); } } while (coordinatorUnknown() && timer.notExpired()); return !coordinatorUnknown(); }
Source:
protected void execute() { logger.debug("execute() method is called!"); for (PowerDogLocalApiBindingProvider provider : providers) { for (String itemName : provider.getInBindingItemNames()) { int refreshInterval = provider.getRefreshInterval(itemName); Long lastUpdateTimeStamp = lastUpdateMap.get(itemName); if (lastUpdateTimeStamp == null) { lastUpdateTimeStamp = 0L; } long age = System.currentTimeMillis() - lastUpdateTimeStamp; boolean itemNeedsUpdate = (age >= refreshInterval); if (itemNeedsUpdate) { logger.debug("Item '{}' is about to be refreshed now", itemName); String unit = provider.getServerId(itemName); PowerDogLocalApiServerConfig server = serverList.get(unit); boolean serverNeedsUpdate = false; if (server == null) { serverNeedsUpdate = false; logger.error("Unknown PowerDog server referenced: " + unit); continue; } else { age = System.currentTimeMillis() - server.lastUpdate; serverNeedsUpdate = (age >= server.refresh); } XmlRpcStruct response = loadPowerDogResponse( serverNeedsUpdate, server); if (response != null) { String value = getVariable(response, provider.getValueId(itemName), provider.getName(itemName)); if (value != null) { Class<? extends Item> itemType = provider .getItemType(itemName); State state = createState(itemType, value); eventPublisher.postUpdate(itemName, state); lastUpdateMap.put(itemName, System.currentTimeMillis()); } } } } } logger.debug("execute() method is finished!"); }

Target:
protected void execute() { logger.debug("execute() method is called!"); for (PowerDogLocalApiBindingProvider provider : providers) { for (String itemName : provider.getInBindingItemNames()) { int refreshInterval = provider.getRefreshInterval(itemName); Long lastUpdateTimeStamp = lastUpdateMap.get(itemName); if (lastUpdateTimeStamp == null) { lastUpdateTimeStamp = 0L; } long age = System.currentTimeMillis() - lastUpdateTimeStamp; boolean itemNeedsUpdate = (age >= refreshInterval); if (itemNeedsUpdate) { logger.debug("Item '{}' is about to be refreshed now", itemName); String unit = provider.getServerId(itemName); PowerDogLocalApiServerConfig server = serverList.get(unit); boolean serverNeedsUpdate = false; if (server == null) { serverNeedsUpdate = false; logger.error("Unknown PowerDog server referenced: {}", unit); continue; } else { age = System.currentTimeMillis() - server.lastUpdate; serverNeedsUpdate = (age >= server.refresh); } XmlRpcStruct response = loadPowerDogResponse(serverNeedsUpdate, server); if (response != null) { String value = getVariable(response, provider.getValueId(itemName), provider.getName(itemName)); if (value != null) { Class<? extends Item> itemType = provider.getItemType(itemName); State state = createState(itemType, value); eventPublisher.postUpdate(itemName, state); lastUpdateMap.put(itemName, System.currentTimeMillis()); } } } } } logger.debug("execute() method is finished!"); }
Source:
public int getAvbPublicKey(AvbPublicKey dst) { try { return mService.getAvbPublicKey(dst); } catch (RemoteException e) { throw new RuntimeException(e.toString()); } }

Target:
public boolean getAvbPublicKey(AvbPublicKey dst) { try { return mService.getAvbPublicKey(dst); } catch (RemoteException e) { throw new RuntimeException(e.toString()); } }
Source:
public Cluster selectCluster( @Nonnull @NonNull @NotEmpty final Set<Cluster> clusters, @Nonnull @NonNull final JobRequest jobRequest ) throws GenieException { final long selectStart = System.nanoTime(); log.debug("Called"); final Set<Tag> tags = Sets.newHashSet(); try { final CompiledScript script = this.loader.get(); if (script == null) { log.debug("Script not configured"); tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_NOT_CONFIGURED)); return null; } final String clusterId = this.evaluator.evaluate(script, jobRequest, clusters); if (clusterId == null) { tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_NO_PREFERENCE)); log.debug("Script returned null, no preference"); return null; } for (final Cluster cluster : clusters) { if (clusterId.equals(cluster.getId())) { tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_FOUND)); return cluster; } } log.warn("Script returned a cluster not in the input list: {}", clusterId); tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_NOT_FOUND)); return null; } catch (final Exception e) { tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_FAILED)); tags.add(Tag.of(MetricsConstants.TagKeys.EXCEPTION_CLASS, e.getClass().getCanonicalName())); log.error("Unable to execute script due to {}", e.getMessage(), e); return null; } finally { this.registry .timer(SELECT_TIMER_NAME, tags) .record(System.nanoTime() - selectStart, TimeUnit.NANOSECONDS); } }

Target:
public Cluster selectCluster( @Nonnull @NonNull @NotEmpty final Set<Cluster> clusters, @Nonnull @NonNull final JobRequest jobRequest ) throws GenieException { final long selectStart = System.nanoTime(); log.debug("Called"); final Set<Tag> tags = Sets.newHashSet(); try { final CompiledScript script = this.loader.get(); if (script == null) { log.debug("Script not configured"); tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_NOT_CONFIGURED)); return null; } final String clusterId = this.evaluator.evaluate(script, jobRequest, clusters); if (clusterId == null) { tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_NO_PREFERENCE)); log.debug("Script returned null, no preference"); return null; } for (final Cluster cluster : clusters) { if (clusterId.equals(cluster.getId())) { tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_FOUND)); tags.add(Tag.of(MetricsConstants.TagKeys.CLUSTER_NAME, cluster.getMetadata().getName())); tags.add(Tag.of(MetricsConstants.TagKeys.CLUSTER_ID, cluster.getId())); return cluster; } } log.warn("Script returned a cluster not in the input list: {}", clusterId); tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_NOT_FOUND)); return null; } catch (final Exception e) { tags.add(Tag.of(MetricsConstants.TagKeys.STATUS, STATUS_TAG_FAILED)); tags.add(Tag.of(MetricsConstants.TagKeys.EXCEPTION_CLASS, e.getClass().getCanonicalName())); log.error("Unable to execute script due to {}", e.getMessage(), e); return null; } finally { this.registry .timer(SELECT_TIMER_NAME, tags) .record(System.nanoTime() - selectStart, TimeUnit.NANOSECONDS); } }
Source:
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { super.bridgeStatusChanged(bridgeStatusInfo); if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE) { scheduler.schedule(() -> { coapClient.startObserve(this); }, 0, TimeUnit.SECONDS); } }

Target:
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { super.bridgeStatusChanged(bridgeStatusInfo); if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE) { scheduler.submit(() -> coapClient.startObserve(this)); } }
Source:
private void markReloadTimerElapsed() { this.reloadTimerElapsed = true; updateReloadButton(); }

Target:
private void markReloadTimerElapsed() { reloadTimerElapsed = true; updateReloadButton(); }
Source:
private boolean isMessageBlocked(SignalServiceEnvelope envelope, SignalServiceContent content) { SignalServiceAddress source = envelope.getSourceAddress(); ContactInfo sourceContact = getContact(source.getNumber().get()); if (sourceContact != null && sourceContact.blocked) { return true; } if (content != null && content.getDataMessage().isPresent()) { SignalServiceDataMessage message = content.getDataMessage().get(); if (message.getGroupInfo().isPresent()) { SignalServiceGroup groupInfo = message.getGroupInfo().get(); GroupInfo group = getGroup(groupInfo.getGroupId()); if (groupInfo.getType() == SignalServiceGroup.Type.DELIVER && group != null && group.blocked) { return true; } } } return false; }

Target:
private boolean isMessageBlocked(SignalServiceEnvelope envelope, SignalServiceContent content) { SignalServiceAddress source; if (!envelope.isUnidentifiedSender() && envelope.hasSource()) { source = envelope.getSourceAddress(); } else if (content != null) { source = content.getSender(); } else { return false; } ContactInfo sourceContact = getContact(source.getNumber().get()); if (sourceContact != null && sourceContact.blocked) { return true; } if (content != null && content.getDataMessage().isPresent()) { SignalServiceDataMessage message = content.getDataMessage().get(); if (message.getGroupInfo().isPresent()) { SignalServiceGroup groupInfo = message.getGroupInfo().get(); GroupInfo group = getGroup(groupInfo.getGroupId()); if (groupInfo.getType() == SignalServiceGroup.Type.DELIVER && group != null && group.blocked) { return true; } } } return false; }
Source:
public S3ListResult next() throws IOException { if (firstListing) { firstListing = false; objects = awaitFuture(s3ListResultFuture); fetchNextBatchAsyncIfPresent(); } else { try { if (objectsPrev!= null && !objectsPrev.isTruncated()) { throw new NoSuchElementException("No more results in listing of " + listPath); } objects = awaitFuture(s3ListResultFuture); LOG.debug("[{}], Requesting next objects under {}", listingCount, maxKeys, listPath); fetchNextBatchAsyncIfPresent(); listingCount++; LOG.debug("New listing status: {}", this); } catch (AmazonClientException e) { throw translateException("listObjects()", listPath, e); } } objectsPrev = objects; return objectsPrev; }

Target:
public S3ListResult next() throws IOException { if (firstListing) { firstListing = false; objects = awaitFuture(s3ListResultFuture); fetchNextBatchAsyncIfPresent(); } else { try { if (objectsPrev!= null && !objectsPrev.isTruncated()) { throw new NoSuchElementException("No more results in listing of " + listPath); } objects = awaitFuture(s3ListResultFuture); fetchNextBatchAsyncIfPresent(); listingCount++; LOG.debug("New listing status: {}", this); } catch (AmazonClientException e) { throw translateException("listObjects()", listPath, e); } } objectsPrev = objects; return objectsPrev; }
Source:
public void read(CorfuPayloadMsg<ReadRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { boolean cacheable = msg.getPayload().isCacheReadResult(); if (log.isTraceEnabled()) { log.trace("read: {}, cacheable: {}", msg.getPayload().getAddresses(), cacheable); } ReadResponse rr = new ReadResponse(); long currentRead = Address.NON_ADDRESS; try { for (Long address : msg.getPayload().getAddresses()) { currentRead = address; ILogData logData = dataCache.get(address, cacheable); if (logData == null) { rr.put(address, LogData.getEmpty(address)); } else { rr.put(address, (LogData) logData); } } r.sendResponse(ctx, msg, CorfuMsgType.READ_RESPONSE.payloadMsg(rr)); } catch (DataCorruptionException e) { log.error( "Data corruption exception while reading addresses {}", msg.getPayload().getAddresses(), e); r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_CORRUPTION.payloadMsg(currentRead)); } }

Target:
public void read(CorfuPayloadMsg<ReadRequest> msg, ChannelHandlerContext ctx, IServerRouter r) { boolean cacheable = msg.getPayload().isCacheReadResult(); if (log.isTraceEnabled()) { log.trace("read: {}, cacheable: {}", msg.getPayload().getAddresses(), cacheable); } ReadResponse rr = new ReadResponse(); for (long address : msg.getPayload().getAddresses()) { try { ILogData logData = dataCache.get(address, cacheable); if (logData == null) { rr.put(address, LogData.getEmpty(address)); } else { rr.put(address, (LogData) logData); } } catch (DataCorruptionException e) { log.error( "Data corruption exception while reading addresses {}", msg.getPayload().getAddresses(), e); r.sendResponse(ctx, msg, CorfuMsgType.ERROR_DATA_CORRUPTION.payloadMsg(address)); return; } } r.sendResponse(ctx, msg, CorfuMsgType.READ_RESPONSE.payloadMsg(rr)); }
Source:
public String validate(Model model, @RequestParam String verificationCode) { String redirectUri = "redirect:/"; try { TwoFactorAuthenticationToken authToken = new TwoFactorAuthenticationToken(verificationCode, null); Authentication authentication = authenticationProvider.authenticate(authToken); SecurityContextHolder.getContext().setAuthentication(authentication); } catch (Exception err) { model.addAttribute(MolgenisLoginController.ERROR_MESSAGE_ATTRIBUTE, determineErrorMessage(err)); redirectUri = VIEW_2FA_CONFIGURED_MODAL; } return redirectUri; }

Target:
public String validate(Model model, @RequestParam String verificationCode) { String redirectUri = "redirect:/"; try { TwoFactorAuthenticationToken authToken = new TwoFactorAuthenticationToken(verificationCode, null); Authentication authentication = authenticationProvider.authenticate(authToken); SecurityContextHolder.getContext().setAuthentication(authentication); } catch (AuthenticationException err) { model.addAttribute(MolgenisLoginController.ERROR_MESSAGE_ATTRIBUTE, determineErrorMessage(err)); redirectUri = VIEW_2FA_CONFIGURED_MODAL; } return redirectUri; }
Source:
public ArtifactoryClientBuilder addInterceptorLast(HttpRequestInterceptor httpRequestInterceptor) { if (this.requestInterceptorList == null) { this.requestInterceptorList = new ArrayList<>(); } this.requestInterceptorList.add(httpRequestInterceptor); return this; }

Target:
public ArtifactoryClientBuilder addInterceptorLast(HttpRequestInterceptor httpRequestInterceptor) { this.requestInterceptorList.add(httpRequestInterceptor); return this; }
Source:
public void setupVariableContent() { IPathVariableManager pathVariableManager; if (content.getResource() != null) pathVariableManager = content.getResource().getPathVariableManager(); else pathVariableManager = ResourcesPlugin.getWorkspace().getPathVariableManager(); ArrayList items = new ArrayList(); for (String variable : pathVariableManager.getPathVariableNames()) { if (variable.equals("PARENT")) continue; items.add(variable); } items.add(IDEWorkbenchMessages.ImportTypeDialog_editVariables); variableCombo.setItems((String[]) items.toArray(new String[0])); }

Target:
public void setupVariableContent() { IPathVariableManager pathVariableManager; if (content.getResource() != null) pathVariableManager = content.getResource().getPathVariableManager(); else pathVariableManager = ResourcesPlugin.getWorkspace().getPathVariableManager(); ArrayList items = new ArrayList(); for (String variableName : pathVariableManager.getPathVariableNames()) { if (variableName.equals("PARENT")) continue; items.add(variableName); } items.add(IDEWorkbenchMessages.ImportTypeDialog_editVariables); variableCombo.setItems((String[]) items.toArray(new String[0])); }
Source:
public void handleError(final HttpCommand command, final HttpResponse response) { Exception exception = null; try { switch (response.getStatusCode()) { case 400: case 405: exception = new IllegalArgumentException(response.getMessage(), exception); break; case 401: exception = new AuthorizationException("This request requires authentication.", exception); break; case 402: case 409: exception = new IllegalStateException(response.getMessage(), exception); break; case 404: case 410: if (!command.getCurrentRequest().getMethod().equals("DELETE")) exception = new ResourceNotFoundException(response.getMessage(), exception); break; case 413: case 503: if (response.getMessage().equals("OK")) exception = new HttpResponseException("The OneAndOne team is currently carrying out maintenance.", command, response); else exception = new InsufficientResourcesException(response.getMessage(), exception); break; } } finally { closeQuietly(response.getPayload()); command.setException(exception); } }

Target:
public void handleError(final HttpCommand command, final HttpResponse response) { Exception exception = null; try { switch (response.getStatusCode()) { case 400: case 405: exception = new IllegalArgumentException(response.getMessage(), exception); break; case 401: exception = new AuthorizationException("This request requires authentication.", exception); break; case 402: case 409: exception = new IllegalStateException(response.getMessage(), exception); break; case 404: case 410: if (!command.getCurrentRequest().getMethod().equals("DELETE")) { exception = new ResourceNotFoundException(response.getMessage(), exception); } break; case 413: case 503: if (response.getMessage().equals("OK")) { exception = new HttpResponseException("The OneAndOne team is currently carrying out maintenance.", command, response); } else { exception = new InsufficientResourcesException(response.getMessage(), exception); } break; default: exception = new HttpResponseException("A generic error occured.", command, response); break; } } finally { closeQuietly(response.getPayload()); command.setException(exception); } }
Source:
private boolean collectElementData(String id, Field field) { idByField.put(field, id); if (templateRoot != null) { Optional<Element> element = Optional .ofNullable(templateRoot.getElementById(id)); Optional<String> tagName = element .map(org.jsoup.nodes.Element::tagName); if (element.isPresent()) { tagById.put(id, tagName.get()); fetchAttributes(id, element.get().attributes()); } return tagName.isPresent(); } return true; }

Target:
private boolean collectElementData(String id, Field field) { idByField.put(field, id); if (templateRoot != null) { Optional<Element> element = Optional .ofNullable(templateRoot.getElementById(id)); Optional<String> tagName = element .map(org.jsoup.nodes.Element::tagName); if (element.isPresent()) { tagById.put(id, tagName.get()); fetchAttributes(id, element.get().attributes()); } return element.isPresent(); } return true; }
Source:
public void execute(TinkerpopGraphManager graphManager) throws IOException { DataStoreOperations dataStoreOperations = new DataStoreOperations( graphManager, new DeafListener(), new GremlinEntityFetcher(), null, new Neo4jIndexHandler(graphManager) ); Vres vres = dataStoreOperations.loadVres(); Neo4jIndexHandler indexHandler = new Neo4jIndexHandler(graphManager); ObjectMapper mapper = new ObjectMapper(); GraphTraversalSource traversalSource = graphManager.getGraph().traversal(); traversalSource .V() .has("types") .forEachRemaining(vertex -> { try { String[] types = mapper.readValue(vertex.<String>value("types"), String[].class); for (String type : types) { if (TYPES_TO_IGNORE.contains(type)) { continue; } if (vres.getCollectionForType(type).isPresent()) { VertexProperty<String> timIdProp = vertex.property("tim_id"); if (timIdProp.isPresent()) { UUID timId = UUID.fromString(timIdProp.value()); indexHandler.addToIdIndex(timId, vertex); } else { LOG.error("Vertex with id '{}' has no 'tim_id' property", vertex.id()); } } else { LOG.error("'{}' is not a known entity type.", type); } } } catch (IOException e) { LOG.error("And exception occurred while indexing vertex with vertex id '{}'.", vertex.id()); } }); }

Target:
public void execute(TinkerpopGraphManager graphManager) throws IOException { DataStoreOperations dataStoreOperations = new DataStoreOperations( graphManager, new DeafListener(), new GremlinEntityFetcher(), null, new Neo4jIndexHandler(graphManager) ); Vres vres = dataStoreOperations.loadVres(); Neo4jIndexHandler indexHandler = new Neo4jIndexHandler(graphManager); ObjectMapper mapper = new ObjectMapper(); GraphTraversalSource traversalSource = graphManager.getGraph().traversal(); traversalSource .V() .has("types") .forEachRemaining(vertex -> { try { String[] types = mapper.readValue(vertex.<String>value("types"), String[].class); for (String type : types) { if (TYPES_TO_IGNORE.contains(type)) { continue; } if (vres.getCollectionForType(type).isPresent()) { VertexProperty<String> timIdProp = vertex.property("tim_id"); if (timIdProp.isPresent()) { try { UUID timId = UUID.fromString(timIdProp.value()); indexHandler.insertIntoIdIndex(timId, vertex); } catch (IllegalArgumentException e) { LOG.error("'{}' is not a valid id", timIdProp.value()); } } else { LOG.error("Vertex with id '{}' has no 'tim_id' property", vertex.id()); } } else { LOG.error("'{}' is not a known entity type.", type); } } } catch (IOException e) { LOG.error("And exception occurred while indexing vertex with vertex id '{}'.", vertex.id()); } }); }
Source:
public GroupCreateRequest(User creator, Group group) { super(); mCreator = creator; mGroup = group; }

Target:
public GroupCreateRequest(User creator, Group group) { super(); Objects.requireNonNull(creator); Objects.requireNonNull(group); mCreator = creator; mGroup = group; }
Source:
private synchronized void instantiateInvalidType(Environment env) { if(invalidType != UNINITIALIZED) { return; } @SuppressWarnings("LocalVariableHidesMemberVariable") String fqcn = this.fqcn.getFQCN(); try { if("auto".equals(fqcn)) { invalidType = null; } else if("ms.lang.ClassType".equals(fqcn)) { invalidType = new Mixed[]{this}; } else { invalidType = new Mixed[types.size()]; for(int i = 0; i < invalidType.length; i++) { if(NativeTypeList.getNativeTypeList().contains(this.fqcn)) { invalidType[i] = NativeTypeList.getInvalidInstanceForUse(this.fqcn); } else { ObjectDefinitionTable odt = env.getEnv(CompilerEnvironment.class).getObjectDefinitionTable(); ObjectDefinition od = odt.get(this.fqcn); invalidType[i] = new UserObject(Target.UNKNOWN, null, env, od, null); } } } } catch (ClassNotFoundException | ObjectDefinitionNotFoundException ex) { throw new Error(ex); } }

Target:
private void instantiateInvalidType(Environment env) { if(this.invalidType != UNINITIALIZED) { return; } synchronized(this) { if(this.invalidType != UNINITIALIZED) { return; } @SuppressWarnings("LocalVariableHidesMemberVariable") String fqcn = this.fqcn.getFQCN(); try { Mixed[] invalidType; if("auto".equals(fqcn)) { invalidType = null; } else if("ms.lang.ClassType".equals(fqcn)) { invalidType = new Mixed[]{this}; } else { invalidType = new Mixed[this.types.size()]; for(int i = 0; i < invalidType.length; i++) { if(NativeTypeList.getNativeTypeList().contains(this.fqcn)) { invalidType[i] = NativeTypeList.getInvalidInstanceForUse(this.fqcn); } else { ObjectDefinitionTable odt = env.getEnv(CompilerEnvironment.class).getObjectDefinitionTable(); ObjectDefinition od = odt.get(this.fqcn); invalidType[i] = new UserObject(Target.UNKNOWN, null, env, od, null); } } } this.invalidType = invalidType; } catch (ClassNotFoundException | ObjectDefinitionNotFoundException ex) { throw new Error(ex); } } }
Source:
private void fireDataChangedEvents(final String path, Set<IZkDataListenerEntry> listeners, final OptionalLong notificationTime, boolean pathExists) { try { final ZkPathStatRecord pathStatRecord = new ZkPathStatRecord(path); for (final IZkDataListenerEntry listener : listeners) { _eventThread.send(new ZkEventThread.ZkEvent( "Data of " + path + " changed sent to " + listener.getDataListener() + " prefetch data: " + listener.isPrefetchData()) { @Override public void run() throws Exception { if (!pathStatRecord.pathChecked()) { if (!pathExists) { pathStatRecord.recordPathStat(getStat(path, false), notificationTime); } else { pathStatRecord.recordPathStat(getStat(path, true, true), notificationTime); } } if (!pathStatRecord.pathExists()) { listener.getDataListener().handleDataDeleted(path); } else { Object data = null; if (listener.isPrefetchData()) { if (LOG.isDebugEnabled()) { LOG.debug("Prefetch data for path: {}", path); } try { data = readData(path, null, true); } catch (ZkNoNodeException e) { LOG.warn("Prefetch data for path: failed.", path, e); listener.getDataListener().handleDataDeleted(path); return; } } listener.getDataListener().handleDataChange(path, data); } } }); } } catch (Exception e) { LOG.error("Failed to fire data changed event for path: {}", path, e); } }

Target:
private void fireDataChangedEvents(final String path, Set<IZkDataListenerEntry> listeners, final OptionalLong notificationTime, boolean pathExists) { try { final ZkPathStatRecord pathStatRecord = new ZkPathStatRecord(path); for (final IZkDataListenerEntry listener : listeners) { _eventThread.send(new ZkEventThread.ZkEvent( "Data of " + path + " changed sent to " + listener.getDataListener() + " prefetch data: " + listener.isPrefetchData()) { @Override public void run() throws Exception { if (!pathStatRecord.pathChecked()) { Stat stat = null; if (!pathExists) { stat = getStat(path, false); } else { stat = installWatchOnlyPathExist(path); } pathStatRecord.recordPathStat(stat, notificationTime); } if (!pathStatRecord.pathExists()) { listener.getDataListener().handleDataDeleted(path); } else { Object data = null; if (listener.isPrefetchData()) { if (LOG.isDebugEnabled()) { LOG.debug("Prefetch data for path: {}", path); } try { data = readData(path, null, true); } catch (ZkNoNodeException e) { LOG.warn("Prefetch data for path: failed.", path, e); listener.getDataListener().handleDataDeleted(path); return; } } listener.getDataListener().handleDataChange(path, data); } } }); } } catch (Exception e) { LOG.error("Failed to fire data changed event for path: {}", path, e); } }
Source:
public void tearDown() throws Exception { super.tearDown(); mIccRecords.dispose(); }

Target:
public void tearDown() throws Exception { super.tearDown(); }