auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void insertWrongReference() throws NamingException, SQLException, AssertionFailedError { DataSource ds = DataSourceHelper.getDataSource("jdbc/canrollback"); try (Connection db = ds.getConnection()) { try (Statement st = db.createStatement()) { st.execute("INSERT INTO footest (a) VALUES (0)"); st.execute("INSERT INTO footest (a) VALUES (1)"); st.execute("INSERT INTO footest (a) VALUES (1)"); } } catch (SQLException cause) { cause.printStackTrace(); TransactionHelper.setTransactionRollbackOnly(); throw cause; } finally { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); try (Connection db = ds.getConnection()) { try (Statement st = db.createStatement()) { try (ResultSet rs = st.executeQuery("SELECT a FROM footest WHERE a = 0")) { if (rs.next()) { throw new AssertionFailedError("connection was not rollbacked"); } } } } } }

Target:
private void insertWrongReference() throws NamingException, SQLException, AssertionFailedError { DataSource ds = DataSourceHelper.getDataSource("jdbc/canrollback"); try (Connection db = ds.getConnection()) { try (Statement st = db.createStatement()) { st.execute("INSERT INTO footest (a) VALUES (0)"); st.execute("INSERT INTO footest (a) VALUES (1)"); st.execute("INSERT INTO footest (a) VALUES (1)"); } } catch (SQLException cause) { TransactionHelper.setTransactionRollbackOnly(); throw cause; } finally { TransactionHelper.commitOrRollbackTransaction(); TransactionHelper.startTransaction(); try (Connection db = ds.getConnection()) { try (Statement st = db.createStatement()) { try (ResultSet rs = st.executeQuery("SELECT a FROM footest WHERE a = 0")) { if (rs.next()) { throw new AssertionFailedError("connection was not rollbacked"); } } } } } }
Source:
protected Object getTargetObject(boolean key) { Object targetObject; if (key) { if (keyData.isPortable() || keyData.getType() == JAVASCRIPT_JSON_SERIALIZATION_TYPE) { targetObject = keyData; } else { targetObject = getKey(); } } else { if (valueObject == null) { if (valueData.isPortable() || valueData.getType() == JAVASCRIPT_JSON_SERIALIZATION_TYPE) { targetObject = valueData; } else { targetObject = getValue(); } } else { if (valueObject instanceof Portable) { targetObject = getValueData(); } else { targetObject = getValue(); } } } return targetObject; }

Target:
protected Object getTargetObject(boolean key) { Object targetObject; if (key) { if (keyData.isPortable() || keyData.isJson()) { targetObject = keyData; } else { targetObject = getKey(); } } else { if (valueObject == null) { if (valueData.isPortable() || valueData.isJson()) { targetObject = valueData; } else { targetObject = getValue(); } } else { if (valueObject instanceof Portable) { targetObject = getValueData(); } else { targetObject = getValue(); } } } return targetObject; }
Source:
public void testAddJumpStitchPoint() { EmbroideryStream stream = new DSTStream(); stream.addJump(); stream.addStitchPoint(0, 0); assertEquals(1, stream.getPointList().size()); assertTrue(stream.getPointList().get(0).isJumpPoint()); }

Target:
public void testAddJumpStitchPoint() { stream.addJump(); stream.addStitchPoint(0, 0); assertEquals(1, stream.getPointList().size()); assertTrue(stream.getPointList().get(0).isJumpPoint()); }
Source:
private void printIfEnabled(MetricAttribute type, String status) { if(isMetricAttributeDisabled(type)) { return; } output.println(status); }

Target:
private void printIfEnabled(MetricAttribute type, String status) { if(getDisabledMetricAttributes().contains(type)) { return; } output.println(status); }
Source:
protected SIRIUS getParentOf(SIRIUS description) { SIRIUS nextParent = null; EStructuralFeature extensionFeature = description.eClass().getEStructuralFeature(EXTENDS_FEATURE_NAME); if (extensionFeature instanceof EReference) { EReference extendsEReference = (EReference) extensionFeature; if (extendsEReference.getEType().equals(description.eClass()) && !extendsEReference.isMany()) { Object currentExtends = description.eGet(extendsEReference); if (currentExtends != null && description.getClass().isAssignableFrom(currentExtends.getClass())) { nextParent = this.descriptionClass.cast(currentExtends); } } } return nextParent; }

Target:
protected Optional<SIRIUS> getParentOf(SIRIUS description) { Optional<SIRIUS> nextParent = Optional.empty(); EStructuralFeature extensionFeature = description.eClass().getEStructuralFeature(EXTENDS_FEATURE_NAME); if (extensionFeature instanceof EReference) { EReference extendsEReference = (EReference) extensionFeature; if (extendsEReference.getEType().equals(description.eClass()) && !extendsEReference.isMany()) { Optional<Object> currentExtends = Optional.ofNullable(description.eGet(extendsEReference)); nextParent = currentExtends.filter(ref -> description.getClass().isAssignableFrom(ref.getClass())).map(ref -> this.descriptionClass.cast(ref)); } } return nextParent; }
Source:
private static Node provisionNewNode(final CloudProvisioningRecord whatWeShouldSpinUp, final String cloneName) throws VSphereException, FormException, IOException, InterruptedException { final vSphereCloudSlaveTemplate template = whatWeShouldSpinUp.getTemplate(); final vSphereCloudProvisionedSlave slave = template.provision(cloneName, StreamTaskListener.fromStdout()); Jenkins.get().addNode(slave); return slave; }

Target:
private static Node provisionNewNode(final CloudProvisioningRecord whatWeShouldSpinUp, final String cloneName) throws VSphereException, FormException, IOException, InterruptedException { final vSphereCloudSlaveTemplate template = whatWeShouldSpinUp.getTemplate(); final vSphereCloudProvisionedSlave slave = template.provision(cloneName, StreamTaskListener.fromStdout()); Jenkins.getInstance().addNode(slave); return slave; }
Source:
private DockerClient createDockerClient(final AgentConfig config) { final DefaultDockerClient.Builder builder = DefaultDockerClient.builder() .uri(config.getDockerHost().uri()) .connectionPoolSize(config.getConnectionPoolSize()); if (!isNullOrEmpty(config.getDockerHost().dockerCertPath())) { final Path dockerCertPath = java.nio.file.Paths.get(config.getDockerHost().dockerCertPath()); final DockerCertificates dockerCertificates; try { dockerCertificates = new DockerCertificates(dockerCertPath); } catch (DockerCertificateException e) { throw Throwables.propagate(e); } builder.dockerCertificates(dockerCertificates); } return new PollingDockerClient(builder); }

Target:
private DockerClient createDockerClient(final AgentConfig config) { final DefaultDockerClient.Builder builder = DefaultDockerClient.builder() .uri(config.getDockerHost().uri()); if (config.getConnectionPoolSize() != -1) { builder.connectionPoolSize(config.getConnectionPoolSize()); } if (!isNullOrEmpty(config.getDockerHost().dockerCertPath())) { final Path dockerCertPath = java.nio.file.Paths.get(config.getDockerHost().dockerCertPath()); final DockerCertificates dockerCertificates; try { dockerCertificates = new DockerCertificates(dockerCertPath); } catch (DockerCertificateException e) { throw Throwables.propagate(e); } builder.dockerCertificates(dockerCertificates); } return new PollingDockerClient(builder); }
Source:
private List getListFromSerializableCollection(Collection<?> objects) { List serializableItems = new ArrayList<>(objects.size()); Iterator<? extends Object> iterator = objects.iterator(); while (iterator.hasNext()) { Object o = iterator.next(); serializableItems.add(o); } return serializableItems; }

Target:
private List getListFromSerializableCollection(Collection<?> objects) { List serializableItems = new ArrayList<>(objects.size()); serializableItems.addAll(objects); return serializableItems; }
Source:
private void ttsSpeak(String text, int queue, String utteranceId) { if (BuildConfig.DEBUG && !(state == State.PLAYING || isTTSInitialized)) { throw new AssertionError(); } if (text != null) { HashMap params = this.utteranceParams; if ( ! utteranceId.equals(params.get("utteranceId"))) { params = new HashMap(); params.put("utteranceId", utteranceId); this.utteranceParams = params; } this.tts.speak(text, queue, params); } }

Target:
private void ttsSpeak(String text, int queue, String utteranceId) { if (BuildConfig.DEBUG && !(state == State.PLAYING && isTTSInitialized)) { throw new AssertionError(); } if (text != null) { HashMap params = this.utteranceParams; if ( ! utteranceId.equals(params.get("utteranceId"))) { params = new HashMap(); params.put("utteranceId", utteranceId); this.utteranceParams = params; } this.tts.speak(text, queue, params); } }
Source:
public Object getElementToHighlightAtPosition(View element, int x, int y, Rect bounds) { if (element instanceof ViewGroup) { final ViewGroup vg = (ViewGroup) element; for (int i = 0, count = vg.getChildCount(); i < count; ++i) { final View child = vg.getChildAt(i); child.getHitRect(bounds); if (bounds.contains(x, y)) { return child; } } } bounds.set(0, 0, element.getWidth(), element.getHeight()); return element; }

Target:
public Object getElementToHighlightAtPosition(View element, int x, int y, Rect bounds) { bounds.set(0, 0, element.getWidth(), element.getHeight()); return element; }
Source:
public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition destinationAttributeDefinition) throws InternalErrorException { Attribute destinationAttribute = new Attribute(destinationAttributeDefinition); List<String> values = new ArrayList<>(); String sourceAttributeFriendlyName = getSourceAttributeFriendlyName(); List<UserExtSource> userExtSources = sess.getPerunBl().getUsersManagerBl().getUserExtSources(sess, user); AttributesManagerBl am = sess.getPerunBl().getAttributesManagerBl(); for (UserExtSource userExtSource : userExtSources) { try { Attribute a = am.getAttribute(sess, userExtSource, AttributesManager.NS_UES_ATTR_DEF + ":" + sourceAttributeFriendlyName); Object value = a.getValue(); if (value != null && value instanceof String) { String[] rawValues = ((String) value).split(";"); for(String rawValue: rawValues) { String modifiedValue = modifyValue(rawValue); if(modifiedValue != null && !modifiedValue.isEmpty()) { if(!values.contains(rawValue)) values.add(modifiedValue); } } } } catch (WrongAttributeAssignmentException | AttributeNotExistsException e) { log.error("cannot read " + sourceAttributeFriendlyName + " from userExtSource " + userExtSource.getId() + " of user " + user.getId(), e); } } destinationAttribute.setValue(values); return destinationAttribute; }

Target:
public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition destinationAttributeDefinition) throws InternalErrorException { Attribute destinationAttribute = new Attribute(destinationAttributeDefinition); Set<String> valuesWithoutDuplicities = new HashSet<>(); String sourceAttributeFriendlyName = getSourceAttributeFriendlyName(); List<UserExtSource> userExtSources = sess.getPerunBl().getUsersManagerBl().getUserExtSources(sess, user); AttributesManagerBl am = sess.getPerunBl().getAttributesManagerBl(); for (UserExtSource userExtSource : userExtSources) { try { Attribute a = am.getAttribute(sess, userExtSource, AttributesManager.NS_UES_ATTR_DEF + ":" + sourceAttributeFriendlyName); Object value = a.getValue(); if (value != null && value instanceof String) { String[] rawValues = ((String) value).split(";"); Arrays.stream(rawValues).map(this::modifyValue).filter(Objects::nonNull).forEachOrdered(valuesWithoutDuplicities::add); } } catch (WrongAttributeAssignmentException | AttributeNotExistsException e) { log.error("cannot read " + sourceAttributeFriendlyName + " from userExtSource " + userExtSource.getId() + " of user " + user.getId(), e); } } destinationAttribute.setValue(new ArrayList<>(valuesWithoutDuplicities)); return destinationAttribute; }
Source:
public void removeRepositories(Space space, Set<String> aliases) { try { configurationService.startBatch(); OrganizationalUnit orgUnit = Optional .ofNullable(organizationalUnitService.getOrganizationalUnit(space.getName())) .orElseThrow(() -> new IllegalArgumentException(String .format("The given space [%s] does not correspond to any known organizational unit.", space.getName()))); List<Repository> removedRepos = new ArrayList<>(); for (final String alias : aliases) { doRemoveRepository(orgUnit, alias, findRepositoryConfig(alias), repo -> removedRepos.add(repo)); } } catch (final Exception e) { logger.error("Error while removing repositories", e); throw new RuntimeException(e); } finally { configurationService.endBatch(); } }

Target:
public void removeRepositories(Space space, Set<String> aliases) { try { configurationService.startBatch(); OrganizationalUnit orgUnit = Optional .ofNullable(organizationalUnitService.getOrganizationalUnit(space.getName())) .orElseThrow(() -> new IllegalArgumentException(String .format("The given space [%s] does not correspond to any known organizational unit.", space.getName()))); for (final String alias : aliases) { doRemoveRepository(orgUnit, alias, findRepositoryConfig(alias), repo -> {}); } } catch (final Exception e) { logger.error("Error while removing repositories", e); throw new RuntimeException(e); } finally { configurationService.endBatch(); } }
Source:
public void visit(CommonCourtJudgment judgment) { initializeJudgment(judgment); if (judgment.getCourtDivision() != null) { JpaUtils.initialize(judgment.getCourtDivision()); JpaUtils.initialize(judgment.getCourtDivision().getCourt()); } }

Target:
public void visit(CommonCourtJudgment judgment) { initializeJudgment(judgment); JpaUtils.initialize(judgment.getCourtDivision()); JpaUtils.initialize(judgment.getCourtDivision().getCourt()); }
Source:
public void testFailed(ExtensionContext context, Throwable cause) { if (!(cause instanceof UIAssertionError)) { log.info(screenshot(driver())); SelenideLogger.commitStep(new SelenideLog(context.getTestMethod().toString(), context.getExecutionException().toString()), FAIL); } }

Target:
public void testFailed(ExtensionContext context, Throwable cause) { if (!(cause instanceof UIAssertionError)) { log.info(getScreenshot()); SelenideLogger.commitStep(new SelenideLog(context.getTestMethod().toString(), context.getExecutionException().toString()), FAIL); } }
Source:
private String getNameOfClass(Class<?> cls) { return useFqn?cls.getName():cls.getSimpleName(); }

Target:
protected String getNameOfClass(Class<?> cls) { return useFqn?cls.getName():cls.getSimpleName(); }
Source:
public void tap(String name, MessageChannel channel) { Assert.hasText(name, "A valid name is required to register a tap channel"); Assert.notNull(channel, "channel cannot be null"); DirectChannel localChannel = new DirectChannel(); localChannel.setComponentName(name); localChannel.setBeanFactory(applicationContext); localChannel.setBeanName(name); WireTap wiretap = new WireTap(localChannel); ((AbstractMessageChannel) channel).addInterceptor(wiretap); applicationContext.getBeanFactory().registerSingleton(name, localChannel); }

Target:
public void tap(String name, MessageChannel channel) { Assert.hasText(name, "A valid name is required to register a tap channel"); Assert.notNull(channel, "channel cannot be null"); SubscribableChannel registeredChannel = null; try { registeredChannel = applicationContext.getBean(name, SubscribableChannel.class); } catch (Exception e) { throw new IllegalArgumentException("No channel is currently registered for '" + name + "'"); } BridgeHandler handler = new BridgeHandler(); handler.setOutputChannel(channel); handler.afterPropertiesSet(); registeredChannel.subscribe(handler); }
Source:
public Select limit(int limit) { if (limit <= 0) throw new IllegalArgumentException("Invalid LIMIT value, must be strictly positive"); if (this.limit != null) throw new IllegalStateException("A LIMIT value has already been provided"); this.limit = limit; return this; }

Target:
public Select limit(int limit) { if (limit <= 0) throw new IllegalArgumentException("Invalid LIMIT value, must be strictly positive"); if (this.limit != null) throw new IllegalStateException("A LIMIT value has already been provided"); this.limit = limit; setDirty(); return this; }
Source:
public MockReplicaId(int port, MockPartitionId partitionId, MockDataNodeId dataNodeId, int indexOfMountPathToUse) { this.partitionId = partitionId; this.dataNodeId = dataNodeId; if (dataNodeId.getMountPaths().isEmpty()) { replicaType = ReplicaType.CLOUD_BACKED; } else { mountPath = dataNodeId.getMountPaths().get(indexOfMountPathToUse); File mountFile = new File(mountPath); File replicaFile = new File(mountFile, "replica" + port + partitionId.partition); replicaFile.mkdir(); replicaFile.deleteOnExit(); if (mountPath.startsWith("/vcr")) { replicaType = ReplicaType.CLOUD_BACKED; } else { replicaType = ReplicaType.DISK_BACKED; } replicaPath = replicaFile.getAbsolutePath(); diskId = new MockDiskId(dataNodeId, mountPath); } isSealed = partitionId.getPartitionState().equals(PartitionState.READ_ONLY); }

Target:
public MockReplicaId(int port, MockPartitionId partitionId, MockDataNodeId dataNodeId, int indexOfMountPathToUse) { this.partitionId = partitionId; this.dataNodeId = dataNodeId; if (dataNodeId.getMountPaths().isEmpty()) { replicaType = ReplicaType.CLOUD_BACKED; } else { mountPath = dataNodeId.getMountPaths().get(indexOfMountPathToUse); File mountFile = new File(mountPath); File replicaFile = new File(mountFile, REPLICA_FILE_PREFIX + port + partitionId.partition); replicaFile.mkdir(); replicaFile.deleteOnExit(); if (mountPath.startsWith(CLOUD_REPLICA_MOUNT)) { replicaType = ReplicaType.CLOUD_BACKED; } else { replicaType = ReplicaType.DISK_BACKED; } replicaPath = replicaFile.getAbsolutePath(); diskId = new MockDiskId(dataNodeId, mountPath); } isSealed = partitionId.getPartitionState().equals(PartitionState.READ_ONLY); }
Source:
private static Container readContainerInternal(final int major, final InputStream inputStream, final long containerByteOffset) { final Container container = ContainerHeaderIO.readContainerHeader(major, inputStream, containerByteOffset); if (container.isEOF()) { return container; } container.compressionHeader = CompressionHeader.read(major, inputStream); final ArrayList<Slice> slices = new ArrayList<>(); for (final int landmark : container.landmarks) { slices.add(SliceIO.read(major, inputStream)); } container.populateSlicesAndIndexingParameters(slices, containerByteOffset); log.debug("READ CONTAINER: " + container.toString()); return container; }

Target:
private static Container readContainerInternal(final int major, final InputStream inputStream, final long containerByteOffset) { final Container container = ContainerHeaderIO.readContainerHeader(major, inputStream, containerByteOffset); if (container.isEOF()) { return container; } container.compressionHeader = CompressionHeader.read(major, inputStream); final ArrayList<Slice> slices = new ArrayList<>(); for (int sliceCounter = 0; sliceCounter < container.landmarks.length; sliceCounter++) { slices.add(SliceIO.read(major, inputStream)); } container.setSlicesAndByteOffset(slices, containerByteOffset); container.distributeIndexingParametersToSlices(); log.debug("READ CONTAINER: " + container.toString()); return container; }
Source:
private synchronized <E extends BaseRealm> E doCreateRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { RefAndCount refAndCount = refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (refAndCount.globalCount == 0) { copyAssetFileIfNeeded(configuration); SharedRealm sharedRealm = SharedRealm.getInstance(configuration); if (Table.primaryKeyTableNeedsMigration(sharedRealm)) { sharedRealm.beginTransaction(); if (Table.migratePrimaryKeyTableIfNeeded(sharedRealm)) { sharedRealm.commitTransaction(); } else { sharedRealm.cancelTransaction(); } } sharedRealm.close(); this.configuration = configuration; } else { validateConfiguration(configuration); } if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { realm = Realm.createInstance(this); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(this); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); } Integer refCount = refAndCount.localCount.get(); if (refCount == 0) { if (realmClass == Realm.class && refAndCount.globalCount == 0) { final BaseRealm realm = refAndCount.localRealm.get(); RealmCache.storeColumnIndices(typedColumnIndicesArray, realm.schema.cloneColumnIndices()); } refAndCount.globalCount++; } refAndCount.localCount.set(refCount + 1); return (E) refAndCount.localRealm.get(); }

Target:
private synchronized <E extends BaseRealm> E doCreateRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { RefAndCount refAndCount = refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (getTotalGlobalRefCount() == 0) { copyAssetFileIfNeeded(configuration); SharedRealm sharedRealm = null; try { sharedRealm = SharedRealm.getInstance(configuration); if (Table.primaryKeyTableNeedsMigration(sharedRealm)) { sharedRealm.beginTransaction(); if (Table.migratePrimaryKeyTableIfNeeded(sharedRealm)) { sharedRealm.commitTransaction(); } else { sharedRealm.cancelTransaction(); } } } finally { if (sharedRealm != null) { sharedRealm.close(); } } this.configuration = configuration; } else { validateConfiguration(configuration); } if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { realm = Realm.createInstance(this); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(this); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); if (realmClass == Realm.class && refAndCount.globalCount == 0) { RealmCache.storeColumnIndices(typedColumnIndicesArray, realm.schema.cloneColumnIndices()); } refAndCount.globalCount++; } Integer refCount = refAndCount.localCount.get(); refAndCount.localCount.set(refCount + 1); return (E) refAndCount.localRealm.get(); }
Source:
public static String setupTestPath(final ConfigContext config, final MantaClient client, final String testName, final String testType) { if ("buckets".equals(testType)) { if (BooleanUtils.isTrue(verifyBucketsSupport(config, client))) { return setupBucketsPath(config, testName); } else { throw new SkipException("Bucket operations not supported by the server"); } } return IntegrationTestConfigContext.generateBasePath(config, testName); }

Target:
public static String setupTestPath(final ConfigContext config, final MantaClient client, final String testName, final String testType) throws IOException { if ("buckets".equals(testType)) { if (BooleanUtils.isTrue(verifyBucketsSupport(config, client))) { return setupBucketsPath(config, testName); } else { throw new SkipException("Bucket operations not supported by the server"); } } return IntegrationTestConfigContext.generateBasePath(config, testName); }
Source:
public void write(XMLOutputSerializer out) throws Exception { XMLStreamWriter serializer = out.getSerializer(); writeStartReplace(out, "/rapi:metadata/rapi:quality", null); if(String.valueOf(quality) != null) serializer.writeCharacters(String.valueOf(quality)); serializer.writeEndElement(); }

Target:
public void write(XMLOutputSerializer out) throws Exception { XMLStreamWriter serializer = out.getSerializer(); writeStartReplace(out, "/rapi:metadata/rapi:quality", null); serializer.writeCharacters(String.valueOf(quality)); serializer.writeEndElement(); }
Source:
protected void createCacheManagers() throws Throwable { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.SCATTERED_SYNC).hash().numSegments(3); if (biasAcquisition != null) { cb.clustering().biasAcquisition(biasAcquisition); } ControlledConsistentHashFactory.Scattered chf = new ControlledConsistentHashFactory.Scattered(new int[] {0, 1, 2}); cb.clustering().hash().consistentHashFactory(chf); addClusterEnabledCacheManager(cb); addClusterEnabledCacheManager(cb); viewLatch = new CountDownLatch(1); GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder(); gcb.transport().transport(new DelayedViewJGroupsTransport(viewLatch)); addClusterEnabledCacheManager(gcb, cb); assertTrue(cache(0).getCacheManager().isCoordinator()); cache(1); cache(2); waitForClusterToForm(); chf.setOwnerIndexes(new int[][] { {1}, {0}, {1} }); }

Target:
protected void createCacheManagers() throws Throwable { ConfigurationBuilder cb = new ConfigurationBuilder(); chf = new ControlledConsistentHashFactory.Scattered(new int[] {0, 1, 2}); cb.clustering().cacheMode(CacheMode.SCATTERED_SYNC).hash().numSegments(3).consistentHashFactory(chf); if (biasAcquisition != null) { cb.clustering().biasAcquisition(biasAcquisition); } addClusterEnabledCacheManager(cb); viewLatch = new CountDownLatch(1); GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder(); gcb.transport().transport(new DelayedViewJGroupsTransport(viewLatch)); addClusterEnabledCacheManager(gcb, cb); gcb.transport().transport(new DelayedViewJGroupsTransport(viewLatch)); addClusterEnabledCacheManager(gcb, cb); assertTrue(cache(0).getCacheManager().isCoordinator()); cache(1); cache(2); waitForClusterToForm(); }
Source:
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap lastHivStatusObss = Calculations.lastObs(getConcept(Dictionary.HIV_STATUS), inMchmsProgram, context); CalculationResultMap artStatusObss = Calculations.lastObs(getConcept(Dictionary.ANTIRETROVIRAL_USE_IN_PREGNANCY), inMchmsProgram, context); CalculationResultMap ret = new CalculationResultMap(); for (Integer ptId : cohort) { boolean onHaart = false; if (inMchmsProgram.contains(ptId)) { Concept lastHivStatus = EmrCalculationUtils.codedObsResultForPatient(lastHivStatusObss, ptId); Concept lastArtStatus = EmrCalculationUtils.codedObsResultForPatient(artStatusObss, ptId); boolean hivPositive = false; if (lastHivStatus != null) { hivPositive = lastHivStatus.equals(Dictionary.getConcept(Dictionary.POSITIVE)); if (lastArtStatus != null) { onHaart = lastArtStatus.equals(Dictionary.getConcept(Dictionary.MOTHER_ON_HAART)); } } onHaart = hivPositive && onHaart; } ret.put(ptId, new BooleanResult(onHaart, this, context)); } return ret; }

Target:
public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> parameterValues, PatientCalculationContext context) { Program mchmsProgram = MetadataUtils.getProgram(Metadata.Program.MCHMS); Set<Integer> alive = alivePatients(cohort, context); Set<Integer> inMchmsProgram = CalculationUtils.patientsThatPass(Calculations.activeEnrollment(mchmsProgram, alive, context)); CalculationResultMap lastHivStatusObss = Calculations.lastObs(getConcept(Dictionary.HIV_STATUS), inMchmsProgram, context); CalculationResultMap artStatusObss = Calculations.lastObs(getConcept(Dictionary.ANTIRETROVIRAL_USE_IN_PREGNANCY), inMchmsProgram, context); Concept hivPositiveConcept = Dictionary.getConcept(Dictionary.POSITIVE); Concept onHaartConcept = Dictionary.getConcept(Dictionary.MOTHER_ON_HAART); CalculationResultMap ret = new CalculationResultMap(); for (Integer ptId : cohort) { boolean onHaart = false; if (inMchmsProgram.contains(ptId)) { Concept lastHivStatus = EmrCalculationUtils.codedObsResultForPatient(lastHivStatusObss, ptId); Concept lastArtStatus = EmrCalculationUtils.codedObsResultForPatient(artStatusObss, ptId); boolean hivPositive = false; if (lastHivStatus != null) { hivPositive = lastHivStatus.equals(hivPositiveConcept); if (lastArtStatus != null) { onHaart = lastArtStatus.equals(onHaartConcept); } } onHaart = hivPositive && onHaart; } ret.put(ptId, new BooleanResult(onHaart, this, context)); } return ret; }
Source:
public DiskProfilePopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants) { super(eventBus, resources); storageDomainEditor = new ListModelListBoxEditor<StorageDomain>(new NullSafeRenderer<StorageDomain>() { @Override public String renderNullSafe(StorageDomain storageDomain) { return storageDomain.getName(); } }); qosEditor = new ListModelListBoxEditor<StorageQos>(new NullSafeRenderer<StorageQos>() { @Override public String renderNullSafe(StorageQos StorageQos) { return StorageQos.getName(); } }); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); localize(constants); ViewIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); }

Target:
public DiskProfilePopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants) { super(eventBus, resources); storageDomainEditor = new ListModelListBoxEditor<StorageDomain>(new NullSafeRenderer<StorageDomain>() { @Override public String renderNullSafe(StorageDomain storageDomain) { return storageDomain.getName(); } }); qosEditor = new ListModelListBoxEditor<StorageQos>(new NullSafeRenderer<StorageQos>() { @Override public String renderNullSafe(StorageQos storageQos) { return storageQos.getName(); } }); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); localize(constants); ViewIdHandler.idHandler.generateAndSetIds(this); driver.initialize(this); }
Source:
private boolean hasHigherPrecedence(Publisher currentPublisher, Publisher existingPublisher, Iterable<Publisher> publisherPrecedence) { for (Publisher publisher : publisherPrecedence) { if (publisher == existingPublisher) { return false; } if (publisher == currentPublisher) { return true; } } LOG.warn("Delegate content index returned publisher that was not asked for." + " Requested publishers: {}", currentPublisher, publisherPrecedence); return false; }

Target:
private boolean hasHigherPrecedence(Publisher currentPublisher, Publisher existingPublisher, Iterable<Publisher> publisherPrecedence) { for (Publisher publisher : publisherPrecedence) { if (publisher == existingPublisher) { return false; } if (publisher == currentPublisher) { return true; } } LOG.error("Delegate content index returned publisher that was not asked for." + " Requested publishers: {}", currentPublisher, publisherPrecedence); return false; }
Source:
public boolean uses(final Use u) { return u == Use.X30 || u == Use.NDT || super.uses(u); }

Target:
public boolean uses(final Use u) { return u == Use.X30 || super.uses(u); }
Source:
public void testListAccessCredentials() throws InterruptedException { List<SharedStorageAccess> access = sharedStorageApi().getAccessCredentials(); assertNotNull(access); assertTrue(access.size() > 0); }

Target:
public void testListAccessCredentials() { List<SharedStorageAccess> access = sharedStorageApi().getAccessCredentials(); assertNotNull(access); assertTrue(access.size() > 0); }
Source:
private ObjectId createCommit(IdentifiedUser me, ObjectInserter inserter, RevCommit prevEdit, RevCommit base, ObjectId tree) throws IOException { CommitBuilder builder = new CommitBuilder(); builder.setTreeId(tree); builder.setParentIds(base); builder.setAuthor(prevEdit.getAuthorIdent()); builder.setCommitter(getCommitterIdent(me)); builder.setMessage(prevEdit.getFullMessage()); ObjectId newEdit = inserter.insert(builder); inserter.flush(); return newEdit; }

Target:
private ObjectId createCommit(IdentifiedUser me, ObjectInserter inserter, RevCommit prevEdit, RevCommit base, ObjectId tree) throws IOException { CommitBuilder builder = new CommitBuilder(); builder.setTreeId(tree); builder.setParentIds(base); builder.setAuthor(prevEdit.getAuthorIdent()); builder.setCommitter(getCommitterIdent(me)); builder.setMessage(prevEdit.getFullMessage()); return inserter.insert(builder); }
Source:
private void returnRowLock(RowLock lock) { rowLocks.compute(lock.rowSeq, (key, value) -> { Objects.requireNonNull(value); Preconditions.checkState(value.count.intValue() > 0); final int newCount = value.count.decrementAndGet(); return (newCount > 0) ? value : null; }); }

Target:
private void returnRowLock(RowLock lock) { Objects.requireNonNull(lock); rowLocks.compute(lock.rowSeq, (key, value) -> { Preconditions.checkState(value == lock); Preconditions.checkState(value.count > 0); final int newCount = --value.count; return (newCount > 0) ? value : null; }); }
Source:
private void enableTrafficControl(Platform platform, String networkDevice, int delayMs, int rateLimitKbps) throws IOException { if (delayMs > 0) { int deviationMs = Math.max(1, (int) Math.sqrt(delayMs)); List<String> delay = new ArrayList<>(); rootHandler(networkDevice, delay::add); netemDelay(delayMs, deviationMs, delay::add); platform.runCommand(delay.toArray(new String[]{})); if (rateLimitKbps > 0) { List<String> rate = new ArrayList<>(); childHandler(networkDevice, rate::add); tbfRate(rateLimitKbps, rate::add); platform.runCommand(rate.toArray(new String[]{})); } } else if (rateLimitKbps > 0) { List<String> rate = new ArrayList<>(); rootHandler(networkDevice, rate::add); tbfRate(rateLimitKbps, rate::add); platform.runCommand(rate.toArray(new String[]{})); } else { } }

Target:
private void enableTrafficControl(Platform platform, String networkDevice, int delayMs, int rateLimitKbps) throws IOException { if (delayMs > 0) { int deviationMs = Math.max(1, (int) Math.sqrt(delayMs)); List<String> delay = new ArrayList<>(); rootHandler(networkDevice, delay::add); netemDelay(delayMs, deviationMs, delay::add); platform.runCommand(delay.toArray(new String[]{})); if (rateLimitKbps > 0) { List<String> rate = new ArrayList<>(); childHandler(networkDevice, rate::add); tbfRate(rateLimitKbps, rate::add); platform.runCommand(rate.toArray(new String[]{})); } } else if (rateLimitKbps > 0) { List<String> rate = new ArrayList<>(); rootHandler(networkDevice, rate::add); tbfRate(rateLimitKbps, rate::add); platform.runCommand(rate.toArray(new String[]{})); } else { log.warn("Not applying any rate limiting or latency"); } }
Source:
public Mono<AccessToken> getToken(TokenRequestContext request) { Mono<AccessToken> accessTokenMono; if (appServiceMSICredential != null) { accessTokenMono = appServiceMSICredential.authenticate(request); logger.info("Azure Identity => Managed Identity environment: MSI_ENDPOINT"); } else { accessTokenMono = virtualMachineMSICredential.authenticate(request); logger.info("Azure Identity => Managed Identity environment: IMDS"); } return accessTokenMono .doOnNext(token -> LoggingUtil.logTokenSuccess(logger, request)) .doOnError(error -> LoggingUtil.logTokenError(logger, request, error)); }

Target:
public Mono<AccessToken> getToken(TokenRequestContext request) { Mono<AccessToken> accessTokenMono; if (appServiceMSICredential != null) { accessTokenMono = appServiceMSICredential.authenticate(request) .doOnSuccess((t -> logger.info("Azure Identity => Managed Identity environment: MSI_ENDPOINT"))); } else { accessTokenMono = virtualMachineMSICredential.authenticate(request) .doOnSuccess((t -> logger.info("Azure Identity => Managed Identity environment: IMDS"))); } return accessTokenMono .doOnNext(token -> LoggingUtil.logTokenSuccess(logger, request)) .doOnError(error -> LoggingUtil.logTokenError(logger, request, error)); }
Source:
public void testConcurrentOpen() throws Exception { ClientConfiguration conf = new ClientConfiguration(); conf.setMetadataServiceUri(zkUtil.getMetadataServiceUri()) .setNumChannelsPerBookie(16) .setUseV2WireProtocol(true) .setZkTimeout(20000) .setAddEntryTimeout(30) .setReadEntryTimeout(30) .setSpeculativeReadTimeout(0) .setThrottleValue(0) .setLedgerManagerFactoryClassName(HierarchicalLedgerManagerFactory.class.getName()); BookKeeper bkc = new BookKeeper(conf); for (int j = 0; j < 10; j++) { LedgerHandle lh = bkc.createLedger(DigestType.CRC32, "testPasswd".getBytes()); lh.addEntry("foobar".getBytes()); long ledgerId = lh.getId(); final long finalLedgerId = ledgerId; ExecutorService executor = Executors.newFixedThreadPool(10); List<Future<?>> futures = new ArrayList<>(); CountDownLatch latch = new CountDownLatch(1); for (int i = 0; i < 5; i++) { final CompletableFuture<LedgerHandle> future = new CompletableFuture<>(); executor.submit(() -> { latch.await(); bkc.asyncOpenLedger(finalLedgerId, DigestType.CRC32, "testPasswd".getBytes(), (rc, handle, ctx) -> { if (rc != BKException.Code.OK) { future.completeExceptionally(BKException.create(rc)); } else { future.complete(handle); } }, null); return future; }); futures.add(future); } Thread.sleep(1000); latch.countDown(); for (Future<?> f : futures) { try { f.get(10, TimeUnit.SECONDS); } catch (ExecutionException ee) { Assert.assertEquals(ee.getCause().getClass(), BKException.BKLedgerRecoveryException.class); } } } bkc.close(); }

Target:
public void testConcurrentOpen() throws Exception { ClientConfiguration conf = new ClientConfiguration(); conf.setMetadataServiceUri(zkUtil.getMetadataServiceUri()) .setNumChannelsPerBookie(16) .setUseV2WireProtocol(true) .setZkTimeout(20000) .setAddEntryTimeout(30) .setReadEntryTimeout(30) .setSpeculativeReadTimeout(0) .setThrottleValue(0) .setLedgerManagerFactoryClassName(HierarchicalLedgerManagerFactory.class.getName()); BookKeeper bkc = new BookKeeper(conf); for (int j = 0; j < 10; j++) { LedgerHandle lh = bkc.createLedger(DigestType.CRC32, "testPasswd".getBytes()); lh.addEntry("foobar".getBytes()); long ledgerId = lh.getId(); final long finalLedgerId = ledgerId; ExecutorService executor = Executors.newFixedThreadPool(10); List<Future<?>> futures = new ArrayList<>(); CountDownLatch latch = new CountDownLatch(1); for (int i = 0; i < 5; i++) { final CompletableFuture<LedgerHandle> future = new CompletableFuture<>(); executor.submit(() -> { latch.await(); bkc.asyncOpenLedger(finalLedgerId, DigestType.CRC32, "testPasswd".getBytes(), (rc, handle, ctx) -> { if (rc != BKException.Code.OK) { future.completeExceptionally(BKException.create(rc)); } else { future.complete(handle); } }, null); return future; }); futures.add(future); } latch.countDown(); for (Future<?> f : futures) { try { f.get(10, TimeUnit.SECONDS); } catch (ExecutionException ee) { Assert.assertEquals(ee.getCause().getClass(), BKException.BKLedgerRecoveryException.class); } } } bkc.close(); }
Source:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { if (fRequirements == null) { ImmutableList<String> eventNames = ImmutableList.of(LttngStrings.EXIT_SYSCALL, LttngStrings.IRQ_HANDLER_ENTRY, LttngStrings.IRQ_HANDLER_EXIT, LttngStrings.SOFTIRQ_ENTRY, LttngStrings.SOFTIRQ_EXIT, LttngStrings.SOFTIRQ_RAISE, LttngStrings.SCHED_SWITCH, LttngStrings.SCHED_PROCESS_FORK, LttngStrings.SCHED_PROCESS_EXIT, LttngStrings.SCHED_PROCESS_FREE, LttngStrings.STATEDUMP_PROCESS_STATE, LttngStrings.SCHED_WAKEUP, LttngStrings.SCHED_WAKEUP_NEW, LttngStrings.SYSCALL_PREFIX); TmfAnalysisRequirement domainReq = new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN); domainReq.addValue(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, ValuePriorityLevel.MANDATORY); fRequirements = ImmutableList.of(domainReq, new TmfAnalysisRequirement(SessionConfigStrings.CONFIG_ELEMENT_EVENT, eventNames, ValuePriorityLevel.MANDATORY)); } return fRequirements; }

Target:
public Iterable<TmfAnalysisRequirement> getAnalysisRequirements() { return fRequirements; }
Source:
private void logAllObisCodes(final List<ClassIdObisAttr> allObisCodes) { int index = 1; LOGGER.info("List of all ObisCodes:"); for (final ClassIdObisAttr obisAttr : allObisCodes) { LOGGER.info("{}/{} #attr{}", index++, allObisCodes.size(), obisAttr.getObisCode().value(), obisAttr.getNoAttr()); } }

Target:
private void logAllObisCodes(final List<ClassIdObisAttr> allObisCodes) { int index = 1; LOGGER.debug("List of all ObisCodes:"); for (final ClassIdObisAttr obisAttr : allObisCodes) { LOGGER.debug("{}/{} #attr{}", index++, allObisCodes.size(), obisAttr.getObisCode().value(), obisAttr.getNoAttr()); } }
Source:
protected boolean set(EntityZombie container, ZombieType value) { if(value == ZombieTypes.VILLAGER) return false; container.setZombieType(ZombieUtils.toNative(value, null)); return true; }

Target:
protected boolean set(EntityZombie container, ZombieType value) { if (value == ZombieTypes.VILLAGER) { return false; } container.setZombieType(EntityUtil.toNative(value, null)); return true; }
Source:
private boolean onBoardSaveAs() { logger.info("Menu: Boards > Save as"); List<PanelInfo> panelList = panels.getCurrentPanelInfos(); BoardNameDialog dlg = new BoardNameDialog(prefs, mainStage); Optional<String> response = dlg.showAndWait(); ui.showMainStage(); panels.selectFirstPanel(); if (response.isPresent()) { String boardName = response.get().trim(); prefs.addBoard(boardName, panelList); prefs.setLastOpenBoard(boardName); prefs.setLastOpenBoardPanelInfo(panelList); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " saved"); ui.updateTitle(); return true; } else { return false; } }

Target:
private void onBoardSaveAs() { logger.info("Menu: Boards > Save as"); saveBoardAs(); }
Source:
public void idsIfPresentShouldBeWrittenIntoTheVariant() throws Exception { Variant variant = buildVariant("12", 3, 4, "A", "T", "fileId", "studyId"); variant.setIds(new HashSet<>(Arrays.asList("a", "b", "c"))); VariantMongoWriter variantMongoWriter = new VariantMongoWriter(collectionName, mongoOperations, false, true); variantMongoWriter.write(Collections.singletonList(variant)); DBCollection dbCollection = mongoOperations.getCollection(collectionName); assertEquals(1, dbCollection.count()); final DBObject storedVariant = dbCollection.findOne(); assertNotNull(storedVariant.get(IDS_FIELD)); }

Target:
public void idsIfPresentShouldBeWrittenIntoTheVariant() throws Exception { Variant variant = buildVariantWithStats("12", 3, 4, "A", "T", "fileId", "studyId"); HashSet<String> ids = new HashSet<>(Arrays.asList("a", "b", "c")); variant.setIds(ids); VariantMongoWriter variantMongoWriter = new VariantMongoWriter(collectionName, mongoOperations, false, true); variantMongoWriter.write(Collections.singletonList(variant)); DBCollection dbCollection = mongoOperations.getCollection(collectionName); assertEquals(1, dbCollection.count()); final DBObject storedVariant = dbCollection.findOne(); BasicDBList dbIds = (BasicDBList) storedVariant.get(IDS_FIELD); for (String id : ids) { assertTrue(dbIds.contains(id)); } assertEquals(ids.size(), dbIds.size()); }
Source:
private void readMetaDataText(Reader metadataTextInput) throws IOException, RecognitionException, ParseException { CommonTree tree = createAST(metadataTextInput); fTreeParser = new IOStructGen(tree, trace); fTreeParser.generate(); if (getDetectedByteOrder() != null && trace.getByteOrder() != getDetectedByteOrder()) { throw new ParseException("Metadata byte order and trace byte order inconsistent."); } }

Target:
private void readMetaDataText(Reader metadataTextInput) throws IOException, RecognitionException, ParseException { CommonTree tree = createAST(metadataTextInput); fTreeParser = new IOStructGen(tree, fTrace); fTreeParser.generate(); ByteOrder detectedByteOrder = getDetectedByteOrder(); if (detectedByteOrder != null && fTrace.getByteOrder() != detectedByteOrder) { throw new ParseException("Metadata byte order and trace byte order inconsistent."); } }
Source:
public HandleServiceFactory(@JsonProperty("privateKeyFile") String privateKeyFile, @JsonProperty("cypher") String cypher, @JsonProperty("namingAuthority") String namingAuthority, @JsonProperty("prefix") String prefix) { HandlePersistenceManagerFactory handleManagerFactory = new HandlePersistenceManagerFactory( privateKeyFile, cypher, namingAuthority, prefix ); manager = handleManagerFactory.build(); }

Target:
public HandleServiceFactory(@JsonProperty("privateKeyFile") String privateKeyFile, @JsonProperty("cypher") String cypher, @JsonProperty("namingAuthority") String namingAuthority, @JsonProperty("prefix") String prefix) { if (Strings.isNullOrEmpty(privateKeyFile) || Strings.isNullOrEmpty(cypher) || Strings.isNullOrEmpty(namingAuthority) || Strings.isNullOrEmpty(prefix)) { LOG.error("Configuration must have: \n" + " persistenceManager:\n" + " privateKeyFile: ...\n" + " cypher: ...\n" + " namingAuthority: ...\n" + " prefix: ...\n"); throw new IllegalArgumentException( "'privateKeyFile', 'cypher', 'namingAuthority' and 'prefix' must be provided" ); } else { LOG.info("Using real handle server"); try { manager = HandleManager.newHandleManager( cypher, namingAuthority, prefix, privateKeyFile ); } catch (PersistenceManagerCreationException e) { manager = null; } } }
Source:
public JeoJSONWriter workspace(Workspace ws, boolean children) throws IOException { object(); key("type").value("workspace"); key("driver").value(ws.getDriver().getName()); key("datasets"); array(); for (Handle<Dataset> ref : ws.list()) { if (children) { dataset(ref.resolve()); } else { value(ref.getName()); } } endArray(); return endObject(); }

Target:
public JeoJSONWriter workspace(Workspace ws, boolean children) throws IOException { object(); key("type").value("workspace"); key("driver").value(ws.getDriver().getName()); key("datasets"); array(); for (Handle<Dataset> ref : ws.list()) { if (children) { try { dataset(ref.resolve()); } finally { ref.close(); } } else { value(ref.getName()); } } endArray(); return endObject(); }
Source:
public void visit(FunctionExpression expression) { BooleanLiteralRenderingContext oldBooleanLiteralRenderingContext = setBooleanLiteralRenderingContext(BooleanLiteralRenderingContext.PLAIN); ParameterRenderingMode oldParameterRenderingMode = setParameterRenderingMode(ParameterRenderingMode.PLACEHOLDER); boolean hasExpressions = expression.getExpressions().size() > 0; String functionName = expression.getFunctionName().toUpperCase(); sb.append(functionName); if (!"CURRENT_TIME".equalsIgnoreCase(functionName) && !"CURRENT_DATE".equalsIgnoreCase(functionName) && !"CURRENT_TIMESTAMP".equalsIgnoreCase(functionName)) { sb.append('('); if (expression instanceof AggregateExpression) { AggregateExpression aggregateExpression = (AggregateExpression) expression; if (aggregateExpression.isDistinct()) { sb.append("DISTINCT "); } if (!hasExpressions && "COUNT".equalsIgnoreCase(aggregateExpression.getFunctionName())) { sb.append('*'); } } if (hasExpressions) { expression.getExpressions().get(0).accept(this); for (int i = 1; i < expression.getExpressions().size(); i++) { sb.append(","); expression.getExpressions().get(i).accept(this); } } sb.append(')'); } setBooleanLiteralRenderingContext(oldBooleanLiteralRenderingContext); setParameterRenderingMode(oldParameterRenderingMode); }

Target:
public void visit(FunctionExpression expression) { BooleanLiteralRenderingContext oldBooleanLiteralRenderingContext = setBooleanLiteralRenderingContext(BooleanLiteralRenderingContext.PLAIN); ParameterRenderingMode oldParameterRenderingMode = setParameterRenderingMode(ParameterRenderingMode.PLACEHOLDER); boolean hasExpressions = expression.getExpressions().size() > 0; String functionName = expression.getFunctionName(); sb.append(functionName); if (!"CURRENT_TIME".equalsIgnoreCase(functionName) && !"CURRENT_DATE".equalsIgnoreCase(functionName) && !"CURRENT_TIMESTAMP".equalsIgnoreCase(functionName)) { sb.append('('); if (expression instanceof AggregateExpression) { AggregateExpression aggregateExpression = (AggregateExpression) expression; if (aggregateExpression.isDistinct()) { sb.append("DISTINCT "); } if (!hasExpressions && "COUNT".equalsIgnoreCase(aggregateExpression.getFunctionName())) { sb.append('*'); } } if (hasExpressions) { expression.getExpressions().get(0).accept(this); for (int i = 1; i < expression.getExpressions().size(); i++) { sb.append(","); expression.getExpressions().get(i).accept(this); } } sb.append(')'); } setBooleanLiteralRenderingContext(oldBooleanLiteralRenderingContext); setParameterRenderingMode(oldParameterRenderingMode); }
Source:
public void close() { if (isOpen) { isOpen = false; if (scheduler != null) { scheduler.shutdown(); try { if (!scheduler.awaitTermination(storeConfig.accountUpdaterShutDownTimeoutMs, TimeUnit.MILLISECONDS)) { logger.warn("Scheduler for account updater is not shut down successfully"); scheduler.shutdownNow(); if (!scheduler.awaitTermination(storeConfig.accountUpdaterShutDownTimeoutMs, TimeUnit.MILLISECONDS)) { logger.error("Scheduler for account updater is not shut down successfully"); } } } catch (InterruptedException e) { scheduler.shutdownNow(); Thread.currentThread().interrupted(); } catch (Exception e) { logger.error("Exception occurred when closing HelixAccountService.", e); } helixStore.stop(); } } }

Target:
public void close() { if (isOpen) { isOpen = false; if (scheduler != null) { shutDownExecutorService(scheduler, storeConfig.accountUpdaterShutDownTimeoutMs, TimeUnit.MILLISECONDS); } helixStore.stop(); } }