auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void annotate(PsiElement element, AnnotationHolder holder) { PsiFile file = element.getContainingFile(); Long analyzedFileTime = file.getUserData(HaxeSemanticError.KEY_ANALYZED_METHOD_TIME); if (analyzedFileTime == null || analyzedFileTime != file.getModificationStamp()) { analyze(file); file.putUserData(HaxeSemanticError.KEY_ANALYZED_METHOD_TIME, file.getModificationStamp()); } List<HaxeSemanticError> errors = element.getUserData(HaxeSemanticError.KEY_HAXE_ERROR); if (errors != null) { for (HaxeSemanticError error : errors) { Annotation annotation = holder.createErrorAnnotation(element, error.message); if (error.quickfix != null) annotation.registerFix(error.quickfix); } } }

Target:
public void annotate(PsiElement element, AnnotationHolder holder) { analyzeSingle(element, holder); }
Source:
public void run(IAction action) { IReviewItem item = compareSourceViewer.getAnnotationModel().getItem(); ReviewBehavior reviewBehavior = compareSourceViewer.getAnnotationModel().getBehavior(); if (item.getReview() != null && item.getReview().getRepository() != null && item.getReview().getRepository().getAccount() != null) { AddCommentDialog dialog = new AddCommentDialog(WorkbenchUtil.getShell(), reviewBehavior, item, getLocation()); dialog.open(); } else { MessageDialog.openError(WorkbenchUtil.getShell(), "Can't Add Comments", "Anonymous users cannot comment on a review. Please log in to perform this action."); } }

Target:
public void run(IAction action) { IReviewItem item = getItem(); ReviewBehavior reviewBehavior = compareSourceViewer.getAnnotationModel().getBehavior(); AddCommentDialog dialog = new AddCommentDialog(WorkbenchUtil.getShell(), reviewBehavior, item, getLocation()); dialog.open(); }
Source:
private boolean setOwningPlayerInternal(OfflinePlayer owningPlayer) { if (owningPlayer instanceof GlowOfflinePlayer) { GlowOfflinePlayer impl = (GlowOfflinePlayer) owningPlayer; this.owner.set(impl.getProfile()); return true; } else { CompletableFuture<PlayerProfile> profileFuture = PlayerProfile .getProfile(owningPlayer.getName()); PlayerProfile profile = profileFuture.getNow(null); if (profile != null) { this.owner.set(profile); return true; } else { profileFuture.thenAcceptAsync(this.owner::set); return false; } } }

Target:
private boolean setOwningPlayerInternal(OfflinePlayer owningPlayer) { if (owningPlayer instanceof GlowOfflinePlayer) { GlowOfflinePlayer impl = (GlowOfflinePlayer) owningPlayer; this.owner.set(impl.getProfile()); return true; } else if (owningPlayer instanceof GlowPlayer) { this.owner.set(((GlowPlayer) owningPlayer).getProfile()); return true; } else { CompletableFuture<PlayerProfile> profileFuture = PlayerProfile .getProfile(owningPlayer.getName()); PlayerProfile profile = profileFuture.getNow(null); if (profile != null) { this.owner.set(profile); return true; } else { profileFuture.thenAcceptAsync(this.owner::set); return false; } } }
Source:
private List<String> createSocketBindings() throws CommandFailedException, IOException { final List<String> socketBindingNames = new LinkedList<>(); for (int i = 0; i < count; i++) { String name = generateName(); Address remoteSocketBindingAddress = this.socketBindingGroupAddress.and("remote-destination-outbound-socket-binding", name); operations.add(remoteSocketBindingAddress, Values.of("host", "el-policy-host_" + RandomStringUtils.randomAlphanumeric(5)) .and("port", AvailablePortFinder.getNextAvailableNonPrivilegedPort())).assertSuccess(); socketBindingNames.add(name); } return socketBindingNames; }

Target:
private List<String> createSocketBindings() throws IOException { final List<String> socketBindingNames = new LinkedList<>(); for (int i = 0; i < count; i++) { String name = generateName(); Address remoteSocketBindingAddress = this.socketBindingGroupAddress.and(SOCKET_BINDING_TYPE, name); operations.add(remoteSocketBindingAddress, Values.of("host", "el-policy-host_" + RandomStringUtils.randomAlphanumeric(5)) .and("port", AvailablePortFinder.getNextAvailableNonPrivilegedPort())).assertSuccess(); socketBindingNames.add(name); } return socketBindingNames; }
Source:
public static Query readAll(Class<? extends Message> entityClass, String... paths) { final FieldMask fieldMask = paths != null ? FieldMask.newBuilder() .addAllPaths(Arrays.asList(paths)) .build() : null; final Query result = composeQuery(entityClass, null, fieldMask); return result; }

Target:
public static Query readAll(Class<? extends Message> entityClass, String... paths) { final FieldMask fieldMask = FieldMask.newBuilder() .addAllPaths(Arrays.asList(paths)) .build(); final Query result = composeQuery(entityClass, null, fieldMask); return result; }
Source:
private void checkVideoStatus(VideoBlockModel unit) { final DownloadEntry entry = unit.getDownloadEntry(environment.getStorage()); if (entry == null) return; if (entry.isDownload()) { if (entry.isVideoForWebOnly) { Toast.makeText(getActivity(), getString(R.string.video_only_on_web_short), Toast.LENGTH_SHORT).show(); return; } if (!entry.isDownloaded()) { IDialogCallback dialogCallback = new IDialogCallback() { @Override public void onPositiveClicked() { startOnlinePlay(entry); } @Override public void onNegativeClicked() { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); notifyAdapter(); } }; MediaConsentUtils.consentToMediaPlayback(getActivity(), dialogCallback, environment.getConfig()); } else { if (playerFragment != null && !playerFragment.isFrozen()) { startOnlinePlay(entry); } } } }

Target:
private void checkVideoStatus(VideoBlockModel unit) { final DownloadEntry entry = unit.getDownloadEntry(environment.getStorage()); if (entry == null) return; if (entry.isDownload()) { if (entry.isVideoForWebOnly) { Toast.makeText(getActivity(), getString(R.string.video_only_on_web_short), Toast.LENGTH_SHORT).show(); return; } if (!entry.isDownloaded()) { IDialogCallback dialogCallback = new IDialogCallback() { @Override public void onPositiveClicked() { startOnlinePlay(entry); } @Override public void onNegativeClicked() { ((BaseFragmentActivity) getActivity()). showInfoMessage(getString(R.string.wifi_off_message)); notifyAdapter(); } }; MediaConsentUtils.consentToMediaPlayback(getActivity(), dialogCallback, environment.getConfig()); } else if (playerFragment != null && !playerFragment.isFrozen()) { startOnlinePlay(entry); } } }
Source:
public Optional<Float> calculateAverageSensorState(final List<Sample> samples, final long startTimestampUTC, final long endTimestampUTC) { if (samples.isEmpty() || (startTimestampUTC == endTimestampUTC)) { return Optional.absent(); } float sum = 0; int count = 0; for (final Sample sample : samples) { final long sampleTimestampUTC = sample.dateTime; if (sampleTimestampUTC < startTimestampUTC) { continue; } if (sampleTimestampUTC > endTimestampUTC) { break; } sum += sample.value; count++; } final float average = sum / count; return Optional.of(average); }

Target:
public Optional<Float> calculateAverageSensorState(final List<Sample> samples, final long startTimestampUTC, final long endTimestampUTC) { if (samples.isEmpty() || (startTimestampUTC == endTimestampUTC)) { return Optional.absent(); } float sum = 0; int count = 0; for (final Sample sample : samples) { final long sampleTimestampUTC = sample.dateTime; if (sampleTimestampUTC < startTimestampUTC) { continue; } if (sampleTimestampUTC > endTimestampUTC) { break; } sum += sample.value; count++; } if (count > 0) { final float average = sum / count; return Optional.of(average); } else { return Optional.absent(); } }
Source:
static boolean mongoInsertLectureIntoCourse(final DB dbs, final String courseId, final String lectureId) throws AuthenticationException, DatabaseAccessException { final DBCollection collection = dbs.getCollection(getCollectionFromType(School.ItemType.COURSE)); final DBObject cursor = collection.findOne(convertStringToObjectId(courseId)); DBObject updateObj = null; final DBCollection courses = dbs.getCollection(getCollectionFromType(School.ItemType.COURSE)); updateObj = new BasicDBObject(LECTURE_LIST, lectureId); courses.update(cursor, new BasicDBObject(ADD_SET_COMMAND, updateObj)); UserUpdateHandler.insertUpdates(dbs, ((List) cursor.get(USERS)), courseId, UserUpdateHandler.COURSE_CLASSIFICATION); return true; }

Target:
static boolean mongoInsertLectureIntoCourse(final DB dbs, final String courseId, final String lectureId) throws AuthenticationException, DatabaseAccessException { final DBCollection courseCollection = dbs.getCollection(getCollectionFromType(School.ItemType.COURSE)); final DBObject cursor = courseCollection.findOne(convertStringToObjectId(courseId)); DBObject updateObj = null; updateObj = new BasicDBObject(LECTURE_LIST, lectureId); courseCollection.update(cursor, new BasicDBObject(ADD_SET_COMMAND, updateObj)); UserUpdateHandler.insertUpdates(dbs, ((List) cursor.get(USERS)), courseId, UserUpdateHandler.COURSE_CLASSIFICATION); return true; }
Source:
private static Cell parseCell(List<RiakTsPB.TsColumnDescription> columnDescriptions, int j, OtpErlangObject cell) throws InvalidTermToBinaryException { if (cell instanceof OtpErlangBinary) { final OtpErlangBinary v = (OtpErlangBinary) cell; if (columnDescriptions.get(j).getType() == RiakTsPB.TsColumnType.VARCHAR) { final String s = new String(v.binaryValue(), StandardCharsets.UTF_8); return new Cell(s); } else if (columnDescriptions.get(j).getType() == RiakTsPB.TsColumnType.BLOB) { return new Cell(v.binaryValue()); } } else if (cell instanceof OtpErlangLong) { final OtpErlangLong v = (OtpErlangLong) cell; if (columnDescriptions.get(j).getType() == RiakTsPB.TsColumnType.TIMESTAMP) { return Cell.newTimestamp(v.longValue()); } else if (columnDescriptions.get(j).getType() == RiakTsPB.TsColumnType.SINT64) { return new Cell(v.longValue()); } } else if (cell instanceof OtpErlangDouble) { final OtpErlangDouble v = (OtpErlangDouble) cell; return new Cell(v.doubleValue()); } else if (cell instanceof OtpErlangAtom) { final OtpErlangAtom v = (OtpErlangAtom) cell; return new Cell(v.booleanValue()); } else if (cell instanceof OtpErlangList) { final OtpErlangList l = (OtpErlangList) cell; assert (l.arity() == 0); return null; } throw new InvalidTermToBinaryException("Unknown cell type encountered: " + cell.toString() + ", unable to continue parsing."); }

Target:
private static Cell parseCell(List<RiakTsPB.TsColumnDescription> columnDescriptions, int j, OtpErlangObject cell) throws InvalidTermToBinaryException { if (cell instanceof OtpErlangBinary) { final OtpErlangBinary v = (OtpErlangBinary) cell; final RiakTsPB.TsColumnType type = columnDescriptions.get(j).getType(); switch (type) { case VARCHAR: final String s = new String(v.binaryValue(), StandardCharsets.UTF_8); return new Cell(s); case BLOB: return new Cell(v.binaryValue()); default: throw new IllegalStateException( String.format( "Type '%s' from the provided ColumnDescription contradicts to the actual OtpErlangBinary value", type.name() ) ); } } else if (cell instanceof OtpErlangLong) { final OtpErlangLong v = (OtpErlangLong) cell; final RiakTsPB.TsColumnType type = columnDescriptions.get(j).getType(); switch (type) { case TIMESTAMP: return Cell.newTimestamp(v.longValue()); case SINT64: return new Cell(v.longValue()); default: throw new IllegalStateException( String.format( "Type '%s' from the provided ColumnDescription contradicts to the actual OtpErlangLong value", type.name() ) ); } } else if (cell instanceof OtpErlangDouble) { final OtpErlangDouble v = (OtpErlangDouble) cell; return new Cell(v.doubleValue()); } else if (cell instanceof OtpErlangAtom) { final OtpErlangAtom v = (OtpErlangAtom) cell; return new Cell(v.booleanValue()); } else if (cell instanceof OtpErlangList) { final OtpErlangList l = (OtpErlangList) cell; assert (l.arity() == 0); return null; } throw new InvalidTermToBinaryException("Unknown cell type encountered: " + cell.toString() + ", unable to continue parsing."); }
Source:
public GrpcBackedQueryUpdateMessage(QueryUpdate queryUpdate, Serializer serializer) { this.queryUpdate = queryUpdate; this.serializedPayload = new LazyDeserializingObject<>(new GrpcSerializedObject(queryUpdate.getPayload()), serializer); this.metaDataSupplier = new GrpcMetaData(queryUpdate.getMetaDataMap(), serializer); }

Target:
public GrpcBackedQueryUpdateMessage(QueryUpdate queryUpdate, Serializer serializer) { this( queryUpdate, new LazyDeserializingObject<>(new GrpcSerializedObject(queryUpdate.getPayload()), serializer), new GrpcMetaData(queryUpdate.getMetaDataMap(), serializer) ); }
Source:
public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression, Date startAt, Date endBy) { JobDetail job = createJobWithBasicMapValues(instance, methodName, inputTypes, inputParams); try { String triggerName = generateUniqueNameForInstance(instance, TRIGGER_PREFIX); Trigger trigger = newTrigger() .withIdentity(triggerName, Scheduler.DEFAULT_GROUP) .withSchedule(cronSchedule(cronExpression)) .startAt(startAt) .endAt(endBy) .build(); sched.scheduleJob(job, trigger); } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); } return job.getKey().getName(); }

Target:
public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression, Date startAt, Date endBy) { JobDetail job = createJobWithBasicMapValues(instance, methodName, inputTypes, inputParams); try { String triggerName = generateUniqueNameForInstance(instance, TRIGGER_PREFIX); Trigger trigger = newTrigger() .withIdentity(triggerName, Scheduler.DEFAULT_GROUP) .withSchedule(cronSchedule(cronExpression)) .startAt(startAt) .endAt(endBy) .build(); sched.scheduleJob(job, trigger); } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); return null; } return job.getKey().getName(); }
Source:
private void checkConstraints(Element annotatedElement, List<AnnotationMirror> mirrors) { for ( AnnotationMirror oneAnnotationMirror : mirrors ) { try { ConstraintChecks constraintChecks = constraintCheckFactory.getConstraintChecks( annotatedElement, oneAnnotationMirror ); Set<ConstraintCheckIssue> errors = constraintChecks.execute( annotatedElement, oneAnnotationMirror ); Map<Class, Set<ConstraintCheckIssue>> issues = errors.stream().collect( Collectors.groupingBy( issue -> issue.getClass(), Collectors.toSet() ) ); messager.reportErrors( issues.getOrDefault( ConstraintCheckError.class, Collections.emptySet() ) ); messager.reportWarnings( issues.getOrDefault( ConstraintCheckWarning.class, Collections.emptySet() ) ); } catch (Exception e) { if ( verbose ) { messager.getDelegate() .printMessage( Kind.NOTE, e.getMessage() != null ? e.getMessage() : e.toString(), annotatedElement, oneAnnotationMirror ); } } } }

Target:
private void checkConstraints(Element annotatedElement, List<AnnotationMirror> mirrors) { for ( AnnotationMirror oneAnnotationMirror : mirrors ) { try { ConstraintChecks constraintChecks = constraintCheckFactory.getConstraintChecks( annotatedElement, oneAnnotationMirror ); Set<ConstraintCheckIssue> allIssues = constraintChecks.execute( annotatedElement, oneAnnotationMirror ); Set<ConstraintCheckIssue> warnings = CollectionHelper.newHashSet(); Set<ConstraintCheckIssue> errors = CollectionHelper.newHashSet(); for ( ConstraintCheckIssue issue : allIssues ) { if ( issue.isError() ) { errors.add( issue ); } else if ( issue.isWarning() ) { warnings.add( issue ); } } messager.reportErrors( errors ); messager.reportWarnings( warnings ); } catch (Exception e) { if ( verbose ) { messager.getDelegate() .printMessage( Kind.NOTE, e.getMessage() != null ? e.getMessage() : e.toString(), annotatedElement, oneAnnotationMirror ); } } } }
Source:
public static void beforeClass() throws Exception { locatorProperties = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); locator = cluster.startLocatorVM(0, locatorProperties); Properties props = new Properties(); props.setProperty("statistic-archive-file", "stats1.gfs"); server1 = cluster.startRedisVM(1, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats2.gfs"); server2 = cluster.startRedisVM(2, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats3.gfs"); server3 = cluster.startRedisVM(3, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats4.gfs"); server4 = cluster.startRedisVM(4, props, locator.getPort()); props.setProperty("statistic-archive-file", "stats5.gfs"); server5 = cluster.startServerVM(5, props, locator.getPort()); redisServerPort1 = cluster.getRedisPort(1); redisServerPort2 = cluster.getRedisPort(2); redisServerPort3 = cluster.getRedisPort(3); redisServerPort4 = cluster.getRedisPort(4); subscriber1 = new Jedis(LOCAL_HOST, redisServerPort1, 120000); subscriber2 = new Jedis(LOCAL_HOST, redisServerPort2, 120000); publisher1 = new Jedis(LOCAL_HOST, redisServerPort3, 120000); publisher2 = new Jedis(LOCAL_HOST, redisServerPort4, 120000); gfsh.connectAndVerify(locator); }

Target:
public static void beforeClass() throws Exception { locatorProperties = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); locator = cluster.startLocatorVM(0, locatorProperties); server1 = cluster.startRedisVM(1, locator.getPort()); server2 = cluster.startRedisVM(2, locator.getPort()); server3 = cluster.startRedisVM(3, locator.getPort()); server4 = cluster.startRedisVM(4, locator.getPort()); server5 = cluster.startServerVM(5, locator.getPort()); for (VM v : Host.getHost(0).getAllVMs()) { v.invoke(() -> { Logger logger = LogService.getLogger("org.apache.geode.redis"); Configurator.setAllLevels(logger.getName(), Level.getLevel("DEBUG")); FastLogger.setDelegating(true); }); } redisServerPort1 = cluster.getRedisPort(1); redisServerPort2 = cluster.getRedisPort(2); redisServerPort3 = cluster.getRedisPort(3); redisServerPort4 = cluster.getRedisPort(4); subscriber1 = new Jedis(LOCAL_HOST, redisServerPort1, 120000); subscriber2 = new Jedis(LOCAL_HOST, redisServerPort2, 120000); publisher1 = new Jedis(LOCAL_HOST, redisServerPort3, 120000); publisher2 = new Jedis(LOCAL_HOST, redisServerPort4, 120000); gfsh.connectAndVerify(locator); }
Source:
public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager manager) { bbd.addAnnotatedType(manager.createAnnotatedType(TracerProducer.class), TracerProducer.class.toString()); bbd.addAnnotatedType(manager.createAnnotatedType(SmallRyeTracingCDIInterceptor.class), SmallRyeTracingCDIInterceptor.class.toString()); }

Target:
public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager manager) { String extensionName = TracingCDIExtension.class.getName(); bbd.addAnnotatedType(manager.createAnnotatedType(TracerProducer.class), extensionName + "-" + TracerProducer.class.getName()); bbd.addAnnotatedType(manager.createAnnotatedType(SmallRyeTracingCDIInterceptor.class), extensionName + "-" + SmallRyeTracingCDIInterceptor.class.getName()); }
Source:
protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<ItemInfo> iterator = failedToCreate.iterator(); while (iterator.hasNext()) { ItemInfo itemInfo = iterator.next(); Item item = itemFactory.createItem(itemInfo.itemType, itemInfo.itemName); if (item != null) { iterator.remove(); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factotry '{}' still could not instantiate item '{}'.", itemFactory, itemInfo.itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading all items that could not have been created before."); } } }

Target:
protected void addItemFactory(ItemFactory itemFactory) { itemFactories.add(itemFactory); if (failedToCreate.size() > 0) { Iterator<ItemInfo> iterator = failedToCreate.iterator(); while (iterator.hasNext()) { ItemInfo itemInfo = iterator.next(); Item item = itemFactory.createItem(itemInfo.itemType, itemInfo.itemName); if (item != null) { iterator.remove(); notifyListenersAboutAddedElement(item); } else { logger.debug("The added item factory '{}' still could not instantiate item '{}'.", itemFactory, itemInfo.itemName); } } if (failedToCreate.isEmpty()) { logger.info("Finished loading the items which could not have been created before."); } } }
Source:
public void removeWorkspaceChatRoom(WorkspaceEntity workspaceEntity) { String openfireToken = pluginSettingsController.getPluginSetting("chat", "openfireToken"); if (openfireToken == null) { logger.log(Level.INFO, "No openfire token set, skipping room sync"); return; } String openfireUrl = pluginSettingsController.getPluginSetting("chat", "openfireUrl"); if (openfireUrl == null) { logger.log(Level.INFO, "No openfire url set, skipping room sync"); return; } String openfirePort = pluginSettingsController.getPluginSetting("chat", "openfirePort"); if (openfirePort == null) { logger.log(Level.INFO, "No openfire port set, skipping room sync"); return; } if (!StringUtils.isNumeric(openfirePort)) { logger.log(Level.WARNING, "Invalid openfire port, skipping room sync"); return; } AuthenticationToken token = new AuthenticationToken(openfireToken); RestApiClient client = new RestApiClient(openfireUrl, Integer.parseInt(openfirePort, 10), token); Workspace workspace = workspaceController.findWorkspace(workspaceEntity); String roomName = workspace.getIdentifier(); client.deleteChatRoom(roomName); }

Target:
public void removeWorkspaceChatRoom(WorkspaceEntity workspaceEntity) { String openfireToken = pluginSettingsController.getPluginSetting("chat", "openfireToken"); if (openfireToken == null) { logger.log(Level.INFO, "No openfire token set, skipping room sync"); return; } String openfireUrl = pluginSettingsController.getPluginSetting("chat", "openfireUrl"); if (openfireUrl == null) { logger.log(Level.INFO, "No openfire url set, skipping room sync"); return; } String openfirePort = pluginSettingsController.getPluginSetting("chat", "openfirePort"); if (openfirePort == null) { logger.log(Level.INFO, "No openfire port set, skipping room sync"); return; } if (!StringUtils.isNumeric(openfirePort)) { logger.log(Level.WARNING, "Invalid openfire port, skipping room sync"); return; } AuthenticationToken token = new AuthenticationToken(openfireToken); RestApiClient client = new RestApiClient(openfireUrl, Integer.parseInt(openfirePort, 10), token); client.deleteChatRoom(workspaceEntity.getIdentifier()); }
Source:
public boolean categoryMembersContainerIsVisible() { wait.forElementVisible(categoryMembersContainer); PageObjectLogging.logInfo("Category sections container is visible."); return true; }

Target:
public boolean categoryMembersContainerIsVisible() { wait.forElementVisible(categoryMembersContainer); PageObjectLogging.logInfo("Category members container is visible."); return true; }
Source:
private CompletableFuture<byte[]> generateThumbnail(NetworkAccess network, AsyncReader fileData, int fileSize, String filename) { CompletableFuture<byte[]> fut = new CompletableFuture<>(); if (fileSize > MimeTypes.HEADER_BYTES_TO_IDENTIFY_MIME_TYPE) { getFileType(fileData).thenAccept(type -> { if (type == FileType.Image) { if (network.isJavascript()) { thumbnail.generateThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateThumbnail(bytes)); }); } }else if(type == FileType.Video) { if (network.isJavascript()) { thumbnail.generateVideoThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateVideoThumbnail(bytes)); }); } } else { fut.complete(new byte[0]); } }); } else { fut.complete(new byte[0]); } return fut; }

Target:
private CompletableFuture<byte[]> generateThumbnail(NetworkAccess network, AsyncReader fileData, int fileSize, String filename) { CompletableFuture<byte[]> fut = new CompletableFuture<>(); if (fileSize > MimeTypes.HEADER_BYTES_TO_IDENTIFY_MIME_TYPE) { getFileType(fileData).thenAccept(mimeType -> { if (mimeType.startsWith("image")) { if (network.isJavascript()) { thumbnail.generateThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateThumbnail(bytes)); }); } }else if(mimeType.startsWith("video")) { if (network.isJavascript()) { thumbnail.generateVideoThumbnail(fileData, fileSize, filename).thenAccept(base64Str -> { byte[] bytesOfData = Base64.getDecoder().decode(base64Str); fut.complete(bytesOfData); }); } else { byte[] bytes = new byte[fileSize]; fileData.readIntoArray(bytes, 0, fileSize).thenAccept(data -> { fut.complete(generateVideoThumbnail(bytes)); }); } } else { fut.complete(new byte[0]); } }); } else { fut.complete(new byte[0]); } return fut; }
Source:
public VolumeListModel() { setTitle(ConstantsManager.getInstance().getConstants().volumesTitle()); setDefaultSearchString("Volumes:"); setSearchString(getDefaultSearchString()); setSearchObjects(new String[] { SearchObjects.GLUSTER_VOLUME_OBJ_NAME, SearchObjects.GLUSTER_VOLUME_PLU_OBJ_NAME }); setAvailableInModes(ApplicationMode.GlusterOnly); setCreateVolumeCommand(new UICommand("Create Volume", this)); setRemoveVolumeCommand(new UICommand("Remove", this)); setStartCommand(new UICommand("Start", this)); setStopCommand(new UICommand("Stop", this)); setStartRebalanceCommand(new UICommand("Rebalance", this)); setOptimizeForVirtStoreCommand(new UICommand("OptimizeForVirtStore", this)); getStartRebalanceCommand().setIsAvailable(true); getRemoveVolumeCommand().setIsExecutionAllowed(false); getStartCommand().setIsExecutionAllowed(false); getStopCommand().setIsExecutionAllowed(false); getStartRebalanceCommand().setIsExecutionAllowed(false); getSearchNextPageCommand().setIsAvailable(true); getSearchPreviousPageCommand().setIsAvailable(true); }

Target:
public VolumeListModel() { setTitle(ConstantsManager.getInstance().getConstants().volumesTitle()); setDefaultSearchString("Volumes:"); setSearchString(getDefaultSearchString()); setSearchObjects(new String[] { SearchObjects.GLUSTER_VOLUME_OBJ_NAME, SearchObjects.GLUSTER_VOLUME_PLU_OBJ_NAME }); setAvailableInModes(ApplicationMode.GlusterOnly); setCreateVolumeCommand(new UICommand("Create Volume", this)); setRemoveVolumeCommand(new UICommand("Remove", this)); setStartCommand(new UICommand("Start", this)); setStopCommand(new UICommand("Stop", this)); setStartRebalanceCommand(new UICommand("startRebalance", this)); setOptimizeForVirtStoreCommand(new UICommand("OptimizeForVirtStore", this)); getStartRebalanceCommand().setIsAvailable(true); getRemoveVolumeCommand().setIsExecutionAllowed(false); getStartCommand().setIsExecutionAllowed(false); getStopCommand().setIsExecutionAllowed(false); getStartRebalanceCommand().setIsExecutionAllowed(false); getSearchNextPageCommand().setIsAvailable(true); getSearchPreviousPageCommand().setIsAvailable(true); }
Source:
private void pickedUp(Player player) { if (!pickedUp) { levelController.getScreenController().removeSprite(this); pickedUp = true; Logger.log("Picked up Powerup."); if (kind < 1) { for (int i = 0; i < AMOUNT_OF_POWERUPS; i++) { if (kind >= i * (kind / AMOUNT_OF_POWERUPS)) { player.activateSpeedPowerup(); } } } else { switch ((int) kind) { case 2: player.activateSpeedPowerup(); default: Logger.log("Unknown Powerup int, should use static int."); } } } }

Target:
private void pickedUp(Player player) { if (!pickedUp) { levelController.getScreenController().removeSprite(this); pickedUp = true; Logger.log("Picked up Powerup."); int k = (int) kind; if (kind < 1) { k = (int) Math.ceil(kind * AMOUNT_OF_POWERUPS); } switch (k) { case POWERUP_SPEED: player.activateSpeedPowerup(); break; default: Logger.log("Unknown Powerup int, should use static int."); } } }
Source:
public void verifyNameLength(String constructType, int maxLength, ParserRuleContext ctx) { if (SourceFileUtil.nameTooLong(ctx, maxLength)) { String lengthVersusLimit = " (" + ctx.getText().length() + "/" + maxLength + ")"; Location location = getContextStartLocation(ctx); this.printer.error(constructType + Messages.EXCEEDS_CHARACTER_LIMIT + lengthVersusLimit, location); } }

Target:
void verifyNameLength(String constructType, int maxLength, ParserRuleContext ctx) { if (SourceFileUtil.nameTooLong(ctx, maxLength)) { String lengthVersusLimit = " (" + ctx.getText().length() + "/" + maxLength + ")"; Location location = getContextStartLocation(ctx); this.printer.error(constructType + Messages.EXCEEDS_CHARACTER_LIMIT + lengthVersusLimit, location); } }
Source:
public void testRecordRetrievalMatchingId() { beforeEachTest(); Set<Long> set = Sets.newHashSet(); set.add(new Long(35)); Assert.assertEquals( set, client.find(Criteria.where() .key(Constants.JSON_RESERVED_IDENTIFIER_NAME) .operator(Operator.EQUALS).value(35).build())); }

Target:
public void testRecordRetrievalMatchingId() { Set<Long> set = Sets.newHashSet(); set.add(new Long(35)); Assert.assertEquals( set, client.find(Criteria.where() .key(Constants.JSON_RESERVED_IDENTIFIER_NAME) .operator(Operator.EQUALS).value(35).build())); }
Source:
public int fontSize() { if (fontSize < MIN_FONT) { return MIN_FONT; } else if (fontSize > MAX_FONT) { return MAX_FONT; } else { return fontSize; } }

Target:
public int fontSize() { return Utils.constrainIntToRange(fontSize, MIN_FONT, MAX_FONT); }
Source:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { boolean anyFailed = false; for (Guid childCmdId : childCmdIds) { switch (TaskManagerUtil.getCommandStatus(childCmdId)) { case ACTIVE: case ACTIVE_SYNC: case ACTIVE_ASYNC: case ACTIVE_ASYNC_EXECUTED: log.info("Waiting on Live Merge child commands to complete"); return; case FAILED: case FAILED_RESTARTED: case UNKNOWN: anyFailed = true; break; default: break; } } RemoveSnapshotCommand<RemoveSnapshotParameters> command = getCommand(cmdId); command.getParameters().setTaskGroupSuccess(!anyFailed); command.setCommandStatus(anyFailed ? CommandStatus.FAILED : CommandStatus.SUCCEEDED); log.infoFormat("All Live Merge child commands have completed, status {0}", command.getCommandStatus()); }

Target:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { boolean anyFailed = false; for (Guid childCmdId : childCmdIds) { switch (TaskManagerUtil.getCommandStatus(childCmdId)) { case ACTIVE: case ACTIVE_SYNC: case ACTIVE_ASYNC: log.info("Waiting on Live Merge child commands to complete"); return; case FAILED: case FAILED_RESTARTED: case UNKNOWN: anyFailed = true; break; default: break; } } RemoveSnapshotCommand<RemoveSnapshotParameters> command = getCommand(cmdId); command.getParameters().setTaskGroupSuccess(!anyFailed); command.setCommandStatus(anyFailed ? CommandStatus.FAILED : CommandStatus.SUCCEEDED); log.infoFormat("All Live Merge child commands have completed, status {0}", command.getCommandStatus()); }
Source:
public void init(String title, String width, String height, boolean closeIconVisible) { asWidget().setWidth(width); asWidget().setHeight(height); asWidget().setCloseIconButtonVisible(closeIconVisible); }

Target:
public void init(String title, String width, String height, boolean closeIconVisible) { dialogPanel.setTitle(title); asWidget().setWidth(width); asWidget().setHeight(height); asWidget().setCloseIconButtonVisible(closeIconVisible); }
Source:
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.time, container, false); final TimePicker picker = ButterKnife.findById(view, R.id.picker); picker.setCurrentHour(date.get(Calendar.HOUR_OF_DAY)); picker.setCurrentMinute(date.get(Calendar.MINUTE)); picker.setOnTimeChangedListener(new TimePickerListener()); picker.setIs24HourView(Settings.get24HourStyle()); return view; }

Target:
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.time, container, false); final TimePicker picker = ButterKnife.findById(view, R.id.picker); picker.setCurrentHour(date.get(Calendar.HOUR_OF_DAY)); picker.setCurrentMinute(date.get(Calendar.MINUTE)); picker.setOnTimeChangedListener(new TimePickerListener()); picker.setIs24HourView(DateFormat.is24HourFormat(getActivity())); return view; }
Source:
private BoBManager(XMPPConnection connection) { super(connection); }

Target:
private BoBManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection); serviceDiscoveryManager.addFeature(NAMESPACE); connection.registerIQRequestHandler( new AbstractIqRequestHandler(BoBIQ.ELEMENT, BoBIQ.NAMESPACE, Type.get, Mode.sync) { @Override public IQ handleIQRequest(IQ iqRequest) { BoBIQ getBoBIQ = (BoBIQ) iqRequest; BoBData bobData = bobSaverManager.getBoB(getBoBIQ.getBoBHash()); BoBIQ responseBoBIQ = null; try { responseBoBIQ = responseBoB(getBoBIQ, bobData); } catch (NotConnectedException | NotLoggedInException | InterruptedException e) { } return responseBoBIQ; } }); connection.registerIQRequestHandler( new AbstractIqRequestHandler(BoBIQ.ELEMENT, BoBIQ.NAMESPACE, Type.result, Mode.sync) { @Override public IQ handleIQRequest(IQ iqRequest) { BoBIQ resultBoBIQ = (BoBIQ) iqRequest; bobSaverManager.addBoB(resultBoBIQ.getBoBHash(), resultBoBIQ.getBoBData()); return null; } }); }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getActivity().getApplication()).component().inject(this); setHasOptionsMenu(true); }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) requireActivity().getApplication()).component().inject(this); setHasOptionsMenu(true); }
Source:
private boolean computeIsConstantExpression() { if (getConstructor() == null) { ICPPEvaluation conversionEval = maybeApplyConversion(fArguments[0], fInputType, false, false); if (!conversionEval.isConstantExpression()) return false; } return !fRepresentsNewExpression && areAllConstantExpressions(fArguments) && isNullOrConstexprFunc(getConstructor()); }

Target:
private boolean computeIsConstantExpression() { if (getConstructor() == null && fArguments.length == 1) { ICPPEvaluation conversionEval = maybeApplyConversion(fArguments[0], fInputType, false, false); if (!conversionEval.isConstantExpression()) return false; } return !fRepresentsNewExpression && areAllConstantExpressions(fArguments) && isNullOrConstexprFunc(getConstructor()); }
Source:
public void findInPage(String s) { textView.setFindListener((activeMatchOrdinal, numberOfMatches, textPosition, findingNext) -> { if (numberOfMatches > 0) { findInPageMatch.setText(textView.getContext().getString(R.string.find_in_page_result, activeMatchOrdinal + 1, numberOfMatches)); findInPageMatch.setTextColor(ResourceUtil.getThemedColor(textView.getContext(), R.attr.material_theme_de_emphasised_color)); setFindInPageChevronsEnabled(true); textView.setSelection(textPosition, textPosition + s.length()); Rect r = new Rect(); textView.getFocusedRect(r); final int scrollTopOffset = 32; scrollView.scrollTo(0, r.top - DimenUtil.roundedDpToPx(scrollTopOffset)); } else { findInPageMatch.setText("0/0"); findInPageMatch.setTextColor(ResourceUtil.getThemedColor(textView.getContext(), R.attr.colorError)); setFindInPageChevronsEnabled(false); } findInPageMatch.setVisibility(View.VISIBLE); }); textView.findInEditor(s, syntaxHighlighter); }

Target:
public void findInPage(String s) { textView.setFindListener((activeMatchOrdinal, numberOfMatches, textPosition, findingNext) -> { if (numberOfMatches > 0) { findInPageMatch.setText(textView.getContext().getString(R.string.find_in_page_result, activeMatchOrdinal + 1, numberOfMatches)); findInPageMatch.setTextColor(ResourceUtil.getThemedColor(textView.getContext(), R.attr.material_theme_de_emphasised_color)); setFindInPageChevronsEnabled(true); textView.setSelection(textPosition, textPosition + s.length()); Rect r = new Rect(); textView.getFocusedRect(r); final int scrollTopOffset = 32; scrollView.scrollTo(0, r.top - DimenUtil.roundedDpToPx(scrollTopOffset)); if (findingNext) { textView.requestFocus(); } } else { findInPageMatch.setText("0/0"); findInPageMatch.setTextColor(ResourceUtil.getThemedColor(textView.getContext(), R.attr.colorError)); setFindInPageChevronsEnabled(false); } findInPageMatch.setVisibility(View.VISIBLE); }); textView.findInEditor(s, syntaxHighlighter); }
Source:
public void should_save_a_project() throws Exception { DynamicProjectRepository repo = new DynamicProjectRepository(); GHRepository ghRepository = setupMockGHRepository(); DynamicProject project = repo.createNewProject(ghRepository); assert(repo.getDatastore().getCount(DynamicProject.class) > 0); assert(repo.getDatastore().createQuery(DynamicProject.class).get() instanceof DynamicProject); }

Target:
public void should_save_a_project() throws Exception { DynamicProjectRepository repo = new DynamicProjectRepository(); GHRepository ghRepository = setupMockGHRepository(); DynamicProject project = repo.createNewProject(ghRepository); assert(repo.getDatastore().getCount(DynamicProject.class) > 0); DynamicProject restoredProject = repo.getDatastore().createQuery(DynamicProject.class).get(); assert("repo_name".equals(restoredProject.getName())); }
Source:
public void load(Collection<Properties> configurations) { if (configurations == null) { return; } for (Properties configuration : configurations) { ExtensionEntry entry = new ExtensionEntry(configuration); ExtensionEntry alreadyLoaded = loadedEntries.get(entry.getName()); if (alreadyLoaded != null) { throw new ConfigurationException(String.format("Could not load the configuration '%1$s'. %2%s", entry.getName(), alreadyLoaded.file != null ? String.format("The already loaded file %1$s contains a configuration with the same name", alreadyLoaded.file.getAbsolutePath()) : "")); } loadedEntries.put(entry.getName(), entry); } }

Target:
public void load(Collection<Properties> configurations) { for (Properties configuration : configurations) { ExtensionEntry entry = new ExtensionEntry(configuration); load(entry); } activate(); }
Source:
public void toggleApplicationDetailsTest() throws Exception { List<ApplicationsPage.ClientRepresentation> applications = applicationsPage.toggleApplicationsDetails(); assertFalse(applications.isEmpty()); Map<String, ApplicationsPage.ClientRepresentation> apps = applications.stream().collect(Collectors.toMap(x -> x.getClientId(), x -> x)); assertThat(apps.keySet(), containsInAnyOrder("always-display-client", "account-console")); assertClientRep(apps.get("account-console"), "Account Console", false, true, "/realms/test/account/", true); assertClientRep(apps.get("always-display-client"), "Always Display Client", false, false, "https://localhost:8543/auth/realms/master/app/always-display-client", true); applications = applicationsPage.toggleApplicationsDetails(); assertFalse(applications.isEmpty()); apps = applications.stream().collect(Collectors.toMap(x -> x.getClientId(), x -> x)); assertThat(apps.keySet(), containsInAnyOrder("always-display-client", "account-console")); assertClientRep(apps.get("account-console"), "Account Console", false, true, "/realms/test/account/", false); assertClientRep(apps.get("always-display-client"), "Always Display Client", false, false, "https://localhost:8543/auth/realms/master/app/always-display-client", false); }

Target:
public void toggleApplicationDetailsTest() throws Exception { applicationsPage.toggleApplicationDetails("account-console"); List<ApplicationsPage.ClientRepresentation> applications = applicationsPage.getApplications(); assertFalse(applications.isEmpty()); Map<String, ApplicationsPage.ClientRepresentation> apps = applications.stream().collect(Collectors.toMap(x -> x.getClientId(), x -> x)); assertThat(apps.keySet(), containsInAnyOrder("always-display-client", "account-console")); assertClientRep(apps.get("account-console"), "Account Console", false, true, "/realms/test/account/", true); assertClientRep(apps.get("always-display-client"), "Always Display Client", false, false, "https://localhost:8543/auth/realms/master/app/always-display-client", false); applicationsPage.toggleApplicationDetails("account-console"); applications = applicationsPage.getApplications(); assertFalse(applications.isEmpty()); apps = applications.stream().collect(Collectors.toMap(x -> x.getClientId(), x -> x)); assertThat(apps.keySet(), containsInAnyOrder("always-display-client", "account-console")); assertClientRep(apps.get("account-console"), "Account Console", false, true, "/realms/test/account/", false); assertClientRep(apps.get("always-display-client"), "Always Display Client", false, false, "https://localhost:8543/auth/realms/master/app/always-display-client", false); }
Source:
public Preview.PreviewSurfaceCallback getPreviewSurfaceCallback() { return new Preview.PreviewSurfaceCallback() { @NonNull @Override public ListenableFuture<Surface> createSurfaceFuture(@NonNull Size resolution, int imageFormat) { final SurfaceTexture surfaceTexture = mTextureView.getSurfaceTexture(); surfaceTexture.setDefaultBufferSize(resolution.getWidth(), resolution.getHeight()); return Futures.immediateFuture(new Surface(surfaceTexture)); } @Override public void onSafeToRelease(@NonNull ListenableFuture<Surface> surfaceFuture) { try { surfaceFuture.get().release(); } catch (ExecutionException | InterruptedException e) { e.printStackTrace(); } } }; }

Target:
public Preview.PreviewSurfaceCallback getPreviewSurfaceCallback() { return new Preview.PreviewSurfaceCallback() { final Map<Surface, SurfaceTexture> mSurfaceTextureMap = new HashMap<>(); @NonNull @Override public ListenableFuture<Surface> createSurfaceFuture(@NonNull Size resolution, int imageFormat) { final SurfaceTexture surfaceTexture = new SurfaceTexture(0); surfaceTexture.setDefaultBufferSize(resolution.getWidth(), resolution.getHeight()); surfaceTexture.detachFromGLContext(); final ViewGroup parent = (ViewGroup) mTextureView.getParent(); parent.removeView(mTextureView); parent.addView(mTextureView); mTextureView.setSurfaceTexture(surfaceTexture); final Surface surface = new Surface(surfaceTexture); mSurfaceTextureMap.put(surface, surfaceTexture); return Futures.immediateFuture(surface); } @Override public void onSafeToRelease(@NonNull ListenableFuture<Surface> surfaceFuture) { try { final Surface surface = surfaceFuture.get(); final SurfaceTexture surfaceTexture = mSurfaceTextureMap.get(surface); if (surfaceTexture != null) { surfaceTexture.release(); mSurfaceTextureMap.remove(surface); } surface.release(); } catch (ExecutionException | InterruptedException e) { e.printStackTrace(); } } }; }
Source:
public String countConsumers( @PathParam("owner_key") @Verify(value = Owner.class, subResource = SubResource.CONSUMERS) String ownerKey, @QueryParam("type") Set<String> typeLabels, @QueryParam("sku") List<String> skus, @QueryParam("subscription_id") List<String> subscriptionIds, @QueryParam("contract") List<String> contracts) { findOwner(ownerKey); findAndValidateTypeLabels(typeLabels); int count = consumerCurator.countConsumers(ownerKey, typeLabels, skus, subscriptionIds, contracts); return "{ \"consumersCount\" : " + count + "}"; }

Target:
public int countConsumers( @PathParam("owner_key") @Verify(value = Owner.class, subResource = SubResource.CONSUMERS) String ownerKey, @QueryParam("type") Set<String> typeLabels, @QueryParam("sku") List<String> skus, @QueryParam("subscription_id") List<String> subscriptionIds, @QueryParam("contract") List<String> contracts) { findOwner(ownerKey); consumerTypeValidator.findAndValidateTypeLabels(typeLabels); return consumerCurator.countConsumers(ownerKey, typeLabels, skus, subscriptionIds, contracts); }
Source:
public PieChart(PlotSheet plotSheet, double[] vals){ this.mPlotSheet = plotSheet; mValues = vals; mPercent = new double[mValues.length]; for(double v: mValues) mSum +=v; double denominator; if(mSum == 0) denominator = 1; else denominator = mSum; mPercent[0]= mValues[0]/ denominator; for(int i=1; i< mValues.length; i++){ mPercent[i]= mPercent[i-1]+ mValues[i]/ denominator; } mColorHelper = mColors.length; if((mValues.length-1)%(mColors.length)==0) mColorHelper = mColors.length-1; }

Target:
public PieChart(PlotSheet plotSheet, double[] vals){ this.mPlotSheet = plotSheet; mValues = vals; mPercent = new double[mValues.length]; for(double v: mValues) mSum +=v; double denominator = (mSum == 0) ? 1 : mSum; mPercent[0]= mValues[0]/ denominator; for(int i=1; i< mValues.length; i++){ mPercent[i]= mPercent[i-1]+ mValues[i]/ denominator; } mColorHelper = mColors.length; if((mValues.length-1)%(mColors.length)==0) mColorHelper = mColors.length-1; }
Source:
private OAuth2AuthorizationRequest authorizationRequest(ServerWebExchange exchange, ClientRegistration clientRegistration) { String redirectUriStr = this .expandRedirectUri(exchange.getRequest(), clientRegistration); Map<String, Object> additionalParameters = new HashMap<>(); additionalParameters.put(OAuth2ParameterNames.REGISTRATION_ID, clientRegistration.getRegistrationId()); OAuth2AuthorizationRequest.Builder builder; if (AuthorizationGrantType.AUTHORIZATION_CODE.equals(clientRegistration.getAuthorizationGrantType())) { builder = OAuth2AuthorizationRequest.authorizationCode(); if (isEmpty(clientRegistration.getClientSecret())) { builder.codeVerifier(this.pkceCodeVerifierStringKeyGenerator.generateKey()); } } else if (AuthorizationGrantType.IMPLICIT.equals(clientRegistration.getAuthorizationGrantType())) { builder = OAuth2AuthorizationRequest.implicit(); } else { throw new IllegalArgumentException( "Invalid Authorization Grant Type (" + clientRegistration.getAuthorizationGrantType().getValue() + ") for Client Registration with Id: " + clientRegistration.getRegistrationId()); } return builder .clientId(clientRegistration.getClientId()) .authorizationUri(clientRegistration.getProviderDetails().getAuthorizationUri()) .redirectUri(redirectUriStr).scopes(clientRegistration.getScopes()) .state(this.stateGenerator.generateKey()) .additionalParameters(additionalParameters) .build(); }

Target:
private OAuth2AuthorizationRequest authorizationRequest(ServerWebExchange exchange, ClientRegistration clientRegistration) { String redirectUriStr = this .expandRedirectUri(exchange.getRequest(), clientRegistration); Map<String, Object> attributes = new HashMap<>(); attributes.put(OAuth2ParameterNames.REGISTRATION_ID, clientRegistration.getRegistrationId()); OAuth2AuthorizationRequest.Builder builder; if (AuthorizationGrantType.AUTHORIZATION_CODE.equals(clientRegistration.getAuthorizationGrantType())) { builder = OAuth2AuthorizationRequest.authorizationCode(); if (ClientAuthenticationMethod.NONE.equals(clientRegistration.getClientAuthenticationMethod())) { Map<String, Object> additionalParameters = new HashMap<>(); addPkceParameters(attributes, additionalParameters); builder.additionalParameters(additionalParameters); } } else if (AuthorizationGrantType.IMPLICIT.equals(clientRegistration.getAuthorizationGrantType())) { builder = OAuth2AuthorizationRequest.implicit(); } else { throw new IllegalArgumentException( "Invalid Authorization Grant Type (" + clientRegistration.getAuthorizationGrantType().getValue() + ") for Client Registration with Id: " + clientRegistration.getRegistrationId()); } return builder .clientId(clientRegistration.getClientId()) .authorizationUri(clientRegistration.getProviderDetails().getAuthorizationUri()) .redirectUri(redirectUriStr).scopes(clientRegistration.getScopes()) .state(this.stateGenerator.generateKey()) .attributes(attributes) .build(); }