manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1447556 - /manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrServer.java
Date Mon, 18 Feb 2013 23:33:46 GMT
Author: kwright
Date: Mon Feb 18 23:33:45 2013
New Revision: 1447556

URL: http://svn.apache.org/r1447556
Log:
More fixes for CONNECTORS-623.

Modified:
    manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrServer.java

Modified: manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrServer.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrServer.java?rev=1447556&r1=1447555&r2=1447556&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrServer.java
(original)
+++ manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/ModifiedHttpSolrServer.java
Mon Feb 18 23:33:45 2013
@@ -140,13 +140,22 @@ public class ModifiedHttpSolrServer exte
           else if( SolrRequest.METHOD.POST == request.getMethod() ) {
 
             String url = baseUrl + path;
-            boolean isMultipart = this.useMultiPartPost || ( streams != null && streams.size()
> 1 );
-
+            boolean hasNullStreamName = false;
+            if (streams != null) {
+              for (ContentStream cs : streams) {
+                if (cs.getName() == null) {
+                  hasNullStreamName = true;
+                  break;
+                }
+              }
+            }
+            boolean isMultipart = (this.useMultiPartPost || ( streams != null &&
streams.size() > 1 )) && !hasNullStreamName;
+            
             LinkedList<NameValuePair> postParams = new LinkedList<NameValuePair>();
             if (streams == null || isMultipart) {
               HttpPost post = new HttpPost(url);
               post.setHeader("Content-Charset", "UTF-8");
-              if (!this.useMultiPartPost && !isMultipart) {
+              if (!isMultipart) {
                 post.addHeader("Content-Type",
                     "application/x-www-form-urlencoded; charset=UTF-8");
               }
@@ -173,7 +182,8 @@ public class ModifiedHttpSolrServer exte
                   if(contentType==null) {
                     contentType = "application/octet-stream"; // default
                   }
-                  parts.add(new FormBodyPart(content.getName(), 
+                  String contentName = content.getName();
+                  parts.add(new FormBodyPart(contentName, 
                        new InputStreamBody(
                            content.getStream(), 
                            contentType, 



Mime
View raw message