auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Boolean executeDistCp(String serviceName, Map<String, FileStatus> fileListingMap, Path targetPath) throws Exception { Configuration conf = currentCluster.getHadoopConf(); conf.set(ConduitConstants.AUDIT_ENABLED_KEY, System.getProperty(ConduitConstants.AUDIT_ENABLED_KEY)); conf.set("mapred.job.name", serviceName); conf.set("tmpjars", auditUtilJarDestPath.toString()); DistCpOptions options = new DistCpOptions(new Path("/tmp"), targetPath); options.setOutPutDirectory(tmpCounterOutputPath); DistCp distCp = new ConduitDistCp(conf, options, fileListingMap); try { long jobStartTime = System.nanoTime(); distCp.execute(); long jobExecutionTimeInSecs = (System.nanoTime() - jobStartTime)/(NANO_SECONDS_IN_SECOND); updateJobTimeCounter(jobExecutionTimeInSecs); } catch (Exception e) { LOG.error("Exception encountered ", e); throw e; } return true; }

Target:
protected Boolean executeDistCp(String serviceName, Map<String, FileStatus> fileListingMap, Path targetPath) throws Exception { Configuration conf = currentCluster.getHadoopConf(); conf.set(ConduitConstants.AUDIT_ENABLED_KEY, System.getProperty(ConduitConstants.AUDIT_ENABLED_KEY)); conf.set("mapred.job.name", serviceName); conf.set("tmpjars", auditUtilJarDestPath.toString()); DistCpOptions options = new DistCpOptions(new Path("/tmp"), targetPath); options.setOutPutDirectory(tmpCounterOutputPath); DistCp distCp = new ConduitDistCp(conf, options, fileListingMap); try { distCp.execute(); long jobExecutionTimeInSecs = (distCp.getJobTimeInNanos())/(NANO_SECONDS_IN_SECOND); updateJobTimeCounter(jobExecutionTimeInSecs); } catch (Exception e) { LOG.error("Exception encountered ", e); throw e; } return true; }
Source:
public void resourceFound(SpiderResourceFound resourceFound) { if (resourceFound == null || resourceFound.getUri() == null || resourceFound.getMethod() == null) { return; } log.debug("New " + resourceFound.getMethod() + "resource found: " + resourceFound.getUri()); URI uriV = createURI(resourceFound.getUri()); if (uriV == null) { return; } String resourceIdentifier = ""; try { resourceIdentifier = buildCanonicalResourceIdentifier(uriV, resourceFound); } catch (URIException e) { return; } synchronized (visitedResources) { if (visitedResources.contains(resourceIdentifier)) { return; } else { visitedResources.add(resourceIdentifier); } } for (FetchFilter f : fetchFilters) { FetchStatus s = f.checkFilter(uriV); if (s != FetchStatus.VALID) { log.debug("URI: " + uriV + " was filtered by a filter with reason: " + s); spider.notifyListenersFoundURI( resourceFound.getUri(), resourceFound.getMethod(), s); return; } } if (resourceFound.isShouldIgnore()) { log.debug( "URI: " + uriV + " is valid, but will not be fetched, by parser recommendation."); spider.notifyListenersFoundURI( resourceFound.getUri(), resourceFound.getMethod(), FetchStatus.VALID); return; } spider.notifyListenersFoundURI( resourceFound.getUri(), resourceFound.getMethod(), FetchStatus.VALID); SpiderTask task = new SpiderTask(spider, resourceFound, uriV); spider.submitTask(task); }

Target:
public void resourceFound(SpiderResourceFound resourceFound) { log.debug("New resource found: {}", resourceFound.getMethod(), resourceFound.getUri()); URI uriV = createURI(resourceFound.getUri()); if (uriV == null) { return; } String resourceIdentifier = ""; try { resourceIdentifier = buildCanonicalResourceIdentifier(uriV, resourceFound); } catch (URIException e) { return; } synchronized (visitedResources) { if (visitedResources.contains(resourceIdentifier)) { log.debug("Resource already visited: {}", resourceIdentifier.trim()); return; } else { visitedResources.add(resourceIdentifier); } } for (FetchFilter f : fetchFilters) { FetchStatus s = f.checkFilter(uriV); if (s != FetchStatus.VALID) { log.debug("URI: " + uriV + " was filtered by a filter with reason: " + s); spider.notifyListenersFoundURI( resourceFound.getUri(), resourceFound.getMethod(), s); return; } } if (resourceFound.isShouldIgnore()) { log.debug( "URI: " + uriV + " is valid, but will not be fetched, by parser recommendation."); spider.notifyListenersFoundURI( resourceFound.getUri(), resourceFound.getMethod(), FetchStatus.VALID); return; } spider.notifyListenersFoundURI( resourceFound.getUri(), resourceFound.getMethod(), FetchStatus.VALID); SpiderTask task = new SpiderTask(spider, resourceFound, uriV); spider.submitTask(task); }
Source:
public static JobDetail bindByPoolAndQuantities(Consumer consumer, PoolIdAndQuantity... poolQuantities) { JobDataMap map = new JobDataMap(); map.put(JobStatus.OWNER_ID, consumer.getOwner().getKey()); map.put("pool_and_quanities", poolQuantities); map.put(JobStatus.TARGET_TYPE, JobStatus.TargetType.CONSUMER); map.put(JobStatus.TARGET_ID, consumer.getUuid()); JobDetail detail = newJob(EntitlerJob.class) .withIdentity("bind_by_pool_" + Util.generateUUID()) .requestRecovery(false) .storeDurably() .usingJobData(map) .build(); return detail; }

Target:
public static JobDetail bindByPoolAndQuantities(Consumer consumer, PoolIdAndQuantity... poolQuantities) { JobDataMap map = new JobDataMap(); map.put(JobStatus.OWNER_ID, consumer.getOwner().getKey()); map.put("pool_and_quantities", poolQuantities); map.put(JobStatus.TARGET_TYPE, JobStatus.TargetType.CONSUMER); map.put(JobStatus.TARGET_ID, consumer.getUuid()); JobDetail detail = newJob(EntitlerJob.class) .withIdentity("bind_by_pool_" + Util.generateUUID()) .requestRecovery(false) .storeDurably() .usingJobData(map) .build(); return detail; }
Source:
private void processComplex(RelOptRuleCall call, Project project, TableScan scan) { HazelcastTable originalTable = OptUtils.getHazelcastTable(scan); ProjectFieldVisitor projectFieldVisitor = new ProjectFieldVisitor(originalTable.getProjects()); for (RexNode projectExp : project.getProjects()) { projectExp.accept(projectFieldVisitor); } List<Integer> newScanProjects = projectFieldVisitor.createNewScanProjects(); if (newScanProjects.isEmpty()) { return; } if (newScanProjects.size() == originalTable.getProjects().size()) { return; } LogicalTableScan newScan = OptUtils.createLogicalScanWithNewTable( scan, originalTable.withProject(newScanProjects) ); ProjectConverter projectConverter = projectFieldVisitor.createProjectConverter(); List<RexNode> newProjects = new ArrayList<>(); for (RexNode projectExp : project.getProjects()) { RexNode newProjectExp = projectExp.accept(projectConverter); newProjects.add(newProjectExp); } LogicalProject newProject = LogicalProject.create( newScan, project.getHints(), newProjects, project.getRowType() ); call.transformTo(newProject); }

Target:
private void processComplex(RelOptRuleCall call, Project project, TableScan scan) { HazelcastTable originalTable = OptUtils.getHazelcastTable(scan); ProjectFieldVisitor projectFieldVisitor = new ProjectFieldVisitor(originalTable.getProjects()); for (RexNode projectExp : project.getProjects()) { projectExp.accept(projectFieldVisitor); } List<Integer> newScanProjects = projectFieldVisitor.createNewScanProjects(); if (newScanProjects.size() == originalTable.getProjects().size()) { return; } LogicalTableScan newScan = OptUtils.createLogicalScanWithNewTable( scan, originalTable.withProject(newScanProjects) ); ProjectConverter projectConverter = projectFieldVisitor.createProjectConverter(); List<RexNode> newProjects = new ArrayList<>(); for (RexNode projectExp : project.getProjects()) { RexNode newProjectExp = projectExp.accept(projectConverter); newProjects.add(newProjectExp); } LogicalProject newProject = LogicalProject.create( newScan, project.getHints(), newProjects, project.getRowType() ); call.transformTo(newProject); }
Source:
static <R extends IRecipe<?>> List<R> filterRecipes(Collection<IRecipe<?>> recipes, Class<R> recipeClass, IRecipeType<R> recipeType) { return recipes.stream() .filter(iRecipe -> iRecipe.getType()==recipeType) .map(recipeClass::cast) .collect(Collectors.toCollection(ArrayList::new)); }

Target:
static <R extends IRecipe<?>> Map<ResourceLocation, R> filterRecipes(Collection<IRecipe<?>> recipes, Class<R> recipeClass, IRecipeType<R> recipeType) { return recipes.stream() .filter(iRecipe -> iRecipe.getType()==recipeType) .map(recipeClass::cast) .collect(Collectors.toMap(recipe -> recipe.getId(), recipe -> recipe)); }
Source:
public final void removeBundles(Bundle... bundles) { for (Bundle bundle : bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } if (bundles != null && bundles != this.bundles) { for (Bundle bundle : this.bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } } }

Target:
public final void removeBundles(Bundle... bundles) { for (Bundle bundle : bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } if (bundles != this.bundles) { for (Bundle bundle : this.bundles) { if (bundle != null) { bundle.deleteBundle(prism); } } } }
Source:
public CurrencyAmount presentValue(FixedCouponBondTrade trade, LegalEntityDiscountingProvider provider) { CurrencyAmount pvProduct = presentValueProduct(trade, provider); CurrencyAmount pvPayment = presentValuePayment(trade, provider); return pvProduct.plus(pvPayment); }

Target:
public CurrencyAmount presentValue(FixedCouponBondTrade trade, LegalEntityDiscountingProvider provider) { LocalDate settlementDate = trade.getTradeInfo().getSettlementDate().get(); CurrencyAmount pvProduct = productPricer.presentValue(trade.getProduct(), provider, settlementDate); return presentValueFromProductPresentValue(trade, provider, pvProduct); }
Source:
public Map<String, String> getUAMap(String uaString) { result.clear(); UserAgent browser = null; Device device = null; OS os = null; if (uaString == null) uaString = ""; try { Client c = cachingParser.parse(uaString); if (c != null) { browser = c.userAgent; device = c.device; os = c.os; } } catch (Exception e) { LOG.error(e.getMessage(), e); } if (browser != null) { result.put("browser_family", replaceNA(browser.family)); result.put("browser_major", replaceNA(browser.major)); } else { result.put("browser_family", NA); result.put("browser_major", NA); } if (device != null) { result.put("device_family", replaceNA(device.family)); } else { result.put("device_family", NA); } if (os != null) { result.put("os_family", replaceNA(os.family)); result.put("os_major", replaceNA(os.major)); result.put("os_minor", replaceNA(os.minor)); } else { result.put("os_family", NA); result.put("os_major", NA); result.put("os_minor", NA); } if (uaString.startsWith("WikipediaApp")) { int delimiterIndex = uaString.indexOf(' ', 13); result.put("wmf_app_version", uaString.substring(13, delimiterIndex)); } else { result.put("wmf_app_version", NA); } return result; }

Target:
public Map<String, String> getUAMap(String uaString) { result.clear(); UserAgent browser = null; Device device = null; OS os = null; if (uaString == null) uaString = ""; try { Client c = cachingParser.parse(uaString); if (c != null) { browser = c.userAgent; device = c.device; os = c.os; } } catch (Exception e) { LOG.error(e.getMessage(), e); } if (browser != null) { result.put("browser_family", replaceNA(browser.family)); result.put("browser_major", replaceNA(browser.major)); } else { result.put("browser_family", NA); result.put("browser_major", NA); } if (device != null) { result.put("device_family", replaceNA(device.family)); } else { result.put("device_family", NA); } if (os != null) { result.put("os_family", replaceNA(os.family)); result.put("os_major", replaceNA(os.major)); result.put("os_minor", replaceNA(os.minor)); } else { result.put("os_family", NA); result.put("os_major", NA); result.put("os_minor", NA); } String wmfAppStart = "WikipediaApp/"; if (uaString.startsWith(wmfAppStart)) { int from = wmfAppStart.length(); int to = uaString.indexOf(' ', from); result.put("wmf_app_version", uaString.substring(from, to)); } else { result.put("wmf_app_version", NA); } return result; }
Source:
private List<ComputedStatistics> getComputedStatistics() { ImmutableList.Builder<ComputedStatistics> statistics = ImmutableList.builder(); while (!statisticsAggregation.isFinished()) { Page page = statisticsAggregation.getOutput(); if (page == null) { continue; } for (int position = 0; position < page.getPositionCount(); position++) { statistics.add(getComputedStatistics(page, position)); } } return statistics.build(); }

Target:
private List<ComputedStatistics> getComputedStatistics() { ImmutableList.Builder<ComputedStatistics> statistics = ImmutableList.builder(); while (!statisticsAggregationOperator.isFinished()) { verify(statisticsAggregationOperator.isBlocked().isDone()); Page page = statisticsAggregationOperator.getOutput(); if (page == null) { continue; } for (int position = 0; position < page.getPositionCount(); position++) { statistics.add(getComputedStatistics(page, position)); } } return statistics.build(); }
Source:
public static Serializer getXmlSerializer() { if (xmlSerializer == null) { xmlSerializer = Framework.getService(SerializerService.class).getSerializer("xml"); } return xmlSerializer; }

Target:
public static Serializer getXmlSerializer() { return SerializerService.getXMLSerializerHelper(); }
Source:
private void createNewTargetState(boolean resolve, URL[] urls, IProgressMonitor monitor) { fState = stateObjectFactory.createState(resolve); if (resolve) { fState.getResolver().setSelectionPolicy(new Comparator<BaseDescription>() { @Override public int compare(BaseDescription bd1, BaseDescription bd2) { Version v1 = bd1.getVersion(); Version v2 = bd2.getVersion(); if (v1.getMajor() == v2.getMajor() && v1.getMinor() == v2.getMinor() && v1.getMicro() == v2.getMicro()) { boolean q1 = "qualifier".equals(v1.getQualifier()); boolean q2 = "qualifier".equals(v2.getQualifier()); if (q1 && q2) { return 0; } else if (q1 && !q2) { return -1; } else if (q2 && !q1) { return 1; } } return v2.compareTo(v1); } }); } monitor.beginTask(PDECoreMessages.PDEState_CreatingTargetModelState, urls.length); for (int i = 0; i < urls.length; i++) { File file = new File(urls[i].getFile()); try { if (monitor.isCanceled()) return; monitor.subTask(file.getName()); addBundle(file, -1); } catch (CoreException e) { PDECore.log(e); } finally { monitor.worked(1); } } }

Target:
private void createNewTargetState(boolean resolve, URL[] urls, IProgressMonitor monitor) { fState = stateObjectFactory.createState(resolve); if (resolve) { fState.getResolver().setSelectionPolicy(new Comparator<BaseDescription>() { @Override public int compare(BaseDescription bd1, BaseDescription bd2) { Version v1 = bd1.getVersion(); Version v2 = bd2.getVersion(); int versionCompare = versionCompare(v1, v2); if (versionCompare != 0) return versionCompare; BundleDescription s1 = bd1.getSupplier(); BundleDescription s2 = bd2.getSupplier(); String n1 = s1.getName(); String n2 = s2.getName(); if (n1 != null && n1.equals(n2)) { return versionCompare(s1.getVersion(), s2.getVersion()); } long id1 = s1.getBundleId(); long id2 = s2.getBundleId(); return (id1 < id2) ? -1 : ((id1 == id2) ? 0 : 1); } private int versionCompare(Version v1, Version v2) { if (v1.getMajor() == v2.getMajor() && v1.getMinor() == v2.getMinor() && v1.getMicro() == v2.getMicro()) { boolean q1 = "qualifier".equals(v1.getQualifier()); boolean q2 = "qualifier".equals(v2.getQualifier()); if (q1 && q2) { return 0; } else if (q1 && !q2) { return -1; } else if (q2 && !q1) { return 1; } } int versionCompare = -(v1.compareTo(v2)); return versionCompare; } }); } monitor.beginTask(PDECoreMessages.PDEState_CreatingTargetModelState, urls.length); for (int i = 0; i < urls.length; i++) { File file = new File(urls[i].getFile()); try { if (monitor.isCanceled()) return; monitor.subTask(file.getName()); addBundle(file, -1); } catch (CoreException e) { PDECore.log(e); } finally { monitor.worked(1); } } }
Source:
public static GitRepository makeGitRepository() { final GitRepository repository = new GitRepository("guvnorng-playground", new Space("space")); final HashMap<String, Branch> branches = new HashMap<>(); branches.put("master", new Branch("master", mock(Path.class))); repository.setBranches(branches); return repository; }

Target:
public static GitRepository makeGitRepository() { final GitRepository repository = new GitRepository("guvnorng-playground", new Space("space")); final Map<String, Branch> branches = Collections.singletonMap("master", new Branch("master", mock(Path.class))); repository.setBranches(branches); return repository; }
Source:
public void testChunkResponse() throws IOException { HttpURLConnection urlConn = request("/test/v1/chunk", HttpMethod.POST); try { writeContent(urlConn, "Testing message"); String response = getContent(urlConn); System.out.println(response); } finally { urlConn.disconnect(); } }

Target:
public void testChunkResponse() throws IOException { HttpURLConnection urlConn = request("/test/v1/chunk", HttpMethod.POST); try { writeContent(urlConn, "Testing message"); String response = getContent(urlConn); Assert.assertEquals("Testing message", response); } finally { urlConn.disconnect(); } }
Source:
public void deprecatesDefaultImage() throws IOException { final Talk talk = this.talk(); final XML xml = talk.read(); if (!"yegor256/rultor".equals( xml.xpath("/wire/github-repo/text()").get(0) )) { for (final String path : xml.xpath("/p/entry[@key='merge']/entry[@key='script']") ) { if ("yegor256/rultor".equals(path)) { final String dir = talk.read() .xpath("/talk/daemon/dir/text()").get(0); MatcherAssert.assertThat( dir, StringStartsWith.startsWith( "#### Deprecation Notice ####" ) ); } } } }

Target:
public void deprecatesDefaultImage() throws IOException { final String rultor = "yegor256/rultor"; final Talk talk = this.talk(); final XML xml = talk.read(); final String dir = xml.xpath("/talk/daemon/dir/text()").get(0); final List<String> repos = xml.xpath("/wire/github-repo/text()"); final String notice = "#### Deprecation Notice ####"; final Matcher<String> matcher; if ((repos.isEmpty() || !rultor.equals(repos.get(0))) && xml.xpath( "/p/entry[@key='merge']/entry[@key='script']" ).contains(rultor) ) { matcher = StringStartsWith.startsWith(notice); } else { matcher = Matchers.not(StringStartsWith.startsWith(notice)); } MatcherAssert.assertThat(dir, matcher); }
Source:
protected Map<String, String> buildEnvFromProperties() { Map<String, String> env = new HashMap<String, String>(); Properties sparkProperties = new Properties(); String sparkMaster = getSparkMaster(properties); for (String key : properties.stringPropertyNames()) { if (RemoteInterpreterUtils.isEnvString(key)) { env.put(key, properties.getProperty(key)); } if (isSparkConf(key, properties.getProperty(key))) { sparkProperties.setProperty(key, toShellFormat(properties.getProperty(key))); } } setupPropertiesForPySpark(sparkProperties); setupPropertiesForSparkR(sparkProperties, properties.getProperty("SPARK_HOME")); if (isYarnMode() && getDeployMode().equals("cluster")) { env.put("SPARK_YARN_CLUSTER", "true"); } StringBuilder sparkConfBuilder = new StringBuilder(); if (sparkMaster != null) { sparkConfBuilder.append(" --master " + sparkMaster); } if (isYarnMode() && getDeployMode().equals("cluster")) { sparkConfBuilder.append(" --files " + zConf.getConfDir() + "/log4j_yarn_cluster.properties"); } for (String name : sparkProperties.stringPropertyNames()) { sparkConfBuilder.append(" --conf " + name + "=" + sparkProperties.getProperty(name)); } env.put("ZEPPELIN_SPARK_CONF", sparkConfBuilder.toString()); if (!env.containsKey("HADOOP_CONF_DIR") && System.getenv("HADOOP_CONF_DIR") != null) { env.put("HADOOP_CONF_DIR", System.getenv("HADOOP_CONF_DIR")); } LOGGER.debug("buildEnvFromProperties: " + env); return env; }

Target:
protected Map<String, String> buildEnvFromProperties() { Map<String, String> env = new HashMap<String, String>(); Properties sparkProperties = new Properties(); String sparkMaster = getSparkMaster(properties); for (String key : properties.stringPropertyNames()) { if (RemoteInterpreterUtils.isEnvString(key)) { env.put(key, properties.getProperty(key)); } if (isSparkConf(key, properties.getProperty(key))) { sparkProperties.setProperty(key, toShellFormat(properties.getProperty(key))); } } setupPropertiesForPySpark(sparkProperties); setupPropertiesForSparkR(sparkProperties); if (isYarnMode() && getDeployMode().equals("cluster")) { env.put("ZEPPELIN_SPARK_YARN_CLUSTER", "true"); } StringBuilder sparkConfBuilder = new StringBuilder(); if (sparkMaster != null) { sparkConfBuilder.append(" --master " + sparkMaster); } if (isYarnMode() && getDeployMode().equals("cluster")) { sparkConfBuilder.append(" --files " + zConf.getConfDir() + "/log4j_yarn_cluster.properties"); } for (String name : sparkProperties.stringPropertyNames()) { sparkConfBuilder.append(" --conf " + name + "=" + sparkProperties.getProperty(name)); } env.put("ZEPPELIN_SPARK_CONF", sparkConfBuilder.toString()); for (String envName : new String[]{"SPARK_HOME", "SPARK_CONF_DIR", "HADOOP_CONF_DIR"}) { String envValue = getEnv(envName); if (envValue != null) { env.put(envName, envValue); } } LOGGER.debug("buildEnvFromProperties: " + env); return env; }
Source:
private boolean isViolatingEmptyLineBetweenFieldsPolicy(DetailAST detailAST) { return detailAST.getType() != TokenTypes.RCURLY && !(allowNoEmptyLineBetweenFields && TokenUtil.isOfType(detailAST, TokenTypes.COMMA, TokenTypes.VARIABLE_DEF)); }

Target:
private boolean isViolatingEmptyLineBetweenFieldsPolicy(DetailAST detailAST) { return detailAST.getType() != TokenTypes.RCURLY && (!allowNoEmptyLineBetweenFields || !TokenUtil.isOfType(detailAST, TokenTypes.COMMA, TokenTypes.VARIABLE_DEF)); }
Source:
public static String generateScenarioStepRegexp(String scenarioId, String stepId) { return "^.*" + USER_SCENARIO_ID + scenarioId + US_STEP_ID + "\\d+_" + stepId + "_" + US_METRIC_ID + ".*$"; }

Target:
public static String generateScenarioStepRegexp(String scenarioId, String stepId) { return String.format(SCENARIO_STEP_REGEXP_TEMPLATE, scenarioId, stepId); }
Source:
private boolean setDocumentContent(IDocument document, IEditorInput input) throws CoreException { Reader reader = null; try { if (input instanceof FileStoreEditorInput){ reader = new InputStreamReader(((FileStoreEditorInput)input).getURI().toURL().openStream()); } else if (input instanceof IPathEditorInput){ reader= new FileReader(((IPathEditorInput)input).getPath().toFile()); } else { return false; } } catch (FileNotFoundException e) { return true; } catch (MalformedURLException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); } try { setDocumentContent(document, reader); return true; } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", IStatus.OK, "error reading file", e)); } }

Target:
private boolean setDocumentContent(IDocument document, IEditorInput input) throws CoreException { Reader reader = null; try { if (input instanceof FileStoreEditorInput){ reader = new InputStreamReader(((FileStoreEditorInput)input).getURI().toURL().openStream()); } else if (input instanceof IPathEditorInput){ reader= new FileReader(((IPathEditorInput)input).getPath().toFile()); } else { return false; } } catch (FileNotFoundException e) { return true; } catch (MalformedURLException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", "Incorrect URL", e)); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", "Error reading file", e)); } try { setDocumentContent(document, reader); return true; } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.linuxtools.systemtap.ui.editor", IStatus.OK, "error reading file", e)); } }
Source:
private byte[] getEncryptionKey() { byte[] key; if (loginNeeded) { initUKRForLogin(); if (ukrForLogin == null) { return null; } key = ByteEncrypter.wrapByteArrayWithString(ukrForLogin.getEncryptedKey(), password); } else { CaseUtils.purgeCases(); key = CommCareApplication._().getSession().getLoggedInUser().getWrappedKey(); } this.publishProgress(PROGRESS_CLEANED); return key; }

Target:
private byte[] getEncryptionKey() { byte[] key; if (loginNeeded) { initUKRForLogin(); if (ukrForLogin == null) { return null; } key = ukrForLogin.getEncryptedKey(); } else { key = CommCareApplication._().getSession().getLoggedInUser().getWrappedKey(); } this.publishProgress(PROGRESS_CLEANED); return key; }
Source:
public static Object convertFromJsonValue(JsonValue value) { if (value == null) { return null; } else if (value.isNumber()) { try { return value.asLong(); } catch (NumberFormatException e) { return value.asDouble(); } } else if (value.isBoolean()) { return value.asBoolean(); } else if (value.isNull()) { return null; } else if (value.isString()) { return value.asString(); } throw new HazelcastSerializationException("Unknown Json type: " + value); }

Target:
public static Object convertFromJsonValue(JsonValue value) { if (value == null) { return null; } else if (value.isNumber()) { if (value.toString().contains(".")) { return value.asDouble(); } else { return value.asLong(); } } else if (value.isBoolean()) { return value.asBoolean(); } else if (value.isNull()) { return null; } else if (value.isString()) { return value.asString(); } throw new HazelcastSerializationException("Unknown Json type: " + value); }
Source:
public void start() { life.start(); Values.setNanoPrecision( configuration.get( GraphDatabaseSettings.default_temporal_nanosecond_precision ) ); }

Target:
public void start() { life.start(); int nanoPrecisionConfig = configuration.get( GraphDatabaseSettings.temporal_nanosecond_precision ); if ( nanoPrecisionConfig != Values.getNanoPrecision() && Values.nanoPrecisionConfigAltered ) { throw new IllegalArgumentException( "dbms.temporal.nanosecond_precision can only be set once" ); } Values.setNanoPrecision( nanoPrecisionConfig ); Values.nanoPrecisionConfigAltered = true; }
Source:
void testUnitTypeComparator() { assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(nullType, noneType1)); assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(noneType1, nullType)); assertThrows(IllegalStateException.class, () -> unitTypeComparator.compare(nullType, nullType)); assertEquals(0, unitTypeComparator.compare(infrastructure, infrastructure)); assertEquals(0, unitTypeComparator.compare(antiAircraft, antiAircraft)); assertEquals(0, unitTypeComparator.compare(air, air)); assertEquals(0, unitTypeComparator.compare(sea, sea)); assertEquals(0, unitTypeComparator.compare(attacker, attacker)); assertEquals(0, unitTypeComparator.compare(noneType1, noneType1)); assertEquals(1, unitTypeComparator.compare(infrastructure, antiAircraft)); assertEquals(1, unitTypeComparator.compare(antiAircraft, air)); assertEquals(1, unitTypeComparator.compare(air, sea)); assertEquals(1, unitTypeComparator.compare(sea, attacker)); assertEquals(1, unitTypeComparator.compare(attacker, noneType1)); assertEquals(1, unitTypeComparator.compare(noneType1, noneType2)); assertEquals(-1, unitTypeComparator.compare(antiAircraft, infrastructure)); assertEquals(-1, unitTypeComparator.compare(air, antiAircraft)); assertEquals(-1, unitTypeComparator.compare(sea, air)); assertEquals(-1, unitTypeComparator.compare(attacker, sea)); assertEquals(-1, unitTypeComparator.compare(noneType1, attacker)); assertEquals(-1, unitTypeComparator.compare(noneType2, noneType1)); }

Target:
void testUnitTypeComparator() { assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(nullType, noneType1)); assertThrows( IllegalStateException.class, () -> unitTypeComparator.compare(noneType1, nullType)); assertThrows(IllegalStateException.class, () -> unitTypeComparator.compare(nullType, nullType)); assertThat(unitTypeComparator.compare(infrastructure, infrastructure), is(0)); assertThat(unitTypeComparator.compare(antiAircraft, antiAircraft), is(0)); assertThat(unitTypeComparator.compare(air, air), is(0)); assertThat(unitTypeComparator.compare(sea, sea), is(0)); assertThat(unitTypeComparator.compare(attacker, attacker), is(0)); assertThat(unitTypeComparator.compare(noneType1, noneType1), is(0)); assertThat(unitTypeComparator.compare(infrastructure, antiAircraft), is(1)); assertThat(unitTypeComparator.compare(antiAircraft, air), is(1)); assertThat(unitTypeComparator.compare(air, sea), is(1)); assertThat(unitTypeComparator.compare(sea, attacker), is(1)); assertThat(unitTypeComparator.compare(attacker, noneType1), is(1)); assertThat(unitTypeComparator.compare(noneType1, noneType2), is(1)); assertThat(unitTypeComparator.compare(antiAircraft, infrastructure), is(-1)); assertThat(unitTypeComparator.compare(air, antiAircraft), is(-1)); assertThat(unitTypeComparator.compare(sea, air), is(-1)); assertThat(unitTypeComparator.compare(attacker, sea), is(-1)); assertThat(unitTypeComparator.compare(noneType1, attacker), is(-1)); assertThat(unitTypeComparator.compare(noneType2, noneType1), is(-1)); }
Source:
public Stock(String symbol, String name, double price) { super(); this.symbol = symbol; this.name = name; this.price = price; }

Target:
public Stock(String symbol, String name, double price) { this.symbol = symbol; this.name = name; this.price = price; }
Source:
public BackupMessagesLoader(BrokerMessageProducer brokerMessageProducer, HermesMetrics hermesMetrics, BrokerListeners brokerListeners, TopicsCache topicsCache, Trackers trackers, ConfigFactory config) { this.brokerMessageProducer = brokerMessageProducer; this.hermesMetrics = hermesMetrics; this.brokerListeners = brokerListeners; this.topicsCache = topicsCache; this.trackers = trackers; this.secondsToWaitForTopicsCache = config.getIntProperty(MESSAGES_LOADING_WAIT_FOR_TOPICS_CACHE); this.messageMaxAgeHours = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_AGE_HOURS); this.resentSleep = config.getIntProperty(KAFKA_PRODUCER_ACK_TIMEOUT) + secondsToWaitForTopicsCache * 1000; this.maxResent = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_RESENT); }

Target:
public BackupMessagesLoader(BrokerMessageProducer brokerMessageProducer, HermesMetrics hermesMetrics, BrokerListeners brokerListeners, TopicsCache topicsCache, Trackers trackers, ConfigFactory config) { this.brokerMessageProducer = brokerMessageProducer; this.hermesMetrics = hermesMetrics; this.brokerListeners = brokerListeners; this.topicsCache = topicsCache; this.trackers = trackers; this.secondsToWaitForTopicsCache = config.getIntProperty(MESSAGES_LOADING_WAIT_FOR_TOPICS_CACHE); this.messageMaxAgeHours = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_AGE_HOURS); this.resendSleep = config.getIntProperty(KAFKA_PRODUCER_ACK_TIMEOUT) + secondsToWaitForTopicsCache * 1000; this.maxResendRetries = config.getIntProperty(MESSAGES_LOCAL_STORAGE_MAX_RESEND_RETRIES); }
Source:
private void createFSTIndexForColumn(ColumnMetadata columnMetadata) throws IOException { String column = columnMetadata.getColumnName(); boolean hasDictionary = columnMetadata.hasDictionary(); if (!hasDictionary) { return; } if (_segmentWriter.hasIndexFor(column, ColumnIndexType.FST_INDEX)) { LOGGER.info("Found text index for column: {}, in segment: {}", column, _segmentName); return; } LOGGER.info( "Creating new FST index for column: in segment: {}, hasDictionary: {}, cardinality: {}", column, _segmentName, hasDictionary, columnMetadata.getCardinality()); File segmentDirectory = SegmentDirectoryPaths.segmentDirectoryFor( _indexDir, _segmentVersion); LuceneFSTIndexCreator luceneFSTIndexCreator = new LuceneFSTIndexCreator( segmentDirectory, column, columnMetadata.getCardinality(), null); try (BaseImmutableDictionary dictionary = getDictionaryReader(columnMetadata);) { for (int dictId = 0; dictId < dictionary.length(); dictId++) { luceneFSTIndexCreator.addSortedDictIds( dictionary.getStringValue(dictId), dictId); } } luceneFSTIndexCreator.seal(); }

Target:
private void createFSTIndexForColumn(ColumnMetadata columnMetadata) throws IOException { String column = columnMetadata.getColumnName(); File inProgress = new File(_indexDir, column + ".fst.inprogress"); File fstIndexFile = new File(_indexDir, column + FST_INDEX_FILE_EXTENSION); if (!inProgress.exists()) { if (_segmentWriter.hasIndexFor(column, ColumnIndexType.FST_INDEX)) { LOGGER.info("Found fst index for column: {}, in segment: {}", column, _segmentName); return; } FileUtils.touch(inProgress); } else { FileUtils.deleteQuietly(fstIndexFile); } LOGGER.info("Creating new FST index for column: in segment: {}, cardinality: {}", column, _segmentName, columnMetadata.getCardinality()); LuceneFSTIndexCreator luceneFSTIndexCreator = new LuceneFSTIndexCreator(_indexDir, column, null); try (BaseImmutableDictionary dictionary = getDictionaryReader(columnMetadata);) { for (int dictId = 0; dictId < dictionary.length(); dictId++) { luceneFSTIndexCreator.add(dictionary.getStringValue(dictId)); } } luceneFSTIndexCreator.seal(); if (_segmentVersion == SegmentVersion.v3) { LoaderUtils.writeIndexToV3Format(_segmentWriter, column, fstIndexFile, ColumnIndexType.FST_INDEX); } FileUtils.deleteQuietly(inProgress); LOGGER.info("Created FST index for segment: {}, column: {}", _segmentName, column); }
Source:
protected void onLoad() { super.onLoad(); Util.ACCOUNT_SVC.myAccount(new ScreenLoadCallback<Account>(this) { public void preDisplay(final Account result) { display(result.getGeneralPreferences()); AccountApi.self().view("preferences").get(new AsyncCallback<Preferences>() { @Override public void onSuccess(Preferences prefs) { displayMyMenus(prefs.my()); } @Override public void onFailure(Throwable caught) { } }); } }); }

Target:
protected void onLoad() { super.onLoad(); AccountApi.self().view("preferences") .get(new ScreenLoadCallback<Preferences>(this) { @Override public void preDisplay(Preferences prefs) { display(prefs); } }); }
Source:
public void removeInterviewByAppointmentId(String interviewId) throws InterviewNotFoundException, HttpRequestException, QuestionsBlockNotFound, WrongCriteriaException { List<Interview> interviewsList = new ArrayList<Interview>(); { Interview interview1 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment1.getAppointmentId()); Interview interview2 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment2.getAppointmentId()); interviewsList.add(interview1); interviewsList.add(interview2); } while(true){ for (int i = 0; i < interviewsList.size(); i++){ if (interviewsList.get(i).getAppointmentId().equals(interviewId)){ interviewsList.remove(i); return; } } throw new InterviewNotFoundException("Wrong ID, interview not found"); } }

Target:
public void removeInterviewByAppointmentId(String interviewId) throws HttpRequestException, InterviewNotFoundException { List<Interview> interviewsList = new ArrayList<Interview>(); { Interview interview1 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment1.getAppointmentId()); Interview interview2 = interviewFactory.getInterviewWithType(InterviewType.InterviewWithUserAndStandardQuestions).create(appointment2.getAppointmentId()); interviewsList.add(interview1); interviewsList.add(interview2); } for (int i = 0; i < interviewsList.size(); i++){ if (interviewsList.get(i).getAppointmentId().equals(interviewId)){ interviewsList.remove(i); return; } } throw new InterviewNotFoundException("Wrong ID, interview not found"); }
Source:
protected void handleHTTPError(final HttpResponseException e) { if (e.getStatusCode() == HttpStatus.SC_FORBIDDEN) { String message = "Network Error."; try { JSONObject obj = new JSONObject(e.getMessage()); message = obj.getString("msg"); } catch (JSONException e1) { ZLog.logException(e1); } final String finalMessage = message; ((LoginActivity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, finalMessage, Toast.LENGTH_LONG) .show(); } }); } else { super.handleHTTPError(e); } }

Target:
protected void handleHTTPError(final HttpResponseException e) { if (e.getStatusCode() == HttpStatus.SC_FORBIDDEN) { String message = context.getString(R.string.network_error); try { JSONObject obj = new JSONObject(e.getMessage()); message = obj.getString("msg"); } catch (JSONException e1) { ZLog.logException(e1); } final String finalMessage = message; ((LoginActivity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, finalMessage, Toast.LENGTH_LONG) .show(); } }); } else { super.handleHTTPError(e); } }
Source:
public ConfigEntry(String name, String value, ConfigSource source, boolean isSensitive, boolean isReadOnly, List<ConfigSynonym> synonyms) { Objects.requireNonNull(name, "name should not be null"); this.name = name; this.value = value; this.source = source; this.isSensitive = isSensitive; this.isReadOnly = isReadOnly; this.synonyms = synonyms; }

Target:
ConfigEntry(String name, String value, ConfigSource source, boolean isSensitive, boolean isReadOnly, List<ConfigSynonym> synonyms) { Objects.requireNonNull(name, "name should not be null"); this.name = name; this.value = value; this.source = source; this.isSensitive = isSensitive; this.isReadOnly = isReadOnly; this.synonyms = synonyms; }
Source:
public void run() { if (getStateSystemBuilder() == null) { System.err.println("Cannot run event manager without assigning a target state system first!"); return; } ITmfEvent event; try { event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } currentEvent = event; if (fEventType.isInstance(event) && event.getType() != null) { eventHandle(event); } event = fEventsQueue.take(); } closeStateSystem(); } catch (InterruptedException e) { System.out.println("Event handler interrupted!"); e.printStackTrace(); } }

Target:
public void run() { if (!fStateSystemAssigned) { System.err.println("Cannot run event manager without assigning a target state system first!"); return; } ITmfEvent event; try { event = fEventsQueue.take(); while (event != END_EVENT) { if (event == EMPTY_QUEUE_EVENT) { event = fEventsQueue.take(); continue; } currentEvent = event; if (fEventType.isInstance(event) && event.getType() != null) { eventHandle(event); } event = fEventsQueue.take(); } closeStateSystem(); } catch (InterruptedException e) { System.out.println("Event handler interrupted!"); e.printStackTrace(); } }
Source:
protected Control createDialogArea(Composite parent) { getShell().setText(UIText.AddConfigEntryDialog_AddConfigTitle); setTitle(UIText.AddConfigEntryDialog_AddConfigTitle); setMessage(UIText.AddConfigEntryDialog_DialogMessage); Composite titleParent = (Composite) super.createDialogArea(parent); Composite main = new Composite(titleParent, SWT.NONE); main.setLayout(new GridLayout(2, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(main); Label keyLabel = new Label(main, SWT.NONE); keyLabel.setText(UIText.AddConfigEntryDialog_KeyLabel); keyLabel.setToolTipText(UIText.AddConfigEntryDialog_ConfigKeyTooltip); keyText = new Text(main, SWT.BORDER); if (suggestedKey != null) { keyText.setText(trimKey(suggestedKey)); keyText.selectAll(); } keyText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { check(); } }); keyText.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { addValueContentProposal(valueText, keyText.getText()); } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(keyText); new Label(main, SWT.NONE) .setText(UIText.AddConfigEntryDialog_ValueLabel); valueText = new Text(main, SWT.BORDER); valueText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { check(); } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(valueText); applyDialogFont(main); addKeyContentProposal(keyText); return main; }

Target:
protected Control createDialogArea(Composite parent) { getShell().setText(UIText.AddConfigEntryDialog_AddConfigTitle); setTitle(UIText.AddConfigEntryDialog_AddConfigTitle); setMessage(UIText.AddConfigEntryDialog_DialogMessage); Composite titleParent = (Composite) super.createDialogArea(parent); Composite main = new Composite(titleParent, SWT.NONE); main.setLayout(new GridLayout(2, false)); GridDataFactory.fillDefaults().grab(true, true).applyTo(main); Label keyLabel = new Label(main, SWT.NONE); keyLabel.setText(UIText.AddConfigEntryDialog_KeyLabel); keyLabel.setToolTipText(UIText.AddConfigEntryDialog_ConfigKeyTooltip); keyText = new Text(main, SWT.BORDER); if (suggestedKey != null) { keyText.setText(trimKey(suggestedKey)); keyText.selectAll(); } keyText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { check(); } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(keyText); new Label(main, SWT.NONE) .setText(UIText.AddConfigEntryDialog_ValueLabel); valueText = new Text(main, SWT.BORDER); valueText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { check(); } }); GridDataFactory.fillDefaults().grab(true, false).applyTo(valueText); applyDialogFont(main); addKeyContentProposal(); addValueContentProposal(); return main; }
Source:
public SetScheduleDeviceRequest(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final ScheduleMessageDataContainerDto scheduleMessageDataContainer, final RelayTypeDto relayType, final String domain, final String domainVersion, final String messageType, final int messagePriority, final String ipAddress, final int retryCount, final boolean isScheduled) { super(organisationIdentification, deviceIdentification, correlationUid, domain, domainVersion, messageType, messagePriority, ipAddress, retryCount, isScheduled); this.scheduleMessageDataContainer = scheduleMessageDataContainer; this.relayType = relayType; }

Target:
public SetScheduleDeviceRequest(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final ScheduleMessageDataContainerDto scheduleMessageDataContainer, final RelayTypeDto relayType, final String domain, final String domainVersion, final String messageType, final int messagePriority, final String ipAddress, final int retryCount, final boolean isScheduled) { super(DeviceRequest.newBuilder().organisationIdentification(organisationIdentification) .deviceIdentification(deviceIdentification).correlationUid(correlationUid).domain(domain) .domainVersion(domainVersion).messageType(messageType).messagePriority(messagePriority) .ipAddress(ipAddress).retryCount(retryCount).isScheduled(isScheduled)); this.scheduleMessageDataContainer = scheduleMessageDataContainer; this.relayType = relayType; }
Source:
List<VdsNetworkInterface> filterNicsWithUnmanagedNetworks( List<VdsNetworkInterface> existingInterfaces, Set<String> removedUnmanagedNetworks){ List<VdsNetworkInterface> nicsWithUnmanagedNetworks = new ArrayList<VdsNetworkInterface>(); for(VdsNetworkInterface nic : existingInterfaces){ if(nic.getNetworkImplementationDetails()!=null && !nic.getNetworkImplementationDetails().isManaged()) if (!removedUnmanagedNetworks.contains(nic.getNetworkName())) nicsWithUnmanagedNetworks.add(nic); } return nicsWithUnmanagedNetworks; }

Target:
List<VdsNetworkInterface> filterNicsWithUnmanagedNetworks( List<VdsNetworkInterface> existingInterfaces, Set<String> removedUnmanagedNetworks){ List<VdsNetworkInterface> nicsWithUnmanagedNetworks = new ArrayList<>(); for(VdsNetworkInterface nic : existingInterfaces){ if(nic.getNetworkImplementationDetails()!=null && !nic.getNetworkImplementationDetails().isManaged()) if (!removedUnmanagedNetworks.contains(nic.getNetworkName())) nicsWithUnmanagedNetworks.add(nic); } return nicsWithUnmanagedNetworks; }
Source:
public ValidationResult canStopOrCommitRemoveBrick(GlusterVolumeEntity volumeEntity, List<GlusterBrickEntity> paramBricks) { GlusterAsyncTask asyncTask = volumeEntity.getAsyncTask(); if (asyncTask != null && asyncTask.getType() == GlusterTaskType.REMOVE_BRICK) { if (paramBricks.isEmpty()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); } List<GlusterBrickEntity> bricksForTask = getGlusterBrickDao().getGlusterVolumeBricksByTaskId(asyncTask.getTaskId()); if (paramBricks.size() != bricksForTask.size()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); } int counter = 0; for (GlusterBrickEntity paramBrick : paramBricks) { for (GlusterBrickEntity brick : bricksForTask) { if (paramBrick.getBrickDirectory().equals(brick.getBrickDirectory()) && paramBrick.getServerId() == brick.getServerId()) { break; } counter++; if (counter == bricksForTask.size()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); } } } } return ValidationResult.VALID; }

Target:
public ValidationResult canStopOrCommitRemoveBrick(GlusterVolumeEntity volumeEntity, List<GlusterBrickEntity> paramBricks) { GlusterAsyncTask asyncTask = volumeEntity.getAsyncTask(); if (asyncTask == null || asyncTask.getType() != GlusterTaskType.REMOVE_BRICK) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID_TASK_TYPE); } if (paramBricks.isEmpty()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); } List<GlusterBrickEntity> bricksForTask = getGlusterBrickDao().getGlusterVolumeBricksByTaskId(asyncTask.getTaskId()); if (paramBricks.size() != bricksForTask.size() || !areBricksInTheList(paramBricks, bricksForTask)) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); } return ValidationResult.VALID; }
Source:
public Completable toCompletable() { return new Completable(OnSubscribeCompletable.create(this)); }

Target:
public Completable toCompletable() { return Completable.fromObservable(this); }
Source:
private void createButtons() { ButtonType submitButtonType = new ButtonType("Save", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(submitButtonType, ButtonType.CANCEL); submitButton = (Button) getDialogPane().lookupButton(submitButtonType); setResultConverter(submit -> { if (submit == submitButtonType) { return nameField.getText(); } return null; }); }

Target:
private void createButtons() { ButtonType submitButtonType = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(submitButtonType, ButtonType.CANCEL); submitButton = (Button) getDialogPane().lookupButton(submitButtonType); submitButton.setId("boardsavebutton"); setResultConverter(submit -> { if (submit == submitButtonType) { return nameField.getText(); } return null; }); }
Source:
public Message copy(final long newID) { try { LargeServerMessage newMessage = storageManager.createLargeMessage(newID, this); ensureFileExists(false); SequentialFile cloneFile = file.cloneFile(); try { byte[] bufferBytes = new byte[100 * 1024]; ByteBuffer buffer = ByteBuffer.wrap(bufferBytes); if (!cloneFile.isOpen()) { cloneFile.open(); } cloneFile.position(0); for (;;) { buffer.clear(); int bytesRead = cloneFile.read(buffer); byte[] bufferToWrite; if (bytesRead <= 0) { break; } else if (bytesRead == bufferBytes.length && !this.storageManager.isReplicated()) { bufferToWrite = bufferBytes; } else { bufferToWrite = new byte[bytesRead]; System.arraycopy(bufferBytes, 0, bufferToWrite, 0, bytesRead); } newMessage.addBytes(bufferToWrite); if (bytesRead < bufferBytes.length) { break; } } } finally { cloneFile.close(); } return newMessage; } catch (Exception e) { ActiveMQServerLogger.LOGGER.lareMessageErrorCopying(e, this); return null; } }

Target:
public Message copy(final long newID) { try { LargeServerMessage newMessage = storageManager.createLargeMessage(newID, this); ensureFileExists(false); SequentialFile cloneFile = file.cloneFile(); try { byte[] bufferBytes = new byte[100 * 1024]; ByteBuffer buffer = ByteBuffer.wrap(bufferBytes); if (!cloneFile.isOpen()) { cloneFile.open(); } cloneFile.position(0); for (;;) { buffer.clear(); int bytesRead = cloneFile.read(buffer); byte[] bufferToWrite; if (bytesRead <= 0) { break; } else if (bytesRead == bufferBytes.length && !this.storageManager.isReplicated()) { bufferToWrite = bufferBytes; } else { bufferToWrite = new byte[bytesRead]; System.arraycopy(bufferBytes, 0, bufferToWrite, 0, bytesRead); } newMessage.addBytes(bufferToWrite); if (bytesRead < bufferBytes.length) { break; } } } finally { if (!file.isOpen()) { newMessage.getFile().close(); } cloneFile.close(); } return newMessage; } catch (Exception e) { ActiveMQServerLogger.LOGGER.lareMessageErrorCopying(e, this); return null; } }