Skip to content

Commit 30f5c00

Browse files
committed
Merge branch 'develop'
2 parents ad61f8e + 07cb2ea commit 30f5c00

File tree

66 files changed

+212
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+212
-178
lines changed

.github/workflows/maven-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ${{ matrix.os }}
2121
strategy:
2222
matrix:
23-
java: [11, 17]
23+
java: [11, 17, 21]
2424
os: [ubuntu-latest]
2525
distribution: [temurin]
2626

.github/workflows/maven-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
2121

2222
- name: Configure GIT
2323
run: |

.github/workflows/release-from-tag.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
permissions:
1313
contents: write
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- uses: ncipollo/release-action@v1
1717
with:
1818
body: 'Changes: https://wcm.io/wcm/core-components/changes-report.html'

build-deploy_aem65.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626
# install AEM 6.5 with service pack
2727
mvn --non-recursive wcmio-content-package:install \
2828
--activate-profiles=${MAVEN_PROFILES} \
29-
-Dvault.artifact=adobe.binary.aem.65.servicepack:aem-service-pkg:zip:6.5.18.0 \
29+
-Dvault.artifact=adobe.binary.aem.65.servicepack:aem-service-pkg:zip:6.5.19.0 \
3030
-Dvault.delayAfterInstallSec=30
3131

3232
if [ "$?" -ne "0" ]; then

bundles/core/pom.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<parent>
2626
<groupId>io.wcm</groupId>
2727
<artifactId>io.wcm.wcm.core.components.parent</artifactId>
28-
<version>1.14.0-2.23.2</version>
28+
<version>2.0.0-2.23.2</version>
2929
<relativePath>../../parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm</groupId>
3333
<artifactId>io.wcm.wcm.core.components</artifactId>
34-
<version>1.14.0-2.23.2</version>
34+
<version>2.0.0-2.23.2</version>
3535
<packaging>jar</packaging>
3636

3737
<name>WCM Core Components</name>
@@ -154,6 +154,11 @@
154154
<artifactId>org.apache.sling.testing.logging-mock</artifactId>
155155
<scope>test</scope>
156156
</dependency>
157+
<dependency>
158+
<groupId>com.adobe.cq</groupId>
159+
<artifactId>core.wcm.components.testing.aem-mock-plugin</artifactId>
160+
<scope>test</scope>
161+
</dependency>
157162
<dependency>
158163
<groupId>org.apache.sling</groupId>
159164
<artifactId>org.apache.sling.testing.caconfig-mock-plugin</artifactId>

bundles/core/src/main/java/io/wcm/wcm/core/components/commons/link/LinkWrapper.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ public boolean isValid() {
7979
@JsonSerialize(using = LinkHtmlAttributesSerializer.class)
8080
@JsonProperty("attributes")
8181
public @NotNull Map getHtmlAttributes() {
82-
return link.getAnchorAttributes();
82+
Map<String, String> result = link.getAnchorAttributes();
83+
if (result == null) {
84+
result = Map.of();
85+
}
86+
return result;
8387
}
8488

8589
@Override

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/AbstractComponentImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
/**
3030
* Abstract class that can be used as a base class for {@link Component} implementations.
3131
*/
32+
@SuppressWarnings("java:S2176") // accept duplicate class name
3233
public abstract class AbstractComponentImpl extends com.adobe.cq.wcm.core.components.util.AbstractComponentImpl implements ComponentExporter {
3334

3435
@Override

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/ImageAreaV1Impl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
/**
3434
* Implementation of {@link ImageArea}.
3535
*/
36-
public class ImageAreaV1Impl extends ImageAreaV2Impl {
36+
public final class ImageAreaV1Impl extends ImageAreaV2Impl {
3737

3838
/**
3939
* @param delegate Delegate
4040
*/
41-
public ImageAreaV1Impl(ImageMapArea<io.wcm.handler.link.Link> delegate) {
41+
public ImageAreaV1Impl(ImageMapArea delegate) {
4242
super(delegate);
4343
}
4444

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/ImageAreaV2Impl.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
*/
3939
public class ImageAreaV2Impl implements ImageArea {
4040

41-
private final ImageMapArea<io.wcm.handler.link.Link> delegate;
41+
private final ImageMapArea delegate;
4242
private final LinkWrapper link;
4343

4444
/**
4545
* @param delegate Delegate
4646
*/
47-
public ImageAreaV2Impl(ImageMapArea<io.wcm.handler.link.Link> delegate) {
47+
public ImageAreaV2Impl(ImageMapArea delegate) {
4848
this.delegate = delegate;
49-
io.wcm.handler.link.Link delegateLink = delegate.getLink();
49+
io.wcm.handler.link.Link delegateLink = toLink(delegate.getLink());
5050
if (delegateLink != null) {
5151
this.link = new LinkWrapper(delegateLink);
5252
}
@@ -55,6 +55,15 @@ public ImageAreaV2Impl(ImageMapArea<io.wcm.handler.link.Link> delegate) {
5555
}
5656
}
5757

58+
private io.wcm.handler.link.Link toLink(Object linkObject) {
59+
if (linkObject instanceof io.wcm.handler.link.Link) {
60+
return (io.wcm.handler.link.Link)linkObject;
61+
}
62+
else {
63+
return null;
64+
}
65+
}
66+
5867
@Override
5968
public String getShape() {
6069
return delegate.getShape();

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV1Impl.java

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
/**
3838
* {@link LanguageNavigationItem} implementation.
3939
*/
40+
@SuppressWarnings("java:S110") // class hierarchy levels
4041
public class LanguageNavigationItemV1Impl extends NavigationItemV1Impl implements LanguageNavigationItem {
4142

4243
private final Page page;
@@ -56,6 +57,7 @@ public class LanguageNavigationItemV1Impl extends NavigationItemV1Impl implement
5657
* @param parentId Parent ID
5758
* @param parentComponent The component that contains this list item
5859
*/
60+
@SuppressWarnings("java:S107") // number of parameters
5961
public LanguageNavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
6062
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
6163
@Nullable String title, @Nullable String parentId, @Nullable Component parentComponent) {

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LanguageNavigationItemV2Impl.java

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
/**
3838
* {@link LanguageNavigationItem} implementation.
3939
*/
40+
@SuppressWarnings("java:S110") // class hierarchy levels
4041
public class LanguageNavigationItemV2Impl extends NavigationItemV2Impl implements LanguageNavigationItem {
4142

4243
private final Page page;
@@ -56,6 +57,7 @@ public class LanguageNavigationItemV2Impl extends NavigationItemV2Impl implement
5657
* @param parentId Parent ID
5758
* @param parentComponent The component that contains this list item
5859
*/
60+
@SuppressWarnings("java:S107") // number of parameters
5961
public LanguageNavigationItemV2Impl(@NotNull Page page, @NotNull Link link,
6062
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
6163
@Nullable String title, @Nullable String parentId, @Nullable Component parentComponent) {

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV1Impl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public LinkListItemV1Impl(@NotNull String title, @NotNull LinkWrapper link, @Not
5858
/**
5959
* @deprecated Deprecated in API
6060
*/
61-
@Deprecated
61+
@Deprecated(forRemoval = true)
6262
@Override
6363
@JsonIgnore
6464
public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
@@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
7070
* @deprecated Deprecated in API
7171
*/
7272
@Override
73-
@Deprecated
73+
@Deprecated(forRemoval = true)
7474
@JsonIgnore(false)
7575
public String getURL() {
7676
return super.getURL();

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/LinkListItemV2Impl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public LinkListItemV2Impl(@NotNull String title, @NotNull LinkWrapper link, @Not
7575
* @deprecated Deprecated in API
7676
*/
7777
@Override
78-
@Deprecated
78+
@Deprecated(forRemoval = true)
7979
@JsonIgnore
8080
public String getURL() {
8181
return link.getURL();
@@ -97,7 +97,7 @@ protected String getItemIdPrefix() {
9797
protected @NotNull PageData getComponentData() {
9898
return DataLayerBuilder.extending(super.getComponentData()).asPage()
9999
.withTitle(this::getTitle)
100-
.withLinkUrl(this::getURL)
100+
.withLinkUrl(link::getURL)
101101
.build();
102102
}
103103

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV1Impl.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
/**
3535
* {@link NavigationItem} implementation.
3636
*/
37+
@SuppressWarnings("java:S110") // class hierarchy levels
3738
public class NavigationItemV1Impl extends PageListItemV1Impl implements NavigationItem {
3839

3940
private final Page page;
@@ -52,6 +53,7 @@ public class NavigationItemV1Impl extends PageListItemV1Impl implements Navigati
5253
* @param parentId Parent ID
5354
* @param parentComponent The component that contains this list item
5455
*/
56+
@SuppressWarnings("java:S107") // number of parameters
5557
public NavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
5658
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
5759
@Nullable String parentId, @Nullable Component parentComponent) {
@@ -67,7 +69,7 @@ public NavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
6769
* @deprecated Deprecated in API
6870
*/
6971
@Override
70-
@Deprecated
72+
@Deprecated(forRemoval = true)
7173
@JsonIgnore
7274
public Page getPage() {
7375
return page;

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/NavigationItemV2Impl.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
/**
3535
* {@link NavigationItem} implementation.
3636
*/
37+
@SuppressWarnings("java:S110") // class hierarchy levels
3738
public class NavigationItemV2Impl extends PageListItemV2Impl implements NavigationItem {
3839

3940
private final Page page;
@@ -52,6 +53,7 @@ public class NavigationItemV2Impl extends PageListItemV2Impl implements Navigati
5253
* @param parentId Parent ID
5354
* @param parentComponent The component that contains this list item
5455
*/
56+
@SuppressWarnings("java:S107") // number of parameters
5557
public NavigationItemV2Impl(@NotNull Page page, @NotNull Link link,
5658
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
5759
@Nullable String parentId, @Nullable Component parentComponent) {
@@ -67,7 +69,7 @@ public NavigationItemV2Impl(@NotNull Page page, @NotNull Link link,
6769
* @deprecated Deprecated in API
6870
*/
6971
@Override
70-
@Deprecated
72+
@Deprecated(forRemoval = true)
7173
@JsonIgnore
7274
public Page getPage() {
7375
return page;

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV1Impl.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
/**
3434
* {@link ListItem} implementation for page links.
3535
*/
36+
@SuppressWarnings("java:S110") // class hierarchy levels
3637
public class PageListItemV1Impl extends PageListItemV2Impl implements LinkMixin {
3738

3839
/**
@@ -63,7 +64,7 @@ public PageListItemV1Impl(@NotNull Page page, @NotNull Link link,
6364
* @deprecated Deprecated in API
6465
*/
6566
@Override
66-
@Deprecated
67+
@Deprecated(forRemoval = true)
6768
@JsonIgnore(false)
6869
public String getURL() {
6970
return super.getURL();

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/helpers/PageListItemV4Impl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public PageListItemV4Impl(@NotNull Page page, @NotNull Link link,
106106
* @deprecated Deprecated in API
107107
*/
108108
@Override
109-
@Deprecated(since = "1.9.0-2.17.2")
109+
@Deprecated(forRemoval = true, since = "1.9.0-2.17.2")
110110
@JsonIgnore
111111
public String getURL() {
112112
return link.getURL();

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/ButtonV1Impl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class ButtonV1Impl extends ButtonV2Impl implements LinkMixin {
5858
/**
5959
* @deprecated Deprecated in API
6060
*/
61-
@Deprecated
61+
@Deprecated(forRemoval = true)
6262
@Override
6363
@JsonIgnore
6464
public com.adobe.cq.wcm.core.components.commons.link.Link getButtonLink() {
@@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getButtonLink() {
7070
* @deprecated Deprecated in API
7171
*/
7272
@Override
73-
@Deprecated
73+
@Deprecated(forRemoval = true)
7474
@JsonIgnore(false)
7575
public String getLink() {
7676
return super.getLink();

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/LayoutContainerV1Impl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class LayoutContainerV1Impl extends AbstractContainerImpl implements Layo
7474
*/
7575
@Override
7676
@JsonIgnore
77-
@Deprecated(since = "1.13.0-2.22.6")
77+
@Deprecated(forRemoval = true, since = "1.13.0-2.22.6")
7878
public @NotNull List<ListItem> getItems() {
7979
return delegate.getItems();
8080
}

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v1/TeaserV1Impl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
7070
* @deprecated Deprecated in API
7171
*/
7272
@Override
73-
@Deprecated
73+
@Deprecated(forRemoval = true)
7474
@JsonIgnore(false)
7575
@JsonProperty("linkURL")
7676
public String getLinkURL() {

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/BreadcrumbV2ItemImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
@JsonIgnoreProperties({
4141
"page", "children", "level", "description", "lastModified", PROPERTY_PATH
4242
})
43+
@SuppressWarnings("java:S110") // class hierarchy levels
4344
public class BreadcrumbV2ItemImpl extends NavigationItemV1Impl implements NavigationItem {
4445

4546
/**

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ButtonV2Impl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public Link getButtonLink() {
9393
* @deprecated Deprecated in API
9494
*/
9595
@Override
96-
@Deprecated
96+
@Deprecated(forRemoval = true)
9797
@JsonIgnore
9898
public String getLink() {
9999
return link.getURL();

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/ImageV2Impl.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
import io.wcm.handler.link.Link;
3939
import io.wcm.handler.media.Media;
40+
import io.wcm.handler.media.Rendition;
4041
import io.wcm.wcm.core.components.impl.models.helpers.ImageAreaV1Impl;
4142
import io.wcm.wcm.core.components.impl.models.v3.ImageV3Impl;
4243
import io.wcm.wcm.core.components.impl.servlets.ImageWidthProxyServlet;
@@ -89,7 +90,11 @@ protected List<ImageArea> buildAreas() {
8990
*/
9091
@Override
9192
protected List<Long> buildRenditionWidths() {
92-
long maxWidth = media.getRendition().getWidth();
93+
Rendition rendition = media.getRendition();
94+
if (rendition == null) {
95+
return List.of();
96+
}
97+
long maxWidth = rendition.getWidth();
9398
String[] configuredWidths = currentStyle.get(PN_DESIGN_ALLOWED_RENDITION_WIDTHS, new String[0]);
9499
return Arrays.stream(configuredWidths)
95100
.map(NumberUtils::toLong)

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/NavigationV2Impl.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,9 @@ private boolean isCurrent(@NotNull Page page, @NotNull Link link) {
267267
}
268268

269269
private boolean currentPageIsRedirectTarget(@NotNull Link link) {
270-
return link.getTargetPage() != null
271-
&& StringUtils.equals(getCurrentPage().getPath(), link.getTargetPage().getPath());
270+
Page targetPage = link.getTargetPage();
271+
return targetPage != null
272+
&& StringUtils.equals(getCurrentPage().getPath(), targetPage.getPath());
272273
}
273274

274275
protected NavigationItem newNavigationItem(@NotNull Page page, @NotNull Link link,

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TeaserV2Impl.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public class TeaserV2Impl extends AbstractComponentImpl implements Teaser, Media
104104
private boolean titleLinkHidden;
105105

106106
@PostConstruct
107+
@SuppressWarnings({ "java:S3776", "java:S6541" }) // ignore complexity
107108
private void activate() {
108109
ValueMap properties = resource.getValueMap();
109110

@@ -215,7 +216,7 @@ public Link getLink() {
215216
* @deprecated Deprecated in API
216217
*/
217218
@Override
218-
@Deprecated
219+
@Deprecated(forRemoval = true)
219220
@JsonIgnore
220221
public String getLinkURL() {
221222
return link.getURL();
@@ -261,7 +262,7 @@ public String getTitleType() {
261262
protected @NotNull ComponentData getComponentData() {
262263
return DataLayerBuilder.extending(super.getComponentData()).asComponent()
263264
.withTitle(this::getTitle)
264-
.withLinkUrl(this::getLinkURL)
265+
.withLinkUrl(link::getURL)
265266
.withDescription(this::getDescription)
266267
.build();
267268
}

bundles/core/src/main/java/io/wcm/wcm/core/components/impl/models/v2/TitleV2Impl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
6767
* @deprecated Deprecated in API
6868
*/
6969
@Override
70-
@Deprecated
70+
@Deprecated(forRemoval = true)
7171
@JsonIgnore(false)
7272
@JsonProperty("linkURL")
7373
public String getLinkURL() {

0 commit comments

Comments
 (0)