auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void initSubjectsGrid() { final String subjectItemsJson; try { subjectItemsJson = FileUtil.loadTextFileFromResources(getContext(), R.raw.subjects); final Type type = new TypeToken<List<SubjectModel>>() { }.getType(); final List<SubjectModel> allSubjects = new Gson().fromJson(subjectItemsJson, type); adapter = new SubjectsAdapter(getContext(), allSubjects); binding.glSubjects.setAdapter(adapter); binding.glSubjects.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final SubjectModel subjectModel = adapter.getItem(position); final Intent data = new Intent().putExtra("SUBJECT_FILTER", subjectModel.filter); analyticsRegistry.trackSubjectClicked(subjectModel.filter); getActivity().setResult(Activity.RESULT_OK, data); getActivity().finish(); } }); } catch (IOException e) { e.printStackTrace(); } }

Target:
private void initSubjectsGrid() { final String subjectItemsJson; try { subjectItemsJson = FileUtil.loadTextFileFromResources(getContext(), R.raw.subjects); final Type type = new TypeToken<List<SubjectModel>>() { }.getType(); final List<SubjectModel> allSubjects = new Gson().fromJson(subjectItemsJson, type); adapter = new SubjectsAdapter(getContext(), allSubjects); binding.glSubjects.setAdapter(adapter); binding.glSubjects.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final SubjectModel subjectModel = adapter.getItem(position); final Intent data = new Intent().putExtra(Router.EXTRA_SUBJECT_FILTER, subjectModel.filter); analyticsRegistry.trackSubjectClicked(subjectModel.filter); getActivity().setResult(Activity.RESULT_OK, data); getActivity().finish(); } }); } catch (IOException e) { e.printStackTrace(); } }
Source:
private InstanceTypeDescription getInstanceTypeInfo() { if (LOG.isDebugEnabled()) { LOG.debug("Connecting compiler to JobManager to dertermine instance information."); } Map<InstanceType, InstanceTypeDescription> instances = null; JobManagerConnector jmc = new JobManagerConnector(this.jobManagerAddress); Thread connectorThread = new Thread(jmc, "Compiler - JobManager connector."); connectorThread.setDaemon(true); connectorThread.start(); try { jmc.waitForCompletion(); instances = jmc.instances; if (instances == null) { throw new NullPointerException("Returned instance map is <null>"); } } catch (Throwable t) { throw new CompilerException("Cannot connect to the JobManager to determine the available machines. " + "Check if the JobManager is running (using the web interface or log files). Reason: " + t.getMessage(), t); } return getType(instances); }

Target:
private InstanceTypeDescription getInstanceTypeInfo() { if (LOG.isDebugEnabled()) { LOG.debug("Connecting compiler to JobManager to dertermine instance information."); } Map<InstanceType, InstanceTypeDescription> instances = null; JobManagerConnector jmc = new JobManagerConnector(this.jobManagerAddress); Thread connectorThread = new Thread(jmc, "Compiler - JobManager connector."); connectorThread.setDaemon(true); connectorThread.start(); try { jmc.waitForCompletion(); instances = jmc.instances; if (instances == null) { throw new NullPointerException("Returned instance map is <null>"); } } catch (IOException e) { throw new CompilerException(e.getMessage()); } catch (Throwable t) { throw new CompilerException("Cannot connect to the JobManager to determine the available TaskManagers. " + "Check if the JobManager is running (using the web interface or log files). Reason: " + t.getMessage(), t); } return getType(instances); }
Source:
public CompletableFuture<? extends Iterable<Row>> apply(BatchIterator<Row> batchIterator) { BatchIterator<ShardedRequests<ShardUpsertRequest, ShardUpsertRequest.Item>> reqBatchIterator = BatchIterators.partition(batchIterator, bulkSize, () -> new ShardedRequests<>(requestFactory), grouper, bulkShardCreationLimiter.or(heapThresholdChecker)); Predicate<ShardedRequests<ShardUpsertRequest, ShardUpsertRequest.Item>> shouldPause = this::shouldPauseOnPartitionCreation; shouldPause.or(heapThresholdChecker); if (batchIterator.involvesIO()) { shouldPause = shouldPause.or(this::shouldPauseOnTargetNodeJobsCounter); } BatchIteratorBackpressureExecutor<ShardedRequests<ShardUpsertRequest, ShardUpsertRequest.Item>, UpsertResults> executor = new BatchIteratorBackpressureExecutor<>( scheduler, this.executor, reqBatchIterator, this::execute, resultCollector.combiner(), resultCollector.supplier().get(), shouldPause, BACKOFF_POLICY ); return executor.consumeIteratorAndExecute() .thenApply(upsertResults -> resultCollector.finisher().apply(upsertResults)); }

Target:
public CompletableFuture<? extends Iterable<Row>> apply(BatchIterator<Row> batchIterator) { var reqBatchIterator = BatchIterators.partition( batchIterator, bulkSize, () -> new ShardedRequests<>(requestFactory), grouper, bulkShardCreationLimiter.or(isUsedBytesOverThreshold) ); Predicate<ShardedRequests<ShardUpsertRequest, ShardUpsertRequest.Item>> shouldPause = this::shouldPauseOnPartitionCreation; if (batchIterator.involvesIO()) { shouldPause = shouldPause.or(this::shouldPauseOnTargetNodeJobsCounter); } BatchIteratorBackpressureExecutor<ShardedRequests<ShardUpsertRequest, ShardUpsertRequest.Item>, UpsertResults> executor = new BatchIteratorBackpressureExecutor<>( scheduler, this.executor, reqBatchIterator, this::execute, resultCollector.combiner(), resultCollector.supplier().get(), shouldPause, BACKOFF_POLICY ); return executor.consumeIteratorAndExecute() .thenApply(upsertResults -> resultCollector.finisher().apply(upsertResults)); }
Source:
private static String getTitleValue(Object responseTitle) { if (!(responseTitle instanceof Map)) { return null; } final Map<String, String> map; try { map = (Map<String, String>) responseTitle; return map.get(""); } catch (ClassCastException ignored) { return null; } }

Target:
private String getTitleValue(Object responseTitle) { if (!(responseTitle instanceof Map)) { return null; } final Map<String, String> map; try { map = (Map<String, String>) responseTitle; return map.get(""); } catch (ClassCastException error) { logger.warning("Unable to cast to Map<String,String>. Title: {}", responseTitle, error); return null; } }
Source:
public String getUsername() { return username; }

Target:
public String getUsername() { return StringUtils.notNullStr(username); }
Source:
private final boolean isDateInvalid(Elements elements) { boolean result = false; if (!elements.isEmpty()) { Element dcTermsDateElement = elements.get(0); try { new SimpleDateFormat(MrrtReportTemplateConstants.DATE_FORMAT).parse(dcTermsDateElement.attr("content")); } catch (ParseException ex) { result = true; } } return result; }

Target:
private final boolean isDateInvalid(Elements elements) { boolean result = false; if (elements.isEmpty()) { return result; } Element dcTermsDateElement = elements.get(0); try { new SimpleDateFormat(MrrtReportTemplateConstants.DATE_FORMAT).parse(dcTermsDateElement.attr("content")); } catch (ParseException ex) { result = true; } return result; }
Source:
public void addDeadWatcher(int watcherBit) { while (maxInProcessingDeadWatchers > 0 && !stopped && totalDeadWatchers.get() >= maxInProcessingDeadWatchers) { try { RATE_LOGGER.rateLimitLog("Waiting for dead watchers cleaning"); synchronized(produserAndConsumerLock) { produserAndConsumerLock.wait(100); } } catch (InterruptedException e) { LOG.info("Got interrupted while waiting for dead watches " + "queue size"); break; } } synchronized (this) { if (deadWatchers.add(watcherBit)) { totalDeadWatchers.incrementAndGet(); if (deadWatchers.size() >= watcherCleanThreshold) { synchronized (cleanEvent) { cleanEvent.notifyAll(); } } } } }

Target:
public void addDeadWatcher(int watcherBit) { while (maxInProcessingDeadWatchers > 0 && !stopped && totalDeadWatchers.get() >= maxInProcessingDeadWatchers) { try { RATE_LOGGER.rateLimitLog("Waiting for dead watchers cleaning"); synchronized(processingCompletedEvent) { processingCompletedEvent.wait(100); } } catch (InterruptedException e) { LOG.info("Got interrupted while waiting for dead watches " + "queue size"); break; } } synchronized (this) { if (deadWatchers.add(watcherBit)) { totalDeadWatchers.incrementAndGet(); if (deadWatchers.size() >= watcherCleanThreshold) { synchronized (cleanEvent) { cleanEvent.notifyAll(); } } } } }
Source:
public static void setUpClass() throws Exception { server = HttpServer.create(new InetSocketAddress(0), 0); server.createContext("/", exchange -> { byte[] content = "Hello World!".getBytes(); exchange.sendResponseHeaders(200, content.length); try (OutputStream responseBody = exchange.getResponseBody()) { responseBody.write(content); responseBody.flush(); } }); server.start(); Map<Integer, Integer> portMapping = new HashMap<>(); portMapping.put(server.getAddress().getPort(), 80); Testcontainers.exposeHostPorts(portMapping); }

Target:
public static void setUpClass() throws Exception { server = HttpServer.create(new InetSocketAddress(0), 0); server.createContext("/", exchange -> { byte[] content = "Hello World!".getBytes(); exchange.sendResponseHeaders(200, content.length); try (OutputStream responseBody = exchange.getResponseBody()) { responseBody.write(content); responseBody.flush(); } }); server.start(); Testcontainers.exposeHostPorts(server.getAddress().getPort()); Testcontainers.exposeHostPorts(ImmutableMap.of(server.getAddress().getPort(), 80)); Testcontainers.exposeHostPorts(ImmutableMap.of(server.getAddress().getPort(), 81)); }
Source:
public List<Dataverse> findLinkingDataverses(Long datasetId) { List<Dataverse> retList = new ArrayList<>(); Query query = em.createQuery("select object(o) from DatasetLinkingDataverse as o where o.dataset.id =:datasetId order by o.id"); query.setParameter("datasetId", datasetId); for (Object o : query.getResultList()) { DatasetLinkingDataverse converted = (DatasetLinkingDataverse) o; retList.add(converted.getLinkingDataverse()); } return retList; }

Target:
public List<Dataverse> findLinkingDataverses(Long datasetId) { List<Dataverse> retList = new ArrayList<>(); TypedQuery<DatasetLinkingDataverse> typedQuery = em.createNamedQuery("DatasetLinkingDataverse.findByDatasetId", DatasetLinkingDataverse.class) .setParameter("datasetId", datasetId); for (DatasetLinkingDataverse datasetLinkingDataverse : typedQuery.getResultList()) { retList.add(datasetLinkingDataverse.getLinkingDataverse()); } return retList; }
Source:
public void addConfigNode() { DataNode zookeeperZnode = nodes.get(procZookeeper); if (zookeeperZnode!=null) { zookeeperZnode.addChild(configChildZookeeper); } else { LOG.error("There's no /zookeeper znode - this should never happen."); } nodes.put(configZookeeper, configDataNode); try { setACL(configZookeeper, ZooDefs.Ids.READ_ACL_UNSAFE, -1); } catch (KeeperException.NoNodeException e) { LOG.error("Fail to set ACL on - this should never happen: {}", configZookeeper, e); throw new RuntimeException(e.getMessage()); } }

Target:
public void addConfigNode() { DataNode zookeeperZnode = nodes.get(procZookeeper); if (zookeeperZnode != null) { zookeeperZnode.addChild(configChildZookeeper); } else { assert false : "There's no /zookeeper znode - this should never happen."; } nodes.put(configZookeeper, configDataNode); try { setACL(configZookeeper, ZooDefs.Ids.READ_ACL_UNSAFE, -1); } catch (KeeperException.NoNodeException e) { assert false : "There's no " + configZookeeper + " znode - this should never happen."; } }
Source:
public CommandRequirement(List<Command> setupCommands) { this.setupCommands = setupCommands; }

Target:
public CommandRequirement(List<Command> setupCommands) { this.setupCommands = requireNonNull(setupCommands, "setupCommands is null"); }
Source:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setIncludeEventTypes(EventType.EVTS_ALL); return cfg; }

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { return super.getConfiguration(igniteInstanceName).setIncludeEventTypes(EventType.EVTS_ALL); }
Source:
public void visitMemberAccess(MemberAccessTree tree) { tree.object().accept(this); Set<String> selfObjects = ImmutableSet.of("$this", "self", "static"); String strObject = SourceBuilder.build(tree.object()).trim(); classMemberUsageState = new ClassMemberUsageState(); classMemberUsageState.isStatic = tree.isStatic(); classMemberUsageState.isSelfMember = selfObjects.contains(strObject.toLowerCase()); classMemberUsageState.isField = insideCallee.isEmpty(); classMemberUsageState.isConst = classMemberUsageState.isField && tree.isStatic(); tree.member().accept(this); }

Target:
public void visitMemberAccess(MemberAccessTree tree) { tree.object().accept(this); final ImmutableSet<String> selfObjects = ImmutableSet.of("$this", "self", "static"); String strObject = SourceBuilder.build(tree.object()).trim(); classMemberUsageState = new ClassMemberUsageState(); classMemberUsageState.isStatic = tree.isStatic(); classMemberUsageState.isSelfMember = selfObjects.contains(strObject.toLowerCase()); classMemberUsageState.isField = insideCallee.isEmpty(); classMemberUsageState.isConst = classMemberUsageState.isField && tree.isStatic(); tree.member().accept(this); }
Source:
protected void downloadFileFromRemote(URL remoteURL, File localFile) throws IOException{ LOGGER.info("Downloaded file to local file {}", remoteURL, localFile); long timeS = System.currentTimeMillis(); File tempFile = File.createTempFile(FileDownloadUtils.getFilePrefix(localFile), "."+ FileDownloadUtils.getFileExtension(localFile)); FileOutputStream out = new FileOutputStream(tempFile); InputStream in = remoteURL.openStream(); byte[] buf = new byte[4 * 1024]; int bytesRead; while ((bytesRead = in.read(buf)) != -1) { out.write(buf, 0, bytesRead); } in.close(); out.close(); FileDownloadUtils.copy(tempFile,localFile); tempFile.delete(); long size = localFile.length(); double disp = size / 1024.0; String unit = " kB"; if ( disp > 1024 ) { unit = " MB"; disp = disp / 1024.0; } long timeE = System.currentTimeMillis(); LOGGER.info("Downloaded in sec. to {}", String.format("%.1f",disp) + unit, (timeE - timeS)/1000, localFile); }

Target:
protected void downloadFileFromRemote(URL remoteURL, File localFile) throws IOException{ LOGGER.info("Downloading file to local file {}", remoteURL, localFile); long timeS = System.currentTimeMillis(); File tempFile = File.createTempFile(FileDownloadUtils.getFilePrefix(localFile), "."+ FileDownloadUtils.getFileExtension(localFile)); FileOutputStream out = new FileOutputStream(tempFile); InputStream in = remoteURL.openStream(); byte[] buf = new byte[4 * 1024]; int bytesRead; while ((bytesRead = in.read(buf)) != -1) { out.write(buf, 0, bytesRead); } in.close(); out.close(); FileDownloadUtils.copy(tempFile,localFile); tempFile.delete(); long size = localFile.length(); double disp = size / 1024.0; String unit = " kB"; if ( disp > 1024 ) { unit = " MB"; disp = disp / 1024.0; } long timeE = System.currentTimeMillis(); LOGGER.info("Downloaded in sec. to {}", String.format("%.1f",disp) + unit, (timeE - timeS)/1000, localFile); }
Source:
public static void main(String[] args) { CommandLine cmdLine = new CommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); Config config = Util.rewriteConfig(orgConfig); LocalApplicationRunner runner = new LocalApplicationRunner(config); WikipediaApplication app = new WikipediaApplication(); runner.run(app); runner.waitForFinish(); }

Target:
public static void main(String[] args) { CommandLine cmdLine = new CommandLine(); OptionSet options = cmdLine.parser().parse(args); Config config = cmdLine.loadConfig(options); LocalApplicationRunner runner = new LocalApplicationRunner(config); WikipediaApplication app = new WikipediaApplication(); runner.run(app); runner.waitForFinish(); }
Source:
public SignAlgorithm getSignRequestAlgorithm() { if (getSAMLProtocol().getSignRequest() != null && getSAMLProtocol().getSignRequest().getAlgorithm() != null) { return SignAlgorithm.fromValue(getSAMLProtocol().getSignRequest().getAlgorithm().value()); } return SignAlgorithm.SHA1; }

Target:
public SignatureDigestAlgorithm getSignRequestAlgorithm() { if (getSAMLProtocol().getSignRequest() != null && getSAMLProtocol().getSignRequest().getAlgorithm() != null) { return SignatureDigestAlgorithm.fromValue(getSAMLProtocol().getSignRequest().getAlgorithm().value()); } return SignatureDigestAlgorithm.RSA_SHA1; }
Source:
private void iterateOverHigherLevelMetadata(LegacyDocStructHelperInterface enricher, Map<String, Map<String, LegacyMetadataHelper>> higherLevelMetadata) { HIGHER: for (Entry<String, Map<String, LegacyMetadataHelper>> availableHigherMetadata : higherLevelMetadata .entrySet()) { String enrichable = availableHigherMetadata.getKey(); if (!isAddable(enricher, enrichable)) { continue HIGHER; } for (Entry<String, LegacyMetadataHelper> higherElement : availableHigherMetadata.getValue().entrySet()) { List<LegacyMetadataHelper> amNotNull = enricher.getAllMetadata(); if (Objects.isNull(amNotNull)) { amNotNull = Collections.emptyList(); } for (LegacyMetadataHelper existentMetadata : amNotNull) { if (existentMetadata.getMetadataType().getName().equals(enrichable) && existentMetadata.getValue().equals(higherElement.getKey())) { continue HIGHER; } } enricher.addMetadata(higherElement.getValue()); } } }

Target:
private void iterateOverHigherLevelMetadata(LegacyDocStructHelperInterface enricher, Map<String, Map<String, LegacyMetadataHelper>> higherLevelMetadata) { for (Entry<String, Map<String, LegacyMetadataHelper>> availableHigherMetadata : higherLevelMetadata .entrySet()) { String enrichable = availableHigherMetadata.getKey(); if (!isAddable(enricher, enrichable)) { continue; } for (Entry<String, LegacyMetadataHelper> higherElement : availableHigherMetadata.getValue().entrySet()) { List<LegacyMetadataHelper> amNotNull = enricher.getAllMetadata(); if (Objects.isNull(amNotNull)) { amNotNull = Collections.emptyList(); } boolean breakMiddle = false; for (LegacyMetadataHelper existentMetadata : amNotNull) { if (existentMetadata.getMetadataType().getName().equals(enrichable) && existentMetadata.getValue().equals(higherElement.getKey())) { breakMiddle = true; break; } } if (breakMiddle) { break; } else { enricher.addMetadata(higherElement.getValue()); } } } }
Source:
public static String url(Server server, String path) { return "http://localhost:" + server.activePort().localAddress().getPort() + path; }

Target:
public static String url(Server server, String path) { return "http://localhost:" + server.activeLocalPort() + path; }
Source:
public void action() { filesToOpen.clear(); final AppendDatabaseDialog dialog = new AppendDatabaseDialog(); Optional<Boolean> response = dialog.showAndWait(); if (OptionalUtil.isPresentAndTrue(response)) { FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() .withDefaultExtension(StandardFileType.BIBTEX_DB) .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)) .build(); List<Path> chosen = dialogService.showFileOpenDialogAndGetMultipleFiles(fileDialogConfiguration); if (chosen.isEmpty()) { return; } filesToOpen.addAll(chosen); if (filesToOpen.isEmpty()) { return; } for (Path file : filesToOpen) { BackgroundTask.wrap(() -> openIt(file, dialog.importEntries(), dialog.importStrings(), dialog.importGroups(), dialog.importSelectorWords())) .onSuccess(fileName -> { dialogService.notify(Localization.lang("Imported from library") + " '" + fileName + "'");}) .onFailure(exception -> { LOGGER.warn("Could not open database", exception); dialogService.showErrorDialogAndWait(Localization.lang("Open library"), exception);}) .executeWith(Globals.TASK_EXECUTOR);; } } }

Target:
public void action() { filesToOpen.clear(); final AppendDatabaseDialog dialog = new AppendDatabaseDialog(); Optional<Boolean> response = dialog.showAndWait(); if (OptionalUtil.isPresentAndTrue(response)) { FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() .withDefaultExtension(StandardFileType.BIBTEX_DB) .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)) .build(); List<Path> chosen = dialogService.showFileOpenDialogAndGetMultipleFiles(fileDialogConfiguration); if (chosen.isEmpty()) { return; } filesToOpen.addAll(chosen); if (filesToOpen.isEmpty()) { return; } for (Path file : filesToOpen) { BackgroundTask.wrap(() -> openIt(file, dialog.importEntries(), dialog.importStrings(), dialog.importGroups(), dialog.importSelectorWords())) .onSuccess(fileName -> dialogService.notify(Localization.lang("Imported from library") + " '" + fileName + "'")) .onFailure(exception -> { LOGGER.warn("Could not open database", exception); dialogService.showErrorDialogAndWait(Localization.lang("Open library"), exception);}) .executeWith(Globals.TASK_EXECUTOR);; } } }
Source:
public synchronized void addMutation(TableId table, Mutation m) throws MutationsRejectedException { if (closed) throw new IllegalStateException("Closed"); if (m.size() == 0) throw new IllegalArgumentException("Can not add empty mutations"); checkForFailures(); waitRTE(() -> (totalMemUsed > MAX_MEM_PERCENTAGE * maxMem || flushing)); if (closed) throw new IllegalStateException("Closed"); checkForFailures(); if (startTime == 0) { startTime = System.currentTimeMillis(); List<GarbageCollectorMXBean> gcmBeans = ManagementFactory.getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean garbageCollectorMXBean : gcmBeans) { initialGCTimes += garbageCollectorMXBean.getCollectionTime(); } CompilationMXBean compMxBean = ManagementFactory.getCompilationMXBean(); if (compMxBean.isCompilationTimeMonitoringSupported()) { initialCompileTimes = compMxBean.getTotalCompilationTime(); } initialSystemLoad = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(); } m = new Mutation(m); totalMemUsed += m.estimatedMemoryUsed(); mutations.addMutation(table, m); totalAdded++; if (mutations.getMemoryUsed() >= maxMem / MAX_MEMORY_DIVISOR) { if (!somethingFailed) { startProcessing(); consecutiveFailedProcessCalls.set(0); } else consecutiveFailedProcessCalls.getAndIncrement(); if (consecutiveFailedProcessCalls.get() > 5000) log.error( "TabletServerBatchWriter::startProcessing is not occurring in over 5000 attempts in addMutation."); checkForFailures(); } }

Target:
public synchronized void addMutation(TableId table, Mutation m) throws MutationsRejectedException { if (closed) throw new IllegalStateException("Closed"); if (m.size() == 0) throw new IllegalArgumentException("Can not add empty mutations"); checkForFailures(); waitRTE(() -> (totalMemUsed > maxMem || flushing) && !somethingFailed); if (closed) throw new IllegalStateException("Closed"); checkForFailures(); if (startTime == 0) { startTime = System.currentTimeMillis(); List<GarbageCollectorMXBean> gcmBeans = ManagementFactory.getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean garbageCollectorMXBean : gcmBeans) { initialGCTimes += garbageCollectorMXBean.getCollectionTime(); } CompilationMXBean compMxBean = ManagementFactory.getCompilationMXBean(); if (compMxBean.isCompilationTimeMonitoringSupported()) { initialCompileTimes = compMxBean.getTotalCompilationTime(); } initialSystemLoad = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(); } m = new Mutation(m); totalMemUsed += m.estimatedMemoryUsed(); mutations.addMutation(table, m); totalAdded++; if (mutations.getMemoryUsed() >= maxMem / MAX_MEMORY_DIVISOR) { startProcessing(); if (!somethingFailed) consecutiveFailedProcessCalls.set(0); if (consecutiveFailedProcessCalls.get() > 5000) log.error( "TabletServerBatchWriter::startProcessing is not occurring in over 5000 attempts in addMutation."); else if (somethingFailed) consecutiveFailedProcessCalls.getAndIncrement(); checkForFailures(); } }
Source:
public UserProfileServiceHandler() { userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class); try { GenericObjectPool.Config poolConfig = new GenericObjectPool.Config(); poolConfig.maxActive = 100; poolConfig.minIdle = 5; poolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; poolConfig.testOnBorrow = true; poolConfig.testWhileIdle = true; poolConfig.numTestsPerEvictionRun = 10; poolConfig.maxWait = 3000; iasClientPool = new ThriftClientPool<>( tProtocol -> new IamAdminServices.Client(tProtocol), poolConfig, ServerSettings.getProfileServiceServerHost(), Integer.parseInt(ServerSettings.getProfileServiceServerPort())); }catch (ApplicationSettingsException e) { logger.error("Error occured while reading airavata-server properties..", e); } }

Target:
public UserProfileServiceHandler() throws Exception { userProfileRepository = new UserProfileRepository(UserProfile.class, UserProfileEntity.class); try { GenericObjectPool.Config poolConfig = new GenericObjectPool.Config(); poolConfig.maxActive = 100; poolConfig.minIdle = 5; poolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK; poolConfig.testOnBorrow = true; poolConfig.testWhileIdle = true; poolConfig.numTestsPerEvictionRun = 10; poolConfig.maxWait = 3000; iasClientPool = new ThriftClientPool<>( tProtocol -> new IamAdminServices.Client(tProtocol), poolConfig, ServerSettings.getProfileServiceServerHost(), Integer.parseInt(ServerSettings.getProfileServiceServerPort())); } catch (ApplicationSettingsException e) { logger.error("Error occured while reading airavata-server properties..", e); throw new Exception(e); } }
Source:
@BeforeClass public static void beforeClass() throws Exception { service = AppiumDriverLocalService.buildDefaultService(); service.start(); if (service == null || !service.isRunning()) { throw new RuntimeException("An appium server node is not started!"); } File appDir = new File("src/test/java/io/appium/java_client"); File app = new File(appDir, "ApiDemos-debug.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2); driver = new AndroidDriver<>(service.getUrl(), capabilities); }

Target:
@BeforeClass public static void beforeClass() throws Exception { service = AppiumDriverLocalService.buildDefaultService(); service.start(); if (service == null || !service.isRunning()) { throw new AppiumServerHasNotBeenStartedLocallyException ("An appium server node is not started!"); } File appDir = new File("src/test/java/io/appium/java_client"); File app = new File(appDir, "ApiDemos-debug.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2); driver = new AndroidDriver<>(service.getUrl(), capabilities); }
Source:
public static TrustManagerFactory createTrustManagerFactory( Path trustStorePath, SslConfiguration.StoreType trustStoreType) { KeyStore keyStore; switch (trustStoreType) { case JKS: case PKCS12: keyStore = KeyStores.loadKeyStore(trustStoreType.name(), trustStorePath, Optional.<String>absent()); break; case PEM: keyStore = KeyStores.createTrustStoreFromCertificates(trustStorePath); break; case PUPPET: Path puppetCertsDir = trustStorePath.resolve("certs"); if (!puppetCertsDir.toFile().isDirectory()) { throw new IllegalStateException( String.format("Puppet certs directory did not exist at path \"%s\"", puppetCertsDir)); } keyStore = KeyStores.createTrustStoreFromCertificates(puppetCertsDir); break; default: throw new IllegalStateException("Unrecognized trust store type: " + trustStoreType); } try { TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); return trustManagerFactory; } catch (GeneralSecurityException e) { throw Throwables.propagate(e); } }

Target:
private static TrustManagerFactory createTrustManagerFactory( Path trustStorePath, SslConfiguration.StoreType trustStoreType) { KeyStore keyStore; switch (trustStoreType) { case JKS: case PKCS12: keyStore = KeyStores.loadKeyStore(trustStoreType.name(), trustStorePath, Optional.<String>absent()); break; case PEM: keyStore = KeyStores.createTrustStoreFromCertificates(trustStorePath); break; case PUPPET: Path puppetCertsDir = trustStorePath.resolve("certs"); if (!puppetCertsDir.toFile().isDirectory()) { throw new IllegalStateException( String.format("Puppet certs directory did not exist at path \"%s\"", puppetCertsDir)); } keyStore = KeyStores.createTrustStoreFromCertificates(puppetCertsDir); break; default: throw new IllegalStateException("Unrecognized trust store type: " + trustStoreType); } try { TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); return trustManagerFactory; } catch (GeneralSecurityException e) { throw Throwables.propagate(e); } }
Source:
void start() throws StoreException { File mountPath = new File(disk.getMountPath()); if (mountPath.exists()) { ScheduledExecutorService storeStartupScheduler = Utils .newScheduler(Math.min(stores.size(), config.storeNumStoreStartupThreads), "store-startup-" + disk, false); try { Map<PartitionId, Future<Void>> futures = new HashMap<>(); for (final Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { Future<Void> future = storeStartupScheduler.submit(new Callable<Void>() { @Override public Void call() throws Exception { partitionAndStore.getValue().start(); return null; } }); futures.put(partitionAndStore.getKey(), future); } int numFailed = 0; for (Map.Entry<PartitionId, Future<Void>> partitionAndFuture : futures.entrySet()) { try { partitionAndFuture.getValue().get(); } catch (ExecutionException e) { numFailed++; logger.error("Exception while starting store for partition " + partitionAndFuture.getKey(), e.getCause()); } catch (InterruptedException e) { numFailed++; logger.error("Store startup for partition " + partitionAndFuture.getKey() + " was interrupted", e); } } if (numFailed > 0) { throw new StoreException( "Could not start " + numFailed + " out of " + stores.size() + " stores on the disk " + disk, StoreErrorCodes.Initialization_Error); } } finally { storeStartupScheduler.shutdown(); } } else { throw new StoreException("Mount path does not exist: " + mountPath + " ; cannot start stores on this disk", StoreErrorCodes.Initialization_Error); } }

Target:
void start() throws InterruptedException { Timer.Context context = metrics.diskStartTime.time(); try { File mountPath = new File(disk.getMountPath()); if (mountPath.exists()) { List<Thread> startupThreads = new ArrayList<>(); final AtomicInteger numFailures = new AtomicInteger(0); for (final Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { Thread thread = Utils.newThread("store-startup-" + partitionAndStore.getKey(), new Runnable() { @Override public void run() { try { partitionAndStore.getValue().start(); } catch (Exception e) { numFailures.incrementAndGet(); metrics.totalStoreStartFailures.inc(); logger.error("Exception while starting store for the partition" + partitionAndStore.getKey(), e); } } }, false); thread.start(); startupThreads.add(thread); } for (Thread startupThread : startupThreads) { startupThread.join(); } if (numFailures.get() > 0) { logger.error( "Could not start " + numFailures.get() + " out of " + stores.size() + " stores on the disk " + disk); } } else { metrics.diskMountPathFailures.inc(); metrics.totalStoreStartFailures.inc(stores.size()); logger.error("Mount path does not exist: " + mountPath + " ; cannot start stores on this disk"); } } finally { context.stop(); } }
Source:
public void init(GameEngine gameEngine) { entityManager = new EntitySystemBuilder().build(CoreRegistry.get(ModuleManager.class), CoreRegistry.get(NetworkSystem.class), CoreRegistry.get(ReflectFactory.class), CoreRegistry.get(CopyStrategyLibrary.class)); eventSystem = CoreRegistry.get(EventSystem.class); CoreRegistry.put(Console.class, new ConsoleImpl()); nuiManager = CoreRegistry.get(NUIManager.class); ((NUIManagerInternal) nuiManager).refreshWidgetsLibrary(); eventSystem.registerEventHandler(nuiManager); CameraTargetSystem cameraTargetSystem = new CameraTargetSystem(); CoreRegistry.put(CameraTargetSystem.class, cameraTargetSystem); componentSystemManager = CoreRegistry.get(ComponentSystemManager.class); componentSystemManager.register(cameraTargetSystem, "engine:CameraTargetSystem"); componentSystemManager.register(new ConsoleSystem(), "engine:ConsoleSystem"); componentSystemManager.register(new CoreCommands(), "engine:CoreCommands"); inputSystem = CoreRegistry.get(InputSystem.class); new RegisterInputSystem().step(); EntityRef localPlayerEntity = entityManager.create(new ClientComponent()); LocalPlayer localPlayer = CoreRegistry.put(LocalPlayer.class, new LocalPlayer()); localPlayer.setClientEntity(localPlayerEntity); componentSystemManager.initialise(); playBackgroundMusic(); CoreRegistry.get(NUIManager.class).pushScreen("engine:mainMenuScreen"); if (!messageOnLoad.isEmpty()) { nuiManager.pushScreen("engine:errorMessagePopup", ErrorMessagePopup.class).setError("Error", messageOnLoad); } }

Target:
public void init(GameEngine gameEngine) { entityManager = new EntitySystemBuilder().build(CoreRegistry.get(ModuleManager.class), CoreRegistry.get(NetworkSystem.class), CoreRegistry.get(ReflectFactory.class), CoreRegistry.get(CopyStrategyLibrary.class)); eventSystem = CoreRegistry.get(EventSystem.class); CoreRegistry.put(Console.class, new ConsoleImpl()); nuiManager = CoreRegistry.get(NUIManager.class); ((NUIManagerInternal) nuiManager).refreshWidgetsLibrary(); eventSystem.registerEventHandler(nuiManager); componentSystemManager = new ComponentSystemManager(); CoreRegistry.put(ComponentSystemManager.class, componentSystemManager); CameraTargetSystem cameraTargetSystem = new CameraTargetSystem(); CoreRegistry.put(CameraTargetSystem.class, cameraTargetSystem); componentSystemManager.register(cameraTargetSystem, "engine:CameraTargetSystem"); componentSystemManager.register(new ConsoleSystem(), "engine:ConsoleSystem"); componentSystemManager.register(new CoreCommands(), "engine:CoreCommands"); inputSystem = CoreRegistry.get(InputSystem.class); new RegisterInputSystem().step(); EntityRef localPlayerEntity = entityManager.create(new ClientComponent()); LocalPlayer localPlayer = CoreRegistry.put(LocalPlayer.class, new LocalPlayer()); localPlayer.setClientEntity(localPlayerEntity); componentSystemManager.initialise(); playBackgroundMusic(); CoreRegistry.get(NUIManager.class).pushScreen("engine:mainMenuScreen"); if (!messageOnLoad.isEmpty()) { nuiManager.pushScreen("engine:errorMessagePopup", ErrorMessagePopup.class).setError("Error", messageOnLoad); } }
Source:
private boolean clusterHasNonInitializingServers() { for (VDS vds : getVdsDAO().getAllForVdsGroup(getVdsGroupId())) { if (vds.getStatus() != VDSStatus.Installing && vds.getStatus() != VDSStatus.InstallingOS && vds.getStatus() != VDSStatus.PendingApproval && vds.getStatus() != VDSStatus.Initializing) return true; } return false; }

Target:
private boolean clusterHasNonInitializingServers() { for (VDS vds : getVdsDAO().getAllForVdsGroup(getVdsGroupId())) { if (vds.getStatus() != VDSStatus.Installing && vds.getStatus() != VDSStatus.InstallingOS && vds.getStatus() != VDSStatus.PendingApproval && vds.getStatus() != VDSStatus.Initializing && vds.getStatus() != VDSStatus.InstallFailed) return true; } return false; }
Source:
public void setUp() throws Exception { Map<String, Integer> samplesPosition = new HashMap<>(); samplesPosition.put("sample1", 123); VARIANT_SOURCE_ENTITY.setSamplesPosition(samplesPosition); Map<String, Object> metadata = new HashMap<>(); metadata.put("header", "myHeader"); VARIANT_SOURCE_ENTITY.setMetadata(metadata); List<VariantSourceEntity> variantSourceEntities = Collections.singletonList(VARIANT_SOURCE_ENTITY); given(variantSourceEntityRepository.findByStudyIdIn(eq(Collections.singletonList("studyId")), any())) .willReturn(variantSourceEntities); given(variantSourceEntityRepository.countByStudyIdIn(eq(Collections.singletonList("studyId")))) .willReturn(1L); }

Target:
public void setUp() throws Exception { VariantSourceEntity variantSourceEntity = new VariantSourceEntity("fileId", "fileName", "studyId", "studyName", VariantStudy.StudyType.CASE, VariantSource.Aggregation.NONE, null, null, null); Map<String, Integer> samplesPosition = new HashMap<>(); samplesPosition.put("sample1", 123); variantSourceEntity.setSamplesPosition(samplesPosition); Map<String, Object> metadata = new HashMap<>(); metadata.put("header", "myHeader"); variantSourceEntity.setMetadata(metadata); List<VariantSourceEntity> variantSourceEntities = Collections.singletonList(variantSourceEntity); given(variantSourceEntityRepository.findByStudyIdIn(eq(Collections.singletonList("studyId")), any())) .willReturn(variantSourceEntities); given(variantSourceEntityRepository.countByStudyIdIn(eq(Collections.singletonList("studyId")))) .willReturn(Long.valueOf(variantSourceEntities.size())); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { AsyncContext asyncContext = getAsyncContext(req); Observable<Metric<Object>> metricObservable = metricsService.scanAllMetricIndexes().onBackpressureBuffer(); PublishSubject<byte[]> byteSubject = PublishSubject.create(); Observable<byte[]> buffers = metricObservable.map(m -> { try { return objectWriter.writeValueAsBytes(m); } catch (JsonProcessingException e) { throw Exceptions.propagate(e); } }).onBackpressureBuffer(); buffers.subscribe(new Observer<byte[]>() { AtomicBoolean first = new AtomicBoolean(true); @Override public void onCompleted() { byteSubject.onNext("]".getBytes(Charset.forName("UTF-8"))); byteSubject.onCompleted(); } @Override public void onError(Throwable throwable) { } @Override public void onNext(byte[] bytes) { if(first.compareAndSet(true, false)) { byteSubject.onNext("[".getBytes(Charset.forName("UTF-8"))); byteSubject.onNext(bytes); } else { byteSubject.onNext(comma); byteSubject.onNext(bytes); } } }); ObservableServlet.write(byteSubject, resp.getOutputStream()) .subscribe(v -> {}, t -> { t.printStackTrace(); asyncContext.complete(); }, asyncContext::complete); }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setCharacterEncoding("UTF-8"); resp.setContentType("application/json"); AsyncContext asyncContext = getAsyncContext(req); Observable<Metric<Object>> metricObservable = metricsService.scanAllMetricIndexes() .filter(m -> m.getTags().containsKey(DESCRIPTOR_TAG)) .onBackpressureBuffer(); PublishSubject<byte[]> byteSubject = PublishSubject.create(); Observable<byte[]> buffers = metricObservable.map(m -> { try { return objectWriter.writeValueAsBytes(m); } catch (JsonProcessingException e) { throw Exceptions.propagate(e); } }).onBackpressureBuffer(); buffers.subscribe(new Observer<byte[]>() { AtomicBoolean first = new AtomicBoolean(true); @Override public void onCompleted() { if(!first.get()) { byteSubject.onNext("]".getBytes(Charset.forName("UTF-8"))); } byteSubject.onCompleted(); } @Override public void onError(Throwable throwable) { } @Override public void onNext(byte[] bytes) { if(first.compareAndSet(true, false)) { byteSubject.onNext("[".getBytes(Charset.forName("UTF-8"))); byteSubject.onNext(bytes); } else { byteSubject.onNext(comma); byteSubject.onNext(bytes); } } }); ObservableServlet.write(byteSubject, resp.getOutputStream()) .subscribe(v -> {}, t -> { t.printStackTrace(); asyncContext.complete(); }, asyncContext::complete); }
Source:
public void pruneQueryInfo() { Optional<QueryInfo> finalInfo = finalQueryInfo.get(); if (!finalInfo.isPresent() || !finalInfo.get().getOutputStage().isPresent()) { return; } QueryInfo queryInfo = finalInfo.get(); Optional<StageInfo> prunedOutputStage = queryInfo.getOutputStage().map(outputStage -> new StageInfo( outputStage.getStageId(), outputStage.getSelf(), Optional.empty(), outputStage.getLatestAttemptExecutionInfo().isPresent() ? Optional.of(pruneStageExecutionInfo(outputStage.getLatestAttemptExecutionInfo().get())) : Optional.empty(), ImmutableList.of(), ImmutableList.of())); QueryInfo prunedQueryInfo = new QueryInfo( queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), getMemoryPool().getId(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getFieldNames(), queryInfo.getQuery(), pruneQueryStats(queryInfo.getQueryStats()), queryInfo.getSetCatalog(), queryInfo.getSetSchema(), queryInfo.getSetSessionProperties(), queryInfo.getResetSessionProperties(), queryInfo.getSetRoles(), queryInfo.getAddedPreparedStatements(), queryInfo.getDeallocatedPreparedStatements(), queryInfo.getStartedTransactionId(), queryInfo.isClearTransactionId(), queryInfo.getUpdateType(), prunedOutputStage, queryInfo.getFailureInfo(), queryInfo.getErrorCode(), queryInfo.getWarnings(), queryInfo.getInputs(), queryInfo.getOutput(), queryInfo.isCompleteInfo(), queryInfo.getResourceGroupId(), queryInfo.getQueryType(), queryInfo.getFailedTasks()); finalQueryInfo.compareAndSet(finalInfo, Optional.of(prunedQueryInfo)); }

Target:
public void pruneQueryInfo() { Optional<QueryInfo> finalInfo = finalQueryInfo.get(); if (!finalInfo.isPresent() || !finalInfo.get().getOutputStage().isPresent()) { return; } QueryInfo queryInfo = finalInfo.get(); Optional<StageInfo> prunedOutputStage = queryInfo.getOutputStage().map(outputStage -> new StageInfo( outputStage.getStageId(), outputStage.getSelf(), Optional.empty(), outputStage.getLatestAttemptExecutionInfo().map(QueryStateMachine::pruneStageExecutionInfo), ImmutableList.of(), ImmutableList.of())); QueryInfo prunedQueryInfo = new QueryInfo( queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), getMemoryPool().getId(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getFieldNames(), queryInfo.getQuery(), pruneQueryStats(queryInfo.getQueryStats()), queryInfo.getSetCatalog(), queryInfo.getSetSchema(), queryInfo.getSetSessionProperties(), queryInfo.getResetSessionProperties(), queryInfo.getSetRoles(), queryInfo.getAddedPreparedStatements(), queryInfo.getDeallocatedPreparedStatements(), queryInfo.getStartedTransactionId(), queryInfo.isClearTransactionId(), queryInfo.getUpdateType(), prunedOutputStage, queryInfo.getFailureInfo(), queryInfo.getErrorCode(), queryInfo.getWarnings(), queryInfo.getInputs(), queryInfo.getOutput(), queryInfo.isCompleteInfo(), queryInfo.getResourceGroupId(), queryInfo.getQueryType(), queryInfo.getFailedTasks()); finalQueryInfo.compareAndSet(finalInfo, Optional.of(prunedQueryInfo)); }
Source:
public Bookmark(final VertexView vertex, final KnownMutation knownMutation, final long segmentPosition, final double scale) { super(RADIUS); setLayoutX(vertex.getLayoutX() + (segmentPosition + 0.5) * vertex.HORIZONTALSCALE * scale); setLayoutY(vertex.getLayoutY() + vertex.getHeight() / 2); setOpacity(OPACITY); setFill(STANDARD_COLOR); Tooltip tooltip = new Tooltip(knownMutation.toString()); Tooltip.install(this, tooltip); }

Target:
public Bookmark(final VertexView vertex, final KnownMutation knownMutation, final long segmentPosition, final double scale) { super(RADIUS); setLayoutX(vertex.getLayoutX() + (segmentPosition + SEGMENT_CENTER) * vertex.HORIZONTALSCALE * scale); setLayoutY(vertex.getLayoutY() + vertex.getHeight() / 2); setOpacity(OPACITY); setFill(STANDARD_COLOR); Tooltip tooltip = new Tooltip(knownMutation.toString()); Tooltip.install(this, tooltip); }
Source:
public void readData(ObjectDataInput in) throws IOException { name = in.readUTF(); type = IndexType.getById(in.readInt()); attributes = readNullableList(in); if (type == IndexType.BITMAP) { bitmapIndexOptions = in.readObject(); } }

Target:
public void readData(ObjectDataInput in) throws IOException { name = in.readUTF(); type = IndexType.getById(in.readInt()); attributes = readNullableList(in); bitmapIndexOptions = in.readObject(); }
Source:
public ImmutableSpongeSizeData(float base, float height, float scale) { super(ImmutableSizeData.class); checkArgument(scale > 0, "The base size must be greater than 0."); checkArgument(height > 0, "The height must be greater than 0."); checkArgument(scale > 0, "The scale must be greater than 0."); this.base = base; this.height = height; this.scale = scale; this.baseValue = SpongeValueFactory.boundedBuilder(Keys.BASE_SIZE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.base) .build() .asImmutable(); this.heightValue = SpongeValueFactory.boundedBuilder(Keys.HEIGHT) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.height) .build() .asImmutable(); this.scaleValue = SpongeValueFactory.boundedBuilder(Keys.SCALE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.scale) .build() .asImmutable(); registerGetters(); }

Target:
public ImmutableSpongeSizeData(float base, float height, float scale) { super(ImmutableSizeData.class); checkArgument(base > 0, "The base size must be greater than 0."); checkArgument(height > 0, "The height must be greater than 0."); checkArgument(scale > 0, "The scale must be greater than 0."); this.base = base; this.height = height; this.scale = scale; this.baseValue = SpongeValueFactory.boundedBuilder(Keys.BASE_SIZE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.base) .build() .asImmutable(); this.heightValue = SpongeValueFactory.boundedBuilder(Keys.HEIGHT) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.height) .build() .asImmutable(); this.scaleValue = SpongeValueFactory.boundedBuilder(Keys.SCALE) .defaultValue(1f) .minimum(0f) .maximum(Float.MAX_VALUE) .actualValue(this.scale) .build() .asImmutable(); registerGetters(); }
Source:
public void flush() { Set<Identified> written = Sets.newHashSet(); for(ContentHierarchyAndBroadcast hierarchy : ImmutableList.copyOf(hierarchies.get()).reverse()) { Item item = hierarchy.getItem(); if (hierarchy.getBrand().isPresent()) { Brand brand = hierarchy.getBrand().get(); if (!written.contains(brand)) { writer.createOrUpdate(brand); written.add(brand); } item.setContainer(brand); } if (hierarchy.getSeries().isPresent()) { Series series = hierarchy.getSeries().get(); if (!written.contains(series)) { if (hierarchy.getBrand().isPresent()) { series.setParent(hierarchy.getBrand().get()); } writer.createOrUpdate(series); written.add(series); } if (!hierarchy.getBrand().isPresent()) { hierarchy.getItem().setContainer(series); } else { if (hierarchy.getItem() instanceof Episode) { ((Episode) item).setSeries(series); } } } if ( ! (hierarchy.getSeries().isPresent() ^ hierarchy.getBrand().isPresent())) { item = ensureItem(item); } if (!written.contains(hierarchy.getItem())) { writer.createOrUpdate(item); peopleWriter.createOrUpdatePeople(item); written.add(item); } } hierarchies.get().clear(); contentCache.get().clear(); }

Target:
public void flush() { Set<Identified> written = Sets.newHashSet(); for(ContentHierarchyAndBroadcast hierarchy : ImmutableList.copyOf(hierarchies.get()).reverse()) { Item item = hierarchy.getItem(); if (hierarchy.getBrand().isPresent()) { Brand brand = hierarchy.getBrand().get(); if (!written.contains(brand)) { writer.createOrUpdate(brand); written.add(brand); } item.setContainer(brand); } if (hierarchy.getSeries().isPresent()) { Series series = hierarchy.getSeries().get(); if (!written.contains(series)) { if (hierarchy.getBrand().isPresent()) { series.setParent(hierarchy.getBrand().get()); } writer.createOrUpdate(series); written.add(series); } if (!hierarchy.getBrand().isPresent()) { item.setContainer(series); } else { if (item instanceof Episode) { ((Episode) item).setSeries(series); } } } if ( ! (hierarchy.getSeries().isPresent() || hierarchy.getBrand().isPresent())) { item = ensureItem(item); item.setContainer(null); } if (!written.contains(item)) { writer.createOrUpdate(item); peopleWriter.createOrUpdatePeople(item); written.add(item); } } hierarchies.get().clear(); contentCache.get().clear(); }