manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1440742 - in /manifoldcf/branches/release-1.1-branch: ./ CHANGES.txt connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
Date Thu, 31 Jan 2013 00:13:46 GMT
Author: kwright
Date: Thu Jan 31 00:13:46 2013
New Revision: 1440742

URL: http://svn.apache.org/viewvc?rev=1440742&view=rev
Log:
Pull up fix for CONNECTORS-630.

Modified:
    manifoldcf/branches/release-1.1-branch/   (props changed)
    manifoldcf/branches/release-1.1-branch/CHANGES.txt
    manifoldcf/branches/release-1.1-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java

Propchange: manifoldcf/branches/release-1.1-branch/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk:r1440740

Modified: manifoldcf/branches/release-1.1-branch/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-1.1-branch/CHANGES.txt?rev=1440742&r1=1440741&r2=1440742&view=diff
==============================================================================
--- manifoldcf/branches/release-1.1-branch/CHANGES.txt (original)
+++ manifoldcf/branches/release-1.1-branch/CHANGES.txt Thu Jan 31 00:13:46 2013
@@ -3,6 +3,9 @@ $Id$
 
 ======================= Release 1.1 =====================
 
+CONNECTORS-630: Work around SolrJ paramname encoding bug.
+(David Morana, Karl Wright)
+
 CONNECTORS-627: Upgrade SolrJ to 4.1.0 from 4.0.0
 (Minoru Osuka)
 

Modified: manifoldcf/branches/release-1.1-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-1.1-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java?rev=1440742&r1=1440741&r2=1440742&view=diff
==============================================================================
--- manifoldcf/branches/release-1.1-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
(original)
+++ manifoldcf/branches/release-1.1-branch/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
Thu Jan 31 00:13:46 2013
@@ -663,10 +663,29 @@ public class HttpPoster
     return new String[0];
   }
 
+  /** Preprocess field name.
+  * SolrJ has a bug where it does not URL-escape field names.  This causes carnage for
+  * ManifoldCF, because it results in IllegalArgumentExceptions getting thrown deep in SolrJ.
+  * See CONNECTORS-630.
+  * In order to get around this, we need to URL-encode argument names, at least until the
underlying
+  * SolrJ issue is fixed.
+  */
+  protected static String preEncode(String fieldName)
+  {
+    try
+    {
+      return java.net.URLEncoder.encode(fieldName, "utf-8");
+    }
+    catch (IOException e)
+    {
+      throw new RuntimeException("Could not find utf-8 encoding!");
+    }
+  }
+  
   /** Write a field */
   protected static void writeField(ModifiableSolrParams out, String fieldName, String[] fieldValues)
   {
-    out.add(fieldName, fieldValues);
+    out.add(preEncode(fieldName), fieldValues);
   }
   
   /** Write a field */
@@ -683,7 +702,7 @@ public class HttpPoster
   /** Write a field */
   protected static void writeField(ModifiableSolrParams out, String fieldName, String fieldValue)
   {
-    out.add(fieldName, fieldValue);
+    out.add(preEncode(fieldName), fieldValue);
   }
 
   /** Output an acl level */



Mime
View raw message