auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected List<ServerName> fetchSlavesAddresses() { try { AsyncClusterConnection peerConn = getPeerConnection(); ServerName master = FutureUtils.get(peerConn.getAdmin().getMaster()); MasterService.BlockingInterface masterStub = MasterService.newBlockingStub( peerConn.getRpcClient() .createBlockingRpcChannel(master, User.getCurrent(), shortOperationTimeout)); ListReplicationSinkServersResponse resp = masterStub .listReplicationSinkServers(null, ListReplicationSinkServersRequest.newBuilder().build()); isReplicationServer = resp.getIsReplicationServer(); return ProtobufUtil.toServerNameList(resp.getServerNameList()); } catch (ServiceException | IOException e) { LOG.error("Peer fetches servers failed", ctx.getPeerId(), e); } return Collections.emptyList(); }

Target:
protected List<ServerName> fetchSlavesAddresses() throws IOException { try { ServerName master = FutureUtils.get(conn.getAdmin().getMaster()); MasterService.BlockingInterface masterStub = MasterService.newBlockingStub( conn.getRpcClient().createBlockingRpcChannel(master, User.getCurrent(), operationTimeout)); ListReplicationSinkServersResponse resp = masterStub .listReplicationSinkServers(null, ListReplicationSinkServersRequest.newBuilder().build()); return ProtobufUtil.toServerNameList(resp.getServerNameList()); } catch (ServiceException e) { LOG.error("Peer fetches servers failed", ctx.getPeerId(), e); throw ProtobufUtil.getRemoteException(e); } catch (IOException e) { LOG.error("Peer fetches servers failed", ctx.getPeerId(), e); throw e; } }
Source:
public void testCreateBootstrapDatastream() throws IOException, DatastreamException, RemoteInvocationException { Datastream bootstrapDatastream = generateDatastream(3); LOG.info("Bootstrap datastream : " + bootstrapDatastream); DatastreamRestClient restClient = new DatastreamRestClient("http://localhost:8080/"); restClient.createBootstrapDatastream(bootstrapDatastream); Datastream createdDatastream = restClient.getDatastream(bootstrapDatastream.getName()); LOG.info("Created Datastream : " + createdDatastream); Assert.assertEquals(bootstrapDatastream.getName(), createdDatastream.getName()); }

Target:
public void testCreateBootstrapDatastream() throws IOException, DatastreamException, RemoteInvocationException { Datastream bootstrapDatastream = generateDatastream(3); LOG.info("Bootstrap datastream : " + bootstrapDatastream); DatastreamRestClient restClient = new DatastreamRestClient("http://localhost:8080/"); restClient.createBootstrapDatastream(bootstrapDatastream); Datastream createdDatastream = restClient.getDatastream(bootstrapDatastream.getName()); LOG.info("Created Datastream : " + createdDatastream); Assert.assertEquals(bootstrapDatastream.getName(), createdDatastream.getName()); Assert.assertEquals(bootstrapDatastream.getConnectorType(), createdDatastream.getConnectorType()); }
Source:
private static void setUpTable() { items.clear(); itemTable.getColumns().clear(); itemTable.setItems(items); items.addAll(Style.getAndy(), Style.getBoy(), Style.getCaptain(), Style.getIronMan(), Style.getNoob(), Style.getPlank()); TableColumn<AbstractSkin, String> name = new TableColumn<>("Name"); name.setCellValueFactory(new PropertyValueFactory<>("skinName")); name.setResizable(false); TableColumn<AbstractSkin, Integer> price = new TableColumn<>("Price"); price.setCellValueFactory(new PropertyValueFactory<>("skinPrice")); name.setResizable(false); itemTable.getColumns().add(name); itemTable.getColumns().add(price); itemTable.setRowFactory(e -> { TableRow<AbstractSkin> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && (!row.isEmpty())) { State.setSkin(row.getItem()); } }); return row; }); }

Target:
private static void setUpTable() { items.clear(); itemTable.getColumns().clear(); itemTable.setItems(items); itemTable.setTooltip(new Tooltip("Double click to change appearance")); items.addAll(Style.getAndy(), Style.getBoy(), Style.getCaptain(), Style.getIronMan(), Style.getNoob(), Style.getPlank()); final TableColumn<Skin, String> name = new TableColumn<>("Name"); name.setCellValueFactory(new PropertyValueFactory<>("skinName")); name.setResizable(false); final TableColumn<Skin, Integer> price = new TableColumn<>("Price"); price.setCellValueFactory(new PropertyValueFactory<>("skinPrice")); name.setResizable(false); itemTable.getColumns().add(name); itemTable.getColumns().add(price); itemTable.setRowFactory(e -> { final TableRow<Skin> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && !row.isEmpty()) { State.setSkin(row.getItem()); } }); return row; }); }
Source:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); TestTcpDiscoverySpi discoSpi = (TestTcpDiscoverySpi)cfg.getDiscoverySpi(); DiscoveryHook discoveryHook = new DiscoveryHook() { @Override public void beforeDiscovery(DiscoverySpiCustomMessage msg) { DiscoveryCustomMessage customMsg = msg == null ? null : (DiscoveryCustomMessage)IgniteUtils.field(msg, "delegate"); if (customMsg instanceof MetadataUpdateAcceptedMessage) { try { U.sleep(50); } catch (IgniteInterruptedCheckedException e) { fail("Unexpected error:" + e); } } } }; discoSpi.discoveryHooks(discoveryHook); discoSpi.setIpFinder(IP_FINDER); cfg.setPeerClassLoadingEnabled(true); return cfg; }

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TestTcpDiscoverySpi)cfg.getDiscoverySpi()).discoveryHook(new DiscoveryHook() { @Override public void beforeDiscovery(DiscoveryCustomMessage customMsg) { if (customMsg instanceof MetadataUpdateAcceptedMessage) { try { U.sleep(50); } catch (IgniteInterruptedCheckedException e) { fail("Unexpected error:" + e); } } } }); cfg.setPeerClassLoadingEnabled(true); return cfg; }
Source:
public MoveToBlockAITask.Builder from(MoveToBlockAITask value) { return this.speed(value.getSpeed()).searchRange(value.getSearchRange()); }

Target:
public MoveToBlockAITask.Builder from(MoveToBlockAITask value) { if (!((IMixinEntityAIMoveToBlock) value).isVanillaTask()) { destinationPredicate(value.getDestinationPredicate()); } return this.speed(value.getSpeed()).searchRange(value.getSearchRange()); }
Source:
public void setValueFactory(SymbolicValueFactory valueFactory) { if (symbolicValueFactory != null) { throw new IllegalStateException("The symbolic value factory has already been defined by another checker!"); } symbolicValueFactory = valueFactory; }

Target:
public void setValueFactory(SymbolicValueFactory valueFactory) { Preconditions.checkState(symbolicValueFactory == null, "The symbolic value factory has already been defined by another checker!"); symbolicValueFactory = valueFactory; }
Source:
private Collection<VCastResult> getResultFiles(VCastDataStore dataStore) { Collection<VCastResult> results = null; try { results = dataStore.getAllResults(); } catch (OseeCoreException ex) { throw new OseeCoreException(ex, "SQL error while reading results"); } return results; }

Target:
private Collection<VCastResult> getResultFiles(VCastDataStore dataStore) { Collection<VCastResult> results = null; results = dataStore.getAllResults(); return results; }
Source:
public StudentProfileEditBox(String name, String isEditingPhoto, StudentProfileAttributes profile, String googleId, String pictureUrl) { this.name = name; this.editingPhoto = isEditingPhoto; this.shortName = StringHelper.convertToEmptyStringIfNull(profile.shortName); this.email = StringHelper.convertToEmptyStringIfNull(profile.email); this.institute = StringHelper.convertToEmptyStringIfNull(profile.institute); this.nationality = StringHelper.convertToEmptyStringIfNull(profile.nationality); this.nationalitySelectField = PageData.getNationalitiesAsElementTags(profile.nationality); this.legacyNationality = PageData.getLegacyNationalityInstructions(profile.nationality); this.gender = profile.gender; this.moreInfo = StringHelper.convertToEmptyStringIfNull(profile.moreInfo); this.googleId = googleId; this.pictureUrl = pictureUrl; }

Target:
public StudentProfileEditBox(String name, String isEditingPhoto, StudentProfileAttributes profile, String googleId, String pictureUrl) { this.name = name; this.editingPhoto = isEditingPhoto; this.shortName = StringHelper.convertToEmptyStringIfNull(profile.shortName); this.email = StringHelper.convertToEmptyStringIfNull(profile.email); this.institute = StringHelper.convertToEmptyStringIfNull(profile.institute); this.nationality = StringHelper.convertToEmptyStringIfNull(profile.nationality); this.nationalitySelectField = PageData.getNationalitiesAsElementTags(profile.nationality); this.legacyNationalityInstructions = PageData.getLegacyNationalityInstructions(profile.nationality); this.gender = profile.gender; this.moreInfo = StringHelper.convertToEmptyStringIfNull(profile.moreInfo); this.googleId = googleId; this.pictureUrl = pictureUrl; }
Source:
private void addCapability0(CapReqBuilder builder) { builder.setResource(resource); CapReqBuilder previous = capabilities.putIfAbsent(builder, builder); }

Target:
private Capability addCapability0(CapReqBuilder builder) { Capability cap = buildCapability(builder); Capability previous = capabilities.put(cap, cap); if (previous != null) { return previous; } return cap; }
Source:
public BuildImageCmd withNoCache(Boolean noCache) { this.noCache = noCache; return this; }

Target:
public BuildImageCmdImpl withNoCache(Boolean noCache) { this.noCache = noCache; return this; }
Source:
private void logZkConnectString() { String zkConnectFromEnv = environment.resolvePlaceholders(ZK_CONNECT_OPTION); String zkClientConnect = (StringUtils.hasText(zkConnectFromEnv)) ? zkConnectFromEnv : ZooKeeperConnection.DEFAULT_CLIENT_CONNECT_STRING; logger.info("Zookeeper Client-Connect String(s): " + zkClientConnect); }

Target:
private void logZkConnectString() { String zkConnectString = environment.resolvePlaceholders(ZK_CONNECT_OPTION); Assert.isTrue(StringUtils.hasText(zkConnectString) && !zkConnectString.equals(ZK_CONNECT_OPTION)); logger.info("Zookeeper Client-Connect String(s): " + zkConnectString); }
Source:
protected void executeCommand() { VmHandler.LockVm(getVm().getDynamicData(), getCompensationContext()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType .MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); return null; } }); }

Target:
protected void executeCommand() { VmHandler.checkStatusAndLockVm(getVm().getvm_guid()); VdcReturnValueBase retVal = Backend.getInstance().runInternalAction(VdcActionType.MoveOrCopyImageGroup, createMoveorCopyImageGroupParams()); handleResult(retVal); }
Source:
private void download() { try { File random = new File(Directories.getCachePath() + File.separator + "randoms.jar"); if (random.exists()) { Core.verbose("Public random dependency already exists, no need to download it..."); return; } String downloadLink = ((Configuration.BOT_VERSION.isNightly()) ? Configuration.GET_RANDOMS + "?stable=false" : Configuration.GET_RANDOMS); WebUtil.downloadFile(new URL(downloadLink), random, new NoProgressListener()); } catch (Exception e) { e.printStackTrace(); } }

Target:
private void download() { try { File random = new File(Directories.getCachePath() + File.separator + fileName); if (random.exists()) { Core.verbose("Public random dependency already exists, no need to download it..."); return; } String downloadLink = ((Configuration.BOT_VERSION.isNightly()) ? Configuration.GET_RANDOMS + Configuration.NIGHTLY_APPEND : Configuration.GET_RANDOMS); WebUtil.downloadFile(new URL(downloadLink), random, new NoProgressListener()); } catch (Exception e) { e.printStackTrace(); } }
Source:
public static double computeArea(Point a, Point b) { final double x1 = a.getTimestamp(); final double x2 = b.getTimestamp(); if (x1 > x2) { throw new IllegalArgumentException("timestamp of b needs to be greater than a"); } if (x1 == x2) { return 0; } final double y1 = a.getValue(); final double y2 = b.getValue(); if (sameSign(y1, y2)) { final double area = areaPositivePoints(x1, Math.abs(y1), x2, Math.abs(y2)); return Math.copySign(area, y1); } else { final double interceptsX = computeInterceptsX(x1, x2, y1, y2); final double area1 = areaPositivePoints(x1, Math.abs(y1), interceptsX, 0); final double area2 = areaPositivePoints(interceptsX, 0, x2, Math.abs(y2)); return Math.copySign(area1, y1) + Math.copySign(area2, y2); } }

Target:
public static double computeArea(Point a, Point b) { if (a.getTimestamp() == b.getTimestamp()) { return 0; } if (a.getTimestamp() > b.getTimestamp()) { return computeArea(b, a); } final double x1 = a.getTimestamp(); final double x2 = b.getTimestamp(); final double y1 = a.getValue(); final double y2 = b.getValue(); if (sameSign(y1, y2)) { final double area = areaPositivePoints(x1, Math.abs(y1), x2, Math.abs(y2)); return Math.copySign(area, y1); } else { final double interceptsX = computeInterceptsX(x1, x2, y1, y2); final double area1 = areaPositivePoints(x1, Math.abs(y1), interceptsX, 0); final double area2 = areaPositivePoints(interceptsX, 0, x2, Math.abs(y2)); return Math.copySign(area1, y1) + Math.copySign(area2, y2); } }
Source:
public NoSuchPartitionKeyException(String tableName, String partitionKey) { super(String.format("ERROR: partition column \"%s\" does not exist in \"%s\".", partitionKey, tableName)); }

Target:
public NoSuchPartitionKeyException(String tableName, String partitionKey) { super(String.format("ERROR: \"%s\" column is not the partition key of \"%s\".", partitionKey, tableName)); }
Source:
public AxisConfiguration(GraphData data) throws JSONException, InvalidStateException { super(data); JSONObject x = new JSONObject(); JSONObject y = new JSONObject(); JSONObject y2 = new JSONObject(); if (Boolean.valueOf(mData.getConfiguration("show-axes", "true")).equals(Boolean.FALSE)) { JSONObject show = new JSONObject("{ show: false }"); x = show; y = show; y2 = show; } else { JSONObject padding = new JSONObject("{top: 0, right: 0, bottom: 0, left: 0}"); x.put("padding", padding); y.put("padding", padding); y2.put("padding", padding); addTitle(x, "x-title", "outer-center"); addTitle(y, "y-title", "outer-middle"); addTitle(y2, "secondary-y-title", "outer-middle"); addBounds(x, "x"); addBounds(y, "y"); addBounds(y2, "secondary-y"); for (SeriesData s : mData.getSeries()) { if (Boolean.valueOf(s.getConfiguration("secondary-y", "false")).equals(Boolean.TRUE)) { y2.put("show", true); break; } } addTickConfig(x, "x-labels", "xLabels"); addTickConfig(y, "y-labels", "yLabels"); addTickConfig(y2, "secondary-y-labels", "y2Labels"); } mConfiguration.put("x", x); mConfiguration.put("y", y); mConfiguration.put("y2", y2); if (mData.getType().equals(Graph.TYPE_BAR) && !mData.getConfiguration("bar-orientation", "horizontal").equalsIgnoreCase("vertical")) { mConfiguration.put("rotated", true); } }

Target:
public AxisConfiguration(GraphData data) throws JSONException, InvalidStateException { super(data); JSONObject x = getAxis("x"); JSONObject y = getAxis("y"); JSONObject y2 = getAxis("secondary-y"); for (SeriesData s : mData.getSeries()) { boolean hasSecondaryAxis = Boolean.valueOf(s.getConfiguration("secondary-y", "false")); if (hasSecondaryAxis) { y2.put("show", true); break; } } mConfiguration.put("x", x); mConfiguration.put("y", y); mConfiguration.put("y2", y2); if (mData.getType().equals(Graph.TYPE_BAR) && !mData.getConfiguration("bar-orientation", "horizontal").equalsIgnoreCase("vertical")) { mConfiguration.put("rotated", true); } }
Source:
public CompletableFuture<Void> putAsync(K key, V value) { put(key, value); return CompletableFuture.completedFuture(null); }

Target:
public CompletableFuture<Void> putAsync(K key, V value) { if (key == null) { return deleteAsync(key); } CompletableFuture<Void> future = new CompletableFuture<>(); try { cache.put(key, value); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
Source:
public synchronized void deleteAll(List<K> keys) { Preconditions.checkNotNull(rwTable, "Cannot delete from a read-only table: " + rdTable); keys.stream().forEach(k -> { cache.delete(k); rwTable.delete(k); }); }

Target:
public void deleteAll(List<K> keys) { Preconditions.checkNotNull(rwTable, "Cannot delete from a read-only table: " + rdTable); keys.stream().forEach(k -> delete(k)); }
Source:
public static void listObject_test5() throws Exception { System.out.println("Test: recursive: listObjects(final String bucketName, final String prefix, " + "final boolean recursive)"); String[] objectNames = new String[1050]; int i = 0; for (i = 0; i < 1050; i++) { objectNames[i] = getRandomName(); InputStream is = new ContentInputStream(1); client.putObject(bucketName, objectNames[i], is, 1, null); is.close(); } i = 0; for (Result<?> r : client.listObjects(bucketName, "minio", true)) { ignore(i++, r.get()); } if (i != 1050) { throw new Exception("[FAILED] Test: recursive: listObject_test5(), number of items, expected: 1050, " + "found: " + i); } for (i = 0; i < 1050; i++) { client.removeObject(bucketName, objectNames[i]); } }

Target:
public static void listObject_test5() throws Exception { System.out.println("Test: recursive: listObjects(final String bucketName, final String prefix, " + "final boolean recursive)"); int objCount = 1050; String[] objectNames = new String[objCount]; int i = 0; for (i = 0; i < objCount; i++) { objectNames[i] = getRandomName(); InputStream is = new ContentInputStream(1); client.putObject(bucketName, objectNames[i], is, 1, null); is.close(); } i = 0; for (Result<?> r : client.listObjects(bucketName, "minio", true)) { ignore(i++, r.get()); } if (i != objCount) { throw new Exception("[FAILED] Test: recursive: listObject_test5(), number of items, expected: " + objCount + ", found: " + i); } for (i = 0; i < objCount; i++) { client.removeObject(bucketName, objectNames[i]); } }
Source:
public String ensureFolderOnPath(String existingPath, String folder) { existingPath = (existingPath == null ? "" : existingPath); String[] roots = null; if( existingPath.isEmpty() && pathCommand != null) { String pathresult = runCommand(pathCommand, false); roots = pathresult.split(delim); } else roots = existingPath.split(delim); ArrayList<String> list = new ArrayList(Arrays.asList(roots)); if( !list.contains(folder)) { list.add(folder); } return String.join(delim, list); }

Target:
public String ensureFolderOnPath(String existingPath, String folder) { existingPath = (existingPath == null ? "" : existingPath); String[] roots = null; if( existingPath.isEmpty() && pathCommand != null) { String pathresult = runCommand(pathCommand); roots = pathresult.split(delim); } else roots = existingPath.split(delim); ArrayList<String> list = new ArrayList<String>(Arrays.asList(roots)); if( !list.contains(folder)) { list.add(folder); } return String.join(delim, list); }
Source:
public void testBindingCteAssociationToEntityId() { transactional(new TxVoidWork() { @Override public void work(EntityManager em) { CriteriaBuilder<MyEntity> select = cbf.create(em, MyEntity.class) .withRecursive(Cte.class) .from(MyEntity.class, "a") .bind("myEntity").select("a.id") .bind("id").select("1") .unionAll() .from(MyEntity.class, "a") .where("a.attribute").eq("bogus") .bind("myEntity").select("a.id") .bind("id").select("1") .end() .from(Cte.class) .select("myEntity"); List<MyEntity> resultList = select .getResultList(); String sql = ((CustomSQLTypedQuery) select.getQuery()).getQuerySpecification().getSql(); String cteBase = sql.substring(sql.indexOf("\nselect") + 1, sql.lastIndexOf("UNION ALL") - 1); String cteRecursivePart = sql.substring(sql.indexOf("UNION ALL")+10, sql.lastIndexOf("select")-3); String queryPart = sql.substring(sql.lastIndexOf("select")); assertEquals("Recursive base part should project 2 columns separated by a single comma", cteBase.indexOf(","), cteBase.lastIndexOf(",")); assertEquals("Recursive part should project 2 columns separated by a single comma", cteRecursivePart.indexOf(","), cteRecursivePart.lastIndexOf(",")); assertEquals("Final query should project 2 columns separated by a single comma", queryPart.indexOf(","), queryPart.lastIndexOf(",")); } }); }

Target:
public void testBindingCteAssociationToEntityId() { expectedException.expectMessage("An association should be bound to its association type and not its identifier type"); transactional(new TxVoidWork() { @Override public void work(EntityManager em) { CriteriaBuilder<MyEntity> select = cbf.create(em, MyEntity.class) .withRecursive(Cte.class) .from(MyEntity.class, "a") .bind("myEntity").select("a.id") .bind("id").select("1") .unionAll() .from(MyEntity.class, "a") .where("a.attribute").eq("bogus") .bind("myEntity").select("a.id") .bind("id").select("1") .end() .from(Cte.class) .select("myEntity"); select.getResultList(); String sql = ((CustomSQLTypedQuery) select.getQuery()).getQuerySpecification().getSql(); String cteBase = sql.substring(sql.indexOf("\nselect") + 1, sql.lastIndexOf("UNION ALL") - 1); String cteRecursivePart = sql.substring(sql.indexOf("UNION ALL")+10, sql.lastIndexOf("select")-3); String queryPart = sql.substring(sql.lastIndexOf("select")); assertEquals("Recursive base part should project 2 columns separated by a single comma", cteBase.indexOf(","), cteBase.lastIndexOf(",")); assertEquals("Recursive part should project 2 columns separated by a single comma", cteRecursivePart.indexOf(","), cteRecursivePart.lastIndexOf(",")); assertEquals("Final query should project 2 columns separated by a single comma", queryPart.indexOf(","), queryPart.lastIndexOf(",")); } }); }
Source:
public ModelNode getAddOperation() { ModelNode addOperation = Util.createAddOperation(address); addOperation.get("authentication-realm").set(authenticationRealm); if (authorizationRealm != null) { addOperation.get("authorization-realm").set(authorizationRealm); } if (authorizationRealms != null) { ModelNode realms = addOperation.get("authorization-realms"); for (String realmName : authorizationRealms) { realms.add(realmName); } } return addOperation; }

Target:
public ModelNode getAddOperation() { ModelNode addOperation = Util.createAddOperation(address); addOperation.get("authentication-realm").set(authenticationRealm); if (authorizationRealm != null) { addOperation.get("authorization-realm").set(authorizationRealm); } if (authorizationRealms != null) { ModelNode realms = addOperation.get("authorization-realms"); for (String realmName : authorizationRealms) { realms.add(realmName); } } if (principalTransformer != null) { addOperation.get("principal-transformer").set(principalTransformer); } return addOperation; }
Source:
private Collection<VCastInstrumentedFile> getInstrumentedFiles(VCastDataStore dataStore) { Collection<VCastInstrumentedFile> instrumentedFiles = new ArrayList<VCastInstrumentedFile>(); try { instrumentedFiles = dataStore.getAllInstrumentedFiles(); } catch (OseeCoreException ex) { } if (instrumentedFiles.isEmpty()) { } return instrumentedFiles; }

Target:
private Collection<VCastInstrumentedFile> getInstrumentedFiles(VCastDataStore dataStore) { Collection<VCastInstrumentedFile> instrumentedFiles = new ArrayList<VCastInstrumentedFile>(); try { instrumentedFiles = dataStore.getAllInstrumentedFiles(); } catch (OseeCoreException ex) { throw new OseeCoreException(ex, "SQL error while reading functions for directory: ", vCastDir); } return instrumentedFiles; }
Source:
public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Ds3Element)) { return false; } final Ds3Element element = (Ds3Element) obj; return Objects.equals(this.getName(), element.getName()) && Objects.equals(this.getType(), element.getType()) && Objects.equals(this.getComponentType(), element.getComponentType()); }

Target:
public boolean equals(final Object obj) { if (obj == this) { return true; } if (!(obj instanceof Ds3Element)) { return false; } final Ds3Element element = (Ds3Element) obj; return this.getName().equals(element.getName()) && this.getType().equals(element.getType()) && (this.getComponentType() == null ? element.getComponentType() == null : this.getComponentType().equals(element.getComponentType())); }
Source:
private Class<?> loadClass(String className) { Class<?> clazz = null; try { clazz = classLoader.loadClass(className); } catch (ClassNotFoundException ex) { } if (clazz == null) { throw new ClassFileInfoException("Unable to load class " + className); } return clazz; }

Target:
private Class<?> loadClass(String className) { log.trace("Loading class with class loader: " + className); Class<?> clazz = null; try { clazz = classLoader.loadClass(className); } catch (ClassNotFoundException ex) { throw new ClassFileInfoException("Unable to load class " + className); } return clazz; }
Source:
private Map<String, Class<?>> loadExtensionClasses() { cacheDefaultExtensionName(); Map<String, Class<?>> extensionClasses = new HashMap<String, Class<?>>(); loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName()); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); return extensionClasses; }

Target:
private Map<String, Class<?>> loadExtensionClasses() { cacheDefaultExtensionName(); Map<String, Class<?>> extensionClasses = new HashMap<>(); loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_INTERNAL_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName()); loadDirectory(extensionClasses, DUBBO_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName()); loadDirectory(extensionClasses, SERVICES_DIRECTORY, type.getName().replace("org.apache", "com.alibaba")); return extensionClasses; }
Source:
public void testManualDocumentMovedToFolderRule() throws InterruptedException { RetentionRule testRule = createManualEventBasedRuleMillis(DocumentEventTypes.DOCUMENT_MOVED, "document.getPathAsString().startsWith('/testFolder')", 1000L); file = service.attachRule(file, testRule, session); assertTrue(file.isRecord()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); Record record = file.getAdapter(Record.class); assertTrue(record.isRetainUntilInderterminate()); awaitRetentionExpiration(500L); file = session.getDocument(file.getRef()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); record = file.getAdapter(Record.class); assertTrue(record.isRetainUntilInderterminate()); DocumentModel folder = session.createDocumentModel("/", "testFolder", "Folder"); folder = session.createDocument(folder); folder = session.saveDocument(folder); file = session.move(file.getRef(), folder.getRef(), null); awaitRetentionExpiration(500L); record = file.getAdapter(Record.class); assertFalse(record.isRetainUntilInderterminate()); assertFalse(record.isRetentionExpired()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); awaitRetentionExpiration(500L); file = session.getDocument(file.getRef()); record = file.getAdapter(Record.class); assertFalse(session.isUnderRetentionOrLegalHold(file.getRef())); assertTrue(record.isRetentionExpired()); }

Target:
public void testManualDocumentMovedToFolderRule() throws InterruptedException { RetentionRule testRule = createManualEventBasedRuleMillis(DocumentEventTypes.DOCUMENT_MOVED, "document.getPathAsString().startsWith('/testFolder')", 1000); file = service.attachRule(file, testRule, session); assertTrue(file.isRecord()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); Record record = file.getAdapter(Record.class); assertTrue(record.isRetentionIndeterminate()); awaitRetentionExpiration(500); file = session.getDocument(file.getRef()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); record = file.getAdapter(Record.class); assertTrue(record.isRetentionIndeterminate()); DocumentModel folder = session.createDocumentModel("/", "testFolder", "Folder"); folder = session.createDocument(folder); folder = session.saveDocument(folder); file = session.move(file.getRef(), folder.getRef(), null); awaitRetentionExpiration(500); record = file.getAdapter(Record.class); assertFalse(record.isRetentionIndeterminate()); assertFalse(record.isRetentionExpired()); assertTrue(session.isUnderRetentionOrLegalHold(file.getRef())); awaitRetentionExpiration(500); file = session.getDocument(file.getRef()); record = file.getAdapter(Record.class); assertFalse(session.isUnderRetentionOrLegalHold(file.getRef())); assertTrue(record.isRetentionExpired()); }
Source:
private void onShareClicked() { String timestamp = !isLive() ? "&t=" + getPlaybackSeekBar().getProgress() / 1000 : ""; ShareUtils.shareUrl(service, getVideoTitle(), getVideoUrl() + timestamp); }

Target:
private void onShareClicked() { final String ts = isLive() ? "" : ("&t=" + (getPlaybackSeekBar().getProgress() / 1000)); ShareUtils.shareUrl(service, getVideoTitle(), getVideoUrl() + ts); }
Source:
public void onConfirmation(String callerTag) { Activity parentActivity = getActivity(); AccountManager am = AccountManager.get(parentActivity); AccountManagerCallback<Boolean> callback = (AccountManagerCallback<Boolean>) parentActivity; am.removeAccount(mTargetAccount, callback, new Handler()); String authority = getResources().getString(R.string.document_provider_authority); Uri rootsUri = DocumentsContract.buildRootsUri(authority); Objects.requireNonNull(getContext()).getContentResolver().notifyChange(rootsUri, null); }

Target:
public void onConfirmation(String callerTag) { Activity parentActivity = getActivity(); AccountManager am = AccountManager.get(parentActivity); AccountManagerCallback<Boolean> callback = (AccountManagerCallback<Boolean>) parentActivity; am.removeAccount(mTargetAccount, callback, new Handler()); String authority = getResources().getString(R.string.document_provider_authority); Uri rootsUri = DocumentsContract.buildRootsUri(authority); if (getContext() != null) { getContext().getContentResolver().notifyChange(rootsUri, null); } }
Source:
public int hashCode() { return Objects.hash(listDelimiter, columns, findColumnsFromHeader, skipHeaderRows); }

Target:
public int hashCode() { return Objects.hash(listDelimiter, columns, findColumnsFromHeader, skipHeaderRows, format); }
Source:
static String constructSegmentPath(String baseKey, String storageDir) { return JOINER.join( baseKey.isEmpty() ? null : baseKey, storageDir ) + "/index.zip"; }

Target:
public static String constructSegmentPath(String baseKey, String storageDir) { return JOINER.join( baseKey.isEmpty() ? null : baseKey, storageDir ) + "/index.zip"; }
Source:
public static void setup() { if (currencySymbolLookup == null) { currencySymbolLookup = new HashMap<String, String>(); currencySymbolLookup.put("USD", "$"); currencySymbolLookup.put("EUR", "???"); currencySymbolLookup.put("CNY", "??"); currencySymbolLookup.put("GBP", "??"); } }

Target:
public static void setup() { if (currencySymbolLookup == null) { currencySymbolLookup = new HashMap<String, String>(); currencySymbolLookup.put("USD", "$"); currencySymbolLookup.put("EUR", "€"); currencySymbolLookup.put("CNY", "¥"); currencySymbolLookup.put("GBP", "£"); } }
Source:
private SiteNode getSiteTreeTarget() { if (!extension.getView().getSiteTreePanel().getTreeSite().isSelectionEmpty()) { SiteNode targetNode = (SiteNode) extension.getView().getSiteTreePanel().getTreeSite().getSelectionPath() .getLastPathComponent(); return targetNode; } return null; }

Target:
private SiteNode getSiteTreeTarget() { if (!extension.getView().getSiteTreePanel().getTreeSite().isSelectionEmpty()) { return (SiteNode) extension.getView().getSiteTreePanel().getTreeSite().getSelectionPath() .getLastPathComponent(); } return null; }
Source:
public SQLTemplates.Builder getBuilder(DatabaseMetaData md) throws SQLException { String name = md.getDatabaseProductName().toLowerCase(); if (name.equals("cubrid")) { return CUBRIDTemplates.builder(); } else if (name.equals("apache derby")) { return DerbyTemplates.builder(); } else if (name.startsWith("firebird")) { return FirebirdTemplates.builder(); } else if (name.equals("h2")) { return H2Templates.builder(); } else if (name.equals("hsql")) { return HSQLDBTemplates.builder(); } else if (name.equals("mysql")) { return MySQLTemplates.builder(); } else if (name.equals("oracle")) { return OracleTemplates.builder(); } else if (name.equals("postgresql")) { return PostgreSQLTemplates.builder(); } else if (name.equals("sqlite")) { return SQLiteTemplates.builder(); } else if (name.startsWith("teradata")) { return TeradataTemplates.builder(); } else if (name.equals("microsoft sql server")) { switch (md.getDatabaseMajorVersion()) { case 12: case 11: return SQLServer2012Templates.builder(); case 10: return SQLServer2008Templates.builder(); case 9: return SQLServer2005Templates.builder(); default: return SQLServerTemplates.builder(); } } else { return new SQLTemplates.Builder() { @Override protected SQLTemplates build(char escape, boolean quote) { return new SQLiteTemplates(escape, quote); } }; } }

Target:
public SQLTemplates.Builder getBuilder(DatabaseMetaData md) throws SQLException { String name = md.getDatabaseProductName().toLowerCase(); if (name.equals("cubrid")) { return CUBRIDTemplates.builder(); } else if (name.equals("apache derby")) { return DerbyTemplates.builder(); } else if (name.startsWith("firebird")) { return FirebirdTemplates.builder(); } else if (name.equals("h2")) { return H2Templates.builder(); } else if (name.equals("hsql")) { return HSQLDBTemplates.builder(); } else if (name.equals("mysql")) { return MySQLTemplates.builder(); } else if (name.equals("oracle")) { return OracleTemplates.builder(); } else if (name.equals("postgresql")) { return PostgreSQLTemplates.builder(); } else if (name.equals("sqlite")) { return SQLiteTemplates.builder(); } else if (name.startsWith("teradata")) { return TeradataTemplates.builder(); } else if (name.equals("microsoft sql server")) { switch (md.getDatabaseMajorVersion()) { case 12: case 11: return SQLServer2012Templates.builder(); case 10: return SQLServer2008Templates.builder(); case 9: return SQLServer2005Templates.builder(); default: return SQLServerTemplates.builder(); } } else { return new SQLTemplates.Builder() { @Override protected SQLTemplates build(char escape, boolean quote) { return new SQLTemplates(Keywords.DEFAULT, "\"", escape, quote); } }; } }
Source:
public void init(NewApplicationRequest dataObject) { super.init(dataObject); view.resetControls(); openShiftClient.getProjects().then(new Operation<List<Project>>() { @Override public void apply(final List<Project> projects) throws OperationException { for (Project project : projects) { openShiftProjects.add(project.getMetadata().getName()); } view.setExistOpenShiftProjects(projects); } }); projectServiceClient.getProjects(false).then(new Operation<List<ProjectDescriptor>>() { @Override public void apply(List<ProjectDescriptor> projects) throws OperationException { for (ProjectDescriptor project : projects) { cheProjects.add(project.getName()); } } }); }

Target:
public void init(NewApplicationRequest dataObject) { super.init(dataObject); view.resetControls(); openShiftClient.getProjects().then(new Operation<List<Project>>() { @Override public void apply(final List<Project> projects) throws OperationException { openShiftProjects.clear(); for (Project project : projects) { openShiftProjects.add(project.getMetadata().getName()); } view.setExistOpenShiftProjects(projects); } }); projectServiceClient.getProjects(false).then(new Operation<List<ProjectDescriptor>>() { @Override public void apply(List<ProjectDescriptor> projects) throws OperationException { openShiftProjects.clear(); for (ProjectDescriptor project : projects) { cheProjects.add(project.getName()); } } }); }
Source:
private static String processLinks(String bbEncodedText) { StringBuilder stringBuilder = new StringBuilder(); int prevPos = 0; Matcher matcher = htmlTagsToSkip.matcher(bbEncodedText); while (matcher.find()) { String substring = bbEncodedText.substring(prevPos, matcher.start()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } stringBuilder.append(matcher.group()); prevPos = matcher.end(); } String substring = bbEncodedText.substring(prevPos, bbEncodedText.length()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } if (stringBuilder.length() > 0) { return stringBuilder.toString(); } return bbEncodedText; }

Target:
private static String processLinks(String bbEncodedText) { StringBuilder stringBuilder = new StringBuilder(); int prevPos = 0; Matcher matcher = htmlTagsToSkip.matcher(bbEncodedText); while (matcher.find()) { String substring = bbEncodedText.substring(prevPos, matcher.start()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } stringBuilder.append(matcher.group()); prevPos = matcher.end(); } if (prevPos == 0) { return processUrlInText(bbEncodedText); } String substring = bbEncodedText.substring(prevPos, bbEncodedText.length()); if (!substring.isEmpty()) { stringBuilder.append(processUrlInText(substring)); } return stringBuilder.toString(); }
Source:
private boolean verifySignature(Signature signature, String providedSignature) { try { if (signature.verify(Hex.decodeHex(providedSignature.toCharArray()))) { return true; } } catch (SignatureException|DecoderException ignore) { } try { if (signature.verify(Base64.getDecoder().decode(providedSignature))) { return true; } } catch (SignatureException ignore) { } return false; }

Target:
private boolean verifySignature(Signature signature, String providedSignature) { try { if (signature.verify(Hex.decodeHex(providedSignature.toCharArray()))) { return true; } } catch (SignatureException|DecoderException ignore) { } try { if (signature.verify(Base64.getDecoder().decode(providedSignature))) { return true; } } catch (SignatureException|IllegalArgumentException ignore) { } return false; }
Source:
public int minimumCoinBottomUp(int total, int coins[]){ int T[] = new int[total + 1]; int R[] = new int[total + 1]; T[0] = 0; for(int i=1; i <= total; i++){ T[i] = Integer.MAX_VALUE-1; R[i] = -1; } for(int j=0; j < coins.length; j++){ for(int i=coins[j]; i <= total; i++){ if (T[i - coins[j]] + 1 < T[i]) { T[i] = 1 + T[i - coins[j]]; R[i] = j; } } } printCoinCombination(R, coins); return T[total]; }

Target:
public int minimumCoinBottomUp(int total, int coins[]){ int T[] = new int[total + 1]; int R[] = new int[total + 1]; T[0] = 0; for(int i=1; i <= total; i++){ T[i] = Integer.MAX_VALUE-1; R[i] = -1; } for(int j=0; j < coins.length; j++){ int i=( (coins[j] > 0) ? coins[j] : 1); for(; i <= total; i++){ if (T[i - coins[j]] + 1 < T[i]) { T[i] = 1 + T[i - coins[j]]; R[i] = j; } } } printCoinCombination(R, coins); return T[total]; }
Source:
private void ensureProperCacheState(AdvancedCache<KIn, VIn> cache) throws NullPointerException, IllegalStateException { if (cache.getStatus() != ComponentStatus.RUNNING) throw new IllegalStateException("Invalid cache state " + cache.getStatus()); if (cache.getRpcManager() != null && cache.getDistributionManager() == null) { throw new IllegalStateException("Cache mode should be DIST or REPL, rather than " + cache.getCacheConfiguration().clustering().cacheModeString()); } }

Target:
private void ensureProperCacheState(AdvancedCache<KIn, VIn> cache) throws NullPointerException, IllegalStateException { if (cache.getStatus() != ComponentStatus.RUNNING) throw log.invalidCacheState(cache.getStats().toString()); if (cache.getRpcManager() != null && cache.getDistributionManager() == null) { throw log.requireDistOrReplCache(cache.getCacheConfiguration().clustering().cacheModeString()); } }
Source:
public void execute(final String[] args) throws Exception { if (args.length == 0) { Main.printUsage(); System.exit(1); } String jarFileName = args[0]; String candidateMainClass = args.length > 1 ? args[1] : null; Class<?> mainClass = null; JarFile f = null; try { f = new JarFile(jarFileName); mainClass = Main.loadClassFromJar(args, f, Main.getClassLoader()); } catch (IOException ioe) { System.out.println("File " + jarFileName + " could not be found or read."); System.exit(1); } catch (ClassNotFoundException cnfe) { System.out.println("Classname " + (candidateMainClass != null ? candidateMainClass : "in JAR manifest") + " not found. Please make sure you use the wholly qualified package name."); System.exit(1); } finally { if (f != null) { f.close(); } } String[] newArgs = Main.stripArgs(args, mainClass.getName().equals(candidateMainClass) ? 2 : 1); Main.execMainClass(mainClass, newArgs); }

Target:
public void execute(final String[] args) throws Exception { if (args.length == 0) { Main.printUsage(); System.exit(1); } String jarFileName = args[0]; String candidateMainClass = args.length > 1 ? args[1] : null; Class<?> mainClass = null; try (JarFile f = new JarFile(jarFileName)) { mainClass = Main.loadClassFromJar(args, f, Main.getClassLoader()); } catch (IOException ioe) { System.out.println("File " + jarFileName + " could not be found or read."); System.exit(1); } catch (ClassNotFoundException cnfe) { System.out.println("Classname " + (candidateMainClass != null ? candidateMainClass : "in JAR manifest") + " not found. Please make sure you use the wholly qualified package name."); System.exit(1); } String[] newArgs = Main.stripArgs(args, mainClass.getName().equals(candidateMainClass) ? 2 : 1); Main.execMainClass(mainClass, newArgs); }
Source:
public void reindex(EntityMetadata md) throws IOException { Map<String, String> fieldMap = Translator.getCaseInsensitiveIndexes(md.getEntityInfo().getIndexes().getIndexes()) .collect(Collectors.toMap( i -> i.getField().toString(), i -> Translator.getHiddenForField(i.getField()).toString())); populateHiddenFields(md.getEntityInfo(), fieldMap); }

Target:
public void reindex(EntityMetadata md) throws IOException { Map<String, String> fieldMap = Translator.getCaseInsensitiveIndexes(md.getEntityInfo().getIndexes().getIndexes()).collect(Collectors.toMap(i -> i.getField().toString(), i -> Translator.getHiddenForField(i.getField()).toString())); if (!fieldMap.keySet().isEmpty()) { populateHiddenFields(md.getEntityInfo(), fieldMap); } }
Source:
protected Label getLabel() { Label label = new Label("Use filters to restrict the number of jobs currently displayed.<br>Be aware that <b> using multiple filters on the same criteria</b> (id, priority,..) lead in most cases to <b>only consider your last filter</b>."); label.setHeight(20); return label; }

Target:
protected Label getLabel() { Label label = new Label("Use filters to restrict the number of jobs currently displayed.<br>Be aware that <b> using \"Match all\" with multiple filters on the same criteria</b> (id, priority,..) leads, in most cases, to <b>only consider your last filter</b>."); label.setHeight(20); return label; }
Source:
private void handleKeyAlreadyExistsException( long commitTs, KeyAlreadyExistsException ex, LockToken commitLocksToken) { try { if (wasCommitSuccessful(commitTs)) { return; } Set<LockToken> expiredLocks = refreshCommitAndImmutableTsLocks(commitLocksToken); if (!expiredLocks.isEmpty()) { throw new TransactionLockTimeoutException("Our commit was already rolled back at commit time" + " because our locks timed out. startTs: " + getStartTimestamp() + ". " + getExpiredLocksErrorString(commitLocksToken, expiredLocks), ex); } else { log.warn("Potential bug: Someone tried to roll back our transaction but" + " our locks were still valid; this is not allowed." + " Held immutable timestamp lock: " + immutableTimestampLock + "; held commit locks: " + commitLocksToken); } } catch (TransactionFailedException e1) { throw e1; } catch (Exception e1) { log.error("Failed to determine if we can retry this transaction. startTs: {}", SafeArg.of("startTs", getStartTimestamp()), e1); } String msg = "Our commit was already rolled back at commit time." + " Locking should prevent this from happening, but our locks may have timed out." + " startTs: " + getStartTimestamp(); throw new TransactionCommitFailedException(msg, ex); }

Target:
private void handleKeyAlreadyExistsException( long commitTs, KeyAlreadyExistsException ex, LockToken commitLocksToken) { try { if (wasCommitSuccessful(commitTs)) { return; } Set<LockToken> expiredLocks = refreshCommitAndImmutableTsLocks(commitLocksToken); if (!expiredLocks.isEmpty()) { throw new TransactionLockTimeoutException("Our commit was already rolled back at commit time" + " because our locks timed out. startTs: " + getStartTimestamp() + ". " + getExpiredLocksErrorString(commitLocksToken, expiredLocks), ex); } else { log.warn("Possible bug: Someone rolled back our transaction but" + " our locks were still valid; Atlas code is not allowed to do this, though others can.", SafeArg.of("immutableTimestampLock", immutableTimestampLock), SafeArg.of("commitLocksToken", commitLocksToken)); } } catch (TransactionFailedException e1) { throw e1; } catch (Exception e1) { log.error("Failed to determine if we can retry this transaction. startTs: {}", SafeArg.of("startTs", getStartTimestamp()), e1); } String msg = "Our commit was already rolled back at commit time." + " Locking should prevent this from happening, but our locks may have timed out." + " startTs: " + getStartTimestamp(); throw new TransactionCommitFailedException(msg, ex); }
Source:
public void onStart(Stage stage) { area = new CodeArea(); area.appendText("some example\n text to go here\n across a couple of \n lines...."); StateManager stateManager = mock(StateManager.class); when(stateManager.activeSearchQueryProperty()).thenReturn(OptionalObjectProperty.empty()); Globals.prefs = mock(JabRefPreferences.class); KeyBindingRepository keyBindingRepository = new KeyBindingRepository(Collections.emptyList(), Collections.emptyList()); when(Globals.prefs.getKeyBindingRepository()).thenReturn(keyBindingRepository); ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class); when(importFormatPreferences.getFieldContentParserPreferences()) .thenReturn(mock(FieldContentParserPreferences.class)); sourceTab = new SourceTab(new BibDatabaseContext(), new CountingUndoManager(), new LatexFieldFormatterPreferences(), importFormatPreferences, new DummyFileUpdateMonitor(), mock(DialogService.class), stateManager); pane = new TabPane( new Tab("main area", area), new Tab("other tab", new Label("some text")), sourceTab ); scene = new Scene(pane); this.stage = stage; stage.setScene(scene); stage.setWidth(400); stage.setHeight(400); stage.show(); pane.getSelectionModel().select(0); }

Target:
public void onStart(Stage stage) { area = new CodeArea(); area.appendText("some example\n text to go here\n across a couple of \n lines...."); StateManager stateManager = mock(StateManager.class); when(stateManager.activeSearchQueryProperty()).thenReturn(OptionalObjectProperty.empty()); KeyBindingRepository keyBindingRepository = new KeyBindingRepository(Collections.emptyList(), Collections.emptyList()); ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class); when(importFormatPreferences.getFieldContentParserPreferences()) .thenReturn(mock(FieldContentParserPreferences.class)); sourceTab = new SourceTab(new BibDatabaseContext(), new CountingUndoManager(), new LatexFieldFormatterPreferences(), importFormatPreferences, new DummyFileUpdateMonitor(), mock(DialogService.class), stateManager, keyBindingRepository); pane = new TabPane( new Tab("main area", area), new Tab("other tab", new Label("some text")), sourceTab ); scene = new Scene(pane); this.stage = stage; stage.setScene(scene); stage.setWidth(400); stage.setHeight(400); stage.show(); pane.getSelectionModel().select(0); }