Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-12405

Search issue when model set a default value in a criteria

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • 4.9.0
    • None
    • None
    • None
    • 4.9.0 M9
    • Oui

      I have this model

      <extension class="org.ametys.cms.search.ui.model.StaticSearchUIModel">
          <SearchModel>
              <content-types>
                 <content-type id="project"/>
              </content-types>
              
              <simple-search-criteria>
                  <item ref="project-thisyear" multiple="true">
                      <label i18n="false">Année d'activité</label>
                      <test-operator>eq</test-operator>
                      <default-value>0</default-value>
                  </item>

      where project-thisyear is a long

      thie code leads to an exception

      Caused by: java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, java.lang.Long
      	at java.base/java.util.ArrayList.toArray(ArrayList.java:401)
      	at org.ametys.runtime.model.DefaultElementDefinition.getDefaultValue(DefaultElementDefinition.java:302)
      	at org.ametys.cms.search.model.impl.AbstractCriterionDefinition._defaultValueToJSON(AbstractCriterionDefinition.java:69)
      	at org.ametys.runtime.model.DefaultElementDefinition._toJSON(DefaultElementDefinition.java:401)
      	at org.ametys.cms.search.model.impl.ReferencingSearchModelCriterionDefinition._toJSON(ReferencingSearchModelCriterionDefinition.java:119)
      

            Unassigned Unassigned
            raphael Raphaël Franchet
            Caroline Bayle Caroline Bayle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: