auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String generateUniqueStudentEmailStatsInWholeSystem(){ String q = "SELECT FROM " + Student.class.getName(); List<Student> allStudents = (List<Student>) pm.newQuery(q).execute(); HashSet<String> set = new HashSet<String>(); int totalRealStudent = 0; for(Student s: allStudents){ if(!isTestingStudentData(s)){ set.add(s.getEmail()); totalRealStudent ++; } } String result = "===============Unique Student Emails===============\n" + "Format=> Total Unique Emails [Total Emails]\n" + "===================================================\n" + set.size() + " [ " + totalRealStudent + " ]\n"; return result; }

Target:
private String generateUniqueStudentEmailStatsInWholeSystem(){ String q = "SELECT FROM " + Student.class.getName(); List<Student> allStudents = (List<Student>) pm.newQuery(q).execute(); HashSet<String> set = new HashSet<String>(); int totalRealStudent = 0; for(Student s: allStudents){ if(!isTestingStudentData(s)){ set.add(s.getEmail().toLowerCase()); totalRealStudent ++; } } String result = "===============Unique Student Emails===============\n" + "Format=> Total Unique Emails [Total Emails]\n" + "===================================================\n" + set.size() + " [ " + totalRealStudent + " ]\n"; return result; }
Source:
private static boolean isOperator(Signature signature) { for (OperatorType operator : OperatorType.values()) { if (signature.getName().equals(FunctionUtils.mangleOperatorName(operator))) { return true; } } return false; }

Target:
private static boolean isOperator(Signature signature) { for (OperatorType operator : OperatorType.values()) { if (signature.getName().equals(mangleOperatorName(operator))) { return true; } } return false; }
Source:
private @Nullable long[] getCardIdsForModel(long modelId, int[] ords) { String cardIdsToDeleteSql = "select c2.id from cards c2, notes n2 where c2.nid=n2.id and n2.mid = " + modelId + " and c2.ord in " + Utils.ids2str(ords); long[] cids = Utils.toPrimitive(mCol.getDb().queryColumn(Long.class, cardIdsToDeleteSql, 0)); Timber.d("getCardIdsForModel found %s cards to delete for model %s and ords %s", cids.length, modelId, Utils.ids2str(ords)); String noteCountPreDeleteSql = "select count() from notes where mid = " + modelId; int preDeleteNoteCount = mCol.getDb().queryScalar(noteCountPreDeleteSql); Timber.d("preDeleteNoteCount is %s", preDeleteNoteCount); String noteCountPostDeleteSql = "select count(n.id) from cards c, notes n where c.nid=n.id and n.mid = " + modelId + " and c.id not in (" + cardIdsToDeleteSql + ")"; int postDeleteNoteCount = mCol.getDb().queryScalar(noteCountPostDeleteSql); Timber.d("postDeleteNoteCount would be %s", postDeleteNoteCount); if (preDeleteNoteCount != postDeleteNoteCount) { Timber.d("There will be orphan notes if these cards are deleted."); return null; } Timber.d("Deleting these cards will not orphan notes."); return cids; }

Target:
public @Nullable long[] getCardIdsForModel(long modelId, int[] ords) { String cardIdsToDeleteSql = "select c2.id from cards c2, notes n2 where c2.nid=n2.id and n2.mid = " + modelId + " and c2.ord in " + Utils.ids2str(ords); long[] cids = Utils.toPrimitive(mCol.getDb().queryColumn(Long.class, cardIdsToDeleteSql, 0)); Timber.d("getCardIdsForModel found %s cards to delete for model %s and ords %s", cids.length, modelId, Utils.ids2str(ords)); String noteCountPreDeleteSql = "select count(distinct(nid)) from cards where nid in (select id from notes where mid = ?)"; int preDeleteNoteCount = mCol.getDb().queryScalar(noteCountPreDeleteSql, new Long[] {modelId}); Timber.d("noteCountPreDeleteSql was '%s'", noteCountPreDeleteSql); Timber.d("preDeleteNoteCount is %s", preDeleteNoteCount); String noteCountPostDeleteSql = "select count(distinct(nid)) from cards where nid in (select id from notes where mid = ?) and ord not in " + Utils.ids2str(ords); Timber.d("noteCountPostDeleteSql was '%s'", noteCountPostDeleteSql); int postDeleteNoteCount = mCol.getDb().queryScalar(noteCountPostDeleteSql, new Long[] {modelId}); Timber.d("postDeleteNoteCount would be %s", postDeleteNoteCount); if (preDeleteNoteCount != postDeleteNoteCount) { Timber.d("There will be orphan notes if these cards are deleted."); return null; } Timber.d("Deleting these cards will not orphan notes."); return cids; }
Source:
public User userSetWorkloadCredentials(String user, String hashedPassword, String unencryptedKrbPrincipalKey, Optional<Instant> expiration, List<String> sshPublicKeys) throws FreeIpaClientException { Map<String, Object> params = new HashMap<>(); List<String> attributes = new ArrayList<>(); if (null != hashedPassword && !hashedPassword.isBlank()) { attributes.add("cdpHashedPassword=" + hashedPassword); attributes.add("cdpUnencryptedKrbPrincipalKey=" + unencryptedKrbPrincipalKey); attributes.add("krbPasswordExpiration=" + formatDate(expiration)); params.put("setattr", attributes); } params.put("ipasshpubkey", sshPublicKeys); return userMod(user, params); }

Target:
public User userSetWorkloadCredentials(String user, String hashedPassword, String unencryptedKrbPrincipalKey, Optional<Instant> expiration, List<String> sshPublicKeys) throws FreeIpaClientException { Map<String, Object> params = new HashMap<>(); List<String> attributes = new ArrayList<>(); if (StringUtils.isNotBlank(hashedPassword)) { attributes.add("cdpHashedPassword=" + hashedPassword); attributes.add("cdpUnencryptedKrbPrincipalKey=" + unencryptedKrbPrincipalKey); attributes.add("krbPasswordExpiration=" + formatDate(expiration)); params.put("setattr", attributes); } params.put("ipasshpubkey", sshPublicKeys); return userMod(user, params); }
Source:
private void captureVarargsPart(Invocation invocation) { if (!invocation.getMethod().isVarArgs()) { return; } int indexOfVararg = invocation.getRawArguments().length - 1; for (ArgumentMatcher m : uniqueMatcherSet(indexOfVararg)) { if (m instanceof CapturesArguments) { Object rawArgument = invocation.getRawArguments()[indexOfVararg]; for (int i = 0; i < getLength(rawArgument); i++) { ((CapturesArguments) m).captureFrom(getArgument(rawArgument, i)); } } } }

Target:
private void captureVarargsPart(Invocation invocation) { if (!invocation.getMethod().isVarArgs()) { return; } int indexOfVararg = invocation.getRawArguments().length - 1; for (ArgumentMatcher m : uniqueMatcherSet(indexOfVararg)) { if (m instanceof CapturesArguments) { Object rawArgument = invocation.getRawArguments()[indexOfVararg]; if (rawArgument != null) { for (int i = 0; i < Array.getLength(rawArgument); i++) { ((CapturesArguments) m).captureFrom(Array.get(rawArgument, i)); } } else { ((CapturesArguments) m).captureFrom(null); } } } }
Source:
private void manageProcessDependenciesForIndex(Template template) throws CustomResponseException, IOException { Process process = template.getProcess(); if (template.getIndexAction() == IndexAction.DELETE) { if (process != null) { process.getTemplates().remove(template); serviceManager.getProcessService().saveToIndex(process); } } else { if (process != null) { serviceManager.getProcessService().saveToIndex(process); } } }

Target:
private void manageProcessDependenciesForIndex(Template template) throws CustomResponseException, IOException { Process process = template.getProcess(); if (template.getIndexAction() == IndexAction.DELETE) { process.getTemplates().remove(template); serviceManager.getProcessService().saveToIndex(process); } else { serviceManager.getProcessService().saveToIndex(process); } }
Source:
private void addDnsConfiguration(ReportedConfigurations result) { if (!isDefaultRouteNetwork) { return; } List<NameServer> nameServersOfNetworkAttachment = getNameServers(networkAttachment.getDnsResolverConfiguration()); List<NameServer> nameServersOfNetwork = getNameServers(network.getDnsResolverConfiguration()); List<NameServer> nameServersOfHost = getNameServers(vds.getDnsResolverConfiguration()); boolean engineDoesNotContainDnsConfiguration = nameServersOfNetworkAttachment == null && nameServersOfNetwork == null; List<NameServer> expectedNameServers = nameServersOfNetworkAttachment != null ? nameServersOfNetworkAttachment : nameServersOfNetwork; boolean inSync = isDhcpUsed(networkAttachment) || engineDoesNotContainDnsConfiguration || Objects.equals(nameServersOfHost, expectedNameServers); result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), addressesAsString(expectedNameServers), inSync); }

Target:
private void addDnsConfiguration(ReportedConfigurations result) { if (!isDefaultRouteNetwork) { return; } List<NameServer> nameServersOfNetworkAttachment = getNameServers(networkAttachment.getDnsResolverConfiguration()); List<NameServer> nameServersOfNetwork = getNameServers(network.getDnsResolverConfiguration()); List<NameServer> nameServersOfHost = getNameServers(reportedDnsResolverConfiguration); boolean engineDoesNotContainDnsConfiguration = nameServersOfNetworkAttachment == null && nameServersOfNetwork == null; List<NameServer> expectedNameServers = nameServersOfNetworkAttachment != null ? nameServersOfNetworkAttachment : nameServersOfNetwork; boolean inSync = isDhcpUsed(networkAttachment) || engineDoesNotContainDnsConfiguration || Objects.equals(nameServersOfHost, expectedNameServers); result.add(DNS_CONFIGURATION, addressesAsString(nameServersOfHost), addressesAsString(expectedNameServers), inSync); }
Source:
public String getText(Object element) { String text = super.getText(element); if (element instanceof ViewpointItemImpl) { ViewpointItemImpl viewpointItem = (ViewpointItemImpl) element; if (!viewpointItem.isViewpointEnabledInSession()) { text += " (" + Messages.GraphicalRepresentationHandler_disabledViewpoint_label + ")"; } } else if (element instanceof RepresentationDescriptionItemImpl) { RepresentationDescriptionItemImpl descriptionItem = (RepresentationDescriptionItemImpl) element; text += " (" + descriptionItem.getChildren().size() + " " + Messages.GraphicalRepresentationHandler_representationNumber_label + ")"; } return text; }

Target:
public String getText(Object element) { String text = super.getText(element); if (element instanceof ViewpointItemImpl) { ViewpointItemImpl viewpointItem = (ViewpointItemImpl) element; if (!viewpointItem.isViewpointEnabledInSession()) { text += " (" + Messages.GraphicalRepresentationHandler_disabledViewpoint_label + ")"; } } else if (element instanceof RepresentationDescriptionItemImpl) { RepresentationDescriptionItemImpl descriptionItem = (RepresentationDescriptionItemImpl) element; text += MessageFormat.format(Messages.GraphicalRepresentationHandler_representationNumber_label, descriptionItem.getChildren().size()); } return text; }
Source:
private boolean skipDispatch(HttpServletRequest request) { if (isAsyncDispatch(request) && shouldNotFilterAsyncDispatch()) { return true; } return request.getAttribute(WebUtils.ERROR_REQUEST_URI_ATTRIBUTE) != null && shouldNotFilterErrorDispatch(); }

Target:
private boolean skipDispatch(HttpServletRequest request) { if (isAsyncDispatch(request) && shouldNotFilterAsyncDispatch()) { return true; } if (request.getAttribute(WebUtils.ERROR_REQUEST_URI_ATTRIBUTE) != null && shouldNotFilterErrorDispatch()) { return true; } return false; }
Source:
protected void addStorageDomainStatusIllegalMessage() { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2); StorageDomainStatus status = getStorageDomainStatus(); StorageDomainSharedStatus sharedStatus = getStorageDomainSharedStatus(); Object messageParameter; if (status == StorageDomainStatus.Unknown && sharedStatus != null) { messageParameter = sharedStatus; } else { messageParameter = status; } addCanDoActionMessageVariable("status", messageParameter); }

Target:
protected void addStorageDomainStatusIllegalMessage() { addCanDoActionMessage(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2); StorageDomainStatus status = getStorageDomainStatus(); StorageDomainSharedStatus sharedStatus = getStorageDomainSharedStatus(); Object messageParameter = status; if (status == StorageDomainStatus.Unknown && sharedStatus != null) { messageParameter = sharedStatus; } addCanDoActionMessageVariable("status", messageParameter); }
Source:
public static void announceForAccessibility(View view, CharSequence text) { final AccessibilityManager manager = (AccessibilityManager) view.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (!manager.isEnabled()) { return; } final int eventType = AccessibilityEvent.TYPE_ANNOUNCEMENT; final AccessibilityEvent event = AccessibilityEvent.obtain(eventType); event.getText().add(text); event.setSource(view); event.setEnabled(view.isEnabled()); event.setClassName(view.getClass().getName()); event.setPackageName(view.getContext().getPackageName()); manager.sendAccessibilityEvent(event); }

Target:
public static void announceForAccessibility(View view, CharSequence text) { final AccessibilityManager manager = (AccessibilityManager) view.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (!manager.isEnabled()) { return; } final AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT); event.getText().add(text); event.setSource(view); event.setEnabled(view.isEnabled()); event.setClassName(view.getClass().getName()); event.setPackageName(view.getContext().getPackageName()); manager.sendAccessibilityEvent(event); }
Source:
public void resolveProxyCrossReferences(Resource resource) { if (!initialized) { initialize(); } adapter.resolveProxyCrossReferences(resource); }

Target:
public void resolveProxyCrossReferences(Resource resource) { if (initialized) { adapter.resolveProxyCrossReferences(resource); } }
Source:
protected Query newFieldQuery(Analyzer analyzer, String field, String queryText, boolean quoted) throws ParseException { if (field == null || field.length() == 0) { return super.newFieldQuery(analyzer, field, queryText, quoted); } Matcher m = PROPERTY_NAME_PATTERN.matcher(field); if (m.matches() && m.group(2) != null) { return super.newFieldQuery(analyzer, field, queryText, quoted); } String fieldPrefix = field + "_"; List<Query> disjucts = new ArrayList<>(); for (String fieldName : fieldNameToVisibilityMap.getFieldNames()) { if (fieldName.startsWith(fieldPrefix)) { String visibility = fieldNameToVisibilityMap.getFieldVisibility(fieldName); if (VisibilityUtils.canRead(visibility, authorizations)) { Query termQuery = super.newFieldQuery(analyzer, fieldName, queryText, quoted); disjucts.add(termQuery); } } } DisjunctionMaxQuery query = new DisjunctionMaxQuery(disjucts, 0.0f); if (query.getDisjuncts().size() == 0) { return super.newFieldQuery(analyzer, field, queryText, quoted); } return query; }

Target:
protected Query newFieldQuery(Analyzer analyzer, String field, String queryText, boolean quoted) throws ParseException { if (field == null || field.length() == 0) { return super.newFieldQuery(analyzer, field, queryText, quoted); } Matcher m = PROPERTY_NAME_PATTERN.matcher(field); if (m.matches() && m.group(2) != null) { return super.newFieldQuery(analyzer, field, queryText, quoted); } String fieldPrefix = field + "_"; List<Query> disjuncts = new ArrayList<>(); for (String fieldName : fieldNameToVisibilityMap.getFieldNames()) { if (fieldName.startsWith(fieldPrefix)) { String visibility = fieldNameToVisibilityMap.getFieldVisibility(fieldName); if (VisibilityUtils.canRead(visibility, authorizations)) { Query termQuery = super.newFieldQuery(analyzer, fieldName, queryText, quoted); disjuncts.add(termQuery); } } } DisjunctionMaxQuery query = new DisjunctionMaxQuery(disjuncts, 0.0f); if (query.getDisjuncts().size() == 0) { return super.newFieldQuery(analyzer, field, queryText, quoted); } return query; }
Source:
public void outject(@Observes MethodExecuted event) { Type returnType = event.getControllerMethod().getMethod().getGenericReturnType(); if (!returnType.equals(Void.TYPE)) { String name = extractor.nameFor(returnType); Object value = this.info.getResult(); logger.debug("outjecting {}={}", name, value); result.include(name, value); } }

Target:
public void outject(@Observes MethodExecuted event) { Type returnType = event.getMethodReturnType(); if (!returnType.equals(Void.TYPE)) { String name = extractor.nameFor(returnType); Object value = this.info.getResult(); logger.debug("outjecting {}={}", name, value); result.include(name, value); } }
Source:
Mono<CosmosContainerResponse> read(CosmosContainerRequestOptions options, Context context) { Mono<CosmosContainerResponse> responseMono = readInternal(options); return database.getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, this.readContainerSpanName, database.getId(), database.getClient().getServiceEndpoint()); }

Target:
Mono<CosmosContainerResponse> read(CosmosContainerRequestOptions options, Context context) { Mono<CosmosContainerResponse> responseMono = database.getDocClientWrapper().readCollection(getLink(), ModelBridgeInternal.toRequestOptions(options)) .map(response -> ModelBridgeInternal.createCosmosContainerResponse(response)).single(); return database.getClient().getTracerProvider().traceEnabledCosmosResponsePublisher(responseMono, context, this.readContainerSpanName, database.getId(), database.getClient().getServiceEndpoint()); }
Source:
public int getDocumentCount() throws DocumentStoreException { Misc.checkState(this.isOpen(), "Database is closed"); try { return get(queue.submit(new GetDocumentCountCallable())); } catch (ExecutionException e) { String message = "Failed to get document count"; logger.log(Level.SEVERE, message, e); throw new DocumentStoreException(e.getCause()); } }

Target:
public int getDocumentCount() throws DocumentStoreException { Misc.checkState(this.isOpen(), "Database is closed"); try { return get(queue.submit(new GetDocumentCountCallable())); } catch (ExecutionException e) { String message = "Failed to get document count"; logger.log(Level.SEVERE, message, e); throw new DocumentStoreException(message, e.getCause()); } }
Source:
public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) throws IOException { Mono<Void> upload = this.blockBlobAsyncClient.uploadFromFile(filePath, headers, metadata, accessConditions); try { if (timeout == null) { upload.block(); } else { upload.block(timeout); } } catch (UncheckedIOException e) { throw e.getCause(); } }

Target:
public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) throws IOException { Mono<Void> upload = this.blockBlobAsyncClient.uploadFromFile(filePath, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, headers, metadata, accessConditions); try { if (timeout == null) { upload.block(); } else { upload.block(timeout); } } catch (UncheckedIOException e) { throw e.getCause(); } }
Source:
private Iterator<CliCommand> getAllCommands() { ServiceLoader<CliCommand> loader = ServiceLoader.load(CliCommand.class); return loader.iterator(); }

Target:
private Iterator<CliCommand> getAllCommands() { final ServiceLoader<CliCommand> loader = ServiceLoader.load(CliCommand.class); return loader.iterator(); }
Source:
public void setUp() { mockConfiguration = mock(TestcontainersConfiguration.class); underTest = new ConfigurationFileImageNameSubstitutor(mockConfiguration); }

Target:
public void setUp() { underTest = new ConfigurationFileImageNameSubstitutor(TestcontainersConfiguration.getInstance()); }
Source:
protected void fill(Control control, MouseEvent event, Point pt) { TimeGraphControl timeGraphControl = (TimeGraphControl) control; if ((event.stateMask & SWT.MODIFIER_MASK) != SWT.SHIFT) { ILinkEvent linkEvent = timeGraphControl.getArrow(pt); if (linkEvent != null) { fillValues(linkEvent); } } if (getTipComposite().getChildren().length == 0) { ITimeGraphEntry entry = timeGraphControl.getEntry(pt); fillValues(pt, timeGraphControl, entry); Iterable<IMarkerEvent> markers = getMarkers(timeGraphControl , entry, pt); for (IMarkerEvent marker : markers) { fillValues(marker); } } }

Target:
protected void fill(Control control, MouseEvent event, Point pt) { TimeGraphControl timeGraphControl = (TimeGraphControl) control; if ((event.stateMask & SWT.MODIFIER_MASK) != SWT.SHIFT) { ILinkEvent linkEvent = timeGraphControl.getArrow(pt); if (linkEvent != null) { fillValues(linkEvent); } } if (getTipComposite().getChildren().length == 0) { ITimeGraphEntry entry = timeGraphControl.getEntry(pt); if (entry == null) { return; } fillValues(pt, timeGraphControl, entry); Iterable<IMarkerEvent> markers = getMarkers(timeGraphControl, entry, pt); for (IMarkerEvent marker : markers) { fillValues(marker); } } }
Source:
public void callPublicMethodWithDateParam() { Assert.assertNull(controller.getModel().getDateValue()); Date value = new Date(); controller.invoke(PUBLIC_WITH_DATE_PARAM_ACTION, new Param(PARAM_NAME, value)); Assert.assertEquals(controller.getModel().getDateValue(), value); }

Target:
public void callPublicMethodWithDateParam() { Assert.assertNull(controller.getModel().getDateValue()); final Date value = new Date(); controller.invoke(PUBLIC_WITH_DATE_PARAM_ACTION, new Param(PARAM_NAME, value)); Assert.assertEquals(controller.getModel().getDateValue(), value); }
Source:
private void ensureCapacity(int minCapacity) { int oldCapacity = objectData.length; if (minCapacity > oldCapacity) { int newCapacity = (oldCapacity * 3) / 2 + 1; if (newCapacity < minCapacity) { newCapacity = minCapacity; } final int rem = newCapacity % arity; newCapacity += (arity - rem); if (cjMaxSize > 0 && newCapacity > cjMaxSize) { throw MondrianResource.instance().TotalMembersLimitExceeded.ex( newCapacity, cjMaxSize); } Util.checkCJResultLimit(newCapacity); objectData = Util.copyOf(objectData, newCapacity); } }

Target:
private void ensureCapacity( int minCapacity ) { int oldCapacity = objectData.length; if ( minCapacity > oldCapacity ) { int newCapacity = ( oldCapacity * 3 ) / 2 + 1; if ( newCapacity < minCapacity ) { newCapacity = minCapacity; } final int rem = newCapacity % arity; newCapacity += ( arity - rem ); if ( CJ_MAX_SIZE > 0 && newCapacity > CJ_MAX_SIZE ) { throw MondrianResource.instance().TotalMembersLimitExceeded.ex( newCapacity, CJ_MAX_SIZE ); } Util.checkCJResultLimit( newCapacity ); objectData = Util.copyOf( objectData, newCapacity ); } }
Source:
public Object onPullRequest(Runnable closure) throws ANTLRException { GitHubPRTriggerDslContext context = new GitHubPRTriggerDslContext(); executeInContext(closure, context); GitHubPRTrigger trigger = new GitHubPRTrigger(context.cron(), context.mode(), context.events()); trigger.setPreStatus(context.isSetPreStatus()); trigger.setCancelQueued(context.isSetCancelQueued()); trigger.setSkipFirstRun(context.isSetSkipFirstRun()); return trigger; }

Target:
public Object onPullRequest(Runnable closure) throws ANTLRException { GitHubPRTriggerDslContext context = new GitHubPRTriggerDslContext(); executeInContext(closure, context); GitHubPRTrigger trigger = new GitHubPRTrigger(context.cron(), context.mode(), context.events()); trigger.setPreStatus(context.isSetPreStatus()); trigger.setCancelQueued(context.isCancelQueued()); return trigger; }
Source:
public void run(TestInformation testInfo, ITestInvocationListener listener) throws DeviceNotAvailableException { mTestInfo = testInfo; mFilterHelper.addAllIncludeAnnotation(mIncludeAnnotations); mFilterHelper.addAllExcludeAnnotation(mExcludeAnnotations); try { List<Class<?>> classes = getClasses(); if (!mSkipTestClassCheck) { if (classes.isEmpty()) { throw new IllegalArgumentException("No '--class' option was specified."); } } if (mMethodName != null && classes.size() > 1) { throw new IllegalArgumentException( String.format( "'--method' only supports one '--class' name. Multiple were given: '%s'", classes)); } } catch (IllegalArgumentException e) { listener.testRunStarted(this.getClass().getCanonicalName(), 0); FailureDescription failureDescription = FailureDescription.create(StreamUtil.getStackTrace(e)); failureDescription.setFailureStatus(FailureStatus.TEST_FAILURE); listener.testRunFailed(failureDescription); listener.testRunEnded(0L, new HashMap<String, Metric>()); throw e; } if (mEnableHostDeviceLogs) { PrettyTestEventLogger logger = new PrettyTestEventLogger(mTestInfo.getDevices()); listener = new ResultForwarder(logger, listener); } if (mTestMethods != null) { runTestCases(listener); } else { runTestClasses(listener); } }

Target:
public void run(TestInformation testInfo, ITestInvocationListener listener) throws DeviceNotAvailableException { mTestInfo = testInfo; mFilterHelper.addAllIncludeAnnotation(mIncludeAnnotations); mFilterHelper.addAllExcludeAnnotation(mExcludeAnnotations); try { List<Class<?>> classes = getClasses(); if (!mSkipTestClassCheck) { if (classes.isEmpty()) { throw new IllegalArgumentException("No '--class' option was specified."); } } if (mMethodName != null && classes.size() > 1) { throw new IllegalArgumentException( String.format( "'--method' only supports one '--class' name. Multiple were " + "given: '%s'", classes)); } } catch (IllegalArgumentException e) { listener.testRunStarted(this.getClass().getCanonicalName(), 0); FailureDescription failureDescription = FailureDescription.create(StreamUtil.getStackTrace(e)); failureDescription.setFailureStatus(FailureStatus.TEST_FAILURE); listener.testRunFailed(failureDescription); listener.testRunEnded(0L, new HashMap<String, Metric>()); throw e; } if (mEnableHostDeviceLogs) { PrettyTestEventLogger logger = new PrettyTestEventLogger(mTestInfo.getDevices()); listener = new ResultForwarder(logger, listener); } if (mTestMethods != null) { runTestCases(listener); } else { runTestClasses(listener); } }
Source:
protected void initialize(Object... args) { service = Framework.getLocalService(TokenAuthenticationService.class); }

Target:
protected void initialize(Object... args) { service = Framework.getService(TokenAuthenticationService.class); }
Source:
public String toString() { Bundle myBundle = getBundle(); if (myBundle == null) return ""; String name = myBundle.getSymbolicName(); return name == null ? Long.valueOf(myBundle.getBundleId()).toString() : name; }

Target:
public String toString() { Bundle myBundle = getBundle(); if (myBundle == null) return ""; String name = myBundle.getSymbolicName(); return name == null ? String.valueOf(myBundle.getBundleId()) : name; }
Source:
protected void validateDemographics(CertifiedProductSearchDetails product) { super.validateDemographics(product); if(StringUtils.isEmpty(product.getReportFileLocation())) { product.getErrorMessages().add("A test result summary URL is required."); } for(CertificationResult cert : product.getCertificationResults()) { if(cert.getTestToolsUsed() != null && cert.getTestToolsUsed().size() > 0) { for(CertificationResultTestTool testTool : cert.getTestToolsUsed()) { if(StringUtils.isEmpty(testTool.getTestToolName())) { product.getErrorMessages().add("There was no test tool name found for certification " + cert.getNumber() + "."); } else { TestToolDTO tt = super.testToolDao.getByName(testTool.getTestToolName()); if(tt != null && tt.isRetired() && super.icsCode.equals("0")) { if(super.hasIcsConflict) { product.getWarningMessages().add("Test Tool '" + testTool.getTestToolName() + "' can not be used for criteria '" + cert.getNumber() + "', as it is a retired tool, and this Certified Product does not carry ICS."); } else if(tt != null) { product.getErrorMessages().add("Test Tool '" + testTool.getTestToolName() + "' can not be used for criteria '" + cert.getNumber() + "', as it is a retired tool, and this Certified Product does not carry ICS."); } } } } } } }

Target:
protected void validateDemographics(CertifiedProductSearchDetails product) { super.validateDemographics(product); if(StringUtils.isEmpty(product.getReportFileLocation())) { product.getErrorMessages().add("A test result summary URL is required."); } for(CertificationResult cert : product.getCertificationResults()) { if(cert.getTestToolsUsed() != null && cert.getTestToolsUsed().size() > 0) { for(CertificationResultTestTool testTool : cert.getTestToolsUsed()) { if(StringUtils.isEmpty(testTool.getTestToolName())) { product.getErrorMessages().add("There was no test tool name found for certification " + cert.getNumber() + "."); } else { TestToolDTO tt = super.testToolDao.getByName(testTool.getTestToolName()); if(tt == null){ product.getErrorMessages().add("No test tool with " + testTool.getTestToolName() + " was found for criteria " + cert.getNumber() + "."); } else if(tt.isRetired() && super.icsCode.equals("0")) { if(super.hasIcsConflict) { product.getWarningMessages().add("Test Tool '" + testTool.getTestToolName() + "' can not be used for criteria '" + cert.getNumber() + "', as it is a retired tool, and this Certified Product does not carry ICS."); } else { product.getErrorMessages().add("Test Tool '" + testTool.getTestToolName() + "' can not be used for criteria '" + cert.getNumber() + "', as it is a retired tool, and this Certified Product does not carry ICS."); } } } } } } }
Source:
public int execute() throws HiveException { Table tbl = desc.toTable(context.getConf()); LOG.debug("creating table on {}", tbl.getFullyQualifiedName(), tbl.getDataLocation()); boolean dataLocationChanged = false; if (desc.getReplicationSpec().isInReplicationScope()) { Table existingTable = context.getDb().getTable(tbl.getDbName(), tbl.getTableName(), false); if (existingTable != null) { if (desc.getReplicationSpec().allowEventReplacementInto(existingTable.getParameters())) { desc.setReplaceMode(true); ReplicationSpec.copyLastReplId(existingTable.getParameters(), tbl.getParameters()); if (existingTable.getTableType().equals(TableType.MANAGED_TABLE) && tbl.getTableType().equals(TableType.EXTERNAL_TABLE) && (!existingTable.getDataLocation().equals(tbl.getDataLocation()))) { dataLocationChanged = true; } } else { LOG.debug("DDLTask: Create Table is skipped as table is newer than update", desc.getTableName()); return 0; } } } if (desc.getReplaceMode()) { createTableReplaceMode(tbl, dataLocationChanged); } else { createTableNonReplaceMode(tbl); } DDLUtils.addIfAbsentByName(new WriteEntity(tbl, WriteEntity.WriteType.DDL_NO_LOCK), context); return 0; }

Target:
public int execute() throws HiveException { Table tbl = desc.toTable(context.getConf()); LOG.debug("creating table on {}", tbl.getFullyQualifiedName(), tbl.getDataLocation()); boolean replDataLocationChanged = false; if (desc.getReplicationSpec().isInReplicationScope()) { Table existingTable = context.getDb().getTable(tbl.getDbName(), tbl.getTableName(), false); if (existingTable != null) { if (desc.getReplicationSpec().allowEventReplacementInto(existingTable.getParameters())) { desc.setReplaceMode(true); ReplicationSpec.copyLastReplId(existingTable.getParameters(), tbl.getParameters()); if (existingTable.getTableType().equals(TableType.MANAGED_TABLE) && tbl.getTableType().equals(TableType.EXTERNAL_TABLE) && (!existingTable.getDataLocation().equals(tbl.getDataLocation()))) { replDataLocationChanged = true; } } else { LOG.debug("DDLTask: Create Table is skipped as table is newer than update", desc.getTableName()); return 0; } } } if (desc.getReplaceMode()) { createTableReplaceMode(tbl, replDataLocationChanged); } else { createTableNonReplaceMode(tbl); } DDLUtils.addIfAbsentByName(new WriteEntity(tbl, WriteEntity.WriteType.DDL_NO_LOCK), context); return 0; }
Source:
boolean stateFlagsTest() { final long tagCBoxPtr = OS.GetWindowLongPtr(handle, 0); if (tagCBoxPtr == 0) return false; final long stateFlagsPtr = tagCBoxPtr + stateFlagsOffset; int stateFlags[] = new int[1]; OS.MoveMemory(stateFlags, stateFlagsPtr, 4); return (stateFlags[0] == 0x02006002); }

Target:
boolean stateFlagsTest() { final long tagCBoxPtr = OS.GetWindowLongPtr(handle, 0); if (tagCBoxPtr != 0) { final long stateFlagsPtr = tagCBoxPtr + stateFlagsOffset; int stateFlags[] = new int[1]; OS.MoveMemory(stateFlags, stateFlagsPtr, 4); return (stateFlags[0] == 0x02006002); } return false; }
Source:
public TaskResult execute() { TaskResult result = new TaskResult(); Map<String, String> props = new HashMap<>(); props.putAll(tester.globalProperties); props.putAll(taskProperties); Batch.builder() .setGlobalProperties(props) .setEnableLoggingConfiguration(true) .addComponents(new EnvironmentInformation("mediumTest", "1.0"), tester.pluginInstaller, tester.globalRefProvider, tester.qualityProfiles, tester.rulesLoader, tester.branchConfigurationLoader, tester.projectRefProvider, tester.activeRules, tester.serverIssues, mock(ScmConfiguration.class), new DefaultDebtModel(), new FakeSettingsLoader(), result) .setLogOutput(tester.logOutput) .build().execute(); return result; }

Target:
public TaskResult execute() { TaskResult result = new TaskResult(); Map<String, String> props = new HashMap<>(); props.putAll(tester.globalProperties); props.putAll(taskProperties); Batch.builder() .setGlobalProperties(props) .setEnableLoggingConfiguration(true) .addComponents(new EnvironmentInformation("mediumTest", "1.0"), tester.pluginInstaller, tester.globalRefProvider, tester.qualityProfiles, tester.rulesLoader, tester.branchConfigurationLoader, tester.projectRefProvider, tester.activeRules, tester.serverIssues, new DefaultDebtModel(), new FakeSettingsLoader(), result) .setLogOutput(tester.logOutput) .build().execute(); return result; }
Source:
static String getRelModuleOutputPath() throws NoCurrentCaseException { return Case.getCurrentCaseThrows().getModuleOutputDirectoryRelativePath() + File.separator + "RecentActivity"; }

Target:
static String getRelModuleOutputPath() throws NoCurrentCaseException { return Paths.get(Case.getCurrentCaseThrows().getModuleOutputDirectoryRelativePath(), "RecentActivity").normalize().toString() ; }
Source:
public void cancel(InterpreterContext context) { if (livyVersion.isCancelSupported()) { try { cancelStatement(paragraphId2StmtIdMapping.get(context.getParagraphId())); } catch (LivyException e) { LOGGER.warn("Fail to cancel statement for paragraph ", paragraphId2StmtIdMapping.get(context.getParagraphId()), context.getParagraphId()); } finally { paragraphId2StmtIdMapping.remove(context.getParagraphId()); } } else { LOGGER.warn("cancel is not supported for this version of livy: " + livyVersion); } }

Target:
public void cancel(InterpreterContext context) { if (livyVersion.isCancelSupported()) { String paraId = context.getParagraphId(); Integer stmtId = paragraphId2StmtIdMapping.get(paraId); try { if (stmtId != null) { cancelStatement(stmtId); } } catch (LivyException e) { LOGGER.error("Fail to cancel statement " + stmtId + " for paragraph " + paraId, e); } finally { paragraphId2StmtIdMapping.remove(paraId); } } else { LOGGER.warn("cancel is not supported for this version of livy: " + livyVersion); } }
Source:
protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); List<String> extraParams = new ArrayList<>(); extraParams.add(getNewDisk().getId().toString()); Number sizeInGiB = SizeConverter.convert(getParameters().getDiskInfo().getSize(), SizeConverter.SizeUnit.BYTES, SizeConverter.SizeUnit.GiB); extraParams.add(Long.toString(sizeInGiB.longValue())); Map<String, Object> driverOptions = new HashMap<>(managedBlockStorage.getDriverOptions()); if (managedBlockStorage.getDriverSensitiveOptions() != null) { driverOptions.putAll(managedBlockStorage.getDriverSensitiveOptions()); } CinderlibReturnValue returnValue; try { CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson(driverOptions, false), extraParams); returnValue = cinderlibExecutor.runCommand(CinderlibCommand.EXTEND_VOLUME, params); } catch (Exception e) { log.error("Failed executing volume extension", e); setSucceeded(false); return; } if (!returnValue.getSucceed()) { setSucceeded(false); return; } updateDisk(); setSucceeded(true); }

Target:
protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); List<String> extraParams = new ArrayList<>(); extraParams.add(getNewDisk().getId().toString()); Number sizeInGiB = SizeConverter.convert(getParameters().getDiskInfo().getSize(), SizeConverter.SizeUnit.BYTES, SizeConverter.SizeUnit.GiB); extraParams.add(Long.toString(sizeInGiB.longValue())); Map<String, Object> driverOptions = new HashMap<>(managedBlockStorage.getDriverOptions()); if (managedBlockStorage.getDriverSensitiveOptions() != null) { driverOptions.putAll(managedBlockStorage.getDriverSensitiveOptions()); } CinderlibReturnValue returnValue; try { CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson(driverOptions, false), extraParams); returnValue = cinderlibExecutor.runCommand(CinderlibCommand.EXTEND_VOLUME, params); } catch (Exception e) { log.error("Failed executing volume extension", e); return; } if (!returnValue.getSucceed()) { return; } updateDisk(); setSucceeded(true); }
Source:
private static CompletableFuture<List<? extends ICodeMining>> getCodeMinings(ITextViewer viewer, List<ICodeMiningProvider> providers, IProgressMonitor monitor) { List<CompletableFuture<List<? extends ICodeMining>>> com= providers.stream() .map(provider -> provider.provideCodeMinings(viewer, monitor)) .filter(c -> c != null) .map(future -> future.exceptionally(CodeMiningManager::logCodeMiningProviderException)) .collect(Collectors.toList()); return CompletableFuture.allOf(com.toArray(new CompletableFuture[com.size()])).thenApply( v -> com.stream().map(CompletableFuture::join).flatMap(l -> l.stream()).collect(Collectors.toList())); }

Target:
private static CompletableFuture<List<? extends ICodeMining>> getCodeMinings(ITextViewer viewer, List<ICodeMiningProvider> providers, IProgressMonitor monitor) { List<CompletableFuture<List<? extends ICodeMining>>> com= providers.stream() .map(provider -> provider.provideCodeMinings(viewer, monitor)) .filter(c -> c != null) .map(future -> future.exceptionally(e -> { logCodeMiningProviderException(e); return Collections.emptyList(); })) .collect(Collectors.toList()); return CompletableFuture.allOf(com.toArray(new CompletableFuture[com.size()])).thenApply( v -> com.stream().map(CompletableFuture::join).flatMap(l -> l.stream()).collect(Collectors.toList())); }
Source:
protected void deleteBlob(final String blobIdStr, final String serviceId, FutureResult<Void> futureResult, final Callback<Void> callback, boolean attemptChunkDeletes) { try { deleteManager.submitDeleteBlobOperation(blobIdStr, serviceId, futureResult, (Void result, Exception exception) -> { if (exception == null && attemptChunkDeletes) { try { initiateChunkDeletesIfAny(blobIdStr, serviceId); } catch (RouterException e) { logger.warn( "RouterException for same reason should have been thrown by submitDeleteBlobOperation() and no callback should be triggered.", e); } } if (exception == null && !attemptChunkDeletes) { routerMetrics.skippedGetBlobCount.inc(); } if (callback != null) { callback.onCompletion(result, exception); } }); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.onDeleteBlobError(e); NonBlockingRouter.completeOperation(futureResult, callback, null, e); } routerCallback.onPollReady(); }

Target:
protected void deleteBlob(final String blobIdStr, final String serviceId, FutureResult<Void> futureResult, final Callback<Void> callback, boolean attemptChunkDeletes) { try { deleteManager.submitDeleteBlobOperation(blobIdStr, serviceId, futureResult, (Void result, Exception exception) -> { if (exception == null && attemptChunkDeletes) { try { initiateChunkDeletesIfAny(blobIdStr, serviceId); } catch (RouterException e) { logger.warn( "RouterException for same reason should have been thrown by submitDeleteBlobOperation() and no callback should be triggered.", e); } } if (callback != null) { callback.onCompletion(result, exception); } }); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.onDeleteBlobError(e); NonBlockingRouter.completeOperation(futureResult, callback, null, e); } routerCallback.onPollReady(); }
Source:
public synchronized SdkEnvironment getSdkEnvironment(SdkConfig sdkConfig, boolean layoutLibIncluded) { if (!layoutLibIncluded) { return getSdkEnvironment(sdkConfig); } else { Pair<InstrumentationConfiguration, SdkConfig> key = Pair.create(instrumentationConfig, sdkConfig); SdkEnvironment sdkEnvironment = sdkToEnvironment.get(key); if (sdkEnvironment == null) { URL[] urls = dependencyResolver.getLocalArtifactUrls(sdkConfig.getSdkClasspathDependencies()); ClassLoader robolectricClassLoader = new InstrumentingClassLoader(instrumentationConfig, layoutLibIncluded, urls); sdkEnvironment = new SdkEnvironment(sdkConfig, robolectricClassLoader); sdkToEnvironment.put(key, sdkEnvironment); } return sdkEnvironment; } }

Target:
public synchronized SdkEnvironment getSdkEnvironment(SdkConfig sdkConfig, boolean layoutLibIncluded) { Pair<InstrumentationConfiguration, SdkConfig> key = Pair.create(instrumentationConfig, sdkConfig); SdkEnvironment sdkEnvironment = sdkToEnvironment.get(key); if (sdkEnvironment == null) { URL[] urls = dependencyResolver.getLocalArtifactUrls(sdkConfig.getSdkClasspathDependencies()); ClassLoader robolectricClassLoader = new InstrumentingClassLoader(instrumentationConfig, layoutLibIncluded, urls); sdkEnvironment = new SdkEnvironment(sdkConfig, robolectricClassLoader); if (!layoutLibIncluded) { sdkToEnvironment.put(key, sdkEnvironment); } } return sdkEnvironment; }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); restore(savedInstanceState); try { if( courseData == null ) { final Bundle bundle = getArguments(); courseData = (EnrolledCoursesResponse) bundle.getSerializable(Router.EXTRA_ENROLLMENT); courseComponentId = (String) bundle.getString(Router.EXTRA_COURSE_COMPONENT_ID); } } catch (Exception ex) { logger.error(ex); } loadData(getView()); String lastAccessedId = getArguments().getString(Router.EXTRA_LAST_ACCESSED_ID); if (!TextUtils.isEmpty(lastAccessedId)) { updateRowSelection(lastAccessedId); } }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); restore(savedInstanceState); final Bundle bundle = getArguments(); if( courseData == null ) { courseData = (EnrolledCoursesResponse) bundle.getSerializable(Router.EXTRA_ENROLLMENT); courseComponentId = bundle.getString(Router.EXTRA_COURSE_COMPONENT_ID); } loadData(getView()); updateRowSelection(bundle.getString(Router.EXTRA_LAST_ACCESSED_ID)); }
Source:
public void performFailureSuccessIssueClosedWithComponents() throws Exception { JiraCreateIssueNotifier notifier = spy(new JiraCreateIssueNotifier(JIRA_PROJECT, "", "", "")); doReturn(site).when(notifier).getSiteForProject(Mockito.any()); Issue issue = mock(Issue.class); Status status = new Status(null, null, "", JiraCreateIssueNotifier.finishedStatuses.Closed.toString() , null, null); when(session.createIssue(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyList(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyLong())).thenReturn(issue); when(issue.getStatus()).thenReturn(status); when(session.getIssueByKey(Mockito.anyString())).thenReturn(issue); assertEquals(0, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.SUCCESS); when(currentBuild.getResult()).thenReturn(Result.FAILURE); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(1, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.FAILURE); when(currentBuild.getResult()).thenReturn(Result.SUCCESS); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(0, temporaryDirectory.list().length); }

Target:
public void performFailureSuccessIssueClosedWithComponents() throws Exception { JiraCreateIssueNotifier notifier = spy(new JiraCreateIssueNotifier(JIRA_PROJECT, "", "", "")); doReturn(site).when(notifier).getSiteForProject(Mockito.any()); Issue issue = mock(Issue.class); Status status = new Status(null, null, JiraCreateIssueNotifier.finishedStatuses.Closed.toString() , null, null, null); when(session.createIssue(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyList(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyLong())).thenReturn(issue); when(issue.getStatus()).thenReturn(status); when(session.getIssueByKey(Mockito.anyString())).thenReturn(issue); assertEquals(0, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.SUCCESS); when(currentBuild.getResult()).thenReturn(Result.FAILURE); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(1, temporaryDirectory.list().length); when(previousBuild.getResult()).thenReturn(Result.FAILURE); when(currentBuild.getResult()).thenReturn(Result.SUCCESS); assertTrue(notifier.perform(currentBuild, launcher, buildListener)); assertEquals(0, temporaryDirectory.list().length); }
Source:
public static Function<Iterable<?>, String> formatterForIterable(final String pattern) { return new Function<Iterable<?>, String>() { public String apply(@Nullable Iterable<?> input) { return String.format(pattern, Iterables.toArray(input, Object.class)); } }; }

Target:
public static Function<Iterable<?>, String> formatterForIterable(final String pattern) { return new Function<Iterable<?>, String>() { public String apply(@Nullable Iterable<?> input) { Object[] arr = (input == null) ? null : Iterables.toArray(input, Object.class); return String.format(pattern, arr); } }; }
Source:
public void start() { try { this.server.start(); } catch (Exception e) { LOGGER.error("Fail to start the Jetty server... please check the availability of the port."); throw Throwables.propagate(e); } }

Target:
public void start() { try { this.server.start(); } catch (final Exception e) { LOGGER.error("Fail to start the Jetty server... please check the availability of the port."); Throwables.propagate(e); } }
Source:
public Mono<byte[]> getSessionState(String sessionId) { if (isDisposed.get()) { return monoError(logger, new IllegalStateException( String.format(INVALID_OPERATION_DISPOSED_RECEIVER, "getSessionState"))); } else if (!receiverOptions.isSessionReceiver()) { return monoError(logger, new IllegalStateException("Cannot get session state on a non-session receiver.")); } if (sessionManager != null) { if (validateSessionId(sessionId)) { return monoError(logger, new IllegalArgumentException(String.format( "This receiver client is tied to session %s. It can't be used for another session(%s).", receiverOptions.getSessionId(), sessionId))); } return sessionManager.getSessionState(sessionId); } else { return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType)) .flatMap(channel -> channel.getSessionState(sessionId, getLinkName(sessionId))); } }

Target:
Mono<byte[]> getSessionState(String sessionId) { if (isDisposed.get()) { return monoError(logger, new IllegalStateException( String.format(INVALID_OPERATION_DISPOSED_RECEIVER, "getSessionState"))); } else if (!receiverOptions.isSessionReceiver()) { return monoError(logger, new IllegalStateException("Cannot get session state on a non-session receiver.")); } if (sessionManager != null) { return sessionManager.getSessionState(sessionId); } else { return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType)) .flatMap(channel -> channel.getSessionState(sessionId, getLinkName(sessionId))); } }
Source:
public void numberOfJsonObjectsInResultArrayProducesEqualLengthList() throws Exception { JsonObject result = new JsonObject(); JsonArray results = new JsonArray(); for(int i = 1; i<=3; i++) { JsonObject element = new JsonObject(); element.addProperty("experiment_accession", "e"+ i); element.addProperty("contrast_id", "c"+ i); element.addProperty("bioentity_identifier", "id"+ i); element.addProperty("species", "org"+ i); element.addProperty("p_value", 1.11); element.addProperty("fold_change", -1.12); element.addProperty("t_statistic", 0.0); element.addProperty("keyword_symbol", i); results.add(element); } result.add("results", results); List<DiffAnalytics> expression = subject.parseDifferentialResults(result); assertThat(expression,hasSize(3)); }

Target:
public void numberOfJsonObjectsInResultArrayProducesEqualLengthList() throws Exception { JsonObject result = buildJsonObject(3,false); List<DiffAnalytics> expression = subject.parseDifferentialResults(result); assertThat(expression,hasSize(3)); }