[GitHub] [sling-org-apache-sling-event] klcodanr commented on a diff in pull request #30: Removing infinite loop

2023-06-27 Thread via GitHub


klcodanr commented on code in PR #30:
URL: 
https://github.com/apache/sling-org-apache-sling-event/pull/30#discussion_r1244188308


##
src/main/java/org/apache/sling/event/impl/jobs/stats/GaugeSupport.java:
##
@@ -150,9 +154,10 @@ private void registerWithSuffix(String suffix, int count, 
Gauge value) {
 metricRegistry.register(metricName, value);
 gaugeMetricNames.add(metricName);
 } catch (IllegalArgumentException e) {
-if (queueName != null) {
-registerWithSuffix(suffix, count + 1, value);
-}
+logger.error("Failed to register mbean with suffix " + suffix, e);
+// if (queueName != null) {
+// registerWithSuffix(suffix, count + 1, value);
+// }

Review Comment:
   Rather than just failing, this should add a recursion limit. I wouldn't 
_think_ it would have to be large say 5(?), but it should retry x times 
incrementing the count and then log the error and quit.



##
src/main/java/org/apache/sling/event/impl/jobs/stats/GaugeSupport.java:
##
@@ -48,6 +50,8 @@ class GaugeSupport {
 private final Set gaugeMetricNames = new HashSet<>();
 private final String queueName;
 
+Logger logger = LoggerFactory.getLogger(this.getClass());

Review Comment:
   This should be private (and probably static final) most Sling projects use 
log or LOG as name the convention.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-event] pat-lego opened a new pull request, #30: Removing infinite loop

2023-06-27 Thread via GitHub


pat-lego opened a new pull request, #30:
URL: https://github.com/apache/sling-org-apache-sling-event/pull/30

   Removing infinite loop


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: Sling Model Exporter: Prevent serializing of a ResourceResolver

2023-06-27 Thread Jörg Hoh
Hi Radu,

In general I agree, that it is too easy to leak implementation details
here. Maybe I can use these mixins in the first way to write a lot of WARN
messages in such a case, plus the option not to serialize them (by default
turned off, so serializing them nevertheless).

But my priority is not the prevention of these leaks, but rather mitigating
the.risk of breaking the serialization process. In that case I did not
experience issues with serializing the list of resources.

Jörg


Am Di., 27. Juni 2023 um 19:12 Uhr schrieb Radu Cotescu :

> Hi Jörg,
>
> I think you would have the same problem with that model given the other
> property, namely that list of resources.
>
> Unfortunately I don’t see an easy way out other than documenting this
> aspect and advising developers to avoid exposing implementation details.
> Whatever you’d change in the implementation to prevent this, it would be at
> least a behaviour change, potentially causing regressions similar to
> https://xkcd.com/1172/.
>
> Regards,
> Radu
>
> On Tue, 27 Jun 2023 at 18:35, Jörg Hoh 
> wrote:
>
> > HI Stefan,
> >
> > I agree, but:
> >
> > I don't have control over the code, which causes the ResourceResolver to
> be
> > serialized. Also I cannot enforce, that such code is NOT written and
> > deployed (there are too many ways to make it wrong). Also because it
> > currently works, I would have to counter the "but it worked yesterday,
> and
> > I did not change anything since then" argument, in case it fails with an
> > exception like above.
> >
> > So I have to find another way to prevent the ResourceResolver from being
> > serialized ...
> >
> > Jörg
> >
> >
> >
> > Am Di., 27. Juni 2023 um 13:38 Uhr schrieb Stefan Seifert
> > :
> >
> > > well, using lombok with such a result is a bad idea. there should not
> be
> > a
> > > getResolver() method, this is an implementation detail and no getter
> > should
> > > be provided for it.
> > >
> > > so to put it another way: good that the serialization fails, so you can
> > > fix the calls to not add a getResolver() method!
> > >
> > > stefan
> > >
> > > p.s. i'm not a fan of lombok in general and have no experience with it,
> > > but I assume it can be configured to not expose the resolver.
> > >
> > > > -Original Message-
> > > > From: Jörg Hoh 
> > > > Sent: Tuesday, June 27, 2023 1:28 PM
> > > > To: Sling Developers List 
> > > > Subject: Sling Model Exporter: Prevent serializing of a
> > ResourceResolver
> > > >
> > > > Hi,
> > > >
> > > > Assuming this Sling Model (using Lombok's @Getter annotation)
> > > >
> > > > @Getter
> > > > @Model(
> > > > adaptables = { SlingHttpServletRequest.class },
> > > > adapters = { MyModel.class, ComponentExporter.class },
> > > > resourceType = MyModel.RESOURCE_TYPE) @Exporter(
> > > > name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
> > > > extensions = ExporterConstants.SLING_MODEL_EXTENSION)
> > > > public class MyModel implements ComponentExporter {
> > > >
> > > > static final String RESOURCE_TYPE =
> "myapp/components/mymodel";
> > > >
> > > > @Inject
> > > > private ResourceResolver resolver;
> > > >
> > > > @ChildResource
> > > > private List items;
> > > >
> > > > }
> > > >
> > > > When it this model is serialized via SlingModelExporter / Jackson,
> the
> > > > resolver field is also exported via the created getResolver())
> method.
> > > >
> > > > But serializing that does not always work:
> > > >
> > > > org.apache.sling.models.factory.ExportException:
> > > > com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No
> > > > serializer found for class
> > > > com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl and no
> > > > properties discovered to create BeanSerializer (to avoid exception,
> > > > disable
> > > > SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> > > > com.myapp.PageImpl[":items"]> [...] > com.myapp.MyModel["resolver"]
> > > >
> > >org.apache.sling.resourceresolver.impl.ResourceResolverImpl["propertyMa
> > > > >p"]
> > > >
> > >java.util.HashMap["com.day.cq.wcm.core.impl.policies.ContentPolicyAdapt
> > > > >erFactory.ContentPolicy"])
> > > > at
> > > >
> > >
> >
> org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(Jackso
> > > > nExporter.java:138)
> > > > [org.apache.sling.models.jacksonexporter:1.1.2]
> > > > at
> > > >
> > >
> >
> org.apache.sling.models.impl.ModelAdapterFactory.exportModel(ModelAdapterF
> > > > actory.java:1333)
> > > > [org.apache.sling.models.impl:1.5.4]
> > > >
> > > >
> > > > I don't want to check each class I want to add to the propertyMap if
> it
> > > > can be serialized or not; and a more serious problem is that
> > serializing
> > > > the resourceResolver and it's properyMap can leak a lot of
> information,
> > > > which should be not get public.
> > > >
> > > > Do you see a way to prevent serialization of the ResourceResolver
> (and
> > > > 

Re: Sling Model Exporter: Prevent serializing of a ResourceResolver

2023-06-27 Thread Paul Bjorkstrand
Could you do something like [1] and [2] and just write out JSON null or
some other value that makes sense? That would avoid trying to serialize the
ResourceResolver (and potentially Resource as well), at the expense of a
remaining null. There also may be other features of the StdSerializer [3]
that can be used to prevent the field from being written at all, but I am
not familiar enough with it to say if it is possible or not.

[1]:
https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/jackson/PageModuleProvider.java

[2]:
https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/jackson/PageSerializer.java

[3]:
https://fasterxml.github.io/jackson-databind/javadoc/2.8/com/fasterxml/jackson/databind/ser/std/StdSerializer.html

//Paul


On Tue, Jun 27, 2023 at 12:11 PM Radu Cotescu  wrote:

> Hi Jörg,
>
> I think you would have the same problem with that model given the other
> property, namely that list of resources.
>
> Unfortunately I don’t see an easy way out other than documenting this
> aspect and advising developers to avoid exposing implementation details.
> Whatever you’d change in the implementation to prevent this, it would be at
> least a behaviour change, potentially causing regressions similar to
> https://xkcd.com/1172/.
>
> Regards,
> Radu
>
> On Tue, 27 Jun 2023 at 18:35, Jörg Hoh 
> wrote:
>
> > HI Stefan,
> >
> > I agree, but:
> >
> > I don't have control over the code, which causes the ResourceResolver to
> be
> > serialized. Also I cannot enforce, that such code is NOT written and
> > deployed (there are too many ways to make it wrong). Also because it
> > currently works, I would have to counter the "but it worked yesterday,
> and
> > I did not change anything since then" argument, in case it fails with an
> > exception like above.
> >
> > So I have to find another way to prevent the ResourceResolver from being
> > serialized ...
> >
> > Jörg
> >
> >
> >
> > Am Di., 27. Juni 2023 um 13:38 Uhr schrieb Stefan Seifert
> > :
> >
> > > well, using lombok with such a result is a bad idea. there should not
> be
> > a
> > > getResolver() method, this is an implementation detail and no getter
> > should
> > > be provided for it.
> > >
> > > so to put it another way: good that the serialization fails, so you can
> > > fix the calls to not add a getResolver() method!
> > >
> > > stefan
> > >
> > > p.s. i'm not a fan of lombok in general and have no experience with it,
> > > but I assume it can be configured to not expose the resolver.
> > >
> > > > -Original Message-
> > > > From: Jörg Hoh 
> > > > Sent: Tuesday, June 27, 2023 1:28 PM
> > > > To: Sling Developers List 
> > > > Subject: Sling Model Exporter: Prevent serializing of a
> > ResourceResolver
> > > >
> > > > Hi,
> > > >
> > > > Assuming this Sling Model (using Lombok's @Getter annotation)
> > > >
> > > > @Getter
> > > > @Model(
> > > > adaptables = { SlingHttpServletRequest.class },
> > > > adapters = { MyModel.class, ComponentExporter.class },
> > > > resourceType = MyModel.RESOURCE_TYPE) @Exporter(
> > > > name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
> > > > extensions = ExporterConstants.SLING_MODEL_EXTENSION)
> > > > public class MyModel implements ComponentExporter {
> > > >
> > > > static final String RESOURCE_TYPE =
> "myapp/components/mymodel";
> > > >
> > > > @Inject
> > > > private ResourceResolver resolver;
> > > >
> > > > @ChildResource
> > > > private List items;
> > > >
> > > > }
> > > >
> > > > When it this model is serialized via SlingModelExporter / Jackson,
> the
> > > > resolver field is also exported via the created getResolver())
> method.
> > > >
> > > > But serializing that does not always work:
> > > >
> > > > org.apache.sling.models.factory.ExportException:
> > > > com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No
> > > > serializer found for class
> > > > com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl and no
> > > > properties discovered to create BeanSerializer (to avoid exception,
> > > > disable
> > > > SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> > > > com.myapp.PageImpl[":items"]> [...] > com.myapp.MyModel["resolver"]
> > > >
> > >org.apache.sling.resourceresolver.impl.ResourceResolverImpl["propertyMa
> > > > >p"]
> > > >
> > >java.util.HashMap["com.day.cq.wcm.core.impl.policies.ContentPolicyAdapt
> > > > >erFactory.ContentPolicy"])
> > > > at
> > > >
> > >
> >
> org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(Jackso
> > > > nExporter.java:138)
> > > > [org.apache.sling.models.jacksonexporter:1.1.2]
> > > > at
> > > >
> > >
> >
> org.apache.sling.models.impl.ModelAdapterFactory.exportModel(ModelAdapterF
> > > > actory.java:1333)
> > > > [org.apache.sling.models.impl:1.5.4]
> > > >
> > > >
> > 

[GitHub] [sling-org-apache-sling-models-impl] sonarcloud[bot] commented on pull request #45: SLING-11917 Evaluate constructor parameter names via reflection

2023-06-27 Thread via GitHub


sonarcloud[bot] commented on PR #45:
URL: 
https://github.com/apache/sling-org-apache-sling-models-impl/pull/45#issuecomment-1609924130

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-models-impl=45)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-models-impl=45=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-models-impl=45=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-models-impl=45=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=CODE_SMELL)
 [1 Code 
Smell](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=45=false=CODE_SMELL)
   
   
[![93.8%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/90-16px.png
 
'93.8%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-models-impl=45=new_coverage=list)
 [93.8% 
Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-models-impl=45=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-models-impl=45=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-models-impl=45=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: Sling Model Exporter: Prevent serializing of a ResourceResolver

2023-06-27 Thread Radu Cotescu
Hi Jörg,

I think you would have the same problem with that model given the other
property, namely that list of resources.

Unfortunately I don’t see an easy way out other than documenting this
aspect and advising developers to avoid exposing implementation details.
Whatever you’d change in the implementation to prevent this, it would be at
least a behaviour change, potentially causing regressions similar to
https://xkcd.com/1172/.

Regards,
Radu

On Tue, 27 Jun 2023 at 18:35, Jörg Hoh 
wrote:

> HI Stefan,
>
> I agree, but:
>
> I don't have control over the code, which causes the ResourceResolver to be
> serialized. Also I cannot enforce, that such code is NOT written and
> deployed (there are too many ways to make it wrong). Also because it
> currently works, I would have to counter the "but it worked yesterday, and
> I did not change anything since then" argument, in case it fails with an
> exception like above.
>
> So I have to find another way to prevent the ResourceResolver from being
> serialized ...
>
> Jörg
>
>
>
> Am Di., 27. Juni 2023 um 13:38 Uhr schrieb Stefan Seifert
> :
>
> > well, using lombok with such a result is a bad idea. there should not be
> a
> > getResolver() method, this is an implementation detail and no getter
> should
> > be provided for it.
> >
> > so to put it another way: good that the serialization fails, so you can
> > fix the calls to not add a getResolver() method!
> >
> > stefan
> >
> > p.s. i'm not a fan of lombok in general and have no experience with it,
> > but I assume it can be configured to not expose the resolver.
> >
> > > -Original Message-
> > > From: Jörg Hoh 
> > > Sent: Tuesday, June 27, 2023 1:28 PM
> > > To: Sling Developers List 
> > > Subject: Sling Model Exporter: Prevent serializing of a
> ResourceResolver
> > >
> > > Hi,
> > >
> > > Assuming this Sling Model (using Lombok's @Getter annotation)
> > >
> > > @Getter
> > > @Model(
> > > adaptables = { SlingHttpServletRequest.class },
> > > adapters = { MyModel.class, ComponentExporter.class },
> > > resourceType = MyModel.RESOURCE_TYPE) @Exporter(
> > > name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
> > > extensions = ExporterConstants.SLING_MODEL_EXTENSION)
> > > public class MyModel implements ComponentExporter {
> > >
> > > static final String RESOURCE_TYPE = "myapp/components/mymodel";
> > >
> > > @Inject
> > > private ResourceResolver resolver;
> > >
> > > @ChildResource
> > > private List items;
> > >
> > > }
> > >
> > > When it this model is serialized via SlingModelExporter / Jackson, the
> > > resolver field is also exported via the created getResolver()) method.
> > >
> > > But serializing that does not always work:
> > >
> > > org.apache.sling.models.factory.ExportException:
> > > com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No
> > > serializer found for class
> > > com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl and no
> > > properties discovered to create BeanSerializer (to avoid exception,
> > > disable
> > > SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> > > com.myapp.PageImpl[":items"]> [...] > com.myapp.MyModel["resolver"]
> > >
> >org.apache.sling.resourceresolver.impl.ResourceResolverImpl["propertyMa
> > > >p"]
> > >
> >java.util.HashMap["com.day.cq.wcm.core.impl.policies.ContentPolicyAdapt
> > > >erFactory.ContentPolicy"])
> > > at
> > >
> >
> org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(Jackso
> > > nExporter.java:138)
> > > [org.apache.sling.models.jacksonexporter:1.1.2]
> > > at
> > >
> >
> org.apache.sling.models.impl.ModelAdapterFactory.exportModel(ModelAdapterF
> > > actory.java:1333)
> > > [org.apache.sling.models.impl:1.5.4]
> > >
> > >
> > > I don't want to check each class I want to add to the propertyMap if it
> > > can be serialized or not; and a more serious problem is that
> serializing
> > > the resourceResolver and it's properyMap can leak a lot of information,
> > > which should be not get public.
> > >
> > > Do you see a way to prevent serialization of the ResourceResolver (and
> > > potentially other types as well) without touching the model classes?
> > >
> > > Jörg
> > >
> > > --
> > > Cheers,
> > > Jörg Hoh,
> > >
> > > https://cqdump.joerghoh.de
> > > Twitter: @joerghoh
> >
>
>
> --
> Cheers,
> Jörg Hoh,
>
> https://cqdump.joerghoh.de
> Twitter: @joerghoh
>


[GitHub] [sling-org-apache-sling-models-impl] kwin opened a new pull request, #45: SLING-11917 Evaluate constructor parameter names via reflection

2023-06-27 Thread via GitHub


kwin opened a new pull request, #45:
URL: https://github.com/apache/sling-org-apache-sling-models-impl/pull/45

   This is available if compiled accordingly (with javac flag -parameters, 
https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-parameters)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: Sling Model Exporter: Prevent serializing of a ResourceResolver

2023-06-27 Thread Jörg Hoh
Hm, I think that Jackson Mixins [1] could work here.

[1] https://github.com/FasterXML/jackson-docs/wiki/JacksonMixInAnnotations

Am Di., 27. Juni 2023 um 13:28 Uhr schrieb Jörg Hoh :

> Hi,
>
> Assuming this Sling Model (using Lombok's @Getter annotation)
>
> @Getter
> @Model(
> adaptables = { SlingHttpServletRequest.class },
> adapters = { MyModel.class, ComponentExporter.class },
> resourceType = MyModel.RESOURCE_TYPE)
> @Exporter(
> name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
> extensions = ExporterConstants.SLING_MODEL_EXTENSION)
> public class MyModel implements ComponentExporter {
>
> static final String RESOURCE_TYPE = "myapp/components/mymodel";
>
> @Inject
> private ResourceResolver resolver;
>
> @ChildResource
> private List items;
>
> }
>
> When it this model is serialized via SlingModelExporter / Jackson, the
> resolver field is also exported via the created getResolver()) method.
>
> But serializing that does not always work:
>
> org.apache.sling.models.factory.ExportException:
> com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No
> serializer found for class
> com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl and no
> properties discovered to create BeanSerializer (to avoid exception, disable
> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> com.myapp.PageImpl[":items"]> [...] > com.myapp.MyModel["resolver"]
> >org.apache.sling.resourceresolver.impl.ResourceResolverImpl["propertyMap"]
> >java.util.HashMap["com.day.cq.wcm.core.impl.policies.ContentPolicyAdapterFactory.ContentPolicy"])
> at
> org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(JacksonExporter.java:138)
> [org.apache.sling.models.jacksonexporter:1.1.2]
> at
> org.apache.sling.models.impl.ModelAdapterFactory.exportModel(ModelAdapterFactory.java:1333)
> [org.apache.sling.models.impl:1.5.4]
>
>
> I don't want to check each class I want to add to the propertyMap if it
> can be serialized or not; and a more serious problem is that serializing
> the resourceResolver and it's properyMap can leak a lot of information,
> which should be not get public.
>
> Do you see a way to prevent serialization of the ResourceResolver (and
> potentially other types as well) without touching the model classes?
>
> Jörg
>
> --
> Cheers,
> Jörg Hoh,
>
> https://cqdump.joerghoh.de
> Twitter: @joerghoh
>


-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh


Re: Sling Model Exporter: Prevent serializing of a ResourceResolver

2023-06-27 Thread Jörg Hoh
HI Stefan,

I agree, but:

I don't have control over the code, which causes the ResourceResolver to be
serialized. Also I cannot enforce, that such code is NOT written and
deployed (there are too many ways to make it wrong). Also because it
currently works, I would have to counter the "but it worked yesterday, and
I did not change anything since then" argument, in case it fails with an
exception like above.

So I have to find another way to prevent the ResourceResolver from being
serialized ...

Jörg



Am Di., 27. Juni 2023 um 13:38 Uhr schrieb Stefan Seifert
:

> well, using lombok with such a result is a bad idea. there should not be a
> getResolver() method, this is an implementation detail and no getter should
> be provided for it.
>
> so to put it another way: good that the serialization fails, so you can
> fix the calls to not add a getResolver() method!
>
> stefan
>
> p.s. i'm not a fan of lombok in general and have no experience with it,
> but I assume it can be configured to not expose the resolver.
>
> > -Original Message-
> > From: Jörg Hoh 
> > Sent: Tuesday, June 27, 2023 1:28 PM
> > To: Sling Developers List 
> > Subject: Sling Model Exporter: Prevent serializing of a ResourceResolver
> >
> > Hi,
> >
> > Assuming this Sling Model (using Lombok's @Getter annotation)
> >
> > @Getter
> > @Model(
> > adaptables = { SlingHttpServletRequest.class },
> > adapters = { MyModel.class, ComponentExporter.class },
> > resourceType = MyModel.RESOURCE_TYPE) @Exporter(
> > name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
> > extensions = ExporterConstants.SLING_MODEL_EXTENSION)
> > public class MyModel implements ComponentExporter {
> >
> > static final String RESOURCE_TYPE = "myapp/components/mymodel";
> >
> > @Inject
> > private ResourceResolver resolver;
> >
> > @ChildResource
> > private List items;
> >
> > }
> >
> > When it this model is serialized via SlingModelExporter / Jackson, the
> > resolver field is also exported via the created getResolver()) method.
> >
> > But serializing that does not always work:
> >
> > org.apache.sling.models.factory.ExportException:
> > com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No
> > serializer found for class
> > com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl and no
> > properties discovered to create BeanSerializer (to avoid exception,
> > disable
> > SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> > com.myapp.PageImpl[":items"]> [...] > com.myapp.MyModel["resolver"]
> > >org.apache.sling.resourceresolver.impl.ResourceResolverImpl["propertyMa
> > >p"]
> > >java.util.HashMap["com.day.cq.wcm.core.impl.policies.ContentPolicyAdapt
> > >erFactory.ContentPolicy"])
> > at
> >
> org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(Jackso
> > nExporter.java:138)
> > [org.apache.sling.models.jacksonexporter:1.1.2]
> > at
> >
> org.apache.sling.models.impl.ModelAdapterFactory.exportModel(ModelAdapterF
> > actory.java:1333)
> > [org.apache.sling.models.impl:1.5.4]
> >
> >
> > I don't want to check each class I want to add to the propertyMap if it
> > can be serialized or not; and a more serious problem is that serializing
> > the resourceResolver and it's properyMap can leak a lot of information,
> > which should be not get public.
> >
> > Do you see a way to prevent serialization of the ResourceResolver (and
> > potentially other types as well) without touching the model classes?
> >
> > Jörg
> >
> > --
> > Cheers,
> > Jörg Hoh,
> >
> > https://cqdump.joerghoh.de
> > Twitter: @joerghoh
>


-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh


[jira] [Created] (SLING-11917) Sling Models: Support parameter name evaluation in constructor injection

2023-06-27 Thread Konrad Windszus (Jira)
Konrad Windszus created SLING-11917:
---

 Summary: Sling Models: Support parameter name evaluation in 
constructor injection
 Key: SLING-11917
 URL: https://issues.apache.org/jira/browse/SLING-11917
 Project: Sling
  Issue Type: Improvement
Reporter: Konrad Windszus
 Fix For: Models Implementation 1.6.6


https://openjdk.org/jeps/118 introduced support of retrieving parameter names 
at run time through reflection. This should be leveraged in constructor 
injection in Sling Models to not be forced to use the {{@Named}} annotation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [sling-site] kwin opened a new pull request, #112: SLING-3716 Clarify constructor injection

2023-06-27 Thread via GitHub


kwin opened a new pull request, #112:
URL: https://github.com/apache/sling-site/pull/112

   Document injection specific annotations. Clarify that @Inject on constructor 
is mandatory.
   Add chapters for field, method and constructor injection


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (SLING-11916) MockEventAdminTest.testPostEvents times out on Jenkins/Windows

2023-06-27 Thread Robert Munteanu (Jira)


[ 
https://issues.apache.org/jira/browse/SLING-11916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17737635#comment-17737635
 ] 

Robert Munteanu commented on SLING-11916:
-

My hunch was incorrect - 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/28 so I 
won't pursue this any further. If anyone wants to try and fix this, please do.

> MockEventAdminTest.testPostEvents times out on Jenkins/Windows
> --
>
> Key: SLING-11916
> URL: https://issues.apache.org/jira/browse/SLING-11916
> Project: Sling
>  Issue Type: Bug
>  Components: Testing
>Reporter: Robert Munteanu
>Priority: Major
> Fix For: Testing OSGi Mock 3.3.10
>
>
> The error is
>  
>  {noformat}
> [ERROR] org.apache.sling.testing.mock.osgi.MockEventAdminTest.testPostEvents  
> Time elapsed: 3.02 s  <<< ERROR!
> org.junit.runners.model.TestTimedOutException: test timed out after 3000 
> milliseconds
> {noformat}
> and seems to affect both Java 11 and 17.
> https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/PR-27/1/pipeline
>  (Java 11, Windows)
> https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/229/pipeline
>  (Java 17, Windows)
> https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/228/pipeline
>  (Java 17, Windows)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert commented on pull request #28: SLING-11916 - MockEventAdminTest.testPostEvents times out on Jenkins/Windows

2023-06-27 Thread via GitHub


rombert commented on PR #28:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/28#issuecomment-1609414244

   Failed again, does not seem like the missing synchronisation is the problem
   
   ```
   
https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/PR-28/2/pipeline/59
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] laeubi commented on pull request #19: SLING-11231 - Support setting a version for MockBundles

2023-06-27 Thread via GitHub


laeubi commented on PR #19:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/19#issuecomment-1609410394

   Yes I think this is now obsolete.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] sonarcloud[bot] commented on pull request #28: SLING-11916 - MockEventAdminTest.testPostEvents times out on Jenkins/Windows

2023-06-27 Thread via GitHub


sonarcloud[bot] commented on PR #28:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/28#issuecomment-1609409586

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-testing-osgi-mock=28)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=CODE_SMELL)
   
   [![No Coverage 
information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png
 'No Coverage 
information')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=28=coverage=list)
 No Coverage information  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=28=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=28=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert closed pull request #19: SLING-11231 - Support setting a version for MockBundles

2023-06-27 Thread via GitHub


rombert closed pull request #19: SLING-11231 - Support setting a version for 
MockBundles
URL: https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/19


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Resolved] (SLING-11231) [osgi-mocks] Support setting a version for MockBundles

2023-06-27 Thread Robert Munteanu (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-11231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu resolved SLING-11231.
-
Resolution: Duplicate

I just implemented this in SLING-11913 without noticing that we already had an 
issue. Closing this one as duplicate as I already have the fix attached to a 
different issue.

> [osgi-mocks] Support setting a version for MockBundles
> --
>
> Key: SLING-11231
> URL: https://issues.apache.org/jira/browse/SLING-11231
> Project: Sling
>  Issue Type: Improvement
>  Components: Testing
>Reporter: Christoph Läubrich
>Assignee: Stefan Seifert
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently MockBundle throws "UnsupportedOperation" for getVersion().
> It would be useful for certain rarer cases to have a call to that method.
> I'd like to suggest the following:
> # add a method setVersion(...)
> # throw Illegalstate("no version set") if version == null
> # return version if set without any exception



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert commented on pull request #19: SLING-11231 - Support setting a version for MockBundles

2023-06-27 Thread via GitHub


rombert commented on PR #19:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/19#issuecomment-1609408966

   @laeubi - I implemented this in #27, did not notice that you already have a 
PR open. Do the changes I applied work for you?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] sonarcloud[bot] commented on pull request #28: SLING-11916 - MockEventAdminTest.testPostEvents times out on Jenkins/Windows

2023-06-27 Thread via GitHub


sonarcloud[bot] commented on PR #28:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/28#issuecomment-1609398126

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-testing-osgi-mock=28)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=28=false=CODE_SMELL)
   
   [![No Coverage 
information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png
 'No Coverage 
information')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=28=coverage=list)
 No Coverage information  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=28=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=28=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert opened a new pull request, #28: SLING-11916 - MockEventAdminTest.testPostEvents times out on Jenkins/Windows

2023-06-27 Thread via GitHub


rombert opened a new pull request, #28:
URL: https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/28

   Make DummyEventHandler thread-safe. The EventHandler is potentially invoked 
from multiple threads, and improper synchronisation can lead to missing events.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Resolved] (SLING-11913) Implement MockBundle.getVersion

2023-06-27 Thread Robert Munteanu (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-11913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu resolved SLING-11913.
-
Resolution: Fixed

> Implement MockBundle.getVersion
> ---
>
> Key: SLING-11913
> URL: https://issues.apache.org/jira/browse/SLING-11913
> Project: Sling
>  Issue Type: Improvement
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Major
> Fix For: Testing OSGi Mock 3.3.10
>
>
> {{MockBundle.getVersion()}} is not implemented and always throws an 
> UnsupportedOperationException. This can be trivially be implemented with a 
> getter and a setter. For a default value, we can use 
> {{Version.emptyVersion}}, as indicated in the javadoc
> {quote} If this bundle does not have a specified version then \{@link 
> Version#emptyVersion\} is returned.{quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert merged pull request #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


rombert merged PR #27:
URL: https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



RE: [VOTE] Release Apache Sling Context-Aware Configuration Mock Plugin 1.5.2

2023-06-27 Thread Stefan Seifert
+1

stefan


[VOTE] Release Apache Sling Context-Aware Configuration Mock Plugin 1.5.2

2023-06-27 Thread Stefan Seifert
Hi,

We solved 1 issues in this release:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310710=12353254=Text

Staging repository:
https://repository.apache.org/content/repositories/orgapachesling-2757/

You can use this UNIX script to download the release and verify the signatures:
https://raw.githubusercontent.com/apache/sling-tooling-release/master/check_staged_release.sh

Usage:
sh check_staged_release.sh 2757 /tmp/sling-staging

Please vote to approve this release:

  [ ] +1 Approve the release
  [ ]  0 Don't care
  [ ] -1 Don't release, because ...

This majority vote is open for at least 72 hours.

stefan


[GitHub] [sling-org-apache-sling-testing-osgi-mock] sonarcloud[bot] commented on pull request #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


sonarcloud[bot] commented on PR #27:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27#issuecomment-1609351199

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-testing-osgi-mock=27)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-osgi-mock=27=false=CODE_SMELL)
   
   
[![85.7%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png
 
'85.7%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=27=new_coverage=list)
 [85.7% 
Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=27=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=27=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-osgi-mock=27=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Created] (SLING-11916) MockEventAdminTest.testPostEvents times out on Jenkins/Windows

2023-06-27 Thread Robert Munteanu (Jira)
Robert Munteanu created SLING-11916:
---

 Summary: MockEventAdminTest.testPostEvents times out on 
Jenkins/Windows
 Key: SLING-11916
 URL: https://issues.apache.org/jira/browse/SLING-11916
 Project: Sling
  Issue Type: Bug
  Components: Testing
Reporter: Robert Munteanu
 Fix For: Testing OSGi Mock 3.3.10


The error is

 
 {noformat}
[ERROR] org.apache.sling.testing.mock.osgi.MockEventAdminTest.testPostEvents  
Time elapsed: 3.02 s  <<< ERROR!
org.junit.runners.model.TestTimedOutException: test timed out after 3000 
milliseconds
{noformat}

and seems to affect both Java 11 and 17.


https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/PR-27/1/pipeline
 (Java 11, Windows)
https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/229/pipeline
 (Java 17, Windows)
https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/228/pipeline
 (Java 17, Windows)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert commented on pull request #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


rombert commented on PR #27:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27#issuecomment-1609350352

   Created SLING-11916 . On a related note, does the `DummyEventHandler` need 
to be thread-safe?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] stefanseifert commented on pull request #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


stefanseifert commented on PR #27:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27#issuecomment-1609343811

   ah, ok - then best to create a separate issue for that


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Resolved] (SLING-11915) caconfig-mock-plugin: Order of collection items may be lost in writeConfigurationCollection

2023-06-27 Thread Stefan Seifert (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-11915?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Seifert resolved SLING-11915.

Resolution: Fixed

https://github.com/apache/sling-org-apache-sling-testing-caconfig-mock-plugin/commit/4c987ec627fc7b1f84bd630fe9dd2f6a01dea878

> caconfig-mock-plugin: Order of collection items may be lost in 
> writeConfigurationCollection
> ---
>
> Key: SLING-11915
> URL: https://issues.apache.org/jira/browse/SLING-11915
> Project: Sling
>  Issue Type: Bug
>  Components: Testing
>Affects Versions: Context-Aware Configuration Mock Plugin 1.5.0
>Reporter: Stefan Seifert
>Assignee: Stefan Seifert
>Priority: Major
> Fix For: Context-Aware Configuration Mock Plugin 1.5.2
>
>
> when using {{MockContextAwareConfig.writeConfigurationCollection}} the order 
> of collection items may be lost.
> this is a unwanted side-effected of SLING-11839



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [sling-org-apache-sling-testing-caconfig-mock-plugin] stefanseifert merged pull request #4: SLING-11915 caconfig-mock-plugin: Order of collection items may be lost in writeConfigurationCollec

2023-06-27 Thread via GitHub


stefanseifert merged PR #4:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-caconfig-mock-plugin/pull/4


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert commented on pull request #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


rombert commented on PR #27:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27#issuecomment-1609338871

   I asked since the last 5 executions failed
   
   
![image](https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/assets/21237/96589c72-855c-43c8-8eb2-ab3a402cad89)
   
   I'll retry the PR check now, but I think this needs to be looked into 
separately.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-caconfig-mock-plugin] sonarcloud[bot] commented on pull request #4: SLING-11915 caconfig-mock-plugin: Order of collection items may be lost in writeConfigurati

2023-06-27 Thread via GitHub


sonarcloud[bot] commented on PR #4:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-caconfig-mock-plugin/pull/4#issuecomment-1609337836

   Kudos, SonarCloud Quality Gate passed!  [![Quality Gate 
passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png
 'Quality Gate 
passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4)
   
   
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png
 
'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=BUG)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=BUG)
 [0 
Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=BUG)
  
   
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png
 
'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=VULNERABILITY)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=VULNERABILITY)
 [0 
Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=VULNERABILITY)
  
   [![Security 
Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png
 'Security 
Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=SECURITY_HOTSPOT)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=SECURITY_HOTSPOT)
 [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=SECURITY_HOTSPOT)
  
   [![Code 
Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png
 'Code 
Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=CODE_SMELL)
 
[![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png
 
'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=CODE_SMELL)
 [0 Code 
Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=false=CODE_SMELL)
   
   
[![100.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/100-16px.png
 
'100.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=new_coverage=list)
 [100.0% 
Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=new_coverage=list)
  
   
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png
 
'0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=new_duplicated_lines_density=list)
 [0.0% 
Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-testing-caconfig-mock-plugin=4=new_duplicated_lines_density=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-caconfig-mock-plugin] stefanseifert opened a new pull request, #4: SLING-11915 caconfig-mock-plugin: Order of collection items may be lost in writeConfiguratio

2023-06-27 Thread via GitHub


stefanseifert opened a new pull request, #4:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-caconfig-mock-plugin/pull/4

   https://issues.apache.org/jira/browse/SLING-11915


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [sling-org-apache-sling-testing-osgi-mock] stefanseifert commented on pull request #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


stefanseifert commented on PR #27:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27#issuecomment-1609329046

   did you try to re-run the test? in rare occasions i see such timeouts in 
this test case, but usually it goes away when re-running.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



RE: Sling Model Exporter: Prevent serializing of a ResourceResolver

2023-06-27 Thread Stefan Seifert
well, using lombok with such a result is a bad idea. there should not be a 
getResolver() method, this is an implementation detail and no getter should be 
provided for it.

so to put it another way: good that the serialization fails, so you can fix the 
calls to not add a getResolver() method!

stefan

p.s. i'm not a fan of lombok in general and have no experience with it, but I 
assume it can be configured to not expose the resolver.

> -Original Message-
> From: Jörg Hoh 
> Sent: Tuesday, June 27, 2023 1:28 PM
> To: Sling Developers List 
> Subject: Sling Model Exporter: Prevent serializing of a ResourceResolver
> 
> Hi,
> 
> Assuming this Sling Model (using Lombok's @Getter annotation)
> 
> @Getter
> @Model(
> adaptables = { SlingHttpServletRequest.class },
> adapters = { MyModel.class, ComponentExporter.class },
> resourceType = MyModel.RESOURCE_TYPE) @Exporter(
> name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
> extensions = ExporterConstants.SLING_MODEL_EXTENSION)
> public class MyModel implements ComponentExporter {
> 
> static final String RESOURCE_TYPE = "myapp/components/mymodel";
> 
> @Inject
> private ResourceResolver resolver;
> 
> @ChildResource
> private List items;
> 
> }
> 
> When it this model is serialized via SlingModelExporter / Jackson, the
> resolver field is also exported via the created getResolver()) method.
> 
> But serializing that does not always work:
> 
> org.apache.sling.models.factory.ExportException:
> com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No
> serializer found for class
> com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl and no
> properties discovered to create BeanSerializer (to avoid exception,
> disable
> SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
> com.myapp.PageImpl[":items"]> [...] > com.myapp.MyModel["resolver"]
> >org.apache.sling.resourceresolver.impl.ResourceResolverImpl["propertyMa
> >p"]
> >java.util.HashMap["com.day.cq.wcm.core.impl.policies.ContentPolicyAdapt
> >erFactory.ContentPolicy"])
> at
> org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(Jackso
> nExporter.java:138)
> [org.apache.sling.models.jacksonexporter:1.1.2]
> at
> org.apache.sling.models.impl.ModelAdapterFactory.exportModel(ModelAdapterF
> actory.java:1333)
> [org.apache.sling.models.impl:1.5.4]
> 
> 
> I don't want to check each class I want to add to the propertyMap if it
> can be serialized or not; and a more serious problem is that serializing
> the resourceResolver and it's properyMap can leak a lot of information,
> which should be not get public.
> 
> Do you see a way to prevent serialization of the ResourceResolver (and
> potentially other types as well) without touching the model classes?
> 
> Jörg
> 
> --
> Cheers,
> Jörg Hoh,
> 
> https://cqdump.joerghoh.de
> Twitter: @joerghoh


[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert commented on pull request #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


rombert commented on PR #27:
URL: 
https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27#issuecomment-1609324758

   @stefanseifert  - do you have any idea about the Windows testing failures?
   
   ```
   [ERROR] org.apache.sling.testing.mock.osgi.MockEventAdminTest.testPostEvents 
 Time elapsed: 3.02 s  <<< ERROR!
   org.junit.runners.model.TestTimedOutException: test timed out after 3000 
milliseconds
   ```
   
   
https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/PR-27/1/pipeline
 (Java 11, Windows)
   
https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/229/pipeline
 (Java 17, Windows)
   
https://ci-builds.apache.org/blue/organizations/jenkins/Sling%2Fmodules%2Fsling-org-apache-sling-testing-osgi-mock/detail/master/228/pipeline
 (Java 17, Windows)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Created] (SLING-11915) caconfig-mock-plugin: Order of collection items may be lost in writeConfigurationCollection

2023-06-27 Thread Stefan Seifert (Jira)
Stefan Seifert created SLING-11915:
--

 Summary: caconfig-mock-plugin: Order of collection items may be 
lost in writeConfigurationCollection
 Key: SLING-11915
 URL: https://issues.apache.org/jira/browse/SLING-11915
 Project: Sling
  Issue Type: Bug
  Components: Testing
Affects Versions: Context-Aware Configuration Mock Plugin 1.5.0
Reporter: Stefan Seifert
Assignee: Stefan Seifert
 Fix For: Context-Aware Configuration Mock Plugin 1.5.2


when using {{MockContextAwareConfig.writeConfigurationCollection}} the order of 
collection items may be lost.
this is a unwanted side-effected of SLING-11839



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Sling Model Exporter: Prevent serializing of a ResourceResolver

2023-06-27 Thread Jörg Hoh
Hi,

Assuming this Sling Model (using Lombok's @Getter annotation)

@Getter
@Model(
adaptables = { SlingHttpServletRequest.class },
adapters = { MyModel.class, ComponentExporter.class },
resourceType = MyModel.RESOURCE_TYPE)
@Exporter(
name = ExporterConstants.SLING_MODEL_EXPORTER_NAME,
extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class MyModel implements ComponentExporter {

static final String RESOURCE_TYPE = "myapp/components/mymodel";

@Inject
private ResourceResolver resolver;

@ChildResource
private List items;

}

When it this model is serialized via SlingModelExporter / Jackson, the
resolver field is also exported via the created getResolver()) method.

But serializing that does not always work:

org.apache.sling.models.factory.ExportException:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No
serializer found for class
com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl and no
properties discovered to create BeanSerializer (to avoid exception, disable
SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain:
com.myapp.PageImpl[":items"]> [...] > com.myapp.MyModel["resolver"]
>org.apache.sling.resourceresolver.impl.ResourceResolverImpl["propertyMap"]
>java.util.HashMap["com.day.cq.wcm.core.impl.policies.ContentPolicyAdapterFactory.ContentPolicy"])
at
org.apache.sling.models.jacksonexporter.impl.JacksonExporter.export(JacksonExporter.java:138)
[org.apache.sling.models.jacksonexporter:1.1.2]
at
org.apache.sling.models.impl.ModelAdapterFactory.exportModel(ModelAdapterFactory.java:1333)
[org.apache.sling.models.impl:1.5.4]


I don't want to check each class I want to add to the propertyMap if it can
be serialized or not; and a more serious problem is that serializing the
resourceResolver and it's properyMap can leak a lot of information, which
should be not get public.

Do you see a way to prevent serialization of the ResourceResolver (and
potentially other types as well) without touching the model classes?

Jörg

-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh


Re: Sling Models Constructor Injection

2023-06-27 Thread Konrad Windszus
Some things magically work even without ITs.
And no, by someone I really meant some committer.

> On 27. Jun 2023, at 11:36, Bertrand Delacretaz  wrote:
> 
> On Tue, Jun 27, 2023 at 9:05 AM Konrad Windszus  wrote:
>> ...If someone can confirm that both levels are supported for constructor 
>> injection
>> I am gonna adjust our documentation...
> 
> Well, "someone" should be "automated tests", right? Otherwise it
> didn't happen ;-)
> 
> -Bertrand



Re: Sling Models Constructor Injection

2023-06-27 Thread Bertrand Delacretaz
On Tue, Jun 27, 2023 at 9:05 AM Konrad Windszus  wrote:
> ...If someone can confirm that both levels are supported for constructor 
> injection
> I am gonna adjust our documentation...

Well, "someone" should be "automated tests", right? Otherwise it
didn't happen ;-)

-Bertrand


[GitHub] [sling-org-apache-sling-testing-osgi-mock] rombert opened a new pull request, #27: SLING-11913 - Implement MockBundle.getVersion

2023-06-27 Thread via GitHub


rombert opened a new pull request, #27:
URL: https://github.com/apache/sling-org-apache-sling-testing-osgi-mock/pull/27

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Updated] (SLING-11913) Implement MockBundle.getVersion

2023-06-27 Thread Robert Munteanu (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-11913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu updated SLING-11913:

Description: 
{{MockBundle.getVersion()}} is not implemented and always throws an 
UnsupportedOperationException. This can be trivially be implemented with a 
getter and a setter. For a default value, we can use {{Version.emptyVersion}}, 
as indicated in the javadoc

{quote} If this bundle does not have a specified version then \{@link 
Version#emptyVersion\} is returned.{quote}

  was:
{{MockBundle.getVersion()}} is not implemented and always throws an 
UnsupportedOperationException. This can be trivially be implemented with a 
getter and a setter. For a default value, we can use {{Version.emptyVersion}}, 
as indicated in the javadoc

{quote} If this bundle does not have a specified version then {@link 
Version#emptyVersion} is returned.{quote}


> Implement MockBundle.getVersion
> ---
>
> Key: SLING-11913
> URL: https://issues.apache.org/jira/browse/SLING-11913
> Project: Sling
>  Issue Type: Improvement
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Major
> Fix For: Testing OSGi Mock 3.3.10
>
>
> {{MockBundle.getVersion()}} is not implemented and always throws an 
> UnsupportedOperationException. This can be trivially be implemented with a 
> getter and a setter. For a default value, we can use 
> {{Version.emptyVersion}}, as indicated in the javadoc
> {quote} If this bundle does not have a specified version then \{@link 
> Version#emptyVersion\} is returned.{quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (SLING-11914) Accept initial offset via PingMessage

2023-06-27 Thread Christian Schneider (Jira)
Christian Schneider created SLING-11914:
---

 Summary: Accept initial offset via PingMessage
 Key: SLING-11914
 URL: https://issues.apache.org/jira/browse/SLING-11914
 Project: Sling
  Issue Type: Improvement
  Components: Content Distribution
Reporter: Christian Schneider
Assignee: Christian Schneider


When DistributionSubscriber does not yet have a stored offset it is in a 
problematic state.

When a package message is sent and DistributionSubscriber starts late or 
restarts it might miss the message.

This issue aim to improve the situation by accepting offsets via ping messages. 
The messaging provider can send such a message immediately when the poller is 
created to inform subscriber about the current offset on the topic. This offset 
is then written to repository.

>From this point in time the timing problem is solved. No message after the 
>stored offset can be lost.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (SLING-11913) Implement MockBundle.getVersion

2023-06-27 Thread Robert Munteanu (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-11913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu updated SLING-11913:

Description: 
{{MockBundle.getVersion()}} is not implemented and always throws an 
UnsupportedOperationException. This can be trivially be implemented with a 
getter and a setter. For a default value, we can use {{Version.emptyVersion}}, 
as indicated in the javadoc

{quote} If this bundle does not have a specified version then {@link 
Version#emptyVersion} is returned.{quote}

  was:
{{MockBundle.gerVersion()}} is not implemented and always throws an 
UnsupportedOperationException. This can be trivially be implemented with a 
getter and a setter. For a default value, we can use {{Version.emptyVersion}}, 
as indicated in the javadoc

{quote} If this bundle does not have a specified version then {@link 
Version#emptyVersion} is returned.{quote}


> Implement MockBundle.getVersion
> ---
>
> Key: SLING-11913
> URL: https://issues.apache.org/jira/browse/SLING-11913
> Project: Sling
>  Issue Type: Improvement
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Major
> Fix For: Testing OSGi Mock 3.3.10
>
>
> {{MockBundle.getVersion()}} is not implemented and always throws an 
> UnsupportedOperationException. This can be trivially be implemented with a 
> getter and a setter. For a default value, we can use 
> {{Version.emptyVersion}}, as indicated in the javadoc
> {quote} If this bundle does not have a specified version then {@link 
> Version#emptyVersion} is returned.{quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (SLING-11913) Implement Bundle.getVersion

2023-06-27 Thread Robert Munteanu (Jira)
Robert Munteanu created SLING-11913:
---

 Summary: Implement Bundle.getVersion
 Key: SLING-11913
 URL: https://issues.apache.org/jira/browse/SLING-11913
 Project: Sling
  Issue Type: Improvement
Reporter: Robert Munteanu
Assignee: Robert Munteanu
 Fix For: Testing OSGi Mock 3.3.10


{{MockBundle.gerVersion()}} is not implemented and always throws an 
UnsupportedOperationException. This can be trivially be implemented with a 
getter and a setter. For a default value, we can use {{Version.emptyVersion}}, 
as indicated in the javadoc

{quote} If this bundle does not have a specified version then {@link 
Version#emptyVersion} is returned.{quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (SLING-11913) Implement MockBundle.getVersion

2023-06-27 Thread Robert Munteanu (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-11913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu updated SLING-11913:

Summary: Implement MockBundle.getVersion  (was: Implement Bundle.getVersion)

> Implement MockBundle.getVersion
> ---
>
> Key: SLING-11913
> URL: https://issues.apache.org/jira/browse/SLING-11913
> Project: Sling
>  Issue Type: Improvement
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Major
> Fix For: Testing OSGi Mock 3.3.10
>
>
> {{MockBundle.gerVersion()}} is not implemented and always throws an 
> UnsupportedOperationException. This can be trivially be implemented with a 
> getter and a setter. For a default value, we can use 
> {{Version.emptyVersion}}, as indicated in the javadoc
> {quote} If this bundle does not have a specified version then {@link 
> Version#emptyVersion} is returned.{quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (SLING-11112) Regression in content loader : Different behaviour when initial content is missing

2023-06-27 Thread Robert Munteanu (Jira)


 [ 
https://issues.apache.org/jira/browse/SLING-2?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Munteanu updated SLING-2:

Summary: Regression in content loader : Different behaviour when initial 
content is missing  (was: Regression in content loader : Diffent behaviour when 
initial content is missing)

> Regression in content loader : Different behaviour when initial content is 
> missing
> --
>
> Key: SLING-2
> URL: https://issues.apache.org/jira/browse/SLING-2
> Project: Sling
>  Issue Type: Improvement
>Affects Versions: JCR ContentLoader 2.5.0
>Reporter: Carsten Ziegeler
>Priority: Blocker
>  Labels: regression
> Fix For: JCR ContentLoader 2.6.2
>
>
> With a bundle that does not have SLING-INF and the following initial content 
> instruction:
> SLING-INF/content;path:=/libs/foo/bar;overwrite:=true;
> it seems that prior versions handled this case differently and did not touch 
> /libs/foo/bar while the new behaviour removes all child nodes of /libs/foo/bar



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Sling Models Constructor Injection

2023-06-27 Thread Konrad Windszus


Hi,
Currently our documentation at [1] only outlines using the annotations on 
method level for constructor injection:

@Inject public MyModel(@Named("propertyName") String propertyName) { // 
constructor code }


However as we recommend using injector-specific annotation now, I am wondering 
if annotations can also be used on argument level only?

public MyModel(@Named("propertyName”) @ValueMapValue String propertyName, 
@OSGiService MyService myService) { // constructor code }

If someone can confirm that both levels are supported for constructor injection 
I am gonna adjust our documentation.

Thanks,
Konrad

[1] - https://sling.apache.org/documentation/bundles/models.html#model-classes