auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String toString() { return new StringBuilder() .append(isCounter() ? COUNTER : EMPTY_STRING) .append(LEFT_PARAN) .append(getUnit()) .append(RIGHT_PARAN) .toString(); }

Target:
public String toString() { return new StringBuilder() .append(isCounter() ? COUNTER : EMPTY_STRING) .append(LEFT_PAREN) .append(getUnit()) .append(RIGHT_PAREN) .toString(); }
Source:
public Object getValue(final Object element, final String property) { switch (property) { case NAME: return ((INamedElement) element).getName(); case TYPE: String type = ((IInterfaceElement) element).getTypeName(); String[] items = ((ComboBoxCellEditor) viewer.getCellEditors()[1]).getItems(); int i = items.length - 1; while (i > 0 && !type.equals(items[i])) { --i; } return i; case COMMENT: return ((INamedElement) element).getComment() != null ? ((INamedElement) element).getComment() : ""; default: return null; } }

Target:
public Object getValue(final Object element, final String property) { switch (property) { case NAME: return ((INamedElement) element).getName(); case TYPE: String type = ((IInterfaceElement) element).getTypeName(); List<String> items = Arrays .asList(((ComboBoxCellEditor) viewer.getCellEditors()[TYPE_COLUMN_INDEX]).getItems()); return items.indexOf(type); case COMMENT: return ((INamedElement) element).getComment() != null ? ((INamedElement) element).getComment() : ""; default: return null; } }
Source:
private void log(Object message, Object...parameters) { if (DEBUG) { StringBuilder indent = new StringBuilder(); for (int i = 0; i < currentLevel; ++i) { indent.append(" "); } LOG.debug(indent.toString() + message, parameters); } }

Target:
private void log(Object message, Object...parameters) { if (DEBUG) { StringBuilder indent = new StringBuilder(currentLevel * 2); for (int i = 0; i < currentLevel; ++i) { indent.append(" "); } LOG.debug(indent.toString() + message, parameters); } }
Source:
public String toCommentString() { return "compare-to-reflexive on x0"; }

Target:
public String toCommentString() { return "compareTo-reflexive on x0"; }
Source:
public void update(final Spec spec, final Spec widgets) { try { new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='save']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .body() .set( String.format( "spec=%s&widgets=%s", URLEncoder.encode(spec.asText(), CharEncoding.UTF_8), URLEncoder.encode(widgets.asText(), CharEncoding.UTF_8) ) ) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public void update(final Spec spec, final Spec widgets) { try { new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='save']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .body() .formParam("spec", spec.asText()) .formParam("widgets", widgets.asText()) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public String getDescription() { return "Returns the list of log files on JobManager."; }

Target:
public String getDescription() { return "Returns the list of log files on the JobManager."; }
Source:
private void checkIssueOnFile(String expectedIssueMessage, int... secondaryLines) { assertThat(issues).hasSize(1); Issue issue = issues.iterator().next(); assertThat(issue.primaryLocation().message()).isEqualTo(expectedIssueMessage); List<Flow> flows = issue.flows(); if (secondaryLines == null) { assertThat(flows).hasSize(1); assertThat(flows.get(0).locations()).isEmpty(); } else { assertThat(flows).hasSize(secondaryLines.length); assertThat(flows.stream().map(Flow::locations)).allMatch(flow -> flow.size() == 1); Integer[] expectedLines = IntStream.of(secondaryLines).boxed().toArray(Integer[]::new); assertThat(flows.stream().map(Flow::locations).map(locs -> locs.get(0).textRange().start().line()).collect(Collectors.toList())) .containsExactly(expectedLines); } }

Target:
private void checkIssueOnFile(String expectedIssueMessage, int... secondaryLines) { assertThat(issues).hasSize(1); Issue issue = issues.iterator().next(); assertThat(issue.primaryLocation().message()).isEqualTo(expectedIssueMessage); assertThat(issue.primaryLocation().textRange()).isNull(); List<Flow> flows = issue.flows(); assertThat(flows).hasSize(secondaryLines.length); assertThat(flows.stream().map(Flow::locations)).allMatch(flow -> flow.size() == 1); Integer[] expectedLines = IntStream.of(secondaryLines).boxed().toArray(Integer[]::new); assertThat(flows.stream().map(Flow::locations).map(locs -> locs.get(0).textRange().start().line()).collect(Collectors.toList())) .containsExactly(expectedLines); }
Source:
public void whenNoFreeSlotsThenException() throws Exception { final String parition = "0"; range(0, 5).forEach(x -> { try { final String path = zkPathForConsumer(parition) + "/" + randomUUID(); CURATOR.create().creatingParentsIfNeeded().forPath(path); } catch (Exception e) { throw new AssertionError("Error occurred when accessing Zookeeper"); } }); limitingService.acquireConnectionSlots(client, eventType, ImmutableList.of(parition)); }

Target:
public void whenNoFreeSlotsThenException() throws Exception { final String partition = "0"; range(0, 5).forEach(x -> { try { final String path = zkPathForConsumer(partition) + "/" + randomUUID(); CURATOR.create().creatingParentsIfNeeded().forPath(path); } catch (Exception e) { throw new AssertionError("Error occurred when accessing Zookeeper"); } }); limitingService.acquireConnectionSlots(client, eventType, ImmutableList.of(partition)); }
Source:
private Task dequeueWork() { final Iterator<Task> iterator = _queue.iterator(); if (!iterator.hasNext()) { throw new IllegalStateException(); } final Task result = iterator.next(); _queue.remove(result); recordCounter("buffer_size", _queue.size()); return result; }

Target:
private Task dequeueWork() { @Nullable final Task result = Iterables.getFirst(_queue, null); if (result == null) { throw new IllegalStateException("queue is empty"); } _queue.remove(result); return result; }
Source:
private List<storage_pool> buildStoragePoolsList() { List<storage_pool> pools = new LinkedList<storage_pool>(); pools.add(pool1); pools.add(pool2); pools.add(pool3); return pools; }

Target:
private List<storage_pool> buildStoragePoolsList() { return Arrays.asList(pool1,pool2,pool3); }
Source:
protected void onPause() { super.onPause(); lifecycleSubject.onNext(LifecycleEvent.PAUSE); }

Target:
protected void onPause() { lifecycleSubject.onNext(LifecycleEvent.PAUSE); super.onPause(); }
Source:
public scala.collection.Iterator<Tuple2<Integer, PrestoSparkRow>> compute(Partition split, TaskContext context) { List<Partition> partitions = seqAsJavaList(((ZippedPartitionsPartition) split).partitions()); List<Iterator<Tuple2<Integer, PrestoSparkRow>>> iterators = unmodifiableList(IntStream.range(0, rdds.size()) .mapToObj(i -> rdds.get(i).iterator(partitions.get(i), context)) .map(JavaConversions::asJavaIterator) .collect(toList())); return asScalaIterator(function.apply(iterators)); }

Target:
public scala.collection.Iterator<Tuple2<Integer, PrestoSparkRow>> compute(Partition split, TaskContext context) { List<Partition> partitions = seqAsJavaList(((ZippedPartitionsPartition) split).partitions()); List<Iterator<Tuple2<Integer, PrestoSparkRow>>> iterators = new ArrayList<>(); for (int i = 0; i < rdds.size(); i++) { iterators.add(asJavaIterator(rdds.get(i).iterator(partitions.get(i), context))); } return asScalaIterator(function.apply(unmodifiableList(iterators))); }
Source:
public Indexed<String> getAvailableDimensions() { final LinkedHashSet<String> availableDimensions = new LinkedHashSet<>(); baseAdapter.getAvailableDimensions().forEach(availableDimensions::add); for (JoinableClause clause : clauses) { clause.getJoinable() .getAvailableColumns() .stream() .map(c -> clause.getPrefix() + c) .forEach(availableDimensions::add); } return new ListIndexed<>(Lists.newArrayList(availableDimensions)); }

Target:
public Indexed<String> getAvailableDimensions() { final LinkedHashSet<String> availableDimensions = new LinkedHashSet<>(); baseAdapter.getAvailableDimensions().forEach(availableDimensions::add); for (JoinableClause clause : clauses) { availableDimensions.addAll(clause.getAvailableColumnsPrefixed()); } return new ListIndexed<>(Lists.newArrayList(availableDimensions)); }
Source:
public CipherExecutor yubikeyAccountCipherExecutor() { final EncryptionJwtSigningJwtCryptographyProperties crypto = casProperties.getAuthn().getMfa().getYubikey().getCrypto(); if (crypto.isEnabled()) { return new YubikeyAccountCipherExecutor( crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg()); } LOGGER.info("Yubikey account encryption/signing is turned off and " + "MAY NOT be safe in a production environment. " + "Consider using other choices to handle encryption, signing and verification of " + "Yubikey accounts for MFA"); return NoOpCipherExecutor.getInstance(); }

Target:
public CipherExecutor yubikeyAccountCipherExecutor() { final EncryptionJwtSigningJwtCryptographyProperties crypto = casProperties.getAuthn().getMfa().getYubikey().getCrypto(); if (crypto.isEnabled()) { return new YubikeyAccountCipherExecutor( crypto.getEncryption().getKey(), crypto.getSigning().getKey(), crypto.getAlg()); } LOGGER.info("YubiKey account encryption/signing is turned off and " + "MAY NOT be safe in a production environment. " + "Consider using other choices to handle encryption, signing and verification of " + "YubiKey accounts for MFA"); return NoOpCipherExecutor.getInstance(); }
Source:
protected void completeRemoval(IModule m) { try { IPath archiveDestination = getModuleDeployRoot(new IModule[]{m}); IFilesystemController controller = getFilesystemController(); boolean useAS7Behavior = DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(getServer()); if( useAS7Behavior) { DeploymentMarkerUtils.removedDeployedMarker(archiveDestination, controller); DeploymentMarkerUtils.removedDeployFailedMarker(archiveDestination, controller); } } catch(CoreException ce) { JBossServerCorePlugin.log(ce); } }

Target:
protected void completeRemoval(IModule m) { try { IPath archiveDestination = getModuleDeployRoot(new IModule[]{m}); boolean useAS7Behavior = DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(getServer()); if( useAS7Behavior) { IFilesystemController controller = getFilesystemController(); DeploymentMarkerUtils.removedDeployedMarker(archiveDestination, controller); DeploymentMarkerUtils.removedDeployFailedMarker(archiveDestination, controller); } } catch(CoreException ce) { JBossServerCorePlugin.log(ce); } }
Source:
public void updateParticipantLanguage(String identifier, String language) { Participant participant = getParticipant(identifier); if(participant != null) { String previousTargetLanguage = participant.getTranslationLanguage(); translationManager.addLanguage(language); translationManager.removeLanguage(previousTargetLanguage); participant.setTranslationLanguage(language); } }

Target:
public void updateParticipantLanguage(String identifier, String language) { Participant participant = getParticipant(identifier); if(participant != null) { String previousLanguage = participant.getTranslationLanguage(); translationManager.addLanguage(language); translationManager.removeLanguage(previousLanguage); participant.setTranslationLanguage(language); } }
Source:
public void testReleasesOnShrink() { ByteBuf b1 = PooledByteBufAllocator.DEFAULT.buffer(2).writeShort(1); ByteBuf b2 = PooledByteBufAllocator.DEFAULT.buffer(2).writeShort(2); ByteBuf composite = PooledByteBufAllocator.DEFAULT.compositeBuffer() .addComponents(b1, b2); assertEquals(4, composite.capacity()); composite.capacity(2); assertEquals(2, composite.capacity()); ReferenceCountUtil.release(composite); assertEquals(0, composite.refCnt()); assertEquals(0, b1.refCnt()); assertEquals(0, b2.refCnt()); }

Target:
public void testReleasesOnShrink() { ByteBuf b1 = Unpooled.buffer(2).writeShort(1); ByteBuf b2 = Unpooled.buffer(2).writeShort(2); ByteBuf composite = Unpooled.compositeBuffer() .addComponents(b1, b2); assertEquals(4, composite.capacity()); composite.capacity(2); assertEquals(2, composite.capacity()); composite.release(); assertEquals(0, composite.refCnt()); assertEquals(0, b1.refCnt()); assertEquals(0, b2.refCnt()); }
Source:
public void does_nothing_when_organization_disabled() throws Exception { setupDefaultOrganization(); insertOrganization(ORGANIZATION_1, TEMPLATE_1); insertOrganization(ORGANIZATION_2, TEMPLATE_2); insertPermissionTemplate(ORGANIZATION_1, TEMPLATE_1, "Default"); insertPermissionTemplate(ORGANIZATION_2, TEMPLATE_2, "Default"); underTest.execute(); checkGroups(); checkPermTemplateGroups(); }

Target:
public void does_nothing_when_organization_disabled() throws Exception { setupDefaultOrganization(); insertOrganization(ORGANIZATION_1, TEMPLATE_1); insertOrganization(ORGANIZATION_2, TEMPLATE_2); insertPermissionTemplate(ORGANIZATION_1, TEMPLATE_1, "Default"); insertPermissionTemplate(ORGANIZATION_2, TEMPLATE_2, "Default"); underTest.execute(); checkNoGroups(); checkNoPermTemplateGroups(); }
Source:
public AggregationBuilder getClassifierAggregation(String classifierName, String fromDate, String toDate) { String probabilityField = classifierName + "_probability"; DateRangeBuilder db = AggregationBuilders.dateRange("by_date").field("created_at"); if (fromDate == null && toDate != null) { db = db.addUnboundedTo(toDate); } else if (toDate == null && fromDate != null) { db = db.addUnboundedFrom(fromDate); } else { db = db.addRange(fromDate, toDate); } db = db.subAggregation( AggregationBuilders.terms("by_class").field(classifierName) .subAggregation( AggregationBuilders.avg("avg_probability").field(probabilityField) ) .subAggregation( AggregationBuilders.sum("sum_probability").field(probabilityField) ) ); return db; }

Target:
public AggregationBuilder getClassifierAggregation(String classifierName, String fromDate, String toDate) { String probabilityField = classifierName + "_probability"; DateRangeBuilder dateRangeAggregation = AggregationBuilders.dateRange("by_date").field("created_at"); if (fromDate == null && toDate != null) { dateRangeAggregation = dateRangeAggregation.addUnboundedTo(toDate); } else if (toDate == null && fromDate != null) { dateRangeAggregation = dateRangeAggregation.addUnboundedFrom(fromDate); } else { dateRangeAggregation = dateRangeAggregation.addRange(fromDate, toDate); } dateRangeAggregation = dateRangeAggregation.subAggregation( AggregationBuilders.terms("by_class").field(classifierName) .subAggregation( AggregationBuilders.avg("avg_probability").field(probabilityField) ) .subAggregation( AggregationBuilders.sum("sum_probability").field(probabilityField) ) ); return dateRangeAggregation; }
Source:
public void startProjectFileListener(Long id) { String projectsPath = ASSETS_PATH + File.separator + "projects"; Project project = projectRepo.findOne(id); if (project != null) { if (project.isHeadless()) { logger.info("Registering headless document listener: " + projectsPath + File.separator + project.getName()); fileObserverRegistry.register(new HeadlessDocumentListener(projectsPath, project.getName())); } else { logger.info("Registering standard document listener: " + projectsPath + File.separator + project.getName()); fileObserverRegistry.register(new StandardDocumentListener(projectsPath, project.getName())); } }; }

Target:
public void startProjectFileListener(Long id) { Project project = projectRepo.findOne(id); if (project != null) { this.startProjectFileListener(project); } }
Source:
public Activation getActivation() { if (!initialized) { init(txn, true); } return activation; }

Target:
public synchronized Activation getActivation() { if (!initialized) { init(txn, true); } return activation; }
Source:
private static void useBouncyCastleProviderThroughJceApi(BouncyCastleProvider bcProvider) throws Exception { System.out.println("Bouncy Castle JCE Provider:"); System.out.println("version: " + bcProvider.getVersion()); System.out.println("location: " + bcProvider.getClass().getProtectionDomain().getCodeSource().getLocation()); Security.addProvider(bcProvider); KeyGenerator keygenerator = KeyGenerator.getInstance("DES"); Key myDesKey = keygenerator.generateKey(); Cipher desCipher; desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding", bcProvider.getName()); desCipher.init(Cipher.ENCRYPT_MODE, myDesKey); byte[] text = "Nobody can see me".getBytes(); System.out.println("Text [Byte Format]: " + text); System.out.println("Text: " + new String(text)); byte[] textEncrypted = desCipher.doFinal(text); System.out.println("Text Encryted [Byte Format]: " + textEncrypted); desCipher.init(Cipher.DECRYPT_MODE, myDesKey); byte[] textDecrypted = desCipher.doFinal(textEncrypted); System.out.println("Text Decryted: " + new String(textDecrypted)); }

Target:
private static void useBouncyCastleProviderThroughJceApi(BouncyCastleProvider bcProvider) throws Exception { Security.addProvider(bcProvider); KeyGenerator keygenerator = KeyGenerator.getInstance("DES"); Key myDesKey = keygenerator.generateKey(); Cipher desCipher; desCipher = Cipher.getInstance("DES/ECB/PKCS5Padding", bcProvider.getName()); desCipher.init(Cipher.ENCRYPT_MODE, myDesKey); byte[] text = "Nobody can see me".getBytes(); logger.debug("Text [Byte Format]: " + Arrays.toString(text)); logger.debug("Text: " + new String(text)); byte[] textEncrypted = desCipher.doFinal(text); logger.debug("Text Encryted [Byte Format]: " + Arrays.toString(textEncrypted)); desCipher.init(Cipher.DECRYPT_MODE, myDesKey); byte[] textDecrypted = desCipher.doFinal(textEncrypted); logger.debug("Text Decryted: " + new String(textDecrypted)); }
Source:
public boolean exec() throws CliException { String path = args[1]; boolean watch = cl.hasOption("w"); Stat stat; try { stat = zk.exists(path, watch); } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (KeeperException | InterruptedException ex) { throw new CliWrapperException(ex); } if (stat == null) { throw new CliWrapperException(new KeeperException.NoNodeException(path)); } new StatPrinter(out).print(stat); boolean hasD = cl.hasOption("d"); if (hasD) { StatPersisted statPersisted; try { statPersisted = zk.getStatPersisted(path); } catch (KeeperException | InterruptedException e) { e.printStackTrace(); return watch; } CreateMode mode = CreateMode.getNodeMode(statPersisted.getEphemeralOwner()); out.println("node type = " + CreateMode.getModeName(mode.getFlag())); if (mode == CreateMode.PERSISTENT_WITH_TTL) { long ttl = EphemeralType.TTL.getValue(statPersisted.getEphemeralOwner()); out.println("ttl time = " + ttl); long timeDiff = ttl - (Time.currentWallTime() - statPersisted.getMtime()); out.println("remaining time = " + (timeDiff < 0 ? 0 : timeDiff)); } } return watch; }

Target:
public boolean exec() throws CliException { String path = args[1]; boolean watch = cl.hasOption("w"); Stat stat; try { stat = zk.exists(path, watch); } catch (IllegalArgumentException ex) { throw new MalformedPathException(ex.getMessage()); } catch (KeeperException | InterruptedException ex) { throw new CliWrapperException(ex); } if (stat == null) { throw new CliWrapperException(new KeeperException.NoNodeException(path)); } new StatPrinter(out).print(stat); boolean hasD = cl.hasOption("d"); if (hasD) { StatPersisted statPersisted; try { statPersisted = zk.getStatPersisted(path); } catch (KeeperException | InterruptedException e) { e.printStackTrace(); return watch; } new StatPrinter(out).printDetail(statPersisted); } return watch; }
Source:
private void setItemDefinitionNamespace(final ItemDefinition itemDefinition, final String namespace) { final String nameWithNamespace = namespace + "." + itemDefinition.getName(); final List<ItemDefinition> itemComponents = itemDefinition.getItemComponent(); if (itemDefinition.getTypeRef() != null && !isBuiltInType(itemDefinition.getTypeRef())) { itemDefinition.setTypeRef(makeQNameWithNamespace(itemDefinition.getTypeRef(), namespace)); } itemDefinition.setName(nameWithNamespace); setItemDefinitionsNamespace(itemComponents, namespace); }

Target:
private ItemDefinition setItemDefinitionNamespace(final ItemDefinition itemDefinition, final String namespace) { final String nameWithNamespace = namespace + "." + itemDefinition.getName(); final List<ItemDefinition> itemComponents = itemDefinition.getItemComponent(); if (itemDefinition.getTypeRef() != null && !isBuiltInType(itemDefinition.getTypeRef())) { itemDefinition.setTypeRef(makeQNameWithNamespace(itemDefinition.getTypeRef(), namespace)); } itemDefinition.setName(nameWithNamespace); setItemDefinitionsNamespace(itemComponents, namespace); return itemDefinition; }
Source:
DirectoryPersistence( Path path, long fsync, int version, List<Migration> migrations, MemoryStorage<T> storage ) { this( path, plainResolve(), fsync, version, migrations, storage ); }

Target:
public DirectoryPersistence( Path path, long fsync, int version, List<Migration> migrations, MemoryStorage<T> storage ) { this( path, plainResolve(), fsync, version, migrations, storage ); }
Source:
private CorfuRuntime createDefaultRuntimeUsingFollowBackpointers() { CorfuRuntime runtime = createRuntime(DEFAULT_ENDPOINT); runtime.getParameters().setFollowBackpointersEnabled(false) .setCacheDisabled(false); return runtime; }

Target:
private CorfuRuntime createDefaultRuntimeUsingFollowBackpointers() { CorfuRuntime runtime = createRuntime(DEFAULT_ENDPOINT); runtime.getParameters().setFollowBackpointersEnabled(true) .setCacheDisabled(false); return runtime; }
Source:
public void handle(PodEvent event) { final String podName = event.getPodName(); try { for (Entry<String, KubernetesMachineImpl> entry : machines.getMachines(runtimeIdentity).entrySet()) { final KubernetesMachineImpl machine = entry.getValue(); if (machine.getPodName().equals(podName)) { eventPublisher.sendMachineLogEvent( entry.getKey(), event.getMessage(), event.getCreationTimeStamp(), runtimeIdentity); return; } } } catch (InfrastructureException e) { LOG.error("Error while machine fetching for logs publishing. Cause: {}", e.getMessage()); } }

Target:
public void handle(PodEvent event) { final String podName = event.getPodName(); try { for (KubernetesMachineImpl machine : machines.getMachines(runtimeIdentity).values()) { if (machine.getPodName().equals(podName)) { eventPublisher.sendMachineLogEvent( machine.getName(), event.getMessage(), event.getCreationTimeStamp(), runtimeIdentity); return; } } } catch (InfrastructureException e) { LOG.error("Error while machine fetching for logs publishing. Cause: {}", e.getMessage()); } }
Source:
void resizeControl (int yScroll) { if (control != null && !control.isDisposed ()) { boolean visible = GTK.gtk_expander_get_expanded (handle); GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation (clientHandle, allocation); int x = (GTK.GTK3) ? 0 : allocation.x; int y = (GTK.GTK3) ? 0 : allocation.y; if (x != -1 && y != -1) { int width = allocation.width; int height = allocation.height; int property = new int [1]; GTK.gtk_widget_style_get (handle, OS.focus_line_width, property, 0); y += property [0] * 2; height -= property [0] * 2; ScrollBar vBar = parent.verticalBar; if (vBar != null) { if (GTK.gtk_widget_get_visible (vBar.handle)) { GTK.gtk_widget_get_allocation (parent.scrolledHandle, allocation); width = allocation.width - parent.vScrollBarWidth () - 2 * parent.spacing; } } if (GTK.GTK3) { GTK.gtk_widget_show(control.topHandle ()); control.setBounds (x, y, width, Math.max (0, height), true, true); } else { control.setBounds (x, y - yScroll, width, Math.max (0, height), true, true); } } control.setVisible (visible); } }

Target:
void resizeControl (int yScroll) { if (control != null && !control.isDisposed ()) { boolean visible = GTK.gtk_expander_get_expanded (handle); GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation (clientHandle, allocation); int x = (GTK.GTK3) ? 0 : allocation.x; int y = (GTK.GTK3) ? 0 : allocation.y; if (x != -1 && y != -1) { int width = allocation.width; int height = allocation.height; int property = new int [1]; GTK.gtk_widget_style_get (handle, OS.focus_line_width, property, 0); y += property [0] * 2; height -= property [0] * 2; ScrollBar vBar = parent.verticalBar; if (vBar != null) { if (GTK.gtk_widget_get_visible (vBar.handle)) { GTK.gtk_widget_get_allocation (parent.scrolledHandle, allocation); width = allocation.width - parent.vScrollBarWidth () - 2 * parent.spacing; } } if (GTK.GTK3) { if (visible) GTK.gtk_widget_show(control.topHandle ()); control.setBounds (x, y, width, Math.max (0, height), true, true); } else { control.setBounds (x, y - yScroll, width, Math.max (0, height), true, true); } } control.setVisible (visible); } }
Source:
public void produceRecord(String streamName, Record record) { String targetStream = metadata.map(streamName); if (!metadata.outputStreams().contains(targetStream)) { throw new IllegalArgumentException("Stream not registered as output: " + targetStream + ":" + streamName); } List<Record> records = streamRecords.getOrDefault(targetStream, new ArrayList<>()); records.add(record); streamRecords.putIfAbsent(targetStream, records); }

Target:
public void produceRecord(String streamName, Record record) { String targetStream = metadata.map(streamName); if (!metadata.outputStreams().contains(targetStream)) { throw new IllegalArgumentException("Stream not registered as output: " + targetStream + ":" + streamName); } streamRecords.computeIfAbsent(targetStream, key -> new ArrayList<>()).add(record); }
Source:
JsonUtf8Reader(JsonUtf8Reader copyFrom) { super(copyFrom); BufferedSource sourcePeek = copyFrom.source.peek(); this.source = sourcePeek; this.buffer = sourcePeek.getBuffer(); this.peeked = copyFrom.peeked; this.peekedLong = copyFrom.peekedLong; this.peekedNumberLength = copyFrom.peekedNumberLength; this.peekedString = copyFrom.peekedString; try { this.source.require(copyFrom.buffer.size()); } catch (IOException e) { throw new AssertionError(); } }

Target:
JsonUtf8Reader(JsonUtf8Reader copyFrom) { super(copyFrom); BufferedSource sourcePeek = copyFrom.source.peek(); this.source = sourcePeek; this.buffer = sourcePeek.getBuffer(); this.peeked = copyFrom.peeked; this.peekedLong = copyFrom.peekedLong; this.peekedNumberLength = copyFrom.peekedNumberLength; this.peekedString = copyFrom.peekedString; try { sourcePeek.require(copyFrom.buffer.size()); } catch (IOException e) { throw new AssertionError(); } }
Source:
public Response postAlias(final @PathParam("topology") String topology, final @PathParam("alias") String alias, final @FormParam("value") String value) { if (StringUtils.isBlank(value)) { return status(BAD_REQUEST). entity("Alias value cannot be null or blank"). type(MediaType.APPLICATION_JSON_TYPE).build(); } final AliasService as = getAliasService(); try { as.addAliasForCluster(topology, alias, value); return status(Response.Status.CREATED). entity("{ \"created\" : { \"topology\": \"" + topology + "\", \"alias\": \"" + alias + "\" } }"). type(MediaType.APPLICATION_JSON_TYPE). build(); } catch (AliasServiceException e) { return status(INTERNAL_SERVER_ERROR). entity("Error adding alias " + alias + " for cluster " + topology + ", reason: " + e.toString()). type(MediaType.APPLICATION_JSON_TYPE).build(); } }

Target:
public Response postAlias(final @PathParam("topology") String topology, final @PathParam("alias") String alias, final @FormParam("value") String value) { if (value == null || value.isEmpty()) { return status(BAD_REQUEST). entity("Alias value cannot be null or blank"). type(MediaType.APPLICATION_JSON_TYPE).build(); } final AliasService as = getAliasService(); try { as.addAliasForCluster(topology, alias, value); return status(Response.Status.CREATED). entity("{ \"created\" : { \"topology\": \"" + topology + "\", \"alias\": \"" + alias + "\" } }"). type(MediaType.APPLICATION_JSON_TYPE). build(); } catch (AliasServiceException e) { return status(INTERNAL_SERVER_ERROR). entity("Error adding alias " + alias + " for cluster " + topology + ", reason: " + e.toString()). type(MediaType.APPLICATION_JSON_TYPE).build(); } }
Source:
private void initWebView() { ViewCompat.setNestedScrollingEnabled(webView, true); client = new URLInterceptorWebViewClient(getActivity(), webView); client.setAllLinksAsExternal(isAllLinksExternal()); client.setPageStatusListener(pageStatusListener); }

Target:
private void initWebView() { client = new URLInterceptorWebViewClient(getActivity(), webView); client.setAllLinksAsExternal(isAllLinksExternal()); client.setPageStatusListener(pageStatusListener); }
Source:
public ObservationListResult getObservationByPatientUUIDAndConceptUUID(String configName, String patientUUID, String conceptUUID) { Validate.notEmpty(patientUUID, "Patient uuid cannot be empty"); Validate.notEmpty(conceptUUID, "Concept uuid cannot be empty"); try { Config config = configService.getConfigByName(configName); return obsResource.getObservationByPatientUUIDAndConceptUUID(config, patientUUID, conceptUUID); } catch (HttpClientErrorException e) { LOGGER.error("Error while fetching observations with Patient uuid: " + patientUUID + " and Concept uuid: " + conceptUUID); return null; } }

Target:
public ObservationListResult getObservationByPatientUUIDAndConceptUUID(String configName, String patientUUID, String conceptUUID) { Validate.notEmpty(patientUUID, "Patient uuid cannot be empty"); Validate.notEmpty(conceptUUID, "Concept uuid cannot be empty"); try { Config config = configService.getConfigByName(configName); return obsResource.getObservationByPatientUUIDAndConceptUUID(config, patientUUID, conceptUUID); } catch (HttpClientErrorException e) { throw new OpenMRSException(String.format("Could not get Observation for Patient uuid: %s and Concept: %s. %s %s", patientUUID, conceptUUID, e.getMessage(), e.getResponseBodyAsString()), e); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/toneMapping"); toneMappingMaterial.setFloat("viewingDistance", renderingConfig.getViewDistance().getChunkDistance().x * 8.0f, true); toneMappingMaterial.setFloat("daylight", backdropProvider.getDaylight(), true); toneMappingMaterial.setFloat("tick", worldRenderer.getMillisecondsSinceRenderingStart(), true); toneMappingMaterial.setFloat("sunlightValueAtPlayerPos", worldRenderer.getTimeSmoothedMainLightIntensity(), true); cameraDir = activeCamera.getViewingDirection(); cameraPosition = activeCamera.getPosition(); toneMappingMaterial.setFloat("swimming", activeCamera.isUnderWater() ? 1.0f : 0.0f, true); toneMappingMaterial.setFloat3("cameraPosition", cameraPosition.x, cameraPosition.y, cameraPosition.z, true); toneMappingMaterial.setFloat3("cameraDirection", cameraDir.x, cameraDir.y, cameraDir.z, true); toneMappingMaterial.setFloat3("cameraParameters", activeCamera.getzNear(), activeCamera.getzFar(), 0.0f, true); sunDirection = backdropProvider.getSunDirection(false); toneMappingMaterial.setFloat3("sunVec", sunDirection.x, sunDirection.y, sunDirection.z, true); toneMappingMaterial.setFloat("time", worldProvider.getTime().getDays(), true); toneMappingMaterial.setFloat("exposure", screenGrabber.getExposure() * exposureBias, true); toneMappingMaterial.setFloat("whitePoint", whitePoint, true); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/toneMapping"); toneMappingMaterial.setFloat("exposure", screenGrabber.getExposure() * exposureBias, true); toneMappingMaterial.setFloat("whitePoint", whitePoint, true); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
public void doCreateAccount(@NonNull String token) { String email = null; if (emailEdit.getText().length() != 0) { email = emailEdit.getText().toString(); } new CreateAccountTask(usernameEdit.getText().toString(), passwordEdit.getText().toString(), passwordRepeatEdit.getText().toString(), token, email) { @Override public void onBeforeExecute() { progressDialog.show(); } @Override public RequestBuilder buildRequest(Api api) { if (captchaHandler.isActive()) { return captchaHandler.populateBuilder(super.buildRequest(api)); } return super.buildRequest(api); } @Override public void onCatch(Throwable caught) { L.d("Caught " + caught.toString()); if (!progressDialog.isShowing()) { return; } progressDialog.dismiss(); FeedbackUtil.showError(CreateAccountActivity.this, caught); } @Override public void onFinish(final CreateAccountResult result) { if (!progressDialog.isShowing()) { return; } createAccountResult = result; if (result instanceof CreateAccountSuccessResult) { progressDialog.dismiss(); captchaHandler.cancelCaptcha(); funnel.logSuccess(); hideSoftKeyboard(CreateAccountActivity.this); Intent resultIntent = new Intent(); resultIntent.putExtra("username", ((CreateAccountSuccessResult) result).getUsername()); resultIntent.putExtra("password", passwordEdit.getText().toString()); setResult(RESULT_ACCOUNT_CREATED, resultIntent); finish(); } else if ("FAIL".equals(result.getStatus())) { progressDialog.dismiss(); captchaHandler.cancelCaptcha(); handleError(result.getMessage()); } } }.execute(); }

Target:
public void doCreateAccount(@NonNull String token) { String email = null; if (emailEdit.getText().length() != 0) { email = emailEdit.getText().toString(); } new CreateAccountTask(usernameEdit.getText().toString(), passwordEdit.getText().toString(), passwordRepeatEdit.getText().toString(), token, email) { @Override public void onBeforeExecute() { progressDialog.show(); } @Override public RequestBuilder buildRequest(Api api) { if (captchaHandler.isActive()) { return captchaHandler.populateBuilder(super.buildRequest(api)); } return super.buildRequest(api); } @Override public void onCatch(Throwable caught) { L.d("Caught " + caught.toString()); if (!progressDialog.isShowing()) { return; } progressDialog.dismiss(); FeedbackUtil.showError(CreateAccountActivity.this, caught); } @Override public void onFinish(final CreateAccountResult result) { if (!progressDialog.isShowing()) { return; } createAccountResult = result; if (result instanceof CreateAccountSuccessResult) { progressDialog.dismiss(); captchaHandler.cancelCaptcha(); funnel.logSuccess(); hideSoftKeyboard(CreateAccountActivity.this); Intent resultIntent = new Intent(); resultIntent.putExtra("username", ((CreateAccountSuccessResult) result).getUsername()); resultIntent.putExtra("password", passwordEdit.getText().toString()); setResult(RESULT_ACCOUNT_CREATED, resultIntent); finish(); } else { progressDialog.dismiss(); captchaHandler.cancelCaptcha(); handleError(result.getMessage()); } } }.execute(); }
Source:
public AwsSettings(AwsSettings other) { this.productTypeIsEc2 = other.productTypeIsEc2; this.isEc2Instance = other.isEc2Instance; this.productTypeIsJrsAmi = other.productTypeIsJrsAmi; this.awsRegions = new LinkedList<String>(other.awsRegions); this.productTypeIsMpAmi = other.productTypeIsMpAmi; this.suppressEc2CredentialsWarnings = other.suppressEc2CredentialsWarnings; }

Target:
public AwsSettings(AwsSettings other) { this.productTypeIsEc2 = other.productTypeIsEc2; this.isEc2Instance = other.isEc2Instance; this.productTypeIsJrsAmi = other.productTypeIsJrsAmi; this.awsRegions = (other.awsRegions != null) ? new LinkedList<String>(other.awsRegions) : null; this.productTypeIsMpAmi = other.productTypeIsMpAmi; this.suppressEc2CredentialsWarnings = other.suppressEc2CredentialsWarnings; }
Source:
public static void sendLocalizedHotBarMessageFromServer(@Nullable EntityPlayer player, String msg, Object... args) { if (player instanceof EntityPlayerMP && Game.isHost(player.worldObj)) { EntityPlayerMP target = (EntityPlayerMP) player; for (int i = 0; i < args.length; i++) { if (args[i] instanceof String) { args[i] = translateMessage((String) args[i]); } else if (args[i] instanceof GameProfile) { String username = ((GameProfile) args[i]).getName(); args[i] = username != null ? username : "[unknown]"; } } target.connection.sendPacket(new SPacketChat(translateMessage(msg, args), (byte) 2)); } }

Target:
public static void sendLocalizedHotBarMessageFromServer(@Nullable EntityPlayer player, String msg, Object... args) { if (player instanceof EntityPlayerMP && Game.isHost(player.worldObj)) { modifyArgs(args); ((EntityPlayerMP) player).connection.sendPacket(new SPacketChat(translateMessage(msg, args), (byte) 2)); } }
Source:
public void fetch(String remoteName, RefSpec refspec) throws GitException, InterruptedException { fetch(remoteName, refspec); }

Target:
public void fetch(String remoteName, RefSpec refspec) throws GitException, InterruptedException { fetch(remoteName, new RefSpec[] {refspec}); }
Source:
void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final OutputStream output) throws GeneralSecurityException, IOException; } public interface DecryptBytesHandler<T> { void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final T input) throws GeneralSecurityException, IOException; }

Target:
void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final OutputStream output) throws GeneralSecurityException, IOException; } public interface DecryptBytesHandler { void initialize(@NonNull final Cipher cipher, @NonNull final Key key, @NonNull final InputStream input) throws GeneralSecurityException, IOException; }
Source:
public Dirichlet(final double[] alpha) { Utils.nonNull(alpha); Arrays.stream(alpha).forEach(a -> ParamUtils.isPositive(a, "Dirichlet parameters must be positive.")); if (alpha.length < 1) { throw new IllegalArgumentException("Dirichlet parameters must have at least one element"); } this.alpha = Arrays.copyOf(alpha, alpha.length); }

Target:
public Dirichlet(final double[] alpha) { Utils.nonNull(alpha); Arrays.stream(alpha).forEach(a -> ParamUtils.isPositive(a, "Dirichlet parameters must be positive.")); Utils.validateArg(alpha.length > 0, "Dirichlet parameters must have at least one element"); this.alpha = Arrays.copyOf(alpha, alpha.length); }
Source:
private Boolean handleCancelResponse(String chargeExternalId, GatewayResponse<BaseCancelResponse> cancelResponse) { return cancelResponse.getBaseResponse() .map(r -> BaseCancelResponse.CancelStatus.CANCELLED.equals(r.cancelStatus()) || BaseCancelResponse.CancelStatus.SUBMITTED.equals(r.cancelStatus())) .orElseGet(() -> { cancelResponse.getGatewayError().ifPresent( e -> logger.info("Could not cancel charge {}. Gateway error {}", chargeExternalId, e.getMessage())); return false; }); }

Target:
private Boolean handleCancelResponse(String chargeExternalId, GatewayResponse<BaseCancelResponse> cancelResponse) { return cancelResponse.getBaseResponse() .map(r -> { if (BaseCancelResponse.CancelStatus.ERROR.equals(r.cancelStatus())) { logger.info("Could not cancel charge {}. Gateway returned error", chargeExternalId); return false; } else { return true; } }) .orElseGet(() -> { cancelResponse.getGatewayError().ifPresent( e -> logger.info("Could not cancel charge {}. Gateway error {}", chargeExternalId, e.getMessage())); return false; }); }
Source:
public boolean error(Throwable error) { return true; }

Target:
public void error(Throwable error) { }
Source:
protected BaseFileSystem(FileSystemContext fsContext) { mFsContext = fsContext; mBlockStore = AlluxioBlockStore.create(fsContext); mCloser.register(mFsContext); }

Target:
public BaseFileSystem(FileSystemContext fsContext) { mFsContext = fsContext; mBlockStore = AlluxioBlockStore.create(fsContext); mCloser.register(mFsContext); }
Source:
public SearchRequestBuilder buildScrollSearchRequest() { StringBuilder shardBuilder = new StringBuilder("_shards:"); shardBuilder.append(shard); SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index != null && !index.isEmpty() ? index : "_all").setTypes(type).setSearchType(SearchType.QUERY_AND_FETCH).setScroll(new TimeValue(scrollTime)).setQuery(buildSearchQuery()).setPreference(shardBuilder.toString()).setSize(scrollSize); log.info("ElasticSearch Request: " + searchRequestBuilder.toString()); return searchRequestBuilder; }

Target:
public SearchRequestBuilder buildScrollSearchRequest() { String indices = index != null && !index.isEmpty() ? index : "_all"; SearchRequestBuilder searchRequestBuilder = client.prepareSearch(indices) .setTypes(type) .setSearchType(SearchType.QUERY_THEN_FETCH) .setScroll(new TimeValue(scrollTimeout.toMillis())) .setQuery(buildSearchQuery()) .setPreference("_shards:" + shard) .setSize(scrollSize); log.debug("ElasticSearch Request: " + searchRequestBuilder.toString()); return searchRequestBuilder; }
Source:
private void processItemSets(File formMediaDir) { String relativeCsvFilePath = formMediaDir.getName() + File.separator + ITEMSETS_CSV; final File csv = new File(formMediaDir.getAbsolutePath() + "/" + ITEMSETS_CSV); String csvmd5 = null; if (csv.exists()) { csvmd5 = FileUtils.getMd5Hash(csv); boolean readFile = false; final ItemsetDbAdapter ida = new ItemsetDbAdapter(); ida.open(); final Cursor c = ida.getItemsets(relativeCsvFilePath); if (c != null) { if (c.getCount() == 1) { c.moveToFirst(); final String oldmd5 = c.getString(c.getColumnIndex("hash")); if (oldmd5.equals(csvmd5)) { } else { ida.dropTable(ItemsetDbAdapter.getMd5FromString(csv.getAbsolutePath()), relativeCsvFilePath); readFile = true; } } else { readFile = true; } c.close(); } ida.close(); if (readFile) { readCSV(csv, csvmd5, ItemsetDbAdapter.getMd5FromString(csv.getAbsolutePath()), relativeCsvFilePath); } } }

Target:
private void processItemSets(File formMediaDir) { final File csv = new File(formMediaDir.getAbsolutePath() + "/" + ITEMSETS_CSV); String csvmd5 = null; if (csv.exists()) { csvmd5 = FileUtils.getMd5Hash(csv); boolean readFile = false; final ItemsetDbAdapter ida = new ItemsetDbAdapter(); ida.open(); final Cursor c = ida.getItemsets(csv.getAbsolutePath()); if (c != null) { if (c.getCount() == 1) { c.moveToFirst(); final String oldmd5 = c.getString(c.getColumnIndex("hash")); if (oldmd5.equals(csvmd5)) { } else { ida.dropTable(ItemsetDbAdapter.getMd5FromString(csv.getAbsolutePath()), csv.getAbsolutePath()); readFile = true; } } else { readFile = true; } c.close(); } ida.close(); if (readFile) { readCSV(csv, csvmd5, ItemsetDbAdapter.getMd5FromString(csv.getAbsolutePath())); } } }
Source:
public InputStream getGenericThumbnailInputStream(String fallback) throws IOException { String thumb = fallback; if (format != null && format.getIcon() != null) { thumb = format.getIcon(); } InputStream is; if (thumb != null && isCodeValid(this)) { if (new File(thumb).exists()) { return new FileInputStream(thumb); } if ((is = getResourceInputStream(thumb)) != null) { return is; } try { return downloadAndSend(thumb, true); } catch (Exception e) } if (media != null) { BufferedImage bi; if (media.isAudio()) { bi = PMS.getGenericAudioIcon(); } else if (media.isImage()) { bi = PMS.getGenericImageIcon(); } else if (media.isVideo()) { bi = PMS.getGenericVideoIcon(); } else { bi = PMS.getGenericUnknownIcon(); } is = ImagesUtil.addFormatLabelToImage(bi, media.getContainer(), defaultRenderer != null && defaultRenderer.isForceJPGThumbnails() ? "jpeg" : "png"); if (is != null) { LOGGER.trace("Created default thumbnail/icon for the media: {}", getName()); return is; } } String defaultThumbnailImage = "images/thumbnail-video-256.png"; if (isFolder()) { defaultThumbnailImage = "images/thumbnail-folder-256.png"; if (defaultRenderer != null && defaultRenderer.isForceJPGThumbnails()) { defaultThumbnailImage = "images/thumbnail-folder-120.jpg"; } } else if (defaultRenderer != null && defaultRenderer.isForceJPGThumbnails()) { defaultThumbnailImage = "images/thumbnail-video-120.jpg"; } LOGGER.debug("use def thumb " + defaultThumbnailImage); return getResourceInputStream(defaultThumbnailImage); }

Target:
public final DLNAThumbnailInputStream getGenericThumbnailInputStream(String fallback) throws IOException { DLNAThumbnailInputStream inputStream = getGenericThumbnailInputStreamInternal(fallback); thumbnailImageInfo = inputStream.getImageInfo(); return inputStream; }
Source:
public SegmentMetadataQueryTest() { testQuery = Druids.newSegmentMetadataQueryBuilder() .dataSource("testing") .intervals("2013/2014") .toInclude(new ListColumnIncluderator(Arrays.asList("placement"))) .merge(true) .build(); expectedSegmentAnalysis = new SegmentAnalysis( "testSegment", ImmutableList.of( new Interval("2011-01-12T00:00:00.000Z/2011-04-15T00:00:00.001Z") ), ImmutableMap.of( "placement", new ColumnAnalysis( ValueType.STRING.toString(), 10881, 2, null ) ), 73191 ); }

Target:
public SegmentMetadataQueryTest() { testQuery = Druids.newSegmentMetadataQueryBuilder() .dataSource("testing") .intervals("2013/2014") .toInclude(new ListColumnIncluderator(Arrays.asList("placement"))) .analysisTypes(null) .merge(true) .build(); expectedSegmentAnalysis = new SegmentAnalysis( "testSegment", ImmutableList.of( new Interval("2011-01-12T00:00:00.000Z/2011-04-15T00:00:00.001Z") ), ImmutableMap.of( "placement", new ColumnAnalysis( ValueType.STRING.toString(), 10881, 2, null ) ), 71982, 1209 ); }
Source:
public <T> Optional<T> showChoiceDialogAndWait(String title, String content, String okButtonLabel, T defaultChoice, Collection<T> choices) { ChoiceDialog<T> choiceDialog = new ChoiceDialog<>(defaultChoice, choices); ((Stage) choiceDialog.getDialogPane().getScene().getWindow()).getIcons().add(IconTheme.getJabRefImageFX()); ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.OK_DONE); choiceDialog.getDialogPane().getButtonTypes().setAll(ButtonType.CANCEL, okButtonType); choiceDialog.setHeaderText(title); choiceDialog.setTitle(title); choiceDialog.setContentText(content); Globals.getThemeLoader().installCss(choiceDialog.getDialogPane().getScene(), Globals.prefs); return choiceDialog.showAndWait(); }

Target:
public <T> Optional<T> showChoiceDialogAndWait(String title, String content, String okButtonLabel, T defaultChoice, Collection<T> choices) { ChoiceDialog<T> choiceDialog = new ChoiceDialog<>(defaultChoice, choices); ((Stage) choiceDialog.getDialogPane().getScene().getWindow()).getIcons().add(IconTheme.getJabRefImageFX()); ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.OK_DONE); choiceDialog.getDialogPane().getButtonTypes().setAll(ButtonType.CANCEL, okButtonType); choiceDialog.setHeaderText(title); choiceDialog.setTitle(title); choiceDialog.setContentText(content); themeLoader.installCss(choiceDialog.getDialogPane().getScene(), preferences); return choiceDialog.showAndWait(); }
Source:
TDigestGenerateSketchSqlAggFunction() { super( NAME, null, SqlKind.OTHER_FUNCTION, ReturnTypes.explicit(SqlTypeName.OTHER), null, OperandTypes.and( OperandTypes.sequence(SIGNATURE2, OperandTypes.ANY, OperandTypes.LITERAL), OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.NUMERIC) ), SqlFunctionCategory.USER_DEFINED_FUNCTION, false, false ); }

Target:
TDigestGenerateSketchSqlAggFunction() { super( NAME, null, SqlKind.OTHER_FUNCTION, ReturnTypes.explicit(SqlTypeName.OTHER), null, OperandTypes.or( OperandTypes.ANY, OperandTypes.and( OperandTypes.sequence(SIGNATURE_WITH_COMPRESSION, OperandTypes.ANY, OperandTypes.LITERAL), OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.NUMERIC) ) ), SqlFunctionCategory.USER_DEFINED_FUNCTION, false, false ); }