auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { IStructuredSelection selection = getSelection(event); if (selection.isEmpty()) return null; RevCommit commit = (RevCommit) selection.getFirstElement(); Object input = getPage(event).getInputInternal().getSingleFile(); IWorkbenchPage workbenchPage = HandlerUtil .getActiveWorkbenchWindowChecked(event).getActivePage(); if (input instanceof IFile) { IFile file = (IFile) input; final RepositoryMapping mapping = RepositoryMapping .getMapping(file); if (mapping != null) { final String gitPath = mapping.getRepoRelativePath(file); final String commitPath = getRenamedPath(gitPath, commit); ITypedElement right = CompareUtils.getFileRevisionTypedElement( commitPath, commit, mapping.getRepository()); CompareEditorInput in = new GitCompareFileRevisionEditorInput( SaveableCompareEditorInput.createFileElement(file), right, null); CompareUtils.openInCompare(workbenchPage, in); } } else if (input instanceof File) { File file = (File) input; Repository repo = getRepository(event); if (repo != null) { final String leftCommitPath = getRepoRelativePath(repo, file); final String rightCommitPath = getRenamedPath(leftCommitPath, commit); final ITypedElement right = CompareUtils .getFileRevisionTypedElement(rightCommitPath, commit, repo); CompareEditorInput in = new GitCompareFileRevisionEditorInput( new LocalNonWorkspaceTypedElement(repo, new Path(file.getAbsolutePath())), right, null); CompareUtils.openInCompare(workbenchPage, in); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IStructuredSelection selection = getSelection(event); if (selection.isEmpty()) return null; RevCommit commit = (RevCommit) selection.getFirstElement(); Object input = getPage(event).getInputInternal().getSingleFile(); IWorkbenchPage workbenchPage = HandlerUtil .getActiveWorkbenchWindowChecked(event).getActivePage(); if (input instanceof IFile) { IFile file = (IFile) input; final RepositoryMapping mapping = RepositoryMapping .getMapping(file); if (mapping != null) { final String gitPath = mapping.getRepoRelativePath(file); final String commitPath = getRenamedPath(gitPath, commit); ITypedElement right = CompareUtils.getFileRevisionTypedElement( commitPath, commit, mapping.getRepository()); CompareEditorInput in = new GitCompareFileRevisionEditorInput( SaveableCompareEditorInput.createFileElement(file), right, null); CompareUtils.openInCompare(workbenchPage, in); } } else if (input instanceof File) { File file = (File) input; Repository repo = getRepository(event); if (repo != null) { final String leftCommitPath = getRepoRelativePath(repo, file); final String rightCommitPath = getRenamedPath(leftCommitPath, commit); ITypedElement right = CompareUtils.getFileRevisionTypedElement( rightCommitPath, commit, repo); CompareEditorInput in = new GitCompareFileRevisionEditorInput( new LocalNonWorkspaceTypedElement(repo, new Path(file.getAbsolutePath())), right, null); CompareUtils.openInCompare(workbenchPage, in); } } return null; }
Source:
protected void reportInternal(Span span) { Integer maxSpanDelay = dropSpansDelayedMinutes.get(); if (maxSpanDelay != null && span.getStartMillis() + span.getDuration() < Clock.now() - maxSpanDelay * 60 * 1000) { this.reject(span, "span is older than acceptable delay of " + maxSpanDelay + " minutes"); return; } validateSpan(span, validationConfig); final String strSpan = serializer.apply(span); getTask().add(strSpan); getReceivedCounter().inc(); if (validItemsLogger != null) validItemsLogger.info(strSpan); }

Target:
protected void reportInternal(Span span) { Integer maxSpanDelay = dropSpansDelayedMinutes.get(); if (maxSpanDelay != null && span.getStartMillis() + span.getDuration() < Clock.now() - TimeUnit.MINUTES.toMillis(maxSpanDelay)) { this.reject(span, "span is older than acceptable delay of " + maxSpanDelay + " minutes"); return; } validateSpan(span, validationConfig); final String strSpan = serializer.apply(span); getTask().add(strSpan); getReceivedCounter().inc(); if (validItemsLogger != null) validItemsLogger.info(strSpan); }
Source:
public com.alive_n_clickin.waft.application.IManager getManager() { return this.manager; }

Target:
public IManager getManager() { return this.manager; }
Source:
protected boolean isAsync() { if (QueryHelper.hasMatrixParam(getUriInfo(), ASYNC_CONSTRAINT)) { String value = QueryHelper.getMatrixConstraint(getUriInfo(), ASYNC_CONSTRAINT); if (value.equalsIgnoreCase(TRUE) || value.isEmpty()) { return true; } else if (value.equalsIgnoreCase(FALSE)) { return false; } else { throw new UrlParamException(this, null, "Illegal value '" + value + "' for matrix param: 'async'. Acceptable values are 'true' or 'false'"); } } return false; }

Target:
protected boolean isAsync() { String value = QueryHelper.getMatrixConstraint(getUriInfo(), ASYNC_CONSTRAINT); if (value == null) { return false; } else { if (value.equalsIgnoreCase(TRUE) || value.isEmpty()) { return true; } else if (value.equalsIgnoreCase(FALSE)) { return false; } else { throw new UrlParamException(this, null, "Illegal value '" + value + "' for matrix param: 'async'. Acceptable values are 'true' or 'false'"); } } }
Source:
List<UsagePriceOverride> getUsagePriceOverrides(PlanPhase curPhase, CatalogOverridePhaseDefinitionModelDao overriddenPhase, final InternalTenantContext context) { final List<UsagePriceOverride> usagePriceOverrides = new ArrayList<UsagePriceOverride>(); for(int i = 0; i < curPhase.getUsages().length; i++){ final Usage curUsage = curPhase.getUsages()[i]; final List<CatalogOverrideUsageDefinitionModelDao> usageDefs = overrideDao.getOverriddenPhaseUsages(overriddenPhase.getRecordId(), context); final CatalogOverrideUsageDefinitionModelDao overriddenUsage = Iterables.tryFind(usageDefs, new Predicate<CatalogOverrideUsageDefinitionModelDao>() { @Override public boolean apply(final CatalogOverrideUsageDefinitionModelDao input) { return input.getParentUsageName().equals(curUsage.getName()); } }).orNull(); if(overriddenUsage != null) { List<TierPriceOverride> tierPriceOverrides = getTierPriceOverrides(curUsage, overriddenUsage, context); usagePriceOverrides.add(new DefaultUsagePriceOverride(overriddenUsage.getParentUsageName(), curUsage.getUsageType(),tierPriceOverrides)); } else usagePriceOverrides.add(null); } return usagePriceOverrides; }

Target:
List<UsagePriceOverride> getUsagePriceOverrides(PlanPhase curPhase, CatalogOverridePhaseDefinitionModelDao overriddenPhase, final InternalTenantContext context) { final List<UsagePriceOverride> usagePriceOverrides = new ArrayList<UsagePriceOverride>(); final List<CatalogOverrideUsageDefinitionModelDao> usageDefs = overrideDao.getOverriddenPhaseUsages(overriddenPhase.getRecordId(), context); for(int i = 0; i < curPhase.getUsages().length; i++){ final Usage curUsage = curPhase.getUsages()[i]; final CatalogOverrideUsageDefinitionModelDao overriddenUsage = Iterables.tryFind(usageDefs, new Predicate<CatalogOverrideUsageDefinitionModelDao>() { @Override public boolean apply(final CatalogOverrideUsageDefinitionModelDao input) { return input.getParentUsageName().equals(curUsage.getName()); } }).orNull(); if(overriddenUsage != null) { List<TierPriceOverride> tierPriceOverrides = getTierPriceOverrides(curUsage, overriddenUsage, context); usagePriceOverrides.add(new DefaultUsagePriceOverride(overriddenUsage.getParentUsageName(), curUsage.getUsageType(),tierPriceOverrides)); } } return usagePriceOverrides; }
Source:
private GHRepository getRepository(String repositoryId) { GHRepository repository; try { repository = github.getRepository(repositoryId); } catch (IOException e) { LOG.info(gitUsername + ": Cannot retrieve the workflow from GitHub", e); throw new CustomWebApplicationException("Could not reach GitHub, please try again later", HttpStatus.SC_SERVICE_UNAVAILABLE); } return repository; }

Target:
private GHRepository getRepository(String repositoryId) { GHRepository repository; try { repository = github.getRepository(repositoryId); } catch (IOException e) { LOG.error(gitUsername + ": Cannot retrieve the workflow from GitHub", e); throw new CustomWebApplicationException("Could not reach GitHub, please try again later", HttpStatus.SC_SERVICE_UNAVAILABLE); } return repository; }
Source:
public static SSLContext getTrustContext(TrustManager trustManager) { try { if (contextAlreadyCreated.getAndSet(true)) { return sslContext; } TrustManager[] trustManagers = new TrustManager[] { trustManager }; sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, trustManagers, null); }catch(NoSuchAlgorithmException e) { throw new RemoteException("Unable to find suitable algorithm while attempting to communicate with remote server.", e); } catch(KeyManagementException e) { throw new RemoteException("An error occurred initializing SSL context due to a problem with key management.", e); } finally { return sslContext; } }

Target:
public static SSLContext getTrustContext(TrustManager trustManager) throws RemoteException { try { if (contextAlreadyCreated.getAndSet(true)) { return sslContext; } TrustManager[] trustManagers = new TrustManager[] { trustManager }; sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustManagers, null); }catch(NoSuchAlgorithmException e) { throw new RemoteException("Unable to find suitable algorithm while attempting to communicate with remote server.", e); } catch(KeyManagementException e) { throw new RemoteException("An error occurred initializing SSL context due to a problem with key management.", e); } return sslContext; }
Source:
public void testProcessWithReadonlyVariable() throws Exception { KieBase kbase = createKnowledgeBase("variable-tags/approval-with-readonly-variable-tags.bpmn2"); KieSession ksession = createKnowledgeSession(kbase); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); Map<String, Object> parameters = new HashMap<>(); parameters.put("approver", "john"); ProcessInstance processInstance = ksession.startProcess("approvals", parameters); assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE); WorkItem workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); assertThatExceptionOfType(VariableViolationException.class).isThrownBy(() -> ksession.getWorkItemManager().completeWorkItem(workItem.getId(), Collections.singletonMap("ActorId", "john"))); ksession.abortProcessInstance(processInstance.getId()); assertProcessInstanceFinished(processInstance, ksession); ksession.dispose(); }

Target:
public void testProcessWithReadonlyVariable() throws Exception { ksession = createSessionAndRegisterWorkItemHandler("variable-tags/approval-with-readonly-variable-tags.bpmn2"); Map<String, Object> parameters = new HashMap<>(); parameters.put("approver", "john"); ProcessInstance processInstance = ksession.startProcess("approvals", parameters); assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE); WorkItem workItem = workItemHandler.getWorkItem(); assertNotNull(workItem); assertThatExceptionOfType(VariableViolationException.class).isThrownBy(() -> ksession.getWorkItemManager().completeWorkItem(workItem.getId(), Collections.singletonMap("ActorId", "john"))); ksession.abortProcessInstance(processInstance.getId()); assertProcessInstanceFinished(processInstance, ksession); }
Source:
static Transition getTransitionByName(@Nonnull Iterable<Transition> transitions, String name) { for (Transition transition : transitions) { if (transition.getName().equals(name)) { return transition; } } return null; }

Target:
static Transition getTransitionByName(@Nonnull Iterable<Transition> transitions, String name) { for (Transition transition : transitions) { if (transition.getName().equalsIgnoreCase(name)) { return transition; } } return null; }
Source:
public static Pair<BigDecimal, String> getNumberAndUnitFromString(String attributeValue) { String numberString = null; String unit = null; if (attributeValue != null) { Matcher numberMatcher = numberPattern.matcher(attributeValue); Matcher letterMatcher = letterPattern.matcher(attributeValue); numberMatcher.find(); letterMatcher.find(); try { numberString = attributeValue.substring(numberMatcher.start(), numberMatcher.end()); } catch (IllegalStateException ex) { numberString = null; } try { unit = attributeValue.substring(letterMatcher.start(), letterMatcher.end()); } catch (IllegalStateException ex) { unit = "G"; } } BigDecimal number; if(numberString != null) number = new BigDecimal(numberString.replace(',', '.')); else number = new BigDecimal("0"); return new Pair<>(number, unit); }

Target:
public static Pair<BigDecimal, String> getNumberAndUnitFromString(String attributeValue) { String numberString = "0"; String unit = "G"; if (attributeValue != null) { Matcher numberMatcher = numberPattern.matcher(attributeValue); Matcher letterMatcher = letterPattern.matcher(attributeValue); numberMatcher.find(); letterMatcher.find(); try { numberString = attributeValue.substring(numberMatcher.start(), numberMatcher.end()); } catch (IllegalStateException ex) { log.debug("No number could be parsed from given string.", ex); } try { unit = attributeValue.substring(letterMatcher.start(), letterMatcher.end()); } catch (IllegalStateException ex) { log.debug("No unit could be parsed from given string.", ex); } } BigDecimal number = new BigDecimal(numberString.replace(',', '.')); return new Pair<>(number, unit); }
Source:
private boolean userEnteredCommmitMessage() { if (commitMessageComponent.getRepository() == null) return false; String message = commitMessageComponent.getCommitMessage().replace(UIText.StagingView_headCommitChanged, ""); if (message == null || message.trim().length() == 0) return false; if(commitMessageComponent.getCreateChangeId() && message.trim().equals("Change-Id: I" + ObjectId.zeroId().name())) return false; return true; }

Target:
private boolean userEnteredCommmitMessage() { if (commitMessageComponent.getRepository() == null) return false; String message = commitMessageComponent.getCommitMessage().replace( UIText.StagingView_headCommitChanged, ""); if (message == null || message.trim().length() == 0) return false; String chIdLine = "Change-Id: I" + ObjectId.zeroId().name(); if (currentRepository.getConfig().getBoolean( ConfigConstants.CONFIG_GERRIT_SECTION, ConfigConstants.CONFIG_KEY_CREATECHANGEID, false) && commitMessageComponent.getCreateChangeId()) { if (message.trim().equals(chIdLine)) return false; message = message.replace(chIdLine, ""); } if (org.eclipse.egit.ui.Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.COMMIT_DIALOG_SIGNED_OFF_BY) && commitMessageComponent.isSignedOff() && message.trim().equals( Constants.SIGNED_OFF_BY_TAG + commitMessageComponent.getCommitter())) return false; return true; }
Source:
private MergeQuantileDigestFunction() { super(NAME, QDIGEST, StatisticalDigestStateFactory.createQuantileDigestFactory()); }

Target:
private MergeQuantileDigestFunction() { super(NAME, QDIGEST, createQuantileDigestFactory(), false); }
Source:
public String prepareBulkLoad(final byte[] family, final String srcPath, boolean copyFile) throws IOException { Path p = new Path(srcPath); Path stageP = new Path(stagingDir, new Path(Bytes.toString(family), p.getName())); if (p.equals(stageP)) { LOG.debug(p.getName() + " is already available in staging directory. Skipping copy or rename."); return stageP.toString(); } if (srcFs == null) { srcFs = FileSystem.newInstance(p.toUri(), conf); } if(!isFile(p)) { throw new IOException("Path does not reference a file: " + p); } try { if (!FSUtils.isSameHdfs(conf, srcFs, fs)) { LOG.debug("Bulk-load file " + srcPath + " is on different filesystem than " + "the destination filesystem. Copying file over to destination staging dir."); FileUtil.copy(srcFs, p, fs, stageP, false, conf); } else if (copyFile) { LOG.debug("Bulk-load file " + srcPath + " is copied to destination staging dir."); FileUtil.copy(srcFs, p, fs, stageP, false, conf); } else { LOG.debug("Moving " + p + " to " + stageP); FileStatus origFileStatus = fs.getFileStatus(p); origPermissions.put(srcPath, origFileStatus.getPermission()); if(!fs.rename(p, stageP)) { throw new IOException("Failed to move HFile: " + p + " to " + stageP); } } }catch (Throwable t){ throw new IOException("Failed to prepare bulk load for path " + srcPath, t); } fs.setPermission(stageP, PERM_ALL_ACCESS); return stageP.toString(); }

Target:
public String prepareBulkLoad(final byte[] family, final String srcPath, boolean copyFile) throws IOException { Path p = new Path(srcPath); Path stageP = new Path(stagingDir, new Path(Bytes.toString(family), p.getName())); if (p.equals(stageP)) { LOG.debug(p.getName() + " is already available in staging directory. Skipping copy or rename."); return stageP.toString(); } if (srcFs == null) { srcFs = FileSystem.newInstance(p.toUri(), conf); } if(!isFile(p)) { throw new IOException("Path does not reference a file: " + p); } if (!FSUtils.isSameHdfs(conf, srcFs, fs)) { LOG.debug("Bulk-load file " + srcPath + " is on different filesystem than " + "the destination filesystem. Copying file over to destination staging dir."); FileUtil.copy(srcFs, p, fs, stageP, false, conf); } else if (copyFile) { LOG.debug("Bulk-load file " + srcPath + " is copied to destination staging dir."); FileUtil.copy(srcFs, p, fs, stageP, false, conf); } else { LOG.debug("Moving " + p + " to " + stageP); FileStatus origFileStatus = fs.getFileStatus(p); origPermissions.put(srcPath, origFileStatus.getPermission()); if(!fs.rename(p, stageP)) { throw new IOException("Failed to move HFile: " + p + " to " + stageP); } } fs.setPermission(stageP, PERM_ALL_ACCESS); return stageP.toString(); }
Source:
private File getExistingItunesDirectory(File[] files) { File existingDir = null; for (File file : files) { if (file.isDirectory() && file.getName().startsWith("itunes") && file.getName().matches("itunes\\d{8}")) { existingDir = file; } } return existingDir; }

Target:
private Optional<File> getExistingItunesDirectory(File[] files) { File existingDir = null; for (File file : files) { if (file.isDirectory() && file.getName().startsWith("itunes") && file.getName().matches("itunes\\d{8}")) { existingDir = file; } } return Optional.ofNullable(existingDir); }
Source:
private void matchNestedFile(Path file, List<Path> texFiles, List<Path> referencedFiles, String line) { Matcher includeMatch = Pattern.compile(INCLUDE_REGEX).matcher(line); while (includeMatch.find()) { String include = includeMatch.group("file"); if (!include.endsWith(".tex")) { include += ".tex"; } Path folder = file.getParent(); Path inputFile = (folder != null) ? folder.resolve(include) : Paths.get(include); if (!texFiles.contains(inputFile)) { referencedFiles.add(inputFile); } } }

Target:
private void matchNestedFile(Path file, List<Path> texFiles, List<Path> referencedFiles, String line) { Matcher includeMatch = INCLUDE_PATTERN.matcher(line); StringBuilder include; while (includeMatch.find()) { include = new StringBuilder(includeMatch.group(INCLUDE_GROUP)); if (!include.toString().endsWith(TEX_EXT)) { include.append(TEX_EXT); } Path folder = file.getParent(); Path inputFile = (folder == null) ? Paths.get(include.toString()) : folder.resolve(include.toString()); if (!texFiles.contains(inputFile)) { referencedFiles.add(inputFile); } } }
Source:
public Map<String, String[]> getFullParameters() { if (fullParameters == null) { return Collections.emptyMap(); } return fullParameters; }

Target:
public Map<String, String> getFullParameters() { return getFilteringParameters(); }
Source:
private void setMetadataCreator(DepositMetadata depositMetadata, Workflow workflow) { String wfAuthor = workflow.getAuthor(); String authorStr = (wfAuthor == null || wfAuthor.isEmpty()) ? "n/a" : workflow.getAuthor(); Author author = new Author(); author.setName(authorStr); depositMetadata.setCreators(Arrays.asList(author)); }

Target:
private void setMetadataCreator(DepositMetadata depositMetadata, Workflow workflow) { String wfAuthor = workflow.getAuthor(); String authorStr = (wfAuthor == null || wfAuthor.isEmpty()) ? "unknown creator" : workflow.getAuthor(); Author author = new Author(); author.setName(authorStr); depositMetadata.setCreators(Arrays.asList(author)); }
Source:
public EventJobFactory getJobFactory() { try { return jobFactoryClass.newInstance(); } catch (ReflectiveOperationException e) { throw new NuxeoException("Failed to instantiate job factory " + jobFactoryClass, e); } }

Target:
public EventJobFactory getJobFactory() { try { return jobFactoryClass.getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new NuxeoException("Failed to instantiate job factory " + jobFactoryClass, e); } }
Source:
public void configReferenceValidated() { ConfigReference ref1 = new ConfigReference("id:1", 1L); ConfigReference ref2 = new ConfigReference("id:2", 2L); when(appConfigElementService.getElementRevision(any(), any(), anyLong())).thenReturn(AppConfigElement.create()); List<ConfigReference> references = ImmutableList.of(ref1, ref2); appConfig.setConfigReferences(references); assertValidatorMessage(newValidator, appConfig, "criteria", "are required"); }

Target:
public void configReferenceValidated() { ConfigReference ref1 = new ConfigReference("id:1", 1L); ConfigReference ref2 = new ConfigReference("id:2", 2L); when(appConfigElementService.getElementRevision(any(), any(), anyLong())).thenReturn(AppConfigElement.create()); List<ConfigReference> references = ImmutableList.of(ref1, ref2); appConfig.setConfigReferences(references); appConfig.setLabel("label"); appConfig.setCriteria(Criteria.create()); Validate.entityThrowingException(newValidator, appConfig); }
Source:
public Set<List<Integer>> getAliveExecutors(String topoId, Set<List<Integer>> allExecutors, Assignment assignment, int taskLaunchSecs) { Map<List<Integer>, ExecutorCache> topoCache = cache.computeIfAbsent(topoId, MAKE_MAP); LOG.debug("Computing alive executors for {}\nExecutors: {}\nAssignment: {}\nHeartbeat cache: {}", topoId, allExecutors, assignment, topoCache); Set<List<Integer>> ret = new HashSet<>(); Map<List<Long>, Long> execToStartTimes = assignment.get_executor_start_time_secs(); for (List<Integer> exec : allExecutors) { List<Long> longExec = new ArrayList<>(exec.size()); for (Integer num : exec) { longExec.add(num.longValue()); } Long startTime = execToStartTimes.get(longExec); ExecutorCache executorCache = topoCache.get(exec); Boolean isTimedOut = executorCache == null ? null : executorCache.isTimedOut(); Integer delta = startTime == null ? null : Time.deltaSecs(startTime.intValue()); if (startTime != null && ((delta < taskLaunchSecs) || (isTimedOut != null && !isTimedOut))) { ret.add(exec); } else { LOG.info("Executor {}:{} not alive", topoId, exec); } } return ret; }

Target:
public Set<List<Integer>> getAliveExecutors(String topoId, Set<List<Integer>> allExecutors, Assignment assignment, int taskLaunchSecs) { Map<List<Integer>, ExecutorCache> topoCache = cache.computeIfAbsent(topoId, MAKE_MAP); LOG.debug("Computing alive executors for {}\nExecutors: {}\nAssignment: {}\nHeartbeat cache: {}", topoId, allExecutors, assignment, topoCache); Set<List<Integer>> ret = new HashSet<>(); Map<List<Long>, Long> execToStartTimes = assignment.get_executor_start_time_secs(); for (List<Integer> exec : allExecutors) { List<Long> longExec = new ArrayList<>(exec.size()); for (Integer num : exec) { longExec.add(num.longValue()); } Long startTime = execToStartTimes.get(longExec); ExecutorCache executorCache = topoCache.get(exec); boolean isTimedOut = executorCache == null ? true : executorCache.isTimedOut(); Integer delta = startTime == null ? null : Time.deltaSecs(startTime.intValue()); if (startTime != null && ((delta < taskLaunchSecs) || !isTimedOut)) { ret.add(exec); } else { LOG.info("Executor {}:{} not alive", topoId, exec); } } return ret; }
Source:
public void changingMaxWorkersMeetsConcurrencyGoalsTest() throws InterruptedException, TimeoutException { final int numBusyWorkers = 2; SharedExecutorPool sharedPool = new SharedExecutorPool("ChangingMaxWorkersMeetsConcurrencyGoalsTest"); final AtomicInteger notifiedMaxPoolSize = new AtomicInteger(); LocalAwareExecutorService executor = sharedPool.newExecutor(0, notifiedMaxPoolSize::set, 4, "internal", "resizetest"); AtomicBoolean stayBusy = new AtomicBoolean(true); Semaphore busyWorkerPermits = new Semaphore(numBusyWorkers); Thread makeBusy = new Thread(() -> { while (stayBusy.get() == true) { try { if (busyWorkerPermits.tryAcquire(1, MILLISECONDS)) { executor.execute(new BusyWork(busyWorkerPermits)); } } catch (InterruptedException e) { } } }); makeBusy.start(); try { for (int repeat = 0; repeat < 1000; repeat++) { assertMaxTaskConcurrency(executor, 1); Assert.assertEquals(1, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 2); Assert.assertEquals(2, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 1); Assert.assertEquals(1, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 3); Assert.assertEquals(3, notifiedMaxPoolSize.get()); executor.setMaximumPoolSize(0); Assert.assertEquals(0, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 4); Assert.assertEquals(4, notifiedMaxPoolSize.get()); } } finally { stayBusy.set(false); makeBusy.join(TimeUnit.SECONDS.toNanos(5)); Assert.assertFalse(makeBusy.isAlive()); sharedPool.shutdownAndWait(1L, MINUTES); } }

Target:
public void changingMaxWorkersMeetsConcurrencyGoalsTest() throws InterruptedException, TimeoutException { final int numBusyWorkers = 2; SharedExecutorPool sharedPool = new SharedExecutorPool("ChangingMaxWorkersMeetsConcurrencyGoalsTest"); final AtomicInteger notifiedMaxPoolSize = new AtomicInteger(); LocalAwareExecutorService executor = sharedPool.newExecutor(0, notifiedMaxPoolSize::set, 4, "internal", "resizetest"); AtomicBoolean stayBusy = new AtomicBoolean(true); Semaphore busyWorkerPermits = new Semaphore(numBusyWorkers); Thread makeBusy = new Thread(() -> { while (stayBusy.get() == true) { try { if (busyWorkerPermits.tryAcquire(1, MILLISECONDS)) { executor.execute(new BusyWork(busyWorkerPermits)); } } catch (InterruptedException e) { } } }); makeBusy.start(); try { for (int repeat = 0; repeat < 1000; repeat++) { assertMaxTaskConcurrency(executor, 1); Assert.assertEquals(1, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 2); Assert.assertEquals(2, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 1); Assert.assertEquals(1, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 3); Assert.assertEquals(3, notifiedMaxPoolSize.get()); executor.setMaximumPoolSize(0); Assert.assertEquals(0, notifiedMaxPoolSize.get()); assertMaxTaskConcurrency(executor, 4); Assert.assertEquals(4, notifiedMaxPoolSize.get()); } } finally { stayBusy.set(false); makeBusy.join(TimeUnit.SECONDS.toMillis(5)); Assert.assertFalse("makeBusy thread should have checked stayBusy and exited", makeBusy.isAlive()); sharedPool.shutdownAndWait(1L, MINUTES); } }
Source:
public void loadVisitors() { if (!plugins.isEmpty()) { return; } PropertyBasedPluginLocator<DAGSetupPlugin> locator = new PropertyBasedPluginLocator<>(DAGSetupPlugin.class, DAGSETUP_PLUGINS_CONF_KEY); this.plugins.addAll(locator.discoverPlugins(conf)); }

Target:
private void loadVisitors() { if (!plugins.isEmpty()) { return; } PropertyBasedPluginLocator<DAGSetupPlugin> locator = new PropertyBasedPluginLocator<>(DAGSetupPlugin.class, DAGSETUP_PLUGINS_CONF_KEY); this.plugins.addAll(locator.discoverPlugins(conf)); }
Source:
public void annotationToFieldsReturnsUnmodifiableMap() { exception.expect(UnsupportedOperationException.class); TestClass tc = new TestClass(FieldAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkField>> annotationToFields = tc.getAnnotationToFields(); annotationToFields.put(Rule.class, null); }

Target:
public void annotationToFieldsReturnsUnmodifiableMap() { TestClass tc = new TestClass(FieldAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkField>> annotationToFields = tc.getAnnotationToFields(); exception.expect(UnsupportedOperationException.class); annotationToFields.put(Rule.class, null); }
Source:
private static List<StartIdentifiedAtlasDbTransactionResponse> startTransactions( LockLeaseService lockLeaseService, int numberOfTransactions) { List<StartIdentifiedAtlasDbTransactionResponse> result = new ArrayList<>(); while (result.size() < numberOfTransactions) { result.addAll(split(lockLeaseService.startTransactions(numberOfTransactions - result.size()))); } return result.subList(0, numberOfTransactions); }

Target:
private static List<StartIdentifiedAtlasDbTransactionResponse> startTransactions( LockLeaseService lockLeaseService, int numberOfTransactions) { List<StartIdentifiedAtlasDbTransactionResponse> result = new ArrayList<>(); while (result.size() < numberOfTransactions) { result.addAll(split(lockLeaseService.startTransactions(numberOfTransactions - result.size()))); } return result; }
Source:
private static Method findEquivalentMethod(Class<?> clazz, Method method) { Method[] candidates = clazz.getDeclaredMethods(); for (Method candidate : candidates) { if (candidate.getName().equals(method.getName()) && Arrays.equals( candidate.getParameterTypes(), method.getParameterTypes())) { return candidate; } } return null; }

Target:
private static Method findEquivalentMethod(Class<?> clazz, Method method) { Method[] candidates = clazz.getDeclaredMethods(); for (Method candidate : candidates) { if (candidate.getName().equals(method.getName()) && candidate.getParameterCount() == method.getParameterCount() && Arrays.equals(candidate.getParameterTypes(), method.getParameterTypes())) { return candidate; } } return null; }
Source:
private String formatTimeForId(Instant instant) { return formatter.format( TimeHelper.convertInstantToLocalDateTime(instant, Const.SystemParams.ADMIN_TIME_ZONE)); }

Target:
private static String formatTimeForId(Instant instant) { return FORMATTER.format(TimeHelper.convertInstantToLocalDateTime(instant, Const.SystemParams.ADMIN_TIME_ZONE)); }
Source:
private boolean buildAndTag() throws MacroEvaluationException, IOException, InterruptedException { File context = new File(defined(getBuildContext()) ? getBuildContext() : "."); Iterator<String> i = getNameAndTag().iterator(); Result lastResult = new Result(); if (i.hasNext()) { lastResult = executeCmd("docker build -t " + i.next() + ((isNoCache()) ? " --no-cache=true " : "") + " " + ((isForcePull()) ? " --pull=true " : "") + " " + (defined(getDockerfilePath()) ? " --file=" + new File(context, getDockerfilePath()) : "") + " " + context); } String image = getImageBuiltFromStdout(lastResult.stdout); if (image != null) { while (lastResult.result && i.hasNext()) { lastResult = executeCmd("docker tag --force=true " + image + " " + i.next()); } processFingerprints(image); } else { while (lastResult.result && i.hasNext()) { lastResult = executeCmd("docker build -t " + i.next() + ((isNoCache()) ? " --no-cache=true " : "") + " " + ((isForcePull()) ? " --pull=true " : "") + " " + (defined(getDockerfilePath()) ? " --file=" + new File(context, getDockerfilePath()) : "") + " " + context); processFingerprintsFromStdout(lastResult.stdout); } } return lastResult.result; }

Target:
private boolean buildAndTag() throws MacroEvaluationException, IOException, InterruptedException { FilePath context = defined(getBuildContext()) ? new FilePath(new File(getBuildContext())) : build.getWorkspace(); Iterator<String> i = getNameAndTag().iterator(); Result lastResult = new Result(); if (i.hasNext()) { lastResult = executeCmd("docker build -t " + i.next() + ((isNoCache()) ? " --no-cache=true " : "") + " " + ((isForcePull()) ? " --pull=true " : "") + " " + (defined(getDockerfilePath()) ? " --file=" + getDockerfilePath() : "") + " " + context); } String image = getImageBuiltFromStdout(lastResult.stdout); if (image != null) { while (lastResult.result && i.hasNext()) { lastResult = executeCmd("docker tag --force=true " + image + " " + i.next()); } processFingerprints(image); } else { while (lastResult.result && i.hasNext()) { lastResult = executeCmd("docker build -t " + i.next() + ((isNoCache()) ? " --no-cache=true " : "") + " " + ((isForcePull()) ? " --pull=true " : "") + " " + (defined(getDockerfilePath()) ? " --file=" + getDockerfilePath() : "") + " " + context); processFingerprintsFromStdout(lastResult.stdout); } } return lastResult.result; }
Source:
private void testReadWithHeader() throws IOException { File file = makeFile(); DataFileReader<Object> reader = new DataFileReader<>(file, new GenericDatumReader<>()); DataFileStream.Header header = reader.getHeader(); SeekableFileInput sin = new SeekableFileInput(file); sin.seek(sin.length() / 2); reader = DataFileReader.openReader(sin, new GenericDatumReader<>(), header, true); assertNotNull("Should be able to reopen from arbitrary point", reader.next()); long validPos = reader.previousSync(); sin.seek(validPos); reader = DataFileReader.openReader(sin, new GenericDatumReader<>(), header, false); assertEquals("Should not move from sync point on reopen", validPos, sin.tell()); assertNotNull("Should be able to reopen at sync point", reader.next()); reader.close(); }

Target:
private void testReadWithHeader() throws IOException { File file = makeFile(); try (DataFileReader<Object> reader = new DataFileReader<>(file, new GenericDatumReader<>())) { DataFileStream.Header header = reader.getHeader(); SeekableFileInput sin = new SeekableFileInput(file); sin.seek(sin.length() / 2); try (DataFileReader<Object> readerTrue = DataFileReader.openReader(sin, new GenericDatumReader<>(), header, true);) { assertNotNull("Should be able to reopen from arbitrary point", readerTrue.next()); long validPos = readerTrue.previousSync(); sin.seek(validPos); try (DataFileReader<Object> readerFalse = DataFileReader.openReader(sin, new GenericDatumReader<>(), header, false)) { assertEquals("Should not move from sync point on reopen", validPos, sin.tell()); assertNotNull("Should be able to reopen at sync point", readerFalse.next()); } } } }
Source:
public float getRegenerationTimerStart() { return this.REGEN_TIMER_START; }

Target:
public float getRegenerationTimerStart() { return regenTimerStart > 0 ? regenTimerStart : TIMER_START; }
Source:
public Group groupUnion(PerunSession sess, Group resultGroup, Group operandGroup) throws InternalErrorException, WrongReferenceAttributeValueException, NotMemberOfParentGroupException, AlreadyMemberException, WrongAttributeValueException, GroupNotExistsException, NotGroupMemberException { if(resultGroup.getName().equals(VosManager.MEMBERS_GROUP) || operandGroup.getName().equals(VosManager.MEMBERS_GROUP)) { throw new InternalErrorException("Union cannot be created on members group."); } if (resultGroup.getVoId() != operandGroup.getVoId()) { throw new InternalErrorException("Groups are not from same VO"); } if (resultGroup.getId() == operandGroup.getId()) { throw new InternalErrorException("Result group cannot be the same as operand group."); } if (this.groupsManagerImpl.isRelationBetweenGroups(resultGroup, operandGroup)) { throw new InternalErrorException("There is already an operation defined between these two groups: " + resultGroup + " and " + operandGroup); } if (areGroupsTransitive(sess, resultGroup.getId(), operandGroup.getId())) { throw new InternalErrorException("This relation would create group transitivity."); } processRelationMembers(sess, resultGroup, getGroupMembers(sess, operandGroup), operandGroup.getId(), OPERATION_UNION, true); groupsManagerImpl.saveGroupRelation(sess, resultGroup, operandGroup, OPERATION_UNION); return resultGroup; }

Target:
public Group groupUnion(PerunSession sess, Group resultGroup, Group operandGroup) throws GroupOperationsException, InternalErrorException { if(resultGroup.getName().equals(VosManager.MEMBERS_GROUP) || operandGroup.getName().equals(VosManager.MEMBERS_GROUP)) { throw new InternalErrorException("Union cannot be created on members group."); } if (resultGroup.getVoId() != operandGroup.getVoId()) { throw new InternalErrorException("Groups are not from same VO"); } if (resultGroup.getId() == operandGroup.getId()) { throw new InternalErrorException("Result group cannot be the same as operand group."); } if (this.groupsManagerImpl.isRelationBetweenGroups(resultGroup, operandGroup)) { throw new InternalErrorException("There is already an operation defined between these two groups: " + resultGroup + " and " + operandGroup); } if (checkGroupsCycle(sess, resultGroup.getId(), operandGroup.getId())) { throw new InternalErrorException("This relation would create group transitivity."); } groupsManagerImpl.saveGroupRelation(sess, resultGroup, operandGroup, GroupOperations.UNION); processRelationMembers(sess, resultGroup, getGroupActiveMembers(sess, operandGroup), operandGroup.getId(), GroupOperations.UNION, true); return resultGroup; }
Source:
private Account(JSONObject metadata) throws JSONException { if (metadata == null) { throw new IllegalArgumentException("metadata cannot be null."); } short metadataVersion = (short) metadata.getInt(JSON_VERSION_KEY); if (metadataVersion == JSON_VERSION_1) { id = (short) metadata.getInt(ACCOUNT_ID_KEY); name = metadata.getString(ACCOUNT_NAME_KEY); status = AccountStatus.valueOf(metadata.getString(STATUS_KEY)); snapshotVersion = metadata.optInt(SNAPSHOT_VERSION_KEY, SNAPSHOT_VERSION_DEFAULT_VALUE); lastModifiedTime = metadata.optLong(LAST_MODIFIED_TIME_KEY, LAST_MODIFIED_TIME_DEFAULT_VALUE); checkRequiredFieldsForBuild(); JSONArray containerArray = metadata.optJSONArray(CONTAINERS_KEY); if (containerArray != null) { for (int index = 0; index < containerArray.length(); index++) { Container container = Container.fromJson(containerArray.getJSONObject(index), id); checkParentAccountIdInContainers(container); checkDuplicateContainerNameOrId(container); updateContainerMap(container); } } } else { throw new IllegalStateException("Unsupported account json version=" + metadataVersion); } }

Target:
private Account(JSONObject metadata) throws JSONException { if (metadata == null) { throw new IllegalArgumentException("metadata cannot be null."); } short metadataVersion = (short) metadata.getInt(JSON_VERSION_KEY); switch (metadataVersion) { case JSON_VERSION_1: id = (short) metadata.getInt(ACCOUNT_ID_KEY); name = metadata.getString(ACCOUNT_NAME_KEY); status = AccountStatus.valueOf(metadata.getString(STATUS_KEY)); snapshotVersion = metadata.optInt(SNAPSHOT_VERSION_KEY, SNAPSHOT_VERSION_DEFAULT_VALUE); lastModifiedTime = metadata.optLong(LAST_MODIFIED_TIME_KEY, LAST_MODIFIED_TIME_DEFAULT_VALUE); checkRequiredFieldsForBuild(); JSONArray containerArray = metadata.optJSONArray(CONTAINERS_KEY); if (containerArray != null) { List<Container> containers = new ArrayList<>(); for (int index = 0; index < containerArray.length(); index++) { containers.add(Container.fromJson(containerArray.getJSONObject(index), id)); } updateContainerMap(containers); } break; default: throw new IllegalStateException("Unsupported account json version=" + metadataVersion); } }
Source:
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { try { if (ctx.isInTxScope() && command.hasFlag(Flag.FORCE_WRITE_LOCK) && !hasSkipLocking(command)) { acquireRemoteIfNeeded(ctx, command.getKeys(), command); final TxInvocationContext txContext = (TxInvocationContext) ctx; long lockTimeout = getLockAcquisitionTimeout(command, false); for (Object key : command.getKeys()) { lockAndRegisterBackupLock(txContext, key, lockTimeout, false); } } return invokeNextInterceptor(ctx, command); } catch (Throwable t) { releaseLocksOnFailureBeforePrepare(ctx); throw t; } finally { if (!ctx.isInTxScope()) lockManager.unlockAll(ctx); } }

Target:
public Object visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { try { if (ctx.isInTxScope() && command.hasFlag(Flag.FORCE_WRITE_LOCK) && !hasSkipLocking(command)) { acquireRemoteIfNeeded(ctx, command.getKeys(), command); final TxInvocationContext txContext = (TxInvocationContext) ctx; long lockTimeout = getLockAcquisitionTimeout(command, false); for (Object key : command.getKeys()) { lockAndRegisterBackupLock(txContext, key, lockTimeout, false); } } return invokeNextInterceptor(ctx, command); } catch (Throwable t) { releaseLocksOnFailureBeforePrepare(ctx); throw t; } }
Source:
public void validate(Object obj, Errors err) { ValidationUtils.rejectIfEmptyOrWhitespace(err, "title", "about_title.required"); ValidationUtils.rejectIfEmptyOrWhitespace(err, "description", "about_description.required"); }

Target:
public void validate(Object obj, Errors err) { IAboutText abtText = (IAboutText) obj; String description = abtText.getDescription(); String title = abtText.getTitle(); Whitelist whitelist = Whitelist.basicWithImages(); Whitelist titleWhitelist = Whitelist.simpleText(); ValidationUtils.rejectIfEmptyOrWhitespace(err, "title", "about_title.required"); ValidationUtils.rejectIfEmptyOrWhitespace(err, "description", "about_description.required"); if (!Jsoup.isValid(description, whitelist)) { err.rejectValue("description", "about_description.proper"); } if (!Jsoup.isValid(title, titleWhitelist)) { err.rejectValue("title", "about_title.proper"); } }
Source:
private IAction createFlatAction() { IAction action = new Action(Messages.ControlFlowView_flatViewLabel, IAction.AS_RADIO_BUTTON) { @Override public void run() { if (!fIsFlatViewClicked) { setTraceEntryChildren(fFlatList); fIsFlatViewClicked = true; } } }; action.setToolTipText(Messages.ControlFlowView_flatViewToolTip); action.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(IControlflowImageConstants.IMG_UI_FLAT_VIEW)); return action; }

Target:
private IAction createFlatAction() { IAction action = new Action(Messages.ControlFlowView_flatViewLabel, IAction.AS_RADIO_BUTTON) { @Override public void run() { if (!fIsFlatViewClicked) { ITmfTrace parentTrace = getTrace(); for (ITmfTrace trace : TmfTraceManager.getTraceSet(parentTrace)) { final ITmfStateSystem ss = TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID); List<TimeGraphEntry> currentRootList = getEntryList(ss); addEntriesToFlatTree(currentRootList, parentTrace, ss); } fIsFlatViewClicked = true; refresh(); } } }; action.setToolTipText(Messages.ControlFlowView_flatViewToolTip); action.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(IControlflowImageConstants.IMG_UI_FLAT_VIEW)); return action; }
Source:
public String toString() { if (extractionFn != null) { return StringUtils.format("%s(%s) = %s", extractionFn, dimension, hash.toString()); } else { return StringUtils.format("%s = %s", dimension, hash.toString()); } }

Target:
public String toString() { return new DimFilterToStringBuilder().appendDimension(dimension, extractionFn) .appendEquals(hash.toString()) .appendFilterTuning(filterTuning) .build(); }
Source:
private static BiConsumer<MergingCompletableFuture<Object>, Object> moveListItemsToFuture(int myOffset) { return (f, rv) -> { if (rv instanceof List) { List list = (List) rv; if (trace) { log.tracef("Copying %d items %s to results (%s), starting offset %d", list.size(), list, Arrays.toString(f.results), myOffset); } for (int i = 0; i < list.size(); ++i) { f.results[myOffset + i] = list.get(i); } } else if (rv != null || f.results != null) { f.completeExceptionally(new IllegalArgumentException("Unexpected result value " + rv)); } }; }

Target:
private static BiConsumer<MergingCompletableFuture<Object>, Object> moveListItemsToFuture(int myOffset) { return (f, rv) -> { Collection<?> items; if (rv == null && f.results == null) { return; } else if (rv instanceof Map) { items = ((Map) rv).entrySet(); } else if (rv instanceof Collection) { items = (Collection<?>) rv; } else { f.completeExceptionally(new IllegalArgumentException("Unexpected result value " + rv)); return; } if (trace) { log.tracef("Copying %d items %s to results (%s), starting offset %d", items.size(), items, Arrays.toString(f.results), myOffset); } Iterator<?> it = items.iterator(); for (int i = 0; it.hasNext(); ++i) { f.results[myOffset + i] = it.next(); } }; }
Source:
public synchronized Long size() { final File file = path.toFile(); Long size = (file.exists() && !file.isDirectory()) ? file.length() : 0l; if (childSize < 0l || childModCount > lastSizeCheck) { Long childSize = 0l; lastSizeCheck = childModCount; for (FileCopyResult child : children) { childSize += child.size(); } this.childSize = childSize; } size += childSize; return size; }

Target:
public long size() { return size; }
Source:
public void onBindViewHolder(@NonNull SettingsViewHolder holder, int position) { holder.mTitle.setText(mItems.get(position).getTitle()); if (position==0){ holder.mRowLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(v.getContext() , LogsActivity.class); v.getContext().startActivity(i); } }); } if(position == 2){ holder.mRowLayout.setOnClickListener(view -> { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(view.getContext().getString(R.string.url_privacy_policy))); view.getContext().startActivity(i); }); } if (mItems.get(position).getDesc1() != null) { holder.mDesc1.setText(mItems.get(position).getDesc1()); } if (mItems.get(position).getDesc2() != null) { holder.mDesc2.setText(mItems.get(position).getDesc2()); } if (mItems.get(position).getDesc1() == null && mItems.get(position).getDesc2() == null) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) holder.mTitle.getLayoutParams(); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); holder.mTitle.setLayoutParams(layoutParams); } }

Target:
public void onBindViewHolder(@NonNull SettingsViewHolder holder, int position) { holder.mTitle.setText(mItems.get(position).getTitle()); if (position == 0) { holder.mRowLayout.setOnClickListener(view -> { Intent i = new Intent(view.getContext(), LogsActivity.class); view.getContext().startActivity(i); }); } if (position == 2) { holder.mRowLayout.setOnClickListener(view -> { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(view.getContext().getString(R.string.url_privacy_policy))); view.getContext().startActivity(i); }); } if (mItems.get(position).getDesc1() != null) { holder.mDesc1.setText(mItems.get(position).getDesc1()); } if (mItems.get(position).getDesc2() != null) { holder.mDesc2.setText(mItems.get(position).getDesc2()); } if (mItems.get(position).getDesc1() == null && mItems.get(position).getDesc2() == null) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) holder.mTitle.getLayoutParams(); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); holder.mTitle.setLayoutParams(layoutParams); } }
Source:
public static PDataType fromLiteral(Object value) { if (value == null) { return null; } for (PDataType type : PDataType.values()) { if (type.isArrayType() && type.getJavaClass().isInstance(value)) { PhoenixArray arr = (PhoenixArray) value; if ((type.getSqlType() == arr.baseType.sqlType + PDataType.ARRAY_TYPE_BASE)) { return type; } } else { if (type.getJavaClass().isInstance(value)) { return type; } } } throw new UnsupportedOperationException( "Unsupported literal value [" + value + "] of type " + value.getClass().getName()); }

Target:
public static PDataType fromLiteral(Object value) { if (value == null) { return null; } for (PDataType type : PDataType.values()) { if(type.getJavaClass().isInstance(value)){ if (type.isArrayType()) { PhoenixArray arr = (PhoenixArray) value; if ((type.getSqlType() == arr.baseType.sqlType + PDataType.ARRAY_TYPE_BASE)) { return type; } } else { return type; } } } throw new UnsupportedOperationException( "Unsupported literal value [" + value + "] of type " + value.getClass().getName()); }
Source:
public void heartbeat(Event event) { long now = System.currentTimeMillis(); LOG.debug("Heartbeat from mesos. Delta since last heartbeat is {}ms", now - lastHeartbeatTime.getAndSet(now)); }

Target:
public void heartbeat(Event event) { long now = System.currentTimeMillis(); long delta = (now - lastHeartbeatTime.getAndSet(now)); LOG.debug("Heartbeat from mesos. Delta since last heartbeat is {}ms", delta); }