Skip to content

Commit 1c31486

Browse files
authored
Merge pull request #11596 from IQSS/11546-pid-separator
#11546 fix compare separator logic
2 parents 5781291 + 21f69e3 commit 1c31486

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/edu/harvard/iq/dataverse/pidproviders/AbstractPidProvider.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public DvObject generatePid(DvObject dvObject) {
196196
+ ") doesn't match that of the provider, id: " + getId());
197197
}
198198
}
199-
if (dvObject.getAuthority() == null) {
199+
if (dvObject.getAuthority() == null) {
200200
dvObject.setAuthority(getAuthority());
201201
} else {
202202
if (!dvObject.getAuthority().equals(getAuthority())) {
@@ -209,11 +209,19 @@ public DvObject generatePid(DvObject dvObject) {
209209
if (dvObject.getSeparator() == null) {
210210
dvObject.setSeparator(getSeparator());
211211
} else {
212-
if (!dvObject.getSeparator().equals(getSeparator())) {
212+
//only check separator if identifier is not null because a null authority would be set above...
213+
//SEK 06/26/25 #11546
214+
if (dvObject.getIdentifier() != null
215+
&& !dvObject.getSeparator().equals(getSeparator())) {
213216
logger.warning("The separator of the DvObject (" + dvObject.getSeparator()
214217
+ ") does not match the configured separator (" + getSeparator() + ")");
215218
throw new IllegalArgumentException("The separator of the DvObject (" + dvObject.getSeparator()
216219
+ ") doesn't match that of the provider, id: " + getId());
220+
} else {
221+
//we know it's not null so fill it if it's empty
222+
if (dvObject.getSeparator().isEmpty()) {
223+
dvObject.setSeparator(getSeparator());
224+
}
217225
}
218226
}
219227
if (dvObject.isInstanceofDataset()) {

0 commit comments

Comments
 (0)