Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-15597

Fix ClassCast exception when declaring aggregates from studio

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: Core

      Description

      When building a cv with aggregates filter with studio, the search doc model has a multi-valued field to handle the selected bucket (nxs:stringlist)

      The problem is that studio declares nxs:stringList as:

        <xs:simpleType name="stringList"> 
          <xs:list itemType="xs:string"/> 
        </xs:simpleType>  
      

      which gives a String[]

      while the platform declares nxs:stringlist as:

        <xs:complexType name="stringList">
          <xs:sequence>
            <xs:element name="item" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      

      which gives a List<String>.

      As a result, we have the following error when filtering:

      Caused by: javax.el.ELException: Error reading 'aggregates' on type org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider
      at javax.el.BeanELResolver.getValue(BeanELResolver.java:98)
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
      at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
      at org.jboss.el.parser.AstChoice.getValue(AstChoice.java:29)
      at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
      at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
      ... 348 more
      Caused by: java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.util.List
      at org.nuxeo.ecm.platform.query.core.AggregateBase.getSelection(AggregateBase.java:88)
      at org.nuxeo.elasticsearch.aggregate.TermAggregate.getEsFilter(TermAggregate.java:94)
      at org.nuxeo.elasticsearch.aggregate.TermAggregate.getEsFilter(TermAggregate.java:47)
      at org.nuxeo.elasticsearch.query.NxQueryBuilder.getAggregateFilterExceptFor(NxQueryBuilder.java:255)
      at org.nuxeo.elasticsearch.query.NxQueryBuilder.getEsAggregates(NxQueryBuilder.java:277)
      at org.nuxeo.elasticsearch.query.NxQueryBuilder.updateRequest(NxQueryBuilder.java:294)
      at org.nuxeo.elasticsearch.core.ElasticsearchServiceImpl.buildEsSearchRequest(ElasticsearchServiceImpl.java:180)
      at org.nuxeo.elasticsearch.core.ElasticsearchServiceImpl.search(ElasticsearchServiceImpl.java:156)
      at org.nuxeo.elasticsearch.core.ElasticsearchServiceImpl.queryAndAggregate(ElasticsearchServiceImpl.java:104)
      at org.nuxeo.elasticsearch.ElasticSearchComponent.queryAndAggregate(ElasticSearchComponent.java:353)
      at org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider.getCurrentPage(ElasticSearchNxqlPageProvider.java:98)
      at org.nuxeo.elasticsearch.provider.ElasticSearchNxqlPageProvider.getAggregates(ElasticSearchNxqlPageProvider.java:167)
      at sun.reflect.GeneratedMethodAccessor1098.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at javax.el.BeanELResolver.getValue(BeanELResolver.java:87)
      ... 355 more
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 hours
                2h
                Remaining:
                Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified