Skip to content

Commit

Permalink
fixing NPE on repository list page (MID-8085)
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Sep 7, 2022
1 parent 84912a5 commit c3c0ce4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
Expand Down Expand Up @@ -104,7 +105,7 @@ public class PageDebugList extends PageAdminConfiguration {
private static final String ID_TABLE_HEADER = "tableHeader";

// search form model;
private final LoadableModel<Search<? extends ObjectType>> searchModel;
private final LoadableDetachableModel<Search<? extends ObjectType>> searchModel;
// todo make this persistent (in user session)
private final IModel<Boolean> showAllItemsModel = Model.of(true);
// confirmation dialog model
Expand All @@ -113,7 +114,7 @@ public class PageDebugList extends PageAdminConfiguration {

public PageDebugList() {

searchModel = new LoadableModel<>(false) {
searchModel = new LoadableDetachableModel<>() {
private static final long serialVersionUID = 1L;

@Override
Expand Down Expand Up @@ -324,11 +325,11 @@ public void exportPerformed(AjaxRequestTarget target, IModel<DebugObjectItem> mo

@NotNull
private Class<? extends ObjectType> getType() {
return searchModel.isLoaded() ? searchModel.getObject().getTypeClass() : SystemConfigurationType.class;
return searchModel.isAttached() ? searchModel.getObject().getTypeClass() : SystemConfigurationType.class;
}

private ContainerTypeSearchItem<? extends ObjectType> getTypeItem() {
return searchModel.isLoaded() ? searchModel.getObject().getType() : null;
return searchModel.isAttached() ? searchModel.getObject().getType() : null;
}

private List<InlineMenuItem> initInlineMenu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ public class DebugSearchFragment extends Fragment {
private static final String ID_SHOW_ALL_ITEMS_CHECK = "showAllItemsCheck";
private static final String ID_SEARCH_FORM = "searchForm";

private IModel<Boolean> showAllItemsModel;

public DebugSearchFragment(String id, String markupId, MarkupContainer markupProvider,
IModel<Search<? extends ObjectType>> model, IModel<Boolean> showAllItemsModel) {
super(id, markupId, markupProvider, model);
this.showAllItemsModel = showAllItemsModel;
}

@Override
protected void onInitialize() {
super.onInitialize();
initLayout(showAllItemsModel);
}

Expand Down

0 comments on commit c3c0ce4

Please sign in to comment.