Return-Path: X-Original-To: apmail-manifoldcf-commits-archive@www.apache.org Delivered-To: apmail-manifoldcf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 261E8E9F5 for ; Thu, 31 Jan 2013 00:14:07 +0000 (UTC) Received: (qmail 7386 invoked by uid 500); 31 Jan 2013 00:14:07 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 7350 invoked by uid 500); 31 Jan 2013 00:14:07 -0000 Mailing-List: contact commits-help@manifoldcf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@manifoldcf.apache.org Delivered-To: mailing list commits@manifoldcf.apache.org Received: (qmail 7340 invoked by uid 99); 31 Jan 2013 00:14:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2013 00:14:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2013 00:14:05 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E7A272388900; Thu, 31 Jan 2013 00:13:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130131001346.E7A272388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 */