auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private CommentDetail setCommentDetails(PatchSet.Id leftId, PatchSet.Id rightId, String fileName, IProgressMonitor monitor) throws GerritException { CommentDetail commentDetail = new CommentDetail(leftId, rightId); if (leftId != null) { Map<String, List<CommentInfo>> commentInfo_A = retrieveRevisionComments(leftId, monitor); adaptCommentDetails(commentInfo_A, leftId, commentDetail.getCommentsA(), fileName, commentDetail); } Map<String, List<CommentInfo>> commentInfo_B = retrieveRevisionComments(rightId, monitor); adaptCommentDetails(commentInfo_B, rightId, commentDetail.getCommentsB(), fileName, commentDetail); ChangeInfo changeInfo = getChangeInfo(rightId.getParentKey().get(), monitor); List<com.google.gerrit.common.data.AccountInfo> listAccountInfo = new ArrayList<com.google.gerrit.common.data.AccountInfo>(); com.google.gerrit.common.data.AccountInfo accountInfo = setAccountFromChangeInfo(changeInfo); listAccountInfo.add(accountInfo); @SuppressWarnings("unchecked") AccountInfoCache accCache = new AccountInfoCache(listAccountInfo); commentDetail.setAccountInfoCache(accCache); return commentDetail; }

Target:
private CommentDetail setCommentDetails(PatchSet.Id leftId, PatchSet.Id rightId, String fileName, IProgressMonitor monitor) throws GerritException { CommentDetail commentDetail = new CommentDetail(leftId, rightId); if (leftId != null) { Map<String, List<CommentInfo>> commentInfo_A = retrieveRevisionComments(leftId, monitor); adaptCommentDetails(commentInfo_A, leftId, commentDetail.getCommentsA(), fileName, commentDetail); } Map<String, List<CommentInfo>> commentInfo_B = retrieveRevisionComments(rightId, monitor); adaptCommentDetails(commentInfo_B, rightId, commentDetail.getCommentsB(), fileName, commentDetail); ChangeInfo changeInfo = getChangeInfo(rightId.getParentKey().get(), monitor); List<com.google.gerrit.common.data.AccountInfo> listAccountInfo = new ArrayList<com.google.gerrit.common.data.AccountInfo>(); com.google.gerrit.common.data.AccountInfo accountInfo = setAccountFromChangeInfo(changeInfo); listAccountInfo.add(accountInfo); AccountInfoCache accCache = new AccountInfoCache(listAccountInfo); commentDetail.setAccountInfoCache(accCache); return commentDetail; }
Source:
public void repartition(final String topic, final int partitionsNumber) throws CannotAddPartitionToTopicException, TopicConfigException { try (AdminClient adminClient = AdminClient.create(kafkaLocationManager.getProperties())) { adminClient.createPartitions(ImmutableMap.of(topic, NewPartitions.increaseTo(partitionsNumber))); final long timeoutMillis = TimeUnit.SECONDS.toMillis(5); final Boolean allowsConsumption = Retryer.executeWithRetry(() -> { try (Consumer<byte[], byte[]> consumer = kafkaFactory.getConsumer()) { return consumer.partitionsFor(topic).size() == partitionsNumber; } }, new RetryForSpecifiedTimeStrategy<Boolean>(timeoutMillis) .withWaitBetweenEachTry(100L) .withResultsThatForceRetry(Boolean.FALSE)); if (!Boolean.TRUE.equals(allowsConsumption)) { throw new TopicConfigException(String.format("Failed to repartition topic to %s", partitionsNumber)); } final Producer<String, String> producer = kafkaFactory.takeProducer(); kafkaFactory.terminateProducer(producer); kafkaFactory.releaseProducer(producer); } catch (Exception e) { throw new CannotAddPartitionToTopicException(String .format("Failed to increase the number of partition for %s topic to %s", topic, partitionsNumber), e); } }

Target:
public void repartition(final String topic, final int partitionsNumber) throws CannotAddPartitionToTopicException, TopicConfigException { try (AdminClient adminClient = AdminClient.create(kafkaLocationManager.getProperties())) { adminClient.createPartitions(ImmutableMap.of(topic, NewPartitions.increaseTo(partitionsNumber))); final long timeoutMillis = TimeUnit.SECONDS.toMillis(5); final Boolean areNewPartitionsAdded = Retryer.executeWithRetry(() -> { try (Consumer<byte[], byte[]> consumer = kafkaFactory.getConsumer()) { return consumer.partitionsFor(topic).size() == partitionsNumber; } }, new RetryForSpecifiedTimeStrategy<Boolean>(timeoutMillis) .withWaitBetweenEachTry(100L) .withResultsThatForceRetry(Boolean.FALSE)); if (!Boolean.TRUE.equals(areNewPartitionsAdded)) { throw new TopicConfigException(String.format("Failed to repartition topic to %s", partitionsNumber)); } final Producer<String, String> producer = kafkaFactory.takeProducer(); kafkaFactory.terminateProducer(producer); kafkaFactory.releaseProducer(producer); } catch (Exception e) { throw new CannotAddPartitionToTopicException(String .format("Failed to increase the number of partition for %s topic to %s", topic, partitionsNumber), e); } }
Source:
public String toString() { return "AssetRecord [assetStatus=" + this.assetStatus + ", channelId=" + this.channelName + ", timestamp=" + this.timestamp + ", value=" + this.value + "]"; }

Target:
public String toString() { return "AssetRecord [assetStatus=" + this.assetStatus + ", channelName=" + this.channelName + ", timestamp=" + this.timestamp + ", value=" + this.value + "]"; }
Source:
public boolean handleRequest(RestRequest originalRequest, RestRequest darkRequest, RequestContext requestContext) { int numRequestDuplicates = getNumDuplicateRequests(_random.nextFloat()); return _baseDarkClusterDispatcher.sendRequest(originalRequest, darkRequest, requestContext, numRequestDuplicates); }

Target:
public boolean handleRequest(RestRequest originalRequest, RestRequest darkRequest, RequestContext requestContext) { int numRequestDuplicates = getNumDuplicateRequests(); return _baseDarkClusterDispatcher.sendRequest(originalRequest, darkRequest, requestContext, numRequestDuplicates); }
Source:
public void canRebase() throws GitAPIException, IOException, RestApiException, Exception { String subject = "test commit"; String file = "a.txt"; String contents = "contents"; PushOneCommit push = pushFactory.create(db, admin.getIdent()); PushOneCommit.Result r1 = push.to(git, "refs/for/master"); merge(r1); push = pushFactory.create(db, admin.getIdent(), "non-conflicting", "b.txt", "other contents"); PushOneCommit.Result r2 = push.to(git, "refs/for/master"); assertFalse(gApi.changes() .id(r2.getChangeId()) .revision(r2.getCommit().name()) .canRebase()); merge(r2); git.checkout().setName(r1.getCommit().name()).call(); push = pushFactory.create(db, admin.getIdent(), subject, file, contents); PushOneCommit.Result r3 = push.to(git, "refs/for/master"); assertTrue(gApi.changes() .id(r3.getChangeId()) .revision(r3.getCommit().name()) .canRebase()); }

Target:
public void canRebase() throws GitAPIException, IOException, RestApiException, Exception { PushOneCommit push = pushFactory.create(db, admin.getIdent()); PushOneCommit.Result r1 = push.to(git, "refs/for/master"); merge(r1); push = pushFactory.create(db, admin.getIdent()); PushOneCommit.Result r2 = push.to(git, "refs/for/master"); assertFalse(gApi.changes() .id(r2.getChangeId()) .revision(r2.getCommit().name()) .canRebase()); merge(r2); git.checkout().setName(r1.getCommit().name()).call(); push = pushFactory.create(db, admin.getIdent()); PushOneCommit.Result r3 = push.to(git, "refs/for/master"); assertTrue(gApi.changes() .id(r3.getChangeId()) .revision(r3.getCommit().name()) .canRebase()); }
Source:
public TDJobSummary checkStatus() { try { return ensureRunningOrSucceeded(); } catch (TDJobException ex) { try { TDJob job = getJobInfo(); String message = job.getCmdOut() + "\n" + job.getStdErr(); throw new TaskExecutionException(message, buildExceptionErrorConfig(ex)); } catch (Exception getJobInfoFailed) { getJobInfoFailed.addSuppressed(ex); throw Throwables.propagate(getJobInfoFailed); } } catch (InterruptedException ex) { throw Throwables.propagate(ex); } }

Target:
public TDJobSummary checkStatus() { try { return ensureRunningOrSucceeded(); } catch (TDJobException ex) { try { TDJob job = getJobInfo(); String message = job.getCmdOut() + "\n" + job.getStdErr(); throw new TaskExecutionException(message, buildExceptionErrorConfig(ex)); } catch (Exception getJobInfoFailed) { getJobInfoFailed.addSuppressed(ex); throw Throwables.propagate(getJobInfoFailed); } } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw Throwables.propagate(ex); } }
Source:
public static void verifyBlobContents(Digest expected, Digest actual) throws IOException { if (!expected.equals(actual)) { String msg = String.format( "Output download failed: Expected to download a blob of %d bytes with hash '%s', " + "got %d bytes with '%s'.", expected.getSizeBytes(), expected.getHash(), actual.getSizeBytes(), actual.getHash()); throw new IOException(msg); } }

Target:
public static void verifyBlobContents(Digest expected, Digest actual) throws IOException { if (!expected.equals(actual)) { String msg = String.format( "Output download failed: Expected digest '%s/%d' does not match " + "received digest '%s/%d'.", expected.getHash(), expected.getSizeBytes(), actual.getHash(), actual.getSizeBytes()); throw new IOException(msg); } }
Source:
void failsContainerOnEmptyName() { var results = execute("testWithEmptyName", String.class); results.allEvents().assertThatEvents() .haveAtLeast(1, event(container(), displayName("testWithEmptyName(String)"), finishedWithFailure(message(msg -> msg.contains("must be declared with a non-empty name"))))); }

Target:
void failsContainerOnEmptyName() { var results = execute("testWithEmptyName", String.class); results.allEvents().assertThatEvents() .haveExactly(1, event(container(), displayName("testWithEmptyName(String)"), finishedWithFailure(message(msg -> msg.contains("must be declared with a non-empty name"))))); }
Source:
private static Map<String, Function> initFunctions() { final HashMap<String, Function> m = new HashMap<String, Function>(); m.put("toLowerCase", new Function() { @Override String apply(String a) { return a.toLowerCase(); } }); m.put("toUpperCase", new Function() { @Override String apply(String a) { return a.toUpperCase(); } }); m.put("localPart", new Function() { @Override String apply(String a) { int at = a.indexOf('@'); return at < 0 ? a : a.substring(0, at); } }); m.put("localPartLowerCase", new Function() { @Override String apply(String a) { String s = a.toLowerCase(); int at = s.indexOf('@'); return at < 0 ? s : s.substring(0, at); } }); m.put("localPartUpperCase", new Function() { @Override String apply(String a) { String s = a.toUpperCase(); int at = s.indexOf('@'); return at < 0 ? s : s.substring(0, at); } }); return Collections.unmodifiableMap(m); }

Target:
private static Map<String, Function> initFunctions() { final HashMap<String, Function> m = new HashMap<String, Function>(); m.put("toLowerCase", new Function() { @Override String apply(String a) { return a.toLowerCase(); } }); m.put("toUpperCase", new Function() { @Override String apply(String a) { return a.toUpperCase(); } }); m.put("localPart", new Function() { @Override String apply(String a) { int at = a.indexOf('@'); return at < 0 ? a : a.substring(0, at); } }); return Collections.unmodifiableMap(m); }
Source:
protected Map<String, Object> getRequestedEntities(XmlrpcControllerSlice ndlSlice) { Map<String, Object> ticketedRequestEntities = new HashMap<>(); if ((ndlSlice.getComputedReservations() != null) && (ndlSlice.getComputedReservations().size() > 0)) { for (TicketReservationMng currRes : ndlSlice.getComputedReservations()) { Map<String, Object> currResMap = currRes.toMap(); ticketedRequestEntities.put(currRes.getReservationID(), currResMap); } } return ticketedRequestEntities; }

Target:
protected Map<String, Object> getRequestedEntities(XmlrpcControllerSlice ndlSlice) { Map<String, Object> ticketedRequestEntities = new HashMap<>(); if ((ndlSlice.getComputedReservations() != null) && (ndlSlice.getComputedReservations().size() > 0)) { for (TicketReservationMng currRes : ndlSlice.getComputedReservations()) { ticketedRequestEntities.put(currRes.getReservationID(), currRes.toMap()); } } return ticketedRequestEntities; }
Source:
public RevTree getTree(ObjectId id) { return getIfPresent(id, RevTree.class); }

Target:
public RevTree getTree(ObjectId id) { return get(id, RevTree.class); }
Source:
public void init() { isDebug = (getInitParameter("debug", Boolean.class) == null) ? false : getInitParameter("debug", Boolean.class); }

Target:
public void init() { isDebug = Optional.ofNullable(getInitParameter("debug", Boolean.class)).orElse(false); }
Source:
private synchronized int iterQueue(final int flushLimit, final Filter filter1, QueueIterateAction messageAction, final boolean remove) throws Exception { int count = 0; int txCount = 0; Transaction tx = new TransactionImpl(storageManager); try (LinkedListIterator<MessageReference> iter = iterator()) { while (iter.hasNext()) { MessageReference ref = iter.next(); if (ref.isPaged() && queueDestroyed) { continue; } if (filter1 == null || filter1.match(ref.getMessage())) { messageAction.actMessage(tx, ref); if (remove) { iter.remove(); } txCount++; count++; } } if (txCount > 0) { tx.commit(); tx = new TransactionImpl(storageManager); txCount = 0; } List<MessageReference> cancelled = scheduledDeliveryHandler.cancel(filter1); for (MessageReference messageReference : cancelled) { messageAction.actMessage(tx, messageReference, false); count++; txCount++; } if (txCount > 0) { tx.commit(); tx = new TransactionImpl(storageManager); txCount = 0; } if (pageIterator != null && !queueDestroyed) { while (pageIterator.hasNext()) { PagedReference reference = pageIterator.next(); pageIterator.remove(); if (filter1 == null || filter1.match(reference.getMessage())) { count++; txCount++; messageAction.actMessage(tx, reference, false); } else { addTail(reference, false); } if (txCount > 0 && txCount % flushLimit == 0) { tx.commit(); tx = new TransactionImpl(storageManager); txCount = 0; } } } if (txCount > 0) { tx.commit(); tx = null; } if (filter != null && !queueDestroyed && pageSubscription != null) { scheduleDepage(false); } return count; } }

Target:
private synchronized int iterQueue(final int flushLimit, final Filter filter1, QueueIterateAction messageAction, final boolean remove) throws Exception { int count = 0; int txCount = 0; Transaction tx = new TransactionImpl(storageManager); synchronized (this) { try (LinkedListIterator<MessageReference> iter = iterator()) { while (iter.hasNext()) { MessageReference ref = iter.next(); if (ref.isPaged() && queueDestroyed) { continue; } if (filter1 == null || filter1.match(ref.getMessage())) { messageAction.actMessage(tx, ref); if (remove) { iter.remove(); } txCount++; count++; } } if (txCount > 0) { tx.commit(); tx = new TransactionImpl(storageManager); txCount = 0; } List<MessageReference> cancelled = scheduledDeliveryHandler.cancel(filter1); for (MessageReference messageReference : cancelled) { messageAction.actMessage(tx, messageReference, false); count++; txCount++; } if (txCount > 0) { tx.commit(); tx = new TransactionImpl(storageManager); txCount = 0; } } if (pageIterator != null && !queueDestroyed) { while (pageIterator.hasNext()) { PagedReference reference = pageIterator.next(); pageIterator.remove(); if (filter1 == null || filter1.match(reference.getMessage())) { count++; txCount++; messageAction.actMessage(tx, reference, false); } else { addTail(reference, false); } if (txCount > 0 && txCount % flushLimit == 0) { tx.commit(); tx = new TransactionImpl(storageManager); txCount = 0; } } } if (txCount > 0) { tx.commit(); tx = null; } if (filter != null && !queueDestroyed && pageSubscription != null) { scheduleDepage(false); } return count; } }
Source:
public BuildStepMonitor getRequiredMonitorService() { return BuildStepMonitor.NONE; }

Target:
public BuildStepMonitor getRequiredMonitorService() { return buildStep.getRequiredMonitorService(); }
Source:
private void onIncrementTime(CommandTime self, MinecraftServer server, int time, MinecraftServer server2, ICommandSender sender, String[] args) { World world = sender.getEntityWorld(); world.setWorldTime(world.getWorldTime() + time); }

Target:
private void onIncrementTime(CommandTime self, MinecraftServer server, int time, MinecraftServer server2, ICommandSender sender, String[] args) { sender.getEntityWorld().setWorldTime(sender.getEntityWorld().getWorldTime() + time); }
Source:
private ListenableFuture<Connection> enqueue(int maxQueueSize) { if (maxQueueSize == 0) { return Futures.immediateFailedFuture(new ConnectionException(host.getSocketAddress(), "Pool is busy (no available connection and the max queue size is 0)")); } while (true) { int count = pendingBorrowCount.get(); if (count >= maxQueueSize) { return Futures.immediateFailedFuture(new ConnectionException(host.getSocketAddress(), "Pool is busy (no available connection and the queue has reached its max size " + maxQueueSize + " )")); } if (pendingBorrowCount.compareAndSet(count, count + 1)) { break; } } SettableFuture<Connection> future = SettableFuture.create(); pendingBorrows.add(future); return future; }

Target:
private ListenableFuture<Connection> enqueue(int maxQueueSize) { if (maxQueueSize == 0) { return Futures.immediateFailedFuture(new BusyPoolException(host.getSocketAddress(), 0)); } while (true) { int count = pendingBorrowCount.get(); if (count >= maxQueueSize) { return Futures.immediateFailedFuture(new BusyPoolException(host.getSocketAddress(), maxQueueSize)); } if (pendingBorrowCount.compareAndSet(count, count + 1)) { break; } } SettableFuture<Connection> future = SettableFuture.create(); pendingBorrows.add(future); if (phase.get() == Phase.CLOSING) { future.setException(new ConnectionException(host.getSocketAddress(), "Pool is shutdown")); } return future; }
Source:
private ResponseEntity processJSONException(final JSONException e, final NativeWebRequest nativeWebRequest) { if (e.getCause() == null) { return create(crateProblem(e), nativeWebRequest); } return create(Problem.valueOf(Response.Status.BAD_REQUEST), nativeWebRequest); }

Target:
private ResponseEntity processJSONException(final JSONException e, final NativeWebRequest nativeWebRequest) { if (e.getCause() == null) { return create(createProblem(e), nativeWebRequest); } return create(Problem.valueOf(Response.Status.BAD_REQUEST), nativeWebRequest); }
Source:
private void updateTitle() { if(tableSorter==null || !tableSorter.isFiltered()) { dockingPanelParameters.setTitle(I18N.tr("Table Editor of {0} {1}/{2}",tableEditableElement.getSourceName(),table.getSelectedRowCount(),table.getRowCount())); }else{ dockingPanelParameters.setTitle(I18N.tr("Table Editor of {0} (Filtered) {1}/{2}",tableEditableElement.getSourceName(),table.getSelectedRowCount(),table.getRowCount())); } }

Target:
private void updateTitle() { String sourceName = tableEditableElement.getSourceName(); int tableSelectedRowCount = table.getSelectedRowCount(); int tableRowCount = table.getRowCount(); if(tableSorter==null || !tableSorter.isFiltered()) { dockingPanelParameters.setTitle( I18N.tr("Table Editor of {0} {1}/{2}", sourceName,tableSelectedRowCount,tableRowCount)); }else{ dockingPanelParameters.setTitle( I18N.tr("Table Editor of {0} (Filtered) {1}/{2}", sourceName,tableSelectedRowCount,tableRowCount)); } }
Source:
public void batchedTimestampCallShouldReturnAtLeastOneUsableTimestamp() { when(allocator.getRelevantModuli(UUID_ONE)).thenReturn(RESIDUE_ONE); when(timestamps.getFreshTimestamps(anyInt())) .thenReturn(TIMESTAMP_RANGE); assertThat(service.getFreshTimestampsForClient(UUID_ONE, 2).stream()) .hasSize(1) .first() .isEqualTo(RESIDUE_ONE_TIMESTAMP_IN_RANGE.timestamp()); verify(allocator).getRelevantModuli(UUID_ONE); verify(timestamps).getFreshTimestamps(anyInt()); }

Target:
public void batchedTimestampCallShouldReturnAtLeastOneUsableTimestamp() { when(allocator.getRelevantModuli(UUID_ONE)).thenReturn(RESIDUE_ONE); when(timestamps.getFreshTimestamps(anyInt())) .thenReturn(TIMESTAMP_RANGE); assertThat(service.getFreshTimestampsForClient(UUID_ONE, 2).stream()) .containsExactly(RESIDUE_ONE_TIMESTAMP_IN_RANGE.timestamp()); verify(allocator).getRelevantModuli(UUID_ONE); verify(timestamps).getFreshTimestamps(anyInt()); }
Source:
public void checkAutocompleteFeature() { editor.selectTabByName(PYTHON_FILE_NAME); editor.goToPosition(18, 53); editor.typeTextIntoEditor("\n\n"); editor.typeTextIntoEditor("object = MyClass()\nprint(object."); editor.launchAutocompleteAndWaitContainer(); editor.waitTextIntoAutocompleteContainer("function"); editor.waitTextIntoAutocompleteContainer("var"); editor.waitTextIntoAutocompleteContainer("variable"); editor.enterAutocompleteProposal("function() "); editor.waitTextIntoEditor("print(object.function"); editor.typeTextIntoEditor("())"); }

Target:
public void checkAutocompleteFeature() { editor.selectTabByName(PYTHON_FILE_NAME); editor.goToPosition(19, 1); editor.typeTextIntoEditor("\n\nobject = MyClass()\nprint(object."); editor.launchAutocompleteAndWaitContainer(); editor.waitTextIntoAutocompleteContainer("function"); editor.waitTextIntoAutocompleteContainer("var"); editor.waitTextIntoAutocompleteContainer("variable"); editor.enterAutocompleteProposal("function() "); editor.waitTextIntoEditor("print(object.function"); }
Source:
private <T> CachedObject<T> getCachedObject(String cacheKey) { try { return cache.get(Preconditions.checkNotNull(cacheKey)); } catch (Exception e) { log.error(String.format("Error accessing cache using key: %s", cacheKey), e); return null; } }

Target:
private <T> CachedObject<T> getCachedObject(String cacheKey) { try { return cache.get(Preconditions.checkNotNull(cacheKey)); } catch (Exception e) { log.error("Error accessing cache using key: {}", cacheKey, e); return null; } }
Source:
protected void executeCommand() { List<String> errors = new ArrayList<String>(); entity = getGlusterHookDao().getById(getParameters().getHookId()); for (Guid upServerId : getUpServerIds()) { VDSReturnValue returnValue = runVdsCommand( VDSCommandType.EnableGlusterHook, new GlusterHookVDSParameters(upServerId, entity.getGlusterCommand(), entity.getGlusterHookStage(), entity.getName())); if (!returnValue.getSucceeded()) { errors.add(returnValue.getVdsError().getMessage()); } } if (!errors.isEmpty()) { handleVdsErrors(AuditLogType.GLUSTER_HOOK_ENABLE_FAILED, errors); } if (getUpServerIds().size() > errors.size()) { UpdateHookStatusInDb(getParameters().getClusterId(), entity.getName(), GlusterHookStatus.ENABLED); setSucceeded(true); } }

Target:
protected void executeCommand() { List<String> errors = new ArrayList<String>(); entity = getGlusterHooksDao().getById(getParameters().getHookId()); List <VDS> servers = getAllUpServers(getParameters().getClusterId()); for (VDS upServer : servers) { VDSReturnValue returnValue = runVdsCommand( VDSCommandType.EnableGlusterHook, new GlusterHookVDSParameters(upServer.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName())); if (!returnValue.getSucceeded()) { errors.add(returnValue.getVdsError().getMessage()); saveServerHookInDb(getParameters().getHookId(), upServer.getId(), entity.getChecksum(), entity.getStatus()); updateHookInSyncInDb(getParameters().getHookId(), false); } } if (servers.size() > errors.size()) { updateHookStatusInDb(getParameters().getHookId(), null, GlusterHookStatus.ENABLED); } setSucceeded(true); }
Source:
private Expression readAggregate() { int tokenT = token.tokenType; String udaf = token.tokenString; Expression aggExpr; read(); readThis(Tokens.OPENBRACKET); aggExpr = readAggregateExpression(tokenT, udaf); readThis(Tokens.CLOSEBRACKET); if (token.tokenType == Tokens.OVER) { read(); aggExpr = readWindowSpecification(tokenT, aggExpr); if (aggExpr instanceof ExpressionWindowed) { ExpressionWindowed aggWinExpr = (ExpressionWindowed)aggExpr; if (aggWinExpr.isDistinct()) { throw Error.error("DISTINCT is not allowed in window functions.", "", -1); } } } return aggExpr; }

Target:
private Expression readAggregate() { int tokenT = token.tokenType; String funcName = token.tokenString; Expression aggExpr; read(); readThis(Tokens.OPENBRACKET); aggExpr = readAggregateExpression(tokenT, funcName); readThis(Tokens.CLOSEBRACKET); if (token.tokenType == Tokens.OVER) { read(); aggExpr = readWindowSpecification(tokenT, aggExpr); if (aggExpr instanceof ExpressionWindowed) { ExpressionWindowed aggWinExpr = (ExpressionWindowed)aggExpr; if (aggWinExpr.isDistinct()) { throw Error.error("DISTINCT is not allowed in window functions.", "", -1); } } } return aggExpr; }
Source:
public static int testInvokeMethodStatic1(boolean needsThrow) throws Throwable { if (needsThrow) { throw new Throwable("test exception"); } return 567; }

Target:
public static int testInvokeMethodStatic1(boolean needsThrow) throws Throwable { if (needsThrow) { throw new Throwable("test exception"); } return InvokeMethodTestInterface.RETURN_VALUE; }
Source:
public EncounterListResult queryForAllEncountersByPatientId(Config config, String id) { String responseJson = getJson(config, "/encounter?patient={id}&v=full", id); List<Encounter> encounterList = new ArrayList<>(); JsonArray allEncounters = prepareJsonArray(responseJson); for (JsonElement encounter : allEncounters) { encounterList.add(checkVersionAndSetEncounter(config, encounter.toString())); } EncounterListResult encounters = new EncounterListResult(); encounters.setResults(encounterList); return encounters; }

Target:
public EncounterListResult queryForAllEncountersByPatientId(Config config, String id) { String responseJson = getJson(config, "/encounter?patient={id}&v=full", id); List<Encounter> encounterList = new ArrayList<>(); for (JsonElement encounter : prepareAllEncountersList(responseJson)) { encounterList.add(checkVersionAndSetEncounter(config, encounter.toString())); } EncounterListResult encounters = new EncounterListResult(); encounters.setResults(encounterList); return encounters; }
Source:
public void createPdpFeedsFromRequestExtracts() { List<String> filesToProcess = getConcurRequestExtractFileService().getUnprocessedRequestExtractFiles(); if (filesToProcess.isEmpty()) { LOG.info("createPdpFeedsFromRequestExtracts: No Request Extract files found to process."); getConcurRequestExtractReportService().sendResultsEmail(null, null); } else { LOG.info("createPdpFeedsFromRequestExtracts: Found " + filesToProcess.size() + " file(s) to process."); for (String requestExtractFullyQualifiedFileName : filesToProcess) { try { LOG.info("createPdpFeedsFromRequestExtracts: Begin processing for filename: " + requestExtractFullyQualifiedFileName + "."); if (getConcurRequestExtractFileService().processFile(requestExtractFullyQualifiedFileName)) { LOG.info("createPdpFeedsFromRequestExtracts: SUCCESSFUL processing for Request Extract File: " + requestExtractFullyQualifiedFileName); } else { LOG.error("createPdpFeedsFromRequestExtracts: Processing was UNSUCCESSFUL for Request Extract File: " + requestExtractFullyQualifiedFileName); } } catch (Exception e) { LOG.error("createPdpFeedsFromRequestExtracts: Processing to create PDP Files from Request Extract [" + requestExtractFullyQualifiedFileName + "] generated Exception: " + e.getMessage()); } finally { getConcurBatchUtilityService().removeDoneFileFor(requestExtractFullyQualifiedFileName); } } } }

Target:
public void createPdpFeedsFromRequestExtracts() { List<String> filesToProcess = getConcurRequestExtractFileService().getUnprocessedRequestExtractFiles(); if (filesToProcess.isEmpty()) { LOG.info("createPdpFeedsFromRequestExtracts: No Request Extract files found to process."); getConcurRequestExtractReportService().sendEmailThatNoFileWasProcesed(); } else { LOG.info("createPdpFeedsFromRequestExtracts: Found " + filesToProcess.size() + " file(s) to process."); for (String requestExtractFullyQualifiedFileName : filesToProcess) { try { LOG.info("createPdpFeedsFromRequestExtracts: Begin processing for filename: " + requestExtractFullyQualifiedFileName + "."); if (getConcurRequestExtractFileService().processFile(requestExtractFullyQualifiedFileName)) { LOG.info("createPdpFeedsFromRequestExtracts: SUCCESSFUL processing for Request Extract File: " + requestExtractFullyQualifiedFileName); } else { LOG.error("createPdpFeedsFromRequestExtracts: Processing was UNSUCCESSFUL for Request Extract File: " + requestExtractFullyQualifiedFileName); } } catch (Exception e) { LOG.error("createPdpFeedsFromRequestExtracts: Processing to create PDP Files from Request Extract [" + requestExtractFullyQualifiedFileName + "] generated Exception: " + e.getMessage()); } finally { getConcurBatchUtilityService().removeDoneFileFor(requestExtractFullyQualifiedFileName); } } } }
Source:
protected void finalize() throws Throwable { if (!closed.get()) { log.warn("Not closed! Object was[%s]. Allowing gc to prevent leak.", object); } super.finalize(); }

Target:
protected void finalize() throws Throwable { try { if (!closed.get()) { log.warn("Not closed! Object was[%s]. Allowing gc to prevent leak.", object); } } finally { super.finalize(); } }
Source:
public ProfileGenericDataResponse getProfileGenericDataResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ProfileGenericDataAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ProfileGenericDataAsyncRequest for meter: {}.", request.getDeviceIdentification()); ProfileGenericDataResponse response = null; try { final MeterResponseData meterResponseData = this.monitoringService .dequeueProfileGenericDataResponse(request.getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "retrieving profile generic data"); response = this.monitoringMapper.map(meterResponseData.getMessageData(), ProfileGenericDataResponse.class); } catch (final Exception e) { LOGGER.error( "Exception: while sending GetProfileGenericDataAsyncRequest for correlation UID: for organisation {}.", new Object[] { e.getMessage(), request.getCorrelationUid(), organisationIdentification }); this.handleException(e); } return response; }

Target:
public ProfileGenericDataResponse getProfileGenericDataResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ProfileGenericDataAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ProfileGenericDataAsyncRequest for meter: {}.", request.getDeviceIdentification()); ProfileGenericDataResponse response = null; try { final MeterResponseData meterResponseData = this.monitoringService .dequeueProfileGenericDataResponse(request.getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "retrieving profile generic data"); response = this.monitoringMapper.map(meterResponseData.getMessageData(), ProfileGenericDataResponse.class); } catch (final Exception e) { LOGGER.error( "Exception: while sending GetProfileGenericDataAsyncRequest for correlation UID: for organisation {}.", e.getMessage(), request.getCorrelationUid(), organisationIdentification); this.handleException(e); } return response; }
Source:
public String getStudentStatus(StudentAttributes student) { if (student.isRegistered()) { return Const.STUDENT_COURSE_STATUS_JOINED; } else { return Const.STUDENT_COURSE_STATUS_YET_TO_JOIN; } }

Target:
public String getStudentStatus(StudentAttributes student) { return student.getStudentStatus(); }
Source:
public PlanImpl build() { for (final String namespace : evaluatorsToAdd.keySet()) { for (final String evaluator : evaluatorsToAdd.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(evaluator)) { throw new RuntimeException(evaluator + " is planned both for addition and deletion."); } } if (!allTransferSteps.containsKey(namespace)) { continue; } for (final TransferStep transferStep : allTransferSteps.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(transferStep.getDstId())) { throw new RuntimeException(transferStep.getDstId() + " is planned for deletion."); } else if (evaluatorsToAdd.containsKey(namespace) && evaluatorsToAdd.get(namespace).contains(transferStep.getSrcId())) { throw new RuntimeException(transferStep.getSrcId() + " is planned for addition."); } } } return new PlanImpl(evaluatorsToAdd, evaluatorsToDelete, allTransferSteps); }

Target:
public PlanImpl build() { for (final String namespace : evaluatorsToAdd.keySet()) { for (final String evaluator : evaluatorsToAdd.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(evaluator)) { throw new RuntimeException(evaluator + " is planned for both addition and deletion."); } } if (!allTransferSteps.containsKey(namespace)) { continue; } for (final TransferStep transferStep : allTransferSteps.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(transferStep.getDstId())) { throw new RuntimeException(transferStep.getDstId() + " is planned for deletion."); } else if (evaluatorsToAdd.containsKey(namespace) && evaluatorsToAdd.get(namespace).contains(transferStep.getSrcId())) { throw new RuntimeException(transferStep.getSrcId() + " is planned for addition."); } } } return new PlanImpl(evaluatorsToAdd, evaluatorsToDelete, allTransferSteps); }
Source:
public InputStream getInputStream(String filepath) { File f = new File(filepath); if (f.isFile() && f.canRead()) { try { return new FileInputStream(f); } catch (FileNotFoundException e) { logger.debug("Configuration file could not be found even though we just checked it can be read...", filepath); } } return null; }

Target:
public InputStream getInputStream(String filepath) { File f = new File(filepath); if (f.isFile() && f.canRead()) { try { return new FileInputStream(f); } catch (FileNotFoundException e) { logger.debug("Configuration file could not be found even though we just checked it can be read...", filepath); } } else { logger.debug("The configuration file (which resolves to absolute path {}) doesn't exist, is not a file" + " or is not readable.", f, f.getAbsolutePath()); } return null; }
Source:
private void shutdownExecutors() throws InterruptedException { if (persistExecutor != null) { persistExecutor.shutdownNow(); Preconditions.checkState( persistExecutor.awaitTermination(365, TimeUnit.DAYS), "persistExecutor not terminated" ); persistExecutor = null; } if (pushExecutor != null) { pushExecutor.shutdownNow(); Preconditions.checkState( pushExecutor.awaitTermination(365, TimeUnit.DAYS), "pushExecutor not terminated" ); pushExecutor = null; } if (intermediateTempExecutor != null) { intermediateTempExecutor.shutdownNow(); Preconditions.checkState( intermediateTempExecutor.awaitTermination(365, TimeUnit.DAYS), "intermediateTempExecutor not terminated" ); intermediateTempExecutor = null; } }

Target:
private void shutdownExecutors() { if (persistExecutor != null) { persistExecutor.shutdownNow(); } if (pushExecutor != null) { pushExecutor.shutdownNow(); } if (intermediateTempExecutor != null) { intermediateTempExecutor.shutdownNow(); } }
Source:
void testUpdateWhenResponseParametersAreNotEmpty() { when(resultEventData.getResponseParameters()).thenReturn("someValue"); underTest.update(mockAttemptAuditEventResultBuilder, resultEventData); verify(mockResultApiRequestDataBuilder, times(1)).setResponseParameters(anyString()); }

Target:
void testUpdateWhenResponseParametersAreNotEmpty() { String parametersValue = "someValue"; when(resultEventData.getResponseParameters()).thenReturn(parametersValue); underTest.update(mockAttemptAuditEventResultBuilder, resultEventData); verify(mockResultApiRequestDataBuilder, times(1)).setResponseParameters(anyString()); verify(mockResultApiRequestDataBuilder, times(1)).setResponseParameters(parametersValue); }
Source:
public List<SchemaTableName> listTables(ConnectorSession session, String schemaNameOrNull) { Stream<SchemaTableName> stream = tables.listSystemTables(session).stream() .map(SystemTable::getTableMetadata) .map(ConnectorTableMetadata::getTable); if (schemaNameOrNull != null) { stream = stream .filter(table -> table.getSchemaName().equals(schemaNameOrNull)); } return stream.collect(toImmutableList()); }

Target:
public List<SchemaTableName> listTables(ConnectorSession session, String schemaNameOrNull) { return tables.listSystemTables(session).stream() .map(SystemTable::getTableMetadata) .map(ConnectorTableMetadata::getTable) .filter(table -> schemaNameOrNull == null || table.getSchemaName().equals(schemaNameOrNull)) .collect(toImmutableList()); }
Source:
protected void initAndTest() { for (MultimapCache<String, String> mc : multimapCacheCluster.values()) { await(mc.size().thenAccept(s -> assertEquals(0, s.intValue()))); } await(multimapCacheCluster.values().iterator().next().put("names", "oihana")); assertOnAllCachesAndOwnership("names", "oihana"); }

Target:
protected void initAndTest() { assertMultimapCacheSize(multimapCacheCluster, 0); putValuesOnMultimapCache(getMultimapCacheMember(), NAMES_KEY, OIHANA); assertValuesAndOwnership(NAMES_KEY, OIHANA); }
Source:
static Iterator<SerializableFST> transform(Iterator<String> iterator) throws IOException { BytesRefSorter sorter = new InMemorySorter(Comparator.naturalOrder()); while (iterator.hasNext()) { sorter.add(new BytesRef(iterator.next())); } FST<Object> automaton = buildAutomaton(sorter); return automaton == null ? Iterators.emptyIterator() : Collections.singletonList(new SerializableFST(automaton)).iterator(); }

Target:
public static Iterator<SerializableFST> transform(Iterator<String> iterator) throws IOException { BytesRefSorter sorter = new InMemorySorter(Comparator.naturalOrder()); while (iterator.hasNext()) { sorter.add(new BytesRef(iterator.next())); } FST<Object> automaton = buildAutomaton(sorter); return automaton == null ? Iterators.emptyIterator() : Collections.singletonList(new SerializableFST(automaton)).iterator(); }
Source:
protected void addInInterceptorCorrectingInterceptors(ServerFactoryBean sfb) { if (isProxy() && isProxyEnvelope() && CxfUtils.interceptorOfClassIsPresent(sfb.getInInterceptors(), SAAJInInterceptor.class)) { sfb.getInInterceptors().add(new SAAJEnvelopeCorrectionInterceptor()); } }

Target:
protected void addInInterceptorCorrectingInterceptors(ServerFactoryBean sfb) { if (isProxy() && isProxyEnvelope() && interceptorOfClassIsPresent(sfb.getInInterceptors(), SAAJInInterceptor.class)) { sfb.getInInterceptors().add(new SAAJEnvelopeCorrectionInterceptor()); } }
Source:
public AdvancedInsightEndpoint(HttpWrapper httpWrapper, String baseUri) { super(httpWrapper); uri = baseUri + "/ni/advanced/json"; }

Target:
public AdvancedInsightEndpoint(HttpWrapper httpWrapper, String baseUri) { super(httpWrapper); uri = baseUri + DEFAULT_PATH; }
Source:
private static synchronized void notifyErrorHandler(int errorCode, String errorMessage, @Nullable String path) { if (Util.isEmptyString(path)) { for (SyncSession syncSession : sessions.values()) { try { syncSession.notifySessionError(errorCode, errorMessage); } catch (Exception exception) { RealmLog.error(exception); } } } else { SyncSession syncSession = sessions.get(path); if (syncSession != null) { try { syncSession.notifySessionError(errorCode, errorMessage); } catch (Exception exception) { RealmLog.error(exception); } } } }

Target:
private static synchronized void notifyErrorHandler(int errorCode, String errorMessage, @Nullable String path) { if (Util.isEmptyString(path)) { for (SyncSession syncSession : sessions.values()) { try { syncSession.notifySessionError(errorCode, errorMessage); } catch (Exception exception) { RealmLog.error(exception); } } } else { SyncSession syncSession = sessions.get(path); if (syncSession != null) { try { syncSession.notifySessionError(errorCode, errorMessage); } catch (Exception exception) { RealmLog.error(exception); } } else { RealmLog.warn("Cannot find the SyncSession corresponding to the path: " + path); } } }
Source:
void shareFreeList(final BlockRevQueue q) { q.shareFreeList(pending); }

Target:
void shareFreeList(final BlockRevQueue q) { pending.shareFreeList(q); }
Source:
public void removeIndex( final String typeName, final String indexName ) throws IllegalStateException { final short adapterId = internalAdapterStore.getAdapterId(typeName); final AdapterToIndexMapping adapterIndexMap = indexMappingStore.getIndicesForAdapter(adapterId); if (adapterIndexMap == null) { throw new IllegalArgumentException( "No adapter with typeName " + typeName + "could be found."); } final String[] indexNames = adapterIndexMap.getIndexNames(); if (indexNames.length == 1) { throw new IllegalStateException( "Index removal failed. Adapters require at least one index."); } baseOperations.deleteAll( indexName, "", adapterId); Short[] adapters = getAdaptersForIndex(indexName); if (adapters.length == 1) indexStore.removeIndex(indexName); indexMappingStore.remove( adapterId, indexName); }

Target:
public void removeIndex( final String typeName, final String indexName ) throws IllegalStateException { final short adapterId = internalAdapterStore.getAdapterId(typeName); final AdapterToIndexMapping adapterIndexMap = indexMappingStore.getIndicesForAdapter(adapterId); if (adapterIndexMap == null) { throw new IllegalArgumentException( "No adapter with typeName " + typeName + "could be found."); } final String[] indexNames = adapterIndexMap.getIndexNames(); if (indexNames.length == 1) { throw new IllegalStateException( "Index removal failed. Adapters require at least one index."); } baseOperations.deleteAll( indexName, typeName, adapterId); final Short[] adapters = getAdaptersForIndex(indexName); if (adapters.length == 1) { indexStore.removeIndex(indexName); } indexMappingStore.remove( adapterId, indexName); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { if (drawerToggle.onOptionsItemSelected(item)) { drawerLayout.closeDrawer(GravityCompat.END); return true; } switch (item.getItemId()) { case android.R.id.home: getSupportFragmentManager().popBackStack(NARROW, FragmentManager.POP_BACK_STACK_INCLUSIVE); break; case R.id.search: if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Search Zulip"); final EditText editText = new EditText(this); builder.setView(editText); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface dialogInterface, int i) { String query = editText.getText().toString(); doNarrow(new NarrowFilterSearch(query)); } }); builder.show(); } break; case R.id.refresh: Log.w("menu", "Refreshed manually by user. We shouldn't need this."); onRefresh(); break; case R.id.menu_realm: FragmentManager fm = getSupportFragmentManager(); RealmDialog dialogFragment = RealmDialog.newInstance(); dialogFragment.show(fm, "fragment_realm"); break; case R.id.logout: logout(); break; case R.id.legal: openLegal(); break; default: return super.onOptionsItemSelected(item); } return true; }

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (drawerToggle.onOptionsItemSelected(item)) { drawerLayout.closeDrawer(GravityCompat.END); return true; } switch (item.getItemId()) { case android.R.id.home: getSupportFragmentManager().popBackStack(NARROW, FragmentManager.POP_BACK_STACK_INCLUSIVE); break; case R.id.search: if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Search Zulip"); final EditText editText = new EditText(this); builder.setView(editText); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick( DialogInterface dialogInterface, int i) { String query = editText.getText().toString(); doNarrow(new NarrowFilterSearch(query)); } }); builder.show(); } break; case R.id.daynight: switch (AppCompatDelegate.getDefaultNightMode()) { case -1: case AppCompatDelegate.MODE_NIGHT_NO: setNightMode(AppCompatDelegate.MODE_NIGHT_YES); break; case AppCompatDelegate.MODE_NIGHT_YES: setNightMode(AppCompatDelegate.MODE_NIGHT_NO); break; default: setNightMode(AppCompatDelegate.MODE_NIGHT_NO); break; } break; case R.id.refresh: Log.w("menu", "Refreshed manually by user. We shouldn't need this."); onRefresh(); break; case R.id.today: doNarrow(new NarrowFilterToday()); case R.id.menu_realm: FragmentManager fm = getSupportFragmentManager(); RealmDialog dialogFragment = RealmDialog.newInstance(); dialogFragment.show(fm, "fragment_realm"); break; case R.id.logout: logout(); break; case R.id.legal: openLegal(); break; default: return super.onOptionsItemSelected(item); } return true; }
Source:
private Optional<String> getGitReviewBranchName() { Optional<String> branchName = Optional.absent(); DataContext dataContext = DataManager.getInstance().getDataContext(this); Optional<Project> openedProject = dataContext != null ? Optional.fromNullable(CommonDataKeys.PROJECT.getData(dataContext)) : Optional.<Project>absent(); if (openedProject.isPresent()) { String gitReviewFilePath = Joiner.on(File.separator).join( openedProject.get().getBasePath(), GITREVIEW_FILENAME); File gitReviewFile = new File(gitReviewFilePath); if (gitReviewFile.exists() && gitReviewFile.isFile()) { FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(gitReviewFilePath); Properties properties = new Properties(); properties.load(fileInputStream); branchName = Optional.fromNullable(properties.getProperty("defaultbranch")); if (branchName.isPresent() && branchName.get().isEmpty()) { return Optional.absent(); } } catch (IOException e) { } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { } } } } } return branchName; }

Target:
private Optional<String> getGitReviewBranchName() { Optional<String> branchName = Optional.absent(); DataContext dataContext = DataManager.getInstance().getDataContext(this); Optional<Project> openedProject = dataContext != null ? Optional.fromNullable(CommonDataKeys.PROJECT.getData(dataContext)) : Optional.<Project>absent(); if (openedProject.isPresent()) { String gitReviewFilePath = Joiner.on(File.separator).join( openedProject.get().getBasePath(), GITREVIEW_FILENAME); File gitReviewFile = new File(gitReviewFilePath); if (gitReviewFile.exists() && gitReviewFile.isFile()) { FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(gitReviewFilePath); Properties properties = new Properties(); properties.load(fileInputStream); branchName = Optional.fromNullable(Strings.emptyToNull(properties.getProperty("defaultbranch"))); } catch (IOException e) { } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { } } } } } return branchName; }
Source:
public byte[] getBody() throws AuthFailureError { VolleyLog.e(mBodyContent); if (mBodyContent == null) { return super.getBody(); } return mBodyContent.getBytes(); }

Target:
public byte[] getBody() throws AuthFailureError { if (mBodyContent == null) { return super.getBody(); } return mBodyContent.getBytes(); }
Source:
public void onError(Throwable error) { LOGGER.error(sessionName() + " error", error); if (error instanceof MessageTooLargeException) { LOGGER.error("You can set Java system property 'go.websocket.max.text.message.size' to increase limit"); } }

Target:
public void onError(Throwable error) { LOGGER.error(sessionName() + " error", error); if (error instanceof MessageTooLargeException) { LOGGER.error("You can set Java system property '" + SystemEnvironment.GO_WEBSOCKET_MAX_MESSAGE_SIZE.propertyName() + "' to increase limit"); } }
Source:
private static Supplier<ClientRegistration.Builder> oidc(URI issuer) { URI uri = UriComponentsBuilder.fromUri(issuer) .replacePath(issuer.getPath() + OIDC_METADATA_PATH).build(Collections.emptyMap()); return () -> { RequestEntity<Void> request = RequestEntity.get(uri).build(); Map<String, Object> configuration = rest.exchange(request, typeReference).getBody(); OIDCProviderMetadata metadata = parse(configuration, OIDCProviderMetadata::parse); validateJwksUri(metadata); return withProviderConfiguration(metadata, issuer.toASCIIString()) .jwkSetUri(metadata.getJWKSetURI().toASCIIString()) .userInfoUri(metadata.getUserInfoEndpointURI().toASCIIString()); }; }

Target:
private static Supplier<ClientRegistration.Builder> oidc(URI issuer) { URI uri = UriComponentsBuilder.fromUri(issuer) .replacePath(issuer.getPath() + OIDC_METADATA_PATH).build(Collections.emptyMap()); return () -> { RequestEntity<Void> request = RequestEntity.get(uri).build(); Map<String, Object> configuration = rest.exchange(request, typeReference).getBody(); OIDCProviderMetadata metadata = parse(configuration, OIDCProviderMetadata::parse); return withProviderConfiguration(metadata, issuer.toASCIIString()) .jwkSetUri(metadata.getJWKSetURI().toASCIIString()) .userInfoUri(metadata.getUserInfoEndpointURI().toASCIIString()); }; }