Skip to content

Commit

Permalink
MID-7661 proper 404 page returned when object is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Mar 14, 2022
1 parent 38abcce commit 548dc5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import javax.xml.namespace.QName;

import com.evolveum.midpoint.authentication.api.util.AuthUtil;
import com.evolveum.midpoint.web.page.error.PageError;

import com.evolveum.midpoint.web.page.error.PageError404;

import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -292,7 +293,10 @@ public static <T extends ObjectType> PrismObject<T> loadObject(Class<T> type, St
page.showResult(subResult);
}
if (object == null && !allowNotFound) {
throw new RestartResponseException(PageError.class);
PageError404 notFound = new PageError404();
notFound.setBreadcrumbs(page.getBreadcrumbs());

throw new RestartResponseException(notFound);
}
LOGGER.debug("Loaded {} with result {}", object, subResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import com.evolveum.midpoint.authentication.api.config.ModuleAuthentication;
import com.evolveum.midpoint.authentication.api.authorization.Url;

import com.evolveum.midpoint.web.component.util.VisibleBehaviour;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
Expand Down Expand Up @@ -136,6 +138,7 @@ public void onClick(AjaxRequestTarget target) {
backPerformed(target);
}
};
back.add(new VisibleBehaviour(() -> PageError.this.getBreadcrumbs().size() > 1));
add(back);

AjaxButton home = new AjaxButton(ID_HOME, createStringResource("PageError.button.home")) {
Expand Down

0 comments on commit 548dc5a

Please sign in to comment.