auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String getValidBrickNames(List<GlusterBrickEntity> bricksForTask) { StringBuilder builder = new StringBuilder(); for (GlusterBrickEntity brick : bricksForTask) { builder.append(brick.getQualifiedName()); builder.append(", "); } return builder.substring(0, builder.length() - 2).toString(); }

Target:
private String getValidBrickNames(List<GlusterBrickEntity> bricksForTask) { if (bricksForTask.size() == 0) { return ""; } StringBuilder builder = new StringBuilder(); for (GlusterBrickEntity brick : bricksForTask) { builder.append(brick.getQualifiedName()); builder.append(", "); } return builder.substring(0, builder.length() - 2).toString(); }
Source:
public void discardAllContents(Box box) throws IOException; public void discardSingleItem(Box box, String position) throws IOException; public Box getByAlias(String alias) throws IOException; public Box getByBarcode(String barcode) throws IOException; public Map<String, Integer> getColumnSizes() throws IOException; public Collection<BoxableView> getViewsFromBarcodeList(Collection<String> barcodeList) throws IOException; public List<Box> getBySearch(String search); public Collection<BoxSize> listSizes() throws IOException; public Collection<BoxUse> listUses() throws IOException; public long save(Box box) throws IOException; public List<BoxableView> getBoxableViewsBySearch(String search); public BoxableView getBoxableView(BoxableId id) throws IOException; public void updateBoxableLocation(Boxable boxable) throws IOException; @Override public default void beforeDelete(Box object) throws IOException { object.removeAllBoxables(); }

Target:
public void discardAllContents(Box box) throws IOException; public void discardSingleItem(Box box, String position) throws IOException; public Box getByAlias(String alias) throws IOException; public Box getByBarcode(String barcode) throws IOException; public Map<String, Integer> getColumnSizes() throws IOException; public Collection<BoxableView> getViewsFromBarcodeList(Collection<String> barcodeList) throws IOException; public List<Box> getBySearch(String search); public Collection<BoxSize> listSizes() throws IOException; public Collection<BoxUse> listUses() throws IOException; public long save(Box box) throws IOException; public List<BoxableView> getBoxableViewsBySearch(String search); public BoxableView getBoxableView(BoxableId id) throws IOException; public void updateBoxableLocation(Boxable boxable) throws IOException; @Override public default void beforeDelete(Box object) throws IOException { object.removeAllBoxables(); save(object); }
Source:
public void convertProject(IProject project, String bsId, IProgressMonitor monitor) throws CoreException{ monitor.beginTask(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 3); try { if (ManagedBuilderCorePlugin.getDefault().isOldStyleMakeProject(project)) { ManagedBuilderCorePlugin.getDefault().convertOldStdMakeToNewStyle(project, monitor); } else { boolean wasCDTProject = AbstractPage.isCDTPrj(project); super.convertProject(project, bsId, new SubProgressMonitor(monitor, 1)); if (!wasCDTProject && isSetProjectType()) { h_selected.convertProject(project, monitor); } } } finally { monitor.done(); } }

Target:
public void convertProject(IProject project, String bsId, IProgressMonitor monitor) throws CoreException{ monitor.beginTask(MakeUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 3); try { boolean wasCDTProject = AbstractPage.isCDTPrj(project); super.convertProject(project, bsId, new SubProgressMonitor(monitor, 1)); if (!wasCDTProject && isSetProjectType()) { h_selected.convertProject(project, monitor); } } finally { monitor.done(); } }
Source:
public void parsesHttpBody() throws Exception { final String body = "40 N Wolfe Rd, Sunnyvale, CA 94085"; final String part = "t4"; final RqMultipart multi = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( "Content-Length: %s", body.getBytes().length ).asString(), new FormattedText( "Content-Disposition: form-data; name=\"%s\"", part ).asString() ), new RqWithHeaders( new RqFake("", "", ""), "Content-Length: 0", "Content-Disposition: form-data; name=\"data\"; filename=\"a.rar\"" ) ); try { MatcherAssert.assertThat( new RqHeaders.Base( multi.part(part).iterator().next() ).header("Content-Disposition"), Matchers.hasItem("form-data; name=\"t4\"") ); MatcherAssert.assertThat( new RqPrint( new RqHeaders.Base( multi.part(part).iterator().next() ) ).printBody(), Matchers.allOf( Matchers.startsWith("40 N"), Matchers.endsWith("CA 94085") ) ); } finally { multi.part(part).iterator().next().body().close(); } }

Target:
public void parsesHttpBody() throws Exception { final String body = "40 N Wolfe Rd, Sunnyvale, CA 94085"; final String part = "t4"; final RqMultipart multi = new RqMtFake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), new FormattedText( RqMtFakeTest.CONTENT_LENGTH, body.getBytes().length ).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, new FormattedText("name=\"%s\"", part).asString() ).asString() ), new RqWithHeaders( new RqFake("", "", ""), new FormattedText( RqMtFakeTest.CONTENT_LENGTH, 0 ).asString(), new FormattedText( RqMtFakeTest.CONTENT_DISP, "name=\"data\"; filename=\"a.rar\"" ).asString() ) ); try { MatcherAssert.assertThat( new RqHeaders.Base( multi.part(part).iterator().next() ).header("Content-Disposition"), Matchers.hasItem("form-data; name=\"t4\"") ); MatcherAssert.assertThat( new RqPrint( new RqHeaders.Base( multi.part(part).iterator().next() ) ).printBody(), Matchers.allOf( Matchers.startsWith("40 N"), Matchers.endsWith("CA 94085") ) ); } finally { multi.part(part).iterator().next().body().close(); } }
Source:
public void run(PublicApiConfig config, Environment environment) throws Exception { final Client client = new RestClientFactory(config.getRestClientConfig()).getInstance(); environment.getObjectMapper().configure(DeserializationFeature.ACCEPT_FLOAT_AS_INT, false); environment.healthChecks().register("ping", new Ping()); environment.setValidator(Validation.byDefaultProvider() .configure().constraintValidatorFactory(new ConfigurationAwareConstraintValidatorFactory(config)) .buildValidatorFactory() .getValidator()); environment.jersey().register(new PaymentsResource(client, config.getConnectorUrl())); environment.jersey().register(AuthFactory.binder(new OAuthFactory<>(new AccountAuthenticator(client, config.getPublicAuthUrl()), "", String.class))); }

Target:
public void run(PublicApiConfig config, Environment environment) throws Exception { final Client client = RestClientFactory.buildClient(config.getRestClientConfig()); environment.getObjectMapper().configure(DeserializationFeature.ACCEPT_FLOAT_AS_INT, false); environment.healthChecks().register("ping", new Ping()); environment.setValidator(Validation.byDefaultProvider() .configure().constraintValidatorFactory(new ConfigurationAwareConstraintValidatorFactory(config)) .buildValidatorFactory() .getValidator()); environment.jersey().register(new PaymentsResource(client, config.getConnectorUrl())); environment.jersey().register(AuthFactory.binder(new OAuthFactory<>(new AccountAuthenticator(client, config.getPublicAuthUrl()), "", String.class))); }
Source:
public AccountInfo getAccountInfo() throws IOException { CoingiBalances coingiBalances; try { coingiBalances = getCoingiBalance(); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } return CoingiAdapters.adaptAccountInfo( coingiBalances, exchange.getExchangeSpecification().getUserName()); }

Target:
public AccountInfo getAccountInfo() throws IOException { try { CoingiBalances coingiBalances = getCoingiBalance(); return CoingiAdapters.adaptAccountInfo( coingiBalances, exchange.getExchangeSpecification().getUserName()); } catch (CoingiException e) { throw CoingiErrorAdapter.adapt(e); } }
Source:
public void judgmentReindexingJob_ON_EMPTY() throws Exception { JobExecution jobExecution = jobLauncher.run(judgmentReindexingJob, createJobParameters()); solrJudgmentsServer.commit(); JobExecutionAssertUtils.assertJobExecution(jobExecution, 0, ALL_JUDGMENTS_COUNT); assertAllMarkedAsIndexed(); assertIndexCount(ALL_JUDGMENTS_COUNT); assertCcJudgment(fetchJudgmentDoc(ccJudgments.get(1).getId()), ccJudgments.get(1), 0L); assertScJudgment(fetchJudgmentDoc(scJudgments.get(0).getId()), scJudgments.get(0), 0L); assertCtJudgment(fetchJudgmentDoc(ctJudgments.get(3).getId()), ctJudgments.get(3), 0L); assertNacJudgment(fetchJudgmentDoc(nacJudgments.get(5).getId()), nacJudgments.get(5), 0L); }

Target:
public void judgmentReindexingJob_ON_EMPTY() throws Exception { JobExecution jobExecution = jobLauncher.run(judgmentReindexingJob, createJobParameters()); solrJudgmentsServer.commit(); JobExecutionAssertUtils.assertJobExecution(jobExecution, 0, ALL_JUDGMENTS_COUNT); assertAllMarkedAsIndexed(); assertIndexCount(ALL_JUDGMENTS_COUNT); assertCcJudgment(fetchJudgmentDoc(ccJudgments.get(1).getId()), ccJudgments.get(1), 2L); assertScJudgment(fetchJudgmentDoc(scJudgments.get(0).getId()), scJudgments.get(0), 1L); assertCtJudgment(fetchJudgmentDoc(ctJudgments.get(3).getId()), ctJudgments.get(3), 1L); assertNacJudgment(fetchJudgmentDoc(nacJudgments.get(5).getId()), nacJudgments.get(5), 0L); }
Source:
public MockSCMSource(String controllerId, String repository, List<SCMSourceTrait> traits) { super(); this.controllerId = controllerId; this.repository = repository; this.traits = new ArrayList<SCMSourceTrait>(traits); }

Target:
public MockSCMSource(String controllerId, String repository, List<SCMSourceTrait> traits) { this.controllerId = controllerId; this.repository = repository; this.traits = new ArrayList<SCMSourceTrait>(traits); }
Source:
public String toString() { return getForecast() != null ? getForecast().toString() : ""; }

Target:
public String toString() { return getForecast() != null ? getForecast().toString() : "FORECAST IS NULL"; }
Source:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.activity_settings); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); TextView title = (TextView) findViewById(R.id.toolbar_title); toolbar.setTitle(""); title.setText("SETTINGS"); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(R.layout.activity_settings); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); TextView title = (TextView) findViewById(R.id.toolbar_title); toolbar.setTitle(""); title.setText(R.string.settings); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
Source:
private String fetchCsvHeader(Configuration conf, String path) throws IOException { FileSystem fs = FileSystem.get(URI.create(path), conf); FSDataInputStream inputStream = fs.open(new Path(path)); String header = new BufferedReader(new InputStreamReader(inputStream)).readLine(); inputStream.close(); fs.close(); return header; }

Target:
private String fetchCsvHeader(Configuration conf, String path) throws IOException { FileSystem fs = FileSystem.get(URI.create(path), conf); try(FSDataInputStream inputStream = fs.open(new Path(path))) { try(BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { return reader.readLine(); } } }
Source:
public void testBigImage(){ final Img<ByteType> in = generateByteArrayTestImg(false, 6, 6); final Img<ByteType> out = generateByteArrayTestImg(false, 6, 6); Cursor<ByteType> cin = in.cursor(); final byte[] data = {7, 8, 9, 1, 2, 3, 7, 9, 8, 1, 3, 2, 8, 7, 9, 2, 1, 3, 8, 9, 7, 2, 3, 1, 9, 7, 8, 3, 1, 2, 9, 8, 7, 3, 2, 1}; for(byte b: data){ cin.next().set(b); } ops.run(DefaultBilateral.class, out, in, 15, 5, 2); final byte[] expected = {8, 7, 6, 4, 4, 2, 8, 7, 6, 4, 4, 2, 8, 7, 6, 4, 4, 2, 8, 7, 6, 4, 4, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2}; Cursor<ByteType> cout = out.cursor(); for(int i = 0; i < expected.length; i++){ assertEquals(cout.next().get(), expected[i]); } }

Target:
public void testBigImage() { final byte[] data = { 7, 8, 9, 1, 2, 3, 7, 9, 8, 1, 3, 2, 8, 7, 9, 2, 1, 3, 8, 9, 7, 2, 3, 1, 9, 7, 8, 3, 1, 2, 9, 8, 7, 3, 2, 1 }; final Img<ByteType> in = ArrayImgs.bytes(data, 6, 6); final Img<ByteType> out = generateByteArrayTestImg(false, 6, 6); ops.run(DefaultBilateral.class, out, in, 15, 5, 2); final byte[] expected = { 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2, 8, 7, 6, 4, 3, 2 }; Cursor<ByteType> cout = out.cursor(); for (int i = 0; i < expected.length; i++) { assertEquals(cout.next().get(), expected[i]); } }
Source:
public static RelDataType deriveRowType(RelDataTypeFactory typeFactory, final RelDataType inputRowType, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, final List<AggregateCall> aggCalls) { final IntList groupList = groupSet.toList(); assert groupList.size() == groupSet.cardinality(); final RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder(); final List<RelDataTypeField> fieldList = inputRowType.getFieldList(); final Set<String> containedNames = Sets.newHashSet(); for (int groupKey : groupList) { final RelDataTypeField field = fieldList.get(groupKey); containedNames.add(field.getName()); builder.add(field); } if (indicator) { for (int groupKey : groupList) { final RelDataType booleanType = typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BOOLEAN), false); String name = "i$" + fieldList.get(groupKey).getName(); int i = 0; while (containedNames.contains(name)) { name += "_" + i++; } containedNames.add(name); builder.add(name, booleanType); } } for (Ord<AggregateCall> aggCall : Ord.zip(aggCalls)) { String name; if (aggCall.e.name != null) { name = aggCall.e.name; } else { name = "$f" + (groupList.size() + aggCall.i); } int i = 0; while (containedNames.contains(name)) { name += "_" + i++; } containedNames.add(name); builder.add(name, aggCall.e.type); } return builder.build(); }

Target:
public static RelDataType deriveRowType(RelDataTypeFactory typeFactory, final RelDataType inputRowType, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, final List<AggregateCall> aggCalls) { final IntList groupList = groupSet.toList(); assert groupList.size() == groupSet.cardinality(); final RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder(); final List<RelDataTypeField> fieldList = inputRowType.getFieldList(); final Set<String> containedNames = Sets.newHashSet(); for (int groupKey : groupList) { final RelDataTypeField field = fieldList.get(groupKey); containedNames.add(field.getName()); builder.add(field); } if (indicator) { for (int groupKey : groupList) { final RelDataType booleanType = typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BOOLEAN), false); final String base = "i$" + fieldList.get(groupKey).getName(); String name = base; int i = 0; while (containedNames.contains(name)) { name = base + "_" + i++; } containedNames.add(name); builder.add(name, booleanType); } } for (Ord<AggregateCall> aggCall : Ord.zip(aggCalls)) { final String base; if (aggCall.e.name != null) { base = aggCall.e.name; } else { base = "$f" + (groupList.size() + aggCall.i); } String name = base; int i = 0; while (containedNames.contains(name)) { name = base + "_" + i++; } containedNames.add(name); builder.add(name, aggCall.e.type); } return builder.build(); }
Source:
protected PackagingOptions buildPackagingOptions() { boolean isMuleApplicationTemplate = Classifier.MULE_APPLICATION_TEMPLATE.equals(classifier); boolean isMuleApplicationExample = Classifier.MULE_APPLICATION_EXAMPLE.equals(classifier); boolean isMuleReusableApp = Classifier.MULE_PLUGIN.equals(classifier); return new PackagingOptions(isMuleApplicationTemplate || onlyMuleSources, isMuleReusableApp || lightweightPackage, isMuleApplicationExample || attachMuleSources, testJar); }

Target:
protected PackagingOptions buildPackagingOptions() { boolean isMuleApplicationTemplate = MULE_APPLICATION_TEMPLATE.equals(classifier); boolean isMuleApplicationExample = MULE_APPLICATION_EXAMPLE.equals(classifier); boolean isMuleReusableApp = MULE_PLUGIN.equals(classifier); return new PackagingOptions(isMuleApplicationTemplate || onlyMuleSources, isMuleReusableApp || lightweightPackage, isMuleApplicationExample || attachMuleSources, testJar); }
Source:
public List<T> executeAndCollect(String jobExecutionName, int limit) throws Exception { Preconditions.checkState(limit > 0, "Limit must be greater than 0"); ClientAndIterator<T> clientAndIterator = executeAndCollectWithClient(jobExecutionName); try { List<T> results = new ArrayList<>(limit); while (clientAndIterator.iterator.hasNext() && limit > 0) { results.add(clientAndIterator.iterator.next()); limit--; } return results; } finally { clientAndIterator.iterator.close(); clientAndIterator.client.cancel(); } }

Target:
public List<T> executeAndCollect(String jobExecutionName, int limit) throws Exception { Preconditions.checkState(limit > 0, "Limit must be greater than 0"); try (ClientAndIterator<T> clientAndIterator = executeAndCollectWithClient(jobExecutionName)){ List<T> results = new ArrayList<>(limit); while (clientAndIterator.iterator.hasNext() && limit > 0) { results.add(clientAndIterator.iterator.next()); limit--; } return results; } }
Source:
private HashSet<TopicPartition> getActivePartitions() throws InterruptedException, ExecutionException { Set<String> topics = spec.activeTopics().materialize().keySet(); Properties props = new Properties(); props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, this.spec.bootstrapServers()); WorkerUtils.addConfigsToProperties(props, this.spec.commonClientConf(), this.spec.commonClientConf()); HashSet<TopicPartition> active = new HashSet<>(); AdminClient client = AdminClient.create(props); Map<String, TopicDescription> topicDetails = client.describeTopics(spec.activeTopics().get().keySet()).all().get(); for (String topic : topics) { for (TopicPartitionInfo tpi : topicDetails.get(topic).partitions()) { active.add(new TopicPartition(topic, tpi.partition())); } } return active; }

Target:
private HashSet<TopicPartition> getActivePartitions() throws InterruptedException, ExecutionException { Set<String> topics = spec.activeTopics().materialize().keySet(); Properties props = new Properties(); props.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, this.spec.bootstrapServers()); WorkerUtils.addConfigsToProperties(props, this.spec.commonClientConf(), this.spec.commonClientConf()); HashSet<TopicPartition> active = new HashSet<>(); Admin client = Admin.create(props); Map<String, TopicDescription> topicDetails = client.describeTopics(spec.activeTopics().get().keySet()).all().get(); for (String topic : topics) { for (TopicPartitionInfo tpi : topicDetails.get(topic).partitions()) { active.add(new TopicPartition(topic, tpi.partition())); } } client.close(); return active; }
Source:
private void setThreadCount(int threadCount) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { setMaximumPoolSize(threadCount); setCorePoolSize(threadCount); } else { setCorePoolSize(threadCount); setMaximumPoolSize(threadCount); } }

Target:
private void setThreadCount(int threadCount) { if (Build.VERSION.SDK_INT > 23) { setMaximumPoolSize(threadCount); setCorePoolSize(threadCount); } else { setCorePoolSize(threadCount); setMaximumPoolSize(threadCount); } }
Source:
private AtomicReference<CpuClock> setupCpuClockAtomicReference() { AtomicReference<CpuClock> cpuClock = new AtomicReference<>( CpuClock.NOT_AVAILABLE ); if ( config.get( GraphDatabaseSettings.track_query_cpu_time ) ) { cpuClock.set( CpuClock.CPU_CLOCK ); } BiConsumer<Boolean,Boolean> cpuClockUpdater = ( before, after ) -> { if ( after ) { cpuClock.set( CpuClock.CPU_CLOCK ); } else { cpuClock.set( CpuClock.NOT_AVAILABLE ); } }; config.registerDynamicUpdateListener( GraphDatabaseSettings.track_query_cpu_time, cpuClockUpdater ); return cpuClock; }

Target:
private AtomicReference<CpuClock> setupCpuClockAtomicReference() { AtomicReference<CpuClock> cpuClock = new AtomicReference<>( CpuClock.NOT_AVAILABLE ); BiConsumer<Boolean,Boolean> cpuClockUpdater = ( before, after ) -> { if ( after ) { cpuClock.set( CpuClock.CPU_CLOCK ); } else { cpuClock.set( CpuClock.NOT_AVAILABLE ); } }; cpuClockUpdater.accept( null, config.get( GraphDatabaseSettings.track_query_cpu_time ) ); config.registerDynamicUpdateListener( GraphDatabaseSettings.track_query_cpu_time, cpuClockUpdater ); return cpuClock; }
Source:
public MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure) throws InvalidEndpointException, InvalidPortException { if (endpoint == null) { throw new InvalidEndpointException("(null)", "null endpoint"); } if (!this.isValidEndpoint(endpoint)) { throw new InvalidEndpointException(endpoint, "invalid host"); } if (endpoint.endsWith(".amazonaws.com") && !endpoint.equals("s3.amazonaws.com")) { throw new InvalidEndpointException(endpoint, "for amazon S3, host should be 's3.amazonaws.com'"); } if (port < 0 || port > 65535) { throw new InvalidPortException(port, "port must be in range of 1 to 65535"); } Scheme scheme = Scheme.HTTP; if (secure) { scheme = Scheme.HTTPS; } if (port == 0) { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .build(); } else { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .port(port) .build(); } this.accessKey = accessKey; this.secretKey = secretKey; }

Target:
public MinioClient(String endpoint, int port, String accessKey, String secretKey, boolean secure) throws InvalidEndpointException, InvalidPortException { if (endpoint == null) { throw new InvalidEndpointException("(null)", "null endpoint"); } HttpUrl url = HttpUrl.parse(endpoint); if (url != null) { if (!"/".equals(url.encodedPath())) { throw new InvalidEndpointException(endpoint, "no path allowed in endpoint"); } if(secure && !url.isHttps()){ throw new InvalidEndpointException(endpoint, "endpoint is not https, but a secured connection is required"); } String amzHost = url.host(); if (amzHost.endsWith(".amazonaws.com") && !amzHost.equals("s3.amazonaws.com")) { throw new InvalidEndpointException(endpoint, "for Amazon S3, host should be 's3.amazonaws.com' in endpoint"); } this.baseUrl = url; this.accessKey = accessKey; this.secretKey = secretKey; if (port == 0 || url.port() == port){ return; } } if (!this.isValidEndpoint(endpoint)) { throw new InvalidEndpointException(endpoint, "invalid host"); } if (endpoint.endsWith(".amazonaws.com") && !endpoint.equals("s3.amazonaws.com")) { throw new InvalidEndpointException(endpoint, "for amazon S3, host should be 's3.amazonaws.com'"); } if (port < 0 || port > 65535) { throw new InvalidPortException(port, "port must be in range of 1 to 65535"); } Scheme scheme = Scheme.HTTP; if (secure) { scheme = Scheme.HTTPS; } if (port == 0) { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .build(); } else { this.baseUrl = new HttpUrl.Builder() .scheme(scheme.toString()) .host(endpoint) .port(port) .build(); } this.accessKey = accessKey; this.secretKey = secretKey; }
Source:
private void createToolbarMenu(final MToolBar toolbarModel, Control renderedCtrl) { toolbarMenu = new Menu(renderedCtrl); MenuItem hideItem = new MenuItem(toolbarMenu, SWT.NONE); hideItem.setText(Messages.ToolBarManagerRenderer_MenuCloseText); hideItem.addListener(SWT.Selection, new Listener() { public void handleEvent(org.eclipse.swt.widgets.Event event) { toolbarModel.getTags().add(IPresentationEngine.HIDDEN_BY_USER); } }); new MenuItem(toolbarMenu, SWT.SEPARATOR); MenuItem restoreHiddenItems = new MenuItem(toolbarMenu, SWT.NONE); restoreHiddenItems.setText(Messages.ToolBarManagerRenderer_MenuRestoreText); restoreHiddenItems.addListener(SWT.Selection, new Listener() { public void handleEvent(org.eclipse.swt.widgets.Event event) { removeHiddenByUserTags(); } }); renderedCtrl.setMenu(toolbarMenu); }

Target:
private void createToolbarMenu(final MToolBar toolbarModel, Control renderedCtrl) { toolbarMenu = new Menu(renderedCtrl); MenuItem hideItem = new MenuItem(toolbarMenu, SWT.NONE); hideItem.setText(Messages.ToolBarManagerRenderer_MenuCloseText); hideItem.addListener(SWT.Selection, new Listener() { public void handleEvent(org.eclipse.swt.widgets.Event event) { toolbarModel.getTags().add(HIDDEN_BY_USER); } }); new MenuItem(toolbarMenu, SWT.SEPARATOR); MenuItem restoreHiddenItems = new MenuItem(toolbarMenu, SWT.NONE); restoreHiddenItems.setText(Messages.ToolBarManagerRenderer_MenuRestoreText); restoreHiddenItems.addListener(SWT.Selection, new Listener() { public void handleEvent(org.eclipse.swt.widgets.Event event) { removeHiddenByUserTags(); } }); renderedCtrl.setMenu(toolbarMenu); }
Source:
protected abstract void bankTransferTest() throws AssertionError, Exception; @Test public void runWithRetries() throws Exception { int maxRetries = 3; for (int i = 0; i < maxRetries; i++) { try { this.bankTransferTest(); break; } catch (AssertionError e) { if (i == maxRetries-1) { throw e; } Thread.sleep(1000); continue; } } }

Target:
protected abstract void bankTransferTest() throws AssertionError, Exception; @Test public void runWithRetries() throws Exception { int maxRetries = 3; for (int i = 0; i < maxRetries; i++) { try { this.bankTransferTest(); break; } catch (AssertionError e) { if (i == maxRetries-1) { throw e; } Thread.sleep(1000); } } }
Source:
public ApiFuture<Backup> createBackupAsync(CreateBackupRequest request) { return ApiFutureUtil.transformAndAdapt( delegate.createBackupAsync( request.toProto(instanceName.getProjectId(), instanceName.getInstanceId())), new Function<Operation, Backup>() { @Override public Backup apply(Operation operation) { try { return Backup.fromProto( operation.getResponse().unpack(com.google.bigtable.admin.v2.Backup.class)); } catch (InvalidProtocolBufferException e) { return Backup.fromProto(com.google.bigtable.admin.v2.Backup.getDefaultInstance()); } } }); }

Target:
public ApiFuture<Backup> createBackupAsync(CreateBackupRequest request) { ListenableFuture<Operation> backupAsync = delegate.createBackupAsync( request.toProto(instanceName.getProjectId(), instanceName.getInstanceId())); Function<Operation, Backup> function = new Function<Operation, Backup>() { @Override public Backup apply(final Operation operation) { try { Future<Operation> operationFuture = batchThreadPool.submit( new Callable<Operation>() { @Override public Operation call() throws Exception { return delegate.waitForOperation(operation); } }); return Backup.fromProto( operationFuture .get() .getResponse() .unpack(com.google.bigtable.admin.v2.Backup.class)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException("Interrupted while waiting for operation to finish"); } catch (ExecutionException | InvalidProtocolBufferException e) { throw new IllegalStateException(e); } } }; return ApiFutureUtil.transformAndAdapt(backupAsync, function); }
Source:
protected Collection<String> lookupCommitSha1s( @SuppressWarnings("rawtypes") Run run, FilePath workspace, TaskListener listener) { if (commitSha1 != null && commitSha1.trim().length() > 0) { PrintStream logger = listener.getLogger(); try { if (run instanceof AbstractBuild) { return Arrays.asList(TokenMacro.expandAll((AbstractBuild) run, listener, commitSha1)); } else { return Arrays.asList(TokenMacro.expandAll(run, workspace, listener, commitSha1)); } } catch (IOException | InterruptedException | MacroEvaluationException e) { logger.println("Unable to expand commit SHA value"); e.printStackTrace(logger); return Arrays.asList(); } } Collection<String> sha1s = new HashSet<>(); for (BuildData buildData : run.getActions(BuildData.class)) { Revision lastBuiltRevision = buildData.getLastBuiltRevision(); if (lastBuiltRevision == null) { continue; } String lastBuiltSha1 = lastBuiltRevision.getSha1String(); if (!lastBuiltSha1.isEmpty()) { sha1s.add(lastBuiltSha1); } String markedSha1 = buildData.lastBuild.getMarked().getSha1String(); if (!markedSha1.isEmpty()) { sha1s.add(markedSha1); } } return sha1s; }

Target:
protected Collection<String> lookupCommitSha1s( @SuppressWarnings("rawtypes") Run run, FilePath workspace, TaskListener listener) { if (commitSha1 != null && commitSha1.trim().length() > 0) { PrintStream logger = listener.getLogger(); try { if (run instanceof AbstractBuild) { return Collections.singletonList(TokenMacro.expandAll((AbstractBuild) run, listener, commitSha1)); } else { return Collections.singletonList(TokenMacro.expandAll(run, workspace, listener, commitSha1)); } } catch (IOException | InterruptedException | MacroEvaluationException e) { logger.println("Unable to expand commit SHA value"); e.printStackTrace(logger); return Collections.emptyList(); } } Collection<String> sha1s = new HashSet<>(); for (BuildData buildData : run.getActions(BuildData.class)) { Revision lastBuiltRevision = buildData.getLastBuiltRevision(); if (lastBuiltRevision == null) { continue; } String lastBuiltSha1 = lastBuiltRevision.getSha1String(); if (!lastBuiltSha1.isEmpty()) { sha1s.add(lastBuiltSha1); } String markedSha1 = buildData.lastBuild.getMarked().getSha1String(); if (!markedSha1.isEmpty()) { sha1s.add(markedSha1); } } return sha1s; }
Source:
void poll(RequestRegistrationCallback<GetOperation> requestRegistrationCallback) { if (!maybeProcessDecryptCallbackAndCompleteOperation()) { cleanupExpiredInFlightRequests(); checkAndMaybeComplete(); if (!isComplete() && !onDecryptMode()) { fetchRequests(requestRegistrationCallback); } } }

Target:
void poll(RequestRegistrationCallback<GetOperation> requestRegistrationCallback) { cleanupExpiredInFlightRequests(); maybeProcessCallbacks(); checkAndMaybeComplete(); if (!isComplete()) { fetchRequests(requestRegistrationCallback); } }
Source:
public void gcDeletedSnapshot(String snapshotRoot, String snapshotName) throws IOException { final String operationName = "gcDeletedSnapshot"; String rootPath = null; final INode.BlocksMapUpdateInfo blocksToBeDeleted; checkOperation(OperationCategory.WRITE); writeLock(); try { checkOperation(OperationCategory.WRITE); rootPath = Snapshot.getSnapshotPath(snapshotRoot, snapshotName); checkNameNodeSafeMode("Cannot gcDeletedSnapshot for " + rootPath); final long now = Time.now(); final INodesInPath iip = dir.resolvePath(null, snapshotRoot, DirOp.WRITE); blocksToBeDeleted = FSDirSnapshotOp.deleteSnapshot( dir, snapshotManager, iip, snapshotName, now); } finally { writeUnlock(operationName, getLockReportInfoSupplier(rootPath)); } removeBlocks(blocksToBeDeleted); }

Target:
public void gcDeletedSnapshot(String snapshotRoot, String snapshotName) throws IOException { final String operationName = "gcDeletedSnapshot"; String rootPath = null; final INode.BlocksMapUpdateInfo blocksToBeDeleted; checkOperation(OperationCategory.WRITE); writeLock(); try { checkOperation(OperationCategory.WRITE); rootPath = Snapshot.getSnapshotPath(snapshotRoot, snapshotName); checkNameNodeSafeMode("Cannot gcDeletedSnapshot for " + rootPath); final long now = Time.now(); final INodesInPath iip = dir.resolvePath(null, snapshotRoot, DirOp.WRITE); snapshotManager.assertMarkedAsDeleted(iip, snapshotName); blocksToBeDeleted = FSDirSnapshotOp.deleteSnapshot( dir, snapshotManager, iip, snapshotName, now); } finally { writeUnlock(operationName, getLockReportInfoSupplier(rootPath)); } removeBlocks(blocksToBeDeleted); }
Source:
public String getEventString(int index) { if (fData != null) { processData(); } return fColumnData[index].getValue().toString(); }

Target:
public String getEventString(int index) { if (fData != null) { processData(); } if (index < 0 || index >= fColumnData.length) { return ""; } return fColumnData[index].getValue().toString(); }
Source:
public OverthereProcess startProcess(CmdLine cmd) { checkNotNull(cmd, "Cannot execute null command line"); checkArgument(cmd.getArguments().size() > 0, "Cannot execute empty command line"); final String obfuscatedCmd = cmd.toCommandLine(os, true); logger.info("Starting command on [{}]", obfuscatedCmd, this); File wd = null; if (workingDirectory != null) { wd = ((LocalFile) workingDirectory).getFile(); } try { logger.debug("Creating " + os + " process with command line [{}]", obfuscatedCmd); String[] args = cmd.toCommandArray(os, false); if (isWindows(os)) args = getArgsWithWindowsCmd(args); final ProcessBuilder pb = new ProcessBuilder(args); if (wd != null) { logger.debug("Setting working directory to [{}]", wd); pb.directory(wd); } else { logger.debug("Not setting working directory"); } logger.debug("Starting process"); final Process p = pb.start(); return new LocalProcess(p); } catch (IOException exc) { throw new RuntimeIOException(format("Cannot start command [%s] on [%s]", obfuscatedCmd, this), exc); } }

Target:
public OverthereProcess startProcess(CmdLine cmd) { checkNotNull(cmd, "Cannot execute null command line"); checkArgument(cmd.getArguments().size() > 0, "Cannot execute empty command line"); final String obfuscatedCmd = cmd.toCommandLine(os, true); logger.info("Starting command on [{}]", obfuscatedCmd, this); File wd = null; if (workingDirectory != null) { wd = ((LocalFile) workingDirectory).getFile(); } try { logger.debug("Creating " + os + " process with command line [{}]", obfuscatedCmd); CmdLine command = isWindows(os) ? getCmdForWindows(cmd) : cmd; final ProcessBuilder pb = new ProcessBuilder(command.toCommandArray(os, false)); if (wd != null) { logger.debug("Setting working directory to [{}]", wd); pb.directory(wd); } else { logger.debug("Not setting working directory"); } logger.debug("Starting process"); final Process p = pb.start(); return new LocalProcess(p); } catch (IOException exc) { throw new RuntimeIOException(format("Cannot start command [%s] on [%s]", obfuscatedCmd, this), exc); } }
Source:
public void switchToCameraWithFlash() { if (hasCurrentCameraFlash()) { return; } if (frontCameraInformation.flashAvailable) { updateCamera(frontCameraInformation); } else if (backCameraInformation.flashAvailable) { updateCamera(backCameraInformation); } }

Target:
public void switchToCameraWithFlash() { if (hasCurrentCameraFlash()) { return; } if (hasFrontCameraFlash()) { updateCamera(frontCameraInformation); } else if (hasBackCameraFlash()) { updateCamera(backCameraInformation); } }
Source:
shutdown_test() throws Exception { final int port = 17256; final DummyStatsDServer server = new DummyStatsDServer(port); final AtomicBoolean slow = new AtomicBoolean(true); final NonBlockingStatsDClient client = new NonBlockingStatsDClient("my.prefix.shutdownTest", "localhost", port) { @Override protected StatsDSender createSender(final Callable<SocketAddress> addressLookup, final int queueSize, final StatsDClientErrorHandler handler, final DatagramChannel clientChannel) { return new SlowStatsDSender(addressLookup, new SlowBlockingQueue(slow), handler, clientChannel, slow); } }; try { for (int i = 0; i < 1000; i++) { client.count("mycounter", 5); } client.stop(); assertEquals(1000, server.messagesReceived().size()); } finally { client.stop(); server.close(); } }

Target:
public void shutdown_test() throws Exception { final int port = 17256; final DummyStatsDServer server = new DummyStatsDServer(port); final CountDownLatch lock = new CountDownLatch(1); final NonBlockingStatsDClient client = new NonBlockingStatsDClient("my.prefix.shutdownTest", "localhost", port) { @Override protected StatsDSender createSender(final Callable<SocketAddress> addressLookup, final int queueSize, final StatsDClientErrorHandler handler, final DatagramChannel clientChannel) { return new SlowStatsDSender(addressLookup, new SlowBlockingQueue(lock), handler, clientChannel, lock); } }; try { client.count("mycounter", 5); assertEquals(0, server.messagesReceived().size()); client.stop(); assertEquals(1, server.messagesReceived().size()); } finally { client.stop(); server.close(); } }
Source:
public boolean getIsPassive() { return this.isPassive; }

Target:
public Boolean getIsPassive() { return this.isPassive; }
Source:
public static SchedulingPolicyUnit map(PolicyUnit entity, SchedulingPolicyUnit template) { SchedulingPolicyUnit model = template != null ? template : new SchedulingPolicyUnit(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); String policyUnitTypeName = null; switch (entity.getPolicyUnitType()) { case FILTER: policyUnitTypeName = org.ovirt.engine.api.model.PolicyUnitType.FILTER.name().toLowerCase(); break; case WEIGHT: policyUnitTypeName = org.ovirt.engine.api.model.PolicyUnitType.WEIGHT.name().toLowerCase(); break; case LOAD_BALANCING: policyUnitTypeName = org.ovirt.engine.api.model.PolicyUnitType.LOAD_BALANCING.name().toLowerCase(); break; default: assert (false) : "unknown Policy Unit Type value: " + model.toString(); return null; } model.setType(policyUnitTypeName); model.setEnabled(entity.isEnabled()); model.setInternal(entity.isInternal()); if (entity.getParameterRegExMap() != null && !entity.getParameterRegExMap().isEmpty()) { model.setPropertiesMetaData(CustomPropertiesParser.fromMap(entity.getParameterRegExMap())); } return model; }

Target:
public static SchedulingPolicyUnit map(PolicyUnit entity, SchedulingPolicyUnit template) { SchedulingPolicyUnit model = template != null ? template : new SchedulingPolicyUnit(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setDescription(entity.getDescription()); model.setType(map(entity.getPolicyUnitType(), null).name().toLowerCase()); model.setEnabled(entity.isEnabled()); model.setInternal(entity.isInternal()); if (entity.getParameterRegExMap() != null && !entity.getParameterRegExMap().isEmpty()) { model.setPropertiesMetaData(CustomPropertiesParser.fromMap(entity.getParameterRegExMap())); } return model; }
Source:
protected String fixEntryName(String entryName){ if(entryName.indexOf('\\') > 0) { return entryName.replaceAll("\\\\", CompressedHelper.SEPARATOR); } if(entryName.indexOf(CompressedHelper.SEPARATOR_CHAR) == 0) { return entryName.substring(entryName.lastIndexOf(CompressedHelper.SEPARATOR_CHAR)+1); } else { return entryName; } }

Target:
protected String fixEntryName(String entryName){ if(entryName.indexOf('\\') >= 0) { return fixEntryName(entryName.replaceAll("\\\\", SEPARATOR)); } else if(entryName.indexOf(SEPARATOR_CHAR) == 0) { return entryName.replaceAll("^/+", ""); } else { return entryName; } }
Source:
public void close_stops_started_components() { final DefaultStartable defaultStartable = new DefaultStartable(); final EagerStartable eagerStartable = new EagerStartable(); TaskContainerImpl ceContainer = new TaskContainerImpl(parent, new ContainerPopulator<TaskContainer>() { @Override public void populateContainer(TaskContainer container) { container.add(defaultStartable); container.add(eagerStartable); } }); ceContainer.bootup(); ceContainer.close(); assertThat(defaultStartable.startCalls).isEqualTo(0); assertThat(defaultStartable.stopCalls).isEqualTo(0); assertThat(eagerStartable.startCalls).isEqualTo(1); assertThat(eagerStartable.stopCalls).isEqualTo(1); }

Target:
public void close_stops_started_components() { final DefaultStartable defaultStartable = new DefaultStartable(); final EagerStartable eagerStartable = new EagerStartable(); TaskContainerImpl ceContainer = new TaskContainerImpl(parent, container -> { container.add(defaultStartable); container.add(eagerStartable); }); ceContainer.bootup(); ceContainer.close(); assertThat(defaultStartable.startCalls).isEqualTo(0); assertThat(defaultStartable.stopCalls).isEqualTo(0); assertThat(eagerStartable.startCalls).isEqualTo(1); assertThat(eagerStartable.stopCalls).isEqualTo(1); }
Source:
public void test() throws IOException, InterruptedException { final String version = "3.12-SNAPSHOT"; assertThat(trimSnapshot(jenkins.getPlugin("remoting").getVersion()), is(version)); File jar = tmp.newFile(); FileUtils.copyURLToFile(jenkins.url("jnlpJars/slave.jar"),jar); try (JarFile j = new JarFile(jar)) { Attributes main = j.getManifest().getMainAttributes(); assertThat(main.getValue("Version"),is(version)); } }

Target:
public void test() throws IOException, InterruptedException { final String version = ucmp.get(jenkins).plugins.get("remoting").getVersion(); assertThat(trimSnapshot(jenkins.getPlugin("remoting").getVersion()), is(version)); File jar = tmp.newFile(); FileUtils.copyURLToFile(jenkins.url("jnlpJars/slave.jar"),jar); try (JarFile j = new JarFile(jar)) { Attributes main = j.getManifest().getMainAttributes(); assertThat(main.getValue("Version"),is(version)); } }
Source:
public QueryList findQueryList(Object id) { AccessPointEntity apEntity = datastore.findOne(AccessPointEntity.class, Filter.where("_id").is(id)); if (apEntity == null) { throw new NotFoundException("Unsuccessful retrieving of query list due to missing AP"); } Object operatorId = apEntity.operatorId; OperatorEntity operatorEntity = datastore.findOne(OperatorEntity.class, Filter.where("_id").is(operatorId)); if (operatorEntity == null) { throw new NotFoundException("Unsuccessful retrieving of query list due to missing operator"); } IpType ipType = IpType.valueOf(operatorEntity.ipAddressType); Optional<Integer> response = catalog.get(ipType); List<Integer> values = Lists.newArrayList(response.get()); return new QueryList(values); }

Target:
public QueryList findQueryList(Object id) { AccessPointEntity apEntity = datastore.findById(AccessPointEntity.class, id); if (apEntity == null) { throw new NotFoundException("Unsuccessful retrieving of query list due to missing AP"); } OperatorEntity operatorEntity = datastore.findById(OperatorEntity.class, apEntity.operatorId); if (operatorEntity == null) { throw new NotFoundException("Unsuccessful retrieving of query list due to missing operator"); } Optional<Integer> response = catalog.findId(operatorEntity.ipType); return new QueryList(response.get()); }
Source:
protected Boolean loadIfNeeded(InvocationContext ctx, Object key, boolean isRetrieval, FlagAffectedCommand cmd) throws Throwable { try { cdl.lock(key); InternalCacheEntry ice = dataContainer.get(key); if (ice != null) { if (cmd instanceof ApplyDeltaCommand) { ctx.putLookedUpEntry(key, ice); entryFactory.wrapEntryForDelta(ctx, key, ((ApplyDeltaCommand) cmd).getDelta()); } else { entryFactory.wrapEntryForPut(ctx, key, ice, false, cmd, false); } return null; } Boolean loaded = super.loadIfNeeded(ctx, key, isRetrieval, cmd); if (loaded == Boolean.TRUE) { if (enabled && isManualEviction) { CacheEntry e = ctx.lookupEntry(key); if (e != null && e.isLoaded()) { cdl.commitEntry(e, null, cmd, ctx); removeFromStoreIfNeeded(key); } } } return loaded; } finally { cdl.unlock(key); } }

Target:
protected Boolean loadIfNeeded(InvocationContext ctx, Object key, boolean isRetrieval, FlagAffectedCommand cmd) throws Throwable { CacheEntry entry = ctx.lookupEntry(key); if (entry != null && !entry.isNull() && entry.getValue() != null) { return null; } try { while (!cdl.lock(key, false)); InternalCacheEntry ice = dataContainer.get(key); if (ice != null) { if (cmd instanceof ApplyDeltaCommand) { ctx.putLookedUpEntry(key, ice); entryFactory.wrapEntryForDelta(ctx, key, ((ApplyDeltaCommand) cmd).getDelta()); } else { entryFactory.wrapEntryForPut(ctx, key, ice, false, cmd, false); } return null; } Boolean loaded = super.loadIfNeeded(ctx, key, isRetrieval, cmd); if (loaded == Boolean.TRUE) { if (enabled && isManualEviction) { CacheEntry e = ctx.lookupEntry(key); if (e != null && e.isLoaded()) { cdl.commitEntry(e, null, cmd, ctx); removeFromStoreIfNeeded(key); } } } return loaded; } finally { cdl.unlock(key); } }
Source:
private static String toString(Object obj) { if (obj instanceof Class) { return getCanonicalName((Class<?>) obj); } else if (obj instanceof Object[]) { return Arrays.toString((Object[]) obj); } else { return String.valueOf(obj); } }

Target:
private static String toString(Object obj) { if (obj instanceof Class) { return getCanonicalName((Class<?>) obj); } return StringUtils.nullSafeToString(obj); }
Source:
private boolean tryFetchNext() { while ( recordBuffer.isEmpty() ) { if ( done ) { connectionHandler.resultBuffered(); return false; } connection.receiveOne(); } return true; }

Target:
private boolean tryFetchNext() { while ( recordBuffer.isEmpty() ) { if ( done ) { return false; } receiveOne(); } return true; }
Source:
protected void emitAnchorHref(String href) { if (convertMarkupPageLinks && href.indexOf('.') == -1 && !ABSOLUTE_URL_PATTERN.matcher(href).matches()) { int split = href.indexOf('#'); if (split > 0) { href = href.substring(0, split) + ".html" + href.substring(split); } else if (split == -1) { href += ".html"; } } writer.writeAttribute("href", makeUrlAbsolute(href)); }

Target:
protected void emitAnchorHref(String href) { String[] names = href.split("/"); String name = names[names.length - 1]; if (convertMarkupPageLinks && name.indexOf('.') == -1 && !ABSOLUTE_URL_PATTERN.matcher(href).matches()) { int split = href.indexOf('#'); if (split > 0) { href = getHtmlFilenameFormat().replace("$1", href.substring(0, split)) + href.substring(split); } else if (split == -1) { href = getHtmlFilenameFormat().replace("$1", href); } } writer.writeAttribute("href", makeUrlAbsolute(href)); }
Source:
public void testStreamingAppend() throws Exception { testStreamingWrite(false, false, false, (p) -> { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(1); StreamTableEnvironment tEnv = HiveTestUtils.createTableEnvWithBlinkPlannerStreamMode(env); tEnv.registerCatalog(hiveCatalog.getName(), hiveCatalog); tEnv.useCatalog(hiveCatalog.getName()); try { tEnv.executeSql( "insert into db1.sink_table select 6,'a','b','2020-05-03','12'") .await(); } catch (Exception e) { throw new TableException("Failed to execute sql", e); } assertBatch("db1.sink_table", Arrays.asList( "1,a,b,2020-05-03,7", "1,a,b,2020-05-03,7", "2,p,q,2020-05-03,8", "2,p,q,2020-05-03,8", "3,x,y,2020-05-03,9", "3,x,y,2020-05-03,9", "4,x,y,2020-05-03,10", "4,x,y,2020-05-03,10", "5,x,y,2020-05-03,11", "5,x,y,2020-05-03,11", "6,a,b,2020-05-03,12")); }); }

Target:
public void testStreamingAppend() throws Exception { testStreamingWrite(false, false, "parquet", (p) -> { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(1); StreamTableEnvironment tEnv = HiveTestUtils.createTableEnvWithBlinkPlannerStreamMode(env); tEnv.registerCatalog(hiveCatalog.getName(), hiveCatalog); tEnv.useCatalog(hiveCatalog.getName()); try { tEnv.executeSql( "insert into db1.sink_table select 6,'a','b','2020-05-03','12'") .await(); } catch (Exception e) { Assert.fail("Failed to execute sql: " + e.getMessage()); } assertBatch("db1.sink_table", Arrays.asList( "1,a,b,2020-05-03,7", "1,a,b,2020-05-03,7", "2,p,q,2020-05-03,8", "2,p,q,2020-05-03,8", "3,x,y,2020-05-03,9", "3,x,y,2020-05-03,9", "4,x,y,2020-05-03,10", "4,x,y,2020-05-03,10", "5,x,y,2020-05-03,11", "5,x,y,2020-05-03,11", "6,a,b,2020-05-03,12")); }); }