auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initialize() throws IOException { if (!(systemEnvironment.get(SystemEnvironment.USE_NEW_RAILS) && systemEnvironment.useCompressedJs())) { return; } String assetsDirPath = servletContext.getRealPath(servletContext.getInitParameter("rails.root") + "/public/assets/"); File assetsDir = new File(assetsDirPath); if (!assetsDir.exists()) { throw new RuntimeException(String.format("Assets directory does not exist %s", assetsDirPath)); } File manifestFile = null; Iterator iterator = FileUtils.iterateFiles(assetsDir, new String[]{"json"}, false); while (iterator.hasNext()) { File next = (File) iterator.next(); if (MANIFEST_FILE_PATTERN.matcher(next.getName()).matches()) { manifestFile = next; break; } } if (manifestFile == null) { throw new RuntimeException(String.format("Manifest json file was not found at %s", assetsDirPath)); } LOG.info(String.format("Found rails assets manifest file named %s ", manifestFile.getName())); String manifest = FileUtil.readContentFromFile(manifestFile); Gson gson = new Gson(); railsAssetsManifest = gson.fromJson(manifest, RailsAssetsManifest.class); LOG.info(String.format("Successfully read rails assets manifest file located at %s", manifestFile.getAbsolutePath())); }

Target:
public void initialize() throws IOException { if (!(systemEnvironment.get(SystemEnvironment.USE_NEW_RAILS) && systemEnvironment.useCompressedJs())) { return; } String assetsDirPath = servletContext.getRealPath(servletContext.getInitParameter("rails.root") + "/public/assets/"); File assetsDir = new File(assetsDirPath); if (!assetsDir.exists()) { throw new RuntimeException(String.format("Assets directory does not exist %s", assetsDirPath)); } Collection files = FileUtils.listFiles(assetsDir, new RegexFileFilter(MANIFEST_FILE_PATTERN), null); if (files.isEmpty()) { throw new RuntimeException(String.format("Manifest json file was not found at %s", assetsDirPath)); } File manifestFile = (File) files.iterator().next(); LOG.info(String.format("Found rails assets manifest file named %s ", manifestFile.getName())); String manifest = FileUtil.readContentFromFile(manifestFile); Gson gson = new Gson(); railsAssetsManifest = gson.fromJson(manifest, RailsAssetsManifest.class); LOG.info(String.format("Successfully read rails assets manifest file located at %s", manifestFile.getAbsolutePath())); }
Source:
protected GenotypeType determineType() { final List<Allele> alleles = getAlleles(); if ( alleles.isEmpty() ) { return GenotypeType.UNAVAILABLE; } boolean sawNoCall = false, sawMultipleAlleles = false; Allele firstAllele = null; for ( int i = 0; i < alleles.size(); i++ ) { final Allele allele = alleles.get(i); if ( allele.isNoCall() ) { sawNoCall = true; } else if ( firstAllele == null ) { firstAllele = allele; } else if ( !allele.equals(firstAllele) ) sawMultipleAlleles = true; } if ( sawNoCall ) { if ( firstAllele == null ) return GenotypeType.NO_CALL; return GenotypeType.MIXED; } if ( firstAllele == null ) throw new IllegalStateException("BUG: there are no alleles present in this genotype but the alleles list is not null"); return sawMultipleAlleles ? GenotypeType.HET : firstAllele.isReference() ? GenotypeType.HOM_REF : GenotypeType.HOM_VAR; }

Target:
protected GenotypeType determineType() { final List<Allele> alleles = getAlleles(); if ( alleles.isEmpty() ) { return GenotypeType.UNAVAILABLE; } boolean sawNoCall = false, sawMultipleAlleles = false; Allele firstCallAllele = null; for ( int i = 0; i < alleles.size(); i++ ) { final Allele allele = alleles.get(i); if ( allele.isNoCall() ) { sawNoCall = true; } else if ( firstCallAllele == null ) { firstCallAllele = allele; } else if ( !allele.equals(firstCallAllele) ) sawMultipleAlleles = true; } if ( sawNoCall ) { if ( firstCallAllele == null ) return GenotypeType.NO_CALL; return GenotypeType.MIXED; } if ( firstCallAllele == null ) throw new IllegalStateException("BUG: there are no alleles present in this genotype but the alleles list is not null"); return sawMultipleAlleles ? GenotypeType.HET : firstCallAllele.isReference() ? GenotypeType.HOM_REF : GenotypeType.HOM_VAR; }
Source:
public TwilioRestClient(String accountSid, String authToken, String endpoint) { validateAccountSid(accountSid); validateAuthToken(authToken); this.accountSid = accountSid; this.authToken = authToken; if ((endpoint != null) && (!endpoint.equals(""))) { this.endpoint = endpoint; } ClientConnectionManager mgr = null; try { Class.forName("com.google.appengine.api.urlfetch.HTTPRequest"); } catch (ClassNotFoundException e) { mgr = new ThreadSafeClientConnManager(); ((ThreadSafeClientConnManager) mgr).setDefaultMaxPerRoute(10); } finally { if (mgr == null) { mgr = new TwilioGAEConnectionManager(); } } setHttpclient(new DefaultHttpClient(mgr)); httpclient.getParams().setParameter("http.protocol.version", HttpVersion.HTTP_1_1); httpclient.getParams().setParameter("http.socket.timeout", new Integer(CONNECTION_TIMEOUT)); httpclient.getParams().setParameter("http.connection.timeout", new Integer(CONNECTION_TIMEOUT)); httpclient.getParams().setParameter("http.protocol.content-charset", "UTF-8"); this.authAccount = new Account(this); this.authAccount.setSid(this.accountSid); this.authAccount.setAuthToken(this.authToken); }

Target:
public TwilioRestClient(String accountSid, String authToken, String endpoint) { validateAccountSid(accountSid); validateAuthToken(authToken); this.accountSid = accountSid; this.authToken = authToken; if ((endpoint != null) && (!endpoint.equals(""))) { this.endpoint = endpoint; } ClientConnectionManager mgr = null; try { Class.forName("com.google.appengine.api.urlfetch.HTTPRequest"); mgr = new AppEngineClientConnectionManager(); } catch (ClassNotFoundException e) { mgr = new ThreadSafeClientConnManager(); ((ThreadSafeClientConnManager) mgr).setDefaultMaxPerRoute(10); } setHttpclient(new DefaultHttpClient(mgr)); httpclient.getParams().setParameter("http.protocol.version", HttpVersion.HTTP_1_1); httpclient.getParams().setParameter("http.socket.timeout", new Integer(CONNECTION_TIMEOUT)); httpclient.getParams().setParameter("http.connection.timeout", new Integer(CONNECTION_TIMEOUT)); httpclient.getParams().setParameter("http.protocol.content-charset", "UTF-8"); this.authAccount = new Account(this); this.authAccount.setSid(this.accountSid); this.authAccount.setAuthToken(this.authToken); }
Source:
public String showAddNewMetadataGroup() { try { newMetadataGroup = new RenderableMetadataGroup(docStruct.getAddableMetadataGroupTypes(), process.getProject().getTitle()); } catch (ConfigurationException e) { Helper.setFehlerMeldung("Form_configuration_mismatch", e.getMessage()); logger.error(e.getMessage(), e); return ""; } modeAdd = false; modeAddPerson = false; addMetadataGroupMode = true; return !updateBlocked() ? "SperrungAbgelaufen" : ""; }

Target:
public String showAddNewMetadataGroup() { try { newMetadataGroup = new RenderableMetadataGroup(docStruct.getAddableMetadataGroupTypes(), process.getProject().getTitle()); } catch (ConfigurationException e) { Helper.setErrorMessage("Form_configuration_mismatch", logger, e); return ""; } modeAdd = false; modeAddPerson = false; addMetadataGroupMode = true; return !updateBlocked() ? "SperrungAbgelaufen" : ""; }
Source:
public Dialog onCreateDialog(Bundle savedInstance) { if (savedInstance != null) { name = (String) savedInstance.getSerializable("name"); position = (Integer) savedInstance.getSerializable("position"); keyword = (Keyword) savedInstance.getParcelable("keyword"); } LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.keyword_edit_name, null); nameEdit = (EditText) view.findViewById(R.id.keyword_name_edit); nameEdit.setText(name); nameEdit.setSelection(name.length()); final EditText nameEditFinal = nameEdit; TextView externalCode = (TextView) view.findViewById(R.id.keyword_external_code); externalCode.setText(keyword.getExternalCode()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.keyword_edit_name_dialog_title) .setView(view) .setPositiveButton( android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { listener.onKeywordNameChanged( nameEditFinal.getText().toString(), position); } }) .setNegativeButton(android.R.string.cancel, null); Dialog dialog = builder.create(); dialog.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); return dialog; }

Target:
public Dialog onCreateDialog(Bundle savedInstance) { if (savedInstance != null) { name = (String) savedInstance.getSerializable("name"); position = (Integer) savedInstance.getSerializable("position"); keyword = (Keyword) savedInstance.getParcelable("keyword"); } LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.keyword_edit_name, null); nameEdit = (EditText) view.findViewById(R.id.keyword_name_edit); nameEdit.addTextChangedListener(new NameWatcher()); nameEdit.setText(name); nameEdit.setSelection(name.length()); final EditText nameEditFinal = nameEdit; TextView externalCode = (TextView) view.findViewById(R.id.keyword_external_code); externalCode.setText(keyword.getExternalCode()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.keyword_edit_name_dialog_title) .setView(view) .setPositiveButton(android.R.string.ok, new OkListener()) .setNegativeButton(android.R.string.cancel, null); Dialog dialog = builder.create(); dialog.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); return dialog; }
Source:
public String html() { synchronized (Markdown.TIDY) { return Markdown.clean( new PegDownProcessor().markdownToHtml( Markdown.formatLinks(this.text) ) ).replaceAll("(</a>)(\\w)", "$1 $2"); } }

Target:
public String html() { synchronized (Markdown.TIDY) { return LINK_WHITESPACE.matcher( Markdown.clean( new PegDownProcessor().markdownToHtml( Markdown.formatLinks(this.text) ) ) ).replaceAll("$1 $2"); } }
Source:
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { JsonObjectFormatVisitor jsonObjectFormatVisitor = visitor.expectObjectFormat(typeHint); JavaType numberType = visitor.getProvider().constructType(Number.class); JavaType currencyUnitType = visitor.getProvider().constructType(CurrencyUnit.class); JavaType stringType = visitor.getProvider().constructType(String.class); JsonSerializer<Object> numberSerializer = visitor.getProvider().findValueSerializer(Number.class); JsonSerializer<Object> currencyUnitSerializer = visitor.getProvider().findValueSerializer(CurrencyUnit.class); JsonSerializer<Object> stringSerializer = visitor.getProvider().findValueSerializer(String.class); jsonObjectFormatVisitor.property(names.getAmount(), numberSerializer, numberType); jsonObjectFormatVisitor.property(names.getCurrency(), currencyUnitSerializer, currencyUnitType); jsonObjectFormatVisitor.optionalProperty(names.getFormatted(), stringSerializer, stringType); }

Target:
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { JsonObjectFormatVisitor jsonObjectFormatVisitor = visitor.expectObjectFormat(typeHint); JavaType amountType = visitor.getProvider().constructType(writer.getType()); JsonSerializer<Object> amountSerializer = visitor.getProvider().findValueSerializer(writer.getType()); jsonObjectFormatVisitor.property(names.getAmount(), amountSerializer, amountType); JavaType currencyUnitType = visitor.getProvider().constructType(CurrencyUnit.class); JsonSerializer<Object> currencyUnitSerializer = visitor.getProvider().findValueSerializer(CurrencyUnit.class); jsonObjectFormatVisitor.property(names.getCurrency(), currencyUnitSerializer, currencyUnitType); JavaType stringType = visitor.getProvider().constructType(String.class); JsonSerializer<Object> stringSerializer = visitor.getProvider().findValueSerializer(String.class); jsonObjectFormatVisitor.optionalProperty(names.getFormatted(), stringSerializer, stringType); }
Source:
int resizeCalculationsGTK3 (long widget, int width, int height) { int sizes = new int[2]; if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { GtkRequisition requisition = new GtkRequisition(); OS.gtk_widget_get_preferred_size(widget, requisition, null); sizes[0] = (width - (requisition.width - width)) < 0 ? requisition.width : width; sizes[1] = (height - (requisition.height - height)) < 0 ? requisition.height : height; } else { sizes[0] = width; sizes[0] = height; } return sizes; }

Target:
Point resizeCalculationsGTK3 (long widget, int width, int height) { Point sizes = new Point (width, height); if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { GtkRequisition requisition = new GtkRequisition(); OS.gtk_widget_get_preferred_size(widget, requisition, null); sizes.x = (width - (requisition.width - width)) < 0 ? requisition.width : width; sizes.y = (height - (requisition.height - height)) < 0 ? requisition.height : height; } return sizes; }
Source:
public void open(ReadableMap options) throws ActivityNotFoundException { super.open(options); this.openIntentChooser(options); }

Target:
public void open(ReadableMap options) throws ActivityNotFoundException { super.open(options); this.openIntentChooser(); }
Source:
public String toString() { return "Account{" + "id=" + id + ", description='" + description + '\'' + ", creationDate='" + creationDate + '\'' + ", limits=" + limits + ", blurb=" + blurb.stream().map(Arrays::toString).collect(Collectors.toList()) + ", unknownFieldSet='" + unknownFieldSet + '\'' + ", currencies='" + Arrays.toString(currencies) + '\'' + '}'; }

Target:
public String toString() { return "Account{" + "id=" + id + ", description='" + description + '\'' + ", creationDate='" + creationDate + '\'' + ", limits=" + limits + ", blurb=" + blurb.stream().map(Arrays::toString).collect(Collectors.toList()) + ", currencies='" + Arrays.toString(currencies) + '\'' + ", unknownFieldSet='" + unknownFieldSet + '\'' + '}'; }
Source:
public SnapshotsInProgress(StreamInput in) throws IOException { Entry[] entries = new Entry[in.readVInt()]; for (int i = 0; i < entries.length; i++) { Snapshot snapshot = new Snapshot(in); boolean includeGlobalState = in.readBoolean(); boolean partial = in.readBoolean(); State state = State.fromValue(in.readByte()); int indices = in.readVInt(); List<IndexId> indexBuilder = new ArrayList<>(); for (int j = 0; j < indices; j++) { indexBuilder.add(new IndexId(in.readString(), in.readString())); } long startTime = in.readLong(); ImmutableOpenMap.Builder<ShardId, ShardSnapshotStatus> builder = ImmutableOpenMap.builder(); int shards = in.readVInt(); for (int j = 0; j < shards; j++) { ShardId shardId = new ShardId(in); builder.put(shardId, new ShardSnapshotStatus(in)); } long repositoryStateId = in.readLong(); final String failure = in.readOptionalString(); final Map<String, Object> userMetadata = in.readMap(); final Version version; if (in.getVersion().onOrAfter(VERSION_IN_SNAPSHOT_VERSION)) { version = Version.readVersion(in); } else { version = in.readBoolean() ? SnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION : SnapshotsService.OLD_SNAPSHOT_FORMAT; } List<String> dataStreams = Collections.emptyList(); if (in.getVersion().onOrAfter(DATA_STREAMS_IN_SNAPSHOT)){ dataStreams = Arrays.asList(in.readStringArray()); } entries[i] = new Entry(snapshot, includeGlobalState, partial, state, Collections.unmodifiableList(indexBuilder), dataStreams, startTime, repositoryStateId, builder.build(), failure, userMetadata, version ); } this.entries = Arrays.asList(entries); }

Target:
public SnapshotsInProgress(StreamInput in) throws IOException { Entry[] entries = new Entry[in.readVInt()]; for (int i = 0; i < entries.length; i++) { Snapshot snapshot = new Snapshot(in); boolean includeGlobalState = in.readBoolean(); boolean partial = in.readBoolean(); State state = State.fromValue(in.readByte()); int indices = in.readVInt(); List<IndexId> indexBuilder = new ArrayList<>(); for (int j = 0; j < indices; j++) { indexBuilder.add(new IndexId(in.readString(), in.readString())); } long startTime = in.readLong(); ImmutableOpenMap.Builder<ShardId, ShardSnapshotStatus> builder = ImmutableOpenMap.builder(); int shards = in.readVInt(); for (int j = 0; j < shards; j++) { ShardId shardId = new ShardId(in); builder.put(shardId, new ShardSnapshotStatus(in)); } long repositoryStateId = in.readLong(); final String failure = in.readOptionalString(); final Map<String, Object> userMetadata = in.readMap(); final Version version; if (in.getVersion().onOrAfter(VERSION_IN_SNAPSHOT_VERSION)) { version = Version.readVersion(in); } else { version = in.readBoolean() ? SnapshotsService.SHARD_GEN_IN_REPO_DATA_VERSION : SnapshotsService.OLD_SNAPSHOT_FORMAT; } entries[i] = new Entry(snapshot, includeGlobalState, partial, state, Collections.unmodifiableList(indexBuilder), startTime, repositoryStateId, builder.build(), failure, userMetadata, version ); } this.entries = Arrays.asList(entries); }
Source:
public Path getRecordingPath(String title) { return getRecordingsPath().resolve(title.replaceAll("[^A-Za-z0-9-_ ]", "")); }

Target:
public Path getRecordingPath(String title) { return getRecordingsPath().resolve(title.replaceAll(REGEX, "")); }
Source:
private static List<Property> applyPropertyOverride(List<Property> properties, List<Property> overrides) { Map<String, Expression> propertyMap = properties.stream() .collect(toImmutableMap(property -> property.getName().getValue().toLowerCase(ENGLISH), Property::getValue)); Map<String, Expression> overrideMap = overrides.stream() .collect(toImmutableMap(property -> property.getName().getValue().toLowerCase(ENGLISH), Property::getValue)); return Stream.concat(propertyMap.entrySet().stream(), overrideMap.entrySet().stream()) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (first, second) -> second)) .entrySet() .stream() .map(entry -> new Property(new Identifier(entry.getKey()), entry.getValue())) .collect(toImmutableList()); }

Target:
private static List<Property> applyPropertyOverride(List<Property> properties, List<Property> overrides) { Map<String, Expression> propertyMap = properties.stream() .collect(toImmutableMap(property -> property.getName().getValue().toLowerCase(ENGLISH), Property::getValue)); Map<String, Expression> overrideMap = overrides.stream() .collect(toImmutableMap(property -> property.getName().getValue().toLowerCase(ENGLISH), Property::getValue)); return Stream.concat(propertyMap.entrySet().stream(), overrideMap.entrySet().stream()) .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (original, override) -> override)) .entrySet() .stream() .map(entry -> new Property(new Identifier(entry.getKey()), entry.getValue())) .collect(toImmutableList()); }
Source:
public static boolean areRelated(final IService service, final IDeploymentConfig dc) { return service.getProject().getResources(ResourceKind.POD).stream() .filter(pod -> containsAll(service.getSelector(), pod.getLabels())) .filter(pod -> dc.getName().equals(pod.getAnnotation(OpenShiftAPIAnnotations.DEPLOYMENT_CONFIG_NAME))) .count() > 0; }

Target:
public static boolean areRelated(final IService service, final IDeploymentConfig dc) { return service.getProject().getResources(ResourceKind.POD).stream() .filter(pod -> dc.getName().equals(pod.getAnnotation(OpenShiftAPIAnnotations.DEPLOYMENT_CONFIG_NAME))) .filter(pod -> containsAll(service.getSelector(), pod.getLabels())) .count() > 0; }
Source:
public DumpLogTool(VerifiableProperties verifiableProperties, StoreToolsMetrics metrics) throws Exception { fileToRead = verifiableProperties.getString("file.to.read"); hardwareLayoutFilePath = verifiableProperties.getString("hardware.layout.file.path"); partitionLayoutFilePath = verifiableProperties.getString("partition.layout.file.path"); blobIdList = verifiableProperties.getString("blobId.list", ""); logStartOffset = verifiableProperties.getLong("log.start.offset", -1); logEndOffset = verifiableProperties.getLong("log.end.offset", -1); bytesPerSec = verifiableProperties.getLong("bytes.per.sec", 10000); silent = verifiableProperties.getBoolean("silent", true); if (!new File(hardwareLayoutFilePath).exists() || !new File(partitionLayoutFilePath).exists()) { throw new IllegalArgumentException("Hardware or Partition Layout file does not exist"); } ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties); this.clusterMap = ((ClusterAgentsFactory) Utils.getObj(clusterMapConfig.clusterMapClusterAgentsFactory, clusterMapConfig, hardwareLayoutFilePath, partitionLayoutFilePath)).getClusterMap(); if (bytesPerSec > 0) { this.throttler = new Throttler(bytesPerSec, 1000, true, SystemTime.getInstance()); } else if (bytesPerSec < 0) { throw new IllegalArgumentException("BlobsPerSec " + bytesPerSec + " cannot be negative "); } currentTimeInMs = SystemTime.getInstance().milliseconds(); this.metrics = metrics; }

Target:
public DumpLogTool(VerifiableProperties verifiableProperties, StoreToolsMetrics metrics) throws Exception { fileToRead = verifiableProperties.getString("file.to.read"); hardwareLayoutFilePath = verifiableProperties.getString("hardware.layout.file.path"); partitionLayoutFilePath = verifiableProperties.getString("partition.layout.file.path"); blobIdList = verifiableProperties.getString("blobId.list", ""); logStartOffset = verifiableProperties.getLong("log.start.offset", -1); logEndOffset = verifiableProperties.getLong("log.end.offset", -1); bytesPerSec = verifiableProperties.getLongInRange("bytes.per.sec", 10000, 0, 100000000); silent = verifiableProperties.getBoolean("silent", true); if (!new File(hardwareLayoutFilePath).exists() || !new File(partitionLayoutFilePath).exists()) { throw new IllegalArgumentException("Hardware or Partition Layout file does not exist"); } ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties); this.clusterMap = ((ClusterAgentsFactory) Utils.getObj(clusterMapConfig.clusterMapClusterAgentsFactory, clusterMapConfig, hardwareLayoutFilePath, partitionLayoutFilePath)).getClusterMap(); if (bytesPerSec > 0) { this.throttler = new Throttler(bytesPerSec, 1000, true, SystemTime.getInstance()); } currentTimeInMs = SystemTime.getInstance().milliseconds(); this.metrics = metrics; }
Source:
public void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters) throws Exception { String pigCountersJson = parameters.get(PIG_COUNTERS_PROPERTY); PigCounters pigCounters = pigCountersParser.parse(pigCountersJson); Map<String, String> reportParams = collectReportParameters(parameters); List<ReportParam> avroReportParams = convertToAvroReportParams(reportParams, pigCounters); FileSystem fs = FileSystem.get(conf); Path reportPath = portBindings.getOutput().get(REPORT_PORT_OUT_NAME); DataStore.create(avroReportParams, new FileSystemPath(fs, reportPath)); }

Target:
public void run(PortBindings portBindings, Configuration conf, Map<String, String> parameters) throws Exception { String pigCountersJson = parameters.get(PIG_COUNTERS_PROPERTY); PigCounters pigCounters = pigCountersParser.parse(pigCountersJson); List<ReportPigCounterMapping> reportCountersMapping = collectReportCountersMapping(parameters); List<ReportParam> reportCounters = reportPigCountersResolver.resolveReportCounters(pigCounters, reportCountersMapping); FileSystem fs = FileSystem.get(conf); Path reportPath = portBindings.getOutput().get(REPORT_PORT_OUT_NAME); DataStore.create(reportCounters, new FileSystemPath(fs, reportPath)); }
Source:
public void testHashCodeDifferent() { RuntimeSettingProvider runtimeSettingProvider1 = createPropsWithDriverName("org.talend.Driver1"); JdbcRuntimeInfo jarRuntimeInfo1 = new JdbcRuntimeInfo(runtimeSettingProvider1, "anyRuntimeClassName"); int hashCode1 = jarRuntimeInfo1.hashCode(); RuntimeSettingProvider runtimeSettingProvider2 = createPropsWithDriverName("org.talend.Driver2"); JdbcRuntimeInfo jarRuntimeInfo2 = new JdbcRuntimeInfo(runtimeSettingProvider2, "anyRuntimeClassName"); int hashCode2 = jarRuntimeInfo2.hashCode(); assertEquals(269161086, hashCode1); assertEquals(269161087, hashCode2); assertNotEquals(hashCode1, hashCode2); }

Target:
public void testHashCodeDifferent() { RuntimeSettingProvider runtimeSettingProvider1 = createPropsWithDriverName("org.talend.Driver1"); JdbcRuntimeInfo jdbcRuntimeInfo1 = new JdbcRuntimeInfo(runtimeSettingProvider1, "anyRuntimeClassName"); int hashCode1 = jdbcRuntimeInfo1.hashCode(); RuntimeSettingProvider runtimeSettingProvider2 = createPropsWithDriverName("org.talend.Driver2"); JdbcRuntimeInfo jdbcRuntimeInfo2 = new JdbcRuntimeInfo(runtimeSettingProvider2, "anyRuntimeClassName"); int hashCode2 = jdbcRuntimeInfo2.hashCode(); assertNotEquals(hashCode1, hashCode2); }
Source:
public OAuth2ServiceProvider addProvider(String serviceName, String description, String tokenServerURL, String authorizationServerURL, String userAuthorizationURL, String clientId, String clientSecret, List<String> scopes, Boolean isEnabled) { DirectoryService ds = Framework.getService(DirectoryService.class); try (Session session = ds.open(DIRECTORY_NAME)) { Map<String, Serializable> filter = new HashMap<>(); filter.put("serviceName", serviceName); List<DocumentModel> providers = queryProviders(filter, 1); DocumentModel creationEntry = BaseSession.createEntryModel(null, SCHEMA, null, null); DocumentModel entry = session.createEntry(creationEntry); entry.setProperty(SCHEMA, "serviceName", serviceName); entry.setProperty(SCHEMA, "description", description); entry.setProperty(SCHEMA, "authorizationServerURL", authorizationServerURL); entry.setProperty(SCHEMA, "tokenServerURL", tokenServerURL); entry.setProperty(SCHEMA, "userAuthorizationURL", userAuthorizationURL); entry.setProperty(SCHEMA, "clientId", clientId); entry.setProperty(SCHEMA, "clientSecret", clientSecret); entry.setProperty(SCHEMA, "scopes", StringUtils.join(scopes, ",")); boolean enabled = (clientId != null && clientSecret != null); entry.setProperty(SCHEMA, "enabled", enabled && isEnabled); if (!enabled) { log.info("OAuth2 provider for " + serviceName + " is disabled because clientId and/or clientSecret are empty"); } session.updateEntry(entry); return getProvider(serviceName); } }

Target:
public OAuth2ServiceProvider addProvider(String serviceName, String description, String tokenServerURL, String authorizationServerURL, String userAuthorizationURL, String clientId, String clientSecret, List<String> scopes, Boolean isEnabled) { DirectoryService ds = Framework.getService(DirectoryService.class); try (Session session = ds.open(DIRECTORY_NAME)) { Map<String, Serializable> filter = new HashMap<>(); filter.put("serviceName", serviceName); List<DocumentModel> providers = queryProviders(filter, 1); DocumentModel creationEntry = BaseSession.createEntryModel(null, SCHEMA, null, null); DocumentModel entry = session.createEntry(creationEntry); entry.setProperty(SCHEMA, "serviceName", serviceName); entry.setProperty(SCHEMA, "description", description); entry.setProperty(SCHEMA, "authorizationServerURL", authorizationServerURL); entry.setProperty(SCHEMA, "tokenServerURL", tokenServerURL); entry.setProperty(SCHEMA, "userAuthorizationURL", userAuthorizationURL); entry.setProperty(SCHEMA, "clientId", clientId); entry.setProperty(SCHEMA, "clientSecret", clientSecret); entry.setProperty(SCHEMA, "scopes", String.join(",", scopes)); boolean enabled = (clientId != null && clientSecret != null); entry.setProperty(SCHEMA, "enabled", enabled && (isEnabled == null ? false : isEnabled)); if (!enabled) { log.info("OAuth2 provider for " + serviceName + " is disabled because clientId and/or clientSecret are empty"); } session.updateEntry(entry); return getProvider(serviceName); } }
Source:
private void updateRecipe() { if (!input.isEmpty()) { IRefineryRecipe recipe = BCARecipeManager.refinery.getRecipe(input.getFluid()); requiredHeat = recipe.getRequiredHeat(); lastRequiredHeat = requiredHeat; outputFluidStack = recipe.getOutput(); inputFluidStack = recipe.getInput(); } else requiredHeat = 0; }

Target:
private void updateRecipe() { if (!input.isEmpty()) { IRefineryRecipe recipe = BCARecipeManager.refinery.getRecipe(input.getFluid()); requiredHeat = recipe.getRequiredHeat(); lastRequiredHeat = requiredHeat; outputFluidStack = recipe.getOutput(); inputFluidStack = recipe.getInput(); } else { requiredHeat = 0; } }
Source:
private void setPredicatePushdown(JobConf jobConf) { if (this.filterPredicate != null) { ParquetInputFormat.setFilterPredicate(jobConf, this.filterPredicate); } }

Target:
private void setPredicatePushdown(JobConf jobConf) { if (this.config.filterPredicate != null) { ParquetInputFormat.setFilterPredicate(jobConf, this.config.filterPredicate); } }
Source:
private void notifyListeners(List<CidrAddress> added, List<CidrAddress> removed) { List<CidrAddress> unmodifiableAddedList = Collections.unmodifiableList(added); List<CidrAddress> unmodifiableRemovedList = Collections.unmodifiableList(removed); networkAddressChangeListeners .forEach(listener -> listener.onChanged(unmodifiableAddedList, unmodifiableRemovedList)); }

Target:
private void notifyListeners(List<CidrAddress> added, List<CidrAddress> removed) { List<CidrAddress> unmodifiableAddedList = Collections.unmodifiableList(added); List<CidrAddress> unmodifiableRemovedList = Collections.unmodifiableList(removed); for (NetworkAddressChangeListener listener : networkAddressChangeListeners) { if (safeCaller == null) { break; } NetworkAddressChangeListener safeListener = safeCaller.create(listener, NetworkAddressChangeListener.class) .withTimeout(15000) .onException(exception -> LOGGER.debug("NetworkAddressChangeListener exception {}", exception)) .build(); safeListener.onChanged(unmodifiableAddedList, unmodifiableRemovedList); } }
Source:
static AccountingDate ofYearDay(AccountingChronology chronology, int prolepticYear, int dayOfYear) { if (chronology == null) { throw new DateTimeException("A previously setup chronology is required."); } YEAR.checkValidValue(prolepticYear); DAY_OF_YEAR_RANGE.checkValidValue(dayOfYear, DAY_OF_YEAR); boolean leap = chronology.isLeapYear(prolepticYear); if (dayOfYear > WEEKS_IN_YEAR * DAYS_IN_WEEK && !leap) { throw new DateTimeException("Invalid date 'DayOfYear " + dayOfYear + "' as '" + prolepticYear + "' is not a leap year"); } int month = (leap ? chronology.division.getMonthFromElapsedWeeks((dayOfYear - 1) / DAYS_IN_WEEK, chronology.leapWeekInMonth) : chronology.division.getMonthFromElapsedWeeks((dayOfYear - 1) / DAYS_IN_WEEK)); int dayOfMonth = dayOfYear - (leap ? chronology.division.getWeeksAtStartOfMonth(month, chronology.leapWeekInMonth) : chronology.division.getWeeksAtStartOfMonth(month)) * DAYS_IN_WEEK; return new AccountingDate(chronology, prolepticYear, month, dayOfMonth); }

Target:
static AccountingDate ofYearDay(AccountingChronology chronology, int prolepticYear, int dayOfYear) { Objects.requireNonNull(chronology, "A previously setup chronology is required."); YEAR.checkValidValue(prolepticYear); DAY_OF_YEAR_RANGE.checkValidValue(dayOfYear, DAY_OF_YEAR); boolean leap = chronology.isLeapYear(prolepticYear); if (dayOfYear > WEEKS_IN_YEAR * DAYS_IN_WEEK && !leap) { throw new DateTimeException("Invalid date 'DayOfYear " + dayOfYear + "' as '" + prolepticYear + "' is not a leap year"); } int month = (leap ? chronology.division.getMonthFromElapsedWeeks((dayOfYear - 1) / DAYS_IN_WEEK, chronology.leapWeekInMonth) : chronology.division.getMonthFromElapsedWeeks((dayOfYear - 1) / DAYS_IN_WEEK)); int dayOfMonth = dayOfYear - (leap ? chronology.division.getWeeksAtStartOfMonth(month, chronology.leapWeekInMonth) : chronology.division.getWeeksAtStartOfMonth(month)) * DAYS_IN_WEEK; return new AccountingDate(chronology, prolepticYear, month, dayOfMonth); }
Source:
private void initNetworkInterfaces() { AsyncQuery getVmNicsQuery = new AsyncQuery(); getVmNicsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { List<VmNetworkInterface> nics = (List<VmNetworkInterface>) result; initNetworkInterfaces(networkBehavior, nics); } }; AsyncDataProvider.getVmNicList(getVmNicsQuery, vm.getId()); }

Target:
private void initNetworkInterfaces() { if (networkInterfacesInited) { return; } AsyncQuery getVmNicsQuery = new AsyncQuery(); getVmNicsQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { List<VmNetworkInterface> nics = (List<VmNetworkInterface>) result; initNetworkInterfaces(networkBehavior, nics); networkInterfacesInited = true; } }; AsyncDataProvider.getVmNicList(getVmNicsQuery, vm.getId()); }
Source:
public Response statusByDate(@PathParam("date") String date) throws Exception { JSONObject object = new JSONObject(); Optional<BackupMetadata> backupMetadataOptional = this.completedBkups .locate(date) .stream() .filter(backupMetadata -> backupMetadata != null) .filter(backupMetadata -> backupMetadata.getStatus() == Status.FINISHED) .filter( backupMetadata -> backupMetadata.getBackupVersion() == SnapshotBackup.BACKUP_VERSION) .findFirst(); if (!backupMetadataOptional.isPresent()) { object.put("Snapshotstatus", false); } else { object.put("Snapshotstatus", true); object.put("Details", backupMetadataOptional.get().toString()); } return Response.ok(object.toString(), MediaType.APPLICATION_JSON).build(); }

Target:
public Response statusByDate(@PathParam("date") String date) throws Exception { JSONObject object = new JSONObject(); Optional<BackupMetadata> backupMetadataOptional = this.completedBkups .locate(date) .stream() .filter(Objects::nonNull) .filter(backupMetadata -> backupMetadata.getStatus() == Status.FINISHED) .filter( backupMetadata -> backupMetadata .getBackupVersion() .equals(BackupVersion.SNAPSHOT_BACKUP)) .findFirst(); if (!backupMetadataOptional.isPresent()) { object.put("Snapshotstatus", false); } else { object.put("Snapshotstatus", true); object.put("Details", backupMetadataOptional.get().toString()); } return Response.ok(object.toString(), MediaType.APPLICATION_JSON).build(); }
Source:
public void testLoadUnknown() { Preferences preferences = anyPreferences(); PreferenceStorage storage = new PreferenceStorage(preferences); try { assertEquals(new Object(), storage.load(unknown)); fail("UnsupportedOperationException expected for unknown value class"); } catch (UnsupportedOperationException e) { } }

Target:
public void testLoadUnknown() { Preferences preferences = anyPreferences(); OsgiPreferenceStorage storage = new OsgiPreferenceStorage(preferences); assertEquals(new Object(), storage.load(unknown)); fail("UnsupportedOperationException expected for unknown value type"); }
Source:
public void testSetDelivery() { Configuration configuration = new Configuration("5d1ec5bd39a74caa1267142706a7fb21"); assertNull(configuration.getDelivery()); Delivery delivery = new Delivery() { @NotNull @Override public DeliveryStatus deliver(@NotNull SessionPayload payload, @NotNull DeliveryParams deliveryParams) { return null; } @NotNull @Override public DeliveryStatus deliver(@NotNull EventPayload report, @NotNull DeliveryParams deliveryParams) { return null; } }; configuration.setDelivery(delivery); assertFalse(configuration.getDelivery() instanceof DefaultDelivery); assertEquals(delivery, configuration.getDelivery()); }

Target:
public void testSetDelivery() { Configuration configuration = new Configuration("5d1ec5bd39a74caa1267142706a7fb21"); assertNull(configuration.getDelivery()); Delivery delivery = new Delivery() { @NotNull @Override public DeliveryStatus deliver(@NotNull SessionPayload payload, @NotNull DeliveryParams deliveryParams) { return null; } @NotNull @Override public DeliveryStatus deliver(@NotNull EventPayload payload, @NotNull DeliveryParams deliveryParams) { return null; } }; configuration.setDelivery(delivery); assertFalse(configuration.getDelivery() instanceof DefaultDelivery); assertEquals(delivery, configuration.getDelivery()); }
Source:
FilterSupportStatus(boolean isSupported, String reason) { this.isSupported = isSupported; this.reason = reason; }

Target:
private FilterSupportStatus(boolean isSupported, String reason) { this.isSupported = isSupported; this.reason = reason; }
Source:
public void nonProtectedCheckMethodsTest() { final JavaClasses importedClasses = new ClassFileImporter() .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) .importPackages("com.puppycrawl.tools.checkstyle.checks"); final ArchRule checkMethodsShouldNotBeProtectedRule = methods().that() .areDeclaredInClassesThat().haveNameMatching("^(Abstract).*Check") .should().notBeProtected(); checkMethodsShouldNotBeProtectedRule.check(importedClasses); }

Target:
public void nonProtectedCheckMethodsTest() { final String[] methodsWithOverrideAnnotation = { "processFiltered", "getMethodName", "mustCheckName", "postProcessHeaderLines", "getLogMessageId", }; final String ignoreMethodList = String.join("|", methodsWithOverrideAnnotation); final JavaClasses importedClasses = new ClassFileImporter() .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) .importPackages("com.puppycrawl.tools.checkstyle.checks"); final ArchRule checkMethodsShouldNotBeProtectedRule = methods().that() .haveNameNotMatching(".*(" + ignoreMethodList + ")").and() .areDeclaredInClassesThat() .haveSimpleNameEndingWith("Check").and() .areDeclaredInClassesThat() .doNotHaveModifier(JavaModifier.ABSTRACT) .should().notBeProtected(); checkMethodsShouldNotBeProtectedRule.check(importedClasses); }
Source:
private void createLegend(D3 d3Selection) { int titleSize = 5; int legendSquareSize = 12; int legendSize = titleSize + (legendSquareSize * COLORS_SCHEME.length); AtomicInteger rectPos = new AtomicInteger(); AtomicInteger textPos = new AtomicInteger(legendSquareSize); String translate = "translate(0, " + (height - legendSize - 2) + ")"; D3 legendGroup = d3Selection.append("g") .attr("transform", translate); legendGroup.append("text") .attr("class", "map-legend-caption") .attr("x", 0) .attr("y", titleSize * -1) .text(conf.getTitle()); D3 legendValuesGroup = legendGroup.append("g"); legendValuesGroup.selectAll("rect") .data(colorScale.range()) .enter().append("rect") .attr("height", legendSquareSize) .attr("width", legendSquareSize) .attr("y", (d, i, el) -> rectPos.getAndAdd(legendSquareSize)) .attr("fill", (d, i, el) -> d) .append("svg:title").text((d, i, el) -> { return String.join(" - ", getFormattedBoundaryValues((String) d)); }); legendValuesGroup.selectAll("text") .data(colorScale.range()) .enter().append("text") .attr("class", "map-legend-val") .attr("x", legendSquareSize + 2) .attr("y", (d, i, el) -> textPos.getAndAdd(legendSquareSize)) .text((d, i, el) -> { String[] values = getFormattedBoundaryValues((String) d); return "< " + values[1]; }); }

Target:
private void createLegend(D3 d3Selection) { int titleSize = 5; int legendSquareSize = 12; int legendSize = titleSize + (legendSquareSize * COLORS_SCHEME.length); AtomicInteger rectPos = new AtomicInteger(); AtomicInteger textPos = new AtomicInteger(legendSquareSize); String translate = "translate(0, " + (height - legendSize - 2) + ")"; D3 legendGroup = d3Selection.append("g").attr("transform", translate); legendGroup.append("text").attr("class", "map-legend-caption") .attr("x", 0).attr("y", titleSize * -1) .text(conf.getTitle()); D3 legendValuesGroup = legendGroup.append("g"); legendValuesGroup.selectAll("rect") .data(colorScale.range()).enter().append("rect") .attr("height", legendSquareSize).attr("width", legendSquareSize) .attr("y", (d, i, el) -> rectPos.getAndAdd(legendSquareSize)) .attr("fill", (d, i, el) -> d) .append("svg:title") .text((d, i, el) -> String.join(" - ", getFormattedBoundaryValues(d)) ); legendValuesGroup.selectAll("text").data(colorScale.range()).enter().append("text") .attr("class", "map-legend-val").attr("x", legendSquareSize + 2) .attr("y", (d, i, el) -> textPos.getAndAdd(legendSquareSize)).text( (d, i, el) -> buildLegendValue(d, i)); }
Source:
private void registerShellListener() { isActive.set(true); final Display display = PlatformUI.getWorkbench().getDisplay(); if (display.isDisposed()) return; display.asyncExec(new Runnable() { public void run() { Shell shell = display.getActiveShell(); if (shell != null) { shell.addShellListener(new ShellAdapter() { public void shellActivated(ShellEvent e) { isActive.set(true); } public void shellClosed(ShellEvent e) { isActive.set(false); } public void shellDeactivated(ShellEvent e) { isActive.set(false); } }); } } }); }

Target:
private void registerShellListener() { isActive.set(true); final Display display = PlatformUI.getWorkbench().getDisplay(); if (display.isDisposed()) return; display.asyncExec(new Runnable() { public void run() { Shell shell = display.getActiveShell(); if (shell != null) { shell.addShellListener(new ShellAdapter() { public void shellActivated(ShellEvent e) { isActive.set(true); } public void shellClosed(ShellEvent e) { isActive.set(false); } public void shellDeactivated(ShellEvent e) { isActive.set(false); } }); } else handleIssue(IStatus.WARNING, UIText.Activator_CantRegisterShellListener, null, false); } }); }
Source:
private Button createChangeAction() { final Button createChange = new Button("Create change"); createChange.setTitle("Create change directly in browser"); createChange.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { CreateChangeAction.call(createChange, getProjectKey().toString()); } }); return createChange; }

Target:
private Button createChangeAction() { final Button createChange = new Button(Util.C.buttonCreateChange()); createChange.setTitle(Util.C.buttonCreateChangeDescription()); createChange.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { CreateChangeAction.call(createChange, getProjectKey().get()); } }); return createChange; }
Source:
private void setUnixLookAndFeel(){ try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Exceptions.printStackTrace(ex); } }

Target:
private void setUnixLookAndFeel(){ try { UIManager.put("swing.boldMetal", Boolean.FALSE); UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); setModuleSettings("true"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.log(Level.WARNING, "Error setting crossplatform look-and-feel, setting default look-and-feel",ex); setModuleSettings("false"); } }
Source:
private void createNewTraceNameGroup(Composite parent) { Font font = parent.getFont(); Composite folderGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; folderGroup.setLayout(layout); folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; String name = fTrace.getName(); Label newTaceLabel = new Label(folderGroup, SWT.NONE); newTaceLabel.setFont(font); newTaceLabel.setText(Messages.RenameTraceDialog_TraceNewName); fNewTraceNameText = new Text(folderGroup, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; fNewTraceNameText.setLayoutData(data); fNewTraceNameText.setFont(font); fNewTraceNameText.setFocus(); fNewTraceNameText.setText(name); fNewTraceNameText.setSelection(0, name.length()); fNewTraceNameText.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { validateNewTraceName(); } }); }

Target:
private void createNewTraceNameGroup(Composite parent) { Font font = parent.getFont(); Composite folderGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; folderGroup.setLayout(layout); folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); String name = fTrace.getName(); Label newTaceLabel = new Label(folderGroup, SWT.NONE); newTaceLabel.setFont(font); newTaceLabel.setText(Messages.RenameTraceDialog_TraceNewName); fNewTraceNameText = new Text(folderGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; fNewTraceNameText.setLayoutData(data); fNewTraceNameText.setFont(font); fNewTraceNameText.setFocus(); fNewTraceNameText.setText(name); fNewTraceNameText.setSelection(0, name.length()); fNewTraceNameText.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { validateNewTraceName(); } }); }
Source:
public List<TriggerEvent> getTriggers(int page, int pageSize) { try (Connection conn = DBConnectionManager.getInstance().getConnection(sqlProperties.getProperty(DATA_SOURCE)); Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery(buildGetTriggersQuery(page, pageSize)); List<TriggerEvent> triggers = new ArrayList<>(); while (rs.next()) { try (InputStream is = new ByteArrayInputStream(rs.getBytes(JOB_DATA)); ObjectInputStream ois = new ObjectInputStream(is)) { JobDataMap dataMap = (JobDataMap) ois.readObject(); triggers.add(new TriggerEvent( "Job: " + rs.getString(JOB_NAME), rs.getString(JOB_NAME), rs.getString(JOB_DESCRIPTION), new ArrayList<>(), dataMap.getString(SchedulerConstants.EVENT_TYPE_KEY_NAME) )); } } return triggers; } catch (Exception e) { throw new TriggerRetrievalException("Couldn't retrieve triggers for Scheduler channel", e); } }

Target:
public List<TriggerEvent> getTriggers(int page, int pageSize) { try { return motechSchedulerDatabaseService.getTriggers(page, pageSize); } catch (SQLException|IOException|ClassNotFoundException e) { throw new TriggerRetrievalException("Couldn't retrieve triggers for Scheduler channel", e); } }
Source:
public <T> Mono<T> toObjectAsync(Class<T> clazz, ObjectSerializer serializer) { if (Objects.isNull(serializer)) { return monoError(LOGGER, new NullPointerException("'serializer' cannot be null.")); } return Mono.fromCallable(() -> toObject(clazz, serializer)); }

Target:
public <T> Mono<T> toObjectAsync(Class<T> clazz, ObjectSerializer serializer) { if (Objects.isNull(clazz)) { return monoError(LOGGER, new NullPointerException("'clazz' cannot be null.")); } else if (Objects.isNull(serializer)) { return monoError(LOGGER, new NullPointerException("'serializer' cannot be null.")); } return Mono.fromCallable(() -> toObject(clazz, serializer)); }
Source:
ElasticsearchTableDescriptionProvider(ElasticsearchConnectorConfig config, JsonCodec<ElasticsearchTableDescription> codec) { this.tableDefinitions = new HashMap<>(); try { for (File file : listFiles(config.getTableDescriptionDir())) { if (file.isFile() && file.getName().endsWith(".json")) { ElasticsearchTableDescription table = codec.fromJson(readAllBytes(file.toPath())); String schemaName = firstNonNull(table.getSchemaName(), config.getDefaultSchema()); tableDefinitions.put(new SchemaTableName(schemaName, table.getTableName()), table); } } for (String definedTable : config.getTableNames()) { SchemaTableName tableName = parseTableName(definedTable); if (!tableDefinitions.containsKey(tableName)) { throw new PrestoException(ELASTICSEARCH_TABLE_DEFINITION_ERROR, "Missing table definition for: " + tableName); } ElasticsearchTableDescription elasticsearchTable = tableDefinitions.get(tableName); tableDefinitions.put(tableName, elasticsearchTable); } } catch (IOException e) { throw new UncheckedIOException(e); } }

Target:
ElasticsearchTableDescriptionProvider(ElasticsearchConnectorConfig config, JsonCodec<ElasticsearchTableDescription> codec) { requireNonNull(config, "config is null"); requireNonNull(codec, "codec is null"); tableDefinitions = createTableDescriptions(config, codec); }