auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void afterNamesPerGroupChanged() { String namesNumber = namesPerGroup.getText().toString().trim(); if (namesPerGroup.isFocused() && isValid(namesNumber)) { numGroups.setText(getOffset(namesNumber)); } dialog.getActionButton(DialogAction.POSITIVE).setEnabled(isValid(namesNumber)); }

Target:
void afterNamesPerGroupChanged() { String namesPerGroupInput = namesPerGroup.getText().toString().trim(); if (namesPerGroup.isFocused() && isValid(namesNumber)) { numGroups.setText(getOffset(namesNumber)); } dialog.getActionButton(DialogAction.POSITIVE).setEnabled(isValid(namesNumber)); }
Source:
protected final void registerAsSlingFilter(ComponentContext ctx, int ranking, String pattern) { Dictionary<String, String> filterProps = new Hashtable<String, String>(); filterProps.put("service.ranking", String.valueOf(ranking)); filterProps.put("sling.filter.scope", "REQUEST"); filterRegistration = ctx.getBundleContext().registerService(Filter.class.getName(), this, filterProps); }

Target:
protected final void registerAsSlingFilter(ComponentContext ctx, int ranking, String pattern) { Dictionary<String, String> filterProps = new Hashtable<String, String>(); filterProps.put("service.ranking", String.valueOf(ranking)); filterProps.put("sling.filter.scope", "REQUEST"); filterProps.put("sling.filter.pattern", StringUtils.defaultIfEmpty(pattern, ".*")); filterRegistration = ctx.getBundleContext().registerService(Filter.class.getName(), this, filterProps); }
Source:
private static URL deploymentStaticOne() throws Throwable { System.out.println("deploymentStatic"); return new URL("<LINK_0>"); }

Target:
private static URL deploymentStaticOne() throws Throwable { return new URL("<LINK_0>"); }
Source:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; if (firstParent && i > 0) { continue; } pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if (firstParent && i > 0) { continue; } if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }
Source:
public List<ExperimentSpotDesign> list() { List expmts = this.getHibernateTemplate().find("from ExperimentSpotDesign as spotDesign order by readSpec.experimentSpotDesignId asc" ); return expmts; }

Target:
public List<ExperimentSpotDesign> list() { List expmts = this.getHibernateTemplate().find("from ExperimentSpotDesign as spotDesign" ); return expmts; }
Source:
public Config<T> withRecordClass(Class<T> klass) { return new Config<T>(Objects.requireNonNull(klass, "recordClass"), this.filterPredicate, this.deprecatedProjectionString, this.strictProjectionString); }

Target:
public Config<T> withRecordClass(Class<T> klass) { return new Config<T>( Objects.requireNonNull(klass, "recordClass cannot be null"), this.filterPredicate, this.deprecatedProjectionString, this.strictProjectionString); }
Source:
public void validateJob(InputStream jobInputStream) throws JobValidationException { try { byte[] bytes = ValidationUtil.getInputStreamBytes(jobInputStream); String findSchemaByNamespaceUsed = findSchemaByNamespaceUsed(new ByteArrayInputStream(bytes)); InputStream schemaStream = this.getClass().getResourceAsStream(findSchemaByNamespaceUsed); ValidationUtil.validate(new ByteArrayInputStream(bytes), schemaStream); } catch (Exception e) { throw new JobValidationException(true, e); } }

Target:
public void validateJob(InputStream jobInputStream) throws JobValidationException { try { byte[] bytes = ValidationUtil.getInputStreamBytes(jobInputStream); try (ByteArrayInputStream jobInputStreamForSchema = new ByteArrayInputStream(bytes)) { String findSchemaByNamespaceUsed = findSchemaByNamespaceUsed(jobInputStreamForSchema); InputStream schemaStream = this.getClass().getResourceAsStream(findSchemaByNamespaceUsed); try (ByteArrayInputStream jobInputStreamForValidation = new ByteArrayInputStream(bytes)) { ValidationUtil.validate(jobInputStreamForValidation, schemaStream); } } } catch (Exception e) { throw new JobValidationException(true, e); } }
Source:
public CompletionStage<MarshallableEntry> loadFromAllStores(Object key, boolean localInvocation, boolean includeStores) { assert !Thread.currentThread().getName().startsWith("persistence") : "Thread name is: " + Thread.currentThread().getName(); int traceId = getNextTraceNumber("Loading from first store for id %d"); return continueOnCPUExecutor(CompletableFuture.supplyAsync(() -> loadFromAllStoresSync(key, localInvocation, includeStores, traceId), persistenceExecutor), traceId); }

Target:
public <K, V> CompletionStage<MarshallableEntry<K, V>> loadFromAllStores(Object key, boolean localInvocation, boolean includeStores) { assert !Thread.currentThread().getName().startsWith("persistence") : "Thread name is: " + Thread.currentThread().getName(); return supplyOnPersistenceExAndContinue(traceId -> loadFromAllStoresSync(key, localInvocation, includeStores, traceId), "Loading from first store for id %d"); }
Source:
private static String getLogType(String logs) { String[] logsArray = logs.split("~"); String types = ""; for (int i = 0; i < logsArray.length; i++) { types += logsArray[i].substring(0, logsArray[i].indexOf(':')); } if (types.contains(ERROR)) { return ERROR; } else if (types.contains(EVENT)) { return EVENT; } else if (types.contains(MESSAGE)) { return MESSAGE; } else if (types.contains(STACK)) { return STACK; } else { return OTHER; } }

Target:
private static String getLogType(String logs) { String[] logsArray = logs.split("~"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < logsArray.length; i++) { builder.append(logsArray[i].substring(0, logsArray[i].indexOf(':'))); } String types = builder.toString(); if (types.contains(ERROR)) { return ERROR; } else if (types.contains(EVENT)) { return EVENT; } else if (types.contains(MESSAGE)) { return MESSAGE; } else if (types.contains(STACK)) { return STACK; } else { return OTHER; } }
Source:
private void packetReceived(int seq, boolean marked) { long now = System.currentTimeMillis(); synchronized (incomingSeqsSyncRoot) { if (incomingSeqs == null) { incomingSeqs = new TreeMap<>(RTPUtils.sequenceNumberComparator); } if (incomingSeqs.size() >= MAX_INCOMING_PACKETS_HISTORY) { Iterator<Map.Entry<Integer, Long>> iter = incomingSeqs.entrySet().iterator(); if (iter.hasNext()) { iter.next(); iter.remove(); } logger.info("Reached max size, removing an entry."); } if (incomingSeqs.isEmpty()) { firstIncomingTs = now; } incomingSeqs.put(seq, now); } maybeSendRtcp(marked, now); }

Target:
private void packetReceived(int seq, boolean marked) { long now = System.currentTimeMillis(); synchronized (incomingPacketsSyncRoot) { if (incomingPackets == null) { incomingPackets = new RTCPTCCPacket.PacketMap(); } if (incomingPackets.size() >= MAX_INCOMING_PACKETS_HISTORY) { Iterator<Map.Entry<Integer, Long>> iter = incomingPackets.entrySet().iterator(); if (iter.hasNext()) { iter.next(); iter.remove(); } logger.info("Reached max size, removing an entry."); } if (incomingPackets.isEmpty()) { firstIncomingTs = now; } incomingPackets.put(seq, now); } maybeSendRtcp(marked, now); }
Source:
public Optional<String> getLatestSchemaSnapshotFilename() { Optional<String> snapshotVersion = getLatestSnapshotVersion(); if (snapshotVersion.isPresent()) { return Optional .of(SCHEMA_ONLY_FOLDER_NAME + File.separator + SCHEMA_ONLY_BASE_NAME + snapshotVersion.get() + DOT_XML); } return Optional.empty(); }

Target:
public Optional<String> getLatestSchemaSnapshotFilename() { return getLatestSnapshotVersion().map( snapshotVersion -> SCHEMA_ONLY_FOLDER_NAME + File.separator + SCHEMA_ONLY_BASE_NAME + snapshotVersion + DOT_XML); }
Source:
public long getNumberOfImagesInStorageDomain(Guid storageDomainId) { MapSqlParameterSource params = getCustomMapSqlParameterSource().addValue("storage_domain_id", storageDomainId); return getCallsHandler().executeRead("GetNumberOfImagesInStorageDomain", getLongMapper(), params); }

Target:
public long getNumberOfImagesInStorageDomain(Guid storageDomainId) { return getCallsHandler().executeRead("GetNumberOfImagesInStorageDomain", getLongMapper(), getCustomMapSqlParameterSource().addValue("storage_domain_id", storageDomainId)); }
Source:
public StreamsProducer(final Producer<byte[], byte[]> producer, final StreamThread.ProcessingMode processingMode, final LogContext logContext) { this.producer = Objects.requireNonNull(producer, "producer cannot be null"); this.processingMode = Objects.requireNonNull(processingMode, "processingMode cannot be null"); this.eosEnabled = processingMode == EXACTLY_ONCE_ALPHA || processingMode == EXACTLY_ONCE_BETA; log = Objects.requireNonNull(logContext, "logContext cannot be null").logger(getClass()); logPrefix = logContext.logPrefix().trim(); }

Target:
public StreamsProducer(final Producer<byte[], byte[]> producer, final StreamThread.ProcessingMode processingMode, final LogContext logContext) { this.producer = Objects.requireNonNull(producer, "producer cannot be null"); this.processingMode = Objects.requireNonNull(processingMode, "processingMode cannot be null"); log = Objects.requireNonNull(logContext, "logContext cannot be null").logger(getClass()); logPrefix = logContext.logPrefix().trim(); }
Source:
protected String[] getGDBCommandLine() { List<String> gdbCommandLine = new ArrayList<String>(); gdbCommandLine.add(getGDBPath().toOSString()); gdbCommandLine.add("--interpreter"); gdbCommandLine.add("mi2"); gdbCommandLine.add("--nx"); return gdbCommandLine.toArray(new String[gdbCommandLine.size()]); }

Target:
protected String getGDBCommandLine() { StringBuffer gdbCommandLine = new StringBuffer(getGDBPath().toOSString()); gdbCommandLine.append(" --interpreter"); gdbCommandLine.append(" mi2"); gdbCommandLine.append(" --nx"); return gdbCommandLine.toString(); }
Source:
public PerformSearchResponse performSearch(JsonRpcPeer peer, final JSONObject params) { final PerformSearchRequest request = mObjectMapper.convertValue( params, PerformSearchRequest.class); final ArrayListAccumulator<Integer> results = new ArrayListAccumulator<>(); mDocument.postAndWait(new Runnable() { @Override public void run() { mDocument.findMatchingElements(request.query, results); } }); final String id = String.valueOf(mResultCounter.getAndIncrement()); mSearchResults.put(id, results); final PerformSearchResponse response = new PerformSearchResponse(); response.searchId = id; response.resultCount = results.size(); return response; }

Target:
public PerformSearchResponse performSearch(JsonRpcPeer peer, final JSONObject params) { final PerformSearchRequest request = mObjectMapper.convertValue( params, PerformSearchRequest.class); final ArrayListAccumulator<Integer> resultNodeIds = new ArrayListAccumulator<>(); mDocument.postAndWait(new Runnable() { @Override public void run() { mDocument.findMatchingElements(request.query, resultNodeIds); } }); final String searchId = String.valueOf(mResultCounter.getAndIncrement()); mSearchResults.put(searchId, resultNodeIds); final PerformSearchResponse response = new PerformSearchResponse(); response.searchId = searchId; response.resultCount = resultNodeIds.size(); return response; }
Source:
private String getBrowserTimezoneOffsetMins(EpdqTemplateData templateData) { return templateData.getAuthCardDetails().getJsTimezoneOffsetMins() .filter(timezoneOffsetMins -> NUMBER_FROM_MINUS_840_TO_720.matcher(timezoneOffsetMins).matches()) .map(Integer::parseInt) .filter(timezoneOffsetMins -> timezoneOffsetMins >= -840 && timezoneOffsetMins <= 720) .map(timezoneOffsetMins -> Integer.toString(timezoneOffsetMins)) .orElse(getCurrentBrowserOffsetInMinutes()); }

Target:
private String getBrowserTimezoneOffsetMins(EpdqTemplateData templateData) { return templateData.getAuthCardDetails().getJsTimezoneOffsetMins() .filter(timezoneOffsetMins -> NUMBER_FROM_MINUS_999_TO_999.matcher(timezoneOffsetMins).matches()) .map(Integer::parseInt) .filter(timezoneOffsetMins -> timezoneOffsetMins >= -840 && timezoneOffsetMins <= 720) .map(timezoneOffsetMins -> Integer.toString(timezoneOffsetMins)) .orElseGet(() -> getDefaultBrowserOffsetInMinutes()); }
Source:
public Config set(String name, String value) throws GitException { ConfigKey key = parseName(name); repository.getConfig().setString(key.section, key.subsection, key.name, value); try { this.repository.getConfig().save(); } catch (IOException e) { throw new GitException("Failed to save to config file"); } return this; }

Target:
public Config set(String name, String value) throws GitException { ConfigKey key = parseName(name); repository.getConfig().setString(key.section, key.subsection, key.name, value); try { this.repository.getConfig().save(); } catch (IOException e) { throw new GitException(e.getMessage(), e); } return this; }
Source:
PathAddress getModelControllerResourceAddress(ManagementModel managementModel) { if (modelControllerResourceAddress == null) { Set<String> hosts = managementModel.getRootResource().getChildrenNames(HOST); if (hosts.size() == 0) { return null; } String hostName = managementModel.getRootResource().getChildrenNames(HOST).iterator().next(); modelControllerResourceAddress = PathAddress.pathAddress(HOST, hostName).append(MODEL_CONTROLLER_ADDRESS); } return modelControllerResourceAddress; }

Target:
PathAddress getModelControllerResourceAddress(ManagementModel managementModel) { if (modelControllerResourceAddress == null) { Set<String> hosts = managementModel.getRootResource().getChildrenNames(HOST); if (hosts.size() == 0) { return null; } String hostName = hosts.iterator().next(); modelControllerResourceAddress = PathAddress.pathAddress(HOST, hostName).append(MODEL_CONTROLLER_ADDRESS); } return modelControllerResourceAddress; }
Source:
public static List<Object> map(Package pack) { List<Object> row = Lists.newArrayList(); for (Entry<String, String> entry : PACKAGE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_PACKAGE_TAGS: row.add( StringUtils.join( StreamSupport.stream(pack.getTags().spliterator(), false) .map(Tag::getId) .collect(Collectors.toList()), ",")); break; case EMX_PACKAGE_PARENT: Package parent = pack.getParent(); row.add(parent != null ? parent.getId() : ""); break; default: Object value = pack.get(entry.getValue()); row.add(value != null ? value.toString() : ""); } } return row; }

Target:
public static List<Object> map(Package pack) { List<Object> row = Lists.newArrayList(); for (Entry<String, String> entry : PACKAGE_ATTRS.entrySet()) { switch (entry.getKey()) { case EMX_PACKAGE_TAGS: row.add(Streams.stream(pack.getTags()).map(Tag::getId).collect(joining(","))); break; case EMX_PACKAGE_PARENT: Package parent = pack.getParent(); row.add(parent != null ? parent.getId() : ""); break; default: Object value = pack.get(entry.getValue()); row.add(value != null ? value.toString() : ""); } } return row; }
Source:
public void if_then_test_predecessors() { ControlFlowGraph cfg = build(functionTree( BlockString.withId(0).withSuccessorIds(1, 2).withPredecessorIds().build() + "$x = 1;" + "1 + 1;" + "if (a) {" + BlockString.withId(1).withSuccessorIds(2).withPredecessorIds(0).build() + "}" + BlockString.withId(2).withSuccessorIds("END").withPredecessorIds(0, 1).build())); assertThat(cfg.blocks()).hasSize(4); Map<String, BlockMetadata> data = MetadataParser.parse(cfg.blocks()); CfgBlock startBlock = data.get("0").getBlock(); assertThat(startBlock).isEqualTo(cfg.start()); assertThat(startBlock).isExactlyInstanceOf(PhpCfgBranchingBlock.class); PhpCfgBranchingBlock ifBlock = (PhpCfgBranchingBlock) startBlock; assertThat(ifBlock.trueSuccessor()).isEqualTo(data.get("1").getBlock()); assertThat(ifBlock.falseSuccessor()).isEqualTo(data.get("2").getBlock()); assertThat(data.get("END").getBlock().predecessors()).hasSize(1); Validator.assertCfgStructure(data, CfgPrinter.toDot(cfg), true); }

Target:
public void if_then_test_predecessors() { verifyBlockCfg("" + "b0( succ = [b1, b2], pred = );" + "foo();" + "if (a) {" + " b1( succ = [b2], pred = [b0] );" + "}" + "b2( succ = [END], pred = [b0, b1] );"); }
Source:
public void testCancelCommitWithProgressMonitor() throws Exception { CDOSession session = openSession(); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(100000 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); CDOTransaction transaction1 = session.openTransaction(); CDOResource resource1 = transaction1.createResource(getResourcePath(RESOURCE_PATH)); Company customer1 = initializeModel(resource1); resource1.getContents().add(customer1); ProgressMonitorAsserter progressMonitorAsserter = new ProgressMonitorAsserter(); try { transaction1.commit(progressMonitorAsserter); } catch (Exception ex) { Assert.assertTrue(ex instanceof OperationCanceledException); } }

Target:
public void testCancelCommitWithProgressMonitor() throws Exception { CDOSession session = openSession(); CDONet4jSession.Options options = (Options)session.options(); options.setCommitTimeout(100000 * CommitTransactionRequest.DEFAULT_MONITOR_TIMEOUT_SECONDS); CDOTransaction transaction1 = session.openTransaction(); CDOResource resource1 = transaction1.createResource(getResourcePath(RESOURCE_PATH)); Company customer1 = initializeModel(resource1); resource1.getContents().add(customer1); ProgressMonitorAsserter progressMonitorAsserter = new ProgressMonitorAsserter(); try { transaction1.commit(progressMonitorAsserter); fail("An OperationCanceledException should be thrown as the commit has been canceled"); } catch (Exception ex) { Assert.assertTrue(ex instanceof OperationCanceledException); } }
Source:
public void clear( final ChangeSummary summary ) throws IndyDataException { stores.getCache().clear(); }

Target:
public void clear( final ChangeSummary summary ) throws IndyDataException { stores.executeCache( c -> { c.clear(); return null; } ); }
Source:
public ImmutableMap<ColumnName, Column> lifecycleColumns() { return columns().lifecycleColumns(); }

Target:
public final ImmutableMap<ColumnName, Column> lifecycleColumns() { return columns().lifecycleColumns(); }
Source:
public void copyOf() { Headers headers = new Headers(); headers.set("Content-Length", "5"); Headers headers2 = Headers.copyOf(headers); headers2.add("Via", "duct"); Truth.assertThat(headers.getAll("Via")).isEmpty(); }

Target:
public void copyOf() { Headers headers = new Headers(); headers.set("Content-Length", "5"); Headers headers2 = Headers.copyOf(headers); headers2.add("Via", "duct"); Truth.assertThat(headers.getAll("Via")).isEmpty(); Truth.assertThat(headers2.size()).isEqualTo(2); Truth.assertThat(headers2.getAll("Content-Length")).containsExactly("5"); }
Source:
public Href path(final Object suffix) { return new Href( URI.create( new StringBuilder( TRAILER.matcher(this.uri.toString()).replaceAll("") ) .append('/') .append(Href.encode(suffix.toString())).toString() ), this.params ); }

Target:
public Href path(final Object suffix) { return new Href( URI.create( new StringBuilder( Href.TRAILING_SLASH.matcher(this.uri.toString()) .replaceAll("") ) .append('/') .append(Href.encode(suffix.toString())).toString() ), this.params ); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_privacy_policy); setupToolbar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getText(R.string.actionbar_privacy_policy)); final ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.syncProgressBar); DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); WebView webview = (WebView) findViewById(R.id.privacyPolicyWebview); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setDisplayZoomControls(false); final Activity activity = this; webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { mProgressBar.setProgress(progress); if(progress == 100) { mProgressBar.setVisibility(View.GONE); } } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(activity, "An error has occurred: " + description, Toast.LENGTH_SHORT).show(); } }); String urlPrivacyPolicy = getResources().getString(R.string.url_privacy_policy); webview.loadUrl(urlPrivacyPolicy); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_privacy_policy); setupToolbar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getText(R.string.actionbar_privacy_policy)); final ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.syncProgressBar); DisplayUtils.colorPreLollipopHorizontalProgressBar(mProgressBar); WebView webview = (WebView) findViewById(R.id.privacyPolicyWebview); webview.getSettings().setJavaScriptEnabled(true); webview.getSettings().setBuiltInZoomControls(true); webview.getSettings().setDisplayZoomControls(false); webview.setWebChromeClient(new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { mProgressBar.setProgress(progress); if(progress == 100) { mProgressBar.setVisibility(View.GONE); } } }); webview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Snackbar snackbar = Snackbar.make( findViewById(android.R.id.content), getString(R.string.privacy_policy_error) + description, Snackbar.LENGTH_LONG ); snackbar.show(); } }); String urlPrivacyPolicy = getResources().getString(R.string.url_privacy_policy); webview.loadUrl(urlPrivacyPolicy); }
Source:
public Container create(boolean loadSingletons) { ensureNotCreated(); created = true; final ContainerImpl container = new ContainerImpl(factories); if (loadSingletons) { container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : singletonFactories) { factory.create(context); } return null; } }); } container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : earlyInitializableFactories) { factory.create(context); } return null; } }); container.injectStatics(staticInjections); return container; }

Target:
public Container create(boolean loadSingletons) { ensureNotCreated(); created = true; final ContainerImpl container = new ContainerImpl(new HashMap<>(factories)); if (loadSingletons) { container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : singletonFactories) { factory.create(context); } return null; } }); } container.callInContext(new ContainerImpl.ContextualCallable<Void>() { public Void call(InternalContext context) { for (InternalFactory<?> factory : earlyInitializableFactories) { factory.create(context); } return null; } }); container.injectStatics(staticInjections); return container; }
Source:
private LeipzigTestSampleStream(int sentencePerDocument, Tokenizer tokenizer, InputStreamFactory in) throws IOException { super(new PlainTextByLineStream(in, StandardCharsets.UTF_8)); this.sentencePerDocument = sentencePerDocument; this.tokenizer = tokenizer; System.setOut(new PrintStream(System.out, true, "UTF-8")); }

Target:
private LeipzigTestSampleStream(int sentencePerDocument, Tokenizer tokenizer, InputStreamFactory in) throws IOException { super(new PlainTextByLineStream(in, StandardCharsets.UTF_8)); this.sentencePerDocument = sentencePerDocument; this.tokenizer = tokenizer; }
Source:
public static void main(String[] args) throws Exception { try { if (args.length < 1) { System.out.println("Usage: LocalDLEmulator <zk_host> <zk_port>"); System.exit(-1); } final String zkHost = args[0]; final int zkPort = Integer.parseInt(args[1]); final File zkDir = IOUtils.createTempDir("distrlog", "zookeeper"); final LocalDLMEmulator localDlm = LocalDLMEmulator.newBuilder() .zkHost(zkHost) .zkPort(zkPort) .build(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { localDlm.teardown(); FileUtils.forceDeleteOnExit(zkDir); System.out.println("ByeBye!"); } catch (Exception e) { } } }); localDlm.start(); System.out.println(String.format( "DistributedLog Sandbox is running now. You could access distributedlog://%s:%s", zkHost, zkPort)); } catch (Exception ex) { System.out.println("Exception occurred running emulator " + ex); } }

Target:
public static void main(String[] args) throws Exception { try { if (args.length < 1) { System.out.println("Usage: LocalDLEmulator [<zk_host>] <zk_port>"); System.exit(-1); } String zkHost = DEFAULT_ZK_HOST; int zkPort = DEFAULT_ZK_PORT; if (args.length == 1) { zkPort = Integer.parseInt(args[0]); } else { zkHost = args[0]; zkPort = Integer.parseInt(args[1]); } final File zkDir = IOUtils.createTempDir("distrlog", "zookeeper"); final LocalDLMEmulator localDlm = LocalDLMEmulator.newBuilder() .zkHost(zkHost) .zkPort(zkPort) .build(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { try { localDlm.teardown(); FileUtils.forceDeleteOnExit(zkDir); System.out.println("ByeBye!"); } catch (Exception e) { } } }); localDlm.start(); System.out.println(String.format( "DistributedLog Sandbox is running now. You could access distributedlog://%s:%s", zkHost, zkPort)); } catch (Exception ex) { System.out.println("Exception occurred running emulator " + ex); } }
Source:
public <E extends RealmModel> Observable<RealmResults<E>> from(final Realm realm, final RealmResults<E> results) { final RealmConfiguration realmConfig = realm.getConfiguration(); return Observable.create(new Observable.OnSubscribe<RealmResults<E>>() { @Override public void call(final Subscriber<? super RealmResults<E>> subscriber) { final Realm observableRealm = Realm.getInstance(realmConfig); resultsRefs.get().acquireReference(results); final RealmChangeListener<RealmResults<E>> listener = new RealmChangeListener<RealmResults<E>>() { @Override public void onChange(RealmResults<E> object) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(results); } } }; results.addChangeListener(listener); subscriber.add(Subscriptions.create(new Action0() { @Override public void call() { results.removeChangeListener(listener); observableRealm.close(); resultsRefs.get().releaseReference(results); } })); subscriber.onNext(results); } }); }

Target:
public <E extends RealmModel> Observable<RealmResults<E>> from(final Realm realm, final RealmResults<E> results) { final RealmConfiguration realmConfig = realm.getConfiguration(); return Observable.create(new Observable.OnSubscribe<RealmResults<E>>() { @Override public void call(final Subscriber<? super RealmResults<E>> subscriber) { final Realm observableRealm = Realm.getInstance(realmConfig); resultsRefs.get().acquireReference(results); final RealmChangeListener<RealmResults<E>> listener = new RealmChangeListener<RealmResults<E>>() { @Override public void onChange(RealmResults<E> result) { if (!subscriber.isUnsubscribed()) { subscriber.onNext(results); } } }; results.addChangeListener(listener); subscriber.add(Subscriptions.create(new Action0() { @Override public void call() { results.removeChangeListener(listener); observableRealm.close(); resultsRefs.get().releaseReference(results); } })); subscriber.onNext(results); } }); }
Source:
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { AnnotatedElement element = context.getElement().orElse(null); return findAnnotation(element, Disabled.class) .map(disabled -> Optional.of(disabled) .map(Disabled::value) .filter(StringUtils::isNotBlank) .orElseGet(() -> element + " is @Disabled")) .map(ConditionEvaluationResult::disabled) .orElse(ENABLED); }

Target:
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { AnnotatedElement element = context.getElement().orElse(null); return findAnnotation(element, Disabled.class).map(annotation -> toResult(element, annotation)).orElse(ENABLED); }
Source:
protected void executeCommand() { int replicaCount = (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) ? getParameters().getReplicaCount() : 0; VDSReturnValue returnValue = runVdsCommand( VDSCommandType.StartRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getBricks(), replicaCount, true)); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { GlusterDBUtils.getInstance().removeBricksFromVolumeInDb(getGlusterVolume(), getParameters().getBricks(), getParameters().getReplicaCount()); } else { handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED, returnValue.getVdsError().getMessage()); return; } }

Target:
protected void executeCommand() { int replicaCount = (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) ? getParameters().getReplicaCount() : 0; VDSReturnValue returnValue = runVdsCommand( VDSCommandType.StartRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getBricks(), replicaCount, true)); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { GlusterDBUtils.getInstance().removeBricksFromVolumeInDb(getGlusterVolume(), getParameters().getBricks(), replicaCount); } else { handleVdsError(AuditLogType.GLUSTER_VOLUME_REMOVE_BRICKS_FAILED, returnValue.getVdsError().getMessage()); return; } }
Source:
public Connection connect(String url, Properties info) throws SQLException { try { LOGGER.info("Initiating connection to database for url: " + url); PinotClientTransport pinotClientTransport = new JsonAsyncHttpPinotClientTransportFactory().buildTransport(); String controllerUrl = DriverUtils.getControllerFromURL(url); Preconditions.checkArgument(info.containsKey(TENANT), "Pinot tenant missing in the properties"); String tenant = info.getProperty(TENANT); return new PinotConnection(controllerUrl, pinotClientTransport, tenant); } catch (Exception e) { throw new SQLException(String.format("Failed to connect to url : %s", url), e); } }

Target:
public Connection connect(String url, Properties info) throws SQLException { try { LOGGER.info("Initiating connection to database for url: " + url); PinotClientTransport pinotClientTransport = new JsonAsyncHttpPinotClientTransportFactory().buildTransport(); String controllerUrl = DriverUtils.getControllerFromURL(url); String tenant = info.getProperty(TENANT, DEFAULT_TENANT); return new PinotConnection(controllerUrl, pinotClientTransport, tenant); } catch (Exception e) { throw new SQLException(String.format("Failed to connect to url : %s", url), e); } }
Source:
@Override public void onError(Throwable e) { U.error(context().planningContext().logger(), "Error occurred during execution: " + X.getFullStackTrace(e)); dest.targets().forEach(nodeId -> { try { sendError(nodeId, e); } catch (IgniteCheckedException ex) { U.error(context().planningContext().logger(), "Error occurred during send error message: " + X.getFullStackTrace(e)); } }); }

Target:
@Override public void onError(Throwable e) { U.error(context().planningContext().logger(), "Error occurred during execution: " + X.getFullStackTrace(e)); nodeBuffers.values().forEach(b -> b.onError(e)); }
Source:
public static Boolean getBoolean(String val) { if (val == null || val.trim().length() == 0) { return false; } try { return Boolean.valueOf(val); } catch (Exception e) { return false; } }

Target:
public static Boolean getBoolean(String val) { if (val == null || val.trim().length() == 0) { return false; } try { return Boolean.valueOf(val); } catch (IllegalArgumentException e) { return false; } }
Source:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer == null) { return true; } int count = targetPlayer.discard(targetPlayer.getHand(), source, game).size(); targetPlayer.drawCards(count, source.getSourceId(), game); return false; }

Target:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); if (targetPlayer == null) { return false; } int count = targetPlayer.discard(targetPlayer.getHand(), source, game).size(); targetPlayer.drawCards(count, source.getSourceId(), game); return true; }
Source:
public void enumerateTest2() throws Exception { PigTest test = createPigTest("test/pig/datafu/test/pig/bags/enumerateTest.pig"); writeLinesToFile("input", "({(10,{(1),(2),(3)}),(20,{(4),(5),(6)}),(30,{(7),(8)}),(40,{(9),(10),(11)}),(50,{(12),(13),(14),(15)})})", "({(10,{(1),(2),(3)}),(20,{(4),(5),(6)}),(30,{(7),(8)}),(40,{(9),(10),(11)}),(50,{(12),(13),(14),(15)})})"); test.runScript(); assertOutput(test, "data4", "(10,{(1),(2),(3)},0)", "(20,{(4),(5),(6)},1)", "(30,{(7),(8)},2)", "(40,{(9),(10),(11)},3)", "(50,{(12),(13),(14),(15)},4)", "(10,{(1),(2),(3)},0)", "(20,{(4),(5),(6)},1)", "(30,{(7),(8)},2)", "(40,{(9),(10),(11)},3)", "(50,{(12),(13),(14),(15)},4)"); }

Target:
public void enumerateTest2() throws Exception { PigTest test = createPigTest("test/pig/datafu/test/pig/bags/enumerateTest.pig"); writeLinesToFile("input", "({(10,{(1),(2),(3)}),(20,{(4),(5),(6)}),(30,{(7),(8)}),(40,{(9),(10),(11)}),(50,{(12),(13),(14),(15)})})", "({(11,{(11),(12),(13),(14)}),(21,{(15),(16),(17),(18)}),(31,{(19),(20)}),(41,{(21),(22),(23),(24)}),(51,{(25),(26),(27)})})"); test.runScript(); assertOutput(test, "data4", "(10,{(1),(2),(3)},0)", "(20,{(4),(5),(6)},1)", "(30,{(7),(8)},2)", "(40,{(9),(10),(11)},3)", "(50,{(12),(13),(14),(15)},4)", "(11,{(11),(12),(13),(14)},0)", "(21,{(15),(16),(17),(18)},1)", "(31,{(19),(20)},2)", "(41,{(21),(22),(23),(24)},3)", "(51,{(25),(26),(27)},4)"); }
Source:
public void testJsonAPIPost() { given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body( datum( resource( type("post"), id("1"), attributes( attr("content", "This is my first post. woot."), attr("date", "2019-01-01T00:00Z") ) ) ) ) .post("/api/v1/post") .then() .statusCode(HttpStatus.SC_CREATED) .extract().body().asString(); given() .when() .get("/api/v1/postView") .then() .statusCode(200); given() .when() .get("/api/v1/postView") .then() .body("data.id", hasItems("0")) .body("data.attributes.content", hasItems("This is my first post. woot.")); }

Target:
public void testJsonAPIPost() { given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body( datum( resource( type("post"), id("1"), attributes( attr("content", "This is my first post. woot."), attr("date", "2019-01-01T00:00Z") ) ) ) ) .post("/api/v1/post") .then() .statusCode(HttpStatus.SC_CREATED) .extract().body().asString(); given() .when() .get("/api/v1/postView") .then() .statusCode(200) .body("data.id", hasItems("0")) .body("data.attributes.content", hasItems("This is my first post. woot.")); }
Source:
public void deactivateApp(String id) { App app = findAppById(id); app.setActive(false); dataService.update(AppMetadata.APP, app); String pluginId = generatePluginId(app); dataService.deleteById(PluginMetadata.PLUGIN, pluginId); }

Target:
public void deactivateApp(String id) { App app = findAppById(id); app.setActive(false); dataService.update(AppMetadata.APP, app); String pluginId = generatePluginId(app); dataService.deleteById(PluginMetadata.PLUGIN, pluginId); Menu menu = menuReaderService.getMenu(); menu.setItems(menu.deleteMenuItem(pluginId)); menuManagerService.saveMenu(menu); }
Source:
public ArtAlnRecord getNextAln() throws IOException { if (currentLine == null) { return null; } final String refAln = br.readLine().trim(); final String readAln = br.readLine().trim(); final String[] alnFields = splitterPattern.split(currentLine.trim().substring(1)); int direction = (alnFields[3].equals("-")) ? 1 : 0; final int refLength = refAln.replace("-", "").length(); ArtAlnRecord record = new ArtAlnRecord(new ChrString(alnFields[0]), Integer.parseInt(alnFields[2]) + 1, direction, alnFields[1], refLength); if (!chromosomeLengths.containsKey(record.chromosome)) { log.warning("got nonexistent chromosome " + record.chromosome + " at aln file line " + (br.getLineNumber() - 2)); return null; } if (record.direction == 1) { final int chromosomeLength = chromosomeLengths.get(record.chromosome); record.location = chromosomeLength - (record.location - 1) + 1 - refLength; } currentLine = br.readLine(); return record; }

Target:
public ArtAlnRecord getNextAln() throws IOException { if (currentLine == null) { return null; } final String refAln = br.readLine().trim(); final String readAln = br.readLine().trim(); final String[] alnFields = splitterPattern.split(currentLine.trim().substring(1)); int direction = (alnFields[3].equals("-")) ? 1 : 0; final int refLength = refAln.replace("-", "").length(); ArtAlnRecord record = new ArtAlnRecord(new ChrString(alnFields[0]), Integer.parseInt(alnFields[2]) + 1, direction, alnFields[1], refLength); if (!chromosomeLengths.containsKey(record.chromosome)) { log.warn("got nonexistent chromosome " + record.chromosome + " at aln file line " + (br.getLineNumber() - 2) + ": " + currentLine.trim()); return null; } if (record.direction == 1) { final int chromosomeLength = chromosomeLengths.get(record.chromosome); record.location = chromosomeLength - (record.location - 1) + 1 - refLength; } currentLine = br.readLine(); return record; }
Source:
public void testFloat() { assertEquals(getDomain(REAL, 0, null), all(REAL)); float minimum = 4.3f; float maximum = 40.3f; assertEquals(getDomain(REAL, 10, floatColumnStats(minimum, minimum)), singleValue(REAL, (long) floatToRawIntBits(minimum))); assertEquals( getDomain(REAL, 10, floatColumnStats(minimum, maximum)), create(ValueSet.ofRanges(range(REAL, (long) floatToRawIntBits(minimum), true, (long) floatToRawIntBits(maximum), true)), false)); try { assertEquals(getDomain(REAL, 10, floatColumnStats(maximum, minimum)), create(ValueSet.all(REAL), false)); fail("Parquet with corrupted statistics"); } catch (ParquetCorruptionException e) { assertEquals(e.getMessage(), "Parquet with corrupted statistics"); } }

Target:
public void testFloat() throws ParquetCorruptionException { String column = "FloatColumn"; assertEquals(getDomain(REAL, 0, null, ID, column, true), all(REAL)); float minimum = 4.3f; float maximum = 40.3f; assertEquals(getDomain(REAL, 10, floatColumnStats(minimum, minimum), ID, column, true), singleValue(REAL, (long) floatToRawIntBits(minimum))); assertEquals( getDomain(REAL, 10, floatColumnStats(minimum, maximum), ID, column, true), create(ValueSet.ofRanges(range(REAL, (long) floatToRawIntBits(minimum), true, (long) floatToRawIntBits(maximum), true)), false)); assertEquals(getDomain(REAL, 10, floatColumnStats(maximum, minimum), ID, column, false), create(ValueSet.all(REAL), false)); assertThatExceptionOfType(ParquetCorruptionException.class) .isThrownBy(() -> getDomain(REAL, 10, floatColumnStats(maximum, minimum), ID, column, true)) .withMessage("Corrupted statistics for column \"FloatColumn\" in Parquet file \"testFile\": [min: 40.30000, max: 4.30000, num_nulls: 0]"); }
Source:
public void testRunParagraphJob() throws IOException, InterruptedException { Note note1 = ZeppelinServer.notebook.createNote(anonymous); note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); Paragraph p = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); PostMethod post = httpPost("/notebook/job/" + note1.getId() + "/" + p.getId(), ""); assertThat(post, isAllowed()); Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType()); assertEquals(resp.get("status"), "OK"); post.releaseConnection(); assertEquals(p.getStatus(), Job.Status.FINISHED); p.setText("%spark.pyspark\nprint(\"test\")"); post = httpPost("/notebook/job/" + note1.getId() + "/" + p.getId(), ""); assertThat(post, isAllowed()); resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType()); assertEquals(resp.get("status"), "OK"); post.releaseConnection(); long startTimeInMins = (System.currentTimeMillis() / (1000 * 60)) % 60; while (!p.getStatus().equals(Job.Status.FINISHED)) { long currentTimeInMins = (System.currentTimeMillis() / (1000 * 60)) % 60; if (currentTimeInMins - startTimeInMins > 1) { if (!p.getStatus().equals(Job.Status.FINISHED)) { fail("Job is running for too long"); } } TimeUnit.SECONDS.sleep(10); } assertEquals("test\n", p.getResult().message().get(0).getData()); ZeppelinServer.notebook.removeNote(note1.getId(), anonymous); }

Target:
public void testRunParagraphJob() throws IOException { Note note1 = ZeppelinServer.notebook.createNote(anonymous); note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); Paragraph p = note1.addNewParagraph(AuthenticationInfo.ANONYMOUS); PostMethod post = httpPost("/notebook/job/" + note1.getId() + "/" + p.getId(), ""); assertThat(post, isAllowed()); Map<String, Object> resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType()); assertEquals(resp.get("status"), "OK"); post.releaseConnection(); assertEquals(p.getStatus(), Job.Status.FINISHED); p.setText("test"); post = httpPost("/notebook/job/" + note1.getId() + "/" + p.getId(), ""); assertThat(post, isAllowed()); resp = gson.fromJson(post.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() {}.getType()); assertEquals(resp.get("status"), "OK"); post.releaseConnection(); assertNotEquals(p.getStatus(), Job.Status.READY); ZeppelinServer.notebook.removeNote(note1.getId(), anonymous); }
Source:
public void testCloseAutoRead() { EmbeddedChannel channel = new EmbeddedChannel(); channel.config().setAutoRead(false); Queue<Object> inboundMessages = channel.inboundMessages(); channel.writeInbound(1L, 2L, 3L); assertEquals(0, inboundMessages.size()); channel.read(); assertEquals(3, inboundMessages.size()); inboundMessages.clear(); channel.writeOneInbound(1L); channel.flushInbound(); assertEquals(0, inboundMessages.size()); channel.finish(); }

Target:
public void testCloseAutoRead() { EmbeddedChannel channel = new EmbeddedChannel(); channel.config().setAutoRead(false); Queue<Object> inboundMessages = channel.inboundMessages(); channel.writeInbound(1L, 2L, 3L); assertEquals(0, inboundMessages.size()); channel.read(); assertEquals(3, inboundMessages.size()); inboundMessages.clear(); channel.writeOneInbound(1L); channel.flushInbound(); assertEquals(0, inboundMessages.size()); assertFalse(channel.finish()); }
Source:
private void revert() { final GitOutputConsole console = gitOutputConsoleFactory.create(REVERT_COMMAND_NAME); service .revert(project.getLocation(), selectedRevision.getId()) .then( result -> { console.print(formRevertMessage(result)); String conflictsMessage = formConflictsMessage(result.getConflicts()); if (conflictsMessage != null && !conflictsMessage.isEmpty()) { console.printError(conflictsMessage); } consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(constant.revertCommitSuccessfully()); project.synchronize(); }) .catchError( error -> { String errorMessage = (error.getMessage() != null) ? error.getMessage() : constant.revertCommitFailed(); console.printError(errorMessage); consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(constant.revertCommitFailed(), FAIL, FLOAT_MODE); }); }

Target:
private void revert() { final GitOutputConsole console = gitOutputConsoleFactory.create(constant.consoleRevertCommandName()); service .revert(project.getLocation(), selectedRevision.getId()) .then( result -> { console.print(formRevertMessage(result)); String conflictsMessage = formConflictsMessage(result.getConflicts()); if (!conflictsMessage.isEmpty()) { console.printError(conflictsMessage); } consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(constant.revertCommitSuccessfully()); project.synchronize(); }) .catchError( error -> { String errorMessage = (error.getMessage() != null) ? error.getMessage() : constant.revertCommitFailed(); console.printError(errorMessage); consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(constant.revertCommitFailed(), FAIL, FLOAT_MODE); }); }
Source:
public void testCreateIndexAndInsertWithExpressionsBatchWithFullNullRow() throws Exception { String tableName = "TEST_IDX_BATCH_INSERT"; methodWatcher.executeUpdate(format("create table %s (c char(4), i int, d double)", tableName)); methodWatcher.executeUpdate(format("insert into %s values ('abc', 10, 1.1), ('def', 20, 2.2)", tableName)); methodWatcher.executeUpdate(format("CREATE INDEX %s_IDX ON %s (upper(c), i + 2)", tableName, tableName)); methodWatcher.executeUpdate(format("insert into %s values ('jkl', 30, 2.2), (NULL, NULL, NULL)", tableName)); methodWatcher.executeUpdate(format("update %s set c = 'def' where i = 10", tableName)); }

Target:
public void testCreateIndexAndInsertWithExpressionsBatchWithFullNullRow() throws Exception { String tableName = "TEST_IDX_BATCH_INSERT"; methodWatcher.executeUpdate(format("create table %s (c char(4), i int, d double)", tableName)); methodWatcher.executeUpdate(format("insert into %s values ('abc', 10, 1.1), ('def', 20, 2.2)", tableName)); methodWatcher.executeUpdate(format("CREATE INDEX %s_IDX ON %s (upper(c), i + 2)", tableName, tableName)); methodWatcher.executeUpdate(format("insert into %s values ('jkl', 30, 2.2), (NULL, NULL, NULL)", tableName)); methodWatcher.executeUpdate(format("update %s set c = 'def' where i = 10", tableName)); String query = format("select c from %s order by c nulls last", tableName); String expected = "C |\n" + "------\n" + " def |\n" + " def |\n" + " jkl |\n" + "NULL |"; try (ResultSet rs = methodWatcher.executeQuery(query)) { Assert.assertEquals(expected, TestUtils.FormattedResult.ResultFactory.toStringUnsorted(rs)); } }