auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } VdcActionType.QuotaDependency quotaDependency = this.getActionType().getQuotaDependency(); List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); try { switch (quotaDependency) { case NONE: return true; case STORAGE: addInternalStorageParameters(consumptionParameters); break; case VDS: addInternalVdsParameters(consumptionParameters); break; case BOTH: addInternalStorageParameters(consumptionParameters); addInternalVdsParameters(consumptionParameters); break; } } catch (ClassCastException e) { log.error("Command: " + this.getClass().getName() + ". Quota handling was expected - class does not implement the expected interface"); } QuotaConsumptionParameters quotaConsumptionParameters; if (getStoragePool() != null) { quotaConsumptionParameters = new QuotaConsumptionParameters( this.getStoragePool(), this.getStoragePool().getId(), this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParameters.setParameters(consumptionParameters); } else { quotaConsumptionParameters = new QuotaConsumptionParameters( null, null, this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParameters.setParameters(consumptionParameters); log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } if (!consumptionParameters.isEmpty()) { return true; } else { return true; } }

Target:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); try { switch (this.getActionType().getQuotaDependency()) { case NONE: return true; case STORAGE: addInternalStorageParameters(consumptionParameters); break; case VDS: addInternalVdsParameters(consumptionParameters); break; case BOTH: addInternalStorageParameters(consumptionParameters); addInternalVdsParameters(consumptionParameters); break; } } catch (ClassCastException e) { log.error("Command: " + this.getClass().getName() + ". Quota handling was expected - class does not implement the expected interface"); } QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper; if (getStoragePool() != null) { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( this.getStoragePool(), this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); } else { quotaConsumptionParametersWrapper = new QuotaConsumptionParametersWrapper( null,this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParametersWrapper.setParameters(consumptionParameters); log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } if (!consumptionParameters.isEmpty()) { return true; } else { return true; } }
Source:
public int hashCode() { int hash = 1; for (int i = 0; i < length(); i++) hash = (31 * hash) + byteAt(i); return hash; }

Target:
final public int hashCode() { if (hashCode == null) { int hash = 1; for (int i = 0; i < length(); i++) { hash = (31 * hash) + byteAt(i); } hashCode = hash; } return hashCode; }
Source:
public void testAutoGeneratedHardwareWithMinCoresMinRamAndInvalidMinDisk() { Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>>ofInstance(ImmutableSet.of(region)); Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>>ofInstance(ImmutableSet.of(image)); Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>>ofInstance(ImmutableSet .<Hardware>of(hardware)); Provider<TemplateOptions> optionsProvider = createMock(Provider.class); Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class); TemplateBuilder defaultTemplate = createMock(TemplateBuilder.class); GetImageStrategy getImageStrategy = createMock(GetImageStrategy.class); expect(optionsProvider.get()).andReturn(new TemplateOptions()); expect(getImageStrategy.getImage(anyObject(String.class))).andReturn(null); replay(defaultTemplate, optionsProvider, templateBuilderProvider, getImageStrategy); TemplateBuilderImpl templateBuilder = new ArbitraryCpuRamTemplateBuilderImpl(locations, new ImageCacheSupplier(images, 60, Atomics.<AuthorizationException>newReference(), Providers.of(getImageStrategy)), hardwares, Suppliers.ofInstance(region), optionsProvider, templateBuilderProvider); templateBuilder.minCores(2); templateBuilder.minRam(4096); float f = 100; f = -f; templateBuilder.minDisk(f); Template template = templateBuilder.build(); Hardware hardware = template.getHardware(); assertThat(hardware.getId()).isEqualTo("automatic:cores=2.0;ram=4096;disk=-100"); }

Target:
public void testAutoGeneratedHardwareWithMinCoresMinRamAndInvalidMinDisk() { Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends Location>>ofInstance(ImmutableSet.of(region)); Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>>ofInstance(ImmutableSet.of(image)); Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>>ofInstance(ImmutableSet .<Hardware>of(hardware)); Provider<TemplateOptions> optionsProvider = createMock(Provider.class); Provider<TemplateBuilder> templateBuilderProvider = createMock(Provider.class); TemplateBuilder defaultTemplate = createMock(TemplateBuilder.class); GetImageStrategy getImageStrategy = createMock(GetImageStrategy.class); expect(optionsProvider.get()).andReturn(new TemplateOptions()); expect(getImageStrategy.getImage(anyObject(String.class))).andReturn(null); replay(defaultTemplate, optionsProvider, templateBuilderProvider, getImageStrategy); TemplateBuilderImpl templateBuilder = new ArbitraryCpuRamTemplateBuilderImpl(locations, new ImageCacheSupplier(images, 60, Atomics.<AuthorizationException>newReference(), Providers.of(getImageStrategy)), hardwares, Suppliers.ofInstance(region), optionsProvider, templateBuilderProvider); templateBuilder.minCores(2); templateBuilder.minRam(4096); templateBuilder.minDisk(-100f); Template template = templateBuilder.build(); Hardware hardware = template.getHardware(); assertThat(hardware.getId()).isEqualTo("automatic:cores=2.0;ram=4096;disk=-100"); }
Source:
public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) { mProviders.clear(); for (IdpConfig config : idpConfigs) { if (mProviders.contains(config)) { throw new IllegalArgumentException("Each provider can only be set once. " + config.getProviderId() + " was set twice."); } else { mProviders.add(config); } if (config.getProviderId().equals(FACEBOOK_PROVIDER)) { try { Class c = com.facebook.FacebookCallback.class; } catch (NoClassDefFoundError e) { throw new RuntimeException("Facebook provider cannot be configured " + "without dependency. Did you forget to add " + "'com.facebook.android:facebook-android-sdk:VERSION' dependency?"); } } if (config.getProviderId().equals(TWITTER_PROVIDER)) { try { Class c = com.twitter.sdk.android.core.TwitterCore.class; } catch (NoClassDefFoundError e) { throw new RuntimeException("Twitter provider cannot be configured " + "without dependency. Did you forget to add " + "'com.twitter.sdk.android:twitter-core:VERSION' dependency?"); } } } return (T) this; }

Target:
public T setAvailableProviders(@NonNull List<IdpConfig> idpConfigs) { mProviders.clear(); for (IdpConfig config : idpConfigs) { if (mProviders.contains(config)) { throw new IllegalArgumentException("Each provider can only be set once. " + config.getProviderId() + " was set twice."); } else { mProviders.add(config); } if (config.getProviderId().equals(FACEBOOK_PROVIDER)) { try { Class c = com.facebook.FacebookSdk.class; } catch (NoClassDefFoundError e) { throw new RuntimeException("Facebook provider cannot be configured " + "without dependency. Did you forget to add " + "'com.facebook.android:facebook-android-sdk:VERSION' dependency?"); } } if (config.getProviderId().equals(TWITTER_PROVIDER)) { try { Class c = com.twitter.sdk.android.core.TwitterCore.class; } catch (NoClassDefFoundError e) { throw new RuntimeException("Twitter provider cannot be configured " + "without dependency. Did you forget to add " + "'com.twitter.sdk.android:twitter-core:VERSION' dependency?"); } } } return (T) this; }
Source:
int getPort(URI url) { int port = url.getPort(); if (port == -1) port = 9200 ; return port; }

Target:
int getPort(URI url) { int port = url.getPort(); if (port == -1) { if (sessionProtocol.isTls()) { port = 443; } else { port = 9200; } } return port; }
Source:
public void testToNova() { assertThat(converter.toNova(BlockPos.ORIGIN)).isEqualTo(Vector3D.ZERO); }

Target:
public void testToNova() { for (int x = -1; x <= 1; x++) for (int y = -1; y <= 1; y++) for (int z = -1; z <= 1; z++) assertThat(converter.toNova(new BlockPos(x, y, z))).isEqualTo(new Vector3D(x, y, z)); }
Source:
public ConstrainedMethod( ConfigurationSource source, MethodConstraintLocation location, List<ConstrainedParameter> parameterMetaData, Set<MetaConstraint<?>> returnValueConstraints, boolean isCascading) { super( source, ConstrainedElementKind.METHOD, location, returnValueConstraints, isCascading ); Method method = location.getMember(); if ( parameterMetaData.size() != method.getParameterTypes().length ) { throw log.getInvalidLengthOfParameterMetaDataListException( method, method.getParameterTypes().length, parameterMetaData.size() ); } this.parameterMetaData = Collections.unmodifiableList( parameterMetaData ); this.hasParameterConstraints = hasParameterConstraints( parameterMetaData ); if ( isConstrained() ) { run( SetAccessibility.action( method ) ); } }

Target:
public ConstrainedMethod( ConfigurationSource source, MethodConstraintLocation location, List<ConstrainedParameter> parameterMetaData, Set<MetaConstraint<?>> returnValueConstraints, boolean isCascading) { super( source, ConstrainedElementKind.METHOD, location, returnValueConstraints, isCascading ); Method method = location.getMember(); if ( parameterMetaData.size() != method.getParameterTypes().length ) { throw log.getInvalidLengthOfParameterMetaDataListException( method, method.getParameterTypes().length, parameterMetaData.size() ); } this.parameterMetaData = Collections.unmodifiableList( parameterMetaData ); this.hasParameterConstraints = hasParameterConstraints( parameterMetaData ); }
Source:
private Object[] childrenOf(ProjectNode projectNode) { boolean isGroupProjects = this.taskView.getState().isGroupProjects(); return projectNodesFor(projectNode, isGroupProjects).toArray(); }

Target:
private Object[] childrenOf(ProjectNode projectNode) { Set<Object> result = Sets.newHashSet(); if (!this.taskView.getState().isProjectHierarchyFlattened()) { result.addAll(projectNodesFor(projectNode)); } if (this.taskView.getState().isGroupTasks()) { result.addAll(groupNodesFor(projectNode)); } else { result.addAll(taskNodesFor(projectNode)); } return result.toArray(); }
Source:
private void checkIdentifierIssue(IdentifierTree identifierTree) { if (isVariableIdentifier(identifierTree)) { return; } Symbol symbol = identifierTree.symbol(); if (isDeprecated(symbol)) { String name; if (isConstructor(symbol)) { name = symbol.owner().name(); } else { name = symbol.name(); } reportIssue(identifierTree, "Remove this use of \"" + name + "\"; it is deprecated."); } }

Target:
private void checkIdentifierIssue(IdentifierTree identifierTree) { if (isSimpleNameOfVariableTree(identifierTree)) { return; } Symbol symbol = identifierTree.symbol(); if (isDeprecated(symbol)) { String name; if (isConstructor(symbol)) { name = symbol.owner().name(); } else { name = symbol.name(); } reportIssue(identifierTree, "Remove this use of \"" + name + "\"; it is deprecated."); } }
Source:
public ValidationResult validateAddProvider() { ValidationResult result = validatePluginType(); if (!result.isValid()) { return result; } if (!(result = validateAuthentication()).isValid()) { return result; } return super.validateAddProvider(); }

Target:
public ValidationResult validateAddProvider() { ValidationResult result = validatePluginType(); if (!result.isValid()) { return result; } result = validateAuthentication(); if (!result.isValid()) { return result; } return super.validateAddProvider(); }
Source:
boolean create(User user, char[] password) { Objects.requireNonNull(user.getUserid()); Objects.requireNonNull(user.getEmail()); if (!insertCredentialsIfNotExists(user.getEmail(), password, user.getUserid())) { return false; } if (user.getCreatedDate() == null) { user.setCreatedDate(Instant.now()); } insertUser(user); return true; }

Target:
boolean create(User user, char[] password) { Objects.requireNonNull(user.getUserid()); Objects.requireNonNull(user.getEmail()); if (user.getCreatedDate() == null) { user.setCreatedDate(Instant.now()); } try { insertUser(user); if (!insertCredentialsIfNotExists(user.getEmail(), password, user.getUserid())) { session.execute(preparedDeleteUser.bind(user.getUserid())); return false; } return true; } catch (Exception insertException) { try { session.execute(preparedDeleteUser.bind(user.getUserid())); } catch (Exception e) { insertException.addSuppressed(e); } try { session.execute(preparedDeleteCredentials.bind(user.getEmail(), user.getUserid())); } catch (Exception e) { insertException.addSuppressed(e); } throw insertException; } }
Source:
public void threeDimensionalFeatureBounds() { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(); GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); BoundingBox3D envelope1 = new ReferencedEnvelope3D( 0, 50, 0, 50, 0, 70, null); Filter bbox1 = ff.bbox(ff.property("geom"), envelope1); featureCollection = new ListFeatureCollection(TYPE, featureList); featureCollection.add(f1); featureCollection.add(f2); featureCollection.add(f3); assertTrue(bbox1.evaluate(f1)); assertTrue(bbox1.evaluate(f2)); assertTrue(bbox1.evaluate(f3)); }

Target:
public void threeDimensionalFeatureBounds() { GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } featureCollection = new ListFeatureCollection(TYPE, featureList); SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); featureCollection.add(f1); featureCollection.add(f2); ReferencedEnvelope origBounds = featureCollection.getBounds(); featureCollection.remove(f2); featureCollection.add(f3); ReferencedEnvelope postRemoveBounds = featureCollection.getBounds(); assertNotEquals(origBounds, postRemoveBounds); assertNotEquals(postRemoveBounds, f3.getBounds()); }
Source:
public ValueObject filterValue(ValueObject value, Bundle context) { if (value == null || value.getObjectType() != ValueObject.TYPE.MAP) { return null; } ValueMap mapValue = value.asMap(); if(this.put != null) { ValueMap copy = ValueFactory.createMap(); copy.putAll(mapValue); copy.put(this.key.getString(context).get(), this.put.getValue(context)); return copy; } else if(this.defaultValue != null) { return mapValue.getOrDefault(this.key.getString(context).get(), this.defaultValue.getValue(context)); } else { return mapValue.get(this.key.getString(context).get()); } }

Target:
public ValueObject filterValue(ValueObject value, Bundle context) { if (value == null || value.getObjectType() != ValueObject.TYPE.MAP || this.key == null) { return null; } ValueMap mapValue = value.asMap(); if (this.put != null) { ValueMap copy = ValueFactory.createMap(); copy.putAll(mapValue); copy.put(this.key.getString(context).get(), this.put.getValue(context)); return copy; } else if (this.defaultValue != null) { return mapValue.getOrDefault(this.key.getString(context).get(), this.defaultValue.getValue(context)); } else { return mapValue.get(this.key.getString(context).get()); } }
Source:
public CauseOfBlockage canRun(Item item) { if (item.isBuildable()) { return null; } Integer itemId = new Integer(item.id); if (blockedItems.containsKey(itemId)) { BlockedItem blockedItem = blockedItems.get(itemId); if (blockedItem.canRunWithTimeoutCheck()) { if (blockedItem.replicationFailedMessage != null) { item.addAction(new ReplicationFailedAction(blockedItem.replicationFailedMessage)); logger.trace(blockedItem.getEventDescription() + " -> " + blockedItem.replicationFailedMessage); } else { logger.trace(blockedItem.getEventDescription() + " can now run with no timeout check."); } blockedItems.remove(itemId); return null; } else { logger.trace(blockedItem.getEventDescription() + " (item id {}) is still waiting replication to gerrit slaves (waiting " + item.getInQueueForString() + ")", itemId, blockedItem.slavesWaitingFor.size()); return new WaitingForReplication(blockedItem.slavesWaitingFor.values()); } } else { BlockedItem blockedItem = getBlockedItem(item); if (blockedItem != null) { updateFromReplicationCache(blockedItem); blockedItems.put(itemId, blockedItem); return canRun(item); } else { logger.warn("blockedItem null!"); } } return null; }

Target:
public CauseOfBlockage canRun(Item item) { if (item.isBuildable()) { return null; } Integer itemId = new Integer(item.id); if (blockedItems.containsKey(itemId)) { BlockedItem blockedItem = blockedItems.get(itemId); if (blockedItem.canRunWithTimeoutCheck()) { if (blockedItem.replicationFailedMessage != null) { item.addAction(new ReplicationFailedAction(blockedItem.replicationFailedMessage)); logger.trace("{} -> {}", blockedItem.getEventDescription(), blockedItem.replicationFailedMessage); } else { logger.trace("{} can now run with no timeout check.", blockedItem.getEventDescription()); } blockedItems.remove(itemId); return null; } else { logger.trace(blockedItem.getEventDescription() + " (item id {}) is still waiting replication to gerrit slaves (waiting " + item.getInQueueForString() + ")", itemId, blockedItem.slavesWaitingFor.size()); return new WaitingForReplication(blockedItem.slavesWaitingFor.values()); } } else { BlockedItem blockedItem = getBlockedItem(item); if (blockedItem != null) { updateFromReplicationCache(blockedItem); blockedItems.put(itemId, blockedItem); return canRun(item); } else { logger.debug("blockedItem null for {}!", item.id); } } return null; }
Source:
private static SqlNode toSqlNode(String sql) { try { return new SqlBatchImpl(sql).iterator().next().getParsedQuery(); } catch (SqlParseException | PlannerFallbackException e) { return null; } }

Target:
private static SqlNode toSqlNode(String sql) { try { return SqlParserFactory.parse(sql); } catch (SqlParseException e) { return null; } }
Source:
public DiagnosticReport saveFHIRDiagnosticReport(DiagnosticReport diagnosticReport) { System.out.println("Laboratory Handler : diSave FHIR Diagnostic Report"); Encounter omrsDiagnosticReport = new Encounter(); if (diagnosticReport.getId() != null) { omrsDiagnosticReport.setUuid(diagnosticReport.getId().getIdPart()); } EncounterService encounterService = Context.getEncounterService(); return diagnosticReport; }

Target:
public DiagnosticReport saveFHIRDiagnosticReport(DiagnosticReport diagnosticReport) { if (log.isDebugEnabled()) { log.debug("Laboratory Handler : Save FHIR Diagnostic Report"); } Encounter omrsDiagnosticReport = new Encounter(); if (diagnosticReport.getId() != null) { omrsDiagnosticReport.setUuid(diagnosticReport.getId().getIdPart()); } EncounterService encounterService = Context.getEncounterService(); return diagnosticReport; }
Source:
private String getWorkspaceRelativePath(String sourcePath) { if (org.apache.commons.lang.StringUtils.isBlank(sourcePath) || sourcePath.contains("{")) { return sourcePath; } IPath absolutePath = new Path(sourcePath); IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(absolutePath); if (container != null) { return container.getFullPath().toPortableString(); } return null; }

Target:
private String getWorkspaceRelativePath(String sourcePath) { if (org.apache.commons.lang.StringUtils.isBlank(sourcePath) || sourcePath.contains("{")) { return sourcePath; } IPath absolutePath = new Path(sourcePath); IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(absolutePath); if (container != null) { return container.getFullPath().toString(); } return null; }
Source:
public void setLocation(String location, Job job) throws IOException { FileInputFormat.setInputPaths(job, location); this.jobConf = job.getConfiguration(); String projectedFields = getUDFProperties().getProperty( contextSignature + projectionSuffix); if (projectedFields != null) { requiredFieldList = (RequiredFieldList) ObjectSerializer.deserialize(projectedFields); } }

Target:
public void setLocation(String location, Job job) throws IOException { FileInputFormat.setInputPaths(job, location); this.jobConf = job.getConfiguration(); String projectedFields = getUDFProperties().getProperty(projectionKey); if (projectedFields != null) { requiredFieldList = (RequiredFieldList) ObjectSerializer.deserialize(projectedFields); } }
Source:
private void removeReferencesFromTags(List<EnrichmentTag> tags, List<Long> judgmentIds) { tags.parallelStream().forEach(tag -> { try { TAG_TYPE tagValue = jsonStringParser.parseAndValidate(tag.getValue()); removeReference(tagValue, judgmentIds); String value = jsonStringWriter.write(tagValue); tag.setValue(value); } catch (IOException e) { throw new RuntimeException(e); } }); }

Target:
private void removeReferencesFromTags(List<EnrichmentTag> tags, List<Long> judgmentIds) { tags.parallelStream().forEach(tag -> { try { TAG_TYPE tagValue = jsonStringParser.parseAndValidate(tag.getValue()); removeReference(tagValue, judgmentIds); String value = jsonFormatter.formatObject(tagValue); tag.setValue(value); } catch (IOException e) { throw new RuntimeException(e); } }); }
Source:
private void addFileToMonitor(FileObject file) { try { monitor.addFile(file); } catch (RuntimeException re) { if (re.getMessage().contains("files-cache")) log.error("There is no implementation for files-cache in VFS2"); else log.error(re.getMessage()); } }

Target:
private void addFileToMonitor(FileObject file) throws RuntimeException { try { if (monitor != null) monitor.addFile(file); } catch (RuntimeException re) { if (re.getMessage().contains("files-cache")) log.error("files-cache error adding to VFS monitor. " + "There is no implementation for files-cache in VFS2", file, re); else log.error("Runtime error adding to VFS monitor", file, re); throw re; } }
Source:
public void testNoDefaulColortMenuInAppearancePropertyViewFromContainerMappingFontColor() { selectAndCheckEditPart(NODE_CONTAINER, DNodeContainerEditPart.class); bot.viewByTitle("Properties").setFocus(); SWTBotSiriusHelper.selectPropertyTabItem("Appearance"); try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); } catch (WidgetNotFoundException e) { assertTrue(true); } }

Target:
public void testNoDefaulColortMenuInAppearancePropertyViewFromContainerMappingFontColor() { selectAndCheckEditPart(NODE_CONTAINER, DNodeContainerEditPart.class); bot.viewByTitle("Properties").setFocus(); SWTBotSiriusHelper.selectPropertyTabItem("Appearance"); try { bot.viewByTitle("Properties").bot().buttonInGroup("Fonts and Colors:", 0).click().contextMenu(DEFAULT_COLOR); fail(); } catch (WidgetNotFoundException e) { } }
Source:
public List<String> getProvider() { if (provider == null) { provider = new ArrayList<String>(); } return this.provider; }

Target:
public List<String> getProvider() { return this.provider; }
Source:
public TranslatableComponent(TranslatableComponent original) { translate = original.getTranslate(); for (BaseComponent baseComponent : original.getWith()) { with.add( ( baseComponent instanceof TextComponent ? new TextComponent( (TextComponent) baseComponent ) : new TranslatableComponent( (TranslatableComponent) baseComponent ) ) ); } }

Target:
public TranslatableComponent(TranslatableComponent original) { super( original ); setTranslate(original.getTranslate()); for (BaseComponent baseComponent : original.getWith()) { with.add( baseComponent.duplicate() ); } }
Source:
public long getLeastLogEntry() { return currentLog.getLeastLogEntry(); }

Target:
public long getLeastLogEntry() { return Math.min(legacyLogLeastLogEntry.get(), cutoffInclusive); }
Source:
protected void repairProfileApplications(final Resource resource) { if (resource == null) { return; } final StereotypeApplicationRepair repair = new StereotypeApplicationRepair(resource); final ZombieStereotypesDescriptor stereotypesDescriptor = repair.repair(); if (stereotypesDescriptor == null || !stereotypesDescriptor.hasZombies()) { return; } for (final IAdaptable schema : stereotypesDescriptor.getZombieSchemas()) { final IRepairAction repairAction = stereotypesDescriptor.getSuggestedRepairAction(schema); stereotypesDescriptor.repair(schema, repairAction, new BasicDiagnostic(), new NullProgressMonitor()); } }

Target:
protected void repairProfileApplications(final Resource resource) { if (resource == null) { return; } final StereotypeApplicationRepair repair = new StereotypeApplicationRepair(resource); final ZombieStereotypesDescriptor stereotypesDescriptor = repair.repair(); if (stereotypesDescriptor == null || !stereotypesDescriptor.hasZombies()) { return; } for (final IAdaptable schema : stereotypesDescriptor.getZombieSchemas()) { final IRepairAction repairAction = stereotypesDescriptor.getSuggestedRepairAction(schema); if (repairAction != null) { stereotypesDescriptor.repair(schema, repairAction, new BasicDiagnostic(), new NullProgressMonitor()); } } }
Source:
public void force_zero_coverage() { SonarRunner build = Tests.createSonarRunnerBuild() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(Tests.PROJECT_KEY) .setProjectName(Tests.PROJECT_KEY) .setProjectVersion("1.0") .setSourceDirs("."); Tests.setEmptyProfile(Tests.PROJECT_KEY, Tests.PROJECT_KEY); orchestrator.executeBuild(build); assertThat(getProjectMeasure("coverage").getValue()).isEqualTo(0); assertThat(getProjectMeasure("lines_to_cover").getValue()).isEqualTo(10); assertThat(getProjectMeasure("uncovered_lines").getValue()).isEqualTo(10); assertThat(getFileMeasure("coverage_line_hits_data").getData()).startsWith("1=0;2=0;3=0;5=0"); assertThat(getProjectMeasure("conditions_to_cover")).isNull(); assertThat(getProjectMeasure("uncovered_conditions")).isNull(); }

Target:
public void force_zero_coverage() { SonarRunner build = Tests.createSonarRunnerBuild() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(Tests.PROJECT_KEY) .setProjectName(Tests.PROJECT_KEY) .setProjectVersion("1.0") .setSourceDirs(".") .setProperty("sonar.javascript.forceZeroCoverage", "true"); Tests.setEmptyProfile(Tests.PROJECT_KEY, Tests.PROJECT_KEY); orchestrator.executeBuild(build); assertThat(getProjectMeasure("lines_to_cover").getValue()).isEqualTo(10); assertThat(getProjectMeasure("uncovered_lines").getValue()).isEqualTo(10); assertThat(getProjectMeasure("it_lines_to_cover").getValue()).isEqualTo(10); assertThat(getProjectMeasure("it_uncovered_lines").getValue()).isEqualTo(10); assertThat(getFileMeasure("coverage_line_hits_data").getData()).startsWith("1=0;2=0;3=0;5=0"); assertThat(getFileMeasure("it_coverage_line_hits_data").getData()).startsWith("1=0;2=0;3=0;5=0"); assertThat(getProjectMeasure("conditions_to_cover")).isNull(); assertThat(getProjectMeasure("it_conditions_to_cover")).isNull(); assertThat(getProjectMeasure("uncovered_conditions")).isNull(); assertThat(getProjectMeasure("it_uncovered_conditions")).isNull(); }
Source:
public CompletableFuture<Optional<RequiredDifficulty>> updateChain(String username, List<UserPublicKeyLink> chain, ProofOfWork proof) { return writeTarget.updateChain(username, chain, proof) .thenApply(x -> { this.update(); return x; }); }

Target:
public CompletableFuture<Optional<RequiredDifficulty>> updateChain(String username, List<UserPublicKeyLink> chain, ProofOfWork proof) { return writeTarget.updateChain(username, chain, proof) .thenApply(x -> { if (x.isEmpty()) this.update(); return x; }); }
Source:
protected Map<String, String> getTaskConfiguration() { List<TaskDefinition> tasks = this.getContext().getBuildDefinition().getTaskDefinitions(); for (TaskDefinition taskDefinition : tasks) { if (taskDefinition.isEnabled()) { AbstractBuildContext config = AbstractBuildContext.createContextFromMap(taskDefinition.getConfiguration()); if ((config != null) && config.releaseManagementContext.isReleaseMgmtEnabled()) { return taskDefinition.getConfiguration(); } } } return null; }

Target:
protected Map<String, String> getTaskConfiguration() { List<TaskDefinition> tasks = this.getContext().getBuildDefinition().getTaskDefinitions(); for (TaskDefinition taskDefinition : tasks) { if (taskDefinition.isEnabled() && TaskDefinitionHelper.isReleaseMgmtEnabled(taskDefinition)) { return taskDefinition.getConfiguration(); } } return null; }
Source:
public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } if (req.getReferer() == null || req.getMethod().equals("POST")) { rsp.setStatus(200); restart(); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }

Target:
public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } if (req != null && req.getReferer() == null && req.getMethod().equals("POST")) { rsp.setStatus(200); restart(); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }
Source:
public void sendKeyedMessages(String topic, String keySeparator, String... messages) throws IOException { try (AutoClosableProcess autoClosableProcess = AutoClosableProcess.runNonBlocking( kafkaDir.resolve(Paths.get("bin", "kafka-console-producer.sh")).toString(), "--broker-list", KAFKA_ADDRESS, "--topic", topic, "--property", "parse.key=true", "--property", "key.separator=" + keySeparator)) { sendMessagesAndWait(autoClosableProcess, messages); } }

Target:
public void sendKeyedMessages(String topic, String keySeparator, String... messages) throws IOException { List<String> args = new ArrayList<>(createSendMessageArguments(topic)); args.add("--property"); args.add("parse.key=true"); args.add("--property"); args.add("key.separator=" + keySeparator); sendMessagesAndWait(args, messages); }
Source:
private void notifyMsgAsInterrupted(RawData msg) { msg.onError(new InterruptedIOException("Interrupted by shutdown connector.")); }

Target:
private void notifyMsgAsInterrupted(RawData msg) { msg.onError(new InterruptedIOException("Connector is not running.")); }
Source:
public Integer getMateReferenceIndex() { if (null == mMateReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mMateReferenceName)) { mMateReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mMateReferenceIndex = mHeader.getSequenceIndex(mMateReferenceName); } else { throw new IllegalArgumentException("A non-null SAMFileHeader is required to resolve the mate reference index"); } } return mMateReferenceIndex; }

Target:
public Integer getMateReferenceIndex() { if (null == mMateReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mMateReferenceName)) { mMateReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mMateReferenceIndex = mHeader.getSequenceIndex(mMateReferenceName); } else { throw new IllegalStateException("A non-null SAMFileHeader is required to resolve the mate reference index"); } } return mMateReferenceIndex; }
Source:
public void testInitOrientations() throws Exception { final List<DecisionTableOrientation> orientations = Arrays.asList(DecisionTableOrientation.CROSS_TABLE, DecisionTableOrientation.RULE_AS_COLUMN, DecisionTableOrientation.RULE_AS_ROW); testedView.initDecisionTableOrientations(orientations); orientations.stream().forEach(orientation -> verify(lstDecisionTableOrientation).addOption(orientation.value())); }

Target:
public void testInitOrientations() throws Exception { final List<DecisionTableOrientation> orientations = Arrays.asList(DecisionTableOrientation.values()); testedView.initDecisionTableOrientations(orientations); orientations.stream().forEach(orientation -> verify(lstDecisionTableOrientation).addOption(orientation.value())); }
Source:
public ProcessExecutorImpl() { this.shutdownThreads = new ShutDownThreadHolder(); this.service = Executors.newCachedThreadPool(); this.scheduledService = Executors.newScheduledThreadPool(1); this.environment = new HashMap<String, String>(); setWorkingDirectory(System.getProperty("user.dir")); }

Target:
public ProcessExecutorImpl() { this.shutdownThreads = new ShutDownThreadHolder(); this.service = Executors.newCachedThreadPool(); this.scheduledService = Executors.newScheduledThreadPool(1); this.environment = new HashMap<String, String>(); }
Source:
public void deleteNonExisting() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); Integer id = metadataField.getID(); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNoContent()); assertThat(metadataFieldService.find(context, id), nullValue()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNotFound()); }

Target:
public void deleteNonExisting() throws Exception { context.turnOffAuthorisationSystem(); MetadataField metadataField = MetadataFieldBuilder.createMetadataField(context, ELEMENT, QUALIFIER, SCOPE_NOTE) .build(); context.restoreAuthSystemState(); Integer id = metadataField.getID(); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNoContent()); assertThat(metadataFieldService.find(context, id), nullValue()); getClient(getAuthToken(admin.getEmail(), password)) .perform(delete("/api/core/metadatafields/" + id)) .andExpect(status().isNotFound()); }
Source:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { DocumentModelList docs = loadDocuments(session, ids); for (DocumentModel doc : docs) { ThumbnailAdapter thumbnail = doc.getAdapter(ThumbnailAdapter.class); Blob thumbnailBlob = thumbnail.computeThumbnail(session); doc.setPropertyValue(THUMBNAIL_PROPERTY_NAME, (Serializable) thumbnailBlob); thumbnail.save(session); } }

Target:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { DocumentModelList docs = loadDocuments(session, ids); for (DocumentModel doc : docs) { processDoc(session, doc); } }
Source:
public int compareTo(BodyPartRotationalData o) { return 0; }

Target:
public int compareTo(BodyPartRotationalData o) { int mapSizeComp = Integer.compare(this.rotations.size(), o.partRotation().size()); if (mapSizeComp != 0) { return mapSizeComp; } ComparisonChain comparison = ComparisonChain.start(); Map<BodyPart, Vector3d> parts = o.partRotation().get(); parts.forEach((part, vec) -> { comparison.compare(vec, this.rotations.get(part)); }); return comparison.result(); }
Source:
private List<String> getMergedDimensions(List<IndexableAdapter> indexes) { if (indexes.size() == 0) { return new ArrayList<>(); } List<String> dimOrder = Lists.newArrayList(indexes.get(0).getDimensionNames().iterator()); for (IndexableAdapter index : indexes) { List<String> dimOrder2 = Lists.newArrayList(index.getDimensionNames().iterator()); if(!dimOrder.equals(dimOrder2)) { return getLexicographicMergedDimensions(indexes); } } return dimOrder; }

Target:
private List<String> getMergedDimensions(List<IndexableAdapter> indexes) { if (indexes.size() == 0) { return ImmutableList.of(); } Indexed<String> dimOrder = indexes.get(0).getDimensionNames(); for (IndexableAdapter index : indexes) { Indexed<String> dimOrder2 = index.getDimensionNames(); if(!Iterators.elementsEqual(dimOrder.iterator(), dimOrder2.iterator())) { return getLexicographicMergedDimensions(indexes); } } return ImmutableList.copyOf(dimOrder); }
Source:
public static Time convertToTime(java.util.Date date) { if (date == null) { throw new IllegalArgumentException(MESSAGE_ARGUMENT_NULL_ERROR); } Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; }

Target:
public static Time convertToTime(java.util.Date date) { assertArgs(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; }
Source:
private String getContextId(final Configuration contextConf) { try { final Injector injector = Tang.Factory.getTang().newInjector(contextConf); return injector.getNamedInstance(ContextIdentifier.class); } catch (final InjectionException e) { throw new RuntimeException("Unable to inject context identifier from context conf", e); } }

Target:
private String getContextId(final Configuration contextConf) { try { final Injector injector = Tang.Factory.getTang().newInjector(contextConf); return injector.getNamedInstance(ContextIdentifier.class); } catch (final InjectionException e) { throw new RuntimeException("Unable to get the context's identifier from the configuration", e); } }
Source:
public SpringRemoteCacheManagerFactoryBean springCacheManager() { SpringRemoteCacheManagerFactoryBean factoryBean = new SpringRemoteCacheManagerFactoryBean(); factoryBean.setServerList(Arrays.asList(new InetSocketAddress("localhost", SERVER_PORT))); factoryBean.setMarshaller(JavaSerializationMarshaller.class.getName()); factoryBean.setClassWhiteList(AbstractRemoteCacheManagerFactory.SPRING_JAVA_SERIAL_WHITELIST + ",java.util.*"); return factoryBean; }

Target:
public SpringRemoteCacheManagerFactoryBean springCacheManager() { SpringRemoteCacheManagerFactoryBean factoryBean = new SpringRemoteCacheManagerFactoryBean(); factoryBean.setServerList(Arrays.asList(new InetSocketAddress("localhost", SERVER_PORT))); factoryBean.setClassWhiteList(AbstractRemoteCacheManagerFactory.SPRING_JAVA_SERIAL_WHITELIST + ",java.util.*"); return factoryBean; }
Source:
public void ephemeralCreateMultiOpTest() throws KeeperException, InterruptedException, IOException { final ZooKeeper zk = createClient(); waitForClient(zk, ZooKeeper.States.CONNECTED); String data = "test"; String path = "/ephemeralcreatemultiop"; zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); List<OpResult> multi = null; LOG.info("RUNNING MULTI-OP"); try { multi = zk.multi(Arrays.asList( Op.setData(path, data.getBytes(), 0), Op.create(path + "/e", data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL), Op.create(path + "/p", data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT), Op.create(path + "/q", data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL) )); } catch (KeeperException.SessionExpiredException e) { LOG.info("SESSION EXPIRED", e); } LOG.info("TESTING RESULTS"); Assert.assertNotNull(multi); Assert.assertEquals(4, multi.size()); Assert.assertEquals(data, new String(zk.getData(path + "/e", false, null))); Assert.assertEquals(data, new String(zk.getData(path + "/p", false, null))); Assert.assertEquals(data, new String(zk.getData(path + "/q", false, null))); }

Target:
public void ephemeralCreateMultiOpTest() throws KeeperException, InterruptedException, IOException { final ZooKeeper zk = createClient(); String data = "test"; String path = "/ephemeralcreatemultiop"; zk.create(path, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); QuorumZooKeeperServer server = getConnectedServer(zk.getSessionId()); Assert.assertNotNull("unable to find server interlocutor", server); UpgradeableSessionTracker sessionTracker = (UpgradeableSessionTracker)server.getSessionTracker(); Assert.assertFalse("session already global", sessionTracker.isGlobalSession(zk.getSessionId())); List<OpResult> multi = null; try { multi = zk.multi(Arrays.asList( Op.setData(path, data.getBytes(), 0), Op.create(path + "/e", data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL), Op.create(path + "/p", data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT), Op.create(path + "/q", data.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL) )); } catch (KeeperException.SessionExpiredException e) { Assert.fail("received session expired for a session promotion in a multi-op"); } Assert.assertNotNull(multi); Assert.assertEquals(4, multi.size()); Assert.assertEquals(data, new String(zk.getData(path + "/e", false, null))); Assert.assertEquals(data, new String(zk.getData(path + "/p", false, null))); Assert.assertEquals(data, new String(zk.getData(path + "/q", false, null))); Assert.assertTrue("session not promoted", sessionTracker.isGlobalSession(zk.getSessionId())); }
Source:
public String marshal(Boolean v) throws Exception { if (v) { return "On"; } return "Off"; }

Target:
public String marshal(Boolean v) throws Exception { return v ? "On" : "Off"; }
Source:
public void onFastRewind() { if (DEBUG) Log.d(TAG, "onFastRewind() called"); final int duration = getSeekDuration(); seekBy(-duration); }

Target:
public void onFastRewind() { if (DEBUG) Log.d(TAG, "onFastRewind() called"); seekBy(-getSeekDuration()); }
Source:
public static void sendMessage(Address[] recipients, Session session, MimeMessage message) throws MessagingException { Transport transport = null; try { transport = session.getTransport("smtp"); String host = session.getProperty("mail.smtp.host"); String port = session.getProperty("mail.smtp.port"); String user = session.getProperty("connect.mail.user"); String pass = session.getProperty("connect.mail.pass"); if (!StringUtils.isBlank(port)) { port = StringUtils.trim(port); } transport.connect(host, Integer.parseInt(port), user, pass); transport.sendMessage(message, recipients); logHeaders(message); } catch (AssertionError e) { LOG.error("Assertion Error while sending.", e); throw e; } finally { if (transport != null) { try { transport.close(); } catch (Exception e) { LOG.error("Exception while closing the transport: {}", e.getMessage(), e); } } } }

Target:
public static void sendMessage(Address[] recipients, Session session, MimeMessage message) throws MessagingException { Transport transport = null; try { transport = session.getTransport("smtp"); String host = session.getProperty("mail.smtp.host"); String port = session.getProperty("mail.smtp.port"); String user = session.getProperty("connect.mail.user"); String pass = session.getProperty("connect.mail.pass"); if (!StringUtils.isBlank(port)) { port = StringUtils.trim(port); } transport.connect(host, Integer.parseInt(port), user, pass); transport.sendMessage(message, recipients); logHeaders(message); } catch (AssertionError e) { LOG.error("Assertion Error while sending.", e); throw e; } finally { if (transport != null) { try { transport.close(); } catch (MessagingException e) { LOG.error("Exception while closing the transport: {}", e.getMessage(), e); } } } }
Source:
public String getTypeName() { return "Auto Stacker"; }

Target:
public String getTypeName() { return "auto stacker"; }
Source:
static RelDistribution getDistribution(RelNode node) { if (node instanceof VoltLogicalTableScan) { return node.getTable().getDistribution(); } return node.getTraitSet().getTrait(RelDistributionTraitDef.INSTANCE); }

Target:
static RelDistribution getDistribution(RelNode node) { return node.getTraitSet().getTrait(RelDistributionTraitDef.INSTANCE); }
Source:
public int compareTo(UnregisteredDiskId o) { int idComparison = diskId.compareTo(o.diskId); if (idComparison == 0) { return storageDomainId.compareTo(o.storageDomainId); } else { return idComparison; } }

Target:
public int compareTo(UnregisteredDiskId o) { int idComparison = diskId.compareTo(o.diskId); if (idComparison == 0) { return storageDomainId.compareTo(o.storageDomainId); } return idComparison; }
Source:
public LocalMemoryManager(NodeMemoryConfig config) { requireNonNull(config, "config is null"); maxMemory = new DataSize(Runtime.getRuntime().maxMemory(), BYTE); checkArgument(config.getMaxQueryMemoryPerNode().toBytes() <= maxMemory.toBytes(), format("%s set to %s, but only %s of useable heap available", QUERY_MAX_MEMORY_PER_NODE_CONFIG, config.getMaxQueryMemoryPerNode(), maxMemory)); ImmutableMap.Builder<MemoryPoolId, MemoryPool> builder = ImmutableMap.builder(); builder.put(RESERVED_POOL, new MemoryPool(RESERVED_POOL, config.getMaxQueryMemoryPerNode())); DataSize generalPoolSize = new DataSize(Math.max(0, maxMemory.toBytes() - config.getMaxQueryMemoryPerNode().toBytes()), BYTE); builder.put(GENERAL_POOL, new MemoryPool(GENERAL_POOL, generalPoolSize)); this.pools = builder.build(); }

Target:
public LocalMemoryManager(NodeMemoryConfig config) { requireNonNull(config, "config is null"); long availableMemory = Runtime.getRuntime().maxMemory(); validateHeapHeadroom(config, availableMemory); maxMemory = new DataSize(availableMemory - config.getHeapHeadroom().toBytes(), BYTE); checkArgument(config.getMaxQueryMemoryPerNode().toBytes() <= config.getMaxQueryTotalMemoryPerNode().toBytes(), "Max query memory per node cannot be greater than the max query total memory per node."); ImmutableMap.Builder<MemoryPoolId, MemoryPool> builder = ImmutableMap.builder(); builder.put(RESERVED_POOL, new MemoryPool(RESERVED_POOL, config.getMaxQueryTotalMemoryPerNode())); long generalPoolSize = maxMemory.toBytes() - config.getMaxQueryTotalMemoryPerNode().toBytes(); verify(generalPoolSize > 0, "general memory pool size is 0"); builder.put(GENERAL_POOL, new MemoryPool(GENERAL_POOL, new DataSize(generalPoolSize, BYTE))); this.pools = builder.build(); }
Source:
protected String scriptInvocationCommand(Integer optionalThriftPort, String fileToRun) { List<String> args = Lists.newArrayList(); args.add("bin/cassandra-cli"); if (optionalThriftPort != null) { args.add("--port"); args.add(Integer.toString(optionalThriftPort)); } args.add("--file"); args.add(fileToRun); return Joiner.on(" ").join(args); }

Target:
protected String scriptInvocationCommand(Integer optionalThriftPort, String fileToRun) { return "bin/cassandra-cli " + (optionalThriftPort != null ? "--port " + optionalThriftPort : "") + " --file "+fileToRun; }