Skip to content

Commit f923709

Browse files
Handle bad peptide_group_id values more gracefully (#212)
1 parent 49d8483 commit f923709

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

pepdb/src/org/scharp/atlas/pepdb/PepDBController.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.labkey.api.view.InsertView;
3434
import org.labkey.api.view.JspView;
3535
import org.labkey.api.view.NavTree;
36+
import org.labkey.api.view.NotFoundException;
3637
import org.labkey.api.view.UpdateView;
3738
import org.labkey.api.view.VBox;
3839
import org.labkey.api.view.ViewContext;
@@ -442,7 +443,18 @@ public class DisplayPeptideGroupInformationAction extends SimpleViewAction<Pepti
442443
public ModelAndView getView(PeptideAndGroupForm form, BindException errors) throws Exception
443444
{
444445
_log.debug("PeptideAndGroupForm: " + form.toString());
445-
PeptideGroup pg = PepDBManager.getPeptideGroupByID(Integer.parseInt(form.getPeptide_group_id()));
446+
PeptideGroup pg = null;
447+
try
448+
{
449+
int peptideGroupId = Integer.parseInt(form.getPeptide_group_id());
450+
pg = PepDBManager.getPeptideGroupByID(peptideGroupId);
451+
}
452+
catch (NumberFormatException ignored) {}
453+
if (pg == null || !getContainer().getId().equalsIgnoreCase(pg.getContainerId()))
454+
{
455+
throw new NotFoundException();
456+
}
457+
446458
DataRegion rgn1 = new DataRegion();
447459
TableInfo tableInfo1 = PepDBSchema.getInstance().getTableInfoPeptideGroups();
448460
rgn1.setColumns(tableInfo1.getColumns("peptide_group_id,peptide_group_name,pathogen_id,seq_ref,clade_id,pep_align_ref_id,group_type_id,createdby,created,modifiedby,modified"));

0 commit comments

Comments
 (0)