[jira] [Closed] (SLING-12173) Configuration errors in Eclipse for projects using the slingfeature-maven-plugin

2024-04-27 Thread Robert Munteanu (Jira)


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

Robert Munteanu closed SLING-12173.
---

> Configuration errors in Eclipse for projects using the 
> slingfeature-maven-plugin
> 
>
> Key: SLING-12173
> URL: https://issues.apache.org/jira/browse/SLING-12173
> Project: Sling
>  Issue Type: Bug
>  Components: Maven Plugins and Archetypes
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Major
> Fix For: OSGi Feature Maven Plugin 1.8.2
>
>
> The slingfeature-maven-plugin currently uses the Jakarta JSON implementation 
> of the Apache Johnzon parser. 
> I have noticed problems in the Eclipse IDE, where projects fail to update 
> with hard to isolate errors (see below).
> {noformat}java.util.ServiceConfigurationError: jakarta.json.spi.JsonProvider: 
> org.apache.johnzon.core.JsonProviderImpl not a subtype
>   at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
>   at 
> java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
>   at 
> java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
>   at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
>   at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
>   at jakarta.json.spi.JsonProvider.provider(JsonProvider.java:69)
>   at jakarta.json.Json.createReader(Json.java:189)
>   at 
> org.apache.sling.feature.maven.JSONFeatures.read(JSONFeatures.java:64)
>   at 
> org.apache.sling.feature.maven.ProjectHelper.readFeatureFile(ProjectHelper.java:622)
>   at 
> org.apache.sling.feature.maven.Preprocessor.readProjectFeatures(Preprocessor.java:304)
>   at 
> org.apache.sling.feature.maven.Preprocessor.process(Preprocessor.java:145)
>   at 
> org.apache.sling.feature.maven.Preprocessor.process(Preprocessor.java:110)
>   at 
> org.apache.sling.feature.maven.extensions.DependencyLifecycleParticipant.afterProjectsRead(DependencyLifecycleParticipant.java:87)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.executeParticipants(ProjectRegistryManager.java:824)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.lambda$15(ProjectRegistryManager.java:791)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.lambda$14(ProjectRegistryManager.java:790)
>   at java.base/java.util.HashMap$Values.forEach(HashMap.java:1065)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.lambda$11(ProjectRegistryManager.java:788)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.readMavenProjectFacades(ProjectRegistryManager.java:760)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:392)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:366)
>   at 
> org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:318)
>   at 
> org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.getProjectFacade(MavenBuilder.java:146)
>   at 
> org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:84)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
>   at 
> org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214)
>   at 
> org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:83)
>   at 
> org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:192)
>   at 
> org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1079)
> 

[jira] [Closed] (SLING-12153) Update maven-archiver and maven-filtering

2024-04-27 Thread Robert Munteanu (Jira)


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

Robert Munteanu closed SLING-12153.
---

> Update maven-archiver and maven-filtering
> -
>
> Key: SLING-12153
> URL: https://issues.apache.org/jira/browse/SLING-12153
> Project: Sling
>  Issue Type: Improvement
>  Components: Maven Plugins and Archetypes
>Reporter: Robert Munteanu
>Assignee: Robert Munteanu
>Priority: Minor
> Fix For: OSGi Feature Maven Plugin 1.8.2
>
>
> [~jsedding] noticed that the plug-in brings in older versions of the 
> maven-archiver and maven-filtering. Those dependencies 
> {quote}drag an ancient guava version into the classpath via a transitive 
> dependency that was moved into "test" scope in newer versions of these two 
> libraries{quote}
> This causes various problems with IntelliJ and Eclipse integration. And 
> upgrading dependencies is always a good idea :-)



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


[jira] [Closed] (SLING-12159) Add report to list package imports of jsp scripts

2024-04-27 Thread Robert Munteanu (Jira)


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

Robert Munteanu closed SLING-12159.
---

> Add report to list package imports of jsp scripts
> -
>
> Key: SLING-12159
> URL: https://issues.apache.org/jira/browse/SLING-12159
> Project: Sling
>  Issue Type: New Feature
>  Components: Maven Plugins and Archetypes
>Reporter: Carsten Ziegeler
>Assignee: Carsten Ziegeler
>Priority: Major
> Fix For: OSGi Feature Maven Plugin 1.8.2
>
>
> In addition to the reports about bundle package imports, we should generate 
> info about package imports from scripts (jsps)



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


[jira] [Closed] (SLING-12174) Parameter 'defaultMetadata' is unknown for plugin

2024-04-27 Thread Robert Munteanu (Jira)


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

Robert Munteanu closed SLING-12174.
---

> Parameter 'defaultMetadata' is unknown for plugin
> -
>
> Key: SLING-12174
> URL: https://issues.apache.org/jira/browse/SLING-12174
> Project: Sling
>  Issue Type: Bug
>  Components: Feature Model, Maven Plugins and Archetypes
>Affects Versions: OSGi Feature Maven Plugin 1.8.0
>Reporter: Carsten Ziegeler
>Assignee: Carsten Ziegeler
>Priority: Major
> Fix For: OSGi Feature Maven Plugin 1.8.2
>
>
> When running the slingfeature maven plugin with latest Apache Maven, the 
> warning "Parameter 'defaultMetadata' is unknown for plugin" appears for all 
> goals.
> This is due to the fact that this parameter is evaluated in the preprocessor.



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


[RESULT] [VOTE] Release Apache Sling OSGi Feature Maven Plugin 1.8.2

2024-04-27 Thread Robert Munteanu
Hi,

The vote has passed with the following result:

+1 (binding): Stefan Seifert, Carsten Ziegeler, Robert Munteanu
+1 (non-binding): none

I will copy this release to the Sling dist directory and
promote the artifacts to the central Maven repository.

Regards,
Robert Munteanu



Re: [VOTE] Release Apache Sling OSGi Feature Maven Plugin 1.8.2

2024-04-27 Thread Robert Munteanu
On Thu, 2024-04-25 at 08:42 +, Robert Munteanu wrote:
> Please vote to approve this release:

+1
Robert


signature.asc
Description: This is a digitally signed message part


Re: [PR] SLING-12279 - Use ResourceResolver#getPropertyMap() for resource/resolver adaptables [sling-org-apache-sling-models-impl]

2024-04-27 Thread via GitHub


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

   ## [![Quality Gate 
Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png
 'Quality Gate 
Passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-models-impl=50)
 **Quality Gate passed**  
   Issues  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 New 
issues](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-models-impl=50=false=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png
 '') [0 Accepted 
issues](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-models-impl=50=new_accepted_issues=list)
   
   Measures  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0 Security 
Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-models-impl=50=false=true)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [87.5% Coverage on New 
Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-models-impl=50=new_coverage=list)
  
   
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png
 '') [0.0% Duplication on New 
Code](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-models-impl=50=new_duplicated_lines_density=list)
  
 
   [See analysis details on 
SonarCloud](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-models-impl=50)
   
   


-- 
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: [PR] SLING-12279 - Use ResourceResolver#getPropertyMap() for resource/resolver adaptables [sling-org-apache-sling-models-impl]

2024-04-27 Thread via GitHub


paul-bjorkstrand commented on code in PR #50:
URL: 
https://github.com/apache/sling-org-apache-sling-models-impl/pull/50#discussion_r1581876101


##
src/test/java/org/apache/sling/models/impl/AdapterCacheHolderTest.java:
##
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.models.impl;
+
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;
+import org.apache.sling.servlethelpers.MockSlingHttpServletRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import java.lang.ref.SoftReference;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AdapterCacheHolderTest {
+
+@Test
+public void testGetMapNonServletRequestAdaptable() {
+Map, SoftReference>> outerMap = spy(new 
HashMap<>());
+Object adaptable1 = new Object();
+Object adaptable2 = new Object();
+
+try (AdapterCacheHolder adapterCacheHolder = new 
AdapterCacheHolder(false, outerMap)) {
+Map, SoftReference> map1 = 
adapterCacheHolder.getCacheMapForAdaptable(adaptable1);
+Map, SoftReference> map2 = 
adapterCacheHolder.getCacheMapForAdaptable(adaptable1);
+Map, SoftReference> map3 = 
adapterCacheHolder.getCacheMapForAdaptable(adaptable2);
+
+assertSame(map1, map2);
+assertNotSame(map1, map3);
+}
+}
+
+@Test
+public void testGetMapServletRequestAdaptable() {
+Map, SoftReference>> outerMap = spy(new 
HashMap<>());
+SlingHttpServletRequest adaptable1 = new 
MockSlingHttpServletRequest(null);
+SlingHttpServletRequest adaptable2 = new 
SlingHttpServletRequestWrapper(adaptable1);
+SlingHttpServletRequest adaptable3 = new 
MockSlingHttpServletRequest(null);
+
+try (AdapterCacheHolder adapterCacheHolder = new 
AdapterCacheHolder(false, outerMap)) {
+Map, SoftReference> map1 = 
adapterCacheHolder.getCacheMapForAdaptable(adaptable1);
+Map, SoftReference> map2 = 
adapterCacheHolder.getCacheMapForAdaptable(adaptable2);
+Map, SoftReference> map3 = 
adapterCacheHolder.getCacheMapForAdaptable(adaptable3);
+
+assertSame(map1, map2);
+assertSame(map1, map3);
+}
+}
+
+@Test
+public void testClose() {
+Object adaptable = new Object();
+Object result = new Object();
+SoftReference ref = new SoftReference<>(result);
+
+Map, SoftReference> innerMap = spy(new HashMap<>());
+innerMap.put(Object.class, ref);
+
+Map, SoftReference>> outerMap = spy(new 
HashMap<>());
+outerMap.put(adaptable, innerMap);
+
+try (AdapterCacheHolder adapterCacheHolder = new 
AdapterCacheHolder(false, outerMap)) {
+// intentionally empty
+}
+
+verify(outerMap).values();
+verify(outerMap).clear();
+verify(innerMap).clear();
+}
+
+@Test
+public void testNewMapSyncMap() {
+// This is a very weak test, but it should be sufficient to at least 
confirm that we are not just using a
+//  WeakHashMap, in case someone changes it without knowing why.
+Map nonSyncMap= AdapterCacheHolder.newMap(false);
+Map syncMap= AdapterCacheHolder.newMap(true);
+
+System.out.println(nonSyncMap.getClass());

Review Comment:
   Indeed they are not. Updated in latest push.



-- 
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-12197) cpconverter: Sling-Initial-Content directories created as nt:folder instead of sling:Folder

2024-04-27 Thread Stefan Seifert (Jira)


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

Stefan Seifert commented on SLING-12197:


thanks for the analysis!

> cpconverter: Sling-Initial-Content directories created as nt:folder instead 
> of sling:Folder
> ---
>
> Key: SLING-12197
> URL: https://issues.apache.org/jira/browse/SLING-12197
> Project: Sling
>  Issue Type: Bug
>  Components: Content-Package to Feature Model Converter
>Affects Versions: Content-Package to Feature Model Converter 1.3.4
>Reporter: Stefan Seifert
>Priority: Major
> Fix For: Content-Package to Feature Model Converter 1.3.8
>
> Attachments: io.wcm.handler.link-apps-1.10.2-cp2fm-converted.zip
>
>
> the cpconverter extracts Sling-Initial-Content from OSGi bundles and creates 
> FileVault packages with the transformed content.
> this works well, but there is one difference when the resulting content 
> package is installed compared when uploading the OSGi bundle with the 
> Sling-Initial-Content directly:
> * the JCR Content Loader by defaults creates a {{sling:Folder}} node type for 
> each directory found in the Sling-Initial-Content (see also 
> [docs|https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#initial-content-loading-1])
> * the cpconverter process creates no {{.content.xml}} file for the folders, 
> but only for the actual JSON files found in the process. as a result, the 
> folders are created as {{nt:folder}} when uploading the transformed package
> * this difference becomes relevant, when a JSON file in Sling-Initial-Content 
> defines a primary type of {{nt:unstructured}} - it is not allowed to created 
> such a node directly below a {{nt:folder}} node - but it is allowed to do so 
> below a {{sling:Folder}} node



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