auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Bitmap getScaledBitmapFromPath(String imagePath, int outputRectangleWidth, int outputRectangleHeight, ResizeType resizeType, boolean justScaleDown) { if (imagePath == null) { return null; } int[] imageDimensions = getImageDimensions(imagePath); int originalWidth = imageDimensions[0]; int originalHeight = imageDimensions[1]; int newWidth = originalHeight; int newHeight = originalWidth; int loadingSampleSize = 1; double sampleSizeWidth = ((double) originalWidth) / (double) outputRectangleWidth; double sampleSizeHeight = ((double) originalHeight) / (double) outputRectangleHeight; double sampleSizeMinimum = Math.min(sampleSizeWidth, sampleSizeHeight); double sampleSizeMaximum = Math.max(sampleSizeWidth, sampleSizeHeight); if (!(justScaleDown && outputRectangleHeight > originalHeight && outputRectangleWidth > originalWidth)) { if (resizeType == ResizeType.STRETCH_TO_RECTANGLE) { newWidth = outputRectangleWidth; newHeight = outputRectangleHeight; } else if (resizeType == ResizeType.STAY_IN_RECTANGLE_WITH_SAME_ASPECT_RATIO) { newWidth = (int) Math.floor(originalWidth / sampleSizeMaximum); newHeight = (int) Math.floor(originalHeight / sampleSizeMaximum); } else if (resizeType == ResizeType.FILL_RECTANGLE_WITH_SAME_ASPECT_RATIO) { newWidth = (int) Math.floor(originalWidth / sampleSizeMinimum); newHeight = (int) Math.floor(originalHeight / sampleSizeMinimum); } } loadingSampleSize = calculateInSampleSize(originalWidth, originalHeight, outputRectangleWidth, outputRectangleHeight); BitmapFactory.Options bitmapOptions = new BitmapFactory.Options(); bitmapOptions.inSampleSize = loadingSampleSize; bitmapOptions.inJustDecodeBounds = false; Bitmap tempBitmap = BitmapFactory.decodeFile(imagePath, bitmapOptions); return scaleBitmap(tempBitmap, newWidth, newHeight); }

Target:
public static Bitmap getScaledBitmapFromPath(String imagePath, int outputRectangleWidth, int outputRectangleHeight, ResizeType resizeType, boolean justScaleDown) { if (imagePath == null) { return null; } int[] imageDimensions = getImageDimensions(imagePath); int originalWidth = imageDimensions[0]; int originalHeight = imageDimensions[1]; int[] scaledImageDimensions = getScaledImageDimensions(originalWidth, originalHeight, outputRectangleWidth, outputRectangleHeight, resizeType, justScaleDown); int newWidth = scaledImageDimensions[0]; int newHeight = scaledImageDimensions[1]; int loadingSampleSize = calculateInSampleSize(originalWidth, originalHeight, outputRectangleWidth, outputRectangleHeight); BitmapFactory.Options bitmapOptions = new BitmapFactory.Options(); bitmapOptions.inSampleSize = loadingSampleSize; bitmapOptions.inJustDecodeBounds = false; Bitmap tempBitmap = BitmapFactory.decodeFile(imagePath, bitmapOptions); return scaleBitmap(tempBitmap, newWidth, newHeight); }
Source:
public static boolean isMythicSpawner(String name) { return (!(MythicMobs.inst().getSpawnerManager().getSpawnerByName(name) == null)); }

Target:
public static boolean isMythicSpawner(String name) { return MythicMobs.inst().getSpawnerManager().getSpawnerByName(name) != null; }
Source:
public DimensionSelector decorate(final DimensionSelector selector) { if (selector == null) { return null; } final int selectorCardinality = selector.getValueCardinality(); if (selectorCardinality < 0 || !selector.nameLookupPossibleInAdvance()) { return new PredicateFilteredDimensionSelector( selector, new Predicate<String>() { @Override public boolean apply(@Nullable String input) { return NullHandling.nullToEmptyIfNeeded(input).startsWith(prefix); } } ); } int count = 0; final Int2IntOpenHashMap forwardMapping = new Int2IntOpenHashMap(); forwardMapping.defaultReturnValue(-1); for (int i = 0; i < selectorCardinality; i++) { if (NullHandling.nullToEmptyIfNeeded(selector.lookupName(i)).startsWith(prefix)) { forwardMapping.put(i, count++); } } final int[] reverseMapping = new int[forwardMapping.size()]; for (Int2IntMap.Entry e : forwardMapping.int2IntEntrySet()) { reverseMapping[e.getIntValue()] = e.getIntKey(); } return new ForwardingFilteredDimensionSelector(selector, forwardMapping, reverseMapping); }

Target:
public DimensionSelector decorate(final DimensionSelector selector) { if (selector == null) { return null; } final int selectorCardinality = selector.getValueCardinality(); if (selectorCardinality < 0 || !selector.nameLookupPossibleInAdvance()) { return new PredicateFilteredDimensionSelector( selector, new Predicate<String>() { @Override public boolean apply(@Nullable String input) { String val = NullHandling.nullToEmptyIfNeeded(input); return val == null ? false : val.startsWith(prefix); } } ); } int count = 0; final Int2IntOpenHashMap forwardMapping = new Int2IntOpenHashMap(); forwardMapping.defaultReturnValue(-1); for (int i = 0; i < selectorCardinality; i++) { String val = NullHandling.nullToEmptyIfNeeded(selector.lookupName(i)); if (val != null && val.startsWith(prefix)) { forwardMapping.put(i, count++); } } final int[] reverseMapping = new int[forwardMapping.size()]; for (Int2IntMap.Entry e : forwardMapping.int2IntEntrySet()) { reverseMapping[e.getIntValue()] = e.getIntKey(); } return new ForwardingFilteredDimensionSelector(selector, forwardMapping, reverseMapping); }
Source:
public void handleAction(final ActionParameters params) throws ActionException { JSONObject job = new JSONObject(); String downloadDetails = params.getHttpParam(PARAM_DOWNLOAD_DETAILS); String strUserDetails = params.getHttpParam(PARAM_USER_DETAILS); try { JSONObject userDetails = new JSONObject(strUserDetails); JSONArray ddArray = new JSONArray(downloadDetails); new SendDownloadDetailsToEmailThread(ddArray, userDetails, params.getLocale()).start(); job.put("success", true); } catch (Exception e) { throw new ActionException("Could not handle DownloadInfo request: ", e); } ResponseHelper.writeResponse(params, job); }

Target:
public void handleAction(final ActionParameters params) throws ActionException { String downloadDetails = params.getRequiredParam(PARAM_DOWNLOAD_DETAILS); String strUserDetails = params.getRequiredParam(PARAM_USER_DETAILS); try { JSONObject userDetails = new JSONObject(strUserDetails); JSONArray ddArray = new JSONArray(downloadDetails); new SendDownloadDetailsToEmailThread(mapLayerService, ddArray, userDetails, params.getLocale()).run(); } catch (Exception e) { throw new ActionException("Could not handle DownloadInfo request: ", e); } ResponseHelper.writeResponse(params, JSONHelper.createJSONObject("success", true)); }
Source:
public void testBasicContainerUsage() { BucketDefinition bucketDefinition = new BucketDefinition("mybucket"); try (CouchbaseContainer container = new CouchbaseContainer().withBucket(bucketDefinition)) { container.start(); CouchbaseEnvironment environment = DefaultCouchbaseEnvironment .builder() .bootstrapCarrierDirectPort(container.getMappedPort(11210)) .bootstrapHttpDirectPort(container.getMappedPort(8091)) .build(); Cluster cluster = CouchbaseCluster.create(environment, container.getContainerIpAddress()); try { cluster.authenticate(container.getUsername(), container.getPassword()); Bucket bucket = cluster.openBucket(bucketDefinition.getName()); bucket.upsert(JsonDocument.create("foo", JsonObject.empty())); assertTrue(bucket.exists("foo")); assertNotNull(cluster.clusterManager().getBucket(bucketDefinition.getName())); } finally { cluster.disconnect(); environment.shutdown(); } } }

Target:
public void testBasicContainerUsage() { BucketDefinition bucketDefinition = new BucketDefinition("mybucket"); try ( CouchbaseContainer container = new CouchbaseContainer() .withBucket(bucketDefinition) ) { container.start(); CouchbaseEnvironment environment = DefaultCouchbaseEnvironment .builder() .bootstrapCarrierDirectPort(container.getBootstrapCarrierDirectPort()) .bootstrapHttpDirectPort(container.getBootstrapHttpDirectPort()) .build(); Cluster cluster = CouchbaseCluster.create( environment, container.getContainerIpAddress() ); try { cluster.authenticate(container.getUsername(), container.getPassword()); Bucket bucket = cluster.openBucket(bucketDefinition.getName()); bucket.upsert(JsonDocument.create("foo", JsonObject.empty())); assertTrue(bucket.exists("foo")); assertNotNull(cluster.clusterManager().getBucket(bucketDefinition.getName())); } finally { cluster.disconnect(); environment.shutdown(); } } }
Source:
private Map<Long, Double> extractResult(final QueryResult res, final ComputeDistributionStat.Percentile percentile) { final Map<Long,Double> resMap = new HashMap<>(); List<ShardedResultGroup> shardedResultGroups = res.getGroups(); for(ShardedResultGroup shardedGrpRes : shardedResultGroups){ Set<String> pTags = new HashSet<>(); shardedGrpRes.getSeries().forEach(s->s.getTags().entrySet().stream() .filter(t->t.getKey().contentEquals("tdigestat")) .forEach(ss->pTags.add(ss.getValue()))); assertEquals(1, pTags.size()); if ( !pTags.contains(percentile.getName())) continue; MetricCollection metricCollection = shardedGrpRes.getMetrics(); for(Point p : metricCollection.getDataAs(Point.class)){ resMap.put(p.getTimestamp(), p.getValue()); } } return resMap; }

Target:
private Map<Long, Double> extractResult(final QueryResult res, final ComputeDistributionStat.Percentile percentile) { final Map<Long,Double> resMap = new HashMap<>(); List<ShardedResultGroup> shardedResultGroups = res.getGroups(); for(ShardedResultGroup shardedGrpRes : shardedResultGroups){ Set<String> pTags = new HashSet<>(); shardedGrpRes.getSeries().forEach(s->s.getTags().entrySet().stream() .filter(t->t.getKey().contentEquals("tdigeststat")) .forEach(ss->pTags.add(ss.getValue()))); assertEquals(1, pTags.size()); if ( !pTags.contains(percentile.getName())) continue; MetricCollection metricCollection = shardedGrpRes.getMetrics(); for(Point p : metricCollection.getDataAs(Point.class)){ resMap.put(p.getTimestamp(), p.getValue()); } } return resMap; }
Source:
public EventType() { this.validationStrategies = Lists.newArrayList(); this.enrichmentStrategies = Lists.newArrayList(); this.partitionStrategy = PartitionStrategy.RANDOM_STRATEGY; this.writeScopes = Collections.emptySet(); this.readScopes = Collections.emptySet(); }

Target:
public EventType() { this.validationStrategies = Collections.emptyList(); this.enrichmentStrategies = Collections.emptyList(); this.partitionStrategy = PartitionStrategy.RANDOM_STRATEGY; this.writeScopes = Collections.emptySet(); this.readScopes = Collections.emptySet(); }
Source:
private List<Map<String, Object>> toIceServers(List<IceServersServerMessage.IceServer> iceServers) { List<Map<String, Object>> result = new LinkedList<>(); for (IceServersServerMessage.IceServer iceServer : iceServers) { Map<String, Object> map = new HashMap<>(); List<String> urls = new LinkedList<>(); if (iceServer.getUrl() != null && !iceServer.getUrl().equals("null")) { urls.add(iceServer.getUrl()); } if (iceServer.getUrls() != null) { urls.addAll(Arrays.asList(iceServer.getUrls())); } map.put("urls", urls); map.put("credential", iceServer.getCredential()); map.put("credentialType", "token"); map.put("username", iceServers.get(2).getUsername()); result.add(map); } return (result); }

Target:
private List<Map<String, Object>> toIceServers(List<IceServersServerMessage.IceServer> iceServers) { List<Map<String, Object>> result = new LinkedList<>(); for (IceServersServerMessage.IceServer iceServer : iceServers) { Map<String, Object> map = new HashMap<>(); List<String> urls = new LinkedList<>(); if (iceServer.getUrl() != null && !iceServer.getUrl().equals("null")) { urls.add(iceServer.getUrl()); } if (iceServer.getUrls() != null) { urls.addAll(Arrays.asList(iceServer.getUrls())); } map.put("urls", urls); map.put("credential", iceServer.getCredential()); map.put("credentialType", "token"); map.put("username", iceServer.getUsername()); result.add(map); } return (result); }
Source:
private void continueSpan(HttpServletRequest request, Span spanFromRequest) { this.tracer.continueSpan(spanFromRequest); request.setAttribute(TraceRequestAttributes.SPAN_CONTINUED_REQUEST_ATTR, "true"); if (log.isDebugEnabled()) { log.debug("There has already been a span in the request " + spanFromRequest + ""); } }

Target:
private void continueSpan(HttpServletRequest request, Span spanFromRequest) { this.tracer.continueSpan(spanFromRequest); request.setAttribute(TraceRequestAttributes.SPAN_CONTINUED_REQUEST_ATTR, "true"); if (log.isDebugEnabled()) { log.debug("There has already been a span in the request " + spanFromRequest); } }
Source:
public T perform() throws BusinessException { do { try { return this.op.perform(); } catch (BusinessException e) { this.errors.add(e); if (this.attempts.incrementAndGet() >= this.maxAttempts || !this.test.test(e)) { throw e; } try { long testDelay = Math.pow(2, this.attempts)*1000 + Math.round(Math.random()*1000); long delay = (testDelay<this.maxDelay) ? testDelay : maxDelay; Thread.sleep(delay); } catch (InterruptedException f) { } } } while (true); }

Target:
public T perform() throws BusinessException { do { try { return this.op.perform(); } catch (BusinessException e) { this.errors.add(e); if (this.attempts.incrementAndGet() >= this.maxAttempts || !this.test.test(e)) { throw e; } try { Random rand = new Random(); long testDelay = (long) Math.pow(2, this.attempts.intValue()) * 1000 + rand.nextInt(1000); long delay = testDelay < this.maxDelay ? testDelay : maxDelay; Thread.sleep(delay); } catch (InterruptedException f) { } } } while (true); }
Source:
public void run() { LifecycleNotificationDAO lifecycleNotificationDAO = new JDBCLifecycleNotificationDAOImpl(); ArrayList<LCNotification> notifications = new ArrayList<LCNotification>(); try { notifications = lifecycleNotificationDAO .getValidNotifications(CommonUtil.getRegistryService().getRegistry()); } catch (GovernanceException e) { log.error("Error while getting notifications. Hold notification sending job.", e); return; } catch (RegistryException e) { log.error("Error while getting notifications to send Lifecycle checkpoint notifications.", e); } if (notifications != null && notifications.size() > 0) { for (LCNotification schedulerBean : notifications) { String notificationMessage = getNotificationMessage(schedulerBean); LifecycleNotificationEvent<String> notificationEvent = new LifecycleNotificationEvent<String> (notificationMessage); notificationEvent.setTenantId(schedulerBean.getTenantId()); notificationEvent.setResourcePath(schedulerBean.getRegPath()); NotificationService notificationService = new EventingServiceImpl(); try { notificationService.notify(notificationEvent); if (log.isDebugEnabled()) { log.debug("Notification '" + notificationMessage + "' sent to notification service."); } } catch (Exception e) { log.error("Error getting registry while getting scheduler objects to send notifications", e); } } } }

Target:
public void run() { try { ArrayList<LCNotification> notifications = getValidNotifications(); if (notifications.size() > 0) { for (LCNotification schedulerBean : notifications) { String notificationMessage = getNotificationMessage(schedulerBean); LifecycleNotificationEvent<String> notificationEvent = new LifecycleNotificationEvent<>(notificationMessage); notificationEvent.setTenantId(superTenantId); notificationEvent.setResourcePath(schedulerBean.getRegPath()); NotificationService notificationService = new EventingServiceImpl(); try { notificationService.notify(notificationEvent); if (log.isDebugEnabled()) { log.debug("Notification '" + notificationMessage + "' sent to notification service."); } } catch (Exception e) { log.error("Error getting registry while getting scheduler objects to send notifications", e); } } } } catch (RegistryException e) { log.error("Error while getting valid notifications on " + getCurrentDate(), e); } }
Source:
private void cleanAgents(HashSet<String> existingLinks) { List<Agent> agents = objectManager.find(Agent.class, AGENT.REMOVED, new Condition(ConditionType.NULL), AGENT.EXTERNAL_ID, new Condition(ConditionType.NOTNULL)); if(agents.size() > 0) { for(Agent agent : agents) { String[] uri = agent.getUri().substring(EXTERNAL_AGENT_URI_PREFIX.length()).split("_"); String region_env = String.format("%s:%s", uri[0], uri[1]); if(existingLinks.contains(region_env)) { continue; } List<AccountLink> links = objectManager.find(AccountLink.class, ACCOUNT_LINK.LINKED_REGION, uri[0], ACCOUNT_LINK.LINKED_ACCOUNT, uri[1], ACCOUNT_LINK.REMOVED, null); if(links.size()>0) { continue; } try { objectProcessManager.executeStandardProcess(StandardProcess.DEACTIVATE, agent, null); objectProcessManager.executeStandardProcess(StandardProcess.REMOVE, agent, null); } catch (Exception ex) { log.warn(String.format("Failed to clean agent with id [%s] - %s", agent.getId(), ex)); } } } }

Target:
private void cleanAgents(HashSet<String> existingLinks) { List<Agent> agents = objectManager.find(Agent.class, AGENT.REMOVED, new Condition(ConditionType.NULL), AGENT.EXTERNAL_ID, new Condition(ConditionType.NOTNULL)); if(agents.size() > 0) { for(Agent agent : agents) { String[] uri = agent.getUri().substring(RegionUtil.EXTERNAL_AGENT_URI_PREFIX.length()).split("_"); String regionEnv = String.format("%s:%s", uri[0], uri[1]); if(existingLinks.contains(regionEnv)) { continue; } agentRemove.deactivateThenRemove(agent, null); } } }
Source:
public boolean isChangesRequiresResponseDeletion(FeedbackQuestionDetails newDetails) { FeedbackMsqQuestionDetails newMsqDetails = (FeedbackMsqQuestionDetails) newDetails; if (this.numOfMsqChoices != newMsqDetails.numOfMsqChoices || !this.msqChoices.containsAll(newMsqDetails.msqChoices) || !newMsqDetails.msqChoices.containsAll(this.msqChoices)) { return true; } if (this.generateOptionsFor != newMsqDetails.generateOptionsFor) { return true; } if (this.maxSelectableChoices == Integer.MIN_VALUE && newMsqDetails.maxSelectableChoices != Integer.MIN_VALUE) { return true; } if (this.minSelectableChoices == Integer.MIN_VALUE && newMsqDetails.minSelectableChoices != Integer.MIN_VALUE) { return true; } if (this.minSelectableChoices != Integer.MIN_VALUE && newMsqDetails.minSelectableChoices != Integer.MIN_VALUE && this.minSelectableChoices > newMsqDetails.minSelectableChoices) { return true; } if (this.maxSelectableChoices != Integer.MIN_VALUE && newMsqDetails.maxSelectableChoices != Integer.MIN_VALUE && this.maxSelectableChoices < newMsqDetails.maxSelectableChoices) { return true; } return this.otherEnabled != newMsqDetails.otherEnabled; }

Target:
public boolean isChangesRequiresResponseDeletion(FeedbackQuestionDetails newDetails) { FeedbackMsqQuestionDetails newMsqDetails = (FeedbackMsqQuestionDetails) newDetails; if (this.numOfMsqChoices != newMsqDetails.numOfMsqChoices || !this.msqChoices.containsAll(newMsqDetails.msqChoices) || !newMsqDetails.msqChoices.containsAll(this.msqChoices)) { return true; } if (this.generateOptionsFor != newMsqDetails.generateOptionsFor) { return true; } if (this.maxSelectableChoices == Integer.MIN_VALUE && newMsqDetails.maxSelectableChoices != Integer.MIN_VALUE) { return true; } if (this.minSelectableChoices == Integer.MIN_VALUE && newMsqDetails.minSelectableChoices != Integer.MIN_VALUE) { return true; } if (this.minSelectableChoices != Integer.MIN_VALUE && newMsqDetails.minSelectableChoices != Integer.MIN_VALUE && this.minSelectableChoices < newMsqDetails.minSelectableChoices) { return true; } if (this.maxSelectableChoices != Integer.MIN_VALUE && newMsqDetails.maxSelectableChoices != Integer.MIN_VALUE && this.maxSelectableChoices > newMsqDetails.maxSelectableChoices) { return true; } return this.otherEnabled != newMsqDetails.otherEnabled; }
Source:
public void createSheet(String name, List<Object> headers) throws IOException { if (name.length() <= 31) { Sheet sheet = workbook.getSheet(name); if (sheet == null) { sheet = workbook.createSheet(name); internalWriteRow(headers, sheet, 0); } } else { throw new MaximumSheetNameLengthExceededException(name); } }

Target:
public void createSheet(String name, List<Object> headers) { if (name.length() <= MAXIMUM_SHEET_LENGTH) { Sheet sheet = workbook.getSheet(name); if (sheet == null) { sheet = workbook.createSheet(name); internalWriteRow(headers, sheet, 0); } } else { throw new MaximumSheetNameLengthExceededException(name); } }
Source:
private void resurrectCheckpoints() { ExecutorService executorService = Executors.newFixedThreadPool(numOfWorkers, new ThreadFactoryBuilder() .setNameFormat("FastObjectLoaderResurrectCheckpointsThread-%d").build()); CompletableFuture[] cfs = new CompletableFuture[streamsMetaData.size()]; int i = 0; try { for (Map.Entry<UUID, StreamMetaData> entry : streamsMetaData.entrySet()) { cfs[i++] = CompletableFuture.runAsync(() -> { CheckPoint checkPoint = entry.getValue().getLatestCheckPoint(); if (checkPoint == null) { log.info("resurrectCheckpoints[{}]: Truncated checkpoint for this stream", Utils.toReadableId(entry.getKey())); return; } for (long address : checkPoint.getAddresses()) { updateCorfuObject(getLogData(runtime, loadInCache, address)); } }); } executorService.shutdown(); executorService.awaitTermination(timeoutInMinutesForLoading, TimeUnit.MINUTES); for (CompletableFuture future : cfs) { if (!future.isDone() || future.isCancelled() || future.isCompletedExceptionally()) { throw new FastObjectLoaderException("Failed to load checkpoints"); } } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new FastObjectLoaderException("Failed to resurrectCheckpoints"); } finally { executorService.shutdownNow(); } }

Target:
private void resurrectCheckpoints() { ExecutorService executorService = Executors.newFixedThreadPool(numOfWorkers, new ThreadFactoryBuilder() .setNameFormat("FastObjectLoaderResurrectCheckpointsThread-%d").build()); CompletableFuture[] cfs = new CompletableFuture[streamsMetaData.size()]; int i = 0; try { for (Map.Entry<UUID, StreamMetaData> entry : streamsMetaData.entrySet()) { cfs[i++] = CompletableFuture.runAsync(() -> { CheckPoint checkPoint = entry.getValue().getLatestCheckPoint(); if (checkPoint == null) { log.info("resurrectCheckpoints[{}]: Truncated checkpoint for this stream", Utils.toReadableId(entry.getKey())); return; } for (long address : checkPoint.getAddresses()) { updateCorfuObject(getLogData(runtime, loadInCache, address)); } }, executorService); } executorService.shutdown(); executorService.awaitTermination(timeoutInMinutesForLoading, TimeUnit.MINUTES); for (CompletableFuture future : cfs) { if (!future.isDone() || future.isCancelled() || future.isCompletedExceptionally()) { throw new FastObjectLoaderException("Failed to load checkpoints"); } } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new FastObjectLoaderException("Failed to resurrectCheckpoints"); } finally { executorService.shutdownNow(); } }
Source:
public synchronized void start() { _d2Config = new DatastreamD2Config(_config, _clusterName, _endpoints); if (_isLeader.getAsBoolean()) { try { configureCluster(); } catch (Exception e) { String errMsg = "Failed to set up D2 cluster, server=" + this; LOG.error(errMsg, e); throw new DatastreamRuntimeException(errMsg, e); } } try { waitForClusterSetup(); joinCluster(); _isStopped = false; } catch (Exception e) { String errMsg = "Failed to join D2 cluster, server=" + this; LOG.error(errMsg, e); throw new DatastreamRuntimeException(errMsg, e); } }

Target:
public synchronized void start() { _d2Config = new DatastreamD2Config(_config, _clusterName, _svcEndpoints); if (_isLeader.getAsBoolean()) { try { configureCluster(); } catch (Exception e) { String errMsg = "Failed to set up D2 cluster, server=" + this; LOG.error(errMsg, e); throw new DatastreamRuntimeException(errMsg, e); } } try { waitForClusterSetup(); joinCluster(); _isStopped = false; } catch (Exception e) { String errMsg = "Failed to join D2 cluster, server=" + this; LOG.error(errMsg, e); throw new DatastreamRuntimeException(errMsg, e); } }
Source:
public static String toDot(CFG cfg) { StringBuilder sb = new StringBuilder(); List<Block> blocks = cfg.blocks(); sb.append("cfg{"); sb.append(DOT_NEW_LINE); int firstBlockId = blocks.size() - 1; for (Block block : blocks) { int id = block.id(); sb.append(DOT_PADDING); sb.append(id + dotBlockLabel(id, firstBlockId) + ";"); sb.append(DOT_NEW_LINE); } sb.append(DOT_NEW_LINE); for (Block block : blocks) { for (Block successor : block.successors()) { sb.append(DOT_PADDING); sb.append(block.id() + "->" + successor.id() + dotSuccessorLabel(block, successor) + ";"); sb.append(DOT_NEW_LINE); } for (Block exception : block.exceptions()) { sb.append(DOT_PADDING); sb.append(block.id() + "->" + exception.id() + dotExceptionLabel(block, exception) + ";"); sb.append(DOT_NEW_LINE); } } sb.append("}"); return sb.toString(); }

Target:
public static String toDot(CFG cfg) { StringBuilder sb = new StringBuilder(); List<Block> blocks = cfg.blocks(); int firstBlockId = blocks.size() - 1; blocks.stream().map(block -> dotBlockLabel(block.id(), firstBlockId)).forEach(sb::append); sb.append(NEW_LINE); for (Block block : blocks) { block.successors().stream().map(successor -> dotSuccessorFormat(block, successor)).forEach(sb::append); block.exceptions().stream().map(exception -> dotExceptionFormat(block, exception)).forEach(sb::append); } return escapeNewLines("graph cfg {" + NEW_LINE + sb.toString() + "}"); }
Source:
public void updateProviderWithReservedName() throws Exception { NewServiceProvider newProvider1 = NewServiceProviderBuilder.newServiceProvider().name("name1").build(); NewServiceProvider newProvider2 = NewServiceProviderBuilder.newServiceProvider().name("name2").build(); Object id = repository.create(newProvider1); repository.create(newProvider2); ServiceProvider provider = ServiceProviderBuilder.newProvider().id(new ID(id)).name("name2").build(); repository.update(provider); }

Target:
public void updateProviderWithReservedName() throws Exception { NewServiceProvider newProvider1 = newServiceProvider().name("name1").build(); NewServiceProvider newProvider2 = newServiceProvider().name("name2").build(); Object id = repository.create(newProvider1); repository.create(newProvider2); ServiceProvider provider = ServiceProviderBuilder.newProvider().id(new ID(id)).name("name2").build(); repository.update(provider); }
Source:
public FateStatus getStatus(ReadOnlyTStore<T> zs, IZooReader zk, String lockPath, Set<Long> filterTxid, EnumSet<TStatus> filterStatus) throws KeeperException, InterruptedException { Map<Long,List<String>> heldLocks = new HashMap<>(); Map<Long,List<String>> waitingLocks = new HashMap<>(); findLocks(zk, lockPath, heldLocks, waitingLocks); FateStatus status = getTransactionStatus(zs, filterTxid, filterStatus, heldLocks, waitingLocks); return status; }

Target:
public FateStatus getStatus(ReadOnlyTStore<T> zs, IZooReader zk, String lockPath, Set<Long> filterTxid, EnumSet<TStatus> filterStatus) throws KeeperException, InterruptedException { Map<Long,List<String>> heldLocks = new HashMap<>(); Map<Long,List<String>> waitingLocks = new HashMap<>(); findLocks(zk, lockPath, heldLocks, waitingLocks); return getTransactionStatus(zs, filterTxid, filterStatus, heldLocks, waitingLocks); }
Source:
public static <S> void close(S dynamicProxy) { IOUtils.closeQuietly(getPool(dynamicProxy)); }

Target:
public static <S> void close(S dynamicProxy) { try { Closeables.close(getPool(dynamicProxy), true); } catch (IOException e) { throw new AssertionError(); } }
Source:
public final boolean flush(long timeout, TimeUnit unit) { validateBlockingAction(); if (stateUpdater.get(this) == STATE_NOT_RUNNING) { return true; } long timeLimit = System.currentTimeMillis() + unit.toMillis(timeout); try { while (stateUpdater.get(this) == STATE_RUNNING && timeLimit > System.currentTimeMillis()) { if (tasks.isEmpty()) { return true; } Thread.sleep(10); } } catch (InterruptedException e) { } return stateUpdater.get(this) == STATE_NOT_RUNNING; }

Target:
public final boolean flush(long timeout, TimeUnit unit) { validateBlockingCall(); if (stateUpdater.get(this) == STATE_NOT_RUNNING) { return true; } long timeLimit = System.currentTimeMillis() + unit.toMillis(timeout); try { while (stateUpdater.get(this) == STATE_RUNNING && timeLimit > System.currentTimeMillis()) { if (tasks.isEmpty()) { return true; } Thread.sleep(10); } } catch (InterruptedException e) { } return stateUpdater.get(this) == STATE_NOT_RUNNING; }
Source:
protected void focusFirstField() { final Iterator<Entry<String, FormFieldWidget>> fieldWidgestIterator = fieldWidgets.entrySet().iterator(); boolean focused = false; while (fieldWidgestIterator.hasNext() && !focused) { final Entry<String, FormFieldWidget> reducedFormWidget = fieldWidgestIterator.next(); final FormFieldWidget formFieldWidget = reducedFormWidget.getValue(); if (formFieldWidget!=null && formFieldWidget.getType()!=null && widgetTypesToFocus.contains(formFieldWidget.getType())) { focused = true; formFieldWidget.setFocusOn(); } } }

Target:
protected void focusFirstField() { final Iterator<Entry<String, FormFieldWidget>> fieldWidgestIterator = fieldWidgets.entrySet().iterator(); boolean focused = false; while (fieldWidgestIterator.hasNext() && !focused) { final Entry<String, FormFieldWidget> reducedFormWidget = fieldWidgestIterator.next(); final FormFieldWidget formFieldWidget = reducedFormWidget.getValue(); if (formFieldWidget != null && widgetTypesToFocus.contains(formFieldWidget.getType())) { if (formFieldWidget.getType().equals(WidgetType.RICH_TEXTAREA)) { formFieldWidget.getElement().focus(); } else { formFieldWidget.setFocusOn(); } focused = true; } } }
Source:
public Mono<HttpClientResponse> deletePolicy(String vhost, String name) { return doDelete(builder -> builder.pathSegment("policies", vhost, name)); }

Target:
public Mono<HttpResponse> deletePolicy(String vhost, String name) { return doDelete("policies", enc(vhost), enc(name)); }
Source:
public void setFocus(final IDMContext[] focus, RequestMonitor rm) { assert focus != null; IDMContext elem = focus[0]; if (elem instanceof IFrameDMContext) { final IFrameDMContext finalFrameCtx = (IFrameDMContext)elem; setFrameFocus(finalFrameCtx, new ImmediateRequestMonitor(rm) { @Override public void handleSuccess() { fCurrentGDBFocus = finalFrameCtx; rm.done(); } }); } else if (elem instanceof IMIExecutionDMContext) { final IMIExecutionDMContext finalThreadCtx = (IMIExecutionDMContext)elem; setThreadFocus(finalThreadCtx, new ImmediateRequestMonitor(rm) { @Override protected void handleSuccess() { fCurrentGDBFocus = finalThreadCtx; rm.done(); } @Override protected void handleFailure() { rm.done(); } }); } else { assert false; rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context to set focus to", null)); return; } }

Target:
public void setFocus(final IDMContext[] focus, RequestMonitor rm) { assert focus != null; IDMContext elem = focus[0]; if (elem instanceof IFrameDMContext) { final IFrameDMContext finalFrameCtx = (IFrameDMContext)elem; setFrameFocus(finalFrameCtx, new ImmediateRequestMonitor(rm) { @Override public void handleSuccess() { fCurrentGDBFocus = finalFrameCtx; rm.done(); } }); } else if (elem instanceof IMIExecutionDMContext) { final IMIExecutionDMContext finalThreadCtx = (IMIExecutionDMContext)elem; setThreadFocus(finalThreadCtx, new ImmediateRequestMonitor(rm) { @Override protected void handleSuccess() { fCurrentGDBFocus = finalThreadCtx; rm.done(); } @Override protected void handleFailure() { rm.done(); } }); } else if (elem instanceof IMIContainerDMContext) { setProcessFocus((IMIContainerDMContext)elem, rm); } else { assert false; rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid context to set focus to", null)); return; } }
Source:
public MessageChannel resolveDestination(String name) { Assert.state(this.beanFactory != null, "BeanFactory is required"); try { return this.beanFactory.getBean(name, MessageChannel.class); } catch (BeansException e) { if (this.replyChannelRegistry != null) { MessageChannel channel = this.replyChannelRegistry.channelNameToChannel(name); if (channel != null) { return channel; } } throw new DestinationResolutionException( "failed to look up MessageChannel bean with name '" + name + "'" + (this.replyChannelRegistry == null ? " (no header channel registry present)" : ""), e); } }

Target:
public MessageChannel resolveDestination(String name) { Assert.state(this.beanFactory != null, "BeanFactory is required"); try { return this.beanFactory.getBean(name, MessageChannel.class); } catch (BeansException e) { if (this.replyChannelRegistry != null) { MessageChannel channel = this.replyChannelRegistry.channelNameToChannel(name); if (channel != null) { return channel; } } throw new DestinationResolutionException( "failed to look up MessageChannel with name '" + name + "' in the BeanFactory" + (this.replyChannelRegistry == null ? " (and there is no HeaderChannelRegistry present)." : "."), e); } }
Source:
private Object verifyRemoteTransaction(RemoteTxInvocationContext ctx, AbstractTransactionBoundaryCommand command, Object rv, Throwable throwable) throws Throwable { final GlobalTransaction globalTransaction = command.getGlobalTransaction(); final Address origin = globalTransaction.getAddress(); boolean originatorMissing = !rpcManager.getTransport().getMembers().contains(origin); boolean alreadyCompleted = txTable.isTransactionCompleted(globalTransaction) || !txTable.containRemoteTx(globalTransaction); boolean completedSuccessfully = alreadyCompleted && !ctx.getCacheTransaction().isMarkedForRollback(); boolean canRollback = command instanceof PrepareCommand && !((PrepareCommand) command).isOnePhaseCommit() || command instanceof RollbackCommand || command instanceof LockControlCommand; if (trace) { log.tracef("Verifying transaction: originatorMissing=%s, alreadyCompleted=%s", originatorMissing, alreadyCompleted); } if (alreadyCompleted || (originatorMissing && (canRollback || partitionHandlingManager.canRollbackTransactionAfterOriginatorLeave(globalTransaction)))) { if (trace) { log.tracef("Rolling back remote transaction %s because either already completed (%s) or originator no longer in the cluster (%s).", globalTransaction, alreadyCompleted, originatorMissing); } txTable.markTransactionCompleted(globalTransaction, false); RollbackCommand rollback = commandsFactory.buildRollbackCommand(command.getGlobalTransaction()); return invokeNextAndFinally(ctx, rollback, (rCtx, rCommand, rv1, throwable1) -> { RemoteTransaction remoteTx = ((TxInvocationContext<RemoteTransaction>) rCtx).getCacheTransaction(); remoteTx.markForRollback(true); txTable.removeRemoteTransaction(globalTransaction); if (throwable1 == null) { if (originatorMissing && !completedSuccessfully) { throw log.orphanTransactionRolledBack(globalTransaction); } } }); } return valueOrException(rv, throwable); }

Target:
private Object verifyRemoteTransaction(RemoteTxInvocationContext ctx, AbstractTransactionBoundaryCommand command, Object rv, Throwable throwable) throws Throwable { final GlobalTransaction globalTransaction = command.getGlobalTransaction(); boolean alreadyCompleted = txTable.isTransactionCompleted(globalTransaction) || !txTable.containRemoteTx(globalTransaction); boolean canRollback = command instanceof PrepareCommand && !((PrepareCommand) command).isOnePhaseCommit() || command instanceof LockControlCommand; if (trace) { log.tracef("Verifying transaction: alreadyCompleted=%s", alreadyCompleted); } if (alreadyCompleted) { if (trace) { log.tracef("Rolling back remote transaction %s because it was already completed", globalTransaction); } txTable.markTransactionCompleted(globalTransaction, false); RollbackCommand rollback = commandsFactory.buildRollbackCommand(command.getGlobalTransaction()); return invokeNextAndFinally(ctx, rollback, (rCtx, rCommand, rv1, throwable1) -> { RemoteTransaction remoteTx = ((TxInvocationContext<RemoteTransaction>) rCtx).getCacheTransaction(); remoteTx.markForRollback(true); txTable.removeRemoteTransaction(globalTransaction); }); } return valueOrException(rv, throwable); }
Source:
Type getType() { if (root != null) { return root.type; } else { return type; } }

Target:
Type getType() { return root != null ? root.type : type; }
Source:
public void readData(ObjectDataInput in) throws IOException { key = IOUtil.readObject(in); value = IOUtil.readObject(in); cost = in.readLong(); creationTime = in.readLong(); expirationTime = in.readLong(); hits = in.readLong(); lastAccessTime = in.readLong(); lastStoredTime = in.readLong(); lastUpdateTime = in.readLong(); version = in.readLong(); ttl = in.readLong(); maxIdle = in.readLong(); }

Target:
public void readData(ObjectDataInput in) throws IOException { key = IOUtil.readObject(in); value = IOUtil.readObject(in); cost = in.readLong(); creationTime = in.readLong(); expirationTime = in.readLong(); hits = in.readLong(); lastAccessTime = in.readLong(); lastStoredTime = in.readLong(); lastUpdateTime = in.readLong(); version = in.readLong(); ttl = in.readLong(); if (in.getVersion().isGreaterOrEqual(V3_11)) { maxIdle = in.readLong(); } }
Source:
public void startDocument(List<Node> nodes) { String fileContent; try { fileContent = getHtmlSourceCode().inputFile().contents(); } catch (IOException e) { throw new IllegalStateException(e); } if (isRegularExpression) { checkRegularExpression(fileContent); } else { HeaderLinesProcessor processor = new HeaderLinesProcessor(expectedLines); new BufferedReader(new StringReader(fileContent)).lines() .forEachOrdered(processor::processLine); if (!processor.getResult()) { createViolation(0, MESSAGE); } } }

Target:
public void startDocument(List<Node> nodes) { String fileContent; try { fileContent = getHtmlSourceCode().inputFile().contents(); } catch (IOException e) { throw new IllegalStateException(e); } if (isRegularExpression) { checkRegularExpression(fileContent); } else { HeaderLinesProcessor processor = new HeaderLinesProcessor(expectedLines); try (BufferedReader br = new BufferedReader(new StringReader(fileContent))) { List<String> lines = br.lines().collect(Collectors.toList()); for (String line : lines) { if (!processor.processLine(line)) { break; } } if (!processor.getResult()) { createViolation(0, MESSAGE); } } catch (IOException e) { throw new IllegalStateException(e); } } }
Source:
public KeyVaultCredentialPolicy(TokenCredential credential) { Objects.requireNonNull(credential); this.cache = new ScopeTokenCache((request) -> credential.getToken(request)); this.httpClient = null; this.logOptions = null; }

Target:
public KeyVaultCredentialPolicy(TokenCredential credential) { Objects.requireNonNull(credential); this.cache = new ScopeTokenCache((request) -> credential.getToken(request)); }
Source:
private static @NonNull TmfTraceContext getCurrentTraceContext() { TmfTraceManager instance = TmfTraceManager.getInstance(); ITmfTrace activeTrace = instance.getActiveTrace(); return activeTrace == null ? TmfTraceContext.NULL_CONTEXT : instance.getTraceContext(activeTrace); }

Target:
private static @Nullable TmfTraceContext getCurrentTraceContext() { TmfTraceManager instance = TmfTraceManager.getInstance(); ITmfTrace activeTrace = instance.getActiveTrace(); return activeTrace == null ? null : instance.getTraceContext(activeTrace); }
Source:
protected boolean configure() { Configuration configuration = getConfig(); Map<String, String> properties = editProperties(); if (getBridge() == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "bridge missing"); return false; } sensorCount = Integer.valueOf(properties.get(PROPERTY_SENSORCOUNT)); for (int i = 0; i < sensorCount; i++) { String configKey = (i == 0) ? CONFIG_ID : CONFIG_ID + String.valueOf(i); if (configuration.get(configKey) != null) { String sensorId = (String) configuration.get(configKey); if (SENSOR_ID_PATTERN.matcher(sensorId).matches()) { sensorIds.add(sensorId); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "sensor id format mismatch"); return false; } } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "sensor id missing"); return false; } } if (configuration.get(CONFIG_REFRESH) != null) { refreshInterval = ((BigDecimal) configuration.get(CONFIG_REFRESH)).intValue() * 1000; } else { refreshInterval = 300 * 1000; } lastRefresh = 0; return true; }

Target:
protected boolean configure() { Configuration configuration = getConfig(); Map<String, String> properties = thing.getProperties(); if (getBridge() == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "bridge missing"); return false; } sensorCount = Integer.valueOf(properties.get(PROPERTY_SENSORCOUNT)); for (int i = 0; i < sensorCount; i++) { String configKey = (i == 0) ? CONFIG_ID : CONFIG_ID + String.valueOf(i); if (configuration.get(configKey) != null) { String sensorId = (String) configuration.get(configKey); if (SENSOR_ID_PATTERN.matcher(sensorId).matches()) { sensorIds.add(sensorId); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "sensor id format mismatch"); return false; } } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "sensor id missing"); return false; } } if (configuration.get(CONFIG_REFRESH) != null) { refreshInterval = ((BigDecimal) configuration.get(CONFIG_REFRESH)).intValue() * 1000; } else { refreshInterval = 300 * 1000; } if (thing.getChannel(CHANNEL_PRESENT) != null) { showPresence = true; } lastRefresh = 0; return true; }
Source:
public KTableValueGetterSupplier<K, V> view() { final KTableValueGetterSupplier<K, V> parentValueGetterSupplier = parentKTable.valueGetterSupplier(); return new KTableValueGetterSupplier<K, V>() { @Override public KTableValueGetter<K, V> get() { final KTableValueGetter<K, V> parentGetter = parentValueGetterSupplier.get(); return new KTableValueGetter<K, V>() { private TimeOrderedKeyValueBuffer<K, V> buffer; @SuppressWarnings("unchecked") @Override public void init(final ProcessorContext context) { parentGetter.init(context); buffer = requireNonNull((TimeOrderedKeyValueBuffer<K, V>) context.getStateStore(storeName)); } @Override public ValueAndTimestamp<V> get(final K key) { if (buffer.hasKey(key)) { return buffer.priorValueForBuffered(key); } else { return parentGetter.get(key); } } @Override public void close() { parentGetter.close(); } }; } @Override public String[] storeNames() { final String[] parentStores = parentValueGetterSupplier.storeNames(); final String[] stores = new String[1 + parentStores.length]; System.arraycopy(parentStores, 0, stores, 1, parentStores.length); stores[0] = storeName; return stores; } }; }

Target:
public KTableValueGetterSupplier<K, V> view() { final KTableValueGetterSupplier<K, V> parentValueGetterSupplier = parentKTable.valueGetterSupplier(); return new KTableValueGetterSupplier<K, V>() { @Override public KTableValueGetter<K, V> get() { final KTableValueGetter<K, V> parentGetter = parentValueGetterSupplier.get(); return new KTableValueGetter<K, V>() { private TimeOrderedKeyValueBuffer<K, V> buffer; @SuppressWarnings("unchecked") @Override public void init(final ProcessorContext context) { parentGetter.init(context); buffer = requireNonNull((TimeOrderedKeyValueBuffer<K, V>) context.getStateStore(storeName)); } @Override public ValueAndTimestamp<V> get(final K key) { final Maybe<ValueAndTimestamp<V>> maybeValue = buffer.priorValueForBuffered(key); if (maybeValue.isDefined()) { return maybeValue.getNullableValue(); } else { return parentGetter.get(key); } } @Override public void close() { parentGetter.close(); } }; } @Override public String[] storeNames() { final String[] parentStores = parentValueGetterSupplier.storeNames(); final String[] stores = new String[1 + parentStores.length]; System.arraycopy(parentStores, 0, stores, 1, parentStores.length); stores[0] = storeName; return stores; } }; }
Source:
public void beforeClass(final @Optional String testType) throws IOException { if (testType.equals("buckets")) { throw new SkipException("Directory tests will be skipped in Manta Buckets"); } IntegrationTestHelper.createTestBucketOrDirectory(mantaClient, testPathPrefix, testType); }

Target:
public void beforeClass(final @Optional String testType) throws IOException { if ("buckets".equals(testType)) { throw new SkipException("Directory tests will be skipped in Manta Buckets"); } IntegrationTestHelper.createTestBucketOrDirectory(mantaClient, testPathPrefix, testType); }
Source:
private Map<String, Object> getTaskCompletionRowStats() { Map<String, Object> metrics = Maps.newHashMap(); if (determinePartitionsMeters != null) { metrics.put( "determinePartitions", determinePartitionsMeters.getTotals() ); } if (buildSegmentsMeters != null) { metrics.put( "buildSegments", buildSegmentsMeters.getTotals() ); } return metrics; }

Target:
private Map<String, Object> getTaskCompletionRowStats() { Map<String, Object> metrics = Maps.newHashMap(); metrics.put( RowIngestionMeters.DETERMINE_PARTITIONS, determinePartitionsMeters.getTotals() ); metrics.put( RowIngestionMeters.BUILD_SEGMENTS, buildSegmentsMeters.getTotals() ); return metrics; }
Source:
static void setVolumeSliderColor(Context context, MediaRouteVolumeSlider volumeSlider) { int progressAndThumbColor, backgroundColor; if (isLightTheme(context)) { progressAndThumbColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_progress_and_thumb_light); backgroundColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_background_light); } else { progressAndThumbColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_progress_and_thumb_dark); backgroundColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_background_dark); } volumeSlider.setProgressAndThumbColor(progressAndThumbColor); volumeSlider.setBackgroundColor(backgroundColor); }

Target:
static void setVolumeSliderColor(Context context, MediaRouteVolumeSlider volumeSlider) { int progressAndThumbColor, backgroundColor; if (isLightTheme(context)) { progressAndThumbColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_progress_and_thumb_light); backgroundColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_background_light); } else { progressAndThumbColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_progress_and_thumb_dark); backgroundColor = ContextCompat.getColor(context, R.color.mr_cast_progressbar_background_dark); } volumeSlider.setColor(progressAndThumbColor, backgroundColor); }
Source:
public final List<String> getGroupNames() { List<String> groupNames = new ArrayList<>(m_groups.size()); m_groups.forEach(g -> groupNames.add(g.m_name)); return groupNames; }

Target:
public final List<String> getGroupNames() { return m_groups.stream().map(g -> g.m_name).collect(Collectors.toList()); }
Source:
private boolean avoidRpcToGetTable(boolean alwaysHitServer, Long resolvedTimestamp, boolean systemTable, PTable table, PTableRef tableRef, long tableResolvedTimestamp) { if (table != null && !alwaysHitServer) { if (systemTable && table.getRowTimestampColPos() == -1 || resolvedTimestamp == tableResolvedTimestamp) { return true; } long effectiveUpdateCacheFrequency = table.getUpdateCacheFrequency() != 0L ? table.getUpdateCacheFrequency() : connection.getQueryServices().getProps().getLong( QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB, QueryServicesOptions.DEFAULT_UPDATE_CACHE_FREQUENCY); return (table.getRowTimestampColPos() == -1 && connection.getMetaDataCache().getAge(tableRef) < effectiveUpdateCacheFrequency); } return false; }

Target:
private boolean avoidRpcToGetTable(boolean alwaysHitServer, Long resolvedTimestamp, boolean systemTable, PTable table, PTableRef tableRef, long tableResolvedTimestamp) { if (table != null && !alwaysHitServer) { if (systemTable && table.getRowTimestampColPos() == -1 || resolvedTimestamp == tableResolvedTimestamp) { return true; } final long effectiveUpdateCacheFreq; final String ucfInfoForLogging; if (table.getUpdateCacheFrequency() != 0L) { effectiveUpdateCacheFreq = table.getUpdateCacheFrequency(); ucfInfoForLogging = "table-level"; } else { effectiveUpdateCacheFreq = (Long) ConnectionProperty.UPDATE_CACHE_FREQUENCY.getValue( connection.getQueryServices().getProps().get( QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB)); ucfInfoForLogging = connection.getQueryServices().getProps().get( QueryServices.DEFAULT_UPDATE_CACHE_FREQUENCY_ATRRIB) != null ? "connection-level" : "default"; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("Using " + ucfInfoForLogging + " Update Cache Frequency (value = " + effectiveUpdateCacheFreq + "ms) for " + table.getName() + (table.getTenantId() != null ? ", Tenant ID: " + table.getTenantId() : "")); } return (table.getRowTimestampColPos() == -1 && connection.getMetaDataCache().getAge(tableRef) < effectiveUpdateCacheFreq); } return false; }