auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public NewGTFSError setSequence(String sequenceAsString) { Integer sequence = null; try { sequence = Integer.parseInt(sequenceAsString); } catch (NumberFormatException e) { e.printStackTrace(); } this.entitySequenceNumber = sequence; return this; }

Target:
public NewGTFSError setSequence(String sequenceAsString) { try { this.entitySequenceNumber = Integer.parseInt(sequenceAsString); } catch (NumberFormatException e) { e.printStackTrace(); this.entitySequenceNumber = null; } return this; }
Source:
public SpongePagedData(List<Text> pages) { super(PagedData.class); this.pages = pages; registerGettersAndSetters(); }

Target:
public SpongePagedData(List<Text> pages) { super(PagedData.class); this.pages = Lists.newArrayList(pages); registerGettersAndSetters(); }
Source:
private IType findNonPrimaryType(String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException { SearchPattern p= SearchPattern.createPattern(fullyQualifiedName, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE); final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(p); engine.setFiltering(true, true); engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getDeclaringClass().getJavaElement().getJavaProject())); engine.setStatus(status); engine.searchPattern(new SubProgressMonitor(pm, 1)); SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults(); if (groups.length != 0) { for (SearchResultGroup group : groups) { for (SearchMatch match : group.getSearchResults()) { if (match.getAccuracy() == SearchMatch.A_ACCURATE) { return (IType) match.getElement(); } } } } return null; }

Target:
private IType findNonPrimaryType(String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException { SearchPattern p= SearchPattern.createPattern(fullyQualifiedName, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE); final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(p); engine.setFiltering(true, true); engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getDeclaringClass().getJavaElement().getJavaProject())); engine.setStatus(status); engine.searchPattern(new SubProgressMonitor(pm, 1)); SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults(); if (groups.length != 0) { for (SearchResultGroup rg : groups) { for (SearchMatch match : rg.getSearchResults()) { if (match.getAccuracy() == SearchMatch.A_ACCURATE) { return (IType) match.getElement(); } } } } return null; }
Source:
public Builder hostSelectors(final List<HostSelector> hostSelectors) { this.hostSelectors = hostSelectors; return this; }

Target:
public Builder hostSelectors(final List<HostSelector> hostSelectors) { this.hostSelectors = ImmutableList.copyOf(hostSelectors); return this; }
Source:
CreateReviewNotes(@GerritPersonIdent final PersonIdent gerritIdent, final AccountCache accountCache, final @AnonymousCowardName String anonymousCowardName, final ProjectCache projectCache, final LabelNormalizer labelNormalizer, final NotesBranchUtil.Factory notesBranchUtilFactory, final @Nullable @CanonicalWebUrl String canonicalWebUrl, final @Assisted ReviewDb reviewDb, final @Assisted Project.NameKey project, final @Assisted Repository git) { this.gerritServerIdent = gerritIdent; this.accountCache = accountCache; this.anonymousCowardName = anonymousCowardName; ProjectState projectState = projectCache.get(project); if (projectState == null) { log.error("Could not obtain available labels for project " + project.get() + ". Expect missing labels its review notes."); this.labelTypes = new LabelTypes(Collections.<LabelType> emptyList()); } else { this.labelTypes = projectState.getLabelTypes(); } this.labelNormalizer = labelNormalizer; this.notesBranchUtilFactory = notesBranchUtilFactory; this.canonicalWebUrl = canonicalWebUrl; this.reviewDb = reviewDb; this.project = project; this.git = git; }

Target:
CreateReviewNotes(@GerritPersonIdent final PersonIdent gerritIdent, final AccountCache accountCache, final @AnonymousCowardName String anonymousCowardName, final ProjectCache projectCache, final LabelNormalizer labelNormalizer, final NotesBranchUtil.Factory notesBranchUtilFactory, final @Nullable @CanonicalWebUrl String canonicalWebUrl, final @Assisted ReviewDb reviewDb, final @Assisted Project.NameKey project, final @Assisted Repository git) { this.gerritServerIdent = gerritIdent; this.accountCache = accountCache; this.anonymousCowardName = anonymousCowardName; ProjectState projectState = projectCache.get(project); if (projectState == null) { log.error("Could not obtain available labels for project " + project.get() + ". Expect missing labels in its review notes."); this.labelTypes = new LabelTypes(Collections.<LabelType> emptyList()); } else { this.labelTypes = projectState.getLabelTypes(); } this.labelNormalizer = labelNormalizer; this.notesBranchUtilFactory = notesBranchUtilFactory; this.canonicalWebUrl = canonicalWebUrl; this.reviewDb = reviewDb; this.project = project; this.git = git; }
Source:
public void run() { if (log.isDebugEnabled()) { log.debug("Format of the email:" + " " + to + "->" + type); } MimeMessage message = new MimeMessage(session); StringBuilder stringBuilder = new StringBuilder(); if (type.equals(EmailEventAdapterConstants.MAIL_TEXT_PLAIN)) { stringBuilder.append(body); } else if (type.equals(EmailEventAdapterConstants.MAIL_TEXT_HTML)) { stringBuilder.append("<b>"); stringBuilder.append("<u>"); stringBuilder.append(body); stringBuilder.append("</u>"); stringBuilder.append("</b>"); } String finalString = stringBuilder.toString(); try { message.setFrom(smtpFromAddress); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); message.setSentDate(new Date()); message.setContent(finalString, type); if (log.isDebugEnabled()) { log.debug("Meta data of the email configured successfully"); } Transport.send(message); if (log.isDebugEnabled()) { log.debug("Mail sent to the EmailID" + " " + to + " " + "Successfully"); } } catch (MessagingException e) { log.error("Message format error in sending the Email from : " + smtpFromAddress, e); } catch (Exception e) { log.error("Error in sending the Email : " + to, e); } }

Target:
public void run() { if (log.isDebugEnabled()) { log.debug("Format of the email:" + " " + to + "->" + type); } MimeMessage message = new MimeMessage(session); try { message.setFrom(smtpFromAddress); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); message.setSentDate(new Date()); message.setContent(body, type); if (log.isDebugEnabled()) { log.debug("Meta data of the email configured successfully"); } Transport.send(message); if (log.isDebugEnabled()) { log.debug("Mail sent to the EmailID" + " " + to + " " + "Successfully"); } } catch (MessagingException e) { log.error("Message format error in sending the Email from : " + smtpFromAddress, e); } catch (Exception e) { log.error("Error in sending the Email : " + to, e); } }
Source:
public CXFSAMLCallbackHandler(final HOKSAMLAssertionBuilder builder) { this.builder = builder; accessor = PropertyAccessor.getInstance(); }

Target:
public CXFSAMLCallbackHandler(final HOKSAMLAssertionBuilder builder) { this(); this.builder = builder; }
Source:
public InputStream call() throws Exception { try { ReportListenerThreadHolder.setListener( listener ); final long start = System.currentTimeMillis(); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass() .getName(), MessageTypes.INSTANCE_START, instanceId, "", 0, null ); if ( reportComponent.execute() ) { listener.setStatus( AsyncExecutionStatus.FINISHED ); return handler.getStagingContent(); } listener.setStatus( AsyncExecutionStatus.FAILED ); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass() .getName(), MessageTypes.FAILED, instanceId, "", 0, null ); return new NullInputStream( 0 ); } finally { ReportListenerThreadHolder.clear(); } }

Target:
@Override public InputStream call() throws Exception { listener.setStatus( AsyncExecutionStatus.WORKING ); try { ReportListenerThreadHolder.setListener( listener ); final long start = System.currentTimeMillis(); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass().getName(), MessageTypes.INSTANCE_START, instanceId, "", 0, null ); if ( reportComponent.execute() ) { final long end = System.currentTimeMillis(); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass().getName(), MessageTypes.INSTANCE_END, instanceId, "", ( (float) ( end - start ) / 1000 ), null ); listener.setStatus( AsyncExecutionStatus.FINISHED ); return handler.getStagingContent(); } if ( listener.getStatus() != AsyncExecutionStatus.CANCELED ) { listener.setStatus( AsyncExecutionStatus.FAILED ); } AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass().getName(), MessageTypes.FAILED, instanceId, "", 0, null ); return new NullInputStream( 0 ); } finally { ReportListenerThreadHolder.clear(); } }
Source:
public void put(final K key, final V value) { final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheWriter != null) { cacheWriter.write(key, value); } } catch (RuntimeException e) { throw new CacheWriterException(e); } return value; } }); try { store.compute(key, remappingFunction); } catch (CacheAccessException e) { try { remappingFunction.apply(key, value); store.remove(key); resilienceStrategy.recoveredFrom(key, e); } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } catch(CacheWriterException e) { try { store.remove(key); resilienceStrategy.recoveredFrom(key, e); throw e; } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e1, e); } } }

Target:
public void put(final K key, final V value) { checkNonNull(key, value); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheWriter != null) { cacheWriter.write(key, value); } } catch (RuntimeException e) { throw new CacheWriterException(e); } return value; } }); try { store.compute(key, remappingFunction); } catch (CacheAccessException e) { try { remappingFunction.apply(key, value); store.remove(key); resilienceStrategy.recoveredFrom(key, e); } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } catch(CacheWriterException e) { try { store.remove(key); resilienceStrategy.recoveredFrom(key, e); throw e; } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e1, e); } } }
Source:
public void release(V bean) { K id = bean.getId(); Entry<V> entry = this.entries.get(id); if ((entry != null) && entry.done()) { if (this.timeout != null) { long value = this.timeout.getValue(); if (value > 0) { TimeUnit unit = this.timeout.getTimeUnit(); RemoveTask task = new RemoveTask(id); synchronized (task) { this.expirationFutures.put(id, this.executor.schedule(task, value, unit)); } } else if (value == 0) { remove(id); } } else { remove(id); } } }

Target:
public void release(V bean) { K id = bean.getId(); Entry<V> entry = this.entries.get(id); if ((entry != null) && entry.done()) { if (this.timeout != null) { long value = this.timeout.getValue(); if (value > 0) { TimeUnit unit = this.timeout.getTimeUnit(); RemoveTask task = new RemoveTask(id); synchronized (task) { this.expirationFutures.put(id, this.executor.schedule(task, value, unit)); } } else if (value == 0) { remove(id); } } } }
Source:
public long concurrencyKey() { return (key); }

Target:
public long concurrencyKey() { return key; }
Source:
public MetricsTableWrapperAggregateImpl(final HRegionServer regionServer) { this.regionServer = regionServer; this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor(); this.runnable = new TableMetricsWrapperRunnable(); this.tableMetricsUpdateTask = this.executor.scheduleWithFixedDelay(this.runnable, PERIOD, PERIOD, TimeUnit.SECONDS); }

Target:
public MetricsTableWrapperAggregateImpl(final HRegionServer regionServer) { this.regionServer = regionServer; this.period = regionServer.getConfiguration().getLong(HConstants.REGIONSERVER_METRICS_PERIOD, HConstants.DEFAULT_REGIONSERVER_METRICS_PERIOD) + 1000; this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor(); this.runnable = new TableMetricsWrapperRunnable(); this.tableMetricsUpdateTask = this.executor.scheduleWithFixedDelay(this.runnable, period, period, TimeUnit.MILLISECONDS); }
Source:
public static WorkProcessor<Page> mergeSortedPages( List<WorkProcessor<Page>> pageProducers, PageWithPositionComparator comparator, List<Type> outputTypes, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { requireNonNull(pageProducers, "pageProducers is null"); requireNonNull(comparator, "comparator is null"); requireNonNull(outputTypes, "outputTypes is null"); requireNonNull(aggregatedMemoryContext, "aggregatedMemoryContext is null"); requireNonNull(yieldSignal, "yieldSignal is null"); return mergeSortedPages( pageProducers, comparator, IntStream.range(0, outputTypes.size()).boxed().collect(toImmutableList()), outputTypes, (pageBuilder, pageWithPosition) -> pageBuilder.isFull(), false, aggregatedMemoryContext, yieldSignal); }

Target:
public static WorkProcessor<Page> mergeSortedPages( List<WorkProcessor<Page>> pageProducers, PageWithPositionComparator comparator, List<Type> outputTypes, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { return mergeSortedPages( pageProducers, comparator, IntStream.range(0, outputTypes.size()).boxed().collect(toImmutableList()), outputTypes, (pageBuilder, pageWithPosition) -> pageBuilder.isFull(), false, aggregatedMemoryContext, yieldSignal); }
Source:
public void start(BundleContext context) throws Exception { super.start(context); setDefault(this); try { XmlUtils.clearXmlDirectory(); } catch (Throwable e) { } }

Target:
public void start(BundleContext context) throws Exception { super.start(context); setDefault(this); }
Source:
private StackTraceWriter getStackTraceWriter( TestIdentifier testIdentifier, Throwable throwable ) { String className = getClassName( testIdentifier ); String methodName = getMethodName( testIdentifier ).orElse( "" ); return new LegacyPojoStackTraceWriter( className, methodName, throwable ); }

Target:
private StackTraceWriter getStackTraceWriter( TestIdentifier testIdentifier, Throwable throwable ) { String className = getClassName( testIdentifier ); String methodName = getMethodName( testIdentifier ).orElse( "" ); return new PojoStackTraceWriter( className, methodName, throwable ); }
Source:
@Override public ScoredCandidates<Item> score(Item subject, Set<? extends Item> candidates, ResultDescription desc) { DefaultScoredCandidates.Builder<Item> equivalents = DefaultScoredCandidates.fromSource(NAME); for (Item candidate : candidates) { equivalents.addEquivalent(candidate, score(subject, candidate)); } return equivalents.build(); }

Target:
public ScoredCandidates<Item> score( Item subject, Set<? extends Item> candidates, ResultDescription desc) { DefaultScoredCandidates.Builder<Item> equivalents = DefaultScoredCandidates.fromSource(NAME); candidates.forEach(candidate -> equivalents.addEquivalent(candidate, score(subject, candidate))); return equivalents.build(); }
Source:
public void put(final K key, final V value) throws CacheWritingException { putObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheLoaderWriter != null) { cacheLoaderWriter.write(key, value); } } catch (Exception e) { throw newCacheWritingException(e); } if (newValueAlreadyExpired(key, previousValue, value)) { return null; } eventNotificationService.onEvent(previousValue == null ? CacheEvents.creation(key, value, Ehcache.this) : CacheEvents.update(key, previousValue, value, Ehcache.this)); return value; } }); try { ValueHolder<V> computed = store.compute(key, remappingFunction); if (computed != null) { putObserver.end(PutOutcome.ADDED); eventNotificationService.fireEvents(); } else { putObserver.end(PutOutcome.NOOP); } } catch (CacheAccessException e) { try { if (cacheLoaderWriter == null) { resilienceStrategy.putFailure(key, value, e); } else { try { remappingFunction.apply(key, value); } catch (CacheWritingException f) { resilienceStrategy.putFailure(key, value, e, f); return; } resilienceStrategy.putFailure(key, value, e); } } finally { putObserver.end(PutOutcome.FAILURE); eventNotificationService.fireSuccessfulEvents(); } } }

Target:
public void put(final K key, final V value) throws CacheWritingException { putObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheLoaderWriter != null) { cacheLoaderWriter.write(key, value); } } catch (Exception e) { throw newCacheWritingException(e); } if (newValueAlreadyExpired(key, previousValue, value)) { return null; } eventNotificationService.onEvent(previousValue == null ? CacheEvents.creation(key, value, Ehcache.this) : CacheEvents.update(key, previousValue, value, Ehcache.this)); return value; } }); try { ValueHolder<V> computed = store.compute(key, remappingFunction); if (computed != null) { putObserver.end(PutOutcome.ADDED); } else { putObserver.end(PutOutcome.NOOP); } eventNotificationService.fireAllEvents(); } catch (CacheAccessException e) { try { if (cacheLoaderWriter == null) { resilienceStrategy.putFailure(key, value, e); } else { try { remappingFunction.apply(key, value); } catch (CacheWritingException f) { resilienceStrategy.putFailure(key, value, e, f); return; } resilienceStrategy.putFailure(key, value, e); } } finally { putObserver.end(PutOutcome.FAILURE); } } finally { eventNotificationService.processAndFireRemainingEvents(); } }
Source:
public boolean isGetterMethod() { return ReflectionHelper.isGetterMethod( executable ); }

Target:
public boolean isGetterMethod() { return isGetterMethod; }
Source:
public void setColumnWidthPercentageByPosition(int columnPosition, int width, boolean fireEvent) { this.columnWidthConfig.setPercentage(columnPosition, width); if (fireEvent) fireLayerEvent(new ColumnResizeEvent(this, columnPosition)); }

Target:
public void setColumnWidthPercentageByPosition(int columnPosition, int width, boolean fireEvent) { this.columnWidthConfig.setPercentage(columnPosition, width); if (fireEvent){ fireLayerEvent(new ColumnResizeEvent(this, columnPosition)); } }
Source:
public boolean allowsStyleAttributeWithHash(@Nonnull HashAlgorithm algorithm, @Nonnull Base64Value hashValue) { if (!this.haveUnsafeStyleHashes()) { return false; } StyleSrcAttrDirective styleSrcAttrDirective = this.getDirectiveByType(StyleSrcAttrDirective.class); if (styleSrcAttrDirective == null) { StyleSrcDirective styleSrcDirective = this.getDirectiveByType(StyleSrcDirective.class); if (styleSrcDirective == null) { return this.defaultsAllowScriptAttributeWithHash(algorithm, hashValue); } return styleSrcDirective.matchesHash(algorithm, hashValue); } return styleSrcAttrDirective.matchesHash(algorithm, hashValue); }

Target:
public boolean allowsStyleAttributeWithHash(@Nonnull HashAlgorithm algorithm, @Nonnull Base64Value hashValue) { if (!this.haveUnsafeStyleHashes()) { return false; } StyleSrcAttrDirective styleSrcAttrDirective = this.getDirectiveByType(StyleSrcAttrDirective.class); if (styleSrcAttrDirective == null) { StyleSrcDirective styleSrcDirective = this.getDirectiveByType(StyleSrcDirective.class); if (styleSrcDirective == null) { return this.defaultsAllowAttributeWithHash(algorithm, hashValue); } return styleSrcDirective.matchesHash(algorithm, hashValue); } return styleSrcAttrDirective.matchesHash(algorithm, hashValue); }
Source:
public void onMessageReceived(MessageEvent messageEvent) { super.onMessageReceived(messageEvent); if (!messageEvent.getPath().equals(WearableConfigurationUtil.PATH_ANALOG)) { return; } byte[] rawData = messageEvent.getData(); DataMap configKeys = DataMap.fromByteArray(rawData); Log.d(TAG, "configKeys = [" + configKeys + "]"); if (mGoogleApiClient == null) { mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Wearable.API).build(); } if (!mGoogleApiClient.isConnected()) { ConnectionResult connectionResult = mGoogleApiClient.blockingConnect(30, TimeUnit.SECONDS); if (!connectionResult.isSuccess()) { Log.e(TAG, "Failed to connect to GoogleApiClient."); return; } } WearableConfigurationUtil.updateKeysInConfigDataMap(mGoogleApiClient, messageEvent.getPath(), configKeys); }

Target:
public void onMessageReceived(MessageEvent messageEvent) { super.onMessageReceived(messageEvent); if (!messageEvent.getPath().equals(WearableConfigurationUtil.PATH_ANALOG)) { return; } byte[] rawData = messageEvent.getData(); DataMap configKeys = DataMap.fromByteArray(rawData); Timber.d("configKeys = [" + configKeys + "]"); if (mGoogleApiClient == null) { mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Wearable.API).build(); } if (!mGoogleApiClient.isConnected()) { ConnectionResult connectionResult = mGoogleApiClient.blockingConnect(30, TimeUnit.SECONDS); if (!connectionResult.isSuccess()) { Log.e(TAG, "Failed to connect to GoogleApiClient."); return; } } WearableConfigurationUtil.updateKeysInConfigDataMap(mGoogleApiClient, messageEvent.getPath(), configKeys); }
Source:
static boolean areInSameParent(final Element parent, final Node[] children) { return Stream.of(children) .map(GraphUtils::getParent) .filter(childParent -> !Objects.equals(parent, childParent)) .count() == 0; }

Target:
static boolean areInSameParent(final Element parent, final Node[] children) { return Stream.of(children) .map(GraphUtils::getParent) .noneMatch(childParent -> !Objects.equals(parent, childParent)); }
Source:
private CartQuery decorateQueryWithAdditionalInfo(final CartQuery query) { return query .plusPredicates(cart -> cart.cartState().is(CartState.ACTIVE)) .plusExpansionPaths(cartExpansionModel -> cartExpansionModel.discountCodes().discountCode()) .withSort(cart -> cart.lastModifiedAt().sort().desc()) .withLimit(1); }

Target:
private CartQuery decorateQueryWithAdditionalInfo(final CartQuery query) { return query .plusPredicates(cart -> cart.cartState().is(CartState.ACTIVE)) .withSort(cart -> cart.lastModifiedAt().sort().desc()) .withLimit(1); }
Source:
public Serializable convertToEntityAttribute(String dbData) { try { Serializable[] arr = objectMapper.readValue(dbData, Serializable[].class); return (arr.length == 1) ? arr[0] : arr; } catch (IOException e) { throw new RuntimeException("Unable to deserialize preference value:" + e.getMessage(), e); } }

Target:
public Serializable convertToEntityAttribute(String dbData) { try { JsonNode node = objectMapper.readTree(dbData); if (node.isValueNode()) { return serializableNodeValue(node); } else if (node.isArray()) { List<Serializable> values = new ArrayList<>(); node.elements().forEachRemaining(n -> values.add(serializableNodeValue(n))); return values.toArray(); } else { throw new RuntimeException("Unable to deserialize preference value:" + dbData); } } catch (IOException e) { throw new RuntimeException("Unable to deserialize preference value:" + e.getMessage(), e); } }
Source:
public void testXmlAddAndRemoveFile() { IPath xmlPath = XmlUtils.getXmlFilesPath().addTrailingSeparator().append("test_valid.xml"); File destFile = xmlPath.toFile(); assertFalse(destFile.exists()); File testXmlFile = TmfXmlTestFiles.VALID_FILE.getFile(); if ((testXmlFile == null) || !testXmlFile.exists()) { fail("XML test file does not exist"); } assertNotNull(testXmlFile); XmlUtils.addXmlFile(testXmlFile); assertTrue(destFile.exists()); XmlUtils.removeXmlFile(testXmlFile); File[] xmlFiles = XmlUtils.getXmlFilesPath().toFile().listFiles(); boolean found = false; for(int i = 0; i < xmlFiles.length; i++) { if(xmlFiles[i].getName().equals(testXmlFile.getName())) { found = true; } } if(found) { fail("XML test file have not been remove"); } }

Target:
public void testXmlAddAndRemoveFile() { IPath xmlPath = XmlUtils.getXmlFilesPath().addTrailingSeparator().append("test_valid.xml"); File destFile = xmlPath.toFile(); assertFalse(destFile.exists()); File testXmlFile = TmfXmlTestFiles.VALID_FILE.getFile(); assertTrue(testXmlFile.exists()); assertNotNull(testXmlFile); XmlUtils.addXmlFile(testXmlFile); assertTrue(destFile.exists()); XmlUtils.removeXmlFile(testXmlFile); File[] xmlFiles = XmlUtils.getXmlFilesPath().toFile().listFiles(); boolean found = false; for (int i = 0; i < xmlFiles.length; i++) { if (xmlFiles[i].getName().equals(testXmlFile.getName())) { found = true; } } assertFalse(found); }
Source:
public void addModifiedColumns( GlobalConfiguration globalCfg, Value value, Element parent, PropertyAuditingData propertyAuditingData) { String columnName = propertyAuditingData.getModifiedFlagName(); if ( propertyAuditingData.isModifiedFlagNameExplicitlySpecified() ) { columnName = propertyAuditingData.getExplicitModifiedFlagName(); } MetadataTools.addModifiedFlagProperty( parent, propertyAuditingData.getName(), globalCfg.getModifiedFlagSuffix(), columnName ); }

Target:
public void addModifiedColumns( GlobalConfiguration globalCfg, Value value, Element parent, PropertyAuditingData propertyAuditingData) { final String columnName; if ( propertyAuditingData.isModifiedFlagNameExplicitlySpecified() ) { columnName = propertyAuditingData.getExplicitModifiedFlagName(); } else { columnName = propertyAuditingData.getModifiedFlagName(); } MetadataTools.addModifiedFlagProperty( parent, propertyAuditingData.getName(), globalCfg.getModifiedFlagSuffix(), columnName ); }
Source:
protected List<ILogData> getNextEntries(QueuedStreamContext context, long maxGlobal, Function<ILogData, Boolean> contextCheckFn) { NavigableSet<Long> readSet = new TreeSet<>(); boolean readQueueIsEmpty = !fillReadQueue(maxGlobal, context); if (maxGlobal < context.checkpoint.startAddress) { throw new TrimmedException(); } if (readQueueIsEmpty) { return Collections.emptyList(); } readSet.addAll(context.readCpQueue); if (!context.readQueue.isEmpty() && context.readQueue.first() > maxGlobal) { } else { readSet.addAll(context.readQueue.headSet(maxGlobal, true)); } List<Long> toRead = readSet.stream() .collect(Collectors.toList()); List<ILogData> readFrom = readAll(toRead).stream() .filter(x -> x.getType() == DataType.DATA || x.getType() == DataType.HOLE) .filter(x -> x.containsStream(context.id)) .collect(Collectors.toList()); Optional<ILogData> contextEntry = readFrom.stream() .filter(contextCheckFn::apply).findFirst(); if (contextEntry.isPresent()) { log.trace("getNextEntries[{}] context switch @ {}", this, contextEntry.get().getGlobalAddress()); int idx = readFrom.indexOf(contextEntry.get()); readFrom = readFrom.subList(0, idx + 1); readSet.headSet(contextEntry.get().getGlobalAddress(), true).clear(); } else { context.readQueue.headSet(maxGlobal, true).clear(); } readFrom.forEach(entry -> addToResolvedQueue(context, entry.getGlobalAddress())); if (readFrom.size() > 0) { context.setGlobalPointerCheckGCTrimMark(readFrom.get(readFrom.size() - 1) .getGlobalAddress()); } return readFrom.stream().filter(entry -> !entry.isHole()) .collect(Collectors.toList()); }

Target:
protected List<ILogData> getNextEntries(QueuedStreamContext context, long maxGlobal, Function<ILogData, Boolean> contextCheckFn) { NavigableSet<Long> readSet = new TreeSet<>(); boolean readQueueIsEmpty = !fillReadQueue(maxGlobal, context); if (maxGlobal < context.checkpoint.startAddress) { throw new TrimmedException(); } if (readQueueIsEmpty) { return Collections.emptyList(); } readSet.addAll(context.readCpQueue); if (!context.readQueue.isEmpty() && context.readQueue.first() > maxGlobal) { } else { readSet.addAll(context.readQueue.headSet(maxGlobal, true)); } List<Long> toRead = readSet.stream() .collect(Collectors.toList()); List<ILogData> readFrom = readAll(toRead).stream() .filter(x -> x.isData() || x.isHole()) .filter(x -> x.containsStream(context.id)) .collect(Collectors.toList()); Optional<ILogData> contextEntry = readFrom.stream() .filter(contextCheckFn::apply).findFirst(); if (contextEntry.isPresent()) { log.trace("getNextEntries[{}] context switch @ {}", this, contextEntry.get().getGlobalAddress()); int idx = readFrom.indexOf(contextEntry.get()); readFrom = readFrom.subList(0, idx + 1); readSet.headSet(contextEntry.get().getGlobalAddress(), true).clear(); } else { context.readQueue.headSet(maxGlobal, true).clear(); } readFrom.forEach(entry -> addToResolvedQueue(context, entry.getGlobalAddress())); if (readFrom.size() > 0) { context.setGlobalPointerCheckGCTrimMark(readFrom.get(readFrom.size() - 1) .getGlobalAddress()); } return readFrom.stream() .filter(entry -> !entry.isHole()) .collect(Collectors.toList()); }
Source:
public int getSort() { return sort; }

Target:
public SortOrder getSort() { return mySort; }
Source:
public String stripPrefixIfPresent(String path) { String stripedKey = CommonUtils.stripPrefixIfPresent( path, PathUtils.normalizePath(mRootKeySupplier.get(), PATH_SEPARATOR)); if (!stripedKey.equals(path)) { return stripedKey; } final String normalizedPath = PathUtils.normalizePath(path, PATH_SEPARATOR); if (!path.equals(normalizedPath)) { stripedKey = CommonUtils.stripPrefixIfPresent( normalizedPath, PathUtils.normalizePath(mRootKeySupplier.get(), PATH_SEPARATOR)); if (!stripedKey.equals(normalizedPath)) { return stripedKey; } } return CommonUtils.stripPrefixIfPresent(path, PATH_SEPARATOR); }

Target:
public String stripPrefixIfPresent(String path) { if (mRootKeySupplier.get().equals(path)) { return ""; } String stripedKey = CommonUtils.stripPrefixIfPresent( path, PathUtils.normalizePath(mRootKeySupplier.get(), PATH_SEPARATOR)); if (!stripedKey.equals(path)) { return stripedKey; } return CommonUtils.stripPrefixIfPresent(path, PATH_SEPARATOR); }
Source:
public static void createTaskTable(final DBI dbi, final String taskTableName) { createTable( dbi, taskTableName, String.format( "CREATE TABLE `%s` (\n" + " `id` varchar(255) NOT NULL,\n" + " `created_date` tinytext NOT NULL,\n" + " `datasource` varchar(255) NOT NULL,\n" + " `payload` longtext NOT NULL,\n" + " `status_payload` longtext NOT NULL,\n" + " `version` tinytext,\n" + " `active` tinyint(1) NOT NULL DEFAULT '0',\n" + " PRIMARY KEY (`id`)\n" + ")", taskTableName ) ); }

Target:
public static void createTaskTable(final DBI dbi, final String taskTableName) { createTable( dbi, taskTableName, String.format( "CREATE TABLE `%s` (\n" + " `id` varchar(255) NOT NULL,\n" + " `created_date` tinytext NOT NULL,\n" + " `datasource` varchar(255) NOT NULL,\n" + " `payload` longblob NOT NULL,\n" + " `status_payload` longblob NOT NULL,\n" + " `active` tinyint(1) NOT NULL DEFAULT '0',\n" + " PRIMARY KEY (`id`)\n" + ")", taskTableName ) ); }
Source:
protected void performMerge() { CompletableFuture<StateRequestCommand> blockedStateRequest = createStateRequestFuture(); for (String key : ALL_KEYS) { assertCacheGet(key, PARTITION_0_VAL, p0.getNodes()); assertCacheGet(key, PARTITION_1_VAL, p1.getNodes()); } partition(0).merge(partition(1), false); try { blockedStateRequest.get(60, TimeUnit.SECONDS); } catch (ExecutionException | InterruptedException | TimeoutException e) { throw new IllegalStateException(e); } if (trace) log.trace("crashCacheManager(2)"); TestingUtil.crashCacheManagers(manager(2)); TestingUtil.waitForNoRebalance(cache(0), cache(1), cache(3)); }

Target:
protected void performMerge() throws Exception { CompletableFuture<StateRequestCommand> blockedStateRequest = createStateRequestFuture(); for (String key : ALL_KEYS) { assertCacheGet(key, PARTITION_0_VAL, p0.getNodes()); assertCacheGet(key, PARTITION_1_VAL, p1.getNodes()); } partition(0).merge(partition(1), false); blockedStateRequest.get(60, TimeUnit.SECONDS); if (trace) log.trace("crashCacheManager(2)"); TestingUtil.crashCacheManagers(manager(2)); TestingUtil.waitForNoRebalance(cache(0), cache(1), cache(3)); }
Source:
private void checkJobExecution(final int documentationId, final String id) { final RestDocumentationFilter getResultFilter = RestAssuredRestDocumentation.document( "{class-name}/" + documentationId + "/getJobExecution/", Snippets.ID_PATH_PARAM, Snippets.HAL_CONTENT_TYPE_HEADER, Snippets.getJobExecutionResponsePayload(), Snippets.JOB_EXECUTION_LINKS ); final ValidatableResponse validatableResponse = RestAssured .given(this.getRequestSpecification()) .filter(getResultFilter) .when() .port(this.port) .get(JOBS_API + "/{id}/execution", id) .then() .statusCode(Matchers.is(HttpStatus.OK.value())) .contentType(Matchers.is(MediaTypes.HAL_JSON_UTF8_VALUE)) .body(ID_PATH, Matchers.is(id)) .body(CREATED_PATH, Matchers.notNullValue()) .body(UPDATED_PATH, Matchers.notNullValue()); if (this.agentExecution) { validatableResponse .body(HOST_NAME_PATH, Matchers.notNullValue()) .body(PROCESS_ID_PATH, Matchers.nullValue()) .body(CHECK_DELAY_PATH, Matchers.nullValue()) .body(EXIT_CODE_PATH, Matchers.nullValue()); } else { validatableResponse .body(HOST_NAME_PATH, Matchers.is(this.genieHostInfo.getHostname())) .body(PROCESS_ID_PATH, Matchers.notNullValue()) .body(CHECK_DELAY_PATH, Matchers.is((int) CHECK_DELAY)) .body(EXIT_CODE_PATH, Matchers.is(JobExecution.SUCCESS_EXIT_CODE)); } }

Target:
private void checkJobExecution(final int documentationId, final String id) { final RestDocumentationFilter getResultFilter = RestAssuredRestDocumentation.document( "{class-name}/" + documentationId + "/getJobExecution/", Snippets.ID_PATH_PARAM, Snippets.HAL_CONTENT_TYPE_HEADER, Snippets.getJobExecutionResponsePayload(), Snippets.JOB_EXECUTION_LINKS ); final ValidatableResponse validatableResponse = RestAssured .given(this.getRequestSpecification()) .filter(getResultFilter) .when() .port(this.port) .get(JOBS_API + "/{id}/execution", id) .then() .statusCode(Matchers.is(HttpStatus.OK.value())) .contentType(Matchers.is(MediaTypes.HAL_JSON_UTF8_VALUE)) .body(ID_PATH, Matchers.is(id)) .body(CREATED_PATH, Matchers.notNullValue()) .body(UPDATED_PATH, Matchers.notNullValue()) .body(HOST_NAME_PATH, Matchers.is(this.genieHostInfo.getHostname())); if (this.agentExecution) { validatableResponse .body(PROCESS_ID_PATH, Matchers.nullValue()) .body(CHECK_DELAY_PATH, Matchers.nullValue()) .body(EXIT_CODE_PATH, Matchers.nullValue()); } else { validatableResponse .body(PROCESS_ID_PATH, Matchers.notNullValue()) .body(CHECK_DELAY_PATH, Matchers.is((int) CHECK_DELAY)) .body(EXIT_CODE_PATH, Matchers.is(JobExecution.SUCCESS_EXIT_CODE)); } }
Source:
public void setTemporaryFileSuffix(String temporaryFileSuffix) { Assert.hasText(temporaryFileSuffix, "Temporary file suffix provided is non null, non empty"); if(!temporaryFileSuffix.startsWith(".")) { temporaryFileSuffix = "." + temporaryFileSuffix; } this.temporaryFileSuffix = temporaryFileSuffix; }

Target:
public void setTemporaryFileSuffix(String temporaryFileSuffix) { Assert.hasText(temporaryFileSuffix, "The temporary file suffix must not be null or empty"); if(!temporaryFileSuffix.startsWith(".")) { temporaryFileSuffix = "." + temporaryFileSuffix; } this.temporaryFileSuffix = temporaryFileSuffix; }
Source:
private void initializeCommonFields() { supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); AndroidBeam.disable(this); res = this.getResources(); app = (CgeoApplication) this.getApplication(); Cookies.restoreCookieStore(Settings.getCookieStore()); ActivityMixin.onCreate(this, keepScreenOn); }

Target:
private void initializeCommonFields() { res = this.getResources(); app = (CgeoApplication) this.getApplication(); Cookies.restoreCookieStore(Settings.getCookieStore()); ActivityMixin.onCreate(this, keepScreenOn); }
Source:
public Response registerCronJob(@PathParam("noteId") String noteId, String message) throws IOException, IllegalArgumentException { LOG.info("Register cron job note={} request cron msg={}", noteId, message); ZeppelinConfiguration conf = notebook.getConf(); if (conf.isZeppelinNotebookCronEnable()) { CronRequest request = CronRequest.fromJson(message); Note note = notebook.getNote(noteId); checkIfNoteIsNotNull(note); checkIfUserCanRun(noteId, "Insufficient privileges you cannot set a cron job for this note"); if (!CronExpression.isValidExpression(request.getCronString())) { return new JsonResponse<>(Status.BAD_REQUEST, "wrong cron expressions.").build(); } Map<String, Object> config = note.getConfig(); config.put("cron", request.getCronString()); note.setConfig(config); notebook.refreshCron(note.getId()); return new JsonResponse<>(Status.OK).build(); } else { throw new ForbiddenException("Cron is not enabled from Zeppelin server"); } }

Target:
public Response registerCronJob(@PathParam("noteId") String noteId, String message) throws IOException, IllegalArgumentException { LOG.info("Register cron job note={} request cron msg={}", noteId, message); CronRequest request = CronRequest.fromJson(message); Note note = notebook.getNote(noteId); checkIfNoteIsNotNull(note); checkIfUserCanRun(noteId, "Insufficient privileges you cannot set a cron job for this note"); checkIfNoteSupportsCron(note); if (!CronExpression.isValidExpression(request.getCronString())) { return new JsonResponse<>(Status.BAD_REQUEST, "wrong cron expressions.").build(); } Map<String, Object> config = note.getConfig(); config.put("cron", request.getCronString()); note.setConfig(config); notebook.refreshCron(note.getId()); return new JsonResponse<>(Status.OK).build(); }
Source:
public CommandAssociatedEntity(Guid commandId, VdcObjectType entityType, Guid entityId) { this.commandId = commandId; setEntityType(entityType); setEntityId(entityId); }

Target:
public CommandAssociatedEntity(Guid commandId, VdcObjectType entityType, Guid entityId) { super(entityType, entityId); this.commandId = commandId; }
Source:
private static <E> View<E> load(JobContext jobContext) { Configuration conf = Hadoop.JobContext.getConfiguration.invoke(jobContext); @SuppressWarnings("unchecked") Class<E> type = (Class<E>)conf.getClass(KITE_TYPE, Object.class); String outputUri = conf.get(KITE_OUTPUT_URI); if (outputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(outputUri, type); }

Target:
private static <E> View<E> load(JobContext jobContext) { Configuration conf = Hadoop.JobContext.getConfiguration.invoke(jobContext); Class<E> type = getType(jobContext); String outputUri = conf.get(KITE_OUTPUT_URI); if (outputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(outputUri, type); }
Source:
private static void extractZipFileToFolder(File zipFile, File destinationFolder) { try { ZipFile zip = new ZipFile(zipFile); destinationFolder.mkdir(); Enumeration zipFileEntries = zip.entries(); while (zipFileEntries.hasMoreElements()) { ZipEntry entry = (ZipEntry) zipFileEntries.nextElement(); String currentEntry = entry.getName(); File destFile = new File(destinationFolder, currentEntry); File destinationParent = destFile.getParentFile(); destinationParent.mkdirs(); if (!entry.isDirectory()) { BufferedInputStream bufferedInputStream = new BufferedInputStream(zip.getInputStream(entry)); int currentByte; byte data[] = new byte[BUFFER_SIZE]; FileOutputStream fileOutputStream = new FileOutputStream(destFile); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream, BUFFER_SIZE); while ((currentByte = bufferedInputStream.read(data, 0, BUFFER_SIZE)) != -1) { bufferedOutputStream.write(data, 0, currentByte); } bufferedOutputStream.flush(); bufferedOutputStream.close(); bufferedInputStream.close(); } } } catch (Exception e) { logger.error(e.getMessage()); } }

Target:
private static void extractZipFileToFolder(File zipFile, File destinationFolder) { try { ZipFile zip = new ZipFile(zipFile); destinationFolder.mkdir(); Enumeration zipFileEntries = zip.entries(); while (zipFileEntries.hasMoreElements()) { ZipEntry entry = (ZipEntry) zipFileEntries.nextElement(); String currentEntry = entry.getName(); File destFile = new File(destinationFolder, currentEntry); File destinationParent = destFile.getParentFile(); destinationParent.mkdirs(); if (!entry.isDirectory()) { int currentByte; byte data[] = new byte[BUFFER_SIZE]; try(BufferedInputStream bufferedInputStream = new BufferedInputStream(zip.getInputStream(entry)); FileOutputStream fileOutputStream = new FileOutputStream(destFile); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream, BUFFER_SIZE)) { while ((currentByte = bufferedInputStream.read(data, 0, BUFFER_SIZE)) != -1) { bufferedOutputStream.write(data, 0, currentByte); } } } } } catch (Exception e) { logger.error(e.getMessage()); } }
Source:
public void testInvalidUserValidate() throws BugzillaRestException { RepositoryLocation location = new RepositoryLocation(); location.setUrl(actualFixture.getRepositoryUrl()); location.setProxy(null); location.setCredentialsStore(new InMemoryCredentialsStore()); location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("wrong", "wrong")); thrown.expect(BugzillaRestException.class); thrown.expectMessage("Unauthorized"); BugzillaRestClient client; client = new BugzillaRestClient(location, connector); assertNotNull(client.getClient()); assertEquals(true, client.validate(new NullOperationMonitor())); }

Target:
public void testInvalidUserValidate() throws BugzillaRestException { RepositoryLocation location = new RepositoryLocation(); location.setUrl(actualFixture.getRepositoryUrl()); location.setProxy(null); location.setCredentialsStore(new InMemoryCredentialsStore()); location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("wrong", "wrong")); thrown.expect(BugzillaRestException.class); thrown.expectMessage("Unauthorized"); BugzillaRestClient client; client = new BugzillaRestClient(location, connector); assertNotNull(client.getClient()); assertTrue(client.validate(new NullOperationMonitor())); }
Source:
public void testInetAddressQuery() throws ErrnoException { for (Network network : getTestableNetworks()) { CountDownLatch latch = new CountDownLatch(1); final int TIMEOUT_MS = 12_000; final String dname = "www.google.com"; final AtomicReference<List<InetAddress>> answers = new AtomicReference<>(); mDns.query(network, dname, FLAG_NO_CACHE_LOOKUP, mHandler, answerList -> { answers.set(answerList); for (InetAddress addr : answerList) { Log.d(TAG, "Reported addr:" + addr.toString()); } latch.countDown(); } ); String msg = "InetAddress query " + dname + " but no valid answer after " + TIMEOUT_MS + "ms."; try { assertTrue(msg, latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); assertNotNull("Query for " + dname + " timed out after " + TIMEOUT_MS + "ms", answers.get()); assertGreaterThan("Query for " + dname + " returned 0 results ", answers.get().size(), 0); } catch (InterruptedException e) { } } }

Target:
public void testInetAddressQuery() throws ErrnoException { final String dname = "www.google.com"; final String msg = "InetAddress query " + dname; for (Network network : getTestableNetworks()) { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<List<InetAddress>> answers = new AtomicReference<>(); mDns.query(network, dname, FLAG_NO_CACHE_LOOKUP, mHandler, answerList -> { answers.set(answerList); for (InetAddress addr : answerList) { Log.d(TAG, "Reported addr:" + addr.toString()); } latch.countDown(); } ); try { assertTrue(msg + " but no valid answer after " + TIMEOUT_MS + "ms.", latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); assertGreaterThan(msg + " returned 0 result", answers.get().size(), 0); } catch (InterruptedException e) { } } }
Source:
public ReadingListPageDiskRow(@NonNull ReadingListPage row) { super(row.key(), row); filename = null; }

Target:
public ReadingListPageDiskRow(@NonNull ReadingListPage row) { super(row.key(), row, null); }
Source:
private static RexNode stripCastFromString(RexNode node, SqlDialect dialect) { switch (node.getKind()) { case EQUALS: case IS_NOT_DISTINCT_FROM: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: final RexCall call = (RexCall) node; final RexNode o0 = call.operands.get(0); final RexNode o1 = call.operands.get(1); if (o0.getKind() == SqlKind.CAST && o1.getKind() != SqlKind.CAST) { if (dialect.castRequiredForStringOperand((RexCall) o0)) { return node; } final RexNode o0b = ((RexCall) o0).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0b, o1)); } if (o1.getKind() == SqlKind.CAST && o0.getKind() != SqlKind.CAST) { if (dialect.castRequiredForStringOperand((RexCall) o1)) { return node; } final RexNode o1b = ((RexCall) o1).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0, o1b)); } } return node; }

Target:
private static RexNode stripCastFromString(RexNode node, SqlDialect dialect) { switch (node.getKind()) { case EQUALS: case IS_NOT_DISTINCT_FROM: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: final RexCall call = (RexCall) node; final RexNode o0 = call.operands.get(0); final RexNode o1 = call.operands.get(1); if (o0.getKind() == SqlKind.CAST && o1.getKind() != SqlKind.CAST) { if (!dialect.supportsImplicitTypeCoercion((RexCall) o0)) { return node; } final RexNode o0b = ((RexCall) o0).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0b, o1)); } if (o1.getKind() == SqlKind.CAST && o0.getKind() != SqlKind.CAST) { if (!dialect.supportsImplicitTypeCoercion((RexCall) o1)) { return node; } final RexNode o1b = ((RexCall) o1).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0, o1b)); } } return node; }
Source:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); if (getParameters().isDetailRequired() && StringUtils.isNotEmpty(volumeName)) { executeAndSetReturnValue(volumeName); return; } VDSReturnValue nfsReturnValue = null; VDSReturnValue replicateReturnValue = null; GlusterVolumeEntity nfsReplicateVolume = getNfsReplicateVolume(getParameters().getClusterId()); if (nfsReplicateVolume != null) { executeAndSetReturnValue(nfsReplicateVolume.getName()); return; } GlusterVolumeEntity nfsVolume = getNfsVolume(getParameters().getClusterId()); GlusterVolumeEntity replicateVolume = getReplicateVolume(getParameters().getClusterId()); if (nfsVolume == null && replicateVolume == null) { log.error("To get service details, no Nfs or Replicated volumes found in the cluster."); getQueryReturnValue().setReturnValue(new GlusterVolumeAdvancedDetails()); return; } if (nfsVolume != null) { nfsReturnValue = executeCommand(nfsVolume.getName()); } if (replicateVolume != null) { replicateReturnValue = executeCommand(replicateVolume.getName()); } if (nfsReturnValue != null && replicateReturnValue != null) { GlusterVolumeAdvancedDetails volumeAdvancedDetailsForNfs = (GlusterVolumeAdvancedDetails) nfsReturnValue.getReturnValue(); GlusterVolumeAdvancedDetails volumeAdvancedDetailsForShd = (GlusterVolumeAdvancedDetails) replicateReturnValue.getReturnValue(); volumeAdvancedDetailsForNfs.getServiceInfo().addAll(volumeAdvancedDetailsForShd.getServiceInfo()); getQueryReturnValue().setReturnValue(volumeAdvancedDetailsForNfs); } else if (nfsReturnValue == null && replicateReturnValue != null) { getQueryReturnValue().setReturnValue(replicateReturnValue.getReturnValue()); } else if (nfsReturnValue != null && replicateVolume == null) { getQueryReturnValue().setReturnValue(nfsReturnValue.getReturnValue()); } }

Target:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); if (StringUtils.isNotEmpty(volumeName)) { fetchAdvancedDetails(volumeName); return; } getServiceInfo(); }