From fedb103d984d5bf67693f0034ae77855eb9bdce4 Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Wed, 9 Aug 2023 16:34:53 -0400 Subject: [PATCH] add no-op editFileMetadata() to FilePage to prevent errors #8305 As of Payara 6/JSF 4/Jakarta EE 10, this syntax doesn't work: action="#{bean[editFileAction]()}" (Or it logs errors in server.log at the very least.) So we switch to this syntax: action=#{bean.editFileMetadata()}" This means we have to make sure the method exists on all the beans, though, or we get errors. (It's unclear why we weren't seeing errors before!) So we add the method to FilePage, which gets passed as bean. We also remove the now unused "editFileAction". --- src/main/java/edu/harvard/iq/dataverse/FilePage.java | 9 +++++++++ src/main/webapp/file-edit-button-fragment.xhtml | 3 +-- src/main/webapp/filesFragment.xhtml | 1 - 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/FilePage.java b/src/main/java/edu/harvard/iq/dataverse/FilePage.java index 018c88691ce..49c904c3ac3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FilePage.java +++ b/src/main/java/edu/harvard/iq/dataverse/FilePage.java @@ -1246,4 +1246,13 @@ public boolean isHasPublicStore() { return settingsWrapper.isTrueForKey(SettingsServiceBean.Key.PublicInstall, StorageIO.isPublicStore(DataAccess.getStorageDriverFromIdentifier(file.getStorageIdentifier()))); } + /** + * This method only exists because in file-edit-button-fragment.xhtml we + * call bean.editFileMetadata() and we need both FilePage (this bean) and + * DatasetPage to have the method defined to prevent errors in server.log. + */ + public String editFileMetadata(){ + return ""; + } + } diff --git a/src/main/webapp/file-edit-button-fragment.xhtml b/src/main/webapp/file-edit-button-fragment.xhtml index 8531f413b38..a31438f8e06 100644 --- a/src/main/webapp/file-edit-button-fragment.xhtml +++ b/src/main/webapp/file-edit-button-fragment.xhtml @@ -25,7 +25,6 @@ configureTools - for single file, list of configureTools for the file bean - the named value of the backing bean for the below method(s), also used by isFilePg param unrestrictFileAction - name of the method on the above bean to call for unrestrict (method must take a boolean) - editFileAction - for selected files, name of method on the above bean to send for edit metadata refreshTagsPopoupAction - for selected files, name of method on the above bean to refresh tags popup --> @@ -38,7 +37,7 @@ + action="#{bean.editFileMetadata()}"> diff --git a/src/main/webapp/filesFragment.xhtml b/src/main/webapp/filesFragment.xhtml index cdb6af88cd3..6d3c6062ec7 100644 --- a/src/main/webapp/filesFragment.xhtml +++ b/src/main/webapp/filesFragment.xhtml @@ -421,7 +421,6 @@ -