Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-138788

java.lang.ClassCastException when data provider output is list and field is not a String

    Details

      Description

      Steps to reproduce

      1. Allow Access Local Network in System Settings > Data Provider
      2. Create a new data provider named DP
        1. URL: http://localhost:8080/api/jsonws/country/get-countries
        2. Output name: position, path $..position and type List;
      3. Create a new form F
        1. add a field of type Select from List
        2. in the Basic tab of the Select field choose From Data Provider in the Create List selector
        3. Choose DP as the Data Provider
        4. Choose position as Output Parameter
      4. Save the form
      5. Publish the form
      6. Go to the Form URL

      Expected behavior

      A list of zeroes is shown in the select from list field

      Current behavior

      No option is shown in the select from list field and the following stacktrace can be seen in the logs:

      2021-09-07 12:09:36.942 WARN  [http-nio-9132-exec-6][DDMDataProviderInvokerImpl:62] Unable to invoke DDM Data Provider instance ID 43143
      com.netflix.hystrix.exception.HystrixRuntimeException: DDMDataProviderInvokeCommand#eesti failed and no fallback available.
      	at com.netflix.hystrix.AbstractCommand$22.call(AbstractCommand.java:822) ~[?:?]
      	at com.netflix.hystrix.AbstractCommand$22.call(AbstractCommand.java:807) ~[?:?]
      	at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4.onError(OperatorOnErrorResumeNextViaFunction.java:140) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[?:?]
      	at com.netflix.hystrix.AbstractCommand$DeprecatedOnFallbackHookApplication$1.onError(AbstractCommand.java:1472) ~[?:?]
      	at com.netflix.hystrix.AbstractCommand$FallbackHookApplication$1.onError(AbstractCommand.java:1397) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[?:?]
      	at rx.observers.Subscribers$5.onError(Subscribers.java:230) ~[?:?]
      	at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44) ~[?:?]
      	at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4.onError(OperatorOnErrorResumeNextViaFunction.java:142) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[?:?]
      	at com.netflix.hystrix.AbstractCommand$HystrixObservableTimeoutOperator$3.onError(AbstractCommand.java:1194) ~[?:?]
      	at rx.internal.operators.OperatorSubscribeOn$1$1.onError(OperatorSubscribeOn.java:59) ~[?:?]
      	at rx.observers.Subscribers$5.onError(Subscribers.java:230) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87) ~[?:?]
      	at rx.observers.Subscribers$5.onError(Subscribers.java:230) ~[?:?]
      	at com.netflix.hystrix.AbstractCommand$DeprecatedOnRunHookApplication$1.onError(AbstractCommand.java:1431) ~[?:?]
      	at com.netflix.hystrix.AbstractCommand$ExecutionHookApplication$1.onError(AbstractCommand.java:1362) ~[?:?]
      	at rx.observers.Subscribers$5.onError(Subscribers.java:230) ~[?:?]
      	at rx.observers.Subscribers$5.onError(Subscribers.java:230) ~[?:?]
      	at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:44) ~[?:?]
      	at rx.internal.operators.OnSubscribeThrow.call(OnSubscribeThrow.java:28) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:51) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:41) ~[?:?]
      	at rx.internal.operators.OnSubscribeDoOnEach.call(OnSubscribeDoOnEach.java:30) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48) ~[?:?]
      	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30) ~[?:?]
      	at rx.Observable.unsafeSubscribe(Observable.java:10151) ~[?:?]
      	at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94) ~[?:?]
      	at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56) ~[?:?]
      	at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47) ~[?:?]
      	at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69) ~[?:?]
      	at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) ~[?:?]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
      	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
      	at java.lang.Thread.run(Thread.java:829) [?:?]
      Caused by: com.liferay.dynamic.data.mapping.data.provider.DDMDataProviderException: java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.String (java.lang.Double and java.lang.String are in module java.base of loader 'bootstrap')
      	at com.liferay.dynamic.data.mapping.data.provider.internal.rest.DDMRESTDataProvider.getData(DDMRESTDataProvider.java:109) ~[?:?]
      	at com.liferay.dynamic.data.mapping.data.provider.internal.DDMDataProviderInvokeCommand.run(DDMDataProviderInvokeCommand.java:80) ~[?:?]
      	at com.liferay.dynamic.data.mapping.data.provider.internal.DDMDataProviderInvokeCommand.run(DDMDataProviderInvokeCommand.java:35) ~[?:?]
      	at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302) ~[?:?]
      	at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) ~[?:?]
      	... 26 more
      Caused by: java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.String (java.lang.Double and java.lang.String are in module java.base of loader 'bootstrap')
      	at com.liferay.dynamic.data.mapping.data.provider.internal.rest.DDMRESTDataProvider.createDDMDataProviderResponse(DDMRESTDataProvider.java:200) ~[?:?]
      	at com.liferay.dynamic.data.mapping.data.provider.internal.rest.DDMRESTDataProvider.doGetData(DDMRESTDataProvider.java:316) ~[?:?]
      	at com.liferay.dynamic.data.mapping.data.provider.internal.rest.DDMRESTDataProvider.getData(DDMRESTDataProvider.java:88) ~[?:?]
      	at com.liferay.dynamic.data.mapping.data.provider.internal.DDMDataProviderInvokeCommand.run(DDMDataProviderInvokeCommand.java:80) ~[?:?]
      	at com.liferay.dynamic.data.mapping.data.provider.internal.DDMDataProviderInvokeCommand.run(DDMDataProviderInvokeCommand.java:35) ~[?:?]
      	at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302) ~[?:?]
      	at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298) ~[?:?]
      	at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) ~[?:?]
      	... 26 more
      
      

      Additional notes

      In 7.3.x there's no position in the countries' data and stacktrace won't be seen in the logs unless com.liferay.dynamic.data.mapping.data.provider.internal.DDMDataProviderInvokerImpl has log level of at least WARN, but the behavior is the same under the hood.

      Reproduced on master @ 4bc11e114e0e1c29363855f50d7f859796b44857
      Reproduced on 7.3.x @ 096f06d69804625bfb798e66e356e967ad342d6e
      Reproduced on 7.2.x @ a06cde0441958e572dba142dfe1fef24a0c1ff02
      Reproduced on 7.1.x @ a4793db3caac0a50135d3d7e6081bf7dc69bb2f4

        Attachments

          Activity

            People

            Assignee:
            leticia.chiu Leticia Chiu
            Reporter:
            cleydyr.albuquerque Cleydyr Albuquerque
            Participants of an Issue:
            Recent user:
            Clarissa Velazquez
            Engineering Assignee:
            Cleydyr Albuquerque
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              12 weeks, 4 days ago

                Packages

                Version Package
                7.1.10 DXP FP26
                7.1.10.7 SP7
                7.1.X
                7.2.10 DXP FP15
                7.2.X
                7.3.X
                7.4.13 DXP GA1
                7.4.3.4 CE GA4
                Master