diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Config.java b/src/main/java/edu/harvard/iq/dataverse/api/Config.java
index 00bac025ae2..343e2edb6b9 100644
--- a/src/main/java/edu/harvard/iq/dataverse/api/Config.java
+++ b/src/main/java/edu/harvard/iq/dataverse/api/Config.java
@@ -7,13 +7,10 @@
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
-import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
@Path("config")
public class Config extends AbstractApiBean {
@@ -23,9 +20,16 @@ public class Config extends AbstractApiBean {
@EJB
DatasetFieldServiceBean datasetFieldService;
+ /**
+ * We use the output of this method to generate our Solr schema.xml
+ *
+ * @todo Someday we do want to have this return a Response rather than a
+ * String per https://github.com/IQSS/dataverse/issues/298 but not yet while
+ * we are trying to ship Dataverse 4.0
+ */
@GET
@Path("solr/schema")
- public Response getSolrSchema() {
+ public String getSolrSchema() {
StringBuilder sb = new StringBuilder();
@@ -48,11 +52,11 @@ public Response getSolrSchema() {
* when we do a big schema.xml update for
* https://github.com/IQSS/dataverse/issues/754
*/
- logger.log(Level.INFO, "email type detected ({0}) See also https://github.com/IQSS/dataverse/issues/759", nameSearchable);
+ logger.info("email type detected (" + nameSearchable + ") See also https://github.com/IQSS/dataverse/issues/759");
}
String multivalued = datasetField.getSolrField().isAllowedToBeMultivalued().toString();
//
- sb.append(" \n");
+ sb.append(" \n");
}
List listOfStaticFields = new ArrayList();
@@ -63,7 +67,8 @@ public Response getSolrSchema() {
String staticSearchField = null;
try {
staticSearchField = (String) fieldObject.get(searchFieldsObject);
- } catch (IllegalArgumentException | IllegalAccessException ex) {
+ } catch (IllegalArgumentException ex) {
+ } catch (IllegalAccessException ex) {
}
/**
@@ -71,7 +76,7 @@ public Response getSolrSchema() {
* need a copyField source="filetypemime_s" to the catchall?
*/
if (listOfStaticFields.contains(staticSearchField)) {
- return errorResponse( Status.INTERNAL_SERVER_ERROR, "static search field defined twice: " + staticSearchField);
+ return error("static search field defined twice: " + staticSearchField);
}
listOfStaticFields.add(staticSearchField);
}
@@ -86,19 +91,19 @@ public Response getSolrSchema() {
if (nameSearchable.equals(SearchFields.DATASET_DESCRIPTION)) {
// Skip, expected conflct.
} else {
- return errorResponse( Status.INTERNAL_SERVER_ERROR, "searchable dataset metadata field conflict detected with static field: " + nameSearchable);
+ return error("searchable dataset metadata field conflict detected with static field: " + nameSearchable);
}
}
if (listOfStaticFields.contains(nameFacetable)) {
- return errorResponse( Status.INTERNAL_SERVER_ERROR, "facetable dataset metadata field conflict detected with static field: " + nameFacetable);
+ return error("facetable dataset metadata field conflict detected with static field: " + nameFacetable);
}
//
- sb.append(" \n");
+ sb.append(" \n");
}
- return okResponse(sb.toString());
+ return sb.toString();
}
}