Skip to content

Commit

Permalink
Fallback to default extensional type if type cannot be derived from p…
Browse files Browse the repository at this point in the history
…age parameters
  • Loading branch information
Willem Elbers committed Nov 1, 2024
1 parent 0354f0d commit 3c279cd
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,21 @@ public SubmitVirtualCollectionPage() {}
@Override
protected void onBeforeRender() {
//Derivate type from page parameter
String type_string = getPageParameters().get("type").toString();
VirtualCollection.Type type = null;
try {
type = VirtualCollection.Type.valueOf(type_string.toUpperCase());
} catch(IllegalArgumentException ex) {
//Invalid collection type
//TODO: handle error
logger.error("Invalid collection type: {}",type_string);
String type_string = getPageParameters().get("type").toString();
if(type_string == null) {
logger.warn("Collection type not found in page parameters");
type = VirtualCollection.Type.EXTENSIONAL; //fallback to extensional
} else {
try {
type = VirtualCollection.Type.valueOf(type_string.toUpperCase());
} catch(IllegalArgumentException ex) {
//Invalid collection type
//TODO: handle error
logger.error("Invalid collection type: {}",type_string);
}
}

VirtualCollection vc = SubmissionUtils.retrieveCollection(getSession());
if(vc != null && !isSignedIn()) {
logger.info("Collection stored in session, but not logged in");
Expand Down

0 comments on commit 3c279cd

Please sign in to comment.