auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void addCache(Batch batch, Address address, LdapCache cache) { if (cache != null) { String cacheType = null; if (cache.getByAccessTime()) { cacheType = "by-access-time"; } <START> if (cache.getBySearchTime()) { <END> cacheType = "by-search-time"; } batch.add(address.and("cache", cacheType), Values.empty() .andOptional("cache-failures", cache.getCacheFailures()) .andOptional("eviction-time", cache.getEvictionTime()) .andOptional("max-cache-size", cache.getMaxCacheSize())); } }</code><technical_language>else if</technical_language>

Target:
private void addCache(Batch batch, Address address, LdapCache cache) { if (cache != null) { String cacheType = null; if (cache.getByAccessTime()) { cacheType = "by-access-time"; } else if (cache.getBySearchTime()) { cacheType = "by-search-time"; } batch.add(address.and("cache", cacheType), Values.empty() .andOptional("cache-failures", cache.getCacheFailures()) .andOptional("eviction-time", cache.getEvictionTime()) .andOptional("max-cache-size", cache.getMaxCacheSize())); } }
Source:
<code>public void enhanceMetadata(Context context) { super.enhanceMetadata(context); <START> context.put(RuleMetadata.CATEGORY, "Java"); <END> }</code><technical_language>Windup/Discover/Java</technical_language>

Target:
public void enhanceMetadata(Context context) { super.enhanceMetadata(context); context.put(RuleMetadata.CATEGORY, "Java/Discover"); }
Source:
<code>public void drop(LanguageConnectionContext lcc) throws StandardException { DataDictionary dd = getDataDictionary(); DependencyManager dm = getDataDictionary().getDependencyManager(); TransactionController tc = lcc.getTransactionExecute(); dm.invalidateFor(this, DependencyManager.DROP_TRIGGER, lcc); dd.dropTriggerDescriptor(this, tc); dm.clearDependencies(lcc, this); for (UUID actionId: this.actionSPSIdList) { SPSDescriptor spsd = dd.getSPSDescriptor(actionId); dm.invalidateFor(spsd, DependencyManager.DROP_TRIGGER, lcc); dm.clearDependencies(lcc, spsd); dd.dropSPSDescriptor(spsd, tc); <START> lcc.popAllTriggerExecutionContexts(); END> } if (getWhenClauseId() != null) { SPSDescriptor spsd = dd.getSPSDescriptor(getWhenClauseId()); dm.invalidateFor(spsd, DependencyManager.DROP_TRIGGER, lcc); dm.clearDependencies(lcc, spsd); dd.dropSPSDescriptor(spsd, tc); } }</code><technical_language>move this call out of loop</technical_language>

Target:
public void drop(LanguageConnectionContext lcc) throws StandardException { DataDictionary dd = getDataDictionary(); DependencyManager dm = getDataDictionary().getDependencyManager(); TransactionController tc = lcc.getTransactionExecute(); dm.invalidateFor(this, DependencyManager.DROP_TRIGGER, lcc); dd.dropTriggerDescriptor(this, tc); dm.clearDependencies(lcc, this); for (UUID actionId: this.actionSPSIdList) { SPSDescriptor spsd = dd.getSPSDescriptor(actionId); dm.invalidateFor(spsd, DependencyManager.DROP_TRIGGER, lcc); dm.clearDependencies(lcc, spsd); dd.dropSPSDescriptor(spsd, tc); } lcc.popAllTriggerExecutionContexts(); if (getWhenClauseId() != null) { SPSDescriptor spsd = dd.getSPSDescriptor(getWhenClauseId()); dm.invalidateFor(spsd, DependencyManager.DROP_TRIGGER, lcc); dm.clearDependencies(lcc, spsd); dd.dropSPSDescriptor(spsd, tc); } }
Source:
<code>public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) { List <START> items; <END> if (root == null) { items = Collections.emptyList(); } else { items = getAllWhiteCheckedItems(); for (Object object : items) { setTreeChecked(object, false); } } treeViewer.setContentProvider(contentProvider); treeViewer.setLabelProvider(labelProvider); treeContentProvider = contentProvider; treeLabelProvider = labelProvider; for (Object object : items) { setTreeChecked(object, true); } }</code><technical_language>this line produce a "raw type" warning</technical_language>

Target:
public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) { List<?> items; if (root == null) { items = Collections.emptyList(); } else { items = getAllWhiteCheckedItems(); for (Object object : items) { setTreeChecked(object, false); } } treeViewer.setContentProvider(contentProvider); treeViewer.setLabelProvider(labelProvider); treeContentProvider = contentProvider; treeLabelProvider = labelProvider; for (Object object : items) { setTreeChecked(object, true); } }
Source:
<code>public String index(Request request, Response response) throws IOException { Map<AgentInstance, Collection<EnvironmentConfig>> agentToEnvConfigsMap = new HashMap<>(); <START> agentService.getAgentInstances().values().forEach(instance -> agentToEnvConfigsMap.put(instance, environmentConfigService.getAgentEnvironments(instance.getUuid()))); <END> return writerForTopLevelObject(request, response, outputWriter -> AgentsRepresenter.toJSON(outputWriter, agentToEnvConfigsMap, securityService, currentUsername())); }</code><technical_language>agentService.getAgentInstances() return a list of AgentInstance a map</technical_language>

Target:
public String index(Request request, Response response) throws IOException { Map<AgentInstance, Collection<EnvironmentConfig>> agentToEnvConfigsMap = new HashMap<>(); agentService.getAgentInstances().forEach(instance -> agentToEnvConfigsMap.put(instance, environmentConfigService.getAgentEnvironments(instance.getUuid()))); return writerForTopLevelObject(request, response, outputWriter -> AgentsRepresenter.toJSON(outputWriter, agentToEnvConfigsMap, securityService, currentUsername())); }
Source:
<code>private void runTests() throws DeviceNotAvailableException { mDevice.runInstrumentationTests(mRunner, mLaunchListener); if <START> (mLaunchListener.getCurrentRunResults().hasFailedTests()) { <END> throw new RuntimeException("Some tests failed!"); } }</code><technical_language>nit: want check mLaunchListener.getCurrentRunREsults().isRunFailure() in case of crash know</technical_language>

Target:
private void runTests() throws DeviceNotAvailableException { mDevice.runInstrumentationTests(mRunner, mLaunchListener); final TestRunResult runResults = mLaunchListener.getCurrentRunResults(); if (runResults.isRunFailure()) { throw new RuntimeException("Error: test run failed!"); } if (runResults.hasFailedTests()) { throw new RuntimeException("Error: some tests failed!"); } }
Source:
<code>StaticProviderDefinition() { super(new Parameters(PathElement.pathElement(STATIC_PROVIDER), DiscoveryExtension.getResourceDescriptionResolver(STATIC_PROVIDER)) <START> .setAddHandler(StaticProviderAddHandler.getInstance()) <END> .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setCapabilities(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)); }</code><technical_language>Needs a remove handler</technical_language>

Target:
StaticProviderDefinition() { super(new Parameters(PathElement.pathElement(STATIC_PROVIDER), DiscoveryExtension.getResourceDescriptionResolver(STATIC_PROVIDER)) .setAddHandler(StaticProviderAddHandler.getInstance()) .setRemoveHandler(new TrivialRemoveStepHandler(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)) .setCapabilities(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)); }
Source:
<code>public void testFormatDateForInstructorPages() { ZoneId zoneId = ZoneId.of("UTC"); Instant instant = LocalDateTime.of(2018, Month.AUGUST, 18, 0, 0).atZone(zoneId).toInstant(); assertEquals("18 Aug 2018", TimeHelper.formatDateForInstructorPages(instant, zoneId)); <START> Instant instantWithNonZeroTime = LocalDateTime.of(2018, Month.AUGUST, 18, 12, 10).atZone(zoneId).toInstant(); <END> assertEquals("18 Aug 2018", TimeHelper.formatDateForInstructorPages(instantWithNonZeroTime, zoneId)); }</code><technical_language>need create a new attribute here. instant declared above</technical_language>

Target:
public void testFormatDateForInstructorPages() { ZoneId zoneId = ZoneId.of("UTC"); Instant instant = LocalDateTime.of(2018, Month.AUGUST, 18, 0, 0).atZone(zoneId).toInstant(); assertEquals("18 Aug 2018", TimeHelper.formatDateForInstructorPages(instant, zoneId)); assertEquals("", TimeHelper.formatDateForInstructorPages(null, zoneId)); }
Source:
<code>public DatabaseSAML2ClientConfiguration(final SamlClientDao dao) { super(); if (dao == null) { <START> throw new IllegalArgumentException("DAO must not be null."); <END> } this.dao = dao; }</code><technical_language>Lets' throw TechnicalException pac4j spirit..</technical_language>

Target:
public DatabaseSAML2ClientConfiguration(final SamlClientDao dao) { super(); CommonHelper.assertNotNull("dao", dao); this.dao = dao; }
Source:
<code>public Function<@NonNull ISegment, @Nullable Long> getMapper() { <START> return (o) -> { <END> return o.getEnd(); }; }</code><technical_language>For short: return o -> checkNotNull(fSegmentStats.get(o)).getMin();</technical_language>

Target:
public Function<@NonNull ISegment, @Nullable Long> getMapper() { return o -> o.getEnd(); }
Source:
<code><START> private List<EncryptionGroup> toEncryptionGroups(List<DwrfProto.EncryptionGroup> encryptionGroups) <END> { ImmutableList.Builder<EncryptionGroup> encryptionGroupBuilder = ImmutableList.builder(); for (DwrfProto.EncryptionGroup dwrfEncryptionGroup : encryptionGroups) { encryptionGroupBuilder.add(new EncryptionGroup( dwrfEncryptionGroup.getNodesList(), dwrfEncryptionGroup.hasKeyMetadata() ? Optional.of(byteStringToSlice(dwrfEncryptionGroup.getKeyMetadata())) : Optional.empty(), byteStringToSlice(dwrfEncryptionGroup.getStatistics()))); } return encryptionGroupBuilder.build(); }</code><technical_language>this method static</technical_language>

Target:
private static List<EncryptionGroup> toEncryptionGroups(List<DwrfProto.EncryptionGroup> encryptionGroups) { ImmutableList.Builder<EncryptionGroup> encryptionGroupBuilder = ImmutableList.builder(); for (DwrfProto.EncryptionGroup dwrfEncryptionGroup : encryptionGroups) { encryptionGroupBuilder.add(new EncryptionGroup( dwrfEncryptionGroup.getNodesList(), dwrfEncryptionGroup.hasKeyMetadata() ? Optional.of(byteStringToSlice(dwrfEncryptionGroup.getKeyMetadata())) : Optional.empty(), byteStringToSlice(dwrfEncryptionGroup.getStatistics()))); } return encryptionGroupBuilder.build(); }
Source:
<code>protected void executeCommand() { <START> VDSGroup vdsGroup = getVdsGroup(); <END> vdsGroup.setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); vdsGroup.setDetectEmulatedMachine(true); vdsGroupDao.save(vdsGroup); alertIfFencingDisabled(); if (getParameters().getVdsGroup().getStoragePoolId() != null) { attachManagementNetwork(); } if (FeatureSupported.cpuQoS(getParameters().getVdsGroup().getCompatibilityVersion())) { getCpuProfileDao().save(CpuProfileHelper.createCpuProfile(getParameters().getVdsGroup().getId(), getParameters().getVdsGroup().getName())); } if (vdsGroup.getFeaturesSupported() != null && !vdsGroup.getFeaturesSupported().isEmpty()) { for(ClusterFeature feature:vdsGroup.getFeaturesSupported()){ feature.setVdsGroupId(vdsGroup.getId()); } getClusterFeatureDao().saveAll(vdsGroup.getFeaturesSupported()); } setActionReturnValue(vdsGroup.getId()); setSucceeded(true); }</code><technical_language>s/vdsGroup/cluster</technical_language>

Target:
protected void executeCommand() { VDSGroup cluster = getVdsGroup(); cluster.setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); cluster.setDetectEmulatedMachine(true); vdsGroupDao.save(cluster); alertIfFencingDisabled(); if (getParameters().getVdsGroup().getStoragePoolId() != null) { attachManagementNetwork(); } if (FeatureSupported.cpuQoS(getParameters().getVdsGroup().getCompatibilityVersion())) { getCpuProfileDao().save(CpuProfileHelper.createCpuProfile(getParameters().getVdsGroup().getId(), getParameters().getVdsGroup().getName())); } if (CollectionUtils.isNotEmpty(cluster.getFeaturesSupported())) { for (ClusterFeature feature : cluster.getFeaturesSupported()) { feature.setClusterId(cluster.getId()); } clusterFeatureDao.addAllSupportedClusterFeature(cluster.getFeaturesSupported()); } setActionReturnValue(cluster.getId()); setSucceeded(true); }
Source:
<code>public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { <START> return process(templatePath, format, templateName); <END> }</code><technical_language>this is right. closes door for implementing this for KVM (and other below) If this is applicable for format VMware/OVA bit generic interface. If do expect future implementation teh call hierarchy reversed: specific version calling more generic one</technical_language>

Target:
public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { if (format != null) { s_logger.debug("We currently don't handle conversion from " + format + " to QCOW2."); return null; } String qcow2Path = templatePath + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension(); if (!_storage.exists(qcow2Path)) { s_logger.debug("Unable to find the qcow2 file: " + qcow2Path); return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.QCOW2; info.filename = templateName + "." + ImageFormat.QCOW2.getFileExtension(); File qcow2File = _storage.getFile(qcow2Path); info.size = _storage.getSize(qcow2Path); try { info.virtualSize = getTemplateVirtualSize(qcow2File); } catch (IOException e) { s_logger.error("Unable to get virtual size from " + qcow2File.getName()); throw new InternalErrorException("unable to get virtual size from qcow2 file"); } return info; }
Source:
<code>AcquireTokenRequest(final Context appContext, final AuthenticationContext authContext, final APIEvent apiEvent) { mContext = appContext; mAuthContext = authContext; if (authContext.getCache() != null && apiEvent != null) { mTokenCacheAccessor = new TokenCacheAccessor(authContext.getCache(), <START> authContext.getAuthority(), apiEvent.getRequestId()); <END> } mBrokerProxy = new BrokerProxy(appContext); mAPIEvent = apiEvent; }</code><technical_language>request id is telemetry request id, right? if so, telemetryRequestId clear. AuthenticationRequest is a request id, confusing. :) #Resolved</technical_language>

Target:
AcquireTokenRequest(final Context appContext, final AuthenticationContext authContext, final APIEvent apiEvent) { mContext = appContext; mAuthContext = authContext; if (authContext.getCache() != null && apiEvent != null) { mTokenCacheAccessor = new TokenCacheAccessor(authContext.getCache(), authContext.getAuthority(), apiEvent.getTelemetryRequestId()); } mBrokerProxy = new BrokerProxy(appContext); mAPIEvent = apiEvent; }
Source:
<code>public void init() { scheduledTask = executor.scheduleWithFixedDelay( () -> { try { refreshRegistryEntries(); } catch (FederationAdminException | InterruptedException e) { LOGGER.error("Problem refreshing registry entries.", e); Thread.currentThread().interrupt(); } <START> }, <END> 10, refreshIntervalSeconds, TimeUnit.SECONDS); }</code><technical_language>want thread interrupt if a FederationAdminException is thrown</technical_language>

Target:
public void init() { scheduledTask = executor.scheduleWithFixedDelay( () -> { try { refreshRegistryEntries(); } catch (FederationAdminException e) { LOGGER.error("Problem refreshing registry entries.", e); } catch (InterruptedException e) { LOGGER.error("Thread interrupted while refreshing registry entries.", e); Thread.currentThread().interrupt(); } }, 10, refreshIntervalSeconds, TimeUnit.SECONDS); }
Source:
<code>public String toString() { <START> return "SubscribeCommand[" + command.toString() + " " + spec + "]"; <END> }</code><technical_language>toString() necessary. + call for you</technical_language>

Target:
public String toString() { return "SubscribeCommand[" + command + " " + spec + "]"; }
Source:
<code>public void preInitColoredLights(FMLPreInitializationEvent event) { <START> lightHelper = new LightHelperColored(); <END> }</code><technical_language>test this? work. class works own, easier test if mod is loaded Optional</technical_language>

Target:
public void preInitColoredLights(FMLPreInitializationEvent event) { System.out.println("easycolor!"); lightHelper = new LightHelperColored(); }
Source:
<code><S, T> T attemptUntilTimeLimitOrException( S request, Duration duration, BiFunction<S, Duration, S> durationLimiter, Function<S, T> query, Predicate<T> isTimedOutResponse) { Instant now = clock.instant(); Instant deadline = now.plus(duration); S currentRequest = request; T currentResponse = null; while (now.isBefore(deadline)) { Duration remainingTime = Duration.between(now, deadline); currentRequest = durationLimiter.apply(currentRequest, remainingTime); try { currentResponse = query.apply(currentRequest); if (!isTimedOutResponse.test(currentResponse)) { return currentResponse; } <START> } catch (Exception e) { <END> if (!isPlausiblyTimeout(e) || clock.instant().isAfter(deadline)) { throw e; } } now = clock.instant(); } Preconditions.checkNotNull(currentResponse, "We attempted to return because a blocking duration was" + " reached. However, we had never tried applying the query. This indicates a bug in user requests" + " or AtlasDB code."); return currentResponse; }</code><technical_language>this a RuntimeException? checked exceptions</technical_language>

Target:
<S, T> T attemptUntilTimeLimitOrException( S request, Duration duration, BiFunction<S, Duration, S> durationLimiter, Function<S, T> query, Predicate<T> isTimedOutResponse) { Instant now = clock.instant(); Instant deadline = now.plus(duration); S currentRequest = request; T currentResponse = null; while (now.isBefore(deadline)) { Duration remainingTime = Duration.between(now, deadline); currentRequest = durationLimiter.apply(currentRequest, remainingTime); try { currentResponse = query.apply(currentRequest); if (!isTimedOutResponse.test(currentResponse)) { return currentResponse; } } catch (RuntimeException e) { if (!isPlausiblyTimeout(e) || clock.instant().isAfter(deadline)) { throw e; } } now = clock.instant(); } Preconditions.checkNotNull(currentResponse, "We attempted to return because a blocking duration was" + " reached. However, we had never tried applying the query. This indicates a bug in user requests" + " or AtlasDB code."); return currentResponse; }
Source:
<code>public <T extends ComputerLauncher> T setLauncher(Class<T> type) { try { selectType(type); } catch (NoSuchElementException x) { save(); try { <START> getJenkins().getPluginManager().installPlugins(new PluginSpec("command-launcher", null)); <END> } catch (IOException x2) { throw new AssertionError(x2); } configure(); selectType(type); } return newInstance(type, this, "/launcher"); }</code><technical_language>sense check Launcher's class selectType(). try install plugin for other Launcher types</technical_language>

Target:
public <T extends ComputerLauncher> T setLauncher(Class<T> type) { try { selectType(type); } catch (NoSuchElementException x) { if (type == CommandSlaveLauncher.class) { save(); try { getJenkins().getPluginManager().installPlugins(new PluginSpec("command-launcher", null)); } catch (IOException x2) { throw new AssertionError(x2); } configure(); selectType(type); } else { throw x; } } return newInstance(type, this, "/launcher"); }
Source:
<code>public boolean validateAmountsAndDebitCreditCode(ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile) { KualiDecimal journalTotal = concurStandardAccountingExtractFile.getJournalAmountTotal(); KualiDecimal detailTotal = KualiDecimal.ZERO; <START> boolean debbitCreditValid = true; <END> boolean employeeGroupIdValid = true; for (ConcurStandardAccountingExtractDetailLine line : concurStandardAccountingExtractFile .getConcurStandardAccountingExtractDetailLines()) { detailTotal = detailTotal.add(line.getJournalAmount()); debbitCreditValid &= validateDebitCreditField(line.getJounalDebitCredit()); employeeGroupIdValid &= validateEmployeeGroupId(line.getEmployeeGroupId()); } boolean journalTotalValidation = journalTotal.equals(detailTotal); if (journalTotalValidation) { LOG.debug("validateAmounts, journal total: " + journalTotal.doubleValue() + " and detailTotal: " + detailTotal.doubleValue() + " do match."); } else { LOG.error("validateAmounts, The journal total (" + journalTotal + ") does not equal the detail line total (" + detailTotal + ")"); } return journalTotalValidation && debbitCreditValid && employeeGroupIdValid; }</code><technical_language>Minor typo in variable name</technical_language>

Target:
public boolean validateAmountsAndDebitCreditCode(ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile) { KualiDecimal journalTotal = concurStandardAccountingExtractFile.getJournalAmountTotal(); KualiDecimal detailTotal = KualiDecimal.ZERO; boolean debitCreditValid = true; boolean employeeGroupIdValid = true; for (ConcurStandardAccountingExtractDetailLine line : concurStandardAccountingExtractFile .getConcurStandardAccountingExtractDetailLines()) { detailTotal = detailTotal.add(line.getJournalAmount()); debitCreditValid &= validateDebitCreditField(line.getJounalDebitCredit()); employeeGroupIdValid &= validateEmployeeGroupId(line.getEmployeeGroupId()); } boolean journalTotalValidation = journalTotal.equals(detailTotal); if (journalTotalValidation) { LOG.debug("validateAmounts, journal total: " + journalTotal.doubleValue() + " and detailTotal: " + detailTotal.doubleValue() + " do match."); } else { LOG.error("validateAmounts, The journal total (" + journalTotal + ") does not equal the detail line total (" + detailTotal + ")"); } return journalTotalValidation && debitCreditValid && employeeGroupIdValid; }
Source:
<code>private boolean isReversedAdapter(final Class<?> payloadType, final Class<?> aClass, final Adapter<?, ?> instance) { if (TypeAwareAdapter.class.isInstance(instance)) { return !payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getTo())) && payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getFrom())); } final Type[] genericInterfaces = aClass.getGenericInterfaces(); return Stream.of(genericInterfaces).filter(ParameterizedType.class::isInstance) .filter(i -> ParameterizedType.class.cast(i).getRawType() instanceof Class) <START> .filter(i -> ParameterizedType.class.cast(i).getActualTypeArguments()[0] instanceof Class) <END> .filter(i -> Adapter.class.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(i).getRawType()))) .findFirst() .map(pt -> payloadType.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(pt).getActualTypeArguments()[0]))) .orElseGet(() -> { final Class<?> superclass = aClass.getSuperclass(); return superclass != Object.class && isReversedAdapter(payloadType, superclass, instance); }); }</code><technical_language>check length in this lambda, fail ;)</technical_language>

Target:
private boolean isReversedAdapter(final Class<?> payloadType, final Class<?> aClass, final Adapter<?, ?> instance) { if (TypeAwareAdapter.class.isInstance(instance)) { return !payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getTo())) && payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getFrom())); } final Type[] genericInterfaces = aClass.getGenericInterfaces(); return Stream.of(genericInterfaces).filter(ParameterizedType.class::isInstance) .filter(i -> ParameterizedType.class.cast(i).getRawType() instanceof Class) .filter(i -> Objects.nonNull(ParameterizedType.class.cast(i).getActualTypeArguments()) && ParameterizedType.class.cast(i).getActualTypeArguments().length>0) .filter(i -> ParameterizedType.class.cast(i).getActualTypeArguments()[0] instanceof Class) .filter(i -> Adapter.class.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(i).getRawType()))) .findFirst() .map(pt -> payloadType.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(pt).getActualTypeArguments()[0]))) .orElseGet(() -> { final Class<?> superclass = aClass.getSuperclass(); return superclass != Object.class && isReversedAdapter(payloadType, superclass, instance); }); }
Source:
<code>public void executeDelayedDisposal() { <START> synchronized (this) { <END> for (int i = 0; i < abandonedTables.size(); i++) { long nativePointer = abandonedTables.get(i); Table.nativeClose(nativePointer); } abandonedTables.clear(); for (int i = 0; i < abandonedTableViews.size(); i++) { long nativePointer = abandonedTableViews.get(i); TableView.nativeClose(nativePointer); } abandonedTableViews.clear(); for (int i = 0; i < abandonedQueries.size(); i++) { long nativePointer = abandonedQueries.get(i); TableQuery.nativeClose(nativePointer); } abandonedQueries.clear(); cleanNativeReferences(); } }</code><technical_language>This is a suggestion. in alignment public synchronized void addReference() if this synchronized statement turns a synchronized method</technical_language>

Target:
public synchronized void executeDelayedDisposal() { for (int i = 0; i < abandonedTables.size(); i++) { long nativePointer = abandonedTables.get(i); Table.nativeClose(nativePointer); } abandonedTables.clear(); for (int i = 0; i < abandonedTableViews.size(); i++) { long nativePointer = abandonedTableViews.get(i); TableView.nativeClose(nativePointer); } abandonedTableViews.clear(); for (int i = 0; i < abandonedQueries.size(); i++) { long nativePointer = abandonedQueries.get(i); TableQuery.nativeClose(nativePointer); } abandonedQueries.clear(); cleanNativeReferences(); }
Source:
<code><START> private StringBuilder appendToString(StringBuilder builder, String indent){ <END> int i = 0; for (Type field : schema.getFields()) { String name = field.getName(); List<Object> values = data[i]; ++i; if (values != null && !values.isEmpty()) { for (Object value : values) { builder.append(indent).append(name); if (value == null) { builder.append(": NULL\n"); } else if (value instanceof Group) { builder.append("\n").append(((SimpleGroup)value).appendToString(builder,indent+" ")); } else { builder.append(": " ).append(value.toString()).append("\n"); } } } } return builder; }</code><technical_language>nit: suggestion private StringBuilder appendToString(StringBuilder builder, String indent) {</technical_language>

Target:
private StringBuilder appendToString(StringBuilder builder, String indent) { int i = 0; for (Type field : schema.getFields()) { String name = field.getName(); List<Object> values = data[i]; ++i; if (values != null && !values.isEmpty()) { for (Object value : values) { builder.append(indent).append(name); if (value == null) { builder.append(": NULL\n"); } else if (value instanceof Group) { builder.append('\n'); ((SimpleGroup) value).appendToString(builder, indent + " "); } else { builder.append(": ").append(value.toString()).append('\n'); } } } } return builder; }
Source:
<code>public static PrestoException toPrestoException(Exception e) { if ((e instanceof TTransportException) && "No hosts available".equals(e.getMessage())) { throw new PrestoException(THRIFT_SERVICE_NO_AVAILABLE_HOSTS, e); } if ((e instanceof TApplicationException) || (e instanceof PrestoThriftServiceException)) { <START> return new PrestoException(THRIFT_SERVICE_GENERIC_REMOTE_ERROR, "Exception raised by remote Thrift server. Original error message: " + e.getMessage(), e); <END> } if (e instanceof TException) { return new PrestoException(THRIFT_SERVICE_CONNECTION_ERROR, "Error communicating with remote Thrift server", e); } throw new PrestoException(GENERIC_INTERNAL_ERROR, e); }</code><technical_language>"Exception raised remote Thrift server: " + e.getMessage() more concise</technical_language>

Target:
public static PrestoException toPrestoException(Exception e) { if ((e instanceof TTransportException) && "No hosts available".equals(e.getMessage())) { throw new PrestoException(THRIFT_SERVICE_NO_AVAILABLE_HOSTS, e); } if ((e instanceof TApplicationException) || (e instanceof PrestoThriftServiceException)) { return new PrestoException(THRIFT_SERVICE_GENERIC_REMOTE_ERROR, "Exception raised by remote Thrift server: " + e.getMessage(), e); } if (e instanceof TException) { return new PrestoException(THRIFT_SERVICE_CONNECTION_ERROR, "Error communicating with remote Thrift server", e); } throw new PrestoException(GENERIC_INTERNAL_ERROR, e); }
Source:
<code>private ValueHolder<V> getValue(final ValueHolder<V> cachedValue) { if (cachedValue instanceof Fault) { return ((Fault<V>)cachedValue).get(); } <START> return cachedValue; <END> }</code><technical_language>Code style preference ... stick explicit else. If screw if branch longer return, this compile fine. previous version fail is a missing return statement</technical_language>

Target:
private ValueHolder<V> getValue(final ValueHolder<V> cachedValue) { if (cachedValue instanceof Fault) { return ((Fault<V>)cachedValue).get(); } else { return cachedValue; } }
Source:
<code>public boolean isStopped() { if (! stopped && this.spiderParam.getMaxDuration() > 0) { <START> if ((new Date().getTime() - this.timeStarted.getTime()) > (this.spiderParam.getMaxDuration() * 60000)) { <END> log.info("Spidering process has exceeded maxDuration of " + this.spiderParam.getMaxDuration() + " minute(s)"); this.stop(); } } return stopped; }</code><technical_language>TimeUnit.MILLISECONDS.toMinutes() here</technical_language>

Target:
public boolean isStopped() { if (! stopped && this.spiderParam.getMaxDuration() > 0) { if (TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - this.timeStarted) > this.spiderParam.getMaxDuration()) { log.info("Spidering process has exceeded maxDuration of " + this.spiderParam.getMaxDuration() + " minute(s)"); this.complete(); } } return stopped; }
Source:
<code>public static ResultSet queryParentRepairHistory(AbstractCluster<?> cluster, int coordinator, String ks, String table) { Set<String> tableNames = table == null? Collections.emptySet() : ImmutableSet.of(table); ResultSet rs = null; Exception latestException = null; for (int i = 0; i < 10; i++) { try { rs = cluster.coordinator(coordinator) .executeWithResult("SELECT * FROM system_distributed.parent_repair_history", ConsistencyLevel.QUORUM) .filter(row -> ks.equals(row.getString("keyspace_name"))) .filter(row -> tableNames.equals(row.getSet("columnfamily_names"))); break; } catch (Exception e) { latestException = e; rs = null; Uninterruptibles.sleepUninterruptibly( (i + 1) * 300, TimeUnit.MILLISECONDS); } } if (rs == null) { if (latestException == null) { Assert.fail("Unable to query system_distributed.parent_repair_history, got back neither result set or exception "); } <START> if (latestException instanceof RuntimeException) <END> throw (RuntimeException) latestException; throw new RuntimeException(latestException); } return rs; }</code><technical_language>Intellij this is true</technical_language>

Target:
public static QueryResult queryParentRepairHistory(AbstractCluster<?> cluster, int coordinator, String ks, String table) { Set<String> tableNames = table == null? Collections.emptySet() : ImmutableSet.of(table); QueryResult rs = retryWithBackoffBlocking(10, () -> cluster.coordinator(coordinator) .executeWithResult("SELECT * FROM system_distributed.parent_repair_history", ConsistencyLevel.QUORUM) .filter(row -> ks.equals(row.getString("keyspace_name"))) .filter(row -> tableNames.equals(row.getSet("columnfamily_names")))); return rs; }
Source:
<code>public synchronized void updateConfig(AvroType avro) { if (avro == null) { avro = new AvroType(); <START> avro.setRegistry(""); <END> } if (m_avro == null || !Objects.equals(m_avro.getRegistry(), avro.getRegistry())) { m_schemaRegistryClient = new CachedSchemaRegistryClient(avro.getRegistry().trim(), 10000); } if (m_avro == null || !Objects.equals(m_avro.getPrefix(), avro.getPrefix()) || !Objects.equals(m_avro.getNamespace(), avro.getNamespace())) { m_decoderMap.clear(); } m_avro = avro; }</code><technical_language>this sense? This serializer work if a url. assumes is localhost default port I default</technical_language>

Target:
public synchronized void updateConfig(AvroType avro) { if (avro == null) { if (m_schemaRegistryClient != null) { m_schemaRegistryClient.reset(); m_schemaRegistryClient = null; } m_decoderMap.clear(); m_avro = avro; return; } if (m_avro == null || !Objects.equals(m_avro.getRegistry(), avro.getRegistry())) { if (m_schemaRegistryClient != null) { m_schemaRegistryClient.reset(); } m_schemaRegistryClient = new CachedSchemaRegistryClient(avro.getRegistry().trim(), 10000); } if (m_avro == null || !Objects.equals(m_avro.getPrefix(), avro.getPrefix()) || !Objects.equals(m_avro.getNamespace(), avro.getNamespace())) { m_decoderMap.clear(); } m_avro = avro; }
Source:
<code>static MongoDatabaseRule create() { final MongoClient client; if (MongoAssertions.mongoIntegrationTestsEnabled()) { client = new MongoClient("localhost"); <START> } else { <END> client = new Fongo(MongoDatabaseRule.class.getSimpleName()).getMongo(); client.getDatabase(DB_NAME).getCollection("__fongo__").insertOne(new Document()); } return new MongoDatabaseRule(client); }</code><technical_language>tests disabled if calcite.test.mongodb is false</technical_language>

Target:
static MongoDatabaseRule create() { final MongoClient client; if (MongoAssertions.useMongo()) { client = new MongoClient(); } else if (MongoAssertions.useFongo()) { client = new Fongo(MongoDatabaseRule.class.getSimpleName()).getMongo(); } else { throw new UnsupportedOperationException("I can only connect to Mongo or Fongo instances"); } return new MongoDatabaseRule(client); }
Source:
<code><START> private void fillStruct(@NonNull BitBuffer input, final IDefinition[] myFields, StructDefinition structDefinition) throws CTFException { <END> for (int i = 0; i < fFields.length; i++) { myFields[i] = fFields[i].createDefinition(structDefinition, fFieldNames[i], input); } }</code><technical_language>synchronized</technical_language>

Target:
private void fillStruct(@NonNull BitBuffer input, final IDefinition[] myFields, StructDefinition structDefinition) throws CTFException { final @NonNull String[] fieldNames = fFieldNames; final @NonNull IDeclaration[] fields = fFields; for (int i = 0; i < fields.length; i++) { myFields[i] = fields[i].createDefinition(structDefinition, fieldNames[i], input); } }
Source:
<code>private List<ProcessInstanceSummary> getProcessInstancesByParentId(ProcessInstanceKey processInstanceKey, String containerId){ <START> if (processInstanceKey == null || processInstanceKey.isValid() == false) { <END> return null; } ProcessServicesClient processServicesClient = getClient(processInstanceKey.getServerTemplateId(), ProcessServicesClient.class); List<ProcessInstance> processInstances = processServicesClient.findProcessInstancesByParent(containerId, processInstanceKey.getProcessInstanceId(), Arrays.asList(1, 2, 3), 0, Integer.MAX_VALUE); ProcessInstanceSummaryMapper processInstanceSummaryMapper = new ProcessInstanceSummaryMapper(processInstanceKey.getServerTemplateId()); return processInstances.stream().map(processInstance -> processInstanceSummaryMapper.apply(processInstance)).collect(toList()); }</code><technical_language>processInstanceKey.isValid() == false -> !processInstanceKey.isValid()</technical_language>

Target:
private List<ProcessInstanceSummary> getProcessInstancesByParentId(ProcessInstanceKey processInstanceKey, String containerId) { if (processInstanceKey == null || !processInstanceKey.isValid()) { return null; } ProcessServicesClient processServicesClient = getClient(processInstanceKey.getServerTemplateId(), ProcessServicesClient.class); List<ProcessInstance> processInstances = processServicesClient.findProcessInstancesByParent(containerId, processInstanceKey.getProcessInstanceId(), Arrays.asList(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE, org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED, org.kie.api.runtime.process.ProcessInstance.STATE_ABORTED, org.kie.api.runtime.process.ProcessInstance.STATE_PENDING, org.kie.api.runtime.process.ProcessInstance.STATE_SUSPENDED), 0, Integer.MAX_VALUE); ProcessInstanceSummaryMapper processInstanceSummaryMapper = new ProcessInstanceSummaryMapper(processInstanceKey.getServerTemplateId()); return processInstances.stream().map(processInstanceSummaryMapper).collect(toList()); }
Source:
<code>private static OutputStream asyncOutputStream(final OutputStream out) throws IOException { PipedOutputStream pos = new PipedOutputStream(); final PipedInputStream pis = new PipedInputStream(pos); new Thread(new Runnable() { @Override public void run() { try { <START> byte[] bytes = new byte[8192]; <END> for(int len; (len = pis.read(bytes)) > 0;) out.write(bytes, 0, len); } catch(IOException ioe) { throw new RuntimeException(ioe); } finally { close(pis); close(out); } } }, "async-output-stream").start(); return pos; }</code><technical_language>IOUtils.copy</technical_language>

Target:
private static OutputStream asyncOutputStream(final OutputStream out) throws IOException { PipedOutputStream pos = new PipedOutputStream(); final PipedInputStream pis = new PipedInputStream(pos); new Thread(() -> { try { IOUtils.copy(pis, out); } catch(IOException ioe) { throw new RuntimeException(ioe); } finally { close(pis); close(out); } }, "async-output-stream").start(); return pos; }
Source:
<code>void updateDecorations(ArrayDouble interpolatedStates) { int idx = getStartIndexInFileNotIncludingTime(); <START> setPoint(new double[]{interpolatedStates.get(idx)/conversion, <END> interpolatedStates.get(idx+1)/conversion, interpolatedStates.get(idx+2)/conversion}); }</code><technical_language>point data held in interpolatedStates? is confusing</technical_language>

Target:
void updateDecorations(ArrayDouble interpolatedStates) { int idx = getStartIndexInFileNotIncludingTime(); setPoint(new double[]{interpolatedStates.get(idx)*conversion, interpolatedStates.get(idx+1)*conversion, interpolatedStates.get(idx+2)*conversion}); }
Source:
<code>public void internalAddNodeToCore(RMNode configuredNode) { String nodeURL = configuredNode.getNodeURL(); if (!this.allNodes.containsKey(nodeURL)) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " was not known"); return; } RMNode rmnode = this.allNodes.remove(nodeURL); this.allNodes.put(nodeURL, configuredNode); if (toShutDown) { logger.warn("Node " + rmnode.getNodeURL() + " will not be added to the core as the resource manager is shutting down"); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } <START> if(isNumberOfNodesLimited() && isMaximumNumberOfNodesReached()) { <END> logger.warn("Node " + rmnode.getNodeURL() + " is removed because the Resource Manager is limited to "+ maximumNumberOfNodes +" nodes."); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); throw new AddingNodesException("Maximum number of nodes reached: "+ maximumNumberOfNodes); } if (rmnode.isToRemove()) { removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } if (rmnode.isDown()) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " is already down"); return; } internalSetFree(configuredNode); }</code><technical_language>applied formatting (no space if ()</technical_language>

Target:
public void internalAddNodeToCore(RMNode configuredNode) { String nodeURL = configuredNode.getNodeURL(); if (!this.allNodes.containsKey(nodeURL)) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " was not known"); return; } RMNode rmnode = this.allNodes.remove(nodeURL); this.allNodes.put(nodeURL, configuredNode); if (toShutDown) { logger.warn("Node " + rmnode.getNodeURL() + " will not be added to the core as the resource manager is shutting down"); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } if (isNumberOfNodesLimited() && isMaximumNumberOfNodesReachedIncludingAskingNode()) { logger.warn("Node " + rmnode.getNodeURL() + " is removed because the Resource Manager is limited to " + maximumNumberOfNodes + " nodes."); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); throw new AddingNodesException("Maximum number of nodes reached: " + maximumNumberOfNodes); } if (rmnode.isToRemove()) { removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } if (rmnode.isDown()) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " is already down"); return; } internalSetFree(configuredNode); }
Source:
<code>public Map<Cell, Value> get(final TableReference tableRef, final Map<Cell, Long> timestampByCell) { if (timestampByCell.isEmpty()) { return ImmutableMap.of(); } <START> Map<Cell, Value> toReturn = new HashMap<>(); <END> for (List<Entry<Cell, Long>> parition : Iterables.partition(timestampByCell.entrySet(), batchSizeForReads)) { toReturn.putAll(run(ctx -> { Select<? extends Record> query = getLatestTimestampQueryManyTimestamps( ctx, tableRef, toRows(parition)); Result<? extends Record> records = fetchValues(ctx, tableRef, query); Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size()); for (Record record : records) { results.put( Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)), Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP))); } return results; })); } return toReturn; }</code><technical_language>Do care other usages of toRows? batched moment</technical_language>

Target:
public Map<Cell, Value> get(final TableReference tableRef, final Map<Cell, Long> timestampByCell) { if (timestampByCell.isEmpty()) { return ImmutableMap.of(); } Map<Cell, Value> toReturn = new HashMap<>(); for (List<Entry<Cell, Long>> partition : Iterables.partition(timestampByCell.entrySet(), batchSizeForReads)) { toReturn.putAll(run(ctx -> { Select<? extends Record> query = getLatestTimestampQueryManyTimestamps( ctx, tableRef, toRows(partition)); Result<? extends Record> records = fetchValues(ctx, tableRef, query); Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size()); for (Record record : records) { results.put( Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)), Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP))); } return results; })); } return toReturn; }
Source:
<code>public void start() { setMetricsReporter(metricsGroupName); final String jvmMetricsName = metricsGroupName + "-JVM"; setMetricsReporter(jvmMetricsName); <START> jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("Tajo") <END> .createsObjectNamesWith(new TajoJMXObjectNameFactory()).build(); jmxReporter.start(); if(!inited) { metricRegistry.register(MetricRegistry.name(jvmMetricsName, "MEMORY"), new MemoryUsageGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "FILE"), new FileDescriptorRatioGauge()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "GC"), new GarbageCollectorMetricSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "THREAD"), new ThreadStatesGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "LOG"), new LogEventGaugeSet()); } inited = true; }</code><technical_language>This line move 'if(!inited) {}'</technical_language>

Target:
public void start() { setMetricsReporter(metricsGroupName); final String jvmMetricsName = metricsGroupName + "-JVM"; setMetricsReporter(jvmMetricsName); if(!inited) { metricRegistry.register(MetricRegistry.name(jvmMetricsName, "MEMORY"), new MemoryUsageGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "FILE"), new FileDescriptorRatioGauge()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "GC"), new GarbageCollectorMetricSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "THREAD"), new ThreadStatesGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "LOG"), new LogEventGaugeSet()); jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("Tajo") .createsObjectNamesWith(new TajoJMXObjectNameFactory()).build(); jmxReporter.start(); } inited = true; }
Source:
<code>public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if( bindingConfig == null || bindingConfig.length() < 1 ) { logger.warn("No settings configured for Hue binding for item '"+item+"'."); return; <START> } <END> try { String[] configParts = bindingConfig.split(";"); if (item instanceof ColorItem) { BindingConfig hueBindingConfig = (BindingConfig) new HueBindingConfig( configParts[0], BindingType.rgb.name(), null); addBindingConfig(item, hueBindingConfig); } else if (item instanceof DimmerItem) { BindingConfig hueBindingConfig = (BindingConfig) new HueBindingConfig( configParts[0], configParts.length < 2 ? null : configParts[1], configParts.length < 3 ? null : configParts[2]); addBindingConfig(item, hueBindingConfig); } else if (item instanceof SwitchItem) { BindingConfig hueBindingConfig = (BindingConfig) new HueBindingConfig( configParts[0], BindingType.switching.name(), null); addBindingConfig(item, hueBindingConfig); } } catch (ArrayIndexOutOfBoundsException e) { logger.warn("bindingConfig is invalid (item=" + item + ") -> processing bindingConfig aborted!"); } }</code><technical_language>Thanks for this, Chris. formatter in Eclipse IDE (or equivalent), parameterized logging instead of string concatenation, java logger.warn("No settings configured for Hue binding for item '{}'.", item);</technical_language>

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if (bindingConfig == null || bindingConfig.length() < 1) { logger.warn("No settings configured for Hue binding for item '{}'.", item); return; } try { String[] configParts = bindingConfig.split(";"); if (item instanceof ColorItem) { BindingConfig hueBindingConfig = new HueBindingConfig(configParts[0], BindingType.rgb.name(), null); addBindingConfig(item, hueBindingConfig); } else if (item instanceof DimmerItem) { BindingConfig hueBindingConfig = new HueBindingConfig(configParts[0], configParts.length < 2 ? null : configParts[1], configParts.length < 3 ? null : configParts[2]); addBindingConfig(item, hueBindingConfig); } else if (item instanceof SwitchItem) { BindingConfig hueBindingConfig = new HueBindingConfig(configParts[0], BindingType.switching.name(), null); addBindingConfig(item, hueBindingConfig); } } catch (ArrayIndexOutOfBoundsException e) { logger.warn("bindingConfig is invalid (item=" + item + ") -> processing bindingConfig aborted!"); } }
Source:
<code>private static <T> boolean containsSameElements(Collection<T> c1, Collection<T> c2) { <START> return HashMultiset.create(c1).equals(HashMultiset.create(c2)); <END> }</code><technical_language>assertEquals(create(c1), create(c2));</technical_language>

Target:
private static <T> void containsSameElements(Collection<T> c1, Collection<T> c2) { assertEquals(HashMultiset.create(c1), HashMultiset.create(c2)); }
Source:
<code>private boolean isTableOrViewVisibleToUser(QualifiedObjectName tableName) { <START> Set<SchemaTableName> tableNames = ImmutableSet.of(tableName.asSchemaTableName()); <END> tableNames = accessControl.filterTables(session.getRequiredTransactionId(), session.getIdentity(), tableName.getCatalogName(), tableNames); return tableNames.contains(tableName.asSchemaTableName()); }</code><technical_language>inline</technical_language>

Target:
private boolean isTableOrViewVisibleToUser(QualifiedObjectName tableName) { return filterTables(tableName.getCatalogName(), ImmutableSet.of(tableName.getSchemaTableName())) .contains(tableName.getSchemaTableName()); }
Source:
<code>public String getValue(Object obj) { Resource result = (Resource) obj; PageManager pageMgr = result.getResourceResolver().adaptTo(PageManager.class); <START> Page page = Optional.ofNullable(pageMgr).map(p -> p.getContainingPage(result)).orElse(null); <END> return page != null ? page.getPath() : ""; }</code><technical_language>Instead of orElse line 42 combine next line another map call orElse(null) in return statement</technical_language>

Target:
public String getValue(Object obj) { Resource result = (Resource) obj; PageManager pageMgr = result.getResourceResolver().adaptTo(PageManager.class); return Optional.ofNullable(pageMgr).map(p -> p.getContainingPage(result)).map(Page::getPath).orElse(""); }