-
Notifications
You must be signed in to change notification settings - Fork 535
Description
What steps does it take to reproduce the issue?
When playing with the setting of external vocabularies, I started to set :CVocConf. However when I set it with the two commands mentioned in the description the site returned 505 errors, due to a NullPointerException.
The server log recorder the following error message:
[2022-04-28T16:59:17.336+0200] [Payara 5.2021.8] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=104 _ThreadName=http-thread-pool::jk-connector(5)] [timeMill>
StandardWrapperValve[default]: Servlet.service() for servlet default threw exception
java.lang.NullPointerException
at edu.harvard.iq.dataverse.DatasetFieldServiceBean.getCVocConf(DatasetFieldServiceBean.java:303)
at jdk.internal.reflect.GeneratedMethodAccessor862.invoke(Unknown Source)
It is a warning level, but the site was virtually down.
We checked the environment of the referenced code, and we found that null value is checked, but the code only reports it and does not prevent the flow to run into a branch which expects that the value is not null:
for (JsonObject jo : cvocConfJsonArray.getValuesAs(JsonObject.class)) {
DatasetFieldType dft = findByNameOpt(jo.getString("field-name"));
if (dft != null) {
cvocMap.put(dft.getId(), jo);
} else {
logger.warning("Ignoring External Vocabulary setting for non-existent field: "
+ jo.getString("field-name"));
}
if (jo.containsKey("term-uri-field")) {
String termUriField = jo.getString("term-uri-field");
if (!dft.isHasChildren()) {
if (termUriField.equals(dft.getName())) {
logger.fine("Found primitive field for term uri : " + dft.getName() + ": " + dft.getId());
cvocMapByTermUri.put(dft.getId(), jo);
}
} else {
DatasetFieldType childdft = findByNameOpt(jo.getString("term-uri-field"));
logger.fine("Found term child field: " + childdft.getName()+ ": " + childdft.getId());
cvocMapByTermUri.put(childdft.getId(), jo);
if (childdft.getParentDatasetFieldType() != dft) {
logger.warning("Term URI field (" + childdft.getDisplayName() + ") not a child of parent: "
+ dft.getDisplayName());
}
}
if (dft == null) {
logger.warning("Ignoring External Vocabulary setting for non-existent child field: "
+ jo.getString("term-uri-field"));
}Thanks to Marcel Hellkamp (GWDG) who did the error tracking at the first place!
-
When does this issue occur?
-
Which page(s) does it occurs on?
All. -
What happens?
The Payara Java error reporting page is displayed. -
To whom does it occur (all users, curators, superusers)?
All users. -
What did you expect to happen?
Catch the null, and let flow runs only on the safe branch.
Which version of Dataverse are you using?
6.9
Any related open or closed issues to this bug report?
I am not aware of.
Screenshots:
No matter the issue, screenshots are always welcome.
To add a screenshot, please use one of the following formats and/or methods described here: