manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1490730 - in /manifoldcf/trunk: CHANGES.txt connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
Date Fri, 07 Jun 2013 17:05:59 GMT
Author: kwright
Date: Fri Jun  7 17:05:58 2013
New Revision: 1490730

URL: http://svn.apache.org/r1490730
Log:
Fix for CONNECTORS-709

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1490730&r1=1490729&r2=1490730&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Fri Jun  7 17:05:58 2013
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 1.3-dev =====================
 
+CONNECTORS-709: Escape \r, \n, \f, and \b in ElasticSearch connector.
+(Richard Nichols, Karl Wright)
+
 CONNECTORS-701: Add forced ACLs to DropBox connector.  Fixed a
 few UI-related other problems as well.
 WARNING: This is a non-backwards-compatible change!!

Modified: manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java?rev=1490730&r1=1490729&r2=1490730&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
(original)
+++ manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchIndex.java
Fri Jun  7 17:05:58 2013
@@ -200,9 +200,22 @@ public class ElasticSearchIndex extends 
     for (int i = 0; i < value.length(); i++)
     {
       char x = value.charAt(i);
-      if (x == '\"' || x == '\\' || x == '/')
-        sb.append('\\');
-      sb.append(x);
+      if (x == '\n')
+        sb.append('\\').append('n');
+      else if (x == '\r')
+        sb.append('\\').append('r');
+      else if (x == '\t')
+        sb.append('\\').append('t');
+      else if (x == '\b')
+        sb.append('\\').append('b');
+      else if (x == '\f')
+        sb.append('\\').append('f');
+      else
+      {
+        if (x == '\"' || x == '\\' || x == '/')
+          sb.append('\\');
+        sb.append(x);
+      }
     }
     sb.append("\"");
     return sb.toString();



Mime
View raw message