auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void cleanup(WorkspaceServiceClient workspaceServiceClient) { final Storage localStorage = Storage.getLocalStorageIfSupported(); if (localStorage == null) { return; } for (int i = 0; i < localStorage.getLength(); i++) { String key = localStorage.key(i); if (key != null && key.startsWith(LOCAL_STORAGE_DEBUGGER_STATES_KEY_PREFIX)) { String workspaceId = key.substring(LOCAL_STORAGE_DEBUGGER_STATES_KEY_PREFIX.length()); Promise<WorkspaceDto> workspace = workspaceServiceClient.getWorkspace(workspaceId); workspace.catchError(error -> { localStorage.removeItem(key); }); } } }

Target:
private void cleanup(WorkspaceServiceClient workspaceServiceClient) { if (localStorage == null) { return; } for (int i = 0; i < localStorage.getLength(); i++) { String key = localStorage.key(i); if (key != null && key.startsWith(LOCAL_STORAGE_DEBUGGER_STATES_KEY_PREFIX)) { String workspaceId = key.substring(LOCAL_STORAGE_DEBUGGER_STATES_KEY_PREFIX.length()); Promise<WorkspaceDto> workspace = workspaceServiceClient.getWorkspace(workspaceId); workspace.catchError(error -> { localStorage.removeItem(key); }); } } }
Source:
default boolean isCreated() { if (getContainerId() == null) { return false; } try { String status = getCurrentContainerInfo().getState().getStatus(); return status != null & !status.isEmpty(); } catch (DockerException e) { return false; } }

Target:
default boolean isCreated() { if (getContainerId() == null) { return false; } try { String status = getCurrentContainerInfo().getState().getStatus(); return !Strings.isNullOrEmpty(status); } catch (DockerException e) { return false; } }
Source:
public boolean renewLease(String leaseId) { try { leaseBlob.renewLease(AccessCondition.generateLeaseCondition(leaseId)); return true; } catch (StorageException e) { LOG.error("Wasn't able to renew lease.", new SamzaException(e)); return false; } }

Target:
public boolean renewLease(String leaseId) { try { leaseBlob.renewLease(AccessCondition.generateLeaseCondition(leaseId)); return true; } catch (StorageException storageException) { LOG.error("Wasn't able to renew lease with lease id: " + leaseId, storageException); return false; } }
Source:
public void testGetDescriptors() { DescriptorRegistry registry = new DescriptorRegistry(); registry.register(TARGET, EP, new TestDescriptor("id1", "name1", "desc1")); registry.register(TARGET, EP, new TestDescriptor("id1", "name11", "desc1")); registry.register(TARGET, EP, new TestDescriptor("id1", null, "desc11")); registry.register(TARGET, EP, new TestDescriptor("id2", "name2", "desc2")); registry.register(TARGET, EP, new TestDescriptor("id2", "name22", "desc2")); registry.register(TARGET, EP, new TestDescriptor("id2", null, "desc22")); List<TestDescriptor> descs = registry.getDescriptors(TARGET, EP); Assert.assertEquals(2, descs.size()); assertValues(descs.get(0), "id1", "name11", "desc11"); assertValues(descs.get(1), "id2", "name22", "desc22"); }

Target:
public void testGetDescriptors() { DescriptorRegistry registry = new DescriptorRegistry(); registry.register(TARGET, EP, new TestDescriptor("id1", "name1", "desc1")); registry.register(TARGET, EP, new TestDescriptor("id1", "name11", "desc1")); registry.register(TARGET, EP, new TestDescriptor("id1", null, "desc11")); registry.register(TARGET, EP, new TestDescriptor("id2", "name2", "desc2")); registry.register(TARGET, EP, new TestDescriptor("id2", "name22", "desc2")); registry.register(TARGET, EP, new TestDescriptor("id2", null, "desc22")); List<TestDescriptor> descs = registry.getDescriptors(TARGET, EP); assertEquals(2, descs.size()); assertValues(descs.get(0), "id1", "name11", "desc11"); assertValues(descs.get(1), "id2", "name22", "desc22"); }
Source:
public int getMaxConcurrentTask() { return _record.getIntField(InstanceConfigProperty.MAX_CONCURRENT_TASK.toString(), DEFAULT_MAX_CONCURRENT_TASK); }

Target:
public int getMaxConcurrentTask() { return _record.getIntField(InstanceConfigProperty.MAX_CONCURRENT_TASK.toString(), MAX_CONCURRENT_TASK_NOT_SET); }
Source:
public ICompletionProposal[] parameterProposals(IType expectedType, String paramName, Position pos, List<IBinding> suggestions, boolean isLastParameter) throws CModelException { List<Variable> typeMatches = evaluateVisibleMatches(expectedType, suggestions); typeMatches = removeDuplicates(typeMatches); orderMatches(typeMatches, paramName); ICompletionProposal[] ret = new ICompletionProposal[typeMatches.size()]; int i = 0; int replacementLength = 0; for (Variable v : typeMatches) { if (i == 0) { fAlreadyMatchedNames.add(v.name); replacementLength = v.name.length(); } String displayString = v.name; final char[] triggers; if (isLastParameter) { triggers = v.triggerChars; } else { triggers = new char[v.triggerChars.length + 1]; System.arraycopy(v.triggerChars, 0, triggers, 0, v.triggerChars.length); triggers[triggers.length - 1] = ','; } ret[i++] = new PositionBasedCompletionProposal(v.name, pos, replacementLength, getImage(v.descriptor), displayString, null, null, triggers); } return ret; }

Target:
public ICompletionProposal[] parameterProposals(IType expectedType, String paramName, Position pos, List<IBinding> suggestions, boolean isLastParameter) throws CModelException { List<Variable> typeMatches = evaluateVisibleMatches(expectedType, suggestions); orderMatches(typeMatches, paramName); ICompletionProposal[] ret = new ICompletionProposal[typeMatches.size()]; int i = 0; int replacementLength = 0; for (Variable v : typeMatches) { if (i == 0) { fAlreadyMatchedNames.add(v.name); replacementLength = v.name.length(); } String displayString = v.name; final char[] triggers; if (isLastParameter) { triggers = v.triggerChars; } else { triggers = new char[v.triggerChars.length + 1]; System.arraycopy(v.triggerChars, 0, triggers, 0, v.triggerChars.length); triggers[triggers.length - 1] = ','; } ret[i++] = new PositionBasedCompletionProposal(v.name, pos, replacementLength, getImage(v.descriptor), displayString, null, null, triggers); } return ret; }
Source:
private String recreateFullRequestUrl(HttpServletRequest request) { StringBuffer requestURL = request.getRequestURL(); try { URL url = new URL(requestURL.toString()); if (url.getHost().equals(SystemBaseUrl.EXTERNAL.getHost()) && String.valueOf(url.getPort()).equals(SystemBaseUrl.EXTERNAL.getPort())) { requestURL = new StringBuffer(SystemBaseUrl.EXTERNAL.constructUrl(request.getRequestURI())); } } catch (MalformedURLException e) { LOGGER.debug("Unable to convert request URL to URL object."); } String queryString = request.getQueryString(); if (queryString == null) { return requestURL.toString(); } else { return requestURL.append('?').append(queryString).toString(); } }

Target:
private String recreateFullRequestUrl(HttpServletRequest request) { StringBuffer requestURL = request.getRequestURL(); try { URL url = new URL(requestURL.toString()); if (url.getHost().equals(SystemBaseUrl.EXTERNAL.getHost()) && String.valueOf(url.getPort()).equals(SystemBaseUrl.EXTERNAL.getPort()) && !url.getPath().startsWith(SystemBaseUrl.EXTERNAL.getRootContext())) { requestURL = new StringBuffer(SystemBaseUrl.EXTERNAL.constructUrl(request.getRequestURI())); } } catch (MalformedURLException e) { LOGGER.error("Unable to convert request URL to URL object."); } String queryString = request.getQueryString(); if (queryString == null) { return requestURL.toString(); } else { return requestURL.append('?').append(queryString).toString(); } }
Source:
static TfvcClient getInstance(@NotNull Project project) { boolean useReactiveClient = "true".equals( PropertyService.getInstance().getProperty(PropertyService.PROP_TFVC_USE_REACTIVE_CLIENT)); return useReactiveClient ? ServiceManager.getService(project, ReactiveTfvcClient.class) : ServiceManager.getService(project, ClassicTfvcClient.class); }

Target:
static TfvcClient getInstance(@NotNull Project project) { boolean useReactiveClient = "true".equalsIgnoreCase( PropertyService.getInstance().getProperty(PropertyService.PROP_TFVC_USE_REACTIVE_CLIENT)); return useReactiveClient ? ServiceManager.getService(project, ReactiveTfvcClient.class) : ServiceManager.getService(project, ClassicTfvcClient.class); }
Source:
public static String[] splitRpmToParts(String rpmName) { int lastDashIndex = rpmName.lastIndexOf('-'); if (lastDashIndex == -1) { throw new IllegalArgumentException(INVALID_RPM_NAME_FORMAT); } char[] chars = rpmName.toCharArray(); int beforeLastDashIndex = lastDashIndex - 1; for (; beforeLastDashIndex >= 0; beforeLastDashIndex--) { if (chars[beforeLastDashIndex] == '-') { break; } } if (beforeLastDashIndex == -1) { throw new IllegalArgumentException(INVALID_RPM_NAME_FORMAT); } String[] parts = new String[3]; parts[0] = rpmName.substring(0, beforeLastDashIndex); parts[1] = rpmName.substring(beforeLastDashIndex + 1, lastDashIndex); parts[2] = rpmName.substring(lastDashIndex + 1); return parts; }

Target:
public static String[] splitRpmToParts(String rpmName) { int lastDashIndex = rpmName.lastIndexOf('-'); if (lastDashIndex == -1) { throw new IllegalArgumentException(INVALID_RPM_NAME_FORMAT); } char[] chars = rpmName.toCharArray(); int beforeLastDashIndex = lastDashIndex - 1; while (beforeLastDashIndex >= 0) { if (chars[beforeLastDashIndex] == '-') { break; } beforeLastDashIndex--; } if (beforeLastDashIndex == -1) { throw new IllegalArgumentException(INVALID_RPM_NAME_FORMAT); } String[] parts = new String[3]; parts[0] = rpmName.substring(0, beforeLastDashIndex); parts[1] = rpmName.substring(beforeLastDashIndex + 1, lastDashIndex); parts[2] = rpmName.substring(lastDashIndex + 1); return parts; }
Source:
public void testRetainAll1() throws Exception { intSet.add(1); intSet.add(4); intSet.add(7); assertEquals(3, intSet.size()); IntSet rs = new RangeSet(5); assertTrue(intSet.retainAll(rs)); assertEquals(2, intSet.size()); assertTrue(intSet.contains(1)); assertTrue(intSet.contains(4)); }

Target:
public void testRetainAll1() throws Exception { intSet.add(1); intSet.add(4); intSet.add(7); assertEquals(3, intSet.size()); IntSet rs = new RangeSet(5); assertTrue(intSet.retainAll(rs)); assertEquals(CollectionFactory.makeSet(1, 4), intSet); }
Source:
protected JdbcDeserializationConverter createInternalConverter(LogicalType type) { switch (type.getTypeRoot()) { case NULL: return (val, sqlType, unsigned) -> null; case BOOLEAN: case FLOAT: case DOUBLE: case INTERVAL_YEAR_MONTH: case INTERVAL_DAY_TIME: return (val, sqlType, unsigned) -> val; case TINYINT: return (val, sqlType, unsigned) -> ((Integer) val).byteValue(); case SMALLINT: return (val, sqlType, unsigned) -> (Integer.valueOf(val.toString())).shortValue(); case INTEGER: return (val, sqlType, unsigned) -> sqlType == Types.SMALLINT && unsigned ? Integer.valueOf(val.toString()) : val; case BIGINT: return (val, sqlType, unsigned) -> sqlType == Types.INTEGER && unsigned ? Long.valueOf(val.toString()) : val; case DECIMAL: final int precision = ((DecimalType) type).getPrecision(); final int scale = ((DecimalType) type).getScale(); return (val, sqlType, unsigned) -> sqlType == Types.BIGINT && unsigned ? DecimalData.fromBigDecimal(new BigDecimal((BigInteger) val, 0), 20, 0) : DecimalData.fromBigDecimal((BigDecimal) val, precision, scale); case DATE: return (val, sqlType, unsigned) -> (int) (((Date) val).toLocalDate().toEpochDay()); case TIME_WITHOUT_TIME_ZONE: return (val, sqlType, unsigned) -> (int) (((Time) val).toLocalTime().toNanoOfDay() / 1_000_000L); case TIMESTAMP_WITH_TIME_ZONE: case TIMESTAMP_WITHOUT_TIME_ZONE: return (val, sqlType, unsigned) -> TimestampData.fromTimestamp((Timestamp) val); case CHAR: case VARCHAR: return (val, sqlType, unsigned) -> StringData.fromString((String) val); case BINARY: case VARBINARY: return (val, sqlType, unsigned) -> (byte[]) val; case ARRAY: case ROW: case MAP: case MULTISET: case RAW: default: throw new UnsupportedOperationException("Unsupported type:" + type); } }

Target:
protected JdbcDeserializationConverter createInternalConverter(LogicalType type) { switch (type.getTypeRoot()) { case NULL: return val -> null; case BOOLEAN: case FLOAT: case DOUBLE: case INTERVAL_YEAR_MONTH: case INTERVAL_DAY_TIME: return val -> val; case TINYINT: return val -> ((Integer) val).byteValue(); case SMALLINT: return val -> val instanceof Integer ? ((Integer) val).shortValue() : val; case INTEGER: return val -> val; case BIGINT: return val -> val; case DECIMAL: final int precision = ((DecimalType) type).getPrecision(); final int scale = ((DecimalType) type).getScale(); return val -> val instanceof BigInteger ? DecimalData.fromBigDecimal(new BigDecimal((BigInteger) val, 0), precision, scale) : DecimalData.fromBigDecimal((BigDecimal) val, precision, scale); case DATE: return val -> (int) (((Date) val).toLocalDate().toEpochDay()); case TIME_WITHOUT_TIME_ZONE: return val -> (int) (((Time) val).toLocalTime().toNanoOfDay() / 1_000_000L); case TIMESTAMP_WITH_TIME_ZONE: case TIMESTAMP_WITHOUT_TIME_ZONE: return val -> TimestampData.fromTimestamp((Timestamp) val); case CHAR: case VARCHAR: return val -> StringData.fromString((String) val); case BINARY: case VARBINARY: return val -> (byte[]) val; case ARRAY: case ROW: case MAP: case MULTISET: case RAW: default: throw new UnsupportedOperationException("Unsupported type:" + type); } }
Source:
public Integer call() throws Exception { final Object ysoserial = payload.getPayloadClass().newInstance().getObject(command); try { Channel.current().call(new Callable<String, Exception>() { private static final long serialVersionUID = 1L; @Override public String call() throws Exception { return ysoserial.toString(); } @Override public void checkRoles(RoleChecker checker) throws SecurityException { } }); } catch (Exception ex) { ex.printStackTrace(); Throwable cause = ex; while (cause.getCause() != null) { cause = cause.getCause(); } if (cause instanceof SecurityException) { if (cause.getMessage().contains("Rejected")) { return PayloadCaller.EXIT_CODE_REJECTED; } else { throw ex; } } final String message = cause.getMessage(); if (message != null && message.contains("cannot be cast to java.util.Set")) { return EXIT_CODE_ASSIGNMENT_ISSUE; } else { throw ex; } } return EXIT_CODE_OK; }

Target:
public Integer call() throws Exception { final Object ysoserial = payload.getPayloadClass().newInstance().getObject(command); try { getChannelOrFail().call(new Callable<String, Exception>() { private static final long serialVersionUID = 1L; @Override public String call() throws Exception { return ysoserial.toString(); } @Override public void checkRoles(RoleChecker checker) throws SecurityException { } }); } catch (Exception ex) { ex.printStackTrace(); Throwable cause = ex; while (cause.getCause() != null) { cause = cause.getCause(); } if (cause instanceof SecurityException) { if (cause.getMessage().contains("Rejected")) { return PayloadCaller.EXIT_CODE_REJECTED; } else { throw ex; } } final String message = cause.getMessage(); if (message != null && message.contains("cannot be cast to java.util.Set")) { return EXIT_CODE_ASSIGNMENT_ISSUE; } else { throw ex; } } return EXIT_CODE_OK; }
Source:
public void testWebServiceContextInject(@ArquillianResource URL deploymentUrl) throws Exception { QName serviceName = new QName("<LINK_0>", "TestService"); URL wsdlUrl = new URL(deploymentUrl.toExternalForm() + "/" + TestWSImpl.SERVICE_NAME + "?wsdl"); TestWS testService = Service.create(wsdlUrl, serviceName).getPort(TestWS.class); int workerCount = 20; ExecutorService executor = Executors.newFixedThreadPool(workerCount); List<Future<String>> results = new ArrayList<>(); try { for (int i = 0; i < workerCount; i++) { results.add(executor.submit(new Worker(testService))); } for (Future<String> result : results) { Assert.assertTrue(result.get(5, TimeUnit.SECONDS).startsWith("Hello")); } } finally { executor.shutdown(); } }

Target:
public void testWebServiceContextInject(@ArquillianResource URL deploymentUrl) throws Exception { QName serviceName = new QName("<LINK_0>", "TestService"); URL wsdlUrl = new URL(deploymentUrl.toExternalForm() + "/" + TestWSImpl.SERVICE_NAME + "?wsdl"); TestWS testService = Service.create(wsdlUrl, serviceName).getPort(TestWS.class); int workerCount = 20; ExecutorService executor = Executors.newFixedThreadPool(workerCount); List<Future<String>> results = new ArrayList<>(); try { for (int i = 0; i < workerCount; i++) { results.add(executor.submit(new Worker(testService))); } for (Future<String> result : results) { Assert.assertTrue(result.get(TimeoutUtil.adjust(5), TimeUnit.SECONDS).startsWith("Hello")); } } finally { executor.shutdown(); } }
Source:
public static AsyncRDFHandler processAsync(RDFHandler handler, boolean joinOnRDFEnd, int bufferSize) { BlockingQueue<RDFRecordedAction> queue = new ArrayBlockingQueue<>(bufferSize); AtomicReference<Throwable> replayerException = new AtomicReference<>(); RDFRecordedActionConsumer consumer = (a) -> { try { do { Throwable exc = replayerException.get(); if (exc != null) { throw new RDFHandlerException("Queue dead cannot record", exc); } } while (!queue.offer(a, 1, TimeUnit.SECONDS)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RDFHandlerException(e); } }; RDFActionsReplayer replayer = new RDFActionsReplayer(queue, handler, replayerException::set); AsyncRDFHandler recorder = new AsyncRDFHandler(consumer, replayer, joinOnRDFEnd); replayer.setUncaughtExceptionHandler((t, e) -> replayerException.set(e)); replayer.start(); return recorder; }

Target:
public static AsyncRDFHandler processAsync(RDFHandler handler, boolean joinOnRDFEnd, int bufferSize) { BlockingQueue<RDFRecordedAction> queue = new ArrayBlockingQueue<>(bufferSize); AtomicReference<Throwable> replayerException = new AtomicReference<>(); RDFRecordedActionConsumer consumer = (a) -> { try { do { Throwable exc = replayerException.get(); if (exc != null) { throw new RDFHandlerException("Queue dead cannot record", exc); } } while (!queue.offer(a, 1, SECONDS)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RDFHandlerException(e); } }; RDFActionsReplayer replayer = new RDFActionsReplayer(queue, handler, replayerException::set); AsyncRDFHandler recorder = new AsyncRDFHandler(consumer, replayer, joinOnRDFEnd); replayer.setUncaughtExceptionHandler((t, e) -> replayerException.set(e)); replayer.start(); return recorder; }
Source:
public BeaconOrganizationImpl() { this.setId(ID); this.setName(NAME); this.setDescription(DESCRIPTION); this.setAddress(ADDRESS); this.setWelcomeUrl(WELCOME_URL); this.setContactUrl(CONTACT_URL); this.setLogoUrl(LOGO_URL); }

Target:
public BeaconOrganizationImpl() { setId(ID); setName(NAME); setDescription(DESCRIPTION); setAddress(ADDRESS); setWelcomeUrl(WELCOME_URL); setContactUrl(CONTACT_URL); setLogoUrl(LOGO_URL); }
Source:
private void logMetrics() { try { Thread.sleep(METRIC_INIT_DELAY_MS); while (true) { Thread.sleep(metricsWindowMs); final double totalPullTime = getTotalProcTime(pullStats); final double totalPushTime = getTotalProcTime(pushStats); final double totalReqProcTime = getTotalProcTime(requestStats); final int totalPullCount = getTotalProcCount(pullStats); final int totalPushCount = getTotalProcCount(pushStats); final int totalReqCount = getTotalProcCount(requestStats); resetStats(); if (totalPullCount > 0 && totalPushCount > 0) { final ServerMetrics metricsMessage = ServerMetrics.newBuilder() .setWindowIndex(windowIndex) .setNumModelParamBlocks(0) .setMetricWindowMs(metricsWindowMs) .setTotalPullProcessingTime(totalPullTime) .setTotalPushProcessingTime(totalPushTime) .setTotalReqProcessingTime(totalReqProcTime) .setTotalPullProcessed(totalPullCount) .setTotalPushProcessed(totalPushCount) .setTotalReqProcessed(totalReqCount) .build(); LOG.log(Level.FINE, "ServerMetrics {0}", metricsMessage); } windowIndex++; } } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Exception Occurred", e); throw new RuntimeException(e); } }

Target:
private void logMetrics() { try { Thread.sleep(METRIC_INIT_DELAY_MS); while (true) { Thread.sleep(metricsWindowMs); final double totalPullTime = getTotalProcTime(pullStats); final double totalPushTime = getTotalProcTime(pushStats); final double totalReqProcTime = getTotalProcTime(requestStats); final int totalPullCount = getTotalProcCount(pullStats); final int totalPushCount = getTotalProcCount(pushStats); final int totalReqCount = getTotalProcCount(requestStats); resetStats(); final ServerMetrics metricsMessage = ServerMetrics.newBuilder() .setWindowIndex(windowIndex) .setNumModelBlocks(0) .setMetricWindowMs(metricsWindowMs) .setTotalPullProcessingTime(totalPullTime) .setTotalPushProcessingTime(totalPushTime) .setTotalReqProcessingTime(totalReqProcTime) .setTotalPullProcessed(totalPullCount) .setTotalPushProcessed(totalPushCount) .setTotalReqProcessed(totalReqCount) .build(); LOG.log(Level.FINE, "ServerMetrics {0}", metricsMessage); windowIndex++; } } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Exception Occurred", e); throw new RuntimeException(e); } }
Source:
private Response addPatients(final String json) { final JSONArray jsonArray; try { jsonArray = new JSONArray(json); } catch (JSONException ex) { throw new WebApplicationException(Status.BAD_REQUEST); } final int jsonArrayLength = jsonArray.length(); for (int i = 0; i < jsonArrayLength; i++) { JSONObject jsonObject = jsonArray.optJSONObject(i); if (jsonObject == null) { logger.warn("One of the members of the patient JSONArray is null."); continue; } Patient patient = this.repository.create(); patient.updateFromJSON(jsonObject); } final URI targetURI = UriBuilder.fromUri(this.uriInfo.getBaseUri()).build(); final ResponseBuilder response = Response.created(targetURI); return response.build(); }

Target:
private Response addPatients(final String json) { final JSONArray patientsData; final JSONArray createdPatientUri = new JSONArray(); try { patientsData = new JSONArray(json); } catch (JSONException ex) { throw new WebApplicationException(Status.BAD_REQUEST); } final int jsonArrayLength = patientsData.length(); for (int i = 0; i < jsonArrayLength; i++) { JSONObject jsonObject = patientsData.optJSONObject(i); if (jsonObject == null) { logger.warn("One of the members of the patient JSONArray is null."); continue; } Patient patient = this.repository.create(); patient.updateFromJSON(jsonObject); final URI targetURI = UriBuilder.fromUri(this.uriInfo.getBaseUri()) .path(PatientResource.class) .build(patient.getId()); createdPatientUri.put(targetURI); } final ResponseBuilder response = Response.created(null); response.entity(createdPatientUri.toString()); return response.build(); }
Source:
public void onNewIntent(Intent intent) { super.onNewIntent(intent); handleActions(intent); }

Target:
public void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); }
Source:
public int getCurrentRunningCount() { int startPoolSize = currentPoolSize.get(); int initialCount = 0; int initialChainValue = CHAIN_VERIFICATION_START_VAL; while (true) { if (initialCount == 0) { Worker idleWorker = this.idleWorker.get(); while (idleWorker != null) { initialCount++; initialChainValue ^= idleWorker.hashCode(); idleWorker = idleWorker.nextIdleWorker; } } int verificationCount = 0; int verificationChainValue = CHAIN_VERIFICATION_START_VAL; Worker idleWorker = this.idleWorker.get(); while (idleWorker != null) { verificationCount++; verificationChainValue ^= idleWorker.hashCode(); idleWorker = idleWorker.nextIdleWorker; } if (currentPoolSize.get() == startPoolSize && verificationChainValue == initialChainValue && verificationCount == initialCount) { return startPoolSize - initialCount; } else if (currentPoolSize.get() == startPoolSize) { initialCount = verificationCount; initialChainValue = verificationChainValue; } else { startPoolSize = currentPoolSize.get(); initialCount = 0; initialChainValue = CHAIN_VERIFICATION_START_VAL; } } }

Target:
public int getCurrentRunningCount() { while (true) { int poolSize = currentPoolSize.get(); int result = poolSize - idleWorkerCount.get(); if (poolSize == currentPoolSize.get()) { return result; } } }
Source:
public CategoryTreeRefreshController(final CategoriesSettings categoriesSettings, final CacheApi cacheApi, final HomeReverseRouter homeReverseRouter) { this.configuration = categoriesSettings; this.cacheApi = cacheApi; this.homeReverseRouter = homeReverseRouter; }

Target:
public CategoryTreeRefreshController(final CategoriesSettings categoriesSettings, final CacheApi cacheApi, final HomeReverseRouter homeReverseRouter) { this.categoriesSettings = categoriesSettings; this.cacheApi = cacheApi; this.homeReverseRouter = homeReverseRouter; }
Source:
public void testNewQuestionFrame() { ______TS("MSQ: new question (frame) link"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MSQ"); assertTrue(feedbackEditPage.verifyNewMsqQuestionFormIsDisplayed()); feedbackEditPage.clickGenerateMsqOptionsCheckbox(-1); assertFalse(feedbackEditPage.isElementVisible("msqChoiceTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); ______TS("MSQ: Check UI after cancelling"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MSQ"); assertTrue(feedbackEditPage.verifyNewMsqQuestionFormIsDisplayed()); assertFalse(feedbackEditPage.isElementVisible("msqChoiceTable--1")); assertTrue(feedbackEditPage.isElementEnabled("msqGenerateForSelect--1")); feedbackEditPage.clickGenerateMsqOptionsCheckbox(-1); }

Target:
public void testNewQuestionFrame() { ______TS("MSQ: new question (frame) link"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MSQ"); assertTrue(feedbackEditPage.verifyNewMsqQuestionFormIsDisplayed()); ______TS("MSQ: Check UI after cancelling and add new MSQ question again"); feedbackEditPage.clickGenerateMsqOptionsCheckbox(NEW_QUESTION_INDEX); assertFalse(feedbackEditPage.isElementVisible("msqChoiceTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.selectNewQuestionType("MSQ"); assertTrue(feedbackEditPage.verifyNewMsqQuestionFormIsDisplayed()); assertFalse(feedbackEditPage.isElementVisible("msqChoiceTable--1")); assertTrue(feedbackEditPage.isElementEnabled("msqGenerateForSelect--1")); feedbackEditPage.clickGenerateMsqOptionsCheckbox(NEW_QUESTION_INDEX); }
Source:
ManagedIdentityCredential(String clientId, IdentityClientOptions identityClientOptions) { IdentityClient identityClient = new IdentityClientBuilder() .clientId(clientId) .identityClientOptions(identityClientOptions) .build(); Configuration configuration = Configuration.getGlobalConfiguration().clone(); if (configuration.contains(Configuration.PROPERTY_MSI_ENDPOINT) || configuration.contains(PROPERTY_IDENTITY_ENDPOINT)) { appServiceMSICredential = new AppServiceMsiCredential(clientId, identityClient); virtualMachineMSICredential = null; } else { virtualMachineMSICredential = new VirtualMachineMsiCredential(clientId, identityClient); appServiceMSICredential = null; } LoggingUtil.logAvailableEnvironmentVariables(logger, configuration); }

Target:
ManagedIdentityCredential(String clientId, IdentityClientOptions identityClientOptions) { IdentityClient identityClient = new IdentityClientBuilder() .clientId(clientId) .identityClientOptions(identityClientOptions) .build(); Configuration configuration = Configuration.getGlobalConfiguration().clone(); if (configuration.contains(Configuration.PROPERTY_MSI_ENDPOINT) || (configuration.contains(PROPERTY_IDENTITY_ENDPOINT) && configuration.contains(PROPERTY_IDENTITY_HEADER))) { appServiceMSICredential = new AppServiceMsiCredential(clientId, identityClient); virtualMachineMSICredential = null; } else { virtualMachineMSICredential = new VirtualMachineMsiCredential(clientId, identityClient); appServiceMSICredential = null; } LoggingUtil.logAvailableEnvironmentVariables(logger, configuration); }
Source:
public Future<String> convert(RestRequest restRequest, String input, Callback<String> callback) { FutureResult<String> futureResult = new FutureResult<String>(); String convertedId = null; Exception exception = null; long startTimeInMs = System.currentTimeMillis(); frontendMetrics.idConverterRequestRate.mark(); if (!isOpen) { exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); } else { convertedId = input; } futureResult.done(convertedId, exception); if (callback != null) { callback.onCompletion(convertedId, exception); } frontendMetrics.idConverterRequestProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); return futureResult; }

Target:
public Future<String> convert(RestRequest restRequest, String input, Callback<String> callback) { FutureResult<String> futureResult = new FutureResult<String>(); String convertedId = null; Exception exception = null; frontendMetrics.idConverterRequestRate.mark(); long startTimeInMs = System.currentTimeMillis(); if (!isOpen) { exception = new RestServiceException("IdConverter is closed", RestServiceErrorCode.ServiceUnavailable); } else { convertedId = input; } futureResult.done(convertedId, exception); if (callback != null) { callback.onCompletion(convertedId, exception); } frontendMetrics.idConverterRequestProcessingTimeInMs.update(System.currentTimeMillis() - startTimeInMs); return futureResult; }
Source:
@Test public void peekMultiple() { List<String> peek = queue.peek(3); assertThat(peek).containsSequence("one", "two", "three"); }

Target:
@Test public void peekMultiple() { List<String> peek = queue.peek(3); assertThat(peek).containsExactly("one", "two", "three"); }
Source:
public FileEncryptionProperties getEncryptionProperties() { return getUniformEncryptionEncryptionProperties(); }

Target:
public FileEncryptionProperties getEncryptionProperties() { return FileEncryptionProperties.builder(FOOTER_ENCRYPTION_KEY) .withFooterKeyMetadata(footerKeyMetadata).build(); }
Source:
public void start_passwordCheckerSaysNotOk_throws() { assertThrows(CryptoException.class, () -> { try (CryptoSession cryptoSession = CryptoSession.start(Optional.of(PASSWORD1), CryptoSessionTest::passwordIsNotOk)) { assertThat("Password checker inadvertently returned OK", false); } }); }

Target:
public void start_passwordCheckerSaysNotOk_throws() { assertThrows(CryptoException.class, () -> { try (CryptoSession cryptoSession = CryptoSession.start(Optional.of(PASSWORD1), CryptoSessionTest::passwordIsNotOk)) { fail("Password checker inadvertently returned OK"); } }); }
Source:
public void testBehaviorWhenReportedSizesSmall() throws Exception { File baseDir = folder.newFolder("base"); FileSmoosher smoosher = new FileSmoosher(baseDir, 21); boolean exceptionThrown = false; try (final SmooshedWriter writer = smoosher.addWithSmooshedWriter("1", 2)) { writer.write(ByteBuffer.wrap(Ints.toByteArray(1))); } catch (ISE e) { Assert.assertTrue(e.getMessage().contains("Liar!!!")); exceptionThrown = true; } Assert.assertTrue(exceptionThrown); File[] files = baseDir.listFiles(); Assert.assertEquals(1, files.length); Assert.assertEquals(0, files[0].length()); }

Target:
public void testBehaviorWhenReportedSizesSmall() throws Exception { File baseDir = folder.newFolder("base"); try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) { boolean exceptionThrown = false; try (final SmooshedWriter writer = smoosher.addWithSmooshedWriter("1", 2)) { writer.write(ByteBuffer.wrap(Ints.toByteArray(1))); } catch (ISE e) { Assert.assertTrue(e.getMessage().contains("Liar!!!")); exceptionThrown = true; } Assert.assertTrue(exceptionThrown); File[] files = baseDir.listFiles(); Assert.assertEquals(1, files.length); Assert.assertEquals(0, files[0].length()); } }
Source:
public Devfile workspaceToDevFile(WorkspaceConfigImpl wsConfig) throws WorkspaceExportException { if (wsConfig.getEnvironments().size() > 1) { throw new WorkspaceExportException( format( "Workspace '%s' cannot be converted to devfile because it contains multiple environments", wsConfig.getName())); } Devfile devfile = new Devfile().withSpecVersion(CURRENT_SPEC_VERSION).withName(wsConfig.getName()); devfile.setProjects( wsConfig .getProjects() .stream() .map(projectConverter::toDevfileProject) .collect(toCollection(ArrayList::new))); for (CommandImpl command : wsConfig.getCommands()) { devfile.getCommands().add(commandConverter.toDevfileCommand(command)); } for (ToolConverter toolConverter : toolConverters) { toolConverter.fromWorkspaceConfig(wsConfig, devfile); } return devfile; }

Target:
public Devfile workspaceToDevFile(WorkspaceConfigImpl wsConfig) throws WorkspaceExportException { if (wsConfig.getEnvironments().size() > 1) { throw new WorkspaceExportException( format( "Workspace '%s' cannot be converted to devfile because it contains multiple environments", wsConfig.getName())); } Devfile devfile = DevfileFactory.newDevfile() .withSpecVersion(CURRENT_SPEC_VERSION) .withName(wsConfig.getName()); devfile.setProjects( wsConfig .getProjects() .stream() .map(projectConverter::toDevfileProject) .collect(toCollection(ArrayList::new))); for (CommandImpl command : wsConfig.getCommands()) { devfile.getCommands().add(commandConverter.toDevfileCommand(command)); } for (ToolProvisioner toolConverter : toolProvisioners) { toolConverter.provision(devfile, wsConfig); } return devfile; }
Source:
protected InstantOperatorInfo getInstantOpInfo() { final InstantOperatorInfo.Builder iOpInfoBuilder = InstantOperatorInfo.newBuilder(); iOpInfoBuilder.setInstantOperatorType(InstantOperatorTypeEnum.AGGREGATE_WINDOW); final List<ByteBuffer> serializedObjectList = new ArrayList<>(); serializedObjectList.add(ByteBuffer.wrap(SerializationUtils.serialize(aggregateFunc))); iOpInfoBuilder.setObjects(serializedObjectList); iOpInfoBuilder.setKeyIndex(null); return iOpInfoBuilder.build(); }

Target:
protected InstantOperatorInfo getInstantOpInfo() { final InstantOperatorInfo.Builder iOpInfoBuilder = InstantOperatorInfo.newBuilder(); iOpInfoBuilder.setInstantOperatorType(InstantOperatorTypeEnum.AGGREGATE_WINDOW); final List<ByteBuffer> serializedFunctionList = new ArrayList<>(); serializedFunctionList.add(ByteBuffer.wrap(SerializationUtils.serialize(aggregateFunc))); iOpInfoBuilder.setFunctions(serializedFunctionList); iOpInfoBuilder.setKeyIndex(null); return iOpInfoBuilder.build(); }
Source:
private void executeProtocolViolationTest(EmbeddedChannel outChannel, EmbeddedChannel inChannel, int testDataLength, WebSocketCloseStatus expectedStatus, String errorMessage) { CorruptedWebSocketFrameException corrupted = null; try { testBinaryWithLen(outChannel, inChannel, testDataLength); } catch (CorruptedWebSocketFrameException e) { corrupted = e; } BinaryWebSocketFrame exceedingFrame = inChannel.readInbound(); Assert.assertNull(exceedingFrame); Assert.assertNotNull(corrupted); Assert.assertEquals(expectedStatus, corrupted.getCloseStatus()); Assert.assertEquals(errorMessage, corrupted.getMessage()); }

Target:
private void executeProtocolViolationTest(EmbeddedChannel outChannel, EmbeddedChannel inChannel, int testDataLength, WebSocketCloseStatus expectedStatus, String errorMessage) { CorruptedWebSocketFrameException corrupted = null; try { testBinaryWithLen(outChannel, inChannel, testDataLength); } catch (CorruptedWebSocketFrameException e) { corrupted = e; } BinaryWebSocketFrame exceedingFrame = inChannel.readInbound(); Assert.assertNull(exceedingFrame); Assert.assertNotNull(corrupted); Assert.assertEquals(expectedStatus, corrupted.closeStatus()); Assert.assertEquals(errorMessage, corrupted.getMessage()); }
Source:
public void testListFields() throws Exception { StringMetadataField stringField = newFieldInstance("testListFields"); addFieldToAccount(stringField); ApiResponse result = cloudinary.api().listMetadataFields(); assertNotNull(result); }

Target:
public void testListFields() throws Exception { StringMetadataField stringField = newFieldInstance("testListFields"); addFieldToAccount(stringField); ApiResponse result = cloudinary.api().listMetadataFields(); assertNotNull(result); assertNotNull(result.get("metadata_fields")); assertTrue(((List)result.get("metadata_fields")).size() > 0); }
Source:
void handle(EventEnvelope event) { checkState(isActive(), "Dispatched an event of type `%s` to the non-active subscription with ID `%s`.", event.typeUrl(), subscription.getId().getValue()); detectUpdate(event).ifPresent(this::deliverUpdate); }

Target:
void handle(EventEnvelope event) { checkActive(event); detectUpdate(event).ifPresent(this::deliverUpdate); }
Source:
public SamzaSqlRelMessage(List<String> fieldNames, List<Object> fieldValues, SamzaSqlRelMsgMetadata metadata) { Validate.isTrue(fieldNames.size() == fieldValues.size(), "Field Names and values are not of same length."); int keyIndex = fieldNames.indexOf(KEY_NAME); Object key = null; if (keyIndex != -1) { key = fieldValues.get(keyIndex); } this.key = key; this.samzaSqlRelRecord = new SamzaSqlRelRecord(fieldNames, fieldValues); this.samzaSqlRelMsgMetadata = metadata; }

Target:
public SamzaSqlRelMessage(List<String> fieldNames, List<Object> fieldValues, SamzaSqlRelMsgMetadata metadata) { Validate.isTrue(fieldNames.size() == fieldValues.size(), "Field Names and values are not of same length."); Validate.notNull(metadata, "Message metadata is NULL"); int keyIndex = fieldNames.indexOf(KEY_NAME); Object key = null; if (keyIndex != -1) { key = fieldValues.get(keyIndex); } this.key = key; this.samzaSqlRelRecord = new SamzaSqlRelRecord(fieldNames, fieldValues); this.samzaSqlRelMsgMetadata = metadata; }
Source:
private Map<String, Object> generateHeldLocks(ConcurrentMap<HeldLocksToken, LockServiceImpl.HeldLocks<HeldLocksToken>> heldLocksTokenMap) { List<Map<String, Object>> mappedLockListGroupedByToken = heldLocksTokenMap.entrySet().stream() .map(heldLocksTokenMapEntry -> getDescriptorToTokenMap(heldLocksTokenMapEntry.getKey(), heldLocksTokenMapEntry.getValue())) .collect(Collectors.toList()); Map<String, Object> mappedLocksToToken = Maps.newConcurrentMap(); mappedLockListGroupedByToken.forEach(mappedLocksToToken::putAll); return nameObjectForYamlConvertion(mappedLocksToToken, HELD_LOCKS_TITLE); }

Target:
private Map<String, Object> generateHeldLocks(ConcurrentMap<HeldLocksToken, LockServiceImpl.HeldLocks<HeldLocksToken>> heldLocksTokenMap) { Map<String, Object> mappedLocksToToken = Maps.newHashMap(); heldLocksTokenMap.forEach((token, locks) -> { mappedLocksToToken.putAll(getDescriptorToTokenMap(token, locks)); }); return nameObjectForYamlConvertion(HELD_LOCKS_TITLE, mappedLocksToToken); }
Source:
public static boolean isHeaderUseHeuristics() { return Utilities.stringToBoolean( getPropertyValue(GrobidPropertyKeys.PROP_HEADER_USE_HEURISTICS, "false") ); }

Target:
public static boolean isHeaderUseHeuristics() { return Utilities.stringToBoolean( getPropertyValue(GrobidPropertyKeys.PROP_HEADER_USE_HEURISTICS, "true") ); }
Source:
public void testRoomAvailabilityCanBeEnabledOrDisabledWithEnableDisableButton() { HomeAdminPage homeAdminPage = new HomeAdminPage(); RoomsPage confRoomsPage = homeAdminPage.clickConferenceRoomsLink(); confRoomsPage.enableDisableIcon(roomName); Assert.assertTrue(confRoomsPage.stateEnableDisableBtn(roomName)); confRoomsPage.enableDisableIcon(roomName); Assert.assertTrue(confRoomsPage.stateEnableDisableBtn(roomName)); }

Target:
public void testRoomAvailabilityCanBeEnabledOrDisabledWithEnableDisableButton() { HomeAdminPage homeAdminPage = new HomeAdminPage(); RoomsPage roomsPage = homeAdminPage.clickConferenceRoomsLink(); roomsPage.enableDisableIcon(roomName); Assert.assertTrue(roomsPage.isRoomDisabled(roomName)); roomsPage.enableDisableIcon(roomName); Assert.assertTrue(roomsPage.isRoomEnabled(roomName)); }
Source:
public static double logProbToPhredScore(final double rawLogProb, final boolean complement) { if (rawLogProb > MAX_LOG_PROB) { throw new GATKException( String.format("numerical instability problem: the log-probability is too large: %g > 0.0 " + "(with maximum tolerance %g)", rawLogProb, MAX_LOG_PROB)); } final double logProbEqOrLessThan0 = Math.min(0.0, rawLogProb); final double finalLogProb = complement ? logProbComplement(logProbEqOrLessThan0) : logProbEqOrLessThan0; final double absoluteQualScore = QualityUtils.phredScaleLog10ErrorRate(finalLogProb * INV_LN_10); final double exactValue = Math.min(MAX_QUAL_SCORE, absoluteQualScore); return roundPhred(exactValue); }

Target:
public static double logProbToPhredScore(final double rawLogProb, final boolean complement) { if (rawLogProb > MAX_LOG_PROB) { throw new GATKException(String.format("numerical instability problem: the log-probability is too" + " large: %g > 0.0 (with maximum tolerance %g)", rawLogProb, MAX_LOG_PROB)); } final double logProbEqOrLessThan0 = Math.min(0.0, rawLogProb); final double finalLogProb = complement ? logProbComplement(logProbEqOrLessThan0) : logProbEqOrLessThan0; final double absoluteQualScore = QualityUtils.phredScaleLog10ErrorRate(finalLogProb * INV_LN_10); final double exactValue = Math.min(MAX_QUAL_SCORE, absoluteQualScore); return roundPhred(exactValue); }
Source:
public void uploadFailRatingDialogNotShowing() { onView(withId(R.id.next)) .perform(click()); onView(withText(R.string.next)) .perform(click()); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { activityTestRule.getActivity().showUploadDialog(); activityTestRule.getActivity().onReceiveResult(0, bundle); }); onView(withText(R.string.rating_dialog_rate_now)) .check(doesNotExist()); }

Target:
public void uploadFailRatingDialogNotShowing() { sharedPreferences.edit() .putInt(NUMBER_OF_UPLOADED_PROJECTS, 1) .commit(); onView(withId(R.id.next)) .perform(click()); onView(withText(R.string.next)) .perform(click()); InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> { activityTestRule.getActivity().showUploadDialog(); activityTestRule.getActivity().onReceiveResult(0, bundle); }); onView(withText(R.string.rating_dialog_rate_now)) .check(doesNotExist()); }
Source:
public void launchDaemon() { LOG.info("Starting supervisor for storm version '{}'.", VersionInfo.getVersion()); try { Map<String, Object> conf = getConf(); if (ConfigUtils.isLocalMode(conf)) { throw new IllegalArgumentException("Cannot start server in local mode!"); } launch(); Utils.addShutdownHookWithForceKillIn1Sec(this::close); registerGauge(name(SUPERVISOR, "num-slots-used-gauge"), () -> SupervisorUtils.supervisorWorkerIds(conf).size()); StormMetricsRegistry.startMetricsReporters(conf); launchSupervisorThriftServer(conf); } catch (Exception e) { LOG.error("Failed to start supervisor\n", e); System.exit(1); } }

Target:
public void launchDaemon() { LOG.info("Starting supervisor for storm version '{}'.", VersionInfo.getVersion()); try { Map<String, Object> conf = getConf(); if (ConfigUtils.isLocalMode(conf)) { throw new IllegalArgumentException("Cannot start server in local mode!"); } launch(); Utils.addShutdownHookWithForceKillIn1Sec(this::close); StormMetricsRegistry.registerGauge("supervisor:num-slots-used-gauge", () -> SupervisorUtils.supervisorWorkerIds(conf).size()); StormMetricsRegistry.startMetricsReporters(conf); launchSupervisorThriftServer(conf); } catch (Exception e) { LOG.error("Failed to start supervisor\n", e); System.exit(1); } }
Source:
protected <T> void doExecute(SelectContext<T> context) { Query query = context.getRawQuery(); if (query == null) { return; } ResourceEntity<T> resourceEntity = new ResourceEntity<>(metadataService.getLrEntity(context.getType())); sizeConstructor.construct(resourceEntity, query.getStart(), query.getLimit()); includeConstructor.construct(resourceEntity, query.getInclude()); excludeConstructor.construct(resourceEntity, query.getExclude()); sortConstructor.construct(resourceEntity, query.getSort()); mapByConstructor.construct(resourceEntity, query.getMapBy()); expConstructor.construct(resourceEntity, query.getCayenneExp()); context.setEntity(resourceEntity); }

Target:
protected <T> void doExecute(SelectContext<T> context) { ResourceEntity<T> resourceEntity = new ResourceEntity<>(metadataService.getLrEntity(context.getType())); Query query = context.getRawQuery(); if (query != null) { sizeConstructor.construct(resourceEntity, query.getStart(), query.getLimit()); includeConstructor.construct(resourceEntity, query.getInclude()); excludeConstructor.construct(resourceEntity, query.getExclude()); sortConstructor.construct(resourceEntity, query.getSort()); mapByConstructor.construct(resourceEntity, query.getMapBy()); expConstructor.construct(resourceEntity, query.getCayenneExp()); } context.setEntity(resourceEntity); }
Source:
public void testListEntriesOld() throws IOException, ApiException { String[] commandArray = new String[] { "--config", TestUtility.getConfigFileLocation(true), "tool", "list" }; ImmutablePair<String, String> stringStringImmutablePair = runOldDockstoreClient(dockstore, commandArray); }

Target:
public void testListEntriesOld() throws IOException, ApiException { String[] commandArray = new String[] { "--config", TestUtility.getConfigFileLocation(true), "tool", "list" }; ImmutablePair<String, String> stringStringImmutablePair = runOldDockstoreClient(dockstore, commandArray); checkToolList(stringStringImmutablePair.getLeft()); }
Source:
public Mono<HttpResponse> send(HttpRequest request, Context context) { boolean eagerlyReadResponse = context.getData("eagerly-read-response") .map(data -> Boolean.parseBoolean(data.toString())) .orElse(false); return toJdkHttpRequest(request) .flatMap(jdkRequest -> Mono.fromCompletionStage(jdkHttpClient.sendAsync(jdkRequest, ofPublisher())) .flatMap(innerResponse -> { if (eagerlyReadResponse) { int statusCode = innerResponse.statusCode(); HttpHeaders headers = fromJdkHttpHeaders(innerResponse.headers()); return FluxUtil.collectBytesInByteBufferStream(JdkFlowAdapter .flowPublisherToFlux(innerResponse.body()) .flatMapSequential(Flux::fromIterable)) .map(bytes -> new BufferedJdkHttpResponse(request, statusCode, headers, bytes)); } else { return Mono.just(new JdkHttpResponse(request, innerResponse)); } })); }

Target:
public Mono<HttpResponse> send(HttpRequest request, Context context) { boolean eagerlyReadResponse = (boolean) context.getData(EAGERLY_READ_RESPONSE_CONTEXT_KEY).orElse(false); return toJdkHttpRequest(request) .flatMap(jdkRequest -> Mono.fromCompletionStage(jdkHttpClient.sendAsync(jdkRequest, ofPublisher())) .flatMap(innerResponse -> { if (eagerlyReadResponse) { int statusCode = innerResponse.statusCode(); HttpHeaders headers = fromJdkHttpHeaders(innerResponse.headers()); return FluxUtil.collectBytesInByteBufferStream(JdkFlowAdapter .flowPublisherToFlux(innerResponse.body()) .flatMapSequential(Flux::fromIterable)) .map(bytes -> new BufferedJdkHttpResponse(request, statusCode, headers, bytes)); } else { return Mono.just(new JdkHttpResponse(request, innerResponse)); } })); }
Source:
public void testInformationSchemaUppercaseName() { assertQuery( "SELECT table_name FROM information_schema.tables WHERE table_catalog = 'LOCAL' AND table_schema = 'TINY' AND table_name = 'ORDERS'", "SELECT '' WHERE false"); }

Target:
public void testInformationSchemaUppercaseName() { assertQuery( "SELECT table_name FROM information_schema.tables WHERE table_catalog = 'LOCAL'", "SELECT '' WHERE false"); assertQuery( "SELECT table_name FROM information_schema.tables WHERE table_schema = 'TINY'", "SELECT '' WHERE false"); assertQuery( "SELECT table_name FROM information_schema.tables WHERE table_name = 'ORDERS'", "SELECT '' WHERE false"); }