auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderAsSingle() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.Internal internal = mock(StorIOContentResolver.Internal.class); when(storIOContentResolver.internal()).thenReturn(internal); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final List<TestItem> items = asList(TestItem.newInstance(), TestItem.newInstance()); final TestSubscriber<DeleteResults<TestItem>> testSubscriber = new TestSubscriber<DeleteResults<TestItem>>(); storIOContentResolver .delete() .objects(items) .prepare() .asRxSingle() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) .hasCauseInstanceOf(IllegalStateException.class); verify(storIOContentResolver).delete(); verify(storIOContentResolver).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, internal); }

Target:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAffectingContentProviderAsSingle() { final StorIOContentResolver storIOContentResolver = mock(StorIOContentResolver.class); final StorIOContentResolver.Internal internal = mock(StorIOContentResolver.Internal.class); when(storIOContentResolver.internal()).thenReturn(internal); when(storIOContentResolver.delete()).thenReturn(new PreparedDelete.Builder(storIOContentResolver)); final TestItem testItem = TestItem.newInstance(); final List<TestItem> items = asList(testItem, TestItem.newInstance()); final TestSubscriber<DeleteResults<TestItem>> testSubscriber = new TestSubscriber<DeleteResults<TestItem>>(); storIOContentResolver .delete() .objects(items) .prepare() .asRxSingle() .subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(); testSubscriber.assertNoValues(); assertThat(testSubscriber.getOnErrorEvents().get(0)) .isInstanceOf(StorIOException.class) .hasCauseInstanceOf(IllegalStateException.class) .hasMessage(IllegalStateException.class.getName() + ": One of the objects from the collection does not have type mapping: object = " + testItem.toString() + ", object.class = " + TestItem.class + ",ContentProvider was not affected by this operation, please add type mapping for this type"); verify(storIOContentResolver).delete(); verify(storIOContentResolver).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).delete(any(DeleteQuery.class)); verifyNoMoreInteractions(storIOContentResolver, internal); }
Source:
void setCurrentControllerInfo() { if (Build.VERSION.SDK_INT >= 28) { return; } MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl == null) { return; } String packageName; if (Build.VERSION.SDK_INT >= 24) { packageName = sessionImpl.getCallingPackage(); if (TextUtils.isEmpty(packageName)) { packageName = LEGACY_CONTROLLER; } } else { packageName = LEGACY_CONTROLLER; } sessionImpl.setCurrentControllerInfo(new RemoteUserInfo( packageName, UNKNOWN_PID, UNKNOWN_UID)); }

Target:
void setCurrentControllerInfo() { if (Build.VERSION.SDK_INT >= 28) { return; } MediaSessionImpl sessionImpl = mSessionImpl != null ? mSessionImpl.get() : null; if (sessionImpl == null) { return; } String packageName = sessionImpl.getCallingPackage(); if (TextUtils.isEmpty(packageName)) { packageName = LEGACY_CONTROLLER; } sessionImpl.setCurrentControllerInfo(new RemoteUserInfo( packageName, UNKNOWN_PID, UNKNOWN_UID)); }
Source:
synchronized boolean requestRetryIfTimeout() { switch (state) { case INIT_STATE: state = NEED_RETRY_STATE; return false; case NEED_RETRY_STATE: LOG.log(Level.INFO, "Pull request time out for key: {0}, requestIdCounter: {1}, retryCount: {2}", new Object[]{encodedKey.getKey(), requestId, retryCount}); state = RETRY_REQUESTED_STATE; workerThread.enqueueRetryPulls(this); return true; case RETRY_REQUESTED_STATE: return false; default: throw new RuntimeException("Unknown state of pull request"); } }

Target:
synchronized boolean requestRetryIfTimeout() { switch (state) { case INIT_STATE: state = NEED_RETRY_STATE; return false; case NEED_RETRY_STATE: LOG.log(Level.INFO, "Pull request time out for key: {0}, requestId: {1}, retryCount: {2}", new Object[]{encodedKey.getKey(), requestId, retryCount}); state = RETRY_REQUESTED_STATE; workerThread.enqueueRetryPull(this); return true; case RETRY_REQUESTED_STATE: return false; default: throw new RuntimeException("Unknown state of pull request"); } }
Source:
protected MetadataResolver initServiceProviderMetadataResolver(final WebContext context) { String finalCallbackUrl = computeFinalCallbackUrl(context); this.spMetadataResolver = new SAML2ServiceProviderMetadataResolver(this.configuration.getServiceProviderMetadataPath(), this.configuration.getServiceProviderMetadataResource(), finalCallbackUrl, (this.configuration.getServiceProviderEntityId().equals("CALLBACK_URL") ? finalCallbackUrl : this.configuration.getServiceProviderEntityId()), this.configuration.isForceServiceProviderMetadataGeneration(), this.credentialProvider); return this.spMetadataResolver.resolve(); }

Target:
protected MetadataResolver initServiceProviderMetadataResolver(final WebContext context) { this.spMetadataResolver = new SAML2ServiceProviderMetadataResolver(this.configuration, computeFinalCallbackUrl(context), this.credentialProvider); return this.spMetadataResolver.resolve(); }
Source:
public void testNodeValidationFailedEvent() throws Exception { startGrid(0); CountDownLatch evtLatch = new CountDownLatch(1); AtomicReference<Event> listenedEvt = new AtomicReference<>(); grid(0).events().localListen(evt -> { assertTrue(listenedEvt.compareAndSet(null, evt)); evtLatch.countDown(); return true; }, EVT_NODE_VALIDATION_FAILED); startGrid(1); IgniteConfiguration invalidCfg = getConfiguration(getTestIgniteInstanceName(2)) .setPluginProviders(new TestSecurityPluginProvider("login", "", ALLOW_ALL, false)); assertThrowsWithCause(() -> startGrid(optimize(invalidCfg)), IgniteSpiException.class); evtLatch.await(); assertTrue(listenedEvt.get() instanceof NodeValidationFailedEvent); NodeValidationFailedEvent validationEvt = (NodeValidationFailedEvent) listenedEvt.get(); assertEquals(invalidCfg.getConsistentId(), validationEvt.eventNode().attribute(ATTR_NODE_CONSISTENT_ID)); assertNotNull(validationEvt.validationResult()); String errMsg = validationEvt.validationResult().message(); assertNotNull(errMsg); assertTrue(errMsg.contains( "Local node's grid security processor class is not equal to remote node's grid security processor class")); }

Target:
public void testNodeValidationFailedEvent() throws Exception { startGrid(0); CountDownLatch evtLatch = new CountDownLatch(1); AtomicReference<Event> listenedEvtRef = new AtomicReference<>(); grid(0).events().localListen(evt -> { assertTrue(listenedEvtRef.compareAndSet(null, evt)); evtLatch.countDown(); return true; }, EVT_NODE_VALIDATION_FAILED); startGrid(1); String invalidNodeName = getTestIgniteInstanceName(2); IgniteConfiguration invalidCfg = getConfiguration(invalidNodeName) .setPluginProviders(new TestSecurityPluginProvider("login", "", ALLOW_ALL, false)); assertThrowsWithCause(() -> startGrid(optimize(invalidCfg)), IgniteSpiException.class); evtLatch.await(); Event listenedEvt = listenedEvtRef.get(); assertTrue(listenedEvt instanceof NodeValidationFailedEvent); NodeValidationFailedEvent validationEvt = (NodeValidationFailedEvent)listenedEvt; assertEquals(invalidNodeName, validationEvt.eventNode().attribute(ATTR_NODE_CONSISTENT_ID)); IgniteNodeValidationResult validationRes = validationEvt.validationResult(); assertNotNull(validationRes); String errMsg = validationRes.message(); assertNotNull(errMsg); assertTrue(errMsg.contains( "Local node's grid security processor class is not equal to remote node's grid security processor class")); }
Source:
public boolean isCheckboxEnabled(String projectName) { String checkboxLocator = format(CHECKBOX_BY_PROJECT_NAME_XPATH_TEMPLATE, projectName); return seleniumWebDriverHelper .waitVisibilityAndGetAttribute(By.xpath(checkboxLocator), "aria-checked") .equals("true"); }

Target:
public boolean isCheckboxEnabled(String projectName) { final String checkboxLocator = format(CHECKBOX_BY_PROJECT_NAME_XPATH_TEMPLATE, projectName); final String checkboxStateAttribute = "aria-checked"; return seleniumWebDriverHelper .waitVisibilityAndGetAttribute(By.xpath(checkboxLocator), checkboxStateAttribute) .equals("true"); }
Source:
HistoryReference createHistoryReference(int id) throws DatabaseException, HttpMalformedHeaderException; } public void injectCsrfToken(HttpMessage message, HttpRequestConfig config) { List<AntiCsrfToken> tokens = getTokens(message); AntiCsrfToken antiCsrfToken = null; if (tokens.size() > 0) { antiCsrfToken = tokens.get(0); } if (antiCsrfToken != null) { regenerateAntiCsrfToken(message, antiCsrfToken, config); } }

Target:
HistoryReference createHistoryReference(int id) throws DatabaseException, HttpMalformedHeaderException; } public void regenerateAntiCsrfToken(HttpMessage message, HttpMessageSender httpSender) { List<AntiCsrfToken> tokens = getTokens(message); AntiCsrfToken antiCsrfToken = null; if (tokens.size() > 0) { antiCsrfToken = tokens.get(0); } if (antiCsrfToken == null) { return; } String tokenValue = null; try { HttpMessage tokenMsg = antiCsrfToken.getMsg().cloneAll(); httpSender.sendAndReceive(tokenMsg); tokenValue = getTokenValue(tokenMsg, antiCsrfToken.getName()); } catch (Exception e) { log.error(e.getMessage(), e); } if (tokenValue != null) { log.debug( "regenerateAntiCsrfToken replacing " + antiCsrfToken.getValue() + " with " + encoder.getURLEncode(tokenValue)); String replaced = message.getRequestBody().toString(); replaced = replaced.replace( encoder.getURLEncode(antiCsrfToken.getValue()), encoder.getURLEncode(tokenValue)); message.setRequestBody(replaced); registerAntiCsrfToken( new AntiCsrfToken( message, antiCsrfToken.getName(), tokenValue, antiCsrfToken.getFormIndex())); } }
Source:
public void setNumExecutors(@Nonnegative int n) throws IOException { if (this.numExecutors != n) { this.numExecutors = n; updateComputerList(); save(); } }

Target:
public void setNumExecutors(@Nonnegative int n) throws IOException, IllegalArgumentException { if (n < 0) { throw new IllegalArgumentException("Incorrect field \"# of executors\": " + n +". It should be a non-negative number."); } if (this.numExecutors != n) { this.numExecutors = n; updateComputerList(); save(); } }
Source:
public boolean uploadCertificateToHosts(String certificateCer, String alias, String hypervisor) { HypervisorType hypervisorType = HypervisorType.getType(hypervisor); List<HostVO> hosts = getRunningHostsToUploadCertificate(hypervisorType); String certificatePem = getPretifiedCertificate(certificateCer); certificateSanity(certificatePem); s_logger.info("Attempting to upload certificate: " + alias + " to " + hosts.size() + " hosts"); if (CollectionUtils.isNotEmpty(hosts)) { for (HostVO host : hosts) { if (!uploadCertificate(certificatePem, alias, host.getId())) { s_logger.error("Could not upload certificate on host: " + host.getName() + " (" + host.getUuid() + ")"); throw new CloudRuntimeException("Uploading certificate " + alias + " failed on host: " + host.getUuid()); } } } return true; }

Target:
public boolean uploadCertificateToHosts(String certificateCer, String alias, String hypervisor) { HypervisorType hypervisorType = HypervisorType.getType(hypervisor); List<HostVO> hosts = getRunningHostsToUploadCertificate(hypervisorType); String certificatePem = getPretifiedCertificate(certificateCer); certificateSanity(certificatePem); s_logger.info("Attempting to upload certificate: " + alias + " to " + hosts.size() + " hosts"); if (CollectionUtils.isNotEmpty(hosts)) { for (HostVO host : hosts) { if (!uploadCertificate(certificatePem, alias, host.getId())) { String msg = "Could not upload certificate " + alias + " on host: " + host.getName() + " (" + host.getUuid() + ")"; s_logger.error(msg); throw new CloudRuntimeException(msg); } } } return true; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Object returnValue = Boolean.FALSE; final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); final IWorkbenchPart activePart = activePage.getActivePart(); if (activePart instanceof IViewPart) { final IViewPart viewPart = (IViewPart) activePart; applyAction = AbstractFocusViewAction.getActionForPart(viewPart); if (applyAction != null) { applyAction.update(!applyAction.isChecked()); returnValue = Boolean.TRUE; } } return returnValue; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Object returnValue = false; final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); final IWorkbenchPart activePart = activePage.getActivePart(); if (activePart instanceof IViewPart) { final IViewPart viewPart = (IViewPart) activePart; focusAction = AbstractFocusViewAction.getActionForPart(viewPart); if (focusAction != null) { focusAction.update(!focusAction.isChecked()); returnValue = true; } } return returnValue; }
Source:
protected void doExecute() throws Exception { if (skip) { return; } if (isInstall) { installServerAssembly(); } else { log.info(MessageFormat.format(messages.getString("info.install.type.preexisting"), "")); checkServerHomeExists(); checkServerDirectoryExists(); } log.info(MessageFormat.format(messages.getString("info.server.package"), serverName)); ServerTask serverTask = initializeJava(); copyConfigFiles(); serverTask.setOperation("package"); if (packageFile != null) { if (packageFile.isDirectory()) { packageFile = new File(packageFile, serverName + ".zip"); } } else { packageFile = new File(projectBuildDir, serverName + ".zip"); } serverTask.setArchive(packageFile); serverTask.setInclude(include); serverTask.setOs(os); log.info(MessageFormat.format(messages.getString("info.server.package.file.location"), packageFile.getCanonicalPath())); serverTask.execute(); if (attach || (project != null && "liberty-assembly".equals(project.getPackaging()))) { if (project == null) { throw new MojoFailureException(MessageFormat.format(messages.getString("error.server.package.no.project"), "")); } project.getArtifact().setFile(packageFile); } }

Target:
protected void doExecute() throws Exception { if (skip) { return; } if (isInstall) { installServerAssembly(); } else { log.info(MessageFormat.format(messages.getString("info.install.type.preexisting"), "")); checkServerHomeExists(); checkServerDirectoryExists(); } log.info(MessageFormat.format(messages.getString("info.server.package"), serverName)); ServerTask serverTask = initializeJava(); copyConfigFiles(); serverTask.setOperation("package"); String fileType = getPackageFileType(include); String projectBuildDir = project.getBuild().getDirectory(); String projectBuildName = project.getBuild().getFinalName(); if (packageFile != null) { if (packageFile.isDirectory()) { packageFile = new File(packageFile, projectBuildName + fileType); } } else { packageFile = new File(projectBuildDir, projectBuildName + fileType); } serverTask.setArchive(packageFile); serverTask.setInclude(include); serverTask.setOs(os); log.info(MessageFormat.format(messages.getString("info.server.package.file.location"), packageFile.getCanonicalPath())); serverTask.execute(); if (attach || (project != null && "liberty-assembly".equals(project.getPackaging()))) { if (project == null) { throw new MojoFailureException(MessageFormat.format(messages.getString("error.server.package.no.project"), "")); } project.getArtifact().setFile(packageFile); } }
Source:
ObjectMetadata getS3ObjectMetadata(Path path) throws IOException { String bucketName = getBucketName(uri); String key = keyFromPath(path); ObjectMetadata s3ObjectMetadata = getS3ObjectMetadata(path, bucketName, key); if (s3ObjectMetadata == null && !key.isEmpty()) { verify(!key.endsWith(PATH_SEPARATOR), "Expected key to not end with %s", PATH_SEPARATOR); return getS3ObjectMetadata(path, bucketName, key + PATH_SEPARATOR); } return s3ObjectMetadata; }

Target:
ObjectMetadata getS3ObjectMetadata(Path path) throws IOException { String bucketName = getBucketName(uri); String key = keyFromPath(path); ObjectMetadata s3ObjectMetadata = getS3ObjectMetadata(path, bucketName, key); if (s3ObjectMetadata == null && !key.isEmpty()) { return getS3ObjectMetadata(path, bucketName, key + PATH_SEPARATOR); } return s3ObjectMetadata; }
Source:
public static byte[] readFileAsBytes(String filePath) throws IOException { byte[] buffer; try (FileInputStream fis = new FileInputStream(filePath)) { buffer = new byte[1024 * 300]; fis.read(buffer); return buffer; } }

Target:
public static byte[] readFileAsBytes(String filePath) throws IOException { try (FileInputStream fis = new FileInputStream(filePath)) { byte[] buffer = new byte[1024 * 300]; fis.read(buffer); return buffer; } }
Source:
private static List<ProgramState> setNotPresentConstraint(CheckerContext context, Tree syntaxNode) { SymbolicValue val = context.getState().peekValue(); if(syntaxNode.is(Tree.Kind.METHOD_INVOCATION) && OPTIONAL_EMPTY.matches(((MethodInvocationTree) syntaxNode))) { return val.setConstraint(context.getState(), OptionalConstraint.NOT_PRESENT); } return Lists.newArrayList(context.getState()); }

Target:
private static List<ProgramState> setNotPresentConstraint(CheckerContext context, Tree syntaxNode) { if(syntaxNode.is(Tree.Kind.METHOD_INVOCATION) && OPTIONAL_EMPTY.matches(((MethodInvocationTree) syntaxNode))) { return context.getState().peekValue().setConstraint(context.getState(), OptionalConstraint.NOT_PRESENT); } return Lists.newArrayList(context.getState()); }
Source:
private JobRepositoryCleanupManager() { succeededJobTime = Config.<Integer> GetValue(ConfigValues.SucceededJobCleanupTimeInMinutes).intValue() * -1; failedJobTime = Config.<Integer> GetValue(ConfigValues.FailedJobCleanupTimeInMinutes).intValue() * -1; Integer cleanupFrequency = Config.<Integer> GetValue(ConfigValues.JobCleanupRateInMinutes); SchedulerUtilQuartzImpl.getInstance().scheduleAFixedDelayJob(this, "completed_jobs_cleanup", new Class[] {}, new Object[] {}, cleanupFrequency, cleanupFrequency, TimeUnit.MINUTES); }

Target:
private JobRepositoryCleanupManager() { }
Source:
protected int getPrefetchCount() { try { return Integer.parseInt( variablizedStepMeta.getPrefetchCount() ); } catch ( NumberFormatException nfe ) { return 100000; } }

Target:
protected int getPrefetchCount() { try { return Integer.parseInt( variablizedStepMeta.getPrefetchCount() ); } catch ( NumberFormatException nfe ) { return BaseStreamStepMeta.PREFETCH; } }
Source:
private void initRecyclerView() { Timber.d("RecyclerList Recycler view Init."); LinearLayoutManager layoutManager; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { layoutManager = new GridLayoutManager(getContext(), SPAN_COUNT); rvContributionsList.setLayoutManager(layoutManager); } else { layoutManager = new LinearLayoutManager(getContext()); rvContributionsList.setLayoutManager(layoutManager); } rvContributionsList.setAdapter(adapter); rvContributionsList.addOnScrollListener(contributionsListPresenter.getScrollListener(layoutManager)); contributionsListPresenter.setupLiveData(); contributionsListPresenter.fetchContributions(); }

Target:
private void initRecyclerView() { final GridLayoutManager layoutManager = new GridLayoutManager(getContext(), getSpanCount(getResources().getConfiguration().orientation)); rvContributionsList.setLayoutManager(layoutManager); contributionsListPresenter.setup(); contributionsListPresenter.contributionList.observe(this, adapter::submitList); rvContributionsList.setAdapter(adapter); }
Source:
public UploadPack create(HttpServletRequest req, Repository repo) throws ServiceNotEnabledException, ServiceNotAuthorizedException { final ProjectControl pc = getProjectControl(req); final CurrentUser user = pc.getCurrentUser(); final Set<AccountGroup.Id> uploadGroup = serverCommandConfig.getUploadGroup(); if (uploadGroup != null && !uploadGroup.isEmpty()) { if (!CollectionsUtil.isAnyIncludedIn(user.getEffectiveGroups(), uploadGroup)) { throw new ServiceNotAuthorizedException(); } } UploadPack up = new UploadPack(repo); if (!pc.allRefsAreVisible()) { up.setRefFilter(new VisibleRefFilter(repo, pc, db.get())); } return up; }

Target:
public UploadPack create(HttpServletRequest req, Repository repo) throws ServiceNotEnabledException, ServiceNotAuthorizedException { final ProjectControl pc = getProjectControl(req); if (!pc.canPerformPackAction(uploadGroup)) { throw new ServiceNotAuthorizedException(); } UploadPack up = new UploadPack(repo); if (!pc.allRefsAreVisible()) { up.setRefFilter(new VisibleRefFilter(repo, pc, db.get())); } return up; }
Source:
public void testFromToString() { final CoordArrayConverter converter = new CoordArrayConverter(); String a = "[(223380.4988791829;6758072.4280857295),(223404.67545027257;6758049.17275259),(223417.0127605943;6758038.021038004),(223450.67625251273;6757924.791645723),(223456.13332351885;6757906.359813054)]"; Coord[] coords = converter.convert(a); Assert.assertEquals(coords.length, 5); Assert.assertEquals(coords[0].hasZ(), false); Assert.assertEquals(coords[0].getX(), 223380.4988791829, 0.00005); Assert.assertEquals(coords[0].getY(), 6758072.4280857295, 0.00005); Assert.assertEquals(coords[1].hasZ(), false); Assert.assertEquals(coords[1].getX(), 223404.67545027257, 0.00005); Assert.assertEquals(coords[1].getY(), 6758049.17275259, 0.00005); Assert.assertEquals(coords[2].hasZ(), false); Assert.assertEquals(coords[2].getX(), 223417.0127605943, 0.00005); Assert.assertEquals(coords[2].getY(), 6758038.021038004, 0.00005); Assert.assertEquals(coords[3].hasZ(), false); Assert.assertEquals(coords[3].getX(), 223450.67625251273, 0.00005); Assert.assertEquals(coords[3].getY(), 6757924.791645723, 0.00005); Assert.assertEquals(coords[4].hasZ(), false); Assert.assertEquals(coords[4].getX(), 223456.13332351885, 0.00005); Assert.assertEquals(coords[4].getY(), 6757906.359813054, 0.00005); String b = converter.convertToString(coords); Assert.assertEquals("[(223380,498879;6758072,428086),(223404,675450;6758049,172753),(223417,012761;6758038,021038),(223450,676253;6757924,791646),(223456,133324;6757906,359813)]", b); }

Target:
public void testFromToString() { final CoordArrayConverter converter = new CoordArrayConverter(); String a = "[(223380.4988791829;6758072.4280857295),(223404.67545027257;6758049.17275259),(223417.0127605943;6758038.021038004),(223450.67625251273;6757924.791645723),(223456.13332351885;6757906.359813054)]"; Coord[] coords = converter.convert(a); Assert.assertEquals(coords.length, 5); Assert.assertEquals(coords[0].hasZ(), false); Assert.assertEquals(coords[0].getX(), 223380.4988791829, 0.00005); Assert.assertEquals(coords[0].getY(), 6758072.4280857295, 0.00005); Assert.assertEquals(coords[1].hasZ(), false); Assert.assertEquals(coords[1].getX(), 223404.67545027257, 0.00005); Assert.assertEquals(coords[1].getY(), 6758049.17275259, 0.00005); Assert.assertEquals(coords[2].hasZ(), false); Assert.assertEquals(coords[2].getX(), 223417.0127605943, 0.00005); Assert.assertEquals(coords[2].getY(), 6758038.021038004, 0.00005); Assert.assertEquals(coords[3].hasZ(), false); Assert.assertEquals(coords[3].getX(), 223450.67625251273, 0.00005); Assert.assertEquals(coords[3].getY(), 6757924.791645723, 0.00005); Assert.assertEquals(coords[4].hasZ(), false); Assert.assertEquals(coords[4].getX(), 223456.13332351885, 0.00005); Assert.assertEquals(coords[4].getY(), 6757906.359813054, 0.00005); String b = converter.convertToString(coords); Assert.assertEquals(a, b); }
Source:
public int getMaxActiveFiles() { return getInt("secor.max.file.count", 100); }

Target:
public int getMaxActiveFiles() { return getInt("secor.max.file.count", -1); }
Source:
public boolean filterPartitionsByExpr(List<FieldSchema> partColumns, byte[] expr, String defaultPartitionName, List<String> partitionNames) throws MetaException { String partExpr = new String(expr, StandardCharsets.UTF_8); if (LOG.isDebugEnabled()) { LOG.debug("Partition expr: {}", expr); } Set<String> partValueSet = new HashSet<>(); String[] parts = partExpr.split(" AND "); for ( String part : parts){ String[] colAndValue = part.split("="); String key = FileUtils.unescapePathName(colAndValue[0]); String value = FileUtils.unescapePathName(colAndValue[1].substring(1, colAndValue[1].length()-1)); partValueSet.add(key+"="+value); } List<String> partNamesSeq = new ArrayList<>(); for (String partition : partitionNames){ boolean isMatch = true; for ( String col : partValueSet){ if (partition.indexOf(col) == -1){ isMatch = false; break; } } if (isMatch){ partNamesSeq.add(partition); } } partitionNames.clear(); partitionNames.addAll(partNamesSeq); LOG.info("The returned partition list is of size: {}", partitionNames.size()); for(String s : partitionNames){ if (LOG.isDebugEnabled()) { LOG.debug("Matched partition: {}", s); } } return false; }

Target:
public boolean filterPartitionsByExpr(List<FieldSchema> partColumns, byte[] expr, String defaultPartitionName, List<String> partitionNames) throws MetaException { String partExpr = new String(expr, StandardCharsets.UTF_8); if (LOG.isDebugEnabled()) { LOG.debug("Partition expr: {}", expr); } Set<String> partValueSet = new HashSet<>(); String[] parts = partExpr.split(" AND "); for ( String part : parts){ String[] colAndValue = part.split("="); String key = FileUtils.unescapePathName(colAndValue[0]); String value = FileUtils.unescapePathName(colAndValue[1].substring(1, colAndValue[1].length()-1)); partValueSet.add(key+"="+value); } List<String> partNamesSeq = new ArrayList<>(); for (String partition : partitionNames){ boolean isMatch = true; String partnames = partition.split("/"); for (String part: partnames) { if (!partValueSet.contains(FileUtils.unescapePathName(part))){ isMatch = false; break; } } if (isMatch){ partNamesSeq.add(partition); } } partitionNames.clear(); partitionNames.addAll(partNamesSeq); LOG.info("The returned partition list is of size: {}", partitionNames.size()); if (LOG.isDebugEnabled()) { for(String s : partitionNames){ LOG.debug("Matched partition: {}", s); } } return false; }
Source:
private void updateChildLinks() throws DAOException, DataException { Set<Integer> referencedChildren = new TreeSet<>(); addAllChildrenRecursive(workpiece.getRootElement(), referencedChildren); TreeSet<Integer> savedChildren = new TreeSet<>(); process.getChildren().parallelStream().map(Process::getId).forEachOrdered(savedChildren::add); Iterator<Integer> referencedChildrenIterator = referencedChildren.iterator(); Iterator<Integer> savedChildrenIterator = savedChildren.iterator(); boolean nextReferencedChild = true; boolean nextSavedChild = true; Integer referencedChildId = null; Integer savedChildId = null; boolean save = false; do { if (nextReferencedChild) { referencedChildId = referencedChildrenIterator.hasNext() ? referencedChildrenIterator.next() : null; nextReferencedChild = false; } if (nextSavedChild) { savedChildId = savedChildrenIterator.hasNext() ? savedChildrenIterator.next() : null; nextSavedChild = false; } if (Objects.nonNull(referencedChildId) && Objects.isNull(savedChildId) || referencedChildId < savedChildId) { Process childToAdd = ServiceManager.getProcessService().getById(referencedChildId); childToAdd.setParent(process); process.getChildren().add(childToAdd); save = true; nextReferencedChild = true; } else if (Objects.isNull(referencedChildId) && Objects.nonNull(savedChildId) || referencedChildId > savedChildId) { Process childToRemove = ServiceManager.getProcessService().getById(savedChildId); childToRemove.setParent(null); process.getChildren().remove(childToRemove); save = true; nextSavedChild = true; } else if (Objects.nonNull(referencedChildId) && Objects.nonNull(savedChildId)) { nextReferencedChild = true; nextSavedChild = true; } } while (nextReferencedChild || nextSavedChild); if (save) { ServiceManager.getProcessService().save(process); } }

Target:
private void updateChildLinks() throws DAOException, DataException { TreeSet<Integer> referencedChildren = new TreeSet<>(); addAllChildrenRecursive(workpiece.getRootElement(), referencedChildren); TreeSet<Integer> savedChildren = new TreeSet<>(); process.getChildren().parallelStream().map(Process::getId).forEachOrdered(savedChildren::add); Map<Integer, Boolean> differences = ProcessListComparator.compareLists(referencedChildren, savedChildren); for (Entry<Integer, Boolean> difference : differences.entrySet()) { Process child = ServiceManager.getProcessService().getById(difference.getKey()); if (difference.getValue()) { child.setParent(process); process.getChildren().add(child); } else { child.setParent(null); process.getChildren().remove(child); } ServiceManager.getProcessService().save(child); } if (!differences.isEmpty()) { ServiceManager.getProcessService().save(process); } }
Source:
public static WUState getStateID(WorkunitInfo wu) { if (wu != null) { if (wu.getStateID() != null) { return getStateID(wu.getStateID()); } else if (wu.getState() != null && wu.getState().trim().length() != 0) { return Workunit.translateWUState(wu.getState()); } } return WUState.UNKNOWN; }

Target:
public static WUState getStateID(WorkunitInfo wu) { if (wu != null) { if (wu.getStateID() != null) { return getStateID(wu.getStateID()); } else if (wu.getState() != null) { return Workunit.translateWUState(wu.getState()); } } return WUState.UNKNOWN; }
Source:
@Override public Location getLastLocation(LostApiClient client) { throwIfNotConnected(client); Location location = null; try { location = service.getLastLocation(); } catch (RemoteException e) { Log.e(TAG, "Error occurred trying to get last Location " + e.getStackTrace()); } finally { return location; } }

Target:
@Override public Location getLastLocation(LostApiClient client) { throwIfNotConnected(client); Location location = null; try { location = service.getLastLocation(); } catch (RemoteException e) { Log.e(TAG, "Error occurred trying to get last Location", e); } finally { return location; } }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Transfer {"); sb.append("id = ").append(id).append(", "); sb.append("date = ").append(time).append(", "); sb.append("fromAccountId = ").append(fromAccountId).append(", "); sb.append("toAccountId = ").append(toAccountId).append(", "); sb.append("fromAmount = ").append(fromAmount).append(", "); sb.append("toAmount = ").append(toAmount).append(", "); sb.append("fromDecimals = ").append(fromDecimals).append(", "); sb.append("toDecimals = ").append(toDecimals); sb.append("}"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Transfer {"); sb.append("id = ").append(id).append(", "); sb.append("time = ").append(time).append(", "); sb.append("fromAccountId = ").append(fromAccountId).append(", "); sb.append("toAccountId = ").append(toAccountId).append(", "); sb.append("fromAmount = ").append(fromAmount).append(", "); sb.append("toAmount = ").append(toAmount).append(", "); sb.append("fromDecimals = ").append(fromDecimals).append(", "); sb.append("toDecimals = ").append(toDecimals); sb.append("}"); return sb.toString(); }
Source:
public VMImage.OSDiskConfiguration getResult() { VMImage.OSDiskConfiguration result = VMImage.OSDiskConfiguration .create(name, hostCaching, osState, os, mediaLink, logicalDiskSizeInGB, ioType); return result; }

Target:
public VMImage.OSDiskConfiguration getResult() { return VMImage.OSDiskConfiguration .create(name, hostCaching, osState, os, mediaLink, logicalDiskSizeInGB, ioType); }
Source:
public void destroy() { super.destroy(); if (transport != null) { try { transport.close(); } catch (IOException e) { log.debug("Error when closing graphite socket: ", e); } transport = null; } }

Target:
public void destroy() { super.destroy(); if (transport != null) { try { transport.close(); } catch (IOException e) { log.debug("Error when closing Datadog client: ", e); } transport = null; } }
Source:
public ReceivePack create(HttpServletRequest req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { final ProjectControl pc = getProjectControl(req); if (pc.getCurrentUser() instanceof IdentifiedUser) { final IdentifiedUser user = (IdentifiedUser) pc.getCurrentUser(); final Set<AccountGroup.Id> receiveGroup = serverCommandConfig.getReceiveGroup(); if (receiveGroup != null && !receiveGroup.isEmpty()) { if (!CollectionsUtil.isAnyIncludedIn(user.getEffectiveGroups(), receiveGroup)) { throw new ServiceNotAuthorizedException(); } } final ReceiveCommits rc = factory.create(pc, db); final ReceiveCommits.Capable s = rc.canUpload(); if (s != ReceiveCommits.Capable.OK) { final String who = user.getUserName(); final String why = s.getMessage(); log.warn("Rejected push from " + who + ": " + why); throw new ServiceNotEnabledException(); } rc.getReceivePack().setRefLogIdent(user.newRefLogIdent()); return rc.getReceivePack(); } else { throw new ServiceNotAuthorizedException(); } }

Target:
public ReceivePack create(HttpServletRequest req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { final ProjectControl pc = getProjectControl(req); if (pc.getCurrentUser() instanceof IdentifiedUser) { final IdentifiedUser user = (IdentifiedUser) pc.getCurrentUser(); if (!pc.canPerformPackAction(receiveGroup)) { throw new ServiceNotAuthorizedException(); } final ReceiveCommits rc = factory.create(pc, db); final ReceiveCommits.Capable s = rc.canUpload(); if (s != ReceiveCommits.Capable.OK) { final String who = user.getUserName(); final String why = s.getMessage(); log.warn("Rejected push from " + who + ": " + why); throw new ServiceNotEnabledException(); } rc.getReceivePack().setRefLogIdent(user.newRefLogIdent()); return rc.getReceivePack(); } else { throw new ServiceNotAuthorizedException(); } }
Source:
public int getLastLocusInBin(Bin bin) { if(bin == null || bin.getBinNumber() > getMaxBins()) { throw new SAMException("Tried to get last locus for invalid bin: " + bin); } int level = getLevelForBin(bin); int firstBinOnLevel = getFirstBinOnLevel(level); int levelSize = getLevelSize(level); return (bin.getBinNumber() - firstBinOnLevel + 1)*(getMaxSpan()/levelSize); }

Target:
public int getLastLocusInBin(Bin bin) { if(bin == null || bin.getBinNumber() > getMaxBins()) { throw new SAMException("Tried to get last locus for invalid bin: " + bin); } int level = getLevelForBin(bin); int firstBinOnLevel = getFirstBinInLevelForCSI(level); int levelSize = getLevelSize(level); return (bin.getBinNumber() - firstBinOnLevel + 1)*(getMaxSpan()/levelSize); }
Source:
public void addToCache(String key, Group entry, String cacheName, int tenantId) { if (validateAddToCacheRequest(key, entry, cacheName)) return; try { startTenantFlow(tenantId); Cache<String, Group> cache = GroupIdResolverCache(cacheName); if (cache != null && !cache.containsKey(key)) { cache.put(key, entry); if (log.isDebugEnabled()) { log.debug("Cache: " + cacheName + " which is under " + GROUP_ID_RESOLVER_CACHE_MANAGER + "," + "added the entry: " + entry + " for the key: " + key + " successfully"); } } } finally { PrivilegedCarbonContext.endTenantFlow(); } }

Target:
public void addToCache(String key, Group entry, String cacheName, int tenantId) { if (!isValidAddToCacheRequest(key, entry, cacheName)) return; try { startTenantFlow(tenantId); Cache<String, Group> cache = GroupIdResolverCache(cacheName); if (cache != null && !cache.containsKey(key)) { cache.put(key, entry); if (log.isDebugEnabled()) { log.debug("Cache: " + cacheName + " which is under " + GROUP_ID_RESOLVER_CACHE_MANAGER + "," + "added the entry: " + entry + " for the key: " + key + " successfully"); } } } finally { PrivilegedCarbonContext.endTenantFlow(); } }
Source:
public Node visitJoinRelation(SqlBaseParser.JoinRelationContext context) { Relation left = (Relation) visit(context.left); Relation right; if (context.CROSS() != null) { right = (Relation) visit(context.right); return new Join(Join.Type.CROSS, left, right, Optional.empty()); } JoinCriteria criteria; if (context.NATURAL() != null) { right = (Relation) visit(context.right); criteria = new NaturalJoin(); } else { right = (Relation) visit(context.rightRelation); if (context.joinCriteria().ON() != null) { criteria = new JoinOn((Expression) visit(context.joinCriteria().booleanExpression())); } else if (context.joinCriteria().USING() != null) { List<String> columns = identsToStrings(context.joinCriteria().ident()); Table leftTable = (Table) left; Table rightTable = (Table) right; criteria = new JoinUsing(leftTable.getName(), rightTable.getName(), columns); } else { throw new IllegalArgumentException("Unsupported join criteria"); } } return new Join(getJoinType(context.joinType()), left, right, Optional.of(criteria)); }

Target:
public Node visitJoinRelation(SqlBaseParser.JoinRelationContext context) { Relation left = (Relation) visit(context.left); Relation right; if (context.CROSS() != null) { right = (Relation) visit(context.right); return new Join(Join.Type.CROSS, left, right, Optional.empty()); } JoinCriteria criteria; if (context.NATURAL() != null) { right = (Relation) visit(context.right); criteria = new NaturalJoin(); } else { right = (Relation) visit(context.rightRelation); if (context.joinCriteria().ON() != null) { criteria = new JoinOn((Expression) visit(context.joinCriteria().booleanExpression())); } else if (context.joinCriteria().USING() != null) { List<String> columns = identsToStrings(context.joinCriteria().ident()); criteria = new JoinUsing(columns); } else { throw new IllegalArgumentException("Unsupported join criteria"); } } return new Join(getJoinType(context.joinType()), left, right, Optional.of(criteria)); }
Source:
public void privParameterNameTest() throws Exception { final String[] expected = { "8:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "$arg1", privFormat), "9:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "ar$g2", privFormat), "10:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "arg3$", privFormat), "11:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "a_rg4", privFormat), "12:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "_arg5", privFormat), "13:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "arg6_", privFormat), "14:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "aArg7", privFormat), "15:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "aArg8", privFormat), "16:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "aar_g", privFormat), }; final String filePath = getPath("InputParameterNameSimple.java"); Integer[] warnList = getLinesWithWarn(filePath); final List<Integer> selected = new ArrayList<>(); Collections.addAll(selected, warnList); selected.removeIf(line -> line > 16); warnList = selected.toArray(new Integer[selected.size()]); verify(privConfig, filePath, expected, warnList); }

Target:
public void privParameterNameTest() throws Exception { final String[] expected = { "8:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "$arg1", privFormat), "9:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "ar$g2", privFormat), "10:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "arg3$", privFormat), "11:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "a_rg4", privFormat), "12:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "_arg5", privFormat), "13:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "arg6_", privFormat), "14:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "aArg7", privFormat), "15:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "aArg8", privFormat), "16:21: " + getCheckMessage(privConfig.getMessages(), MSG_KEY, "aar_g", privFormat), }; final String filePath = getPath("InputParameterNameSimplePriv.java"); final Integer[] warnList = getLinesWithWarn(filePath); verify(privConfig, filePath, expected, warnList); }
Source:
public AnnotationQueryHandlerAdapter(T target, ParameterResolverFactory parameterResolverFactory) { this(target, parameterResolverFactory, new ClasspathHandlerDefinition(Thread.currentThread().getContextClassLoader())); }

Target:
public AnnotationQueryHandlerAdapter(T target, ParameterResolverFactory parameterResolverFactory) { this(target, parameterResolverFactory, ClasspathHandlerDefinition.forClass(target.getClass())); }
Source:
public void onBtnNextClick() { if (mViewPager.getCurrentItem() == SLIDE_POS_LOCATION_PERMISSION) { if (!haveStoragePermission()) { Toast.makeText(this, R.string.toast_write_storage_permission_required, Toast.LENGTH_LONG).show(); this.finish(); return; } } int current = getItem(+1); if (current < layouts.length) { mViewPager.setCurrentItem(current); btnBack.setVisibility(View.VISIBLE); } else { Log.v(TAG, "User completed first start UI."); mPreferences.edit().putBoolean(Constants.PREF_FIRST_START, false).apply(); startApp(); } }

Target:
public void onBtnNextClick() { if (mViewPager.getCurrentItem() == SLIDE_POS_LOCATION_PERMISSION) { if (!haveStoragePermission()) { Toast.makeText(this, R.string.toast_write_storage_permission_required, Toast.LENGTH_LONG).show(); return; } } int current = getItem(+1); if (current < mLayouts.length) { mViewPager.setCurrentItem(current); mBackButton.setVisibility(View.VISIBLE); } else { Log.v(TAG, "User completed first start UI."); mPreferences.edit().putBoolean(Constants.PREF_FIRST_START, false).apply(); startApp(); } }
Source:
protected String suggestNewFieldName(final ContentType con, final Relationship relationship, final boolean isChild) { final String name = UtilMethods.capitalize(con.variable()); final boolean selfRelated = sameParentAndChild(relationship); String suffix = selfRelated? isChild?"Child" : "Parent": "s"; if(name.toLowerCase().endsWith(suffix)) { return name; } String s = ""; if(isChild){ if (relationship.getCardinality() != WebKeys.Relationship.RELATIONSHIP_CARDINALITY.ONE_TO_ONE.ordinal()){ s = selfRelated?"Children":suffix; } else if(selfRelated){ s = suffix; } } else{ if (relationship.getCardinality() == WebKeys.Relationship.RELATIONSHIP_CARDINALITY.MANY_TO_MANY.ordinal()){ s = selfRelated?"Parents":suffix; } else if(selfRelated){ s = suffix; } } return name + s; }

Target:
protected String suggestNewFieldName(final ContentType con, final Relationship relationship, final boolean isChild) { final String name = UtilMethods.capitalize(con.variable()); final boolean selfRelated = sameParentAndChild(relationship); String suffix = selfRelated? isChild?"Child" : "Parent": "s"; if(name.toLowerCase().endsWith(suffix)) { return name; } String finalSuffix = ""; if(isChild){ if (relationship.getCardinality() != WebKeys.Relationship.RELATIONSHIP_CARDINALITY.ONE_TO_ONE.ordinal()){ finalSuffix = selfRelated?"Children":suffix; } else if(selfRelated){ finalSuffix = suffix; } } else{ if (relationship.getCardinality() == WebKeys.Relationship.RELATIONSHIP_CARDINALITY.MANY_TO_MANY.ordinal()){ finalSuffix = selfRelated?"Parents":suffix; } else if(selfRelated){ finalSuffix = suffix; } } return name + finalSuffix; }
Source:
public List<SDVariable> doDiff(List<SDVariable> i_v1) { SDVariable out = outputVariables()[0]; int[] argShape = arg().getShape(); SDVariable expandedOut = sameDiff.f().reductionBroadcastableWithOrigShape(argShape.length, dimensions, out); expandedOut = sameDiff.onesLike("temp0", arg()).mul("tempmul", expandedOut); SDVariable expandedGrad = sameDiff.f().reductionBroadcastableWithOrigShape(argShape.length, dimensions, i_v1.get(0)); SDVariable eq = sameDiff.eq(arg(), expandedOut); SDVariable ret = eq.mul(expandedGrad); return Collections.singletonList(ret); }

Target:
public List<SDVariable> doDiff(List<SDVariable> i_v1) { SDVariable out = outputVariables()[0]; int origRank = Shape.rankFromShape(arg().getShape()); SDVariable expandedOut = sameDiff.f().reductionBroadcastableWithOrigShape(origRank, dimensions, out); expandedOut = sameDiff.onesLike("temp0", arg()).mul("tempmul", expandedOut); SDVariable expandedGrad = sameDiff.f().reductionBroadcastableWithOrigShape(origRank, dimensions, i_v1.get(0)); SDVariable eq = sameDiff.eq(arg(), expandedOut); SDVariable ret = eq.mul(expandedGrad); return Collections.singletonList(ret); }
Source:
public void publish(PublishChangeEditInput input) throws RestApiException { String request = "/changes/"+id+"/edit:publish"; String json = gerritRestClient.getGson().toJson(input); gerritRestClient.postRequest(request,json); }

Target:
public void publish(PublishChangeEditInput input) throws RestApiException { String request = getRequestPath() + ":publish"; String json = gerritRestClient.getGson().toJson(input); gerritRestClient.postRequest(request,json); }
Source:
public static List<Document> collect(Directory directory, int limit) throws IOException { MatchAllDocsQuery allDocsQuery = new MatchAllDocsQuery(); List<Document> docs = new ArrayList<>(limit); IndexSearcher indexSearcher = openSearcher(directory); TopDocs topDocs = indexSearcher.search(allDocsQuery, limit); for (ScoreDoc scoreDoc : topDocs.scoreDocs) { docs.add(indexSearcher.doc(scoreDoc.doc)); } return docs; }

Target:
public static List<Document> collect(Directory directory, int limit) throws IOException { try (DirectoryReader reader = DirectoryReader.open(directory)) { MatchAllDocsQuery allDocsQuery = new MatchAllDocsQuery(); List<Document> docs = new ArrayList<>(limit); IndexSearcher indexSearcher = new IndexSearcher(reader); TopDocs topDocs = indexSearcher.search(allDocsQuery, limit); for (ScoreDoc scoreDoc : topDocs.scoreDocs) { docs.add(indexSearcher.doc(scoreDoc.doc)); } return docs; } }
Source:
private Optional<Long> getLvmSizeForDevice(String device) { Optional<GlusterLocalLogicalVolume> thinVolume = logicalVolumes.stream() .filter(lvmMatchMapperName(device)) .filter(v -> !"".equals(v.getPoolName().trim())) .findAny(); thinVolume = thinVolume.flatMap(v -> logicalVolumes.stream() .filter(lv -> v.getPoolName().equals(lv.getLogicalVolumeName())) .findAny()); Optional<Long> result = thinVolume.map(GlusterLocalLogicalVolume::getFree); List<String> physicalDevices = thinVolume.map(GlusterLocalLogicalVolume::getVolumeGroupName) .map(v -> physicalVolumes.stream() .filter(g -> g.getVolumeGroupName().equals(v)) .map(GlusterLocalPhysicalVolume::getPhysicalVolumeName) .collect(Collectors.toList()) ).orElseGet(Collections::emptyList); if (physicalDevices.size() != 1) { return result; } Optional<Long> innerResult = getThinSizeForDevice(physicalDevices.get(0)); if (innerResult.isPresent()) { result = result.map(s -> s > innerResult.get() ? innerResult.get() : s); } return result; }

Target:
private Optional<Long> getLvmSizeForDevice(String device) { Optional<GlusterLocalLogicalVolume> thinVolume = logicalVolumes.stream() .filter(lvmMatchMapperName(device)) .filter(v -> !v.getPoolName().trim().isEmpty()) .findAny(); thinVolume = thinVolume.flatMap(v -> logicalVolumes.stream() .filter(lv -> v.getPoolName().equals(lv.getLogicalVolumeName())) .findAny()); Optional<Long> result = thinVolume.map(GlusterLocalLogicalVolume::getFree); List<String> physicalDevices = thinVolume.map(GlusterLocalLogicalVolume::getVolumeGroupName) .map(v -> physicalVolumes.stream() .filter(g -> g.getVolumeGroupName().equals(v)) .map(GlusterLocalPhysicalVolume::getPhysicalVolumeName) .collect(Collectors.toList()) ).orElseGet(Collections::emptyList); if (physicalDevices.size() != 1) { return result; } Optional<Long> innerResult = getThinSizeForDevice(physicalDevices.get(0)); if (innerResult.isPresent()) { result = result.map(s -> s > innerResult.get() ? innerResult.get() : s); } return result; }
Source:
public void addCube(Cube cube) { throw new UnsupportedOperationException("Server must have sent Cubes before Columns"); }

Target:
public void addCube(Cube cube) { }
Source:
protected String requireOption(String name, String errorMessage) { String value = options.get(name); if (isBlank(value)) { throw new IllegalArgumentException("Metric Reporter configuration requires option: " + name + (isBlank(errorMessage) ? "" : errorMessage)); } return value; }

Target:
protected String requireOption(String name, String errorMessage) { String value = options.get(name); if (isBlank(value)) { throw new IllegalArgumentException("Metric Reporter configuration requires option: " + name + (isBlank(errorMessage) ? "" : " " + errorMessage)); } return value; }