auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void argumentsInScript() throws Exception { File xmlFile = tmpFolder.newFile(); TaskFlowJob job = new TaskFlowJob(); job.setName("simpleJob"); String params[] = { "param1", "param2" }; SimpleScript script = new SimpleScript("\nprint('arguments[0]='+arguments[0])\n", "javascript", params); ScriptTask task = new ScriptTask(); task.setName("testTask"); task.setScript(new TaskScript(script)); job.addTask(task); new Job2XMLTransformer().job2xmlFile(job, xmlFile); TaskFlowJob recreatedJob = (TaskFlowJob) (JobFactory.getFactory().createJob(xmlFile.getAbsolutePath())); assertNotNull(((ScriptTask) recreatedJob.getTask("testTask")).getScript()); }

Target:
public void argumentsInScript() throws Exception { File xmlFile = tmpFolder.newFile(); TaskFlowJob job = new TaskFlowJob(); job.setName("simpleJob"); String params[] = { "param1", "param2" }; SimpleScript script = new SimpleScript("\nprint('arguments[0]='+arguments[0])\n", "javascript", params); ScriptTask task = new ScriptTask(); task.setName("testTask"); task.setScript(new TaskScript(script)); job.addTask(task); new Job2XMLTransformer().job2xmlFile(job, xmlFile); TaskFlowJob recreatedJob = (TaskFlowJob) (JobFactory.getFactory().createJob(xmlFile.getAbsolutePath())); Assert.assertEquals("param1", ((ScriptTask) recreatedJob.getTask("testTask")).getScript().getParameters()[0].toString()); Assert.assertEquals("param2", ((ScriptTask) recreatedJob.getTask("testTask")).getScript().getParameters()[1].toString()); }
Source:
public int bulkInsert(List<Record> records) throws NullCursorException { if (records.isEmpty()) { Logger.debug(LOG_TAG, "No records to insert, returning."); } int size = records.size(); ContentValues[] cvs = new ContentValues[size]; int index = 0; for (Record record : records) { cvs[index] = getContentValues(record); index += 1; } int inserted = context.getContentResolver().bulkInsert(getUri(), cvs); if (inserted == size) { Logger.debug(LOG_TAG, "Inserted " + inserted + " records, as expected."); } else { Logger.debug(LOG_TAG, "Inserted " + inserted + " records but expected " + size + " records."); } return inserted; }

Target:
public int bulkInsert(List<Record> records) throws NullCursorException { if (records.isEmpty()) { Logger.debug(LOG_TAG, "No records to insert, returning."); } int size = records.size(); ContentValues[] cvs = new ContentValues[size]; int index = 0; for (Record record : records) { try { cvs[index] = getContentValues(record); index += 1; } catch (Exception e) { Logger.warn(LOG_TAG, "Got exception in getContentValues for record with guid " + record.guid, e); } } if (index != size) { size = index; ContentValues[] temp = new ContentValues[size]; System.arraycopy(cvs, 0, temp, 0, size); } int inserted = context.getContentResolver().bulkInsert(getUri(), cvs); if (inserted == size) { Logger.debug(LOG_TAG, "Inserted " + inserted + " records, as expected."); } else { Logger.debug(LOG_TAG, "Inserted " + inserted + " records but expected " + size + " records."); } return inserted; }
Source:
private void impl$onSet(NBTTagCompound compound, CallbackInfo callbackInfo) { if (this.stackTagCompound != compound) { this.manipulators.clear(); } if (shadow$hasTagCompound() && shadow$getTagCompound().hasKey(Constants.Sponge.SPONGE_DATA, Constants.NBT.TAG_COMPOUND)) { DataUtil.readCustomData(shadow$getTagCompound().getCompoundTag(Constants.Sponge.SPONGE_DATA), ((org.spongepowered.api.item.inventory.ItemStack) this)); } }

Target:
private void impl$onSet(NBTTagCompound compound, CallbackInfo callbackInfo) { if (this.stackTagCompound != compound) { this.manipulators.clear(); } if (this.shadow$hasTagCompound() && this.shadow$getTagCompound().hasKey(Constants.Sponge.SPONGE_DATA, Constants.NBT.TAG_COMPOUND)) { DataUtil.readCustomData(this.shadow$getTagCompound().getCompoundTag(Constants.Sponge.SPONGE_DATA), ((org.spongepowered.api.item.inventory.ItemStack) this)); } }
Source:
public Boolean hasCommandSpy() { return commandSpy; }

Target:
public boolean hasCommandSpy() { return commandSpy; }
Source:
private boolean isChanged(List<String> ol, List<String> nl) { if (ol.size() != nl.size()) return true; for (int i = 0; i < ol.size(); i++) { if (!ol.get(i).equals(nl.get(i))) return true; } return false; }

Target:
private boolean isChanged(List<String> ol, List<String> nl) { if (ol.size() != nl.size()) return true; for (int i = 0; i < ol.size(); i++) if (!ol.get(i).equals(nl.get(i))) return true; return false; }
Source:
public void builtin_symbol_in_super_class() { ClassSymbolImpl classASymbol = new ClassSymbolImpl("A", "mod1.A"); classASymbol.addSuperClass(new SymbolImpl("BaseException", "BaseException")); FileInput tree = parse( new SymbolTableBuilder("my_package", pythonFile("my_module.py"), Collections.singletonMap("mod1", Collections.singleton(classASymbol))), "from mod1 import A" ); Symbol importedASymbol = tree.globalVariables().iterator().next(); assertThat(importedASymbol.kind()).isEqualTo(Symbol.Kind.CLASS); ClassSymbol classA = (ClassSymbol) importedASymbol; assertThat(classA.hasUnresolvedTypeHierarchy()).isEqualTo(false); assertThat(classA.superClasses()).hasSize(1); assertThat(classA.superClasses().get(0).kind()).isEqualTo(Symbol.Kind.OTHER); }

Target:
public void builtin_symbol_in_super_class() { ClassSymbolImpl classASymbol = new ClassSymbolImpl("A", "mod1.A"); classASymbol.addSuperClass(new SymbolImpl("BaseException", "BaseException")); FileInput tree = parse( new SymbolTableBuilder("my_package", pythonFile("my_module.py"), Collections.singletonMap("mod1", Collections.singleton(classASymbol))), "from mod1 import A" ); Symbol importedASymbol = tree.globalVariables().iterator().next(); assertThat(importedASymbol.kind()).isEqualTo(Symbol.Kind.CLASS); ClassSymbol classA = (ClassSymbol) importedASymbol; assertThat(classA.hasUnresolvedTypeHierarchy()).isEqualTo(true); assertThat(classA.superClasses()).hasSize(1); assertThat(classA.superClasses().get(0).kind()).isEqualTo(Symbol.Kind.OTHER); }
Source:
private Item getBasicFilmWithoutBroadcast(ProgData progData, DateTimeZone zone, Timestamp updatedAt) { String rtFilmAlias = PaHelper.getFilmRtAlias(progData.getRtFilmnumber()); String filmUri = PaHelper.getFilmUri(identifierFor(progData)); ResolvedContent possiblePreviousData = contentResolver.findByCanonicalUris(ImmutableList.of(rtFilmAlias, filmUri)); Film film; Maybe<Identified> oldFilm = possiblePreviousData.get(rtFilmAlias); Maybe<Identified> newFilm = possiblePreviousData.get(filmUri); if (oldFilm.hasValue()) { Identified previous = oldFilm.requireValue(); if (previous instanceof Film) { film = (Film) previous; } else { film = new Film(); Item.copyTo((Episode) previous, film); } film.addAlias(PaHelper.getProgIdAlias(progData.getProgId())); film.addAliasUrl(filmUri); } else if (newFilm.hasValue()) { Identified previous = newFilm.requireValue(); if (previous instanceof Film) { film = (Film) previous; } else { film = new Film(); Item.copyTo((Episode) previous, film); } film.addAlias(PaHelper.getProgIdAlias(progData.getProgId())); film.addAliasUrl(rtFilmAlias); } else { film = getBasicFilm(progData); } if (progData.getFilmYear() != null && MoreStrings.containsOnlyAsciiDigits(progData.getFilmYear())) { film.setYear(Integer.parseInt(progData.getFilmYear())); } return film; }

Target:
private Item getBasicFilmWithoutBroadcast(ProgData progData, DateTimeZone zone, Timestamp updatedAt) { String filmAlias = PaHelper.getAlias(progData.getProgId()); String filmUri = PaHelper.getFilmUri(identifierFor(progData)); Maybe<Identified> possiblePreviousData = contentResolver.findByUris(ImmutableList.of( filmAlias, filmUri )).getFirstValue(); Film film; if (possiblePreviousData.hasValue()) { Identified previous = possiblePreviousData.requireValue(); if (previous instanceof Film) { film = (Film) previous; } else { film = new Film(); Item.copyTo((Episode) previous, film); } } else { film = getBasicFilm(progData); } if (progData.getFilmYear() != null && MoreStrings.containsOnlyAsciiDigits(progData.getFilmYear())) { film.setYear(Integer.parseInt(progData.getFilmYear())); } return film; }
Source:
private boolean invalidParam(String url) { return url == null || url.length() == 0; }

Target:
private boolean invalidParam(String url) { return TextUtils.isEmpty(url); }
Source:
public void testShowStatsWithMultipleFromFails() { assertQueryFails("SHOW STATS FOR (SELECT * FROM orders, nation_partitioned)", ".*There must be exactly one table in query passed to SHOW STATS SELECT clause"); }

Target:
public void testShowStatsWithMultipleFromFails() { assertQueryFails("SHOW STATS FOR (SELECT * FROM nation_partitioned, region)", ".*There must be exactly one table in query passed to SHOW STATS SELECT clause"); }
Source:
public static List<StorageServerConnections> updateIfaces(List<StorageServerConnections> conns, Guid vdsId) { List<StorageServerConnections> res = new ArrayList<>(conns); for (StorageServerConnections conn : conns) { List<VdsNetworkInterface> ifaces = DbFacade.getInstance().getInterfaceDao() .getIscsiIfacesByHostIdAndStorageTargetId(vdsId, conn.getid()); if (!ifaces.isEmpty()) { VdsNetworkInterface vdsNetworkInterface = ifaces.remove(0); conn.setIface(vdsNetworkInterface.getName()); conn.setNetIfacename(vdsNetworkInterface.isBridged() ? vdsNetworkInterface.getNetworkName() : vdsNetworkInterface.getName()); for (VdsNetworkInterface iface : ifaces) { StorageServerConnections newConn = StorageServerConnections.copyOf(conn); newConn.setid(Guid.newGuid().toString()); newConn.setIface(iface.getName()); newConn.setNetIfacename(iface.isBridged() ? iface.getNetworkName() : iface.getName()); res.add(newConn); } } } return res; }

Target:
public static List<StorageServerConnections> updateIfaces(List<StorageServerConnections> conns, Guid vdsId) { List<StorageServerConnections> res = new ArrayList<>(conns); for (StorageServerConnections conn : conns) { List<VdsNetworkInterface> ifaces = DbFacade.getInstance().getInterfaceDao() .getIscsiIfacesByHostIdAndStorageTargetId(vdsId, conn.getid()); if (!ifaces.isEmpty()) { VdsNetworkInterface removedInterface = ifaces.remove(0); setInterfaceProperties(conn, removedInterface); for (VdsNetworkInterface iface : ifaces) { StorageServerConnections newConn = StorageServerConnections.copyOf(conn); newConn.setid(Guid.newGuid().toString()); setInterfaceProperties(newConn, iface); res.add(newConn); } } } return res; }
Source:
public void toLastCommitted() { log.debug("toLastCommitted tailer: " + id); String msg = consumer.assignment().stream().map(tp -> String.format("%s-%02d:+%d", getNameForTopic(tp.topic()), tp.partition(), toLastCommitted(tp))) .collect(Collectors.joining("|")); if (msg.length() > 0) { log.info("toLastCommitted offsets: " + group + ":" + msg); } lastCommittedOffsets.clear(); lastOffsets.clear(); records.clear(); }

Target:
public void toLastCommitted() { if (log.isDebugEnabled()) { log.debug("toLastCommitted tailer: " + id); } String msg = consumer.assignment() .stream() .map(tp -> String.format("%s-%02d:+%d", getNameForTopic(tp.topic()), tp.partition(), toLastCommitted(tp))) .collect(Collectors.joining("|")); if (msg.length() > 0) { if (log.isInfoEnabled()) { log.info("toLastCommitted offsets: " + group + ":" + msg); } } lastCommittedOffsets.clear(); lastOffsets.clear(); records.clear(); }
Source:
private DetectorTask restoreRedundancyAndMergeSegments(Layout layout) { String localEndpoint = serverContext.getLocalEndpoint(); if (RedundancyCalculator.requiresMerge(layout, localEndpoint) && !layout.getUnresponsiveServers().contains(localEndpoint)) { log.info("Layout requires restoration: {}. Spawning task to merge segments on {}.", layout, localEndpoint); Supplier<Boolean> redundancyAction = () -> handleMergeSegments( localEndpoint, runtimeSingletonResource, layout, MERGE_SEGMENTS_RETRY_QUERY_TIMEOUT ); mergeSegmentsTask = CompletableFuture.supplyAsync(redundancyAction, failureDetectorWorker); return DetectorTask.COMPLETED; } else if (!mergeSegmentsTask.isDone()) { log.debug("Merge segments task already in progress. Skipping spawning another task."); return DetectorTask.SKIPPED; } log.debug("No segments to merge. Skipping step."); return DetectorTask.SKIPPED; }

Target:
private void restoreRedundancyAndMergeSegments(Layout layout) { String localEndpoint = serverContext.getLocalEndpoint(); if (!mergeSegmentsTask.isDone()){ log.trace("Merge segments task already in progress. Skipping spawning another task."); return; } if (RedundancyCalculator.canRestoreRedundancyOrMergeSegments(layout, localEndpoint) && !layout.getUnresponsiveServers().contains(localEndpoint)) { log.info("Layout requires restoration: {}. Spawning task to merge segments on {}.", layout, localEndpoint); Supplier<Boolean> redundancyAction = () -> handleMergeSegments( localEndpoint, runtimeSingletonResource, layout ); mergeSegmentsTask = CompletableFuture.supplyAsync(redundancyAction, failureDetectorWorker); return; } log.trace("No segments to merge. Skipping step."); }
Source:
public void shouldPreferClientDestPortWhenInitialized() { HttpRequestMessageImpl message = new HttpRequestMessageImpl(new SessionContext(), "HTTP/1.1", "POST", "/some/where", new HttpQueryParams(), new Headers(), "192.168.0.2", "https", 7002, "localhost", new InetSocketAddress("api.netflix.com", 443)); assertEquals(message.getClientDestinationPort(), 443); }

Target:
public void shouldPreferClientDestPortWhenInitialized() { HttpRequestMessageImpl message = new HttpRequestMessageImpl(new SessionContext(), "HTTP/1.1", "POST", "/some/where", new HttpQueryParams(), new Headers(), "192.168.0.2", "https", 7002, "localhost", new InetSocketAddress("api.netflix.com", 443)); assertEquals(message.getClientDestinationPort(), Optional.of(443)); }
Source:
public void storePrefs() { List<String> externalStyles = styles.stream().filter(style -> !style.internalStyleProperty().get()).map(this::toOOBibStyle).map(OOBibStyle::getPath).collect(Collectors.toList()); preferences.setExternalStyles(externalStyles); preferences.setCurrentStyle(selectedItem.getValue().getStylePath()); preferencesService.setOpenOfficePreferences(preferences); }

Target:
public void storePrefs() { List<String> externalStyles = styles.stream().map(this::toOOBibStyle).filter(style->!style.isInternalStyle()).map(OOBibStyle::getPath).collect(Collectors.toList()); preferences.setExternalStyles(externalStyles); preferences.setCurrentStyle(selectedItem.getValue().getStylePath()); preferencesService.setOpenOfficePreferences(preferences); }
Source:
protected void configureMetaStore(HiveConf conf) { try { Class.forName(JDBCDriver.class.getName()); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } metaStorageUrl = "jdbc:hsqldb:mem:" + UUID.randomUUID().toString(); hiveConf.set("datanucleus.connectiondrivername", "org.hsqldb.jdbc.JDBCDriver"); hiveConf.set("javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbc.JDBCDriver"); hiveConf.set("datanucleus.connectionPoolingType", "None"); conf.setBoolVar(METASTORE_VALIDATE_CONSTRAINTS, true); conf.setBoolVar(METASTORE_VALIDATE_COLUMNS, true); conf.setBoolVar(METASTORE_VALIDATE_TABLES, true); }

Target:
protected void configureMetaStore(HiveConf conf) { String jdbcDriver = JDBCDriver.class.getName(); try { Class.forName(jdbcDriver); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } metaStorageUrl = "jdbc:hsqldb:mem:" + UUID.randomUUID().toString(); hiveConf.set("datanucleus.connectiondrivername", jdbcDriver); hiveConf.set("javax.jdo.option.ConnectionDriverName", jdbcDriver); hiveConf.set("datanucleus.connectionPoolingType", "None"); conf.setBoolVar(METASTORE_VALIDATE_CONSTRAINTS, true); conf.setBoolVar(METASTORE_VALIDATE_COLUMNS, true); conf.setBoolVar(METASTORE_VALIDATE_TABLES, true); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.dialog_addshow, container, false); ButterKnife.inject(this, v); mButtonNegative.setText(R.string.dont_add_show); mButtonNegative.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); mButtonPositive.setText(R.string.action_shows_add); mButtonPositive.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(mAdapterCallback != null) { mShow.isAdded = true; mAdapterCallback.notifyDataSetChanged(); } mListener.onAddShow(mShow); dismiss(); } }); ButterKnife.apply(labelViews, VISIBLE, false); return v; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.dialog_addshow, container, false); ButterKnife.inject(this, v); mButtonNegative.setText(R.string.dont_add_show); mButtonNegative.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dismiss(); } }); mButtonPositive.setText(R.string.action_shows_add); mButtonPositive.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mShow.isAdded = true; EventBus.getDefault().post(new AddShowEvent()); mListener.onAddShow(mShow); dismiss(); } }); ButterKnife.apply(labelViews, VISIBLE, false); return v; }
Source:
public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("CodeSystem [oid="); builder.append(oid); builder.append(", name="); builder.append(name); builder.append(", shortName="); builder.append(shortName); builder.append(", organizationLink="); builder.append(organizationLink); builder.append(", primaryLanguage="); builder.append(primaryLanguage); builder.append(", citation="); builder.append(citation); builder.append("]"); builder.append(", branchPath="); builder.append(branchPath); builder.append("]"); builder.append(", iconPath="); builder.append(iconPath); builder.append("]"); builder.append(", repositoryUuid="); builder.append(repositoryUuid); builder.append("]"); return builder.toString(); }

Target:
public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("CodeSystem [oid="); builder.append(oid); builder.append(", name="); builder.append(name); builder.append(", shortName="); builder.append(shortName); builder.append(", organizationLink="); builder.append(organizationLink); builder.append(", primaryLanguage="); builder.append(primaryLanguage); builder.append(", citation="); builder.append(citation); builder.append(", branchPath="); builder.append(branchPath); builder.append(", iconPath="); builder.append(iconPath); builder.append(", repositoryUuid="); builder.append(repositoryUuid); builder.append(", additionalProperties="); builder.append(additionalProperties); builder.append("]"); return builder.toString(); }
Source:
public void onPerfectMatchSearchedEvent(String search, boolean notEqualsSearch) { clearLists(); dataObjectFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addDataObjectListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); simpleJavaTypeFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addSimpleJavaTypeListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); instanceFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addInstanceListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); simpleJavaInstanceFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addSimpleJavaInstanceListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); updateSeparators(); if (!notEqualsSearch) { checkInstanceIsAssigned(search); } }

Target:
public void onPerfectMatchSearchedEvent(String search, boolean notEqualsSearch) { clearLists(); dataObjectFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addDataObjectListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); simpleJavaTypeFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addSimpleJavaTypeListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); instanceFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addInstanceListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); simpleJavaInstanceFieldsMap .entrySet() .stream() .filter(entry -> filterTerm(entry.getKey(), search, notEqualsSearch)) .forEach(filteredEntry -> addSimpleJavaInstanceListGroupItemView(filteredEntry.getKey(), filteredEntry.getValue())); updateSeparators(); }
Source:
private ValueContext<?, Object> buildNewLocalExecutionContext(CascadingMetaData cascadingMetaData, ValueContext<?, ?> valueContext, Object value) { ValueContext<?, Object> newValueContext; Contracts.assertNotNull( value, "value cannot be null" ); newValueContext = ValueContext.getLocalExecutionContext( validatorScopedContext.getParameterNameProvider(), value, cascadingMetaData.getBeanMetaDataForCascadable( beanMetaDataManager, value ), valueContext.getPropertyPath() ); newValueContext.setCurrentValidatedValue( value ); return newValueContext; }

Target:
private ValueContext<?, Object> buildNewLocalExecutionContext(CascadingMetaData cascadingMetaData, ValueContext<?, ?> valueContext, Object value) { ValueContext<?, Object> newValueContext; Contracts.assertNotNull( value, "value cannot be null" ); newValueContext = ValueContext.getLocalExecutionContext( validatorScopedContext.getParameterNameProvider(), value, cascadingMetaData.getBeanMetaDataForCascadable( constraintMetaDataManager, value ), valueContext.getPropertyPath() ); newValueContext.setCurrentValidatedValue( value ); return newValueContext; }
Source:
private static void closeIterator(Iterator<?> iter) { if (iter != null && iter instanceof CloseableIterator) { ((CloseableIterator) iter).close(); } }

Target:
private static void closeIterator(Iterator<?> iter) { if (iter instanceof CloseableIterator) { ((CloseableIterator) iter).close(); } }
Source:
public void testAWSConfigurationWithJSONObject() { JSONObject jsonObject; try { jsonObject = new JSONObject("{\n" + " \"UserAgent\": \"aws-amplify-cli/0.1.0\",\n" + " \"Version\": \"1.0\",\n" + " \"IdentityManager\": {\n" + " \"Default\": {}\n" + " },\n" + " \"AppSync\": {\n" + " \"Default\": {\n" + " \"ApiUrl\": \"redacted\",\n" + " \"Region\": \"redacted\",\n" + " \"AuthMode\": \"API_KEY\",\n" + " \"ApiKey\": \"da2-xyz\",\n" + " \"ClientDatabasePrefix\": \"redacted\"\n" + " }\n" + " },\n" + " \"CredentialsProvider\": {\n" + " \"CognitoIdentity\": {\n" + " \"Default\": {\n" + " \"PoolId\": \"redacted\",\n" + " \"Region\": \"redacted\"\n" + " }\n" + " }\n" + " }\n" + "}"); AWSConfiguration awsConfiguration = new AWSConfiguration(jsonObject); assertNotNull(awsConfiguration); assertNotNull(awsConfiguration.optJsonObject("AppSync")); assertEquals("API_KEY", awsConfiguration.optJsonObject("AppSync").getString("AuthMode")); } catch (JSONException e) { fail("Error in constructing AWSConfiguration." + e.getLocalizedMessage()); } }

Target:
public void testAWSConfigurationWithJSONObject() { try { JSONObject jsonObject = new JSONObject(jsonString); AWSConfiguration awsConfiguration = new AWSConfiguration(jsonObject); assertNotNull(awsConfiguration); assertNotNull(awsConfiguration.optJsonObject("AppSync")); assertEquals("API_KEY", awsConfiguration.optJsonObject("AppSync").getString("AuthMode")); } catch (JSONException e) { fail("Error in constructing AWSConfiguration." + e.getLocalizedMessage()); } }
Source:
protected StorageDomain electNewMaster(boolean duringReconstruct, boolean selectInactiveWhenNoActiveUnknownDomains, boolean canChooseCurrentMasterAsNewMaster) { if (getStoragePool() == null) { log.warn("Cannot elect new master: storage pool not found"); return null; } List<StorageDomain> storageDomains = storageDomainDao.getAllForStoragePool(getStoragePool().getId()); if (storageDomains.isEmpty()) { log.warn("Cannot elect new master, no storage domains found for pool {}", getStoragePool().getName()); return null; } Collections.sort(storageDomains, Comparator.comparing(StorageDomain::getLastTimeUsedAsMaster) .thenComparing(Comparator.comparing(StorageDomain::isLocal))); StorageDomain newMaster = null; StorageDomain storageDomain = getStorageDomain(); for (StorageDomain dbStorageDomain : storageDomains) { if (dbStorageDomain.isHostedEngineStorage()) { continue; } if ((storageDomain == null || (duringReconstruct || !dbStorageDomain.getId() .equals(storageDomain.getId()))) && ((dbStorageDomain.getStorageDomainType() == StorageDomainType.Data) && (!dbStorageDomain.isBackup()) || (canChooseCurrentMasterAsNewMaster && dbStorageDomain.getStorageDomainType() == StorageDomainType.Master))) { if (dbStorageDomain.getStatus() == StorageDomainStatus.Active || dbStorageDomain.getStatus() == StorageDomainStatus.Unknown) { newMaster = dbStorageDomain; break; } else if (selectInactiveWhenNoActiveUnknownDomains && newMaster == null && dbStorageDomain.getStatus() == StorageDomainStatus.Inactive) { newMaster = dbStorageDomain; } } } return newMaster; }

Target:
protected StorageDomain electNewMaster(boolean duringReconstruct, boolean selectInactiveWhenNoActiveUnknownDomains, boolean canChooseCurrentMasterAsNewMaster) { if (getStoragePool() == null) { log.warn("Cannot elect new master: storage pool not found"); return null; } List<StorageDomain> storageDomains = storageDomainDao.getAllForStoragePool(getStoragePool().getId()); if (storageDomains.isEmpty()) { log.warn("Cannot elect new master, no storage domains found for pool {}", getStoragePool().getName()); return null; } Collections.sort(storageDomains, Comparator.comparing(StorageDomain::getLastTimeUsedAsMaster) .thenComparing(Comparator.comparing(StorageDomain::isLocal))); StorageDomain newMaster = null; StorageDomain storageDomain = getStorageDomain(); for (StorageDomain dbStorageDomain : storageDomains) { if (dbStorageDomain.isHostedEngineStorage()) { continue; } if ((storageDomain == null || (duringReconstruct || !dbStorageDomain.getId() .equals(storageDomain.getId()))) && ((dbStorageDomain.getStorageDomainType() == StorageDomainType.Data) && !dbStorageDomain.isBackup() || (canChooseCurrentMasterAsNewMaster && dbStorageDomain.getStorageDomainType() == StorageDomainType.Master))) { if (dbStorageDomain.getStatus() == StorageDomainStatus.Active || dbStorageDomain.getStatus() == StorageDomainStatus.Unknown) { newMaster = dbStorageDomain; break; } else if (selectInactiveWhenNoActiveUnknownDomains && newMaster == null && dbStorageDomain.getStatus() == StorageDomainStatus.Inactive) { newMaster = dbStorageDomain; } } } return newMaster; }
Source:
public Map<String, Boolean> getParameters() { Map<String, Boolean> headers = new HashMap<>(); headers.put(ARTIFACT_FILE_NAME, true); headers.put(ARTIFACT_FOLDER_NAME, false); headers.put(UID, true); return headers; }

Target:
public Map<String, Boolean> getParameters() { return params; }
Source:
protected MessageHandler newRequestHandler() { return message -> { String reply = message.getReplyTo(); if (reply == null || reply.isEmpty()) { LOGGER.warn("Discarding invalid NATS request (no reply)"); return; } String correlationId; try { correlationId = HeaderUtils.decodeFromFrame(message.getData()).get(FContext.CID_HEADER); } catch (TException e) { LOGGER.warn("Discarding invalid NATS request, could not get FContext headers", e); return; } eventHandler.onNewRequest(correlationId); executorService.execute( new Request(message.getData(), System.currentTimeMillis(), message.getReplyTo(), highWatermark, inputProtoFactory, outputProtoFactory, processor, conn, correlationId)); }; }

Target:
protected MessageHandler newRequestHandler() { return message -> { String reply = message.getReplyTo(); if (reply == null || reply.isEmpty()) { LOGGER.warn("Discarding invalid NATS request (no reply)"); return; } Map<Object, Object> ephemeralProperties = new HashMap<>(); this.eventHandler.onRequestReceived(ephemeralProperties); executorService.execute( new Request(message.getData(), message.getReplyTo(), inputProtoFactory, outputProtoFactory, processor, conn, eventHandler, ephemeralProperties)); }; }
Source:
private void validateTag(String xmlTag) { Conditions.checkNotNullOrEmpty(xmlTag, "xmlTag"); boolean valid = false; if (xmlTag.compareTo("resourceDoc") == 0) { valid = true; } else if (xmlTag.compareTo("applicationDocs") == 0) { valid = true; } else if (xmlTag.compareTo("grammars") == 0) { valid = true; } if (!valid) { throw new OseeArgumentException("Invalid resource document tag"); } }

Target:
private void validateTag(String xmlTag) { Conditions.checkNotNullOrEmpty(xmlTag, "xmlTag"); boolean valid = false; if (xmlTag.equals("resourceDoc")) { valid = true; } else if (xmlTag.equals("applicationDocs")) { valid = true; } else if (xmlTag.equals("grammars")) { valid = true; } if (!valid) { throw new OseeArgumentException("Invalid resource document tag"); } }
Source:
public void nextTuple() { BufferedReader br = null; try { String line; br = new BufferedReader(Files.newBufferedReader(Paths.get(path), StandardCharsets.UTF_8)); while ((line = br.readLine()) != null) { String[] result = line.split(delimiter); if (result.length != 2) { LOG.error("Format of input file not as expected. Expecting separated first name and last name", delimiter); } else { Map<String, Object> event = new HashMap<>(); event.put(FIRST_NAME, result[0].trim()); event.put(LAST_NAME, result[1].trim()); List<Object> values = new ArrayList<>(); values.add(new MyStreamlineEvent(event, outputStream)); spoutOutputCollector.emit(outputStream, values, UUID.randomUUID()); } } } catch (IOException e) { LOG.error("Got exception while reading file at {}", path); throw new RuntimeException(e); } finally { if (br != null) try { br.close(); } catch (IOException e) { LOG.error("Got exception while closing buffered reader"); throw new RuntimeException(e); } } }

Target:
public void nextTuple() { try (BufferedReader br = new BufferedReader(Files.newBufferedReader(Paths.get(path), StandardCharsets.UTF_8))) { String line; while ((line = br.readLine()) != null) { String[] result = line.split(delimiter); if (result.length != 2) { LOG.error("Format of input file not as expected. Expecting separated first name and last name", delimiter); } else { List<Object> values = new ArrayList<>(); values.add(StreamlineEventImpl.builder().sourceStream(outputStream).put(FIRST_NAME, result[0].trim()).put(LAST_NAME, result[1].trim()) .build()); spoutOutputCollector.emit(outputStream, values, UUID.randomUUID()); } } } catch (IOException e) { LOG.error("Got exception while reading file at {}", path); throw new RuntimeException(e); } }
Source:
protected CommandStack getCommandStack(IWorkbenchPart part, Object input) { Object helper = getInputType(input); if (null != helper) { return SystemManager.INSTANCE.getCommandStack(((Device) helper).getAutomationSystem()); } return null; }

Target:
protected CommandStack getCommandStack(IWorkbenchPart part, Object input) { Device helper = getInputType(input); if (null != helper) { return SystemManager.INSTANCE.getCommandStack(helper.getAutomationSystem()); } return null; }
Source:
public ArrayList<CategoryPill.Data> getCategoriesFromSite(final String siteId, User user) { return new Categories(user).execute(CreateCategoryContext.defaultContextUsing(siteId, "")); }

Target:
public List<CategoryPill.Data> getCategoriesFromSite(final String siteId, User user) { return new Categories(user).execute(CreateCategoryContext.defaultContextUsing(siteId, "")); }
Source:
public void goToLastEvent() throws CTFException { seek(getEndTime()); while (fPrio.size() > 1) { advance(); } }

Target:
public void goToLastEvent() throws CTFException { seek(fTrace.timestampNanoToCycles(getEndTime())); while (fPrio.size() > 1) { advance(); } }
Source:
public boolean isFulltextSearchDisabled() { return (isFulltextDisabled() || fulltextConfiguration.fulltextSearchDisabled); }

Target:
public boolean isFulltextSearchDisabled() { return isFulltextDisabled() || fulltextConfiguration.fulltextSearchDisabled; }
Source:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { WorkbenchWindow workbenchWindow = (WorkbenchWindow)PlatformUI.getWorkbench().getActiveWorkbenchWindow(); StatusLineManager statusLineManager = workbenchWindow.getStatusLineManager(); if(stats.getStatsSum()==0) { statusLineManager.setMessage("CQuery : Idle"); } else { statusLineManager.setMessage("CQuery : Busy | "+stats.getStatsSum()+" Jobs"); } } }); }

Target:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; IWorkbenchWindow[] Workbenchwindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : Workbenchwindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); if (statusLine.find(cqueryStatusFieldId) != null) { statusLine.remove(cqueryStatusFieldId); } StatusLineContributionItem cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }
Source:
public void setProperties(Properties props) throws StandardException{ properties=props; Enumeration e=properties.keys(); while(e.hasMoreElements()){ String key=(String)e.nextElement(); String value=(String)properties.get(key); switch(key){ case "joinOrder": if(StringUtil.SQLEqualsIgnoreCase(value,"fixed")){ fixedJoinOrder=true; }else if(StringUtil.SQLEqualsIgnoreCase(value,"unfixed")){ fixedJoinOrder=false; }else{ throw StandardException.newException(SQLState.LANG_INVALID_JOIN_ORDER_SPEC,value); } break; case "useStatistics": if(StringUtil.SQLEqualsIgnoreCase(value,"true")){ useStatistics=true; }else if(StringUtil.SQLEqualsIgnoreCase(value,"false")){ useStatistics=false; }else{ throw StandardException.newException(SQLState.LANG_INVALID_STATISTICS_SPEC,value); } break; case "tableLimitForExhaustiveSearch": try { tableLimitForExhaustiveSearch = Integer.parseUnsignedInt(value); } catch (NumberFormatException nfe) { throw StandardException.newException(SQLState.LANG_INVALID_TABLE_LIMIT_FOR_EXHAUSTIVE_SEARCH, value); } if (tableLimitForExhaustiveSearch == 0) throw StandardException.newException(SQLState.LANG_INVALID_TABLE_LIMIT_FOR_EXHAUSTIVE_SEARCH, value); break; default: throw StandardException.newException(SQLState.LANG_INVALID_FROM_LIST_PROPERTY,key,value); } } }

Target:
public void setProperties(Properties props) throws StandardException{ properties=props; Enumeration e=properties.keys(); while(e.hasMoreElements()){ String key=(String)e.nextElement(); String value=(String)properties.get(key); switch(key){ case "joinOrder": if(StringUtil.SQLEqualsIgnoreCase(value,"fixed")){ fixedJoinOrder=true; }else if(StringUtil.SQLEqualsIgnoreCase(value,"unfixed")){ fixedJoinOrder=false; }else{ throw StandardException.newException(SQLState.LANG_INVALID_JOIN_ORDER_SPEC,value); } break; case "useStatistics": if(StringUtil.SQLEqualsIgnoreCase(value,"true")){ useStatistics=true; }else if(StringUtil.SQLEqualsIgnoreCase(value,"false")){ useStatistics=false; }else{ throw StandardException.newException(SQLState.LANG_INVALID_STATISTICS_SPEC,value); } break; case "tableLimitForExhaustiveSearch": try { tableLimitForExhaustiveSearch = Integer.parseInt(value); } catch (NumberFormatException nfe) { throw StandardException.newException(SQLState.LANG_INVALID_TABLE_LIMIT_FOR_EXHAUSTIVE_SEARCH, value); } if (tableLimitForExhaustiveSearch <= 0) throw StandardException.newException(SQLState.LANG_INVALID_TABLE_LIMIT_FOR_EXHAUSTIVE_SEARCH, value); break; default: throw StandardException.newException(SQLState.LANG_INVALID_FROM_LIST_PROPERTY,key,value); } } }
Source:
public void testGetBikeStationsTampa() { Application.get().setCurrentRegion(MockRegion.getTampa(getContext()), false); OtpBikeStationRequest request = OtpBikeStationRequest.newRequest(getContext(), null, null); OtpBikeStationResponse response = request.call(); assertNotNull(response); assertNotNull(response.stations); assertEquals(133, response.stations.size()); for(BikeRentalStation station: response.stations) { assertNotNull(station.name); } }

Target:
public void testGetBikeStationsTampa() { Application.get().setCurrentRegion(MockRegion.getTampa(getContext()), false); OtpBikeStationRequest request = OtpBikeStationRequest.newRequest(getContext(), null, null); OtpBikeStationResponse response = request.call(); assertNotNull(response); assertNotNull(response.stations); assertEquals(133, response.stations.size()); for (BikeRentalStation station: response.stations) { assertNotNull(station.name); } assertFirstStationIsCorrect(response.stations.get(0)); }
Source:
private static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16)); } return data; }

Target:
private static byte[] hexStringToByteArray(String s) { try { return Hex.decodeHex(s.toCharArray()); } catch (DecoderException ex) { throw new RuntimeException("Error decoding hex data: " + s); } }
Source:
void propagateDraw (long container, long cairo) { if (container == fixedHandle) { long list = GTK.gtk_container_get_children (container); long temp = list; while (temp != 0) { long child = OS.g_list_data (temp); if (child != 0) { Widget widget = display.getWidget (child); if (widget != this) { if (noChildDrawing != null) { Boolean childLowered = childrenLowered.get(widget); if (childLowered == null) { childrenLowered.put(widget, false); childLowered = false; } GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation(child, allocation); if (allocation.y < 0) { if (!childLowered) { if (GTK.GTK4) { long surface = gtk_widget_get_surface(child); GDK.gdk_surface_lower(surface); } else { long window = gtk_widget_get_window(child); GDK.gdk_window_lower(window); } childrenLowered.put(widget, true); } } else { if (childLowered) { if (GTK.GTK4) { long surface = gtk_widget_get_surface(child); GDK.gdk_surface_raise(surface); } else { long window = gtk_widget_get_window(child); GDK.gdk_window_raise(window); } childrenLowered.put(widget, false); } GTK.gtk_container_propagate_draw(container, child, cairo); } } else { GTK.gtk_container_propagate_draw(container, child, cairo); } } } temp = OS.g_list_next (temp); } OS.g_list_free (list); } }

Target:
void propagateDraw (long container, long cairo) { if (container == fixedHandle) { long list = GTK.gtk_container_get_children (container); long temp = list; while (temp != 0) { long child = OS.g_list_data (temp); if (child != 0) { Widget widget = display.getWidget (child); if (widget != this) { if (noChildDrawing) { Boolean childLowered = childrenLowered.get(widget); if (childLowered == null) { childrenLowered.put(widget, false); childLowered = false; } GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation(child, allocation); if (allocation.y < 0) { if (!childLowered) { if (GTK.GTK4) { long surface = gtk_widget_get_surface(child); GDK.gdk_surface_lower(surface); } else { long window = gtk_widget_get_window(child); GDK.gdk_window_lower(window); } childrenLowered.put(widget, true); } } else { if (childLowered) { if (GTK.GTK4) { long surface = gtk_widget_get_surface(child); GDK.gdk_surface_raise(surface); } else { long window = gtk_widget_get_window(child); GDK.gdk_window_raise(window); } childrenLowered.put(widget, false); } GTK.gtk_container_propagate_draw(container, child, cairo); } } else { GTK.gtk_container_propagate_draw(container, child, cairo); } } } temp = OS.g_list_next (temp); } OS.g_list_free (list); } }
Source:
public String notFound( HttpServletRequest request, @CurrentUser Integer currentUserId, @RequestAttribute(name = RequestDispatcher.ERROR_REQUEST_URI, required = false) String page, @RequestHeader(name = "referer", required = false) String referer, @RequestHeader(name = "user-agent", required = false) String agent) { String ip = request.getRemoteAddr(); String method = request.getMethod(); siteService.logAboutAbsentPage(page, method, currentUserId, ip, referer, agent); return SiteUrl.COMMON_ERROR_PAGE; }

Target:
public String notFound( HttpServletRequest request, @CurrentUser Integer currentUserId, @RequestAttribute(name = RequestDispatcher.ERROR_REQUEST_URI, required = false) String page, @RequestHeader(name = "referer", required = false) String referer, @RequestHeader(name = "user-agent", required = false) String agent) { String ip = request.getRemoteAddr(); String method = request.getMethod(); siteService.logAboutAbsentPage(page, method, currentUserId, ip, referer, agent); return "error/status-code"; }
Source:
private void addPool(InetSocketAddress server) { int currentPoolNumber = currentPools.size() + 1; addPool(server, new CassandraClientPoolingContainer(server, config, currentPoolNumber)); }

Target:
void addPool(InetSocketAddress server) { int currentPoolNumber = cassandraHosts.indexOf(server) + 1; addPool(server, new CassandraClientPoolingContainer(server, config, currentPoolNumber)); }
Source:
public List<String> getFieldNames() { return ImmutableList.copyOf(fieldNames); }

Target:
public List<String> getFieldNames() { return Collections.unmodifiableList(fieldNames); }
Source:
private static boolean shouldEnforceHardTabs(FileSystemItem item) { if (item == null) return false; if ("Makefile".equals(item.getName()) || "Makevars".equals(item.getName()) || ".tsv".equals(item.getExtension())) { return true; } return false; }

Target:
private static boolean shouldEnforceHardTabs(FileSystemItem item) { if (item == null) return false; String[] requiresHardTabs = new String[] { "Makefile", "Makefile.in", "Makefile.win", "Makevars", "Makevars.in", "Makevars.win" }; for (String file : requiresHardTabs) if (file.equals(item.getName())) return true; if (".tsv".equals(item.getExtension())) return true; return false; }
Source:
private void addExitMenu() { final boolean isMac = SystemProperties.isMac(); final JMenuItem leaveGameMenuExit = new JMenuItem(SwingAction.of("Leave Game", e -> frame.leaveGame())); leaveGameMenuExit.setMnemonic(KeyEvent.VK_L); if (isMac) { leaveGameMenuExit.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_L, Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); } else { leaveGameMenuExit.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); } add(leaveGameMenuExit); if (isMac) { MacOsIntegration.setQuitHandler(() -> frame.shutdown()); } else { final JMenuItem menuFileExit = new JMenuItem(SwingAction.of("Exit Program", e -> frame.shutdown())); menuFileExit.setMnemonic(KeyEvent.VK_E); add(menuFileExit); } }

Target:
private void addExitMenu() { final boolean isMac = SystemProperties.isMac(); final JMenuItem leaveGameMenuExit = new JMenuItem(SwingAction.of("Leave Game", e -> frame.leaveGame())); leaveGameMenuExit.setMnemonic(KeyEvent.VK_L); if (isMac) { leaveGameMenuExit.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_L, Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); } else { leaveGameMenuExit.setAccelerator( KeyStroke.getKeyStroke( KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx())); } add(leaveGameMenuExit); if (isMac) { MacOsIntegration.setQuitHandler(frame); } else { final JMenuItem menuFileExit = new JMenuItem(SwingAction.of("Exit Program", e -> frame.shutdown())); menuFileExit.setMnemonic(KeyEvent.VK_E); add(menuFileExit); } }
Source:
protected VDSExceptionBase createDefaultConcreteException(String errorMessage) { VDSExceptionBase outEx = new IrsOperationFailedNoFailoverException(errorMessage); return outEx; }

Target:
protected VDSExceptionBase createDefaultConcreteException(String errorMessage) { return new IrsOperationFailedNoFailoverException(errorMessage); }
Source:
public boolean runAllParagraphs(String noteId, List<Map<String, Object>> paragraphs, ServiceContext context, ServiceCallback<Paragraph> callback) throws IOException { if (!checkPermission(noteId, Permission.RUNNER, Message.OP.RUN_ALL_PARAGRAPHS, context, callback)) { return false; } Note note = notebook.getNote(noteId); if (note == null) { callback.onFailure(new NoteNotFoundException(noteId), context); return false; } note.setRunning(true); try { if (paragraphs != null) { for (Map<String, Object> raw : paragraphs) { String paragraphId = (String) raw.get("id"); if (paragraphId == null) { continue; } String text = (String) raw.get("paragraph"); String title = (String) raw.get("title"); Map<String, Object> params = (Map<String, Object>) raw.get("params"); Map<String, Object> config = (Map<String, Object>) raw.get("config"); if (!runParagraph(noteId, paragraphId, title, text, params, config, false, true, context, callback)) { return false; } } } else { try { note.runAll(context.getAutheInfo(), true); return true; } catch (Exception e) { LOGGER.warn("Fail to run note: " + note.getName(), e); return false; } } } finally { note.setRunning(false); } return true; }

Target:
public boolean runAllParagraphs(String noteId, List<Map<String, Object>> paragraphs, ServiceContext context, ServiceCallback<Paragraph> callback) throws IOException { if (!checkPermission(noteId, Permission.RUNNER, Message.OP.RUN_ALL_PARAGRAPHS, context, callback)) { return false; } Note note = notebook.getNote(noteId); if (note == null) { callback.onFailure(new NoteNotFoundException(noteId), context); return false; } note.setRunning(true); try { if (paragraphs != null) { for (Map<String, Object> raw : paragraphs) { String paragraphId = (String) raw.get("id"); if (paragraphId == null) { LOGGER.warn("No id found in paragraph json: " + raw); continue; } try { String text = (String) raw.get("paragraph"); String title = (String) raw.get("title"); Map<String, Object> params = (Map<String, Object>) raw.get("params"); Map<String, Object> config = (Map<String, Object>) raw.get("config"); if (!runParagraph(noteId, paragraphId, title, text, params, config, false, true, context, callback)) { return false; } } catch (Exception e) { throw new IOException("Fail to run paragraph json: " + raw); } } } else { try { note.runAll(context.getAutheInfo(), true); return true; } catch (Exception e) { LOGGER.warn("Fail to run note: " + note.getName(), e); return false; } } } finally { note.setRunning(false); } return true; }
Source:
private Composite createTabSkeleton(TabFolder tabFolder, String tabLabel, String introText) { TabItem tbtmMain = new TabItem(tabFolder, SWT.NONE); tbtmMain.setText(tabLabel); Composite tabComposite = new Composite(tabFolder, SWT.NONE); tbtmMain.setControl(tabComposite); GridLayout layout = new GridLayout(1, true); layout.verticalSpacing = VERTICAL_SPACING_GRID; tabComposite.setLayout(layout); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); tabComposite.setLayoutData(layoutData); Label introductionText = new Label(tabComposite, SWT.WRAP); layoutData = new GridData(SWT.FILL, SWT.FILL, true, false); layoutData.widthHint = INTRO_TEXT_WIDTH_HINT; introductionText.setLayoutData(layoutData); introductionText.setText(introText); return tabComposite; }

Target:
private Composite createTabSkeleton(TabFolder tabFolder, String tabLabel, String introText) { TabItem tbtmMain = new TabItem(tabFolder, SWT.NONE); tbtmMain.setText(tabLabel); Composite tabComposite = new Composite(tabFolder, SWT.NONE); tbtmMain.setControl(tabComposite); GridLayout layout = new GridLayout(1, true); tabComposite.setLayout(layout); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); tabComposite.setLayoutData(layoutData); Label introductionText = new Label(tabComposite, SWT.WRAP); GridDataFactory.fillDefaults().grab(true, false).hint(INTRO_TEXT_WIDTH_HINT, SWT.DEFAULT) .applyTo(introductionText); introductionText.setText(introText); return tabComposite; }