auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String printTabularResults(Tabular tabular) { List<Integer> lengths = new ArrayList<>(tabular.headers.size()); for(int i = 0; i < tabular.headers.size(); ++i) { lengths.add(tabular.headers.get(i).length()); } for(Tabular.Row row : tabular.rows) { for(int i = 0; i < row.cols.size(); ++i) { if(lengths.get(i) < row.cols.get(i).length()) { lengths.set(i, row.cols.get(i).length()); } } } List<String> formats = new ArrayList<>(lengths.size()); for(Integer length : lengths) { formats.add("%-" + (length + 5) + "s"); } StringBuilder stringBuilder = new StringBuilder(); for(int i = 0; i < tabular.headers.size(); ++i) { stringBuilder.append(Colored.boldWhite(String.format(formats.get(i), tabular.headers.get(i)))); } stringBuilder.append("\n"); int totalLength = lengths.stream().reduce(0, Integer::sum); totalLength += 5 * lengths.size(); String separate = new String(new char[totalLength]).replace("\0", "="); stringBuilder.append(Colored.boldWhite(separate)).append("\n"); for(Tabular.Row row : tabular.rows) { for(int i = 0; i < row.cols.size(); ++i) { stringBuilder.append(String.format(formats.get(i), row.cols.get(i))); } stringBuilder.append("\n"); } return stringBuilder.toString(); }

Target:
public static String printTabularResults(Tabular tabular) { List<Integer> lengths = new ArrayList<>(tabular.headers.size()); for(int i = 0; i < tabular.headers.size(); ++i) { lengths.add(tabular.headers.get(i).length()); } for(Tabular.Row row : tabular.rows) { for(int i = 0; i < row.cols.size(); ++i) { if(lengths.get(i) < row.cols.get(i).length()) { lengths.set(i, row.cols.get(i).length()); } } } final int padding = 5; List<String> formats = new ArrayList<>(lengths.size()); for(Integer length : lengths) { formats.add("%-" + (length + padding) + "s"); } StringBuilder stringBuilder = new StringBuilder(); for(int i = 0; i < tabular.headers.size(); ++i) { stringBuilder.append(Colored.boldWhite(String.format(formats.get(i), tabular.headers.get(i)))); } stringBuilder.append("\n"); int totalLength = lengths.stream().reduce(0, Integer::sum); totalLength += padding * lengths.size(); String separate = new String(new char[totalLength]).replace("\0", "="); stringBuilder.append(Colored.boldWhite(separate)).append("\n"); for(Tabular.Row row : tabular.rows) { for(int i = 0; i < row.cols.size(); ++i) { stringBuilder.append(String.format(formats.get(i), row.cols.get(i))); } stringBuilder.append("\n"); } return stringBuilder.toString(); }
Source:
public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) { if (commitMessage == null) { PatchSet.Id psId = null; String sha1 = null; Project.NameKey name = null; Repository repo = null; try { psId = change(db).currentPatchSetId(); sha1 = db.get().patchSets().get(psId).getRevision().get(); name = change.getProject(); repo = repoManager.openRepository(name); RevWalk walk = new RevWalk(repo); try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); } } catch (RepositoryNotFoundException e) { log.error("Repository not found: " + name.toString(), e); } catch (IOException e) { if(repo == null) { log.error("Problem opening repository: " + name.toString(), e); } else { log.error("Problem parsing commit: " + sha1, e); } } catch (OrmException e) { if (psId != null) { log.error("Problem requesting sha1 from database for patchSetId: " + psId.toString(), e); } else { log.error("Problem requesting change from database for change: " + legacyId.toString(), e); } } } return commitMessage; }

Target:
public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) { if (commitMessage == null) { PatchSet.Id psId = null; String sha1 = null; Project.NameKey name = null; Repository repo = null; try { psId = change(db).currentPatchSetId(); sha1 = db.get().patchSets().get(psId).getRevision().get(); name = change.getProject(); repo = repoManager.openRepository(name); RevWalk walk = new RevWalk(repo); try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); } } catch (RepositoryNotFoundException e) { log.error("Repository not found: " + name.toString(), e); } catch (IOException e) { if(repo == null) { log.error("Problem opening repository: " + name.toString(), e); } else { log.error("Problem parsing commit: " + sha1, e); } } catch (OrmException e) { if (psId != null) { log.error("Problem requesting sha1 from database for patchSetId: " + psId.toString(), e); } else { log.error("Problem requesting change from database for change: " + legacyId.toString(), e); } } finally { if(repo != null) { repo.close(); } } } return commitMessage; }
Source:
public void onIndexPageWithLocalResources() { ContentSecurityPolicyHeaderWriter writer = new ContentSecurityPolicyHeaderWriter( false, true, SiteUrl.SITE, H2_CONSOLE_PATH ); String[] directives = writer.constructDirectives("/").split(";"); assertThat(directives) .contains( "default-src 'none'", "img-src <LINK_1> 'self'", "font-src 'self'", "report-uri <LINK_0>", "style-src 'report-sample' <LINK_1> 'self'", "script-src 'report-sample' 'unsafe-inline' 'self'" ) .hasSize(NUMBER_OF_DIRECTIVES_ON_STANDARD_PAGES); }

Target:
public void onIndexPageWithLocalResources() { ContentSecurityPolicyHeaderWriter writer = new ContentSecurityPolicyHeaderWriter( false, true, SiteUrl.SITE, nullOr(H2_CONSOLE_PATH) ); String[] directives = writer.constructDirectives("/").split(";"); assertThat(directives) .contains( "default-src 'none'", "img-src <LINK_1> 'self'", "font-src 'self'", "report-uri <LINK_0>", "style-src 'report-sample' <LINK_1> 'self'", "script-src 'report-sample' 'unsafe-inline' 'self'" ) .hasSize(NUMBER_OF_DIRECTIVES_ON_STANDARD_PAGES); }
Source:
public void put(K key, V value) { try { putAsync(key, value).get(); } catch (InterruptedException e) { throw new SamzaException(e); } catch (Exception e) { throw (SamzaException) e.getCause(); } }

Target:
public void put(K key, V value) { try { putAsync(key, value).get(); } catch (Exception e) { throw new SamzaException(e); } }
Source:
String getExternalId(boolean fromServer) { return null; }

Target:
@Nullable String getExternalId(boolean fromServer) { return null; }
Source:
public static boolean matches(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { if (!channelElementValues.isMbusSlaveDeviceConfigured()) { return false; } if (mbusChannelElements.hasMbusIdentificationNumber() && !mbusChannelElements.getMbusIdentificationNumber() .equals(channelElementValues.getIdentificationNumber())) { return false; } if (mbusChannelElements.hasMbusManufacturerIdentification() && !mbusChannelElements .getMbusManufacturerIdentification().equals(channelElementValues.getManufacturerIdentification())) { return false; } if (mbusChannelElements.hasMbusVersion() && !mbusChannelElements.getMbusVersion().equals(channelElementValues.getVersion())) { return false; } if (mbusChannelElements.hasMbusDeviceTypeIdentification() && !mbusChannelElements .getMbusDeviceTypeIdentification().equals(channelElementValues.getDeviceTypeIdentification())) { return false; } return true; }

Target:
public static boolean matches(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { if (!channelElementValues.isMbusSlaveDeviceConfigured()) { return false; } if (failMatchOnMbusIdentificationNumber(mbusChannelElements, channelElementValues) || failMatchOnMbusManufacturerIdentification(mbusChannelElements, channelElementValues) || failMatchOnMbusVersion(mbusChannelElements, channelElementValues) || failMatchOnMbusDeviceTypeIdentification(mbusChannelElements, channelElementValues)) { return false; } return true; }
Source:
public void validateConfig(WorkspaceConfig config) throws ValidationException, ServerException { checkNotNull(config.getName(), "Workspace name required"); check( WS_NAME.matcher(config.getName()).matches(), "Incorrect workspace name, it must be between 3 and 100 characters and may contain digits, " + "latin letters, underscores, dots, dashes and must start and end only with digits, " + "latin letters or underscores"); if ((config.getEnvironments() != null && !config.getEnvironments().isEmpty()) || !isNullOrEmpty(config.getDefaultEnv()) || !isSidecarBasedWorkspace(config.getAttributes())) { validateEnvironments(config); } for (Command command : config.getCommands()) { check( !isNullOrEmpty(command.getName()), "Workspace %s contains command with null or empty name", config.getName()); check( !isNullOrEmpty(command.getCommandLine()), "Command line required for command '%s' in workspace '%s'", command.getName(), config.getName()); } validatePlugins(config); }

Target:
public void validateConfig(WorkspaceConfig config) throws ValidationException, ServerException { checkNotNull(config.getName(), "Workspace name required"); check( WS_NAME.matcher(config.getName()).matches(), "Incorrect workspace name, it must be between 3 and 100 characters and may contain digits, " + "latin letters, underscores, dots, dashes and must start and end only with digits, " + "latin letters or underscores"); validateEnvironments(config); for (Command command : config.getCommands()) { check( !isNullOrEmpty(command.getName()), "Workspace %s contains command with null or empty name", config.getName()); check( !isNullOrEmpty(command.getCommandLine()), "Command line required for command '%s' in workspace '%s'", command.getName(), config.getName()); } validatePlugins(config); }
Source:
private List<FeedbackSubmissionEditResponse> createResponses( FeedbackQuestionAttributes questionAttributes, int qnIndx, int numOfResponseBoxes) { List<FeedbackSubmissionEditResponse> responses = new ArrayList<FeedbackSubmissionEditResponse>(); List<FeedbackResponseAttributes> existingResponses = bundle.questionResponseBundle.get(questionAttributes); int responseIndx = 0; for(FeedbackResponseAttributes existingResponse : existingResponses) { List<String> recipientOptionsForQuestion = getRecipientOptionsForQuestion( questionAttributes.getId(), existingResponse.recipientEmail); String submissionFormHtml = questionAttributes.getQuestionDetails() .getQuestionWithExistingResponseSubmissionFormHtml(isSessionOpenForSubmission(), qnIndx, responseIndx, questionAttributes.courseId, existingResponse.getResponseDetails()); responses.add(new FeedbackSubmissionEditResponse(responseIndx, true, recipientOptionsForQuestion, submissionFormHtml, existingResponse.getId())); responseIndx++; } while (responseIndx < numOfResponseBoxes) { List<String> recipientOptionsForQuestion = getRecipientOptionsForQuestion(questionAttributes.getId(), null); String submissionFormHtml = questionAttributes.getQuestionDetails() .getQuestionWithoutExistingResponseSubmissionFormHtml(isSessionOpenForSubmission(), qnIndx, responseIndx, questionAttributes.courseId); responses.add(new FeedbackSubmissionEditResponse(responseIndx, false, recipientOptionsForQuestion, submissionFormHtml, "")); responseIndx++; } return responses; }

Target:
private List<FeedbackSubmissionEditResponse> createResponses( FeedbackQuestionAttributes questionAttributes, int qnIndx, int numOfResponseBoxes) { List<FeedbackSubmissionEditResponse> responses = new ArrayList<FeedbackSubmissionEditResponse>(); List<FeedbackResponseAttributes> existingResponses = bundle.questionResponseBundle.get(questionAttributes); int responseIndx = 0; for(FeedbackResponseAttributes existingResponse : existingResponses) { List<String> recipientOptionsForQuestion = getRecipientOptionsForQuestion( questionAttributes.getId(), existingResponse.recipientEmail); String submissionFormHtml = questionAttributes.getQuestionDetails() .getQuestionWithExistingResponseSubmissionFormHtml(isSessionOpenForSubmission, qnIndx, responseIndx, questionAttributes.courseId, existingResponse.getResponseDetails()); responses.add(new FeedbackSubmissionEditResponse(responseIndx, true, recipientOptionsForQuestion, submissionFormHtml, existingResponse.getId())); responseIndx++; } while (responseIndx < numOfResponseBoxes) { List<String> recipientOptionsForQuestion = getRecipientOptionsForQuestion(questionAttributes.getId(), null); String submissionFormHtml = questionAttributes.getQuestionDetails() .getQuestionWithoutExistingResponseSubmissionFormHtml(isSessionOpenForSubmission, qnIndx, responseIndx, questionAttributes.courseId); responses.add(new FeedbackSubmissionEditResponse(responseIndx, false, recipientOptionsForQuestion, submissionFormHtml, "")); responseIndx++; } return responses; }
Source:
public OutputWriter createOutputWriter() { List<String> headers = new ArrayList<String>(); for (int i = 0; i < columns.length; i++) { String columnName = getColumnHeader(i); headers.add(columnName); if (columnToBeSortedOn != null) { if (columns[i].equals(columnToBeSortedOn)) { _indexOfColumnToBeSortedOn = i; } } } if (columnToBeSortedOn != null) { if (_indexOfColumnToBeSortedOn == -1) { this._isColumnToBeSortedOnPresentInInput = false; _indexOfColumnToBeSortedOn = columns.length; headers.add(columnToBeSortedOn.getName()); InputColumn<?>[] newColumns = new InputColumn<?>[columns.length + 1]; for (int i = 0; i < columns.length; i++) { newColumns[i] = columns[i]; } newColumns[columns.length] = columnToBeSortedOn; columns = newColumns; } } if (_targetFile == null) { try { initTempFile(); } catch (Exception e) { throw new RuntimeException(e); } } return CsvOutputWriterFactory.getWriter(_targetFile.getPath(), headers.toArray(new String[0]), separatorChar, getSafeQuoteChar(), getSafeEscapeChar(), includeHeader, columns); }

Target:
public OutputWriter createOutputWriter() { List<String> headers = new ArrayList<String>(); for (int i = 0; i < columns.length; i++) { String columnName = getColumnHeader(i); headers.add(columnName); if (columnToBeSortedOn != null) { if (columns[i].equals(columnToBeSortedOn)) { _indexOfColumnToBeSortedOn = i; } } } if (columnToBeSortedOn != null) { if (_indexOfColumnToBeSortedOn == -1) { _isColumnToBeSortedOnPresentInInput = false; _indexOfColumnToBeSortedOn = columns.length; headers.add(columnToBeSortedOn.getName()); InputColumn<?>[] newColumns = new InputColumn<?>[columns.length + 1]; for (int i = 0; i < columns.length; i++) { newColumns[i] = columns[i]; } newColumns[columns.length] = columnToBeSortedOn; columns = newColumns; } } if (_targetFile == null) { try { initTempFile(); } catch (Exception e) { throw new RuntimeException(e); } } return CsvOutputWriterFactory.getWriter(_targetFile.getPath(), headers.toArray(new String[0]), separatorChar, getSafeQuoteChar(), getSafeEscapeChar(), includeHeader, columns); }
Source:
public Map<String, String> getHeaders() throws AuthFailureError { String clientId = ""; Map<String, String> headers = new ArrayMap<>(1); headers.put("Authorization", "Client-ID " + clientId); return headers; }

Target:
public Map<String, String> getHeaders() throws AuthFailureError { String clientId = AwfulPreferences.getInstance().getResources().getString(R.string.imgur_api_client_id); Map<String, String> headers = new ArrayMap<>(1); headers.put("Authorization", "Client-ID " + clientId); return headers; }
Source:
public static FolderItem toFolderItem( final org.uberfire.java.nio.file.Path path ) { if ( Files.isRegularFile( path ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( path ); return new FolderItem( p, p.getFileName(), FolderItemType.FILE, false, Paths.readLockedBy( p ), null ); } else if ( Files.isDirectory( path ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( path ); return new FolderItem( p, p.getFileName(), FolderItemType.FOLDER ); } return null; }

Target:
public static FolderItem toFolderItem( final org.uberfire.java.nio.file.Path path ) { if ( Files.isRegularFile( path ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( path ); return new FolderItem( p, p.getFileName(), FolderItemType.FILE, false, Paths.readLockedBy( p ), new ArrayList<String>( ) ); } else if ( Files.isDirectory( path ) ) { final org.uberfire.backend.vfs.Path p = Paths.convert( path ); return new FolderItem( p, p.getFileName(), FolderItemType.FOLDER ); } return null; }
Source:
private <R extends PersistableBusinessObject> void writeResultsSummaryToReportByResultCode(List<RassBusinessObjectUpdateResult<R>> results, RassObjectUpdateResultCode resultCode, Class businessObjectClass) { List<RassBusinessObjectUpdateResult<R>> filteresdResults = results.stream().filter(result -> resultCode.equals(result.getResultCode())) .collect(Collectors.toList()); writeSummaryLineToReport(filteresdResults, resultCode, businessObjectClass); }

Target:
private <R extends PersistableBusinessObject> void writeResultsSummaryToReportByResultCode(List<RassBusinessObjectUpdateResult<R>> results, RassObjectUpdateResultCode resultCode, Class businessObjectClass) { List<RassBusinessObjectUpdateResult<R>> filteredResults = results.stream().filter(result -> resultCode.equals(result.getResultCode())) .collect(Collectors.toList()); writeSummaryLineToReport(filteredResults, resultCode, businessObjectClass); }
Source:
public ServerCapabilities getServerCapabilities() { try { start(); if (this.initializeFuture != null) { this.initializeFuture.get(capabilitiesAlreadyRequested ? 0 : 1000, TimeUnit.MILLISECONDS); } } catch (TimeoutException e) { if (System.currentTimeMillis() - initializeStartTime > 10000) { LanguageServerPlugin.logError("LanguageServer not initialized after 10s", e); } } catch (IOException | InterruptedException | ExecutionException e) { LanguageServerPlugin.logError(e); } this.capabilitiesAlreadyRequested = true; if (this.initializeResult != null) { return this.initializeResult.getCapabilities(); } else { return null; } }

Target:
public ServerCapabilities getServerCapabilities() { try { getInitializedServer().get(10, TimeUnit.SECONDS); } catch (TimeoutException e) { LanguageServerPlugin.logError("LanguageServer not initialized after 10s", e); } catch (InterruptedException | ExecutionException e) { LanguageServerPlugin.logError(e); } this.capabilitiesAlreadyRequested = true; if (this.initializeResult != null) { return this.initializeResult.getCapabilities(); } else { return null; } }
Source:
public static void setUp() throws IOException, TimeoutException, InterruptedException, CommandFailedException { administration.reloadIfRequired(); client.apply(new DeployCommand.Builder(FILE_PATH + FILE_NAME) .name(NAME) .build()); }

Target:
public static void setUp() throws IOException, TimeoutException, InterruptedException, CommandFailedException { client.apply(new DeployCommand.Builder(XssScriptingTestCase.class.getClassLoader().getResource(FILE_NAME).getFile()) .name(NAME) .build()); }
Source:
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) { if(DefaultDebugExecutor.EXECUTOR_ID.equals(executorId)) { return false; } return DefaultRunExecutor.EXECUTOR_ID.equals(executorId) && profile instanceof GoApplicationConfiguration; }

Target:
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) { return DefaultRunExecutor.EXECUTOR_ID.equals(executorId) && profile instanceof GoApplicationConfiguration; }
Source:
public void handle(Patient patient, User originalVoidingUser, Date origParentVoidedDate, String unused) { if (patient.getId() != null) { EncounterService es = Context.getEncounterService(); EncounterSearchCriteria encounterSearchCriteria = new EncounterSearchCriteriaBuilder() .setPatient(patient) .setIncludeVoided(true) .createEncounterSearchCriteria(); List<Encounter> encounters = es.getEncounters(encounterSearchCriteria); if (CollectionUtils.isNotEmpty(encounters)) { for (Encounter encounter : encounters) { if (encounter.isVoided() && encounter.getDateVoided().equals(origParentVoidedDate) && encounter.getVoidedBy().equals(originalVoidingUser)) { es.unvoidEncounter(encounter); } } } OrderService os = Context.getOrderService(); List<Order> orders = os.getAllOrdersByPatient(patient); if (CollectionUtils.isNotEmpty(orders)) { for (Order order : orders) { if (order.isVoided() && order.getDateVoided().equals(origParentVoidedDate) && order.getVoidedBy().equals(originalVoidingUser)) { os.unvoidOrder(order); } } } CohortService cs = Context.getCohortService(); if (patient.getId() != null) { if (patient.getDateVoided().equals(origParentVoidedDate) && patient.getVoidedBy().equals(originalVoidingUser)) { cs.patientUnvoided(patient, originalVoidingUser, origParentVoidedDate, patient.getVoidReason()); } } } }

Target:
public void handle(Patient patient, User originalVoidingUser, Date origParentVoidedDate, String unused) { if (patient.getId() != null) { EncounterService es = Context.getEncounterService(); EncounterSearchCriteria encounterSearchCriteria = new EncounterSearchCriteriaBuilder() .setPatient(patient) .setIncludeVoided(true) .createEncounterSearchCriteria(); List<Encounter> encounters = es.getEncounters(encounterSearchCriteria); if (CollectionUtils.isNotEmpty(encounters)) { for (Encounter encounter : encounters) { if (encounter.getVoided() && encounter.getDateVoided().equals(origParentVoidedDate) && encounter.getVoidedBy().equals(originalVoidingUser)) { es.unvoidEncounter(encounter); } } } OrderService os = Context.getOrderService(); List<Order> orders = os.getAllOrdersByPatient(patient); if (CollectionUtils.isNotEmpty(orders)) { for (Order order : orders) { if (order.getVoided() && order.getDateVoided().equals(origParentVoidedDate) && order.getVoidedBy().equals(originalVoidingUser)) { os.unvoidOrder(order); } } } CohortService cs = Context.getCohortService(); cs.patientUnvoided(patient, originalVoidingUser, origParentVoidedDate); } }
Source:
public void resumeOfflinePack(final String packName, final Promise promise) { mainHandler.post(new Runnable() { @Override public void run() { OfflineRegionProgressObserver foundObserver = null; for (OfflineRegionProgressObserver observer : offlinePackObservers) { if (packName.equals(observer.name)) { foundObserver = observer; break; } } if (foundObserver == null) { promise.resolve(Arguments.createMap()); return; } foundObserver.region.setDownloadState(OfflineRegion.STATE_ACTIVE); final OfflineRegionProgressObserver _foundObserver = foundObserver; foundObserver.region.getStatus(new OfflineRegion.OfflineRegionStatusCallback() { @Override public void onStatus(OfflineRegionStatus status) { _foundObserver.onStatusChanged(status); WritableMap result = Arguments.createMap(); result.putString("resumed", _foundObserver.name); promise.resolve(result); } @Override public void onError(String error) { Log.e(context.getApplicationContext().getPackageName(), error); promise.reject(new JSApplicationIllegalArgumentException(error)); } }); } }); }

Target:
public void resumeOfflinePack(final String packName, final Promise promise) { mainHandler.post(new Runnable() { @Override public void run() { final OfflineRegionProgressObserver foundObserver = getObserver(packName); if (foundObserver == null) { promise.resolve(Arguments.createMap()); return; } foundObserver.region.setDownloadState(OfflineRegion.STATE_ACTIVE); foundObserver.region.getStatus(new OfflineRegion.OfflineRegionStatusCallback() { @Override public void onStatus(OfflineRegionStatus status) { foundObserver.onStatusChanged(status); WritableMap result = Arguments.createMap(); result.putString("resumed", foundObserver.name); promise.resolve(result); } @Override public void onError(String error) { Log.e(context.getApplicationContext().getPackageName(), error); promise.reject(new JSApplicationIllegalArgumentException(error)); } }); } }); }
Source:
protected String getPluginName(final InputStream manifest) throws IOException { Properties properties = new Properties(); try (BufferedInputStream stream = new BufferedInputStream(manifest)) { properties.load(stream); } String property = properties.getProperty("Bundle-SymbolicName"); if (property == null) { return null; } if (property.contains(";")) { return property.substring(0, property.indexOf(';')).trim(); } return property.trim(); }

Target:
protected Optional<String> getPluginName(final InputStream manifest) throws IOException { Properties properties = new Properties(); try (BufferedInputStream stream = new BufferedInputStream(manifest)) { properties.load(stream); } String property = properties.getProperty("Bundle-SymbolicName"); if (property == null) { return Optional.empty(); } if (property.contains(";")) { return Optional.of(property.substring(0, property.indexOf(';')).trim()); } return Optional.of(property.trim()); }
Source:
public Set<String> getUniqueUsersWithTokenCache() { Iterator<TokenCacheItem> results = this.getAll(); Set<String> users = new HashSet<>(); while (results.hasNext()) { final TokenCacheItem tokenCacheItem = results.next(); if (tokenCacheItem.getUserInfo() != null && !users.contains(tokenCacheItem.getUserInfo().getUserId())) { users.add(tokenCacheItem.getUserInfo().getUserId()); } } return users; }

Target:
public Set<String> getUniqueUsersWithTokenCache() { Iterator<TokenCacheItem> results = this.getAll(); final Set<String> users = new HashSet<>(); while (results.hasNext()) { final TokenCacheItem tokenCacheItem = results.next(); if (tokenCacheItem.getUserInfo() != null && !users.contains(tokenCacheItem.getUserInfo().getUserId())) { users.add(tokenCacheItem.getUserInfo().getUserId()); } } return users; }
Source:
@Override protected Ignite startGrid(String igniteInstanceName, IgniteConfiguration cfg, GridSpringResourceContext ctx) throws Exception { final Ignite ignite; if (locJvmInstance == null && rmJvmInstance != null) { final UUID syncId = ((IgniteProcessProxy)rmJvmInstance).getId(); final UUID nodeId = cfg.getNodeId(); ignite = super.startGrid(igniteInstanceName, cfg, ctx); assert ignite.configuration().getNodeId() == nodeId : "Started node has unexpected node id."; assert GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { return ignite.cluster().node(syncId) != null; } }, NODE_JOIN_TIMEOUT) : "Node has not joined [id=" + nodeId + "]"; } else ignite = super.startGrid(igniteInstanceName, cfg, ctx); if (locJvmInstance == null && !isRemoteJvm(igniteInstanceName)) locJvmInstance = ignite; return ignite; }

Target:
@Override protected Ignite startGrid(String igniteInstanceName, IgniteConfiguration cfg, GridSpringResourceContext ctx) throws Exception { final Ignite ignite; if (locJvmInstance == null && rmJvmInstance != null) { final UUID nodeId = cfg.getNodeId(); final UUID syncNodeId = ((IgniteProcessProxy)rmJvmInstance).getId(); ignite = super.startGrid(igniteInstanceName, cfg, ctx); assert ignite.configuration().getNodeId() == nodeId : "Started node has unexpected node id."; assert ignite.cluster().node(syncNodeId) != null : "Node has not joined [id=" + nodeId + "]"; } else ignite = super.startGrid(igniteInstanceName, cfg, ctx); if (locJvmInstance == null && !isRemoteJvm(igniteInstanceName)) locJvmInstance = ignite; return ignite; }
Source:
private void checkRequiresCapability() throws RequireCapabilityException { RequiresCapability rc = getClass().getAnnotation(RequiresCapability.class); if (rc != null) { CurrentUser user = currentUser.get(); CapabilityControl ctl = user.getCapabilities(); if (!ctl.canPerform(rc.value()) && !ctl.canAdministrateServer()) { String fallbackUserId; if(user instanceof IdentifiedUser) { fallbackUserId = ((IdentifiedUser)user).getNameEmail(); } else { fallbackUserId = user.toString(); } String msg = String.format("fatal: %s does not have \"%s\" capability.", Objects.firstNonNull(user.getUserName(), fallbackUserId), rc.value()); throw new RequireCapabilityException(msg); } } }

Target:
private void checkRequiresCapability() throws RequireCapabilityException { RequiresCapability rc = getClass().getAnnotation(RequiresCapability.class); if (rc != null) { CurrentUser user = currentUser.get(); CapabilityControl ctl = user.getCapabilities(); if (!ctl.canPerform(rc.value()) && !ctl.canAdministrateServer()) { String msg = String.format( "fatal: %s does not have \"%s\" capability.", Objects.firstNonNull( user.getUserName(), user instanceof IdentifiedUser ? ((IdentifiedUser) user).getNameEmail() : user.toString()), rc.value()); throw new RequireCapabilityException(msg); } } }
Source:
public void whenClientErrorResponseThenGetProjectFeatureFlagsShouldThrow() throws Exception { when(restTemplate.getForObject(PROJECT_FEATURE_FLAGS_URI_PATTERN, ProjectFeatureFlags.class, PROJECT_ID)) .thenThrow(new RestClientException("")); service.listProjectFeatureFlags(project); }

Target:
public void whenClientErrorResponseThenGetProjectFeatureFlagsShouldThrow() throws Exception { when(restTemplate.getForObject(new URI(PROJECT_FEATURE_FLAGS_URI), ProjectFeatureFlags.class)) .thenThrow(new RestClientException("")); service.listProjectFeatureFlags(project); }
Source:
public Set<Integer> getPartitionGroupPeersContainHighestPid() { Set<Integer> peers = Sets.newHashSet(); int hPid = getPartitionCount() -1; Collection<Integer> hHostIds = getHostIdList(hPid); if (hHostIds == null) { return peers; } int hHostId = hHostIds.iterator().next(); assert hostsById.get(hHostId) != null; for (Partition p : hostsById.get(hHostId).partitions) { peers.addAll(p.hostIds); } return peers; }

Target:
public Set<Integer> getPartitionGroupPeersContainHighestPid() { int hPid = getPartitionCount() -1; Collection<Integer> hHostIds = getHostIdList(hPid); if (hHostIds == null || hHostIds.isEmpty()) { return Collections.emptySet(); } int hHostId = hHostIds.iterator().next(); return getPartitionGroupPeers(hHostId); }
Source:
BookKeeper() { conf = new ClientConfiguration(); internalConf = ClientInternalConf.defaultValues(); statsLogger = NullStatsLogger.INSTANCE; clientStats = BookKeeperClientStats.newInstance(statsLogger); scheduler = null; requestTimer = null; metadataDriver = null; placementPolicy = null; ownTimer = false; mainWorkerPool = null; ledgerManagerFactory = null; ledgerManager = null; ledgerIdGenerator = null; featureProvider = null; eventLoopGroup = null; bookieWatcher = null; bookieInfoScheduler = null; bookieClient = null; }

Target:
BookKeeper() { conf = new ClientConfiguration(); internalConf = ClientInternalConf.fromConfig(conf); statsLogger = NullStatsLogger.INSTANCE; clientStats = BookKeeperClientStats.newInstance(statsLogger); scheduler = null; requestTimer = null; metadataDriver = null; placementPolicy = null; ownTimer = false; mainWorkerPool = null; ledgerManagerFactory = null; ledgerManager = null; ledgerIdGenerator = null; featureProvider = null; eventLoopGroup = null; bookieWatcher = null; bookieInfoScheduler = null; bookieClient = null; }
Source:
public LinkPreviewContents(@NonNull Page page) { title = page.getTitle(); NodeList elements = getXmlChildren(page.getSections().get(0).getContent()); if (elements == null) { extract = ""; return; } String firstSection = ""; for (int i = 0; i < elements.getLength(); i++) { if (elements.item(i).getNodeName().equalsIgnoreCase("p")) { firstSection += elements.item(i).getTextContent() + " "; } } firstSection = Html.fromHtml(firstSection).toString(); firstSection = firstSection.replaceAll("\\[\\d+\\]", ""); extract = makeStringFromSentences(getSentences(removeParens(firstSection), title.getSite()), EXTRACT_MAX_SENTENCES); }

Target:
public LinkPreviewContents(@NonNull Page page) { title = page.getTitle(); PageExtract pageExtract = new PageExtract(page); extract = makeStringFromSentences(getSentences(removeParens(pageExtract.getText()), title.getSite()), EXTRACT_MAX_SENTENCES); }
Source:
protected void init(NodeMainExecutor nodeMainExecutor) { talker = new Talker(); String host = InetAddressFactory.newNonLoopback().getHostName(); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(host, getMasterUri()); nodeMainExecutor.execute(talker, nodeConfiguration); nodeMainExecutor.execute(rosTextView, nodeConfiguration); }

Target:
protected void init(NodeMainExecutor nodeMainExecutor) { talker = new Talker(); String host = InetAddressFactory.newNonLoopback().getHostAddress(); NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(host, getMasterUri()); nodeMainExecutor.execute(talker, nodeConfiguration); nodeMainExecutor.execute(rosTextView, nodeConfiguration); }
Source:
public NoteJobInfo(Note note) { boolean isNoteRunning = false; long lastRunningUnixTime = 0; this.noteId = note.getId(); this.noteName = note.getName(); if (note.getConfig().containsKey("cron") && !note.getConfig() .get("cron").equals("")) { this.noteType = "cron"; } else { this.noteType = "normal"; } this.interpreter = note.getDefaultInterpreterGroup(); this.paragraphs = new ArrayList<>(); for (Paragraph paragraph : note.getParagraphs()) { if (paragraph.getStatus().isRunning()) { isNoteRunning = true; } ParagraphJobInfo paragraphItem = new ParagraphJobInfo(paragraph); lastRunningUnixTime = getUnixTimeLastRunParagraph(paragraph); paragraphs.add(paragraphItem); } this.isRunningJob = isNoteRunning; this.unixTimeLastRun = lastRunningUnixTime; }

Target:
public NoteJobInfo(Note note) { boolean isNoteRunning = false; long lastRunningUnixTime = 0; this.noteId = note.getId(); this.noteName = note.getName(); if (isCron(note)) { this.noteType = "cron"; } else { this.noteType = "normal"; } this.interpreter = note.getDefaultInterpreterGroup(); this.paragraphs = new ArrayList<>(); for (Paragraph paragraph : note.getParagraphs()) { if (paragraph.getStatus().isRunning()) { isNoteRunning = true; } ParagraphJobInfo paragraphItem = new ParagraphJobInfo(paragraph); lastRunningUnixTime = getUnixTimeLastRunParagraph(paragraph); paragraphs.add(paragraphItem); } this.isRunningJob = isNoteRunning; this.unixTimeLastRun = lastRunningUnixTime; }
Source:
public void alertsWithoutJSessionidInOptions() throws HttpMalformedHeaderException, URIException { String testURI = "<LINK_0>;JSESSIONID=asdfasdfasdf1234?foo=bar"; HttpMessage msg = createHttpMessageWithRespBody(BODY); msg.getRequestHeader().setURI(new URI(testURI, false)); OptionsParam options = Model.getSingleton().getOptionsParam(); HttpSessionsParam sessionOptions = options.getParamSet(HttpSessionsParam.class); if (sessionOptions != null) { sessionOptions.setDefaultTokens(Collections.emptyList()); } else { sessionOptions = new HttpSessionsParam(); sessionOptions.setDefaultTokens(Collections.emptyList()); options.addParamSet(sessionOptions); } rule.scanHttpResponseReceive(msg, -1, new Source(BODY)); assertEquals(1, alertsRaised.size()); }

Target:
public void alertsWithoutJSessionidInOptions() throws HttpMalformedHeaderException, URIException { String testURI = "<LINK_0>;JSESSIONID=asdfasdfasdf1234?foo=bar"; HttpMessage msg = createHttpMessageWithRespBody(BODY); msg.getRequestHeader().setURI(new URI(testURI, false)); OptionsParam options = Model.getSingleton().getOptionsParam(); HttpSessionsParam sessionOptions = options.getParamSet(HttpSessionsParam.class); sessionOptions.setDefaultTokens(Collections.emptyList()); rule.scanHttpResponseReceive(msg, -1, new Source(BODY)); assertEquals(1, alertsRaised.size()); }
Source:
private String getZkConnectionInfo() { String zkConnectionInfo; if (_zkAddress == null) { if (_helixManagerProperty != null && _helixManagerProperty.getZkConnectionConfig() != null) { zkConnectionInfo = _helixManagerProperty.getZkConnectionConfig().toString(); } else { zkConnectionInfo = "ZkAddr and ZkConnectionConfig are null!"; } } else { zkConnectionInfo = _zkAddress; } return zkConnectionInfo; }

Target:
private String getZkConnectionInfo() { String zkConnectionInfo; if (_zkAddress == null) { if (_helixManagerProperty != null && _helixManagerProperty.getZkConnectionConfig() != null) { zkConnectionInfo = _helixManagerProperty.getZkConnectionConfig().toString(); } else { zkConnectionInfo = "None"; } } else { zkConnectionInfo = _zkAddress; } return zkConnectionInfo; }
Source:
private void adminUnitMove(PID sourcePid, ContentObject moveObj) { HashMap<String, String> destContainerInfo = getContainerInfo(destinationPid, 1); String destAdminUnit = destContainerInfo.get("adminUnit"); HashMap<String, String> currentContainerInfo = getContainerInfo(sourcePid, 2); String currentAdminUnit = currentContainerInfo.get("adminUnit"); if (currentAdminUnit != null && destAdminUnit != null && !currentAdminUnit.equals(destAdminUnit)) { moveObj.getPremisLog().buildEvent(Premis.MetadataModification) .addAuthorizingAgent(agent.getUsername()) .addEventDetail("Object moved from source {0} ({1}) in Admin Unit {2} ({3}) " + "to destination {4} ({5}) in Admin Unit {6} ({7})", currentContainerInfo.get("container"), currentContainerInfo.get("containerTitle"), currentAdminUnit, currentContainerInfo.get("adminUnitTitle"), destContainerInfo.get("container"), destContainerInfo.get("containerTitle"), destAdminUnit, destContainerInfo.get("adminUnitTitle")) .writeAndClose(); } }

Target:
private void adminUnitMove(PID sourcePid, ContentObject moveObj) { Map<String, String> destContainerInfo = getContainerInfo(destinationPid, 1); String destAdminUnit = destContainerInfo.get("adminUnit"); Map<String, String> currentContainerInfo = getContainerInfo(sourcePid, 2); String currentAdminUnit = currentContainerInfo.get("adminUnit"); if (currentAdminUnit != null && destAdminUnit != null && !currentAdminUnit.equals(destAdminUnit)) { moveObj.getPremisLog().buildEvent(Premis.MetadataModification) .addAuthorizingAgent(agent.getUsername()) .addEventDetail("Object moved from source {0} ({1}) in Admin Unit {2} ({3}) " + "to destination {4} ({5}) in Admin Unit {6} ({7})", currentContainerInfo.get("container"), currentContainerInfo.get("containerTitle"), currentAdminUnit, currentContainerInfo.get("adminUnitTitle"), destContainerInfo.get("container"), destContainerInfo.get("containerTitle"), destAdminUnit, destContainerInfo.get("adminUnitTitle")) .writeAndClose(); } }
Source:
private void initializePublisher() { mPublisher = (new Publisher.Builder(this)).build(); mPublisher.setPublisherListener(this); mPublisher.getRenderer().setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL); mPublisherViewContainer.addView(mPublisher.getView()); }

Target:
private void initializePublisher() { mPublisher = new Publisher.Builder(this).build(); mPublisher.setPublisherListener(this); mPublisher.getRenderer().setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL); mPublisherViewContainer.addView(mPublisher.getView()); }
Source:
private synchronized void generateNacksForPendingAcks(String cause) { for (Entry<Listener, SortedMap<Long, PendingConfirm>> entry : this.pendingConfirms.entrySet()) { Listener listener = entry.getKey(); Iterator<Entry<Long, PendingConfirm>> iterator = entry.getValue().entrySet().iterator(); while(iterator.hasNext()) { Entry<Long, PendingConfirm> confirmEntry = iterator.next(); confirmEntry.getValue().setCause(cause); if (logger.isDebugEnabled()) { logger.debug(this.toString() + " PC:Nack:(close):" + confirmEntry.getKey()); } processAck(confirmEntry.getKey(), false, false, false); iterator.remove(); } listener.revoke(this); } if (logger.isDebugEnabled()) { logger.debug("PendingConfirms cleared"); } this.pendingConfirms.clear(); this.listenerForSeq.clear(); this.listeners.clear(); }

Target:
private synchronized void generateNacksForPendingAcks(String cause) { for (Entry<Listener, SortedMap<Long, PendingConfirm>> entry : this.pendingConfirms.entrySet()) { Listener listener = entry.getKey(); for (Entry<Long, PendingConfirm> confirmEntry : entry.getValue().entrySet()) { confirmEntry.getValue().setCause(cause); if (logger.isDebugEnabled()) { logger.debug(this.toString() + " PC:Nack:(close):" + confirmEntry.getKey()); } processAck(confirmEntry.getKey(), false, false, false); } listener.revoke(this); } if (logger.isDebugEnabled()) { logger.debug("PendingConfirms cleared"); } this.pendingConfirms.clear(); this.listenerForSeq.clear(); this.listeners.clear(); }
Source:
public void visitNode(Tree tree) { MethodTree methodTree = (MethodTree) tree; if(methodTree.block() == null) { return; } CFG cfg = CFG.build(methodTree); LiveVariables liveVariables = LiveVariables.analyze(cfg); for (CFG.Block block : cfg.blocks()) { Set<Symbol> out = new HashSet<>(liveVariables.getOut(block)); Set<Tree> assignmentLHS = new HashSet<>(); for (Tree element : Lists.reverse(block.elements())) { Symbol symbol; switch (element.kind()) { case ASSIGNMENT: ExpressionTree lhs = ((AssignmentExpressionTree) element).variable(); if (lhs.is(Tree.Kind.IDENTIFIER)) { symbol = ((IdentifierTree) lhs).symbol(); if (isLocalVariable(symbol) && !out.contains(symbol)) { addIssue(element, "Remove this useless assignment to local variable \"" + symbol.name() + "\"."); } assignmentLHS.add(lhs); out.remove(symbol); } break; case IDENTIFIER: if (!assignmentLHS.contains(element)) { symbol = ((IdentifierTree) element).symbol(); if (isLocalVariable(symbol)) { out.add(symbol); } } break; case VARIABLE: VariableTree localVar = (VariableTree) element; symbol = localVar.symbol(); if(localVar.initializer() != null && !out.contains(symbol)) { addIssue(element, "Remove this useless assignment to local variable \"" + symbol.name() + "\"."); } out.remove(symbol); } } } }

Target:
public void visitNode(Tree tree) { MethodTree methodTree = (MethodTree) tree; if (methodTree.block() == null) { return; } if (hasTryFinallyWithLocalVar(methodTree.block(), methodTree.symbol())) { return; } Symbol.MethodSymbol methodSymbol = methodTree.symbol(); CFG cfg = CFG.build(methodTree); LiveVariables liveVariables = LiveVariables.analyze(cfg); for (CFG.Block block : cfg.blocks()) { checkElements(block, liveVariables.getOut(block), methodSymbol); } }
Source:
public static Collection<String> replaceWith(String propertyName, Collection<?> items, String separator, int maxNumberOfPrintedItems) { Validate.isTrue(maxNumberOfPrintedItems >= 1); Validate.isTrue(StringUtils.isNotEmpty(separator)); int maxNumOfItems = Math.min(maxNumberOfPrintedItems, items.size()); List<String> printedItems = new ArrayList<>(maxNumOfItems); String itemPrefix = (separator.equals(DEFAULT_SEPARATOR)) ? "\t" : " "; for (Object item : items) { if (--maxNumOfItems < 0) { break; } printedItems.add(String.format("%s%s", itemPrefix, String.valueOf(item))); } if (items.size() > maxNumberOfPrintedItems) { printedItems.add(String.format("%s...", itemPrefix)); } ArrayList<String> replacements = new ArrayList<>(); replacements.add(createSetVariableString(propertyName, StringUtils.join(printedItems, separator))); replacements.add(createSetVariableString(propertyName + COUNTER_SUFFIX, items.size())); return replacements; }

Target:
public static Collection<String> replaceWith(String propertyName, Collection<?> items, String separator, int maxNumberOfPrintedItems) { Validate.isTrue(maxNumberOfPrintedItems >= 1); Validate.isTrue(StringUtils.isNotEmpty(separator)); int maxNumOfItems = Math.min(maxNumberOfPrintedItems, items.size()); List<String> printedItems = new ArrayList<>(maxNumOfItems); String itemPrefix = separator.equals(DEFAULT_SEPARATOR) ? "\t" : " "; for (Object item : items) { if (--maxNumOfItems < 0) { break; } printedItems.add(String.format("%s%s", itemPrefix, String.valueOf(item))); } if (items.size() > maxNumberOfPrintedItems) { printedItems.add(String.format("%s...", itemPrefix)); } ArrayList<String> replacements = new ArrayList<>(); replacements.add(createSetVariableString(propertyName, StringUtils.join(printedItems, separator))); replacements.add(createSetVariableString(propertyName + COUNTER_SUFFIX, items.size())); return replacements; }
Source:
public void onExternalViewChange(List<ExternalView> externalViewList, NotificationContext changeContext) { HelixConstants.ChangeType changeType = changeContext.getChangeType(); if (changeType != null && !_sourceDataTypeMap.containsKey(changeType.getPropertyType())) { logger.warn( "onExternalViewChange called with mismatched change types. Source data types does not contain changed data type: {}", changeType); return; } if (externalViewList != null && externalViewList.size() > 0) { String keyReference = PropertyType.EXTERNALVIEW.name() + "_" + DEFAULT_TYPE; refresh(externalViewList, Collections.emptyList(), changeContext, keyReference); } else { ClusterEventType eventType; if (_sourceDataTypeMap.containsKey(PropertyType.EXTERNALVIEW)) { eventType = ClusterEventType.ExternalViewChange; } else if (_sourceDataTypeMap.containsKey(PropertyType.TARGETEXTERNALVIEW)) { eventType = ClusterEventType.TargetExternalViewChange; } else { logger.warn( "onExternalViewChange called with mismatched change types. Source data types does not contain changed data type: {}", changeType); return; } _routerUpdater.queueEvent(changeContext, eventType, changeType); } }

Target:
public void onExternalViewChange(List<ExternalView> externalViewList, NotificationContext changeContext) { HelixConstants.ChangeType changeType = changeContext.getChangeType(); if (changeType != null && !_sourceDataTypeMap.containsKey(changeType.getPropertyType())) { logger.warn( "onExternalViewChange called with mismatched change types. Source data types does not contain changed data type: {}", changeType); return; } if (externalViewList != null && externalViewList.size() > 0) { String keyReference = generateReferenceKey(PropertyType.EXTERNALVIEW.name(), DEFAULT_STATE_TYPE); HelixDataAccessor accessor = changeContext.getManager().getHelixDataAccessor(); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); List<InstanceConfig> configList = accessor.getChildValues(keyBuilder.instanceConfigs()); List<LiveInstance> liveInstances = accessor.getChildValues(keyBuilder.liveInstances()); refreshExternalView(externalViewList, configList, liveInstances, keyReference); } else { ClusterEventType eventType; if (_sourceDataTypeMap.containsKey(PropertyType.EXTERNALVIEW)) { eventType = ClusterEventType.ExternalViewChange; } else if (_sourceDataTypeMap.containsKey(PropertyType.TARGETEXTERNALVIEW)) { eventType = ClusterEventType.TargetExternalViewChange; } else { logger.warn( "onExternalViewChange called with mismatched change types. Source data types does not contain changed data type: {}", changeType); return; } _routerUpdater.queueEvent(changeContext, eventType, changeType); } }
Source:
public static Slice stMultiPoint(@SqlType("array(" + GEOMETRY_TYPE_NAME + ")") Block input) { MultiPoint multipoint = new MultiPoint(); for (int i = 0; i < input.getPositionCount(); i++) { if (input.isNull(i)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: null at index %s", i + 1)); } Slice slice = GEOMETRY.getSlice(input, i); OGCGeometry geometry = deserialize(slice); if (!(geometry instanceof OGCPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: geometry is not a point: %s at index %s", geometry.geometryType(), i + 1)); } OGCPoint point = (OGCPoint) geometry; if (point.isEmpty()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: empty point at index %s", i + 1)); } multipoint.add(point.X(), point.Y()); } if (multipoint.getPointCount() < 1) { return null; } return serialize(createFromEsriGeometry(multipoint, null, true)); }

Target:
public static Slice stMultiPoint(@SqlType("array(" + GEOMETRY_TYPE_NAME + ")") Block input) { MultiPoint multipoint = new MultiPoint(); for (int i = 0; i < input.getPositionCount(); i++) { if (input.isNull(i)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: null at index %s", i + 1)); } Slice slice = GEOMETRY.getSlice(input, i); OGCGeometry geometry = deserialize(slice); if (!(geometry instanceof OGCPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: geometry is not a point: %s at index %s", geometry.geometryType(), i + 1)); } OGCPoint point = (OGCPoint) geometry; if (point.isEmpty()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: empty point at index %s", i + 1)); } multipoint.add(point.X(), point.Y()); } if (multipoint.getPointCount() == 0) { return null; } return serialize(createFromEsriGeometry(multipoint, null, true)); }