auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void commonInitialize() { super.commonInitialize(); <START> getModel().getIsHighlyAvailable().getEntityChangedEvent().addListener((ev, sender, args) -> { boolean ha = getModel().getIsHighlyAvailable().getEntity(); if (ha) { Collection<StorageDomain> domains = getModel().getLease().getItems(); Guid bootableDiskStorageDomainId = getBootableDiskStorageDomainId(); if (bootableDiskStorageDomainId != null) { domains.stream() .filter(Objects::nonNull) .filter(d -> d.getId().equals(bootableDiskStorageDomainId)) .findFirst().ifPresent(d -> getModel().getLease().setSelectedItem(d)); } } }); <END> getModel().getIsStateless().getEntityChangedEvent().addListener(new UpdateTemplateWithVersionListener() { @Override protected void beforeUpdate() { updateStatelessFlag = false; } @Override protected boolean isAddLatestVersion() { return getModel().getIsStateless().getEntity(); } }); }</code><technical_language>+1 a lambda, fine/readable, reusable</technical_language>

Target:
protected void commonInitialize() { super.commonInitialize(); getModel().getIsHighlyAvailable().getEntityChangedEvent().addListener((ev, sender, args) -> { boolean ha = getModel().getIsHighlyAvailable().getEntity(); if (ha) { Guid bootableDiskStorageDomainId = getBootableDiskStorageDomainId(); if (bootableDiskStorageDomainId != null) { setVmleaseDefaultStorageDomain(bootableDiskStorageDomainId); } } }); getModel().getIsStateless().getEntityChangedEvent().addListener(new UpdateTemplateWithVersionListener() { @Override protected void beforeUpdate() { updateStatelessFlag = false; } @Override protected boolean isAddLatestVersion() { return getModel().getIsStateless().getEntity(); } }); }
Source:
<code><START> public synchronized void close() <END></code><technical_language>synchronized</technical_language>

Target:
public void close() { }
Source:
<code><START> public BlockSplitBloomFilter(int numBytes, int minimumBytes, int maximumBytes, HashStrategy hashStrategy) { <END> if (minimumBytes > LOWER_BOUND_BYTES && minimumBytes < UPPER_BOUND_BYTES) { this.minimumBytes = minimumBytes; } if (maximumBytes> LOWER_BOUND_BYTES && maximumBytes < UPPER_BOUND_BYTES) { this.maximumBytes = maximumBytes; } initBitset(numBytes); switch (hashStrategy) { case XXH64: this.hashStrategy = hashStrategy; hashFunction = new XxHash(); break; default: throw new RuntimeException("Unsupported hash strategy"); } }</code><technical_language>checking minimumBytes < maximumBytes</technical_language>

Target:
public BlockSplitBloomFilter(int numBytes, int minimumBytes, int maximumBytes, HashStrategy hashStrategy) { if (minimumBytes > maximumBytes) { throw new IllegalArgumentException("the minimum bytes should be less or equal than maximum bytes"); } if (minimumBytes > LOWER_BOUND_BYTES && minimumBytes < UPPER_BOUND_BYTES) { this.minimumBytes = minimumBytes; } if (maximumBytes > LOWER_BOUND_BYTES && maximumBytes < UPPER_BOUND_BYTES) { this.maximumBytes = maximumBytes; } initBitset(numBytes); cacheBuffer.order(ByteOrder.LITTLE_ENDIAN); switch (hashStrategy) { case XXH64: this.hashStrategy = hashStrategy; hashFunction = new XxHash(); break; default: throw new RuntimeException("Unsupported hash strategy"); } }
Source:
<code>public void close() throws IOException { if (!completedFiles.isEmpty() || !filesInProcess.isEmpty()) { for (File file : completedFiles) { if (!file.delete()) { <START> LOG.warn("Unable to delete file [%s]", file.getPath()); <END> } } for (File file : filesInProcess) { if (!file.delete()) { LOG.warn("Unable to delete file [%s]", file.getPath()); } } throw new ISE(String.format( "%d writers needs to be closed before closing smoosher.", filesInProcess.size() + completedFiles.size() )); } if (currOut != null) { currOut.close(); } File metaFile = metaFile(baseDir); try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metaFile), Charsets.UTF_8))) { out.write(String.format("v1,%d,%d", maxChunkSize, outFiles.size())); out.write("\n"); for (Map.Entry<String, Metadata> entry : internalFiles.entrySet()) { final Metadata metadata = entry.getValue(); out.write( joiner.join( entry.getKey(), metadata.getFileNum(), metadata.getStartOffset(), metadata.getEndOffset() ) ); out.write("\n"); } } }</code><technical_language>I passing file is enough instead of file.getPath()</technical_language>

Target:
public void close() throws IOException { if (!completedFiles.isEmpty() || !filesInProcess.isEmpty()) { for (File file : completedFiles) { if (!file.delete()) { LOG.warn("Unable to delete file [%s]", file); } } for (File file : filesInProcess) { if (!file.delete()) { LOG.warn("Unable to delete file [%s]", file); } } throw new ISE( "[%d] writers in progress and [%d] completed writers needs to be closed before closing smoosher.", filesInProcess.size(), completedFiles.size() ); } if (currOut != null) { currOut.close(); } File metaFile = metaFile(baseDir); try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metaFile), Charsets.UTF_8))) { out.write(String.format("v1,%d,%d", maxChunkSize, outFiles.size())); out.write("\n"); for (Map.Entry<String, Metadata> entry : internalFiles.entrySet()) { final Metadata metadata = entry.getValue(); out.write( joiner.join( entry.getKey(), metadata.getFileNum(), metadata.getStartOffset(), metadata.getEndOffset() ) ); out.write("\n"); } } }
Source:
<code>private static Object getTagsValue(Attribute attr) { return StringUtils.join( <START> StreamSupport.stream(attr.getTags().spliterator(), false) <END> .map(Tag::getId) .collect(Collectors.toList()), ","); }</code><technical_language>Guava Streams.stream(myStream) instead of StreamSupport.stream(myStream.spliterator(), false)</technical_language>

Target:
private static Object getTagsValue(Attribute attr) { return Streams.stream(attr.getTags()).map(Tag::getId).collect(joining(",")); }
Source:
<code>private void initializeTrainingAndValidationSets(Iterable<? extends AbstractInstance> rawTrainingData) { setAndSortAllTrainingData(rawTrainingData); setMaxValidationTime(); int initialTrainingSetSize = getInitialSizeForTrainData(); trainingDataToAddToPredictiveModel = Lists.<AbstractInstance>newArrayListWithExpectedSize(initialTrainingSetSize); validationSet = Lists.<AbstractInstance>newArrayList(); DateTime timeOfInstance; DateTime timeOfFirstInstanceInValidationSet = dateTimeExtractor.extractDateTime(allTrainingData.get(initialTrainingSetSize)); DateTime leastUpperBoundOfValidationSet = timeOfFirstInstanceInValidationSet.plus(durationOfValidationSet); weightOfValidationSet = 0; for (AbstractInstance instance : allTrainingData) { timeOfInstance = dateTimeExtractor.extractDateTime(instance); if (timeOfInstance.isBefore(timeOfFirstInstanceInValidationSet)) { trainingDataToAddToPredictiveModel.add(instance); <START> } else if (timeOfInstance.isBefore(leastUpperBoundOfValidationSet) && !timeOfInstance.isAfter(maxTime)) { END> validationSet.add(instance); weightOfValidationSet += instance.getWeight(); } else break; } currentTrainingSetSize = trainingDataToAddToPredictiveModel.size(); return; }</code><technical_language>sort date, I need check !timeOfInstance.isAfter(maxTime)</technical_language>

Target:
private void initializeTrainingAndValidationSets(Iterable<? extends AbstractInstance> rawTrainingData) { setAndSortAllTrainingData(rawTrainingData); setMaxValidationTime(); int initialTrainingSetSize = getInitialSizeForTrainData(); trainingDataToAddToPredictiveModel = Lists.<AbstractInstance>newArrayListWithExpectedSize(initialTrainingSetSize); validationSet = Lists.<AbstractInstance>newArrayList(); DateTime timeOfInstance; DateTime timeOfFirstInstanceInValidationSet = dateTimeExtractor.extractDateTime(allTrainingData.get(initialTrainingSetSize)); DateTime leastUpperBoundOfValidationSet = timeOfFirstInstanceInValidationSet.plus(durationOfValidationSet); weightOfValidationSet = 0; for (AbstractInstance instance : allTrainingData) { timeOfInstance = dateTimeExtractor.extractDateTime(instance); if (timeOfInstance.isBefore(timeOfFirstInstanceInValidationSet)) { trainingDataToAddToPredictiveModel.add(instance); } else if (timeOfInstance.isBefore(leastUpperBoundOfValidationSet)) { validationSet.add(instance); weightOfValidationSet += instance.getWeight(); } else break; } currentTrainingSetSize = trainingDataToAddToPredictiveModel.size(); return; }
Source:
<code>public void checkOperationDefinition(OperationDefinition operationDefinition) { List<VariableDefinition> variableDefinitions = operationDefinition.getVariableDefinitions(); if (variableDefinitions == null || variableDefinitions.size() <= 1) { return; } <START> Set<String> variableNameList = new HashSet<>(variableDefinitions.size()); <END> for (VariableDefinition variableDefinition : variableDefinitions) { if (variableNameList.contains(variableDefinition.getName())) { addError(ValidationErrorType.DuplicateVariableName, variableDefinition.getSourceLocation(), duplicateVariableNameMessage(variableDefinition.getName())); } else { variableNameList.add(variableDefinition.getName()); } } }</code><technical_language>LinkedHashSet in general in favor of HashSet preserves order</technical_language>

Target:
public void checkOperationDefinition(OperationDefinition operationDefinition) { List<VariableDefinition> variableDefinitions = operationDefinition.getVariableDefinitions(); if (variableDefinitions == null || variableDefinitions.size() <= 1) { return; } Set<String> variableNameList = new LinkedHashSet<>(variableDefinitions.size()); for (VariableDefinition variableDefinition : variableDefinitions) { if (variableNameList.contains(variableDefinition.getName())) { addError(ValidationErrorType.DuplicateVariableName, variableDefinition.getSourceLocation(), duplicateVariableNameMessage(variableDefinition.getName())); } else { variableNameList.add(variableDefinition.getName()); } } }
Source:
<code>private List<Partition> batchGetPartitions(AWSGlueAsync glueClient, String tableName) throws IOException { List<Partition> partitions = new ArrayList<>(); try { GetPartitionsRequest getPartitionsRequest = new GetPartitionsRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withDatabaseName(mGlueDbName) .withTableName(tableName); if (glueClient.getPartitions(getPartitionsRequest).getPartitions() != null) { partitions = glueClient.getPartitions(getPartitionsRequest).getPartitions(); } return partitions; } catch (AWSGlueException e) { <START> throw new IOException("WARNING: Cannot get partition information for table: " <END> + tableName + ". error: " + e.getMessage(), e); } }</code><technical_language>remove "WARNING", add catalog id database name</technical_language>

Target:
private List<Partition> batchGetPartitions(AWSGlueAsync glueClient, String tableName) throws IOException { List<Partition> partitions = new ArrayList<>(); try { GetPartitionsRequest getPartitionsRequest = new GetPartitionsRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withDatabaseName(mGlueDbName) .withTableName(tableName); if (glueClient.getPartitions(getPartitionsRequest).getPartitions() != null) { partitions = glueClient.getPartitions(getPartitionsRequest).getPartitions(); } return partitions; } catch (AWSGlueException e) { throw new IOException("Cannot get partition information for table: " + tableName + " in Database: " + mGlueDbName + "; Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". error: " + e.getMessage(), e); } }
Source:
<code>public ElytronClientSshdSessionFactory(URI authenticationConfig) throws ConfigXMLParseException, GeneralSecurityException { context = ElytronXmlParser.parseAuthenticationClientConfiguration(authenticationConfig).create(); this.defaultKeys = new ConcurrentHashMap(); <START> this.defaultIdentities = SshConstants.DEFAULT_IDENTITIES; <END> this.keyPair = null; this.knownHostsFile = "known_hosts"; }</code><technical_language>This reference a constant Elytron instead SshConstants.DEFAULT_IDENTITIES includes algorithm supporting yet</technical_language>

Target:
public ElytronClientSshdSessionFactory(URI authenticationConfig) throws ConfigXMLParseException, GeneralSecurityException { if (authenticationConfig != null) { context = ElytronXmlParser.parseAuthenticationClientConfiguration(authenticationConfig).create(); } else { context = null; } this.defaultKeys = new ConcurrentHashMap<>(); this.setSshDirectory(SSHCredential.DEFAULT_SSH_DIRECTORY); this.defaultIdentities = SSHCredential.DEFAULT_PRIVATE_KEYS; this.keyPair = null; this.knownHostsFile = SSHCredential.DEFAULT_KNOWN_HOSTS; }
Source:
<code>private static BehaviorCategory resolveBehaviorCategory(String category) { if(null == category) { return null; } String CAT = category.toUpperCase(); if(CAT.contains("DEMERIT")) { return BehaviorCategory.DEMERIT; } else if(CAT.contains("MERIT")) { return BehaviorCategory.MERIT; } else if(CAT.contains("HOMEWORK")) { return BehaviorCategory.HOMEWORK; } else if(CAT.contains("DETENTION")) { return BehaviorCategory.DETENTION; } else if(CAT.contains("SUSPENSION")) { return BehaviorCategory.OUT_OF_SCHOOL_SUSPENSION; } else if(CAT.contains("D.O.") || CAT.contains("OFFICE") || CAT.contains("REFERRAL")) { return BehaviorCategory.REFERRAL; } else if(CAT.contains("AUTOMATIC") || CAT.contains("GENERAL") || CAT.contains("STORE")) { <START> return null; <END> } else { return BehaviorCategory.OTHER; } }</code><technical_language>strings lead a null category? run automatically? a category</technical_language>

Target:
private static BehaviorCategory resolveBehaviorCategory(String category) { if(null == category) { return null; } String CAT = category.toUpperCase(); if(CAT.contains("DEMERIT")) { return BehaviorCategory.DEMERIT; } else if(CAT.contains("MERIT")) { return BehaviorCategory.MERIT; } else if(CAT.contains("HOMEWORK")) { return BehaviorCategory.HOMEWORK; } else if(CAT.contains("LUNCH DETENTION")) { return BehaviorCategory.LUNCH_DETENTION; } else if(CAT.contains("DETENTION")) { return BehaviorCategory.DETENTION; } else if(CAT.contains("SUSPENSION")) { return BehaviorCategory.OUT_OF_SCHOOL_SUSPENSION; } else if(CAT.contains("D.O.") || CAT.contains("OFFICE") || CAT.contains("REFERRAL") || CAT.contains("DEAN")) { return BehaviorCategory.REFERRAL; } else { return BehaviorCategory.OTHER; } }
Source:
<code>public Iterable<Directive> process(final XML xml) throws IOException { final ContainerInstance instance = this.amazon.runOnDemand(); Logger.info( this, "ECS instance %s created", instance ); return new Directives().xpath("/talk") .add("ecs") <START> .attr("id", instance.getEc2InstanceId()); <END> }</code><technical_language>@xupyprmv related ec2</technical_language>

Target:
public Iterable<Directive> process(final XML xml) throws IOException { final Container container = this.amazon.runOnDemand(); Logger.info( this, "ECS container %s created", container ); return new Directives().xpath("/talk") .add("ec2") .attr("id", container.getContainerArn()); }
Source:
<code>public void cleanup(String workspaceId) { try (OpenShiftClient client = clientFactory.create()) { final String pvcUniqueName = pvcName + '-' + workspaceId; final List<PersistentVolumeClaim> pvcs = client.persistentVolumeClaims().inNamespace(projectName).list().getItems(); for (PersistentVolumeClaim pvc : pvcs) { <START> if (pvc.getMetadata().getName().equals(pvcUniqueName)) { <END> client.persistentVolumeClaims().inNamespace(projectName).delete(pvc); return; } } } }</code><technical_language>get needed pvc client.persistentVolumeClaims().inNamespace(projectName).withName(pvcUniqueName).get(); avoid for for search</technical_language>

Target:
public void cleanup(String workspaceId) { try (OpenShiftClient client = clientFactory.create()) { final String pvcUniqueName = pvcName + '-' + workspaceId; client.persistentVolumeClaims().inNamespace(projectName).withName(pvcUniqueName).delete(); } }
Source:
<code>public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final WeldCapability weldCapability; try { weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class); } catch (CapabilityServiceSupport.NoSuchCapabilityException e) { String msg = String.format("Deployment %s requires use of the '%s' capability but it is not currently registered", phaseContext.getDeploymentUnit().getName(), <START> WELD_CAPABILITY_NAME); <END> throw new DeploymentUnitProcessingException(msg); } if (weldCapability.isPartOfWeldDeployment(deploymentUnit)) { final SmallRyeHealthReporter healthReporter = (SmallRyeHealthReporter) phaseContext.getServiceRegistry().getService(MicroProfileHealthSubsystemDefinition.HEALTH_REPORTER_SERVICE).getValue(); weldCapability.registerExtensionInstance(new CDIExtension(healthReporter), deploymentUnit); } }</code><technical_language>This needs in i18n Logger method</technical_language>

Target:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final WeldCapability weldCapability; try { weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class); } catch (CapabilityServiceSupport.NoSuchCapabilityException e) { throw new DeploymentUnitProcessingException(MicroProfileHealthLogger.LOGGER.deploymentRequiresCapability( phaseContext.getDeploymentUnit().getName(), WELD_CAPABILITY_NAME) ); } if (weldCapability.isPartOfWeldDeployment(deploymentUnit)) { final SmallRyeHealthReporter healthReporter = (SmallRyeHealthReporter) phaseContext.getServiceRegistry().getService(MicroProfileHealthSubsystemDefinition.HEALTH_REPORTER_SERVICE).getValue(); weldCapability.registerExtensionInstance(new CDIExtension(healthReporter), deploymentUnit); } }
Source:
<code>public static void main(String[] argv) throws Exception{ Args args = new Args(); CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(argv); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } Directory directory = FSDirectory.open(new File(args.index).toPath()); IndexReader reader = DirectoryReader.open(directory); if (args.stats) { Terms terms = MultiTerms.getTerms(reader, IndexArgs.CONTENTS); System.out.println("Index statistics"); System.out.println("----------------"); System.out.println("documents: " + reader.numDocs()); System.out.println("documents (non-empty): " + reader.getDocCount(IndexArgs.CONTENTS)); System.out.println("unique terms: " + terms.size()); System.out.println("total terms: " + reader.getSumTotalTermFreq(IndexArgs.CONTENTS)); <START> } <END> reader.close(); directory.close(); }</code><technical_language>obtain stats getIndexStats print those? Reduces duplicate code</technical_language>

Target:
public static void main(String[] argv) throws Exception { Args args = new Args(); CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(argv); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } IndexReader reader = IndexReaderUtils.getReader(args.index); Map<String, Object> results = IndexReaderUtils.getIndexStats(reader); if (args.stats) { Terms terms = MultiTerms.getTerms(reader, IndexArgs.CONTENTS); System.out.println("Index statistics"); System.out.println("----------------"); System.out.println("documents: " + results.get("documents")); System.out.println("documents (non-empty): " + results.get("non_empty_documents")); System.out.println("unique terms: " + results.get("unique_terms")); System.out.println("total terms: " + results.get("total_terms")); } reader.close(); }
Source:
<code>public int getDepartmentsCount(AccessGroupSet accessGroups) { try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("department"); <START> query.setFacetLimit(-1); <END> QueryResponse response = this.executeQuery(query); return response.getFacetField("department").getValueCount(); } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving department list", e); } return -1; }</code><technical_language>1 signal here? i a good explanation of this in solr docs</technical_language>

Target:
public int getDepartmentsCount(AccessGroupSet accessGroups) { try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("department"); query.setFacetLimit(-1); QueryResponse response = this.executeQuery(query); return response.getFacetField("department").getValueCount(); } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving department list", e); return -1; } }
Source:
<code>public void checkProductItem(ProductItem item) { assertTrue(item.getId() > 0, "item id must be more than 0"); assertNotNull(item.getDescription(), "item description must be not null"); checkCategories(item.getCategories()); <START> assertTrue(item.getPrices().size() >= 0); <END> for (ProductItemPrice price : item.getPrices()) { checkPrice(price); } }</code><technical_language>!...isEmpty() assertFalse(...isEmpty()</technical_language>

Target:
public void checkProductItem(ProductItem item) { assertTrue(item.getId() > 0, "item id must be more than 0"); assertNotNull(item.getDescription(), "item description must be not null"); checkCategories(item.getCategories()); assertFalse(item.getPrices().isEmpty()); for (ProductItemPrice price : item.getPrices()) { checkPrice(price); } }
Source:
<code>private static String baseMessage() { return String.format( <START> "Neo4j cannot be started, because the database files require upgrading and upgrades are " + <END> "disabled in configuration. Please set '%s' to 'true' in your configuration file and try again.", GraphDatabaseSettings.allow_upgrade.name() ); }</code><technical_language>upgrades are, dunno plural there. upgrading is... extra care public surface. WDYT</technical_language>

Target:
private static String baseMessage() { return String.format( "Neo4j cannot be started because the database files require upgrading and upgrades are disabled " + "in the configuration. Please set '%s' to 'true' in your configuration file and try again.", GraphDatabaseSettings.allow_upgrade.name() ); }
Source:
<code>public static void main(String[] args) throws Exception { final String baseDir; if (System.getenv("TEST_DATA_DIR") != null) { baseDir = System.getenv("TEST_DATA_DIR"); } else { baseDir = System.getProperty("java.io.tmpdir"); } File output = new File(baseDir, "python_udf_sql_job_result.csv"); if (output.exists()) { output.delete(); } TableEnvironment tEnv = TableEnvironment.create( EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build()); tEnv.getConfig().getConfiguration().set(CoreOptions.DEFAULT_PARALLELISM, 1); tEnv.sqlUpdate("create temporary system function add_one as 'add_one.add_one' language python"); tEnv.connect(new FileSystem().path(output.getAbsolutePath())) .withSchema(new Schema().field("a", DataTypes.BIGINT())) .withFormat(new OldCsv().field("a", DataTypes.BIGINT())) .inAppendMode() .createTemporaryTable("sink"); tEnv.createTemporaryView("source", tEnv.fromValues(1L, 2L, 3L).as("a")); <START> tEnv.sqlUpdate("insert into sink select add_one(a) as a from source"); <END> tEnv.execute("test-blink-batch-pyudf-sql-job"); try (InputStream in = new FileInputStream(output)) { byte[] content = new byte[in.available()]; in.read(content); String result = new String(content); if (!"2\n3\n4\n".equals(result)) { throw new AssertionError(String.format("The output result: '%s' is not as expected!", result)); } } }</code><technical_language>executeSql? update other places</technical_language>

Target:
public static void main(String[] args) { TableEnvironment tEnv = TableEnvironment.create( EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build()); tEnv.getConfig().getConfiguration().set(CoreOptions.DEFAULT_PARALLELISM, 1); tEnv.executeSql("create temporary system function add_one as 'add_one.add_one' language python"); tEnv.createTemporaryView("source", tEnv.fromValues(1L, 2L, 3L).as("a")); Iterator<Row> result = tEnv.executeSql("select add_one(a) as a from source").collect(); List<Long> actual = new ArrayList<>(); while (result.hasNext()) { Row r = result.next(); actual.add((Long) r.getField(0)); } List<Long> expected = Arrays.asList(2L, 3L, 4L); if (!actual.equals(expected)) { throw new AssertionError(String.format("The output result: %s is not as expected: %s!", actual, expected)); } }
Source:
<code><START> public void minimalYamlParsesCorrectly() throws IOException { <END> testYaml("caching-yaml-example.yaml"); }</code><technical_language>this next</technical_language>

Target:
public void minimalYamlParsesCorrectly() throws IOException { testYaml("minimal.yaml"); }
Source:
<code>public void rebuildIndexes() { long forumComponentId = componentService.getComponentOfForum().getId(); <START> componentService.checkPermissionsForComponent(forumComponentId); <END> topicSearchService.rebuildSearchIndex(); }</code><technical_language>I put lines topicSearchService.rebuildSearchIndex()</technical_language>

Target:
public void rebuildIndexes() { topicSearchService.rebuildSearchIndex(); }
Source:
<code>public static void start(final Stage primaryStage) { GridPane grid = new GridPane(); grid.setPadding(new javafx.geometry.Insets(10, 10, 10, 10)); grid.setVgap(20); grid.setHgap(20); Style.setBackground("sc2.jpg", grid); Button backButton; backButton = new Button("Back"); Style.setButtonStyle(backButton); GridPane.setConstraints(backButton, 2, 26); final Button soundButton; soundButton = new Button("Sound: ON"); Style.setButtonStyle(soundButton); soundButton.setFont(Font.font("Roboto", FontWeight.BOLD, 20)); GridPane.setConstraints(soundButton, 5, 18); grid.getChildren().addAll(backButton, soundButton); backButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(final ActionEvent event) { StartScreen.start(primaryStage); } }); soundButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { if (sound) { soundButton.setText("Sound: OFF"); <START> sound = false; <END> } else { soundButton.setText("Sound: ON"); sound = true; } } }); settings = new Scene(grid, GUIConstant.WIDTH, GUIConstant.HEIGHT); primaryStage.setScene(settings); primaryStage.show(); }</code><technical_language>Is a lot of blank newlines here? :P <layout</technical_language>

Target:
public static void start(final Stage primaryStage) { GridPane grid = new GridPane(); grid.setPadding(new javafx.geometry.Insets(10, 10, 10, 10)); grid.setVgap(20); grid.setHgap(20); Style.setBackground("sc2.jpg", grid); Button backButton; backButton = new Button("Back"); Style.setButtonStyle(backButton); GridPane.setConstraints(backButton, 2, 26); final Button soundButton; soundButton = new Button("Sound: ON"); Style.setButtonStyle(soundButton); soundButton.setFont(Font.font("Roboto", FontWeight.BOLD, 20)); GridPane.setConstraints(soundButton, 5, 18); grid.getChildren().addAll(backButton, soundButton); backButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(final ActionEvent event) { StartScreen.start(primaryStage); } }); soundButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(final ActionEvent event) { if (sound) { soundButton.setText("Sound: OFF"); sound = false; } else { soundButton.setText("Sound: ON"); sound = true; } } }); settings = new Scene(grid, GUIConstant.WIDTH, GUIConstant.HEIGHT); primaryStage.setScene(settings); primaryStage.show(); }
Source:
<code>protected int getRecommendMaxNumberMessagesPerParam(AttackStrength strength) { int recommendMax = super.getRecommendMaxNumberMessagesPerParam(strength); switch (strength) { case LOW: return recommendMax + 4; case MEDIUM: default: return recommendMax + 6; case HIGH: return recommendMax + 7; case INSANE: <START> return 300; <END> } }</code><technical_language>return recommendMax + 225;</technical_language>

Target:
protected int getRecommendMaxNumberMessagesPerParam(AttackStrength strength) { int recommendMax = super.getRecommendMaxNumberMessagesPerParam(strength); switch (strength) { case LOW: return recommendMax + 4; case MEDIUM: default: return recommendMax + 6; case HIGH: return recommendMax + 7; case INSANE: return recommendMax + 9; } }
Source:
<code>private void replaceVariables(Node root) throws Exception { boolean failFast = false; <START> List<ConfigReplacer> replacers = new ArrayList<ConfigReplacer>(); <END> PropertyReplacer propertyReplacer = new PropertyReplacer(); propertyReplacer.init(getProperties()); replacers.add(propertyReplacer); Node node = (Node) xpath.evaluate(format("/hz:%s/hz:%s", getConfigType().name, CONFIG_REPLACERS.name), root, XPathConstants.NODE); if (node != null) { String failFastAttr = getAttribute(node, "fail-if-value-missing"); failFast = isNullOrEmpty(failFastAttr) || Boolean.parseBoolean(failFastAttr); for (Node n : childElements(node)) { String value = cleanNodeName(n); if ("replacer".equals(value)) { replacers.add(createReplacer(n)); } } } ConfigReplacerHelper.traverseChildrenAndReplaceVariables(root, replacers, failFast, new XmlDomVariableReplacer()); }</code><technical_language>This traverseChildrenAndReplaceVariables(root) duplicate methods. this a leftover</technical_language>

Target:
private void replaceVariables(Node root) throws Exception { boolean failFast = false; List<ConfigReplacer> replacers = new ArrayList<ConfigReplacer>(); PropertyReplacer propertyReplacer = new PropertyReplacer(); propertyReplacer.init(getProperties()); replacers.add(propertyReplacer); Node node = (Node) xpath.evaluate(format("/hz:%s/hz:%s", getConfigType().name, CONFIG_REPLACERS.getName()), root, XPathConstants.NODE); if (node != null) { String failFastAttr = getAttribute(node, "fail-if-value-missing"); failFast = isNullOrEmpty(failFastAttr) || Boolean.parseBoolean(failFastAttr); for (Node n : childElements(node)) { String value = cleanNodeName(n); if ("replacer".equals(value)) { replacers.add(createReplacer(n)); } } } ConfigReplacerHelper.traverseChildrenAndReplaceVariables(root, replacers, failFast, new XmlDomVariableReplacer()); }
Source:
<code>protected @NonNull TmfEventsTable createEventsTable(final Composite parent, final int cacheSize) { ITmfTrace trace = fTrace; TmfEventsTable table = TmfTraceTypeUIUtils.getEventTable(trace, parent, cacheSize); if (table != null) { return table; } Iterable<ITmfEventAspect> aspects = getTraceAspects(trace); <START> if (!aspects.iterator().hasNext()) { <END> return new TmfEventsTable(parent, cacheSize); } return new TmfEventsTable(parent, cacheSize, aspects); }</code><technical_language>This is I Iterable ;)</technical_language>

Target:
protected @NonNull TmfEventsTable createEventsTable(final Composite parent, final int cacheSize) { ITmfTrace trace = fTrace; TmfEventsTable table = TmfTraceTypeUIUtils.getEventTable(trace, parent, cacheSize); if (table != null) { return table; } Iterable<ITmfEventAspect> aspects = getTraceAspects(trace); if (Iterables.isEmpty(aspects)) { return new TmfEventsTable(parent, cacheSize); } return new TmfEventsTable(parent, cacheSize, aspects); }
Source:
<code>private static EventTableLine buildEventTableLine(Map<Long, ITmfEventAspect<?>> aspects, ITmfEvent event, long lineIndex, long lineRank) { List<String> entry = new <START> ArrayList<>(); <END> for (Entry<Long, ITmfEventAspect<?>> aspectEntry : aspects.entrySet()) { Object aspectResolved = aspectEntry.getValue().resolve(event); entry.add(Objects.requireNonNull(aspectResolved == null ? StringUtils.EMPTY : String.valueOf(aspectResolved))); } return new EventTableLine(entry, lineIndex, event.getTimestamp(), lineRank, 0); }</code><technical_language>aspects.size()</technical_language>

Target:
private static EventTableLine buildEventTableLine(Map<Long, ITmfEventAspect<?>> aspects, ITmfEvent event, long lineIndex, long lineRank) { List<String> entry = new ArrayList<>(aspects.size()); for (Entry<Long, ITmfEventAspect<?>> aspectEntry : aspects.entrySet()) { Object aspectResolved = aspectEntry.getValue().resolve(event); entry.add(aspectResolved == null ? StringUtils.EMPTY : String.valueOf(aspectResolved)); } return new EventTableLine(entry, lineIndex, event.getTimestamp(), lineRank, 0); }
Source:
<code>public void scan(HttpMessage msg, String param, String value) { if (checkWithPayloadsAndResponses(msg, param, errorCausingPayloads, evidenceError)) { checkWithPayloadsAndResponses(msg, param, vendorReturningPayloads, xsltVendors); <START> checkPortScanning(msg, param); <END> } }</code><technical_language>this alerts raised? I suppose in UI due lack of uniqueness (URL, param, etc). Do is in distinguishing type of check resulted in alert? (Different alert names? Specific other info details?)</technical_language>

Target:
public void scan(HttpMessage msg, String param, String value) { for (XSLTInjectionType check : XSLTInjectionType.values()) { if (tryInjection(msg, param, check)) { return; } } }
Source:
<code>public Map<String, Ref> getRefs(String prefix) throws IOException { List<Ref> refs = reftableDatabase.getRefsByPrefix(prefix); <START> RefList.Builder builder = new RefList.Builder(refs.size()); <END> for (Ref r : refs) { builder.add(r); } return new RefMap(prefix, builder.toRefList(), RefList.emptyList(), RefList.emptyList()); }</code><technical_language>missing type parameter causing warnings RefList.Builder<Ref> builder = new RefList.Builder<>(refs.size());</technical_language>

Target:
public Map<String, Ref> getRefs(String prefix) throws IOException { List<Ref> refs = reftableDatabase.getRefsByPrefix(prefix); RefList.Builder<Ref> builder = new RefList.Builder<>(refs.size()); for (Ref r : refs) { builder.add(r); } return new RefMap(prefix, builder.toRefList(), RefList.emptyList(), RefList.emptyList()); }
Source:
<code>public final DefaultConstraintMapping createConstraintMapping() { PropertyFilter propertyFilterToUse = null; if ( propertyFilter == null ) { propertyFilterToUse = new DefaultPropertyFilter(); LOG.creatingConstraintMappingPriorToBuildingFactoryWithoutDefinedFilter(); } else { propertyFilterToUse = propertyFilter; } LOG.creatingConstraintMappingPriorToBuildingFactory( propertyFilterToUse.getClass() ); <START> return new DefaultConstraintMapping( propertyFilterToUse ); <END> }</code><technical_language>Hmmm, time hit this wall (we this issue discussed resolving parameter names for - a bit HibernateValidatorContext issue). a step back, I a pretty bad decision allow define mappings configuration phase. a separate step. Wondering if revisit this idea of postponing mappings creation factory building phase. do this patch in, if sense</technical_language>

Target:
public final DefaultConstraintMapping createConstraintMapping() { GetterPropertyMatcher getterPropertyMatcherToUse = null; if ( getterPropertyMatcher == null ) { getterPropertyMatcherToUse = new DefaultGetterPropertyMatcher(); LOG.creatingConstraintMappingPriorToBuildingFactoryWithoutDefinedFilter(); } else { getterPropertyMatcherToUse = getterPropertyMatcher; } LOG.creatingConstraintMappingPriorToBuildingFactory( getterPropertyMatcherToUse.getClass() ); return new DefaultConstraintMapping( getterPropertyMatcherToUse ); }
Source:
<code>public static String byteToHexString(byte[] bytes, int start, int end) { if(bytes == null) { throw new IllegalArgumentException("bytes == null"); } else { <START> StringBuilder s = new StringBuilder(); <END> for(int i = start; i < end; ++i) { s.append(String.format("%02x", bytes[i])); } return s.toString(); } }</code><technical_language>hadoop's StringUtils.byteToHexString is</technical_language>

Target:
public static String byteToHexString(byte[] bytes, int start, int end) { return org.apache.hadoop.util.StringUtils.byteToHexString(bytes, start, end); }
Source:
<code>public void init(StreamGraph graph, Config config) { StreamSpec pageViewStreamSpec = new StreamSpec("page-views", TestRepartitionWindowApp.INPUT_TOPIC, "kafka"); Function<MessageEnvelope<String, String>, String> keyFn = pageView -> (String) pageView.getKey(); MessageStream<MessageEnvelope<String, String>> pageViews = graph.createInStream(pageViewStreamSpec, null, null); pageViews .partitionBy(keyFn) .window(Windows.keyedSessionWindow(keyFn, Duration.ofSeconds(3))) .sink((windowOutput, collector, coordinator) -> { String key = windowOutput.getKey().getKey(); String count = new Integer(windowOutput.getMessage().size()).toString(); LOG.info("Count is " + count + " for key " + key); <START> collector.send(new OutgoingMessageEnvelope(new SystemStream("kafka", TestRepartitionWindowApp.OUTPUT_TOPIC), key, count)); <END> }); }</code><technical_language>nit: I suspect folks tests examples of write StreamApplications while matter for testing, I good precreate SystemStream once. recommend for a performance-critical processor, set convention here. Is some reason do here</technical_language>

Target:
public void init(StreamGraph graph, Config config) { MessageStream<String> pageViews = graph.<String, String, String>getInputStream("page-views", (k, v) -> v); Function<String, String> keyFn = pageView -> new PageView(pageView).getUserId(); OutputStream<String, String, WindowPane<String, Collection<String>>> outputStream = graph .getOutputStream(TestRepartitionWindowApp.OUTPUT_TOPIC, m -> m.getKey().getKey(), m -> new Integer(m.getMessage().size()).toString()); pageViews .partitionBy(keyFn) .window(Windows.keyedSessionWindow(keyFn, Duration.ofSeconds(3))) .sendTo(outputStream); }
Source:
<code>protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) <START> { String analysisId = NonNullUtils.nullToEmptyString(getViewSite().getSecondaryId()); <END> return new AbstractSegmentStoreScatterChartTreeViewer(Objects.requireNonNull(parent)) { @Override protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(ITmfTrace trace) { IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, IAnalysisModule.class, analysisId); if (module instanceof ISegmentStoreProvider) { return (ISegmentStoreProvider) module; } return null; } }; }</code><technical_language>handle this error log returning null instead of a viewer? view work incorrect id</technical_language>

Target:
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { String analysisId = String.valueOf(getViewSite().getSecondaryId()); return new AbstractSegmentStoreScatterChartTreeViewer(Objects.requireNonNull(parent)) { @Override protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(ITmfTrace trace) { IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, IAnalysisModule.class, analysisId); if (module instanceof ISegmentStoreProvider) { return (ISegmentStoreProvider) module; } return null; } }; }
Source:
<code>private synchronized boolean tryEvict() { ReadBuffer nodeToEvict = null; if (completedReadList.size() <= 0) { return false; } for (ReadBuffer buf : completedReadList) { if (buf.isFirstByteConsumed() && buf.isLastByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } for (ReadBuffer buf : completedReadList) { if (buf.isAnyByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } long earliestBirthday = Long.MAX_VALUE; ArrayList<ReadBuffer> oldFailedBuffers = new ArrayList<>(); for (ReadBuffer buf : completedReadList) { if ((buf.getBufferindex() != -1) && (buf.getTimeStamp() < earliestBirthday)) { nodeToEvict = buf; earliestBirthday = buf.getTimeStamp(); } else if ((buf.getBufferindex() == -1) <START> && (currentTimeMillis() - buf.getTimeStamp()) > thresholdAgeMilliseconds) { <END> oldFailedBuffers.add(buf); } } for (ReadBuffer buf : oldFailedBuffers) { evict(buf); } if ((currentTimeMillis() - earliestBirthday > thresholdAgeMilliseconds) && (nodeToEvict != null)) { return evict(nodeToEvict); } return false; }</code><technical_language>pull currentTimeMillis() for loop OS call potential cost, work if is loop code L269</technical_language>

Target:
private synchronized boolean tryEvict() { ReadBuffer nodeToEvict = null; if (completedReadList.size() <= 0) { return false; } long currentTimeInMs = currentTimeMillis(); for (ReadBuffer buf : completedReadList) { if (buf.isFirstByteConsumed() && buf.isLastByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } for (ReadBuffer buf : completedReadList) { if (buf.isAnyByteConsumed()) { nodeToEvict = buf; break; } } if (nodeToEvict != null) { return evict(nodeToEvict); } long earliestBirthday = Long.MAX_VALUE; ArrayList<ReadBuffer> oldFailedBuffers = new ArrayList<>(); for (ReadBuffer buf : completedReadList) { if ((buf.getBufferindex() != -1) && (buf.getTimeStamp() < earliestBirthday)) { nodeToEvict = buf; earliestBirthday = buf.getTimeStamp(); } else if ((buf.getBufferindex() == -1) && (currentTimeInMs - buf.getTimeStamp()) > thresholdAgeMilliseconds) { oldFailedBuffers.add(buf); } } for (ReadBuffer buf : oldFailedBuffers) { evict(buf); } if ((currentTimeInMs - earliestBirthday > thresholdAgeMilliseconds) && (nodeToEvict != null)) { return evict(nodeToEvict); } return false; }
Source:
<code>private NumberSchema.Builder buildNumberSchema() { NumberSchema.Builder builder = NumberSchema.builder(); ls.schemaJson().maybe("minimum").map(JsonValue::requireNumber).ifPresent(builder::minimum); ls.schemaJson().maybe("maximum").map(JsonValue::requireNumber).ifPresent(builder::maximum); if (config.useDefaults) <START> ls.schemaJson().maybe("default").map(JsonValue::requireNumber).ifPresent(builder::defaultValue); <END> ls.schemaJson().maybe("multipleOf").map(JsonValue::requireNumber).ifPresent(builder::multipleOf); ls.schemaJson().maybe("exclusiveMinimum") .ifPresent(exclMin -> exclusiveLimitHandler.handleExclusiveMinimum(exclMin, builder)); ls.schemaJson().maybe("exclusiveMaximum") .ifPresent(exclMax -> exclusiveLimitHandler.handleExclusiveMaximum(exclMax, builder)); return builder; }</code><technical_language>notes in #buildBooleanSchema()</technical_language>

Target:
private NumberSchema.Builder buildNumberSchema() { NumberSchema.Builder builder = NumberSchema.builder(); ls.schemaJson().maybe("minimum").map(JsonValue::requireNumber).ifPresent(builder::minimum); ls.schemaJson().maybe("maximum").map(JsonValue::requireNumber).ifPresent(builder::maximum); ls.schemaJson().maybe("multipleOf").map(JsonValue::requireNumber).ifPresent(builder::multipleOf); ls.schemaJson().maybe("exclusiveMinimum") .ifPresent(exclMin -> exclusiveLimitHandler.handleExclusiveMinimum(exclMin, builder)); ls.schemaJson().maybe("exclusiveMaximum") .ifPresent(exclMax -> exclusiveLimitHandler.handleExclusiveMaximum(exclMax, builder)); return builder; }
Source:
<code><START> public ReadableByteChannel get(PageId pageId, int pageOffset) <END> throws IOException, PageNotFoundException { try { byte[] page = mDb.get(getPageKey(pageId)); if (page == null) { throw new PageNotFoundException(new String(getPageKey(pageId))); } ByteArrayInputStream bais = new ByteArrayInputStream(page); bais.skip(pageOffset); return Channels.newChannel(bais); } catch (RocksDBException e) { throw new IOException("Failed to retrieve page", e); } }</code><technical_language>Precondition check page Offset is positive</technical_language>

Target:
public ReadableByteChannel get(PageId pageId, int pageOffset) throws IOException, PageNotFoundException { Preconditions.checkArgument(pageOffset >= 0, "page offset should be non-negative"); try { byte[] page = mDb.get(getPageKey(pageId)); if (page == null) { throw new PageNotFoundException(new String(getPageKey(pageId))); } Preconditions.checkArgument(pageOffset <= page.length, "page offset %s exceeded page size %s", pageOffset, page.length); ByteArrayInputStream bais = new ByteArrayInputStream(page); bais.skip(pageOffset); return Channels.newChannel(bais); } catch (RocksDBException e) { throw new IOException("Failed to retrieve page", e); } }
Source:
<code>public int getSmsCapacityOnIccForSubscriber(int subId) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { return iccSmsIntMgr.getSmsCapacityOnIcc(); } else { Rlog.e(LOG_TAG, "iccSmsIntMgr is null for " + " subId: " + subId); <START> return -1; <END> } }</code><technical_language>0</technical_language>

Target:
public int getSmsCapacityOnIccForSubscriber(int subId) { IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId); if (iccSmsIntMgr != null ) { return iccSmsIntMgr.getSmsCapacityOnIcc(); } else { Rlog.e(LOG_TAG, "iccSmsIntMgr is null for " + " subId: " + subId); return 0; } }
Source:
<code>public void testDeleteScene() { <START> Map<String, Scene> scenes = mockController.getModel().getScenes(); <END> scenes.clear(); scenes.put("initial", new Scene()); mockController.action(DeleteScene.NAME, "initial"); assertEquals(scenes.size(), 1); scenes.put("second", new Scene()); mockController.action(DeleteScene.NAME, "second"); assertEquals(scenes.size(), 1); scenes.put("newInitial", new Scene()); mockController.getModel().getGame().setInitialScene("initial"); mockController.action(DeleteScene.NAME, "initial"); assertEquals("newInitial", mockController.getModel().getGame() .getInitialScene()); }</code><technical_language>shorten this a mockModel.getScenes();</technical_language>

Target:
public void testDeleteScene() { Map<String, EditorScene> scenes = mockModel.getScenes(); scenes.clear(); scenes.put("initial", new EditorScene()); mockController.action(DeleteScene.class, "initial"); assertEquals(scenes.size(), 1); scenes.put("second", new EditorScene()); mockController.action(DeleteScene.class, "second"); assertEquals(scenes.size(), 1); scenes.put("newInitial", new EditorScene()); mockModel.getGame().setEditScene("initial"); mockController.getModel().getGame().setInitialScene("initial"); mockController.action(DeleteScene.class, "initial"); assertEquals("newInitial", mockModel.getGame().getInitialScene()); assertEquals("newInitial", mockModel.getGame().getEditScene()); }
Source:
<code>private Set<String> validateGracePeriodAndExternalPorts(final Job job) { final Integer gracePeriod = job.getGracePeriod(); if (gracePeriod != null && gracePeriod > 0 && job.hasExternalPorts()) { return singleton( <START> "Job has a grace period and static/external ports. Please choose one or the other."); <END> } return emptySet(); }</code><technical_language>explanation of this is a problem useful (or a link docs explaining it). "This configuration prevent new containers deploying gracePeriod of port conflicts."</technical_language>

Target:
private Set<String> validateGracePeriodAndExternalPorts(final Job job) { final Integer gracePeriod = job.getGracePeriod(); if (gracePeriod != null && gracePeriod > 0 && job.hasExternalPorts()) { return singleton("This configuration will prevent new containers from deploying during the " + "gracePeriod because of port conflicts."); } return emptySet(); }