-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DialogResourceProviderImpl throws StringIndexOutOfBoundsException #2313
Comments
Found by some debugging, that the problematic slingmodel is of class |
The problem seems to be that this slingModel does neither specify a resourceType in the @model annotation nor as a property, thus the default @badvision How can we handle this best? I am not really deep into this feature at all, so I wonder if we should rather change this feature to require a opt-in from each SlingModel which wants to use this feature. |
Yeah - this impl is too aggressive. It seems like like a a better paradigm would’ve been:
If we need to add a breaking change to to this to prevent it from breaking general use, we should roll it into 5.0.0 Do we like one of the above options best? And/or are there others? I like #2. |
I would opt for variant of 1: A sling model must provide an extra property to be considered by the DialogResourceProvider (plus of course providing the model property in the @model annotation). Option 2 limits the flexibility and also the Sling Models do not know the concept of ResourceSuperTypes as the resource resolution does. In any case the case of a fallback RT (like |
The drawback with #1 is the user of this feature has to know/manage what is included, so if new SM's are added, they have to know to manage that list. Either way is fine with me, but as a user, i would just want all SlingModels that are built for this purpose to be automatically made available to me. sling:resourceSuperType might not be the right hook; but i wonder if there could be another way to self-identify; perhaps they have to register against some specific interface? |
I agree we need a breaking change to fix the dialog resource provider, but the issue is that sling models aren't held in a registry that lends itself to interrogation easily. Therefore the more prudent solution is to change the @DialogProvider annotation to be a compiler-side annotation and introduce a processor which decorates the model to implement a proper service interface, etc. I can then remove the feature flag mess as well and bind to only a specific OSGi service interface. |
OK the new implementation simply does not register resource providers if the resource type is not known. This is a more sensible approach overall. There were other performance issues unreported, but nonetheless present, with the previous dialog provider factory and those were resolved with this change as well. |
Required Information
I have ticked the "enabled" checkbox for the PID com.adobe.acs.commons.mcp.impl.DialogResourceProviderFactoryImpl and now I get periodically this exception in the logs:
This AEM instance is pretty much ootb (next to ACS AEM Commons).
I also haven't found any message which should be printed on DEBUG level when there were problems with evaluating the resourcetype of a sling model (see
acs-aem-commons/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/DialogResourceProviderImpl.java
Line 98 in 7f8eb08
The text was updated successfully, but these errors were encountered: