Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Jan 26, 2024
2 parents ad61f8e + 07cb2ea commit 30f5c00
Show file tree
Hide file tree
Showing 66 changed files with 212 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [11, 17]
java: [11, 17, 21]
os: [ubuntu-latest]
distribution: [temurin]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Configure GIT
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-from-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ncipollo/release-action@v1
with:
body: 'Changes: https://wcm.io/wcm/core-components/changes-report.html'
Expand Down
2 changes: 1 addition & 1 deletion build-deploy_aem65.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi
# install AEM 6.5 with service pack
mvn --non-recursive wcmio-content-package:install \
--activate-profiles=${MAVEN_PROFILES} \
-Dvault.artifact=adobe.binary.aem.65.servicepack:aem-service-pkg:zip:6.5.18.0 \
-Dvault.artifact=adobe.binary.aem.65.servicepack:aem-service-pkg:zip:6.5.19.0 \
-Dvault.delayAfterInstallSec=30

if [ "$?" -ne "0" ]; then
Expand Down
9 changes: 7 additions & 2 deletions bundles/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
<parent>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.wcm.core.components.parent</artifactId>
<version>1.14.0-2.23.2</version>
<version>2.0.0-2.23.2</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

<groupId>io.wcm</groupId>
<artifactId>io.wcm.wcm.core.components</artifactId>
<version>1.14.0-2.23.2</version>
<version>2.0.0-2.23.2</version>
<packaging>jar</packaging>

<name>WCM Core Components</name>
Expand Down Expand Up @@ -154,6 +154,11 @@
<artifactId>org.apache.sling.testing.logging-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.adobe.cq</groupId>
<artifactId>core.wcm.components.testing.aem-mock-plugin</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.caconfig-mock-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ public boolean isValid() {
@JsonSerialize(using = LinkHtmlAttributesSerializer.class)
@JsonProperty("attributes")
public @NotNull Map getHtmlAttributes() {
return link.getAnchorAttributes();
Map<String, String> result = link.getAnchorAttributes();
if (result == null) {
result = Map.of();
}
return result;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
/**
* Abstract class that can be used as a base class for {@link Component} implementations.
*/
@SuppressWarnings("java:S2176") // accept duplicate class name
public abstract class AbstractComponentImpl extends com.adobe.cq.wcm.core.components.util.AbstractComponentImpl implements ComponentExporter {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
/**
* Implementation of {@link ImageArea}.
*/
public class ImageAreaV1Impl extends ImageAreaV2Impl {
public final class ImageAreaV1Impl extends ImageAreaV2Impl {

/**
* @param delegate Delegate
*/
public ImageAreaV1Impl(ImageMapArea<io.wcm.handler.link.Link> delegate) {
public ImageAreaV1Impl(ImageMapArea delegate) {
super(delegate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
*/
public class ImageAreaV2Impl implements ImageArea {

private final ImageMapArea<io.wcm.handler.link.Link> delegate;
private final ImageMapArea delegate;
private final LinkWrapper link;

/**
* @param delegate Delegate
*/
public ImageAreaV2Impl(ImageMapArea<io.wcm.handler.link.Link> delegate) {
public ImageAreaV2Impl(ImageMapArea delegate) {
this.delegate = delegate;
io.wcm.handler.link.Link delegateLink = delegate.getLink();
io.wcm.handler.link.Link delegateLink = toLink(delegate.getLink());
if (delegateLink != null) {
this.link = new LinkWrapper(delegateLink);
}
Expand All @@ -55,6 +55,15 @@ public ImageAreaV2Impl(ImageMapArea<io.wcm.handler.link.Link> delegate) {
}
}

private io.wcm.handler.link.Link toLink(Object linkObject) {
if (linkObject instanceof io.wcm.handler.link.Link) {
return (io.wcm.handler.link.Link)linkObject;
}
else {
return null;
}
}

@Override
public String getShape() {
return delegate.getShape();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
/**
* {@link LanguageNavigationItem} implementation.
*/
@SuppressWarnings("java:S110") // class hierarchy levels
public class LanguageNavigationItemV1Impl extends NavigationItemV1Impl implements LanguageNavigationItem {

private final Page page;
Expand All @@ -56,6 +57,7 @@ public class LanguageNavigationItemV1Impl extends NavigationItemV1Impl implement
* @param parentId Parent ID
* @param parentComponent The component that contains this list item
*/
@SuppressWarnings("java:S107") // number of parameters
public LanguageNavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
@Nullable String title, @Nullable String parentId, @Nullable Component parentComponent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
/**
* {@link LanguageNavigationItem} implementation.
*/
@SuppressWarnings("java:S110") // class hierarchy levels
public class LanguageNavigationItemV2Impl extends NavigationItemV2Impl implements LanguageNavigationItem {

private final Page page;
Expand All @@ -56,6 +57,7 @@ public class LanguageNavigationItemV2Impl extends NavigationItemV2Impl implement
* @param parentId Parent ID
* @param parentComponent The component that contains this list item
*/
@SuppressWarnings("java:S107") // number of parameters
public LanguageNavigationItemV2Impl(@NotNull Page page, @NotNull Link link,
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
@Nullable String title, @Nullable String parentId, @Nullable Component parentComponent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public LinkListItemV1Impl(@NotNull String title, @NotNull LinkWrapper link, @Not
/**
* @deprecated Deprecated in API
*/
@Deprecated
@Deprecated(forRemoval = true)
@Override
@JsonIgnore
public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
Expand All @@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore(false)
public String getURL() {
return super.getURL();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public LinkListItemV2Impl(@NotNull String title, @NotNull LinkWrapper link, @Not
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore
public String getURL() {
return link.getURL();
Expand All @@ -97,7 +97,7 @@ protected String getItemIdPrefix() {
protected @NotNull PageData getComponentData() {
return DataLayerBuilder.extending(super.getComponentData()).asPage()
.withTitle(this::getTitle)
.withLinkUrl(this::getURL)
.withLinkUrl(link::getURL)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
/**
* {@link NavigationItem} implementation.
*/
@SuppressWarnings("java:S110") // class hierarchy levels
public class NavigationItemV1Impl extends PageListItemV1Impl implements NavigationItem {

private final Page page;
Expand All @@ -52,6 +53,7 @@ public class NavigationItemV1Impl extends PageListItemV1Impl implements Navigati
* @param parentId Parent ID
* @param parentComponent The component that contains this list item
*/
@SuppressWarnings("java:S107") // number of parameters
public NavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
@Nullable String parentId, @Nullable Component parentComponent) {
Expand All @@ -67,7 +69,7 @@ public NavigationItemV1Impl(@NotNull Page page, @NotNull Link link,
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore
public Page getPage() {
return page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
/**
* {@link NavigationItem} implementation.
*/
@SuppressWarnings("java:S110") // class hierarchy levels
public class NavigationItemV2Impl extends PageListItemV2Impl implements NavigationItem {

private final Page page;
Expand All @@ -52,6 +53,7 @@ public class NavigationItemV2Impl extends PageListItemV2Impl implements Navigati
* @param parentId Parent ID
* @param parentComponent The component that contains this list item
*/
@SuppressWarnings("java:S107") // number of parameters
public NavigationItemV2Impl(@NotNull Page page, @NotNull Link link,
int level, boolean active, boolean current, @NotNull List<NavigationItem> children,
@Nullable String parentId, @Nullable Component parentComponent) {
Expand All @@ -67,7 +69,7 @@ public NavigationItemV2Impl(@NotNull Page page, @NotNull Link link,
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore
public Page getPage() {
return page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
/**
* {@link ListItem} implementation for page links.
*/
@SuppressWarnings("java:S110") // class hierarchy levels
public class PageListItemV1Impl extends PageListItemV2Impl implements LinkMixin {

/**
Expand Down Expand Up @@ -63,7 +64,7 @@ public PageListItemV1Impl(@NotNull Page page, @NotNull Link link,
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore(false)
public String getURL() {
return super.getURL();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public PageListItemV4Impl(@NotNull Page page, @NotNull Link link,
* @deprecated Deprecated in API
*/
@Override
@Deprecated(since = "1.9.0-2.17.2")
@Deprecated(forRemoval = true, since = "1.9.0-2.17.2")
@JsonIgnore
public String getURL() {
return link.getURL();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class ButtonV1Impl extends ButtonV2Impl implements LinkMixin {
/**
* @deprecated Deprecated in API
*/
@Deprecated
@Deprecated(forRemoval = true)
@Override
@JsonIgnore
public com.adobe.cq.wcm.core.components.commons.link.Link getButtonLink() {
Expand All @@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getButtonLink() {
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore(false)
public String getLink() {
return super.getLink();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class LayoutContainerV1Impl extends AbstractContainerImpl implements Layo
*/
@Override
@JsonIgnore
@Deprecated(since = "1.13.0-2.22.6")
@Deprecated(forRemoval = true, since = "1.13.0-2.22.6")
public @NotNull List<ListItem> getItems() {
return delegate.getItems();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore(false)
@JsonProperty("linkURL")
public String getLinkURL() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@JsonIgnoreProperties({
"page", "children", "level", "description", "lastModified", PROPERTY_PATH
})
@SuppressWarnings("java:S110") // class hierarchy levels
public class BreadcrumbV2ItemImpl extends NavigationItemV1Impl implements NavigationItem {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Link getButtonLink() {
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore
public String getLink() {
return link.getURL();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import io.wcm.handler.link.Link;
import io.wcm.handler.media.Media;
import io.wcm.handler.media.Rendition;
import io.wcm.wcm.core.components.impl.models.helpers.ImageAreaV1Impl;
import io.wcm.wcm.core.components.impl.models.v3.ImageV3Impl;
import io.wcm.wcm.core.components.impl.servlets.ImageWidthProxyServlet;
Expand Down Expand Up @@ -89,7 +90,11 @@ protected List<ImageArea> buildAreas() {
*/
@Override
protected List<Long> buildRenditionWidths() {
long maxWidth = media.getRendition().getWidth();
Rendition rendition = media.getRendition();
if (rendition == null) {
return List.of();
}
long maxWidth = rendition.getWidth();
String[] configuredWidths = currentStyle.get(PN_DESIGN_ALLOWED_RENDITION_WIDTHS, new String[0]);
return Arrays.stream(configuredWidths)
.map(NumberUtils::toLong)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ private boolean isCurrent(@NotNull Page page, @NotNull Link link) {
}

private boolean currentPageIsRedirectTarget(@NotNull Link link) {
return link.getTargetPage() != null
&& StringUtils.equals(getCurrentPage().getPath(), link.getTargetPage().getPath());
Page targetPage = link.getTargetPage();
return targetPage != null
&& StringUtils.equals(getCurrentPage().getPath(), targetPage.getPath());
}

protected NavigationItem newNavigationItem(@NotNull Page page, @NotNull Link link,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public class TeaserV2Impl extends AbstractComponentImpl implements Teaser, Media
private boolean titleLinkHidden;

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

Expand Down Expand Up @@ -215,7 +216,7 @@ public Link getLink() {
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore
public String getLinkURL() {
return link.getURL();
Expand Down Expand Up @@ -261,7 +262,7 @@ public String getTitleType() {
protected @NotNull ComponentData getComponentData() {
return DataLayerBuilder.extending(super.getComponentData()).asComponent()
.withTitle(this::getTitle)
.withLinkUrl(this::getLinkURL)
.withLinkUrl(link::getURL)
.withDescription(this::getDescription)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public com.adobe.cq.wcm.core.components.commons.link.Link getLink() {
* @deprecated Deprecated in API
*/
@Override
@Deprecated
@Deprecated(forRemoval = true)
@JsonIgnore(false)
@JsonProperty("linkURL")
public String getLinkURL() {
Expand Down
Loading

0 comments on commit 30f5c00

Please sign in to comment.