dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
865 stars 467 forks source link

Scripting API stops working when contentlet with image added in other than default language #22919

Open muhammadfaizandotcms opened 2 years ago

muhammadfaizandotcms commented 2 years ago

Describe the bug

Scripting API stops working, when contentlet with image added in other than default language and does not resume even after restarting the server.

To Reproduce

  1. Go to demo site and login
  2. Create a new content type with one field type of image.
  3. Add new contentlet of default language and attach image.
  4. Check this URL:https://demo.dotcms.com/api/vtl/search It's working fine.
  5. Now create the same version of contentlet in another language and check https://demo.dotcms.com/api/vtl/search.
  6. {"message": "Contentlet is null"} error coming from the API

Additional context

ERROR vtl.VTLResource: Exception on VTL endpoint. GET method: Contentlet is null
com.dotmarketing.business.DotStateException: Contentlet is null
at com.dotmarketing.portlets.fileassets.business.FileAssetAPIImpl.fromContentlet_aroundBody10(FileAssetAPIImpl.java:251) ~[dotcms_21.06.10_999999.jar:?]
at com.dotmarketing.portlets.fileassets.business.FileAssetAPIImpl$AjcClosure11.run(FileAssetAPIImpl.java:1) ~[dotcms_21.06.10_999999.jar:?]
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) ~[aspectjrt-1.9.2.jar:?]
at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42) ~[dotcms_21.06.10_999999.jar:?]
at com.dotcms.aspects.interceptors.CloseDBIfOpenedMethodInterceptor.invoke(CloseDBIfOpenedMethodInterceptor.java:29) ~[dotcms_21.06.10_999999.jar:?]
at com.dotcms.aspects.aspectj.CloseDBIfOpenedAspect.invoke(CloseDBIfOpenedAspect.java:41) ~[dotcms_21.06.10_999999.jar:?]
at com.dotmarketing.portlets.fileassets.business.FileAssetAPIImpl.fromContentlet(FileAssetAPIImpl.java:249) ~[dotcms_21.06.10_999999.jar:?]
at com.dotcms.rest.api.v1.vtl.FileVelocityReader.getVelocity(FileVelocityReader.java:66) ~[dotcms_21.06.10_999999.jar:?]
at com.dotcms.rest.api.v1.vtl.VTLResource.processRequest(VTLResource.java:537) ~[dotcms_21.06.10_999999.jar:?]
at com.dotcms.rest.api.v1.vtl.VTLResource.get(VTLResource.java:104) ~[dotcms_21.06.10_999999.jar:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

Screencast from 09-01-2022 06:02:08 PM.webm

john-thomas-dotcms commented 2 years ago

This is a blocker for a priority customer implementation: https://dotcms.zendesk.com/agent/tickets/107915

muhammadfaizandotcms commented 2 years ago

The code tries to get the GET.vtl in the currentLanguage. I created the get.vtl in ES language and the Scripting API resumed working. https://github.com/dotCMS/core/blob/master/dotCMS/src/main/java/com/dotcms/rest/api/v1/vtl/FileVelocityReader.java#L60

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.