lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r889115 - in /lucene/solr/trunk/contrib/dataimporthandler: CHANGES.txt src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
Date Thu, 10 Dec 2009 07:01:59 GMT
Author: shalin
Date: Thu Dec 10 07:01:58 2009
New Revision: 889115

URL: http://svn.apache.org/viewvc?rev=889115&view=rev
Log:
SOLR-1638 -- Fixed NullPointerException during import if uniqueKey is not specified in schema

Modified:
    lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java

Modified: lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt?rev=889115&r1=889114&r2=889115&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt (original)
+++ lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt Thu Dec 10 07:01:58 2009
@@ -31,7 +31,8 @@
 
 Bug Fixes
 ----------------------
-
+* SOLR-1638: Fixed NullPointerException during import if uniqueKey is not specified
+  in schema (Akshay Ukey via shalin)
 
 
 Other Changes

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java?rev=889115&r1=889114&r2=889115&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DataImporter.java
Thu Dec 10 07:01:58 2009
@@ -149,8 +149,12 @@
   }
 
   private void identifyPk(DataConfig.Entity entity) {
-    String schemaPk = schema.getUniqueKeyField().getName();
-    //if no fields are mentioned . solr uniqeKey is same as dih 'pk'
+    SchemaField uniqueKey = schema.getUniqueKeyField();
+    String schemaPk = "";
+    if (uniqueKey != null)
+      schemaPk = uniqueKey.getName();
+    else return;
+    //if no fields are mentioned . solr uniqueKey is same as dih 'pk'
     entity.pkMappingFromSchema = schemaPk;
     for (DataConfig.Field field : entity.fields) {
       if(field.getName().equals(schemaPk)) {



Mime
View raw message