Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adminEmail field invalid in OAI-PMH Identify response #3619

Closed
tdilauro opened this issue Feb 2, 2017 · 7 comments · Fixed by #6513 or #6538
Closed

adminEmail field invalid in OAI-PMH Identify response #3619

tdilauro opened this issue Feb 2, 2017 · 7 comments · Fixed by #6513 or #6538

Comments

@tdilauro
Copy link
Contributor

tdilauro commented Feb 2, 2017

Unless the :SystemEmail setting contains only a mailbox addr-spec (just the address, no spaces or angle brackets), the Dataverse 4 OAI-PMH provider will return an invalid value for the adminEmail field, since that field should not contain a mailbox display name.

For example, the sample command in the :SystemEmail section of the Configuration section of the Installation Guide:

curl -X PUT -d "Support <[email protected]>" http://localhost:8080/api/admin/settings/:SystemEmail

would result in this error.

Ideally, the OAI-PMH provider code would check for a value ending in "<.*>" and, if present, emit only the string between the angle brackets (i.e., like to sed -e 's/^[^<]*<\([^>]*\)>$/\1/ ').

@pdurbin
Copy link
Member

pdurbin commented Feb 3, 2017

Ah, .withAdminEmail(settingsService.getValueForKey(SettingsServiceBean.Key.SystemEmail)) at https://github.com/IQSS/dataverse/blob/v4.6/src/main/java/edu/harvard/iq/dataverse/harvest/server/web/servlet/OAIServlet.java#L186 should probably call parseSystemAddress at https://github.com/IQSS/dataverse/blob/v4.6/src/main/java/edu/harvard/iq/dataverse/util/MailUtil.java#L12 instead to get back a InternetAddress object from which just the email address can be extracted for use in an OAI-PMH context.

@pdurbin
Copy link
Member

pdurbin commented Jun 23, 2017

As of 4.7 we are further promoting the addition of a name to the email address. For now, see "Branding Your Installation" at https://github.com/IQSS/dataverse/blob/a7242a92eb5173977fff6eadc984ce22ec55f3ba/doc/sphinx-guides/source/installation/config.rst#id75

@pdurbin pdurbin added the User Role: Curator Curates and reviews datasets, manages permissions label Jul 4, 2017
@pdurbin
Copy link
Member

pdurbin commented Oct 1, 2019

I just noticed the post by @poikilotherm about Hacktoberfest ( https://hacktoberfest.digitalocean.com ) at https://groups.google.com/d/msg/dataverse-community/ootwCQL-4K4/00QO3__8CQAJ and the fact that he started using the label "hacktoberfest" over at https://github.com/IQSS/dataverse-kubernetes/issues

He's inviting IQSS to use this label as well and this issue seems to meet "Choose issues that have a well-defined scope and are self-contained" guidance at https://hacktoberfest.digitalocean.com/details

First, it's easy to see that Harvard Dataverse is returning an invalid response (red ERROR at the bottom of the screenshot below) by going to http://oval.base-search.net and entering https://dataverse.harvard.edu/oai

Screen Shot 2019-10-01 at 11 46 30 AM

I think the fix could be a one line change (plus adding an import statement). Maybe something like the untested diff below:

$ git diff
diff --git a/src/main/java/edu/harvard/iq/dataverse/harvest/server/web/servlet/OAIServlet.java b/src/main/java/edu/harvard/iq/dataverse/harvest/server/web/servlet/OAIServlet.java
index 555e5a996..8b3fe0cdd 100644
--- a/src/main/java/edu/harvard/iq/dataverse/harvest/server/web/servlet/OAIServlet.java
+++ b/src/main/java/edu/harvard/iq/dataverse/harvest/server/web/servlet/OAIServlet.java
@@ -38,6 +38,7 @@ import edu.harvard.iq.dataverse.harvest.server.xoai.XitemRepository;
 import edu.harvard.iq.dataverse.harvest.server.xoai.XsetRepository;
 import edu.harvard.iq.dataverse.harvest.server.xoai.XlistRecords;
 import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
+import edu.harvard.iq.dataverse.util.MailUtil;
 import edu.harvard.iq.dataverse.util.SystemConfig;
 import org.apache.commons.lang.StringUtils;
 
@@ -184,7 +185,7 @@ public class OAIServlet extends HttpServlet {
                 .withBaseUrl(systemConfig.getDataverseSiteUrl()+"/oai")
                 .withCompression("gzip")        // ?
                 .withCompression("deflate")     // ?
-                .withAdminEmail(settingsService.getValueForKey(SettingsServiceBean.Key.SystemEmail))
+                .withAdminEmail(MailUtil.parseSystemAddress(settingsService.getValueForKey(SettingsServiceBean.Key.SystemEmail)).getAddress())
                 .withDeleteMethod(DeletedRecord.TRANSIENT)
                 .withGranularity(Granularity.Second)
                 .withMaxListIdentifiers(100)

The starting point for anyone picking this up should be the Dataverse Developer Guide at http://guides.dataverse.org/en/4.16/developers/index.html

I'm happy to answer questions here or at http://chat.dataverse.org or at https://groups.google.com/forum/#!forum/dataverse-dev

I'd like to note that this bug affects on just Harvard Dataverse. It was also reported here: ualbertalib#63

@pdurbin pdurbin added the hacktoberfest It's Hacktoberfest! https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ label Oct 1, 2019
@pdurbin pdurbin added Hackathon: Low Hanging Fruit and removed hacktoberfest It's Hacktoberfest! https://groups.google.com/g/dataverse-community/c/n_Nn_T2yA-w/m/BcoXO4tEAQAJ labels Nov 22, 2019
@pdurbin
Copy link
Member

pdurbin commented Nov 22, 2019

@pdurbin
Copy link
Member

pdurbin commented Jan 13, 2020

I just made pull request #6513 to fix this.

@pdurbin pdurbin assigned pdurbin and unassigned pdurbin Jan 13, 2020
kcondon added a commit that referenced this issue Jan 15, 2020
only show email portion system email via Harvesting #3619
@pdurbin
Copy link
Member

pdurbin commented Jan 17, 2020

Shoot. I made a mistake in pull request #6513 and now we're seeing errors in "develop" at

https://build.hmdc.harvard.edu:8443/job/phoenix.dataverse.org-apitest-develop/lastBuild/edu.harvard.iq$dataverse/testReport/edu.harvard.iq.dataverse.api/HarvestingServerIT/testOaiFunctionality/

Screen Shot 2020-01-17 at 9 41 15 AM

I'm reopening this issue and will submit another pull request.

@pdurbin pdurbin reopened this Jan 17, 2020
@pdurbin pdurbin self-assigned this Jan 17, 2020
@pdurbin
Copy link
Member

pdurbin commented Jan 17, 2020

I just made pull request #6538 to fix the error above. A null pointer exception was being thrown.

@pdurbin pdurbin removed their assignment Jan 17, 2020
kcondon added a commit that referenced this issue Jan 17, 2020
avoid null pointer when getting email for OAI-PMH #3619
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants