Skip to content

Commit 04345f3

Browse files
committed
Fix for duplicarte contributor when exporting to bibtex
1 parent 1abc724 commit 04345f3

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

orcid-core/src/main/java/org/orcid/core/manager/impl/BibtexManagerImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,15 @@ public String workToBibtex(Work work, String creditName){
150150
}
151151
//name
152152
List<String> names = new ArrayList<String>();
153-
names.add(creditName);
153+
if (creditName != null) {
154+
names.add(creditName.trim());
155+
}
154156
if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
155157
for (Contributor c : work.getWorkContributors().getContributor()) {
156158
if (c.getCreditName() != null && c.getCreditName().getContent() != null) {
157-
names.add(c.getCreditName().getContent());
159+
if(!names.contains(c.getCreditName().getContent().trim())) {
160+
names.add(c.getCreditName().getContent().trim());
161+
}
158162
}
159163
}
160164
}

orcid-core/src/main/java/org/orcid/core/manager/v3/impl/BibtexManagerImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,15 @@ public String workToBibtex(Work work, String creditName){
163163
}
164164
//name
165165
List<String> names = new ArrayList<String>();
166-
names.add(creditName);
166+
if (creditName != null) {
167+
names.add(creditName.trim());
168+
}
167169
if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
168170
for (Contributor c : work.getWorkContributors().getContributor()) {
169171
if (c.getCreditName() != null && c.getCreditName().getContent() != null) {
170-
names.add(c.getCreditName().getContent());
172+
if(!names.contains(c.getCreditName().getContent().trim())) {
173+
names.add(c.getCreditName().getContent().trim());
174+
}
171175
} else if (c.getContributorOrcid() != null && c.getContributorOrcid().getPath() != null) {
172176
try {
173177
String contributor = getCreditName(c.getContributorOrcid().getPath());

0 commit comments

Comments
 (0)