auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void canLoadFeedWithErrors () { PersistenceExpectation[] expectations = PersistenceExpectation.list(); ErrorExpectation[] errorExpectations = ErrorExpectation.list( new ErrorExpectation(NewGTFSErrorType.FARE_TRANSFER_MISMATCH, "fare-02"), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, "freq-01_09:00:00_to_10:00:00_every_10m00s"), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, "freq-01_09:30:00_to_10:30:00_every_15m00s"), new ErrorExpectation(NewGTFSErrorType.TRIP_OVERLAP_IN_BLOCK, "1A00000") ); assertThat( "Integration test passes", runIntegrationTestOnFolder("fake-agency-overlapping-trips", nullValue(), expectations, errorExpectations), equalTo(true) ); }

Target:
public void canLoadFeedWithErrors () { PersistenceExpectation[] expectations = PersistenceExpectation.list(); ErrorExpectation[] errorExpectations = ErrorExpectation.list( new ErrorExpectation(NewGTFSErrorType.FARE_TRANSFER_MISMATCH, equalTo("fare-02")), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, equalTo("freq-01_08:30:00_to_10:15:00_every_15m00s")), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, equalTo("freq-01_08:30:00_to_10:15:00_every_15m00s")), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.TRIP_OVERLAP_IN_BLOCK, equalTo("1A00000")) ); assertThat( "Integration test passes", runIntegrationTestOnFolder("fake-agency-overlapping-trips", nullValue(), expectations, errorExpectations), equalTo(true) ); }
Source:
public static String getLineIndentation(IDocument document, int offset) throws BadLocationException { int adjustedOffset= (offset == document.getLength() ? offset - 1 : offset); IRegion line= document.getLineInformationOfOffset(adjustedOffset); int start= line.getOffset(); int end= findEndOfWhiteSpace(document, start, offset + line.getLength()); return document.get(start, end - start); }

Target:
private static String getLineIndentation(IDocument document, int offset) throws BadLocationException { int adjustedOffset= (offset == document.getLength() ? offset - 1 : offset); IRegion line= document.getLineInformationOfOffset(adjustedOffset); int start= line.getOffset(); int end= findEndOfWhiteSpace(document, start, offset + line.getLength()); return document.get(start, end - start); }
Source:
public Pair<List<? extends UsageVO>, Integer> getUsageRecordsPendingQuotaAggregation(final long accountId, final long domainId) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); TransactionLegacy.open(TransactionLegacy.USAGE_DB).close(); s_logger.debug("getting usage records for account: " + accountId + ", domainId: " + domainId); Filter usageFilter = new Filter(UsageVO.class, "startDate", true, 0L, 10000L); SearchCriteria<UsageVO> sc = createSearchCriteria(); if (accountId != -1) { sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); } if (domainId != -1) { sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); } sc.addAnd("quotaCalculated", SearchCriteria.Op.NULL); sc.addOr("quotaCalculated", SearchCriteria.Op.EQ, 0); s_logger.debug("Getting usage records" + usageFilter.getOrderBy()); Pair<List<UsageVO>, Integer> usageRecords = searchAndCountAllRecords(sc, usageFilter); TransactionLegacy.open(opendb).close(); return new Pair<List<? extends UsageVO>, Integer>(usageRecords.first(), usageRecords.second()); }

Target:
public Pair<List<? extends UsageVO>, Integer> getUsageRecordsPendingQuotaAggregation(final long accountId, final long domainId) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); TransactionLegacy.open(TransactionLegacy.USAGE_DB).close(); if (s_logger.isDebugEnabled()){ s_logger.debug("getting usage records for account: " + accountId + ", domainId: " + domainId); } Filter usageFilter = new Filter(UsageVO.class, "startDate", true, 0L, 10000L); SearchCriteria<UsageVO> sc = createSearchCriteria(); if (accountId != -1) { sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); } if (domainId != -1) { sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); } sc.addAnd("quotaCalculated", SearchCriteria.Op.NULL); sc.addOr("quotaCalculated", SearchCriteria.Op.EQ, 0); if (s_logger.isDebugEnabled()){ s_logger.debug("Getting usage records" + usageFilter.getOrderBy()); } Pair<List<UsageVO>, Integer> usageRecords = searchAndCountAllRecords(sc, usageFilter); TransactionLegacy.open(opendb).close(); return new Pair<List<? extends UsageVO>, Integer>(usageRecords.first(), usageRecords.second()); }
Source:
private StackV4Request getStackRequest(SdxClusterRequest sdxClusterRequest, StackV4Request internalStackV4Request, CloudPlatform cloudPlatform, String runtimeVersion) { if (internalStackV4Request == null) { StackV4Request stackRequest = cdpConfigService.getConfigForKey( new CDPConfigKey(cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion)); if (stackRequest == null) { LOGGER.error("Can't find template for cloudplatform: {}, shape {}, cdp version: {}", cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion); throw new BadRequestException("Can't find template for cloudplatform: " + cloudPlatform + ", shape: " + sdxClusterRequest.getClusterShape() + ", runtime version: " + runtimeVersion); } updateStackV4RequestWithIDBrokerVolume(stackRequest); stackRequest.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return stackRequest; } else { updateStackV4RequestWithIDBrokerVolume(internalStackV4Request); internalStackV4Request.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return internalStackV4Request; } }

Target:
private StackV4Request getStackRequest(SdxClusterRequest sdxClusterRequest, StackV4Request internalStackV4Request, CloudPlatform cloudPlatform, String runtimeVersion) { if (internalStackV4Request == null) { StackV4Request stackRequest = cdpConfigService.getConfigForKey( new CDPConfigKey(cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion)); if (stackRequest == null) { LOGGER.error("Can't find template for cloudplatform: {}, shape {}, cdp version: {}", cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion); throw new BadRequestException("Can't find template for cloudplatform: " + cloudPlatform + ", shape: " + sdxClusterRequest.getClusterShape() + ", runtime version: " + runtimeVersion); } stackRequest.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return stackRequest; } else { internalStackV4Request.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return internalStackV4Request; } }
Source:
public void run() { ResourceTransfer resTransfer = ResourceTransfer.getInstance(); IResource[] resourceData = (IResource[]) clipboard.getContents(resTransfer); if (resourceData != null && resourceData.length > 0) { if (resourceData[0].getType() == IResource.PROJECT) { for (IResource element : resourceData) { CopyProjectOperation operation = new CopyProjectOperation(shell); operation.copyProject((IProject) element); } } else { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyResources(resourceData, container); } return; } FileTransfer fileTransfer = FileTransfer.getInstance(); String[] fileData = (String[]) clipboard.getContents(fileTransfer); if (fileData != null) { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyFiles(fileData, container); } }

Target:
public void run() { ResourceTransfer resTransfer = ResourceTransfer.getInstance(); IResource[] resourceData = (IResource[]) clipboard.getContents(resTransfer); if (resourceData != null && resourceData.length > 0) { if (resourceData[0].getType() == IResource.PROJECT) { for (IResource resource : resourceData) { CopyProjectOperation operation = new CopyProjectOperation(shell); operation.copyProject((IProject) resource); } } else { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyResources(resourceData, container); } return; } FileTransfer fileTransfer = FileTransfer.getInstance(); String[] fileData = (String[]) clipboard.getContents(fileTransfer); if (fileData != null) { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyFiles(fileData, container); } }
Source:
private void triggerMatchingPipelines(T event) { try { List<Pipeline> allPipelines = pipelineCache.getPipelinesSync(); List<Pipeline> matchingPipelines = eventHandler.getMatchingPipelines(event, allPipelines); matchingPipelines.stream() .map(pipelineCache::refresh) .map(p -> eventHandler.withMatchingTrigger(event, p)) .filter(Optional::isPresent) .map(Optional::get) .map(pipelinePostProcessorHandler::process) .forEach(p -> { recordMatchingPipeline(p); pipelineInitiator.startPipeline(p); }); } catch (TimeoutException e) { log.error("Failed to get pipeline configs", e); } }

Target:
private void triggerMatchingPipelines(T event) { try { List<Pipeline> allPipelines = pipelineCache.getPipelinesSync(); List<Pipeline> matchingPipelines = eventHandler.getMatchingPipelines(event, allPipelines); matchingPipelines.stream() .map(pipelinePostProcessorHandler::process) .forEach(p -> { recordMatchingPipeline(p); pipelineInitiator.startPipeline(p); }); } catch (TimeoutException e) { log.error("Failed to get pipeline configs", e); } }
Source:
protected CronWorkflow(String type, WorkflowSettings settings) { super(type, schedule, handleFailure, settings); permit(schedule, doWork); permit(doWork, schedule, handleFailure); permit(handleFailure, schedule); }

Target:
protected CronWorkflow(String type, WorkflowSettings settings) { super(type, schedule, handleFailure, settings); permit(schedule, doWork); permit(doWork, schedule); permit(handleFailure, schedule, failed); }
Source:
private void createStudentAccount(StudentAttributes student) throws InvalidParametersException { AccountAttributes account = AccountAttributes.builder() .withGoogleId(student.googleId) .withEmail(student.email) .withName(student.name) .withIsInstructor(false) .withInstitute(getCourseInstitute(student.course)) .build(); StudentProfileAttributes spa = StudentProfileAttributes.builder().build(); spa.googleId = student.googleId; spa.institute = account.institute; account.studentProfile = spa; accountsDb.createAccount(account); }

Target:
private void createStudentAccount(StudentAttributes student) throws InvalidParametersException { AccountAttributes account = AccountAttributes.builder() .withGoogleId(student.googleId) .withEmail(student.email) .withName(student.name) .withIsInstructor(false) .withInstitute(getCourseInstitute(student.course)) .withStudentProfileAttributes(StudentProfileAttributes.builder() .withGoogleId(student.googleId) .withInstitute(getCourseInstitute(student.course)) .build()) .build(); accountsDb.createAccount(account); }
Source:
private void findMeta(Class<?> cls, Object instance) { try { Method getMetaMethod = cls.getMethod("getMeta"); Map<String, String> metaInfo = (Map<String, String>) getMetaMethod.invoke(instance); this.meta.putAll(metaInfo); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { } }

Target:
private void findMeta(Class<?> cls, Object instance) { try { Method getMetaMethod = cls.getMethod("getMeta"); Map<String, String> metaInfo = (Map<String, String>) getMetaMethod.invoke(instance); this.meta.putAll(metaInfo); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { logger.debug("Could not load `getMeta`.", e); } }
Source:
public void filter(DocumentIndexingPackage dip) throws IndexingException { BinaryObject binObj = getFileObject(dip).getOriginalFile(); String filepath = binObj.getFilename(); String mimetype = binObj.getMimetype(); log.debug("The binary has filepath " + filepath + " and mimetype " + mimetype); List<String> contentTypes = new ArrayList<String>(); extractContentType(filepath, mimetype, contentTypes); dip.getDocument().setContentType(contentTypes); }

Target:
public void filter(DocumentIndexingPackage dip) throws IndexingException { ContentObject contentObj = dip.getContentObject(); if (!(contentObj instanceof WorkObject) && !(contentObj instanceof FileObject)) { return; } FileObject fileObj = getFileObject(dip); BinaryObject binObj; if (fileObj == null) { return; } binObj = fileObj.getOriginalFile(); String filepath = binObj.getFilename(); String mimetype = binObj.getMimetype(); log.debug("The binary has filepath and mimetype {}", filepath, mimetype); ArrayList<String> contentTypes = new ArrayList<String>(); extractContentType(filepath, mimetype, contentTypes); dip.getDocument().setContentType(contentTypes); }
Source:
public void should_show_console_link_in_folder() { Folder folder = jenkins.jobs.create(Folder.class, createRandomName()); folder.save(); folder.open(); FreeStyleJob job = folder.getJobs().create(); job.startBuild().waitUntilFinished().shouldSucceed(); ListView.createWithColumn(folder, LastConsoleColumn.class); List<WebElement> links = all(by.link("Last/current build console output")); assertThat(links.size(), is(1)); links.get(0).click(); assertThat(driver, hasContent("Console Output")); }

Target:
public void should_show_console_link_in_folder() { Folder folder = jenkins.jobs.create(Folder.class, createRandomName()); folder.save(); folder.open(); FreeStyleJob job = folder.getJobs().create(); job.startBuild().waitUntilFinished().shouldSucceed(); ListView.createWithColumn(folder, LastConsoleColumn.class); List<WebElement> links = all(by.link("Last/current build console output")); assertThat(links, iterableWithSize(1)); links.get(0).click(); assertThat(driver, hasContent("Console Output")); }
Source:
public List<DBSDocumentState> getChildrenStates(String parentId, boolean excludeSpecialChildren, boolean excludeRegularChildren) { if(!excludeSpecialChildren && !excludeRegularChildren) { return getAllChildrenStates(parentId); } List<DBSDocumentState> docStates = new LinkedList<>(); Set<String> seen = new HashSet<>(); Set<String> specialChildrenTypesNamesSet = getSpecialChildrenTypesNamesSet(); for (DBSDocumentState docState : transientStates.values()) { if (!parentId.equals(docState.getParentId())) { continue; } if (specialChildrenTypesNamesSet.contains(docState.getPrimaryType()) && excludeSpecialChildren) { continue; } if (!specialChildrenTypesNamesSet.contains(docState.getPrimaryType()) && excludeRegularChildren) { continue; } docStates.add(docState); seen.add(docState.getId()); } DBSQueryOperator operator = excludeSpecialChildren == true ? DBSQueryOperator.NOT_IN : DBSQueryOperator.IN; List<State> states = repository.queryKeyValueWithOperator(KEY_PARENT_ID, parentId, KEY_PRIMARY_TYPE, operator, getSpecialChildrenTypesNamesSet(), seen); return getDocumentStates(docStates, states); }

Target:
public List<DBSDocumentState> getChildrenStates(String parentId, boolean excludeSpecialChildren, boolean excludeRegularChildren) { List<DBSDocumentState> docStates = new LinkedList<>(); Set<String> seen = new HashSet<>(); Set<String> specialChildrenTypes = Framework.getService(SchemaManager.class).getSpecialDocumentTypes(); boolean excludeChildren = excludeSpecialChildren || excludeRegularChildren; for (DBSDocumentState docState : transientStates.values()) { if (!parentId.equals(docState.getParentId())) { continue; } if (excludeChildren) { boolean specialChild = specialChildrenTypes.contains(docState.getPrimaryType()); if (excludeSpecialChildren && specialChild || excludeRegularChildren && !specialChild) { continue; } } docStates.add(docState); seen.add(docState.getId()); } List<State> states; if (!excludeChildren) { states = repository.queryKeyValue(KEY_PARENT_ID, parentId, seen); } else { DBSQueryOperator operator = excludeSpecialChildren ? DBSQueryOperator.NOT_IN : DBSQueryOperator.IN; states = repository.queryKeyValueWithOperator(KEY_PARENT_ID, parentId, KEY_PRIMARY_TYPE, operator, specialChildrenTypes, seen); } for (State state : states) { String id = (String) state.get(KEY_ID); if (transientStates.containsKey(id)) { continue; } docStates.add(newTransientState(state)); } return docStates; }
Source:
public int getMaxIntermediateSize() { return card.sizeof(); }

Target:
public int getMaxIntermediateSize() { return 65536; }
Source:
public StatusCheckerResult preExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { mSystemServerProcess = device.getProcessByName("system_server"); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.SUCCESS); if (mSystemServerProcess == null) { String message = "The system_server process has not started."; CLog.w(message); result.setStatus(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); mModuleStartTime = null; return result; } mModuleStartTime = getCurrentTime(); return result; }

Target:
public StatusCheckerResult preExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { mSystemServerProcess = device.getProcessByName("system_server"); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.SUCCESS); if (mSystemServerProcess == null) { String message = "No valid system_server process is found."; CLog.w(message); result.setStatus(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); mModuleStartTime = null; return result; } mModuleStartTime = getCurrentTime(); return result; }
Source:
public CompletableFuture<List<RedisNodeDescription>> getNodesAsync() { List<StatefulRedisConnection<String, String>> connections = new CopyOnWriteArrayList<>(); Flux<RedisURI> uris = Flux.fromIterable(redisURIs); Mono<List<RedisNodeDescription>> nodes = uris.flatMap(uri -> getNodeDescription(connections, uri)) .collectList() .map((nodeDescriptions) -> { if (nodeDescriptions.isEmpty()) { throw new RedisConnectionException(String.format("Failed to connect to any nodes in %s", redisURIs)); } else { return nodeDescriptions; } }) .doFinally(it -> { for (StatefulRedisConnection<String, String> connection : connections) { connection.closeAsync(); } }); return nodes.toFuture(); }

Target:
public CompletableFuture<List<RedisNodeDescription>> getNodesAsync() { List<StatefulRedisConnection<String, String>> connections = new CopyOnWriteArrayList<>(); Flux<RedisURI> uris = Flux.fromIterable(redisURIs); Mono<List<RedisNodeDescription>> nodes = uris.flatMap(uri -> getNodeDescription(connections, uri)) .collectList() .flatMap((nodeDescriptions) -> { if (nodeDescriptions.isEmpty()) { return Mono.error(new RedisConnectionException(String.format("Failed to connect to any nodes in %s", redisURIs))); } else { return Mono.just(nodeDescriptions); } }) .doFinally(it -> { for (StatefulRedisConnection<String, String> connection : connections) { connection.closeAsync(); } }); return nodes.toFuture(); }
Source:
public void setActive(boolean active) { getImage().setActive(true == active); }

Target:
public void setActive(boolean active) { getImage().setActive(active); }
Source:
public void removeRepositories() { try { configLock.writeLock().lock(); configuration.repositories = null; } finally { configLock.writeLock().unlock(); } }

Target:
public void removeRepositories() { try { configLock.writeLock().lock(); configuration.setRepositories(null); } finally { configLock.writeLock().unlock(); } }
Source:
public List<TaskStatusEvent> getJobHistory(final JobId jobId, final String host) throws JobDoesNotExistException { final Job descriptor = getJob(jobId); if (descriptor == null) { throw new JobDoesNotExistException(jobId); } final ZooKeeperClient client = provider.get("getJobHistory"); List<String> hosts; try { hosts = client.getChildren(Paths.historyJobHosts(jobId)); if (!isNullOrEmpty(host)) { if (!hosts.contains(host)) { return emptyList(); } else { hosts = singletonList(host); } } } catch (NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw Throwables.propagate(e); } final List<TaskStatusEvent> jsEvents = Lists.newArrayList(); for (String h : hosts) { final List<String> events; try { events = client.getChildren(Paths.historyJobHostEvents(jobId, h)); } catch (NoNodeException e) { continue; } catch (KeeperException e) { throw Throwables.propagate(e); } for (String event : events) { try { byte[] data = client.getData(Paths.historyJobHostEventsTimestamp( jobId, h, Long.valueOf(event))); final TaskStatus status = Json.read(data, TaskStatus.class); jsEvents.add(new TaskStatusEvent(status, Long.valueOf(event), h)); } catch (NoNodeException e) { } catch (KeeperException | IOException e) { throw Throwables.propagate(e); } } } return Ordering.from(EVENT_COMPARATOR).sortedCopy(jsEvents); }

Target:
public List<TaskStatusEvent> getJobHistory(final JobId jobId, final String host) throws JobDoesNotExistException { final Job descriptor = getJob(jobId); if (descriptor == null) { throw new JobDoesNotExistException(jobId); } final ZooKeeperClient client = provider.get("getJobHistory"); final List<String> hosts; try { hosts = (!isNullOrEmpty(host)) ? singletonList(host) : client.getChildren(Paths.historyJobHosts(jobId)); } catch (NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw Throwables.propagate(e); } final List<TaskStatusEvent> jsEvents = Lists.newArrayList(); for (String h : hosts) { final List<String> events; try { events = client.getChildren(Paths.historyJobHostEvents(jobId, h)); } catch (NoNodeException e) { continue; } catch (KeeperException e) { throw Throwables.propagate(e); } for (String event : events) { try { byte[] data = client.getData(Paths.historyJobHostEventsTimestamp( jobId, h, Long.valueOf(event))); final TaskStatus status = Json.read(data, TaskStatus.class); jsEvents.add(new TaskStatusEvent(status, Long.valueOf(event), h)); } catch (NoNodeException e) { } catch (KeeperException | IOException e) { throw Throwables.propagate(e); } } } return Ordering.from(EVENT_COMPARATOR).sortedCopy(jsEvents); }
Source:
private List<ChannelGroup<?>> resolveChannelGroups(List<String> idParams) { List<ChannelGroup<?>> channelGroups = new ArrayList<>(); for (String idParam : idParams) { Id id = Id.valueOf(codec.decode(idParam)); Optional<ChannelGroup<?>> channelGroupOptional; try { channelGroupOptional = Futures.getChecked( channelGroupResolver.resolveIds(ImmutableList.of(id)), IOException.class, 1, TimeUnit.MINUTES ).getResources().first(); } catch (IOException e) { throw new RuntimeException(new NotFoundException(id)); } if (channelGroupOptional.isPresent()) { channelGroups.add(channelGroupOptional.get()); } else { throw new RuntimeException(new NotFoundException(id)); } } return channelGroups; }

Target:
private List<ChannelGroup<?>> resolveChannelGroups(List<String> idParams) { List<Id> ids = idParams.stream() .map(codec::decode) .map(Id::valueOf) .collect(Collectors.toList()); return Promise.wrap(channelGroupResolver.resolveIds(ids)) .then(Resolved::getResources) .get(1, TimeUnit.MINUTES) .toList(); }
Source:
public List<File> getWritableLedgerDirsForNewLog() throws NoWritableLedgerDirException { if (!writableLedgerDirectories.isEmpty()) { return writableLedgerDirectories; } if (forceGCAllowWhenNoSpace == false) { String errMsg = "All ledger directories are non writable and force GC is not enabled."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; } List<File> fullLedgerDirsToAccomodateNewEntryLog = new ArrayList<File>(); for (File dir: this.ledgerDirectories) { if (dir.getUsableSpace() > (this.entryLogSize * 1.2) ) { fullLedgerDirsToAccomodateNewEntryLog.add(dir); } } if (!fullLedgerDirsToAccomodateNewEntryLog.isEmpty()) { LOG.info("No writable ledger dirs. Trying to go beyond to accomodate compaction." + "Dirs that can accomodate new entryLog are: {}", fullLedgerDirsToAccomodateNewEntryLog); return fullLedgerDirsToAccomodateNewEntryLog; } String errMsg = "All ledger directories are non writable and no reserved space left for creating entry log file."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; }

Target:
public List<File> getWritableLedgerDirsForNewLog() throws NoWritableLedgerDirException { if (!writableLedgerDirectories.isEmpty()) { return writableLedgerDirectories; } if (!forceGCAllowWhenNoSpace) { String errMsg = "All ledger directories are non writable and force GC is not enabled."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; } List<File> fullLedgerDirsToAccomodateNewEntryLog = new ArrayList<File>(); for (File dir: this.ledgerDirectories) { if (dir.getUsableSpace() > (this.entryLogSize * 1.2) ) { fullLedgerDirsToAccomodateNewEntryLog.add(dir); } } if (!fullLedgerDirsToAccomodateNewEntryLog.isEmpty()) { LOG.info("No writable ledger dirs. Trying to go beyond to accomodate compaction." + "Dirs that can accomodate new entryLog are: {}", fullLedgerDirsToAccomodateNewEntryLog); return fullLedgerDirsToAccomodateNewEntryLog; } String errMsg = "All ledger directories are non writable and no reserved space left for creating entry log file."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; }
Source:
public void replaceLock(String taskid, TaskLock oldLock, TaskLock newLock) { Preconditions.checkNotNull(taskid, "taskid"); Preconditions.checkNotNull(oldLock, "oldLock"); Preconditions.checkNotNull(newLock, "newLock"); log.info( "Replacing lock on interval[%s] version[%s] for task: %s", oldLock.getInterval(), oldLock.getVersion(), taskid ); removeLock(taskid, oldLock); addLock(taskid, newLock); }

Target:
public void replaceLock(String taskid, TaskLock oldLock, TaskLock newLock) { Preconditions.checkNotNull(taskid, "taskid"); Preconditions.checkNotNull(oldLock, "oldLock"); Preconditions.checkNotNull(newLock, "newLock"); log.info( "Replacing lock on interval[%s] version[%s] for task: %s", oldLock.getInterval(), oldLock.getVersion(), taskid ); final Long oldLockId = handler.getLockId(taskid, oldLock); if (oldLockId == null) { throw new ISE("Cannot find lock[%s]", oldLock); } handler.replaceLock(taskid, oldLockId, newLock); }
Source:
private static IBundleGroup getBundleGroup(String id, String versionId) { if (id == null || versionId == null) { return null; } for (IBundleGroupProvider provider : Platform.getBundleGroupProviders()) { IBundleGroup[] groups = provider.getBundleGroups(); for (IBundleGroup group : groups) { if (id.equals(group.getIdentifier()) && versionId.equals(group.getVersion())) { return group; } } } return null; }

Target:
private static IBundleGroup getBundleGroup(String id, String versionId) { if (id == null || versionId == null) { return null; } for (IBundleGroupProvider provider : Platform.getBundleGroupProviders()) { for (IBundleGroup group : provider.getBundleGroups()) { if (id.equals(group.getIdentifier()) && versionId.equals(group.getVersion())) { return group; } } } return null; }
Source:
public void beforeBlockElement(ProgramState currentState, Tree element, ProgramPoint programPoint) { if (programPoint instanceof MemberProgramPoint) { final Optional<ProgramState> result = programPoint.execute(currentState); if (!result.isPresent()) { final ExpressionTree memberOwner = ((MemberExpressionTree) element).object(); Symbol symbol = getSymbol(memberOwner); addUniqueIssueForSymbol(memberOwner, String.format(MESSAGE, memberOwner.toString()), symbol); } } else if (isForOfExpression(element)) { Symbol symbol = getSymbol((ExpressionTree) element); Constraint constraint = currentState.getConstraint(symbol); if (symbol != null && constraint != null && constraint.isStricterOrEqualTo(NULL_OR_UNDEFINED)) { addUniqueIssueForSymbol(element, String.format(MESSAGE, symbol.name()), symbol); } } }

Target:
public void beforeBlockElement(ProgramState currentState, Tree element, ProgramPoint programPoint) { if (programPoint instanceof MemberProgramPoint) { final Optional<ProgramState> result = programPoint.execute(currentState); if (!result.isPresent()) { final ExpressionTree memberOwner = ((MemberExpressionTree) element).object(); Symbol symbol = getSymbol(memberOwner); addUniqueIssue(memberOwner, symbol); } } else if (isForOfExpression(element)) { Symbol symbol = getSymbol((ExpressionTree) element); if (currentState.getConstraint(symbol).isStricterOrEqualTo(NULL_OR_UNDEFINED)) { addUniqueIssue(element, symbol); } } }
Source:
public void VETemplateTests_003_AddTemplates() { articleName = PageContent.articleNamePrefix + base.getTimeStamp(); VisualEditorPageObject ve = base.launchVisualEditorWithMainEdit(articleName, wikiURL); VisualEditorInsertTemplateDialog templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); VisualEditorEditTemplateDialog editTemplateDialog = templateDialog.selectResultTemplate("per", 0); ve = editTemplateDialog.clickDone(); templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); editTemplateDialog = templateDialog.selectResultTemplate("per", 1); ve = editTemplateDialog.closeDialog(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); ArticlePageObject article = saveDialog.savePage(); article.verifyVEPublishComplete(); article.logOut(wikiURL); }

Target:
public void VETemplateTests_003_AddTemplates() { articleName = PageContent.articleNamePrefix + base.getTimeStamp(); VisualEditorPageObject ve = base.launchVisualEditorWithMainEdit(articleName, wikiURL); VisualEditorInsertTemplateDialog templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); VisualEditorEditTemplateDialog editTemplateDialog = templateDialog.selectResultTemplate(VEContent.templateSearchStr3, 0); ve = editTemplateDialog.clickDone(); templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); editTemplateDialog = templateDialog.selectResultTemplate(VEContent.templateSearchStr3, 1); ve = editTemplateDialog.closeDialog(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); ArticlePageObject article = saveDialog.savePage(); article.verifyVEPublishComplete(); article.logOut(wikiURL); }
Source:
boolean meetRequirement(Long value) throws NullPointerException { Objects.requireNonNull(value, "Input value is empty which cannot be applied to threshold check."); return boundType == BoundType.UpperBound ? value < threshold : value > threshold; }

Target:
boolean meetRequirement(Long value) throws NullPointerException { Objects.requireNonNull(value, "Input value is empty which cannot be applied to threshold check."); return boundType == BoundType.UpperBound ? value <= threshold : value >= threshold; }
Source:
private String getCreateTableProperties() { if (acidTableKindToUse != null) { if (acidTableKindToUse.equals("orc")) { return " stored as orc TBLPROPERTIES('transactional'='true')"; } else if (acidTableKindToUse.equals("mm")) { return " TBLPROPERTIES('transactional'='true', 'transactional_properties'='insert_only')"; } } return ""; }

Target:
private String getCreateTableProperties() { if (acidTableKindToUse == AcidTableKind.FULL_ACID) { return " stored as orc TBLPROPERTIES('transactional'='true')"; } if (acidTableKindToUse == AcidTableKind.INSERT_ONLY) { return " TBLPROPERTIES('transactional'='true', 'transactional_properties'='insert_only')"; } return ""; }
Source:
public void testDefaultNumberofParallelWorkers() throws Exception { handler = new GerritHandler(); listener = new SlowEventListener(); handler.addListener(listener); postEventsToQueue(5); waitForEventsProcessed(); assertThat(handler.getLargestPoolSize(), equalTo(3)); }

Target:
public void testDefaultNumberofParallelWorkers() throws Exception { handler = new GerritHandler(); listener = new SlowEventListener(); handler.addListener(listener); postEventsToQueue(5); waitForEventsProcessed(); assertThat(handler.getLargestPoolSize(), equalTo(DEFAULT_NR_OF_RECEIVING_WORKER_THREADS)); }
Source:
public void visitNode(Tree tree) { ClassTree node = (ClassTree) tree; Symbol.TypeSymbol symbol = node.symbol(); Symbol owner = symbol.owner(); Type ownerType = owner.type(); if (ownerType != null && ownerType.isClass() && owner.owner().type() == null) { int first = FirstSyntaxTokenFinder.firstSyntaxToken(node).line(); int last = LastSyntaxTokenFinder.lastSyntaxToken(node).line(); int length = last - first + 1; if (length > max) { addIssue(node, "Reduce this class from " + length + " to the maximum allowed " + max + " or externalize it in a public class."); } } }

Target:
public void visitNode(Tree tree) { ClassTree node = (ClassTree) tree; Symbol.TypeSymbol symbol = node.symbol(); Symbol owner = symbol.owner(); Type ownerType = owner.type(); if (ownerType != null && ownerType.isClass() && owner.owner().isPackageSymbol()) { int first = FirstSyntaxTokenFinder.firstSyntaxToken(node).line(); int last = LastSyntaxTokenFinder.lastSyntaxToken(node).line(); int length = last - first + 1; if (length > max) { addIssue(node, "Reduce this class from " + length + " to the maximum allowed " + max + " or externalize it in a public class."); } } }
Source:
public void checkParityFor(long currentId) { final Optional<ChargeEntity> maybeCharge = chargeDao.findById(currentId); try { maybeCharge.ifPresent(c -> MDC.put("chargeId", c.getExternalId())); if (maybeCharge.isPresent()) { final ChargeEntity charge = maybeCharge.get(); Optional<LedgerTransaction> transaction = ledgerService.getTransaction(charge.getExternalId()); if (existsInLedger(charge, transaction)) { logger.info("transaction exists in ledger [id={}]", currentId); charge.updateParityCheck(ParityCheckStatus.EXISTS_IN_LEDGER); } else { logger.info("transaction does not exist in ledger [id={}] -", currentId); charge.updateParityCheck(ParityCheckStatus.MISSING_IN_LEDGER); emitHistoricalEvents(charge); } } else { logger.info("[{}/{}] - not found", currentId, maxId); } } finally { MDC.remove("chargeId"); } }

Target:
public void checkParityFor(long currentId) { final Optional<ChargeEntity> maybeCharge = chargeDao.findById(currentId); try { maybeCharge.ifPresent(c -> MDC.put("chargeId", c.getExternalId())); if (maybeCharge.isPresent()) { final ChargeEntity charge = maybeCharge.get(); Optional<LedgerTransaction> transaction = ledgerService.getTransaction(charge.getExternalId()); if (existsInLedger(transaction)) { logger.info("transaction exists in ledger [id={}]", currentId); chargeService.updateChargeParityStatus(charge.getExternalId(), ParityCheckStatus.EXISTS_IN_LEDGER); } else { logger.info("transaction does not exist in ledger [id={}] -", currentId); chargeService.updateChargeParityStatus(charge.getExternalId(), ParityCheckStatus.MISSING_IN_LEDGER); emitHistoricalEvents(charge); } } else { logger.info("[{}/{}] - not found", currentId, maxId); } } finally { MDC.remove("chargeId"); } }
Source:
protected boolean canDoAction() { if(! super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (!volume.isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STOPPED); addCanDoActionMessage(String.format("$volumeName %1$s", volume.getName())); return false; } if (volume.getAsyncTask() != null && volume.getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { if (volume.getAsyncTask().getType() == GlusterTaskType.REBALANCE) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REBALANCE_IN_PROGRESS); } } return true; }

Target:
protected boolean canDoAction() { if(! super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (!volume.isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STOPPED); addCanDoActionMessage(String.format("$volumeName %1$s", volume.getName())); return false; } if (GlusterTaskUtils.isTaskOfType(volume, GlusterTaskType.REBALANCE) && GlusterTaskUtils.isTaskStatus(volume, JobExecutionStatus.STARTED)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REBALANCE_IN_PROGRESS); } return true; }
Source:
public void onMessage(ReadRowsResponse response) { call.request(1); if (builder == null) { builder = new RowMerger(); } builder.addPartialRow(response); if (builder.isRowCommitted()) { Row builtRow = builder.buildRow(); builder = null; if (builtRow == null) { } else { observer.onNext(builtRow); } } }

Target:
public void onMessage(ReadRowsResponse response) { if (builder == null) { builder = new RowMerger(); } builder.addPartialRow(response); outstandingRequestCount.decrementAndGet(); if (builder.isRowCommitted()) { Row builtRow = builder.buildRow(); builder = null; if (builtRow == null) { } else { observer.onNext(builtRow); } } }
Source:
public void onClick(DialogInterface dialog, int which) { if (which == AlertDialog.BUTTON_POSITIVE) { String username = mUsernameET.getText().toString().trim(); String password = mPasswordET.getText().toString().trim(); mHandler.proceed(username, password); dialog.dismiss(); } else if (which == AlertDialog.BUTTON_NEGATIVE) { dialog.dismiss(); mWebView.stopLoading(); ((AuthenticatorActivity)getActivity()).doNegativeAuthenticatioDialogClick(); } }

Target:
public void onClick(DialogInterface dialog, int which) { if (which == AlertDialog.BUTTON_POSITIVE) { String username = mUsernameET.getText().toString(); String password = mPasswordET.getText().toString(); mHandler.proceed(username, password); } else if (which == AlertDialog.BUTTON_NEGATIVE) { mWebView.stopLoading(); ((AuthenticatorActivity)getActivity()).doNegativeAuthenticatioDialogClick(); } dialog.dismiss(); }
Source:
public List<IDatabaseConnection> getConnections( boolean hidePassword ) throws ConnectionServiceException { ensureDataAccessPermission(); List<IDatabaseConnection> connectionList = null; try { connectionList = datasourceMgmtSvc.getDatasources(); if ( hidePassword ) { for ( IDatabaseConnection conn : connectionList ) { sanitizer.unsanitizeConnectionParameters( conn ); conn.setPassword( null ); } } else { for ( IDatabaseConnection conn : connectionList ) { sanitizer.unsanitizeConnectionParameters( conn ); } } } catch ( DatasourceMgmtServiceException dme ) { String message = Messages.getErrorString( "ConnectionServiceImpl.ERROR_0002_UNABLE_TO_GET_CONNECTION_LIST", dme.getLocalizedMessage() ); logger.error( message ); throw new ConnectionServiceException( message, dme ); } return connectionList; }

Target:
public List<IDatabaseConnection> getConnections( boolean hidePassword ) throws ConnectionServiceException { ensureDataAccessPermission(); List<IDatabaseConnection> connectionList = null; try { connectionList = datasourceMgmtSvc.getDatasources(); for ( IDatabaseConnection conn : connectionList ) { sanitizer.unsanitizeConnectionParameters( conn ); if ( hidePassword ) { conn.setPassword( null ); } } } catch ( DatasourceMgmtServiceException dme ) { String message = Messages.getErrorString( "ConnectionServiceImpl.ERROR_0002_UNABLE_TO_GET_CONNECTION_LIST", dme.getLocalizedMessage() ); logger.error( message ); throw new ConnectionServiceException( message, dme ); } return connectionList; }
Source:
public void setUp() { user = properties.getUserName(); password = properties.getPassword(); loginPage = new LoginPage(driver); homePage = new HomePage(driver); participantPage = new ParticipantPage(driver); participantEditPage = new ParticipantEditPage(driver); if (homePage.expectedUrlPath() != currentPage().urlPath()) { loginPage.login(user , password); } }

Target:
public void setUp() { user = properties.getUserName(); password = properties.getPassword(); loginPage = new LoginPage(driver); homePage = new HomePage(driver); participantPage = new ParticipantPage(driver); participantEditPage = new ParticipantEditPage(driver); if (!StringUtils.equals(homePage.expectedUrlPath(), currentPage().urlPath())) { loginPage.login(user , password); } }
Source:
private URL createURL(KeenProject project, String eventCollection) { try { String rawPath = new URI(null, null, eventCollection, null).getRawPath(); String path = String.format(Locale.US, "%s/%s/projects/%s/events/%s", getBaseUrl(), KeenConstants.API_VERSION, project.getProjectId(), rawPath); return new URL(path); } catch (URISyntaxException e) { KeenLogging.log("Event collection name has invalid character to encode", e); } catch (MalformedURLException e) { KeenLogging.log("Url you create is malformed or there is not legal protocol in string you specified", e); } return null; }

Target:
private URL createURL(KeenProject project, String eventCollection) { try { String encodedCollectionName = new URI(null, null, eventCollection, null).getRawPath(); String path = String.format(Locale.US, "%s/%s/projects/%s/events/%s", getBaseUrl(), KeenConstants.API_VERSION, project.getProjectId(), encodedCollectionName); return new URL(path); } catch (URISyntaxException e) { KeenLogging.log("Event collection name has invalid character to encode", e); } catch (MalformedURLException e) { KeenLogging.log("Url you create is malformed or there is not legal protocol in string you specified", e); } return null; }
Source:
protected ICommand getCreateCommand(CreateElementRequest req) { EObject owner = req.getContainer(); EReference eref = req.getContainmentFeature(); if (eref == null) { return UnexecutableCommand.INSTANCE; } if (owner instanceof Component && eref.equals(UMLPackage.eINSTANCE.getClass_NestedClassifier()) && req.getElementType().getEClass().equals(UMLPackage.eINSTANCE.getComponent())) { return UnexecutableCommand.INSTANCE; } return super.getCreateCommand(req); }

Target:
protected ICommand getCreateCommand(CreateElementRequest req) { EObject owner = req.getContainer(); EReference eref = req.getContainmentFeature(); if (eref == null) { return UnexecutableCommand.INSTANCE; } if (owner instanceof Component && eref == UMLPackage.eINSTANCE.getClass_NestedClassifier() && req.getElementType().getEClass() == UMLPackage.eINSTANCE.getComponent()) { return UnexecutableCommand.INSTANCE; } return super.getCreateCommand(req); }
Source:
public List<String> splitJson(JsonNode jsonNode) throws JsonParseException, JsonMappingException, IOException { List<String> splittedJsonElements = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); if (jsonNode.isArray()) { ArrayNode arrayNode = (ArrayNode) jsonNode; for (int i = 0; i < arrayNode.size(); i++) { JsonNode individualElement = arrayNode.get(i); splittedJsonElements.add(mapper.writeValueAsString(individualElement)); } } else { splittedJsonElements.add(mapper.writeValueAsString(jsonNode)); } return splittedJsonElements; }

Target:
public List<String> splitJson(JsonNode jsonNode) throws IOException { List<String> splittedJsonElements = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); if (jsonNode.isArray()) { for (JsonNode element : (ArrayNode) jsonNode) { splittedJsonElements.add(writeJsonNode(mapper, element)); } } else { splittedJsonElements.add(writeJsonNode(mapper, jsonNode)); } return splittedJsonElements; }
Source:
public void nextJsonObject_ArrayOfElements() throws JsonParseException, IOException { String element1 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc']}"); String element2 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc'], dd: 'ssssxx'}"); String content = "[" + element1 +", " + element2 + "]"; JsonParser jsonParser = jsonFactory.createParser(content); JsonToken jsonToken = jsonUtils.nextJsonObject(jsonParser); assertEquals(content.replaceAll("\\s", ""), jsonParser.readValueAsTree().toString()); jsonToken = jsonUtils.nextJsonObject(jsonParser); assertNull(jsonToken); }

Target:
public void nextJsonObject_ArrayOfElements() throws JsonParseException, IOException { String element1 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc']}"); String element2 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc'], dd: 'ssssxx'}"); String content = "[" + element1 +"," + element2 + "]"; JsonParser jsonParser = jsonFactory.createParser(content); JsonToken jsonToken = jsonUtils.nextJsonObject(jsonParser); assertEquals(content, jsonParser.readValueAsTree().toString()); jsonToken = jsonUtils.nextJsonObject(jsonParser); assertNull(jsonToken); }
Source:
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( (List<String>) listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context); }

Target:
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context); }
Source:
private void addTrace(ITmfStateSystem ss, Builder<@NonNull TimeGraphEntryModel> builder, int quark, long parentId) { int jaegerSpansQuark; try { jaegerSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.JAEGER_QUARK); } catch (AttributeNotFoundException e) { return; } builder.add(new TimeGraphEntryModel(parentId, -1, ss.getAttributeName(quark), ss.getStartTime(), ss.getCurrentEndTime())); int ustSpansQuark; try { ustSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.UST_QUARK); } catch (AttributeNotFoundException e) { addChildren(ss, builder, jaegerSpansQuark, parentId); return; } addUstChildren(ss, builder, jaegerSpansQuark, ustSpansQuark, parentId); }

Target:
private void addTrace(ITmfStateSystem ss, Builder<@NonNull TimeGraphEntryModel> builder, int quark, long parentId) { List<@NonNull Integer> logsQuarks; try { int logsQuark = ss.getQuarkRelative(quark, IOpenTracingConstants.LOGS); logsQuarks = ss.getSubAttributes(logsQuark, false); } catch (AttributeNotFoundException e) { logsQuarks = new ArrayList<>(); } int openTracingSpansQuark; try { openTracingSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.OPEN_TRACING_QUARK); } catch (AttributeNotFoundException e) { return; } builder.add(new TimeGraphEntryModel(parentId, ITmfStateSystem.ROOT_ATTRIBUTE, ss.getAttributeName(quark), ss.getStartTime(), ss.getCurrentEndTime())); int ustSpansQuark; try { ustSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.UST_QUARK); } catch (AttributeNotFoundException e) { addChildren(ss, builder, openTracingSpansQuark, parentId, logsQuarks); return; } addUstChildren(ss, builder, openTracingSpansQuark, ustSpansQuark, parentId, logsQuarks); }
Source:
public void notLeader() { synchronized (lock) { if (running) { try { kubeClient.checkAndUpdateConfigMap( configMapName, configMap -> { if (KubernetesLeaderElector.hasLeadership(configMap, lockIdentity)) { configMap.getData().remove(LEADER_ADDRESS_KEY); configMap.getData().remove(LEADER_SESSION_ID_KEY); return Optional.of(configMap); } return Optional.empty(); } ).get(); } catch (Exception e) { fatalErrorHandler.onFatalError( new LeaderElectionException( "Could not remove leader information from ConfigMap " + configMapName, e)); } leaderElectionEventHandler.onRevokeLeadership(); if (!leaderElectorRunFuture.isDone()) { leaderElectorRunFuture.complete(null); } leaderElectorRunFuture = CompletableFuture.runAsync(leaderElector::run, ioExecutor); FutureUtils.assertNoException(leaderElectorRunFuture); } } }

Target:
public void notLeader() { leaderElectionEventHandler.onRevokeLeadership(); leaderElector.run(); }
Source:
private <T> T getProperty(VariantType type, String property, T defaultValue, Class<T> expectedType) { String systemPropertyName = String.format("aerogear.%s.%s", type.getTypeName(), property); String value = System.getProperty(systemPropertyName, defaultValue.toString()); if (expectedType == String.class) { return (T) value; } else if (expectedType == Integer.class) { return (T) Integer.valueOf(value); } else { throw new IllegalStateException("Unexpected type: " + expectedType); } }

Target:
private <T> T getProperty(VariantType type, String property, T defaultValue, Class<T> expectedType) { String systemPropertyName = String.format("aerogear.%s.%s", type.getTypeName(), property); if (expectedType == String.class) { return (T) ConfigurationUtils.tryGetProperty(systemPropertyName, (String) defaultValue); } else if (expectedType == Integer.class) { return (T) ConfigurationUtils.tryGetIntegerProperty(systemPropertyName, (Integer) defaultValue); } else { throw new IllegalStateException("Unexpected type: " + expectedType); } }