Skip to content

Commit

Permalink
Merge pull request #98 from phenotips/PN-413
Browse files Browse the repository at this point in the history
PN-413: Add information to the Reference and Matched columns to show institution/group that submitted the case
  • Loading branch information
veronikaslc committed Aug 6, 2019
2 parents 89e1b2b + 5591ffa commit 44d1943
Showing 1 changed file with 3 additions and 13 deletions.
Expand Up @@ -37,8 +37,7 @@
import org.xwiki.component.manager.ComponentLookupException;
import org.xwiki.component.manager.ComponentManager;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -364,17 +363,8 @@ private ContactInfo parseContactInfo(JSONObject json)
contactInfo.withInstitution(institution);

if (href != null && href.startsWith("mailto:")) {
URL emailUrl;
try {
emailUrl = new URL(href);
String emails = emailUrl.getPath();
if (StringUtils.isNotBlank(emails) && !emails.contains(",")) {
// Only one email in mailto
contactInfo.withEmail(emails);
}
} catch (MalformedURLException e) {
LOGGER.warn("Invalid mailto URL: " + href);
}
String emailList = href.replace("mailto:", "");
contactInfo.withEmails(Arrays.asList(emailList.split(",|;")));
}

return contactInfo.build();
Expand Down

0 comments on commit 44d1943

Please sign in to comment.