auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Path generate(String id, String version, String packaging, String... dependencyList) throws IOException, NoSuchAlgorithmException, JAXBException, NugetFormatException { NugetArtifactCoordinates coordinates = new NugetArtifactCoordinates(id, version, packaging); Path fullPath = basePath.resolve(coordinates.toPath()); Files.createDirectories(fullPath.getParent()); SemanticVersion semanticVersion = SemanticVersion.parse(version); logger.debug("Version of the package: {}", packaging, semanticVersion.toString()); generate(fullPath, id, semanticVersion, dependencyList); return fullPath; }

Target:
public Path generate(String id, String version, String packaging, String... dependencyList) throws IOException, NoSuchAlgorithmException, JAXBException, NugetFormatException { NugetArtifactCoordinates coordinates = new NugetArtifactCoordinates(id, version, packaging); Path fullPath = basePath.resolve(coordinates.toPath()).normalize().toAbsolutePath(); Files.createDirectories(fullPath.getParent()); SemanticVersion semanticVersion = SemanticVersion.parse(version); logger.debug("Version of the package: {}", packaging, semanticVersion.toString()); generate(fullPath, id, semanticVersion, dependencyList); return fullPath; }
Source:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.updateIndex(); updater.updateMetadataFile(); updater.exit(); } catch (IOException | NoSuchAlgorithmException | JAXBException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } }; }

Target:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.updateIndex(); updater.updateMetadataFile(); updater.exit(); XDMConstants.setTrue(result); } catch (IOException | NoSuchAlgorithmException | JAXBException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } }; }
Source:
public String getEnvironmentIdByName(String ownerId, String envName) { String jpql = "SELECT e.id FROM Environment e WHERE e.owner.id = :owner_id and e.name = :env_name"; String envId = null; if (ownerId != null && envName != null) { try { envId = this.getEntityManager().createQuery(jpql, String.class) .setParameter("owner_id", ownerId).setParameter("env_name", envName) .getSingleResult(); } catch (NoResultException exp) { log.debug("Unable to find environment Id by envName {}", envName); } } return envId; }

Target:
public String getEnvironmentIdByName(String ownerId, String envName) { String jpql = "SELECT e.id FROM Environment e WHERE e.owner.id = :owner_id and e.name = :env_name"; String envId = null; if (ownerId != null && envName != null) { try { envId = this.getEntityManager() .createQuery(jpql, String.class) .setParameter("owner_id", ownerId) .setParameter("env_name", envName) .getSingleResult(); } catch (NoResultException exp) { log.trace("Unable to find environment Id by envName {}", envName); } } return envId; }
Source:
public static void reorderBookmark(Context context, long id, int orderId) { ContentValues cv = new ContentValues(); cv.put(Columns.ORDER_ID, orderId); context.getContentResolver().update(Columns.CONTENT_URI, cv, Columns._ID + " = ?", new String[] { String.valueOf(id) }); }

Target:
public static void reorderBookmark(Context context, long id, int orderId) { ContentValues cv = new ContentValues(); cv.put(Columns.ORDER_ID, orderId); Uri uri = ContentUris.withAppendedId(Columns.CONTENT_URI, id); context.getContentResolver().update(uri, cv, null, null); }
Source:
public void create(CDPStructuredEvent structuredEvent) { StructuredEventType eventType = structuredEvent.getOperation().getEventType(); CDPEventDataExtractor<? extends CDPStructuredEvent> eventDataExtractor = eventDataExtractorMap.get(eventType.name().toLowerCase() + "CDPEventDataExtractor"); if (eventDataExtractor == null) { LOGGER.debug("Event data converter does not exist for event type of {}", eventType); return; } boolean shouldAudit = eventDataExtractor.shouldAudit(structuredEvent); if (shouldAudit) { sendAsyncEvent(AUDIT_EVENT_LOG_MESSAGE, eventFactory.createEvent(structuredEvent)); } else { LOGGER.debug("Audit Event is disabled for this structure event: {}", structuredEvent); } }

Target:
public void create(CDPStructuredEvent structuredEvent) { StructuredEventType eventType = structuredEvent.getOperation().getEventType(); CDPEventDataExtractor<? extends CDPStructuredEvent> eventDataExtractor = eventDataExtractorMap.get(eventType.name().toLowerCase() + "CDPEventDataExtractor"); if (eventDataExtractor == null) { LOGGER.debug("Event data converter does not exist for event type of {}", eventType); return; } boolean shouldAudit = eventDataExtractor.shouldAudit(structuredEvent); if (shouldAudit) { sendAsyncEvent(AUDIT_EVENT_LOG_MESSAGE, eventFactory.createEvent(structuredEvent)); LOGGER.debug("Audit Event is fired for this structured event: {}", structuredEvent); } else { LOGGER.debug("Audit Event is disabled for this structured event: {}", structuredEvent); } }
Source:
protected Map<String, Pair<Class, Object>> getOverriddenReturnTypes() { Pair<Class, Object> statusPair = new Pair<>(); statusPair.setA(Sort.class); statusPair.setB(Sort.parse("attr")); Pair<Class, Object> enumOptions = new Pair<>(); enumOptions.setA(List.class); enumOptions.setB(Collections.singletonList("test")); Map<String, Pair<Class, Object>> map = new HashMap<>(); map.put(AttributeMetadata.ORDER_BY, statusPair); return map; }

Target:
protected Map<String, Pair<Class, Object>> getOverriddenReturnTypes() { Pair<Class, Object> orderPair = new Pair<>(); orderPair.setA(Sort.class); orderPair.setB(Sort.parse("attr")); Map<String, Pair<Class, Object>> map = new HashMap<>(); map.put(AttributeMetadata.ORDER_BY, orderPair); return map; }
Source:
public boolean shouldAskForRating() { return allEnvironmentRequirementsMet() && totalEventCountPredicates.allowFeedbackPrompt() && firstEventTimePredicates.allowFeedbackPrompt() && lastEventTimePredicates.allowFeedbackPrompt() && lastEventVersionPredicates.allowFeedbackPrompt(); }

Target:
public boolean shouldAskForRating() { return allEnvironmentRequirementsMet() && totalCountPredicate.allowFeedbackPrompt() && firstTimePredicate.allowFeedbackPrompt() && lastTimePredicate.allowFeedbackPrompt() && lastVersionPredicate.allowFeedbackPrompt(); }
Source:
private void queryVfMap() { final AsyncQuery asyncQuery = new AsyncQuery(); asyncQuery.setModel(this); asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValueObj) { VdcQueryReturnValue returnValue = (VdcQueryReturnValue) returnValueObj; vfMap = returnValue.getReturnValue(); queryNetworkAttachments(); } }; VDS vds = getEntity(); IdQueryParameters params = new IdQueryParameters(vds.getId()); params.setRefresh(false); Frontend.getInstance().runQuery(VdcQueryType.GetVfMap, params, asyncQuery); }

Target:
private void queryVfMap() { final AsyncQuery asyncQuery = new AsyncQuery(); asyncQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValueObj) { VdcQueryReturnValue returnValue = (VdcQueryReturnValue) returnValueObj; vfMap = returnValue.getReturnValue(); if (vfMap == null) { vfMap = Collections.emptyMap(); } queryFreeBonds(); } }; VDS vds = getEntity(); IdQueryParameters params = new IdQueryParameters(vds.getId()); params.setRefresh(false); Frontend.getInstance().runQuery(VdcQueryType.GetVfToPfMapByHostId, params, asyncQuery); }
Source:
private void handleBulkWriteError(List<BulkWriteError> errors, List<DocInfo> docs) { for (BulkWriteError e : errors) { DocInfo doc = docs.get(e.getIndex()); doc.docCtx.addError(Error.get("remove", MongoCrudConstants.ERR_SAVE_ERROR, e.getMessage())); } }

Target:
private void handleBulkWriteError(List<BulkWriteError> errors, List<DocInfo> docs) { for (BulkWriteError e : errors) { DocInfo doc = docs.get(e.getIndex()); doc.docCtx.addError(Error.get("remove", MongoCrudConstants.ERR_DELETE_ERROR, e.getMessage())); } }
Source:
protected PairSupplier<Q, E> getPairSupplier(){ if (endpointProvider == null){ throw new NullPointerException("Init endpoint provider!"); } if (queryProvider == null) { logger.info("Query provider is null."); } if (pairSupplier == null){ pairSupplier = pairSupplierFactory.create(queryProvider, endpointProvider); } return pairSupplier; }

Target:
protected PairSupplier<Q, E> getPairSupplier(){ return pairSupplier; }
Source:
public DataStream(String name, String timeStampField, List<Index> indices, long generation) { this.name = name; this.timeStampField = timeStampField; this.indices = indices; this.generation = generation; assert indices.size() > 0; assert indices.get(indices.size() - 1).getName().endsWith(getBackingIndexName(name, generation)); }

Target:
public DataStream(String name, String timeStampField, List<Index> indices, long generation) { this.name = name; this.timeStampField = timeStampField; this.indices = indices; this.generation = generation; assert indices.size() > 0; assert indices.get(indices.size() - 1).getName().equals(getDefaultBackingIndexName(name, generation)); }
Source:
private void redirectToYoutubeDialog() { if (getActivity() != null && !getActivity().isDestroyed()) { ((BaseFragmentActivity) getActivity()) .showAlertDialog( getString(R.string.assessment_unable_to_play_video), getString(R.string.assessment_unable_to_play_video_message), getString(R.string.assessment_open_on_youtube), (dialog, which) -> BrowserUtil .open(getActivity(), unit.getData().encodedVideos.getYoutubeVideoInfo().url), getString(R.string.label_cancel), null ); } }

Target:
private void redirectToYoutubeDialog() { releaseYoutubePlayer(); if (getActivity() != null && !getActivity().isDestroyed()) { ((BaseFragmentActivity) getActivity()) .showAlertDialog( getString(R.string.assessment_unable_to_play_video), getString(R.string.assessment_unable_to_play_video_message), getString(R.string.assessment_open_on_youtube), (dialog, which) -> BrowserUtil .open(getActivity(), unit.getData().encodedVideos.getYoutubeVideoInfo().url), getString(R.string.label_ok), null ); } }
Source:
private GenericToken findTokenSiblingInThisNode(GenericToken token, int shift) { if (shift == 0) { return token; } else if (shift < 0) { return TokenOps.nthPrevious(jjtGetFirstToken(), token, -shift); } else { return TokenOps.nthFollower(token, +shift); } }

Target:
private GenericToken findTokenSiblingInThisNode(GenericToken token, int shift) { if (shift == 0) { return token; } else if (shift < 0) { return TokenUtils.nthPrevious(jjtGetFirstToken(), token, -shift); } else { return TokenUtils.nthFollower(token, shift); } }
Source:
private void updateOnNetworkChanges(final DownloadManager downloadManager) { if (deviceDoesNotSupportConnectivityChangesBroadcast()) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkRequest networkRequest = new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(); connectivityManager.registerNetworkCallback(networkRequest, new ConnectivityManager.NetworkCallback() { @Override public void onAvailable(Network network) { Log.v("network is active now from inside the download manager"); downloadManager.forceStart(); } }); } }

Target:
private void updateOnNetworkChanges(final DownloadManager downloadManager) { if (deviceSupportsConnectivityChangesBroadcast()) { return; } ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkRequest networkRequest = new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(); connectivityManager.registerNetworkCallback(networkRequest, new ConnectivityManager.NetworkCallback() { @Override public void onAvailable(Network network) { LLog.v("network is active now from inside the download manager"); downloadManager.forceStart(); } }); }
Source:
public Image decorateImage(Image image, Object element) { boolean useSessionLoadedImage = false; if (element instanceof IFile) { IFile iFileToDecorate = (IFile) element; if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(iFileToDecorate.getProjectRelativePath().getFileExtension())) { Collection<Session> sessions = SessionManager.INSTANCE.getSessions(); Iterator<Session> sessionIte = sessions.iterator(); while (sessionIte.hasNext() && !useSessionLoadedImage) { Session session = sessionIte.next(); Set<Resource> allSessionResources = session.getAllSessionResources(); for (Resource resource : allSessionResources) { URI sessionUri = resource.getURI(); if (sessionUri != null && sessionUri.isPlatformResource()) { IFile sessionIFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(sessionUri.toPlatformString(true))); if (iFileToDecorate.getProjectRelativePath().equals(sessionIFile.getProjectRelativePath()) && session.isOpen()) { useSessionLoadedImage = true; break; } } } } } } if (useSessionLoadedImage) { return SiriusEditPlugin.getPlugin().getImage(SESSION_LOADED_IMAGE_DESCRIPTOR); } return image; }

Target:
public Image decorateImage(Image image, Object element) { boolean useSessionLoadedImage = false; if (!ModelExplorerView.class.getTypeName().equals(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getClass().getTypeName()) && element instanceof IFile) { List<Session> relatedSessions = FileSessionFinder.getRelatedSessions(Lists.newArrayList((IFile) element), false, false); for (Session session : relatedSessions) { if (session.isOpen()) { useSessionLoadedImage = true; break; } } } if (useSessionLoadedImage) { return SiriusEditPlugin.getPlugin().getImage(SESSION_LOADED_IMAGE_DESCRIPTOR); } return image; }
Source:
public I_R_Request createRequest(@NonNull final RequestCandidate candidate) { final I_R_Request request = newInstance(I_R_Request.class); ; request.setSummary(candidate.getSummary()); request.setConfidentialType(candidate.getConfidentialType()); request.setAD_Org_ID(candidate.getOrgId().getRepoId()); request.setM_Product_ID(ProductId.toRepoId(candidate.getProductId())); request.setAD_Table_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getAD_Table_ID() : -1); request.setRecord_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getRecord_ID() : -1); request.setC_BPartner_ID(BPartnerId.toRepoId(candidate.getPartnerId())); request.setC_Order_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getTableName().equals(I_C_Order.Table_Name) ? candidate.getRecordRef().getRecord_ID() : -1 : -1); request.setM_InOut_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getTableName().equals(I_M_InOut.Table_Name) ? candidate.getRecordRef().getRecord_ID() : -1 : -1); request.setDateTrx(TimeUtil.asTimestamp(Date.from(Instant.now()))); request.setAD_User_ID(UserId.toRepoId(candidate.getUserId())); request.setR_RequestType_ID(candidate.getRequestTypeId().getRepoId()); request.setM_QualityNote_ID(QualityNoteId.toRepoId(candidate.getQualityNoteId())); request.setPerformanceType(candidate.getPerformanceType()); request.setDateDelivered(TimeUtil.asTimestamp(candidate.getDateDelivered())); saveRecord(request); return request; }

Target:
public I_R_Request createRequest(@NonNull final RequestCandidate candidate) { final I_R_Request request = newInstance(I_R_Request.class); ; request.setSummary(candidate.getSummary()); request.setConfidentialType(candidate.getConfidentialType()); request.setAD_Org_ID(candidate.getOrgId().getRepoId()); request.setM_Product_ID(ProductId.toRepoId(candidate.getProductId())); request.setAD_Table_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getAD_Table_ID() : -1); request.setRecord_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getRecord_ID() : -1); request.setC_BPartner_ID(BPartnerId.toRepoId(candidate.getPartnerId())); request.setC_Order_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getTableName().equals(I_C_Order.Table_Name) ? candidate.getRecordRef().getRecord_ID() : -1 : -1); request.setM_InOut_ID(candidate.getRecordRef() != null ? candidate.getRecordRef().getTableName().equals(I_M_InOut.Table_Name) ? candidate.getRecordRef().getRecord_ID() : -1 : -1); request.setDateTrx(SystemTime.asTimestamp()); request.setAD_User_ID(UserId.toRepoId(candidate.getUserId())); request.setR_RequestType_ID(candidate.getRequestTypeId().getRepoId()); request.setM_QualityNote_ID(QualityNoteId.toRepoId(candidate.getQualityNoteId())); request.setPerformanceType(candidate.getPerformanceType()); request.setDateDelivered(TimeUtil.asTimestamp(candidate.getDateDelivered())); saveRecord(request); return request; }
Source:
public void testEntriesWithFilter() throws Exception { final PathMatcher m = Mockito.mock(PathMatcher.class); final Path p = Mockito.mock(Path.class); final Stream s = Mockito.mock(Stream.class); Mockito.when(context.entries(Mockito.any(), Mockito.anyBoolean(), Mockito.any())).thenReturn(s); Assert.assertThat(context.entries(p, m), Matchers.sameInstance(s)); Mockito.verify(context).entries(p, true, m); }

Target:
public void testEntriesWithFilter() throws Exception { final PathMatcher filter = Mockito.mock(PathMatcher.class); final Path path = Mockito.mock(Path.class); final Stream stream = Mockito.mock(Stream.class); Mockito.when(context.entries(Mockito.any(), Mockito.anyBoolean(), Mockito.any())) .thenReturn(stream); Assert.assertThat(context.entries(path, filter), Matchers.sameInstance(stream)); Mockito.verify(context).entries(path, true, filter); }
Source:
private void visitorConditionalAnd(BinaryExpressionTree tree) { ConditionalState leftConditionalState = visitCondition(tree.leftOperand()); ConditionalState rightConditionalState = visitCondition(tree.rightOperand(), leftConditionalState.trueState); if (currentConditionalState != null) { leftConditionalState.falseState.merge(leftConditionalState.trueState, null); leftConditionalState.falseState.merge(rightConditionalState.falseState, null); leftConditionalState.trueState.merge(rightConditionalState.trueState, null); currentConditionalState.falseState.apply(leftConditionalState.falseState); currentConditionalState.trueState.apply(leftConditionalState.trueState); } }

Target:
private void visitorConditionalAnd(BinaryExpressionTree tree) { ConditionalState leftConditionalState = visitCondition(tree.leftOperand()); ConditionalState rightConditionalState = visitCondition(tree.rightOperand(), leftConditionalState.trueState); if (currentConditionalState != null) { currentConditionalState.mergeConditionalAnd(leftConditionalState, rightConditionalState); } }
Source:
private boolean shouldRetryImmediately(SingularityRequest request, SingularityDeployStatistics deployStatistics, Optional<SingularityTask> task) { if (!request.getNumRetriesOnFailure().isPresent()) { return false; } if (task.isPresent()) { Optional<SingularityTaskHistoryUpdate> taskHistoryUpdate = taskManager.getTaskHistoryUpdate(task.get().getTaskId(), ExtendedTaskState.TASK_CLEANING); if (taskHistoryUpdate.isPresent() && task.get().getTaskRequest().getPendingTask().getPendingTaskId().getPendingType() == PendingType.ONEOFF && taskHistoryUpdate.get().getStatusMessage().orElse("").contains("USER_REQUESTED")) { return false; } if (task.get().getTaskRequest().getPendingTask().getPendingTaskId().getPendingType() == PendingType.IMMEDIATE && request.getRequestType() == RequestType.SCHEDULED) { return false; } } final int numRetriesInARow = deployStatistics.getNumSequentialRetries(); if (numRetriesInARow >= request.getNumRetriesOnFailure().get()) { LOG.debug("Request had retries in a row, not retrying again (num retries on failure: {})", request.getId(), numRetriesInARow, request.getNumRetriesOnFailure()); return false; } LOG.debug("Request had retries in a row - retrying again (num retries on failure: {})", request.getId(), numRetriesInARow, request.getNumRetriesOnFailure()); return true; }

Target:
private boolean shouldRetryImmediately(SingularityRequest request, SingularityDeployStatistics deployStatistics, Optional<SingularityTask> task) { if (!request.getNumRetriesOnFailure().isPresent()) { return false; } if (task.isPresent()) { if (task.get().getTaskRequest().getPendingTask().getPendingTaskId().getPendingType() == PendingType.IMMEDIATE && request.getRequestType() == RequestType.SCHEDULED) { return false; } Optional<SingularityTaskHistoryUpdate> taskHistoryUpdate = taskManager.getTaskHistoryUpdate(task.get().getTaskId(), ExtendedTaskState.TASK_CLEANING); if (taskHistoryUpdate.isPresent() && request.getRequestType() == RequestType.ON_DEMAND && taskHistoryUpdate.get().getStatusMessage().orElse("").contains("USER_REQUESTED")) { return false; } } final int numRetriesInARow = deployStatistics.getNumSequentialRetries(); if (numRetriesInARow >= request.getNumRetriesOnFailure().get()) { LOG.debug("Request had retries in a row, not retrying again (num retries on failure: {})", request.getId(), numRetriesInARow, request.getNumRetriesOnFailure()); return false; } LOG.debug("Request had retries in a row - retrying again (num retries on failure: {})", request.getId(), numRetriesInARow, request.getNumRetriesOnFailure()); return true; }
Source:
public void visitTryStatement(TryStatementTree tree) { insideTryStatement = true; resourceResolversInTryWithResources = tree.resources().stream() .map(resource -> resource.simpleName().name()) .collect(Collectors.toList()); super.visitTryStatement(tree); resourceResolversInTryWithResources.clear(); insideTryStatement = false; }

Target:
public void visitTryStatement(TryStatementTree tree) { insideTryStatement = true; tree.resources().stream() .map(resource -> resource.simpleName().name()) .forEach(resourceResolversInTryWithResources::add); super.visitTryStatement(tree); resourceResolversInTryWithResources.clear(); insideTryStatement = false; }
Source:
private String generateOutstandingLocksYaml(Map<LockClient, Set<LockRequest>> outstandingLockRequestsMap) { List<Map<String, SimpleLockRequest>> outstandingLockList = Collections.synchronizedList(Lists.newArrayList()); outstandingLockRequestsMap.forEach((client, requestSet) -> { if (requestSet != null) { LockRequest[] lockRequests = requestSet.toArray(new LockRequest[requestSet.size()]); for (LockRequest lockRequest : lockRequests) { outstandingLockList.add(getDescriptorSimpleRequestMap(client, lockRequest)); } } }); Yaml yaml = new Yaml(getDumperOptions()); return yaml.dump(nameObjectForYamlConvertion(outstandingLockList, OUTSTANDING_LOCK_REQUESTS_TITLE)); }

Target:
private Map<String, Object> generateOutstandingLocksYaml(Map<LockClient, Set<LockRequest>> outstandingLockRequestsMap) { Map<String, SimpleLockRequestsWithSameDescriptor> outstandingRequestMap = Maps.newHashMap(); outstandingLockRequestsMap.forEach((client, requestSet) -> { if (requestSet != null) { ImmutableSet<LockRequest> lockRequests = ImmutableSet.copyOf(requestSet); lockRequests.forEach(lockRequest -> { List<SimpleLockRequest> requestList = getDescriptorSimpleRequestMap(client, lockRequest); requestList.forEach(request -> { outstandingRequestMap.putIfAbsent(request.getLockDescriptor(), new SimpleLockRequestsWithSameDescriptor(request.getLockDescriptor())); outstandingRequestMap.get(request.getLockDescriptor()).addLockRequest(request); }); }); } }); List<SimpleLockRequestsWithSameDescriptor> sortedOutstandingRequests = sortOutstandingRequests(outstandingRequestMap.values()); return nameObjectForYamlConvertion(OUTSTANDING_LOCK_REQUESTS_TITLE, sortedOutstandingRequests); }
Source:
public List<String> updateAppLanguageCodes(@NonNull List<String> codes) { appLanguageCodes.clear(); for (String code : codes) { if (!TextUtils.isEmpty(code)) { appLanguageCodes.add(code); } } Prefs.setAppLanguageCodeCsv(StringUtil.listToCsv(appLanguageCodes)); return appLanguageCodes; }

Target:
public List<String> updateAppLanguageCodes(@NonNull List<String> codes) { appLanguageCodes.clear(); for (String code : codes) { if (!TextUtils.isEmpty(code)) { appLanguageCodes.add(code); } } addSystemLanguageCodesIfEmpty(); Prefs.setAppLanguageCodeCsv(StringUtil.listToCsv(appLanguageCodes)); return appLanguageCodes; }
Source:
public void addQuotaPermissionSubject(List<PermissionSubject> quotaPermissionList) { if (!isInternalExecution() && !getStoragePool().getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED)) { for (QuotaConsumptionParameter parameter : getQuotaConsumptionParameters()) { quotaPermissionList.add(new PermissionSubject(parameter.getQuotaGuid(), VdcObjectType.Quota, ActionGroup.CONSUME_QUOTA)); } } }

Target:
public void addQuotaPermissionSubject(List<PermissionSubject> quotaPermissionList) { if (!isInternalExecution() && getStoragePool().getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED) { List<QuotaConsumptionParameter> consumptionParameters = getQuotaConsumptionParameters(); if (consumptionParameters != null) { for (QuotaConsumptionParameter parameter : getQuotaConsumptionParameters()) { quotaPermissionList.add(new PermissionSubject(parameter.getQuotaGuid(), VdcObjectType.Quota, ActionGroup.CONSUME_QUOTA)); } } } }
Source:
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { if (!input.startsWith("##")) { return null; } String tag = input.substring(2).toLowerCase(); boolean anyState = false; if (tag.startsWith("*")) { tag = tag.substring(1); anyState = true; } BlockCategory category = BlockCategories.get(tag); if (category == null) { throw new InputParseException("Unknown block tag: " + tag); } RandomPattern randomPattern = new RandomPattern(); Set<BlockType> blocks = category.getAll(); if (blocks.isEmpty()) { throw new InputParseException("Block tag " + category.getId() + " had no blocks!"); } if (anyState) { for (BlockState blockState : blocks.stream() .flatMap(blockType -> blockType.getAllStates().stream()).collect(Collectors.toList())) { randomPattern.add(new BlockPattern(blockState), 1.0); } } else { for (BlockType blockType : blocks) { randomPattern.add(new BlockPattern(blockType.getDefaultState()), 1.0); } } return randomPattern; }

Target:
public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { if (!input.startsWith("##")) { return null; } String tag = input.substring(2).toLowerCase(); boolean anyState = false; if (tag.startsWith("*")) { tag = tag.substring(1); anyState = true; } BlockCategory category = BlockCategories.get(tag); if (category == null) { throw new InputParseException("Unknown block tag: " + tag); } RandomPattern randomPattern = new RandomPattern(); Set<BlockType> blocks = category.getAll(); if (blocks.isEmpty()) { throw new InputParseException("Block tag " + category.getId() + " had no blocks!"); } if (anyState) { blocks.stream().flatMap(blockType -> blockType.getAllStates().stream()).forEach(state -> randomPattern.add(new BlockPattern(state), 1.0)); } else { for (BlockType blockType : blocks) { randomPattern.add(new BlockPattern(blockType.getDefaultState()), 1.0); } } return randomPattern; }
Source:
public double getCurrentZoomCenter() { return graphView.getZoomCenter(); }

Target:
public float getCurrentZoomCenter() { return graphView.getZoomCenter(); }
Source:
public static JSONObject createJsonObjectOfScopeMapping(ScopeListDTO body) throws APIManagementException { JSONObject responseJson = new JSONObject(); JSONArray scopeJson = new JSONArray(); for (ScopeDTO scope : body.getList()) { JSONObject scopeRoleJson = new JSONObject(); String roles = scope.getRoles().toString().replaceAll("\\[", ""). replaceAll("\\]", "").replaceAll("\\s", ""); scopeRoleJson.put("Name", scope.getName()); scopeRoleJson.put("Roles", roles); scopeJson.put(scopeRoleJson); } responseJson.put("Scope", scopeJson); return responseJson; }

Target:
public static JSONObject createJsonObjectOfScopeMapping(ScopeListDTO body) throws APIManagementException { JSONObject responseJson = new JSONObject(); JSONArray scopeJson = new JSONArray(); for (ScopeDTO scope : body.getList()) { JSONObject scopeRoleJson = new JSONObject(); String roles = scope.getRoles().toString().replaceAll("\\[", ""). replaceAll("\\]", "").replaceAll("\\s", ""); if ( !roles.isEmpty()) { scopeRoleJson.put("Name", scope.getName()); scopeRoleJson.put("Roles", roles); scopeJson.put(scopeRoleJson); } } responseJson.put("Scope", scopeJson); return responseJson; }
Source:
private void connectGithubAccount() { projectSourcePage.clickOnConnectGithubAccountButton(); seleniumWebDriver.switchToNoneCurrentWindow(ideWin); gitHub.waitAuthorizationPageOpened(); gitHub.typeLogin(gitHubUsername); gitHub.typePass(gitHubPassword); gitHub.clickOnSignInButton(); WaitUtils.sleepQuietly(5); if (seleniumWebDriver.getWindowHandles().size() > 1) { gitHub.waitAuthorizeBtn(); gitHub.clickOnAuthorizeBtn(); } seleniumWebDriver.switchTo().window(ideWin); }

Target:
private void connectGithubAccount() { projectSourcePage.clickOnConnectGithubAccountButton(); seleniumWebDriver.switchToNoneCurrentWindow(ideWin); gitHub.waitAuthorizationPageOpened(); gitHub.typeLogin(gitHubUsername); gitHub.typePass(gitHubPassword); gitHub.clickOnSignInButton(); if (gitHub.isAuthorizeButtonPresent()) { gitHub.clickOnAuthorizeBtn(); } seleniumWebDriver.switchTo().window(ideWin); }
Source:
static File searchPath(final String path, final String... lookFor) { for (final String p : path.split(File.pathSeparator)) { for (String command : lookFor) { final File e = new File(p, command); if (e.isFile()) { return e.getAbsoluteFile(); } } } return null; }

Target:
static File searchPath(final String path, final String... lookFor) { for (final String p : path.split(File.pathSeparator)) { for (String command : lookFor) { final File e = new File(p, command); if (e.isFile()) return e.getAbsoluteFile(); } } return null; }
Source:
public void deleteTaskContainerMappings(Iterable<String> taskNames) { for (String taskName : taskNames) { taskContainerMappingMetadataStore.delete(taskName); taskNameToContainerId.remove(taskName); } }

Target:
public void deleteTaskContainerMappings(Iterable<String> taskNames) { for (String taskName : taskNames) { taskContainerMappingMetadataStore.delete(taskName); taskModeMappingMetadataStore.delete(taskName); taskNameToContainerId.remove(taskName); } }
Source:
public AudioController() { setInstance(this); }

Target:
protected AudioController() { setInstance(this); }
Source:
public void setConnectionPoolingProperties( Properties properties ) { ArrayList<String> itemsToRemove = new ArrayList<>(); for ( Iterator<Object> iter = attributes.keySet().iterator(); iter.hasNext(); ) { String key = (String) iter.next(); if ( key.startsWith( ATTRIBUTE_POOLING_PARAMETER_PREFIX ) ) { itemsToRemove.add( key ); } } for ( String item : itemsToRemove ) { attributes.remove( item ); } for ( Iterator<Object> iter = properties.keySet().iterator(); iter.hasNext(); ) { String element = (String) iter.next(); String value = properties.getProperty( element ); if ( !Utils.isEmpty( element ) && !Utils.isEmpty( value ) ) { attributes.put( ATTRIBUTE_POOLING_PARAMETER_PREFIX + element, value ); } } }

Target:
public void setConnectionPoolingProperties( Properties properties ) { for ( Iterator<Object> iter = attributes.keySet().iterator(); iter.hasNext(); ) { String key = (String) iter.next(); if ( key.startsWith( ATTRIBUTE_POOLING_PARAMETER_PREFIX ) ) { iter.remove(); } } for ( Iterator<Object> iter = properties.keySet().iterator(); iter.hasNext(); ) { String element = (String) iter.next(); String value = properties.getProperty( element ); if ( !Utils.isEmpty( element ) && !Utils.isEmpty( value ) ) { attributes.put( ATTRIBUTE_POOLING_PARAMETER_PREFIX + element, value ); } } }
Source:
private ResponseEntity<Object> indexObject(String id) { Map<String, Object> result = new HashMap<>(); result.put("action", "reindex"); result.put("pid", id); PID objectPid = PIDs.get(id); log.info("Updating object " + id); try { indexingService.reindexObject(AgentPrincipals.createFromThread(), objectPid); } catch (Exception e) { result.put("error", e.getMessage()); if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to reindex repository due to {}", e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }

Target:
private ResponseEntity<Object> indexObject(String id) { Map<String, Object> result = new HashMap<>(); result.put("action", "reindex"); result.put("pid", id); PID objectPid = PIDs.get(id); log.info("Indexing object " + id); try { indexingService.reindexObject(AgentPrincipals.createFromThread(), objectPid); } catch (Exception e) { result.put("error", e.getMessage()); if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to reindex object {}", id, e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }
Source:
public void directSelectionAllowed() { FridgeDTO in = createFridgeDTO(); FridgeDTO out = DirectMapper.INSTANCE.map( in ); assertThat( out ).isNotNull(); assertThat( out.getShelve() ).isNotNull(); assertThat( out.getShelve() ).isEqualTo( in.getShelve() ); }

Target:
public void directSelectionAllowed() { FridgeDTO in = createFridgeDTO(); FridgeDTO out = DirectMapper.INSTANCE.map( in ); assertThat( out ).isNotNull(); assertThat( out.getShelve() ).isNotNull(); assertThat( out.getShelve() ).isSameAs( in.getShelve() ); }
Source:
public void run() { final List<CucumberFeature> features = featureSupplier.get(); bus.send(new TestRunStarted(bus.getInstant())); for (CucumberFeature feature : features) { bus.send(new TestSourceRead(bus.getInstant(), feature.getUri().toString(), feature.getSource())); } final List<Future<?>> executingPickles = features.stream() .flatMap(feature -> feature.getPickles().stream()) .filter(filter) .collect(Collectors.collectingAndThen(Collectors.toList(), list -> pickleOrder.orderPickleEvents(list).stream())) .limit(limit > 0 ? limit : Integer.MAX_VALUE) .map(pickleEvent -> executor.submit(() -> runnerSupplier.get().runPickle(pickleEvent))) .collect(Collectors.toList()); executor.shutdown(); List<Throwable> thrown = new ArrayList<>(); for (Future executingPickle : executingPickles) { try { executingPickle.get(); } catch (ExecutionException e) { log.error("Exception while executing pickle", e); thrown.add(e.getCause()); } catch (InterruptedException e) { executor.shutdownNow(); throw new CucumberException(e); } } if (thrown.size() == 1) { throw new CucumberException(thrown.get(0)); } else if (thrown.size() > 1) { throw new CompositeCucumberException(thrown); } bus.send(new TestRunFinished(bus.getInstant())); }

Target:
public void run() { final List<CucumberFeature> features = featureSupplier.get(); bus.send(new TestRunStarted(bus.getInstant())); for (CucumberFeature feature : features) { bus.send(new TestSourceRead(bus.getInstant(), feature.getUri().toString(), feature.getSource())); } final List<Future<?>> executingPickles = features.stream() .flatMap(feature -> feature.getPickles().stream()) .filter(filter) .collect(collectingAndThen(toList(), list -> pickleOrder.orderPickleEvents(list).stream())) .limit(limit > 0 ? limit : Integer.MAX_VALUE) .map(pickleEvent -> executor.submit(() -> runnerSupplier.get().runPickle(pickleEvent))) .collect(toList()); executor.shutdown(); List<Throwable> thrown = new ArrayList<>(); for (Future executingPickle : executingPickles) { try { executingPickle.get(); } catch (ExecutionException e) { log.error("Exception while executing pickle", e); thrown.add(e.getCause()); } catch (InterruptedException e) { executor.shutdownNow(); throw new CucumberException(e); } } if (thrown.size() == 1) { throw new CucumberException(thrown.get(0)); } else if (thrown.size() > 1) { throw new CompositeCucumberException(thrown); } bus.send(new TestRunFinished(bus.getInstant())); }
Source:
public static Pair<Integer,Integer> parse(String portRange) { int idx = portRange.indexOf('-'); if (idx != -1) { int low = Integer.parseInt(portRange.substring(0, idx)); int high = Integer.parseInt(portRange.substring(idx + 1)); if (!VALID_RANGE.contains(low) || !VALID_RANGE.contains(high) || !(low <= high)) { throw new IllegalArgumentException( "Invalid port range specified, only 1024 to 65535 supported."); } return new Pair<>(low, high); } throw new IllegalArgumentException( "Invalid port range specification, must use M-N notation."); }

Target:
public static Pair<Integer,Integer> parse(String portRange) { int idx = portRange.indexOf('-'); if (idx != -1) { int low = Integer.parseInt(portRange.substring(0, idx)); int high = Integer.parseInt(portRange.substring(idx + 1)); if (!VALID_RANGE.contains(low) || !VALID_RANGE.contains(high) || low > high) { throw new IllegalArgumentException( "Invalid port range specified, only 1024 to 65535 supported."); } return new Pair<>(low, high); } throw new IllegalArgumentException( "Invalid port range specification, must use M-N notation."); }
Source:
public void testIsDataStall_EvaluationTcp() { setDataStallEvaluationType(DATA_STALL_EVALUATION_TYPE_TCP); WrappedNetworkMonitor wrappedMonitor = makeMonitorWithTst(METERED_CAPABILITIES, mTcpSocketTracker); wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(wrappedMonitor, DEFAULT_DNS_TIMEOUT_THRESHOLD); assertFalse(wrappedMonitor.isDataStall()); when(mTcpSocketTracker.isDataStallSuspected()).thenReturn(true); setTcpPollingInterval(0); wrappedMonitor.sendTcpPollingEvent(); HandlerUtilsKt.waitForIdle(wrappedMonitor.getHandler(), HANDLER_TIMEOUT_MS); assertTrue(wrappedMonitor.isDataStall()); }

Target:
public void testIsDataStall_EvaluationTcp() { setDataStallEvaluationType(DATA_STALL_EVALUATION_TYPE_TCP); WrappedNetworkMonitor wrappedMonitor = makeMonitor(METERED_CAPABILITIES); wrappedMonitor.setLastProbeTime(SystemClock.elapsedRealtime() - 1000); makeDnsTimeoutEvent(wrappedMonitor, DEFAULT_DNS_TIMEOUT_THRESHOLD); assertFalse(wrappedMonitor.isDataStall()); when(wrappedMonitor.getTcpSocketTracker().isDataStallSuspected()).thenReturn(true); setTcpPollingInterval(0); wrappedMonitor.sendTcpPollingEvent(); HandlerUtilsKt.waitForIdle(wrappedMonitor.getHandler(), HANDLER_TIMEOUT_MS); assertTrue(wrappedMonitor.isDataStall()); }
Source:
public Flux<KeyBase> listKeys() { return service.getKeys(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE).flatMapMany(this::extractAndFetchKeys); }

Target:
public Flux<KeyBase> listKeys() { return service.getKeys(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE).flatMapMany(r -> extractAndFetchKeys(r, Context.NONE)); }
Source:
public void updateReportsAvailability() { updateReportsAvailability(SystemTreeItemType.System); }

Target:
public void updateReportsAvailability() { updateReportsAvailability(getSystemTree().getSelectedItem() == null ? SystemTreeItemType.System : getSystemTree().getSelectedItem().getType()); }
Source:
public static void enhanceRuleMetadata(RuleProvider provider, Rule rule) { if (rule instanceof Context) { Context context = (Context) rule; if (!context.containsKey(RuleMetadata.ORIGIN)) context.put(RuleMetadata.ORIGIN, provider.getMetadata().getOrigin()); if (!context.containsKey(RuleMetadata.RULE_PROVIDER)) context.put(RuleMetadata.RULE_PROVIDER, provider); if (!context.containsKey(RuleMetadata.TAGS)) context.put(RuleMetadata.TAGS, provider.getMetadata().getTags()); } }

Target:
public static void enhanceRuleMetadata(RuleProvider provider, Rule rule) { if (rule instanceof Context) { Context context = (Context) rule; if (!context.containsKey(RuleMetadataType.ORIGIN)) context.put(RuleMetadataType.ORIGIN, provider.getMetadata().getOrigin()); if (!context.containsKey(RuleMetadataType.RULE_PROVIDER)) context.put(RuleMetadataType.RULE_PROVIDER, provider); if (!context.containsKey(RuleMetadataType.TAGS)) context.put(RuleMetadataType.TAGS, provider.getMetadata().getTags()); } }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } Player player = getPlayer(args[0]); if (player == null) { playerMsg(TotalFreedomMod.PLAYER_NOT_FOUND); return true; } if (sender instanceof Player) { if (player == (Player) sender) { playerMsg(ChatColor.RED + "Please, don't try to report yourself."); return true; } } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(ChatColor.RED + "You may not report " + player.getName() + ", they are an admin."); return true; } String reported = player.getName(); String reporter = sender.getName(); String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); sender.sendMessage(ChatColor.GREEN + "Thank you, your report has been successfully logged."); for (Player p : Bukkit.getOnlinePlayers()) { if (TFM_AdminList.isSuperAdmin(p)) { p.sendMessage(ChatColor.RED + "[REPORTS] " + ChatColor.GOLD + reporter + " has reported " + reported + " for " + report); } } return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 2) { return false; } Player player = getPlayer(args[0]); if (player == null) { playerMsg(PLAYER_NOT_FOUND); return true; } if (sender instanceof Player) { if (player.equals(sender_p)) { playerMsg(ChatColor.RED + "Please, don't try to report yourself."); return true; } } if (TFM_AdminList.isSuperAdmin(player)) { playerMsg(ChatColor.RED + "You can not report an admin."); return true; } String report = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " "); TFM_Util.reportAction(sender_p, player, report); playerMsg(ChatColor.GREEN + "Thank you, your report has been successfully logged."); return true; }
Source:
public static long getMillisFromString(String strDate) { long millis = ISO8601.parse(strDate).getTimeInMillis(); return millis; }

Target:
public static long getMillisFromString(String strDate) { return ISO8601.parse(strDate).getTimeInMillis(); }
Source:
private boolean isHelp(List<String> rawArgs) { if(F.isEmpty(rawArgs)) return true; if (rawArgs.size() > 2) return false; boolean help = false; boolean experimental = false; for (String arg : rawArgs) { if (CMD_HELP.equalsIgnoreCase(arg)) help = true; else if (CMD_ENABLE_EXPERIMENTAL.equalsIgnoreCase(arg)) experimental = true; } return (help && experimental) || ((help || experimental) && rawArgs.size() == 1); }

Target:
private boolean isHelp(List<String> rawArgs) { if (F.isEmpty(rawArgs)) return true; if (rawArgs.size() > 2) return false; boolean help = false; boolean experimental = false; for (String arg : rawArgs) { if (CMD_HELP.equalsIgnoreCase(arg)) help = true; else if (CMD_ENABLE_EXPERIMENTAL.equalsIgnoreCase(arg)) experimental = true; else return false; } return help || experimental; }
Source:
@Test public void testTimezone() throws Exception { CronTabList tabs = CronTabList.create("TZ=Australia/Sydney\nH * * * *\nH * * * *", Hash.from("seed")); List<Integer> times = new ArrayList<Integer>(); for (int i = 0; i < 60; i++) { GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("Australia/Sydney")); calendar.set(2013, Calendar.APRIL, 3, 11, i, 0); if (tabs.check(calendar)) { times.add(i); } } assertEquals("[35, 56]", times.toString()); }

Target:
@Test public void testTimezone() throws Exception { CronTabList tabs = CronTabList.create("TZ=Australia/Sydney\nH * * * *\nH * * * *", Hash.from("seed")); List<Integer> times = new ArrayList<Integer>(); for (int i = 0; i < 60; i++) { GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); calendar.set(2013, Calendar.APRIL, 3, 11, i, 0); if (tabs.check(calendar)) { times.add(i); } } assertEquals("[35, 56]", times.toString()); }
Source:
private void storeStatement(final Statement statement) throws IOException, IllegalArgumentException { final boolean isValidPredicate = validPredicates == null || validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate()); if (!isValidPredicate || !(statement.getObject() instanceof Literal)) { return; } final DateTime[] indexDateTimes = new DateTime[2]; extractDateTime(statement, indexDateTimes); if (indexDateTimes[0]==null) { return; } if (!this.isInit) throw new RuntimeException("Method .init() was not called (or failed) before attempting to store statements."); try { if (indexDateTimes[1] != null) { final TemporalInterval interval = new TemporalInterval(new TemporalInstantRfc3339(indexDateTimes[0]), new TemporalInstantRfc3339(indexDateTimes[1])); addInterval(temporalIndexBatchWriter, interval, statement); } else { final TemporalInstant instant = new TemporalInstantRfc3339(indexDateTimes[0]); addInstant(temporalIndexBatchWriter, instant, statement); } } catch (final MutationsRejectedException e) { throw new IOException("While adding interval/instant for statement =" + statement, e); } }

Target:
private void storeStatement(final Statement statement) throws IOException, IllegalArgumentException { Objects.requireNonNull(temporalIndexBatchWriter,"This is not initialized for writing. Must call setMultiTableBatchWriter() and init()."); final boolean isValidPredicate = validPredicates == null || validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate()); if (!isValidPredicate || !(statement.getObject() instanceof Literal)) { return; } final DateTime[] indexDateTimes = new DateTime[2]; extractDateTime(statement, indexDateTimes); if (indexDateTimes[0]==null) { return; } if (!this.isInit) throw new RuntimeException("Method .init() was not called (or failed) before attempting to store statements."); try { if (indexDateTimes[1] != null) { final TemporalInterval interval = new TemporalInterval(new TemporalInstantRfc3339(indexDateTimes[0]), new TemporalInstantRfc3339(indexDateTimes[1])); addInterval(temporalIndexBatchWriter, interval, statement); } else { final TemporalInstant instant = new TemporalInstantRfc3339(indexDateTimes[0]); addInstant(temporalIndexBatchWriter, instant, statement); } } catch (final MutationsRejectedException e) { throw new IOException("While adding interval/instant for statement =" + statement, e); } }