Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-841 -- DataImportHandler should throw exception if a field does not have column attribute

Shalin Shekhar Mangar714d1c7ad7cd
diff --git a/contrib/dataimporthandler/CHANGES.txt b/contrib/dataimporthandler/CHANGES.txt
index 0c0a540cc4e..d0ee8e71bfa 100644
--- a/contrib/dataimporthandler/CHANGES.txt
+++ b/contrib/dataimporthandler/CHANGES.txt
@@ -73,6 +73,9 @@ Bug Fixes
10. SOLR-888: DateFormatTransformer cannot convert non-string type
(Amit Nithian via shalin)
+11. SOLR-841: DataImportHandler should throw exception if a field does not have column attribute
+ (Michael Henson, shalin)
+
Documentation
----------------------
diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
index c8a92fe08c3..92767b11f0f 100644
--- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
+++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataConfig.java
@@ -205,6 +205,9 @@ public class DataConfig {
public Field(Element e) {
this.name = getStringAttribute(e, DataImporter.NAME, null);
this.column = getStringAttribute(e, DataImporter.COLUMN, null);
+ if (column == null) {
+ throw new DataImportHandlerException(DataImportHandlerException.SEVERE, "Field must have a column attribute");
+ }
this.boost = Float.parseFloat(getStringAttribute(e, "boost", "1.0f"));
allAttributes.putAll(getAllAttributes(e));
}