manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1612549 - in /manifoldcf/trunk: connectors/alfresco/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfresco/tests/ connectors/generic/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/generic/ connecto...
Date Tue, 22 Jul 2014 11:34:00 GMT
Author: kwright
Date: Tue Jul 22 11:33:59 2014
New Revision: 1612549

URL: http://svn.apache.org/r1612549
Log:
Charset usage changes.  Part of CONNECTORS-931.  Committed on behalf of Ahmet Arslan.

Modified:
    manifoldcf/trunk/connectors/alfresco/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfresco/tests/APISanityIT.java
    manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/generic/GenericAuthority.java
    manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/generic/GenericConnector.java
    manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/BOMEncodingDetector.java
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/Parser.java
    manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
    manifoldcf/trunk/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java

Modified: manifoldcf/trunk/connectors/alfresco/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfresco/tests/APISanityIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/alfresco/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfresco/tests/APISanityIT.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/alfresco/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfresco/tests/APISanityIT.java
(original)
+++ manifoldcf/trunk/connectors/alfresco/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/alfresco/tests/APISanityIT.java
Tue Jul 22 11:33:59 2014
@@ -20,6 +20,7 @@
 package org.apache.manifoldcf.crawler.connectors.alfresco.tests;
 
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.rmi.RemoteException;
 
 import org.alfresco.webservice.content.ContentServiceSoapBindingStub;
@@ -114,7 +115,7 @@ public class APISanityIT extends BaseITD
       
       //format
       ContentFormat contentFormat = new ContentFormat();
-      contentFormat.setEncoding("UTF-8");
+      contentFormat.setEncoding(StandardCharsets.UTF_8.name());
       contentFormat.setMimetype("text/plain");
       
       //the content
@@ -160,7 +161,7 @@ public class APISanityIT extends BaseITD
       reference.setUuid(row.getNode().getId());
       
       ContentFormat contentFormat = new ContentFormat();
-      contentFormat.setEncoding("UTF-8");
+      contentFormat.setEncoding(StandardCharsets.UTF_8.name());
       contentFormat.setMimetype("text/plain");
       
       ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();

Modified: manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/generic/GenericAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/generic/GenericAuthority.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/generic/GenericAuthority.java
(original)
+++ manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/generic/GenericAuthority.java
Tue Jul 22 11:33:59 2014
@@ -597,7 +597,7 @@ public class GenericAuthority extends or
 
     @Override
     public void process(final HttpRequest request, final HttpContext context) throws HttpException,
IOException {
-      request.addHeader(BasicScheme.authenticate(credentials, "US-ASCII", false));
+      request.addHeader(new BasicScheme(StandardCharsets.US_ASCII).authenticate(credentials,
request, context));
     }
   }
 

Modified: manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/generic/GenericConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/generic/GenericConnector.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/generic/GenericConnector.java
(original)
+++ manifoldcf/trunk/connectors/generic/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/generic/GenericConnector.java
Tue Jul 22 11:33:59 2014
@@ -1044,13 +1044,13 @@ public class GenericConnector extends Ba
     public PreemptiveAuth(Credentials creds) {
       this.credentials = creds;
     }
-
-    @Override
-    public void process(final HttpRequest request, final HttpContext context) throws HttpException,
IOException {
-      request.addHeader(BasicScheme.authenticate(credentials, "US-ASCII", false));
-    }
-  }
-
+
+    @Override
+    public void process(final HttpRequest request, final HttpContext context) throws HttpException,
IOException {
+      request.addHeader(new BasicScheme(StandardCharsets.US_ASCII).authenticate(credentials,
request, context));
+    }
+  }
+
   protected static class CheckThread extends Thread {
 
     protected HttpClient client;

Modified: manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
(original)
+++ manifoldcf/trunk/connectors/webcrawler/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/webcrawler/WebcrawlerConnector.java
Tue Jul 22 11:33:59 2014
@@ -34,6 +34,7 @@ import org.apache.http.NoHttpResponseExc
 import org.apache.http.HttpException;
 
 import java.io.*;
+import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.net.*;
 import java.util.regex.*;
@@ -788,7 +789,7 @@ public class WebcrawlerConnector extends
                         String contentType = extractContentType(connection.getResponseHeader("Content-Type"));
                         String encoding = extractEncoding(contentType);
                         if (encoding == null)
-                          encoding = "utf-8";
+                          encoding = StandardCharsets.UTF_8.name();
                         String decodedResponse = "undecodable";
                         try
                         {
@@ -6993,7 +6994,7 @@ public class WebcrawlerConnector extends
       String contentType = extractContentType(cache.getContentType(documentURI));
       String encoding = extractEncoding(contentType);
       if (encoding == null)
-        encoding = "utf-8";
+        encoding = StandardCharsets.UTF_8.name();
       
       // Search for A HREF tags in the document stream.  This is brain-dead link location
       InputStream is = cache.getData(documentURI);
@@ -7149,9 +7150,9 @@ public class WebcrawlerConnector extends
             String nextString = is.readLine();
             if (nextString == null)
               break;
+            nextString = nextString.trim();
             if (nextString.length() == 0)
               continue;
-            nextString.trim();
             if (nextString.startsWith("#"))
               continue;
             list.add(nextString);

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/BOMEncodingDetector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/BOMEncodingDetector.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/BOMEncodingDetector.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/BOMEncodingDetector.java
Tue Jul 22 11:33:59 2014
@@ -19,6 +19,8 @@
 package org.apache.manifoldcf.core.fuzzyml;
 
 import org.apache.manifoldcf.core.interfaces.*;
+
+import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.io.*;
 
@@ -139,7 +141,7 @@ public class BOMEncodingDetector extends
       {
         // Encoding detected as utf-8
         mark();
-        return establishEncoding("UTF-8");
+        return establishEncoding(StandardCharsets.UTF_8.name());
       }
       else
         return replay();
@@ -153,7 +155,7 @@ public class BOMEncodingDetector extends
       {
         // Encoding detected as UTF-16LE.  Do NOT re-mark, we need this
         // character for later.
-        return establishEncoding("UTF-16LE");
+        return establishEncoding(StandardCharsets.UTF_16LE.name());
       }
       break;
 
@@ -173,7 +175,7 @@ public class BOMEncodingDetector extends
       else
       {
         // Leave mark alone.
-        return establishEncoding("UTF-16LE");
+        return establishEncoding(StandardCharsets.UTF_16LE.name());
       }
 
     case BOM_SEEN_0000FE:

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/Parser.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/Parser.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/Parser.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/fuzzyml/Parser.java
Tue Jul 22 11:33:59 2014
@@ -20,6 +20,7 @@ package org.apache.manifoldcf.core.fuzzy
 
 import org.apache.manifoldcf.core.interfaces.*;
 import java.io.*;
+import java.nio.charset.StandardCharsets;
 
 /** This is the main parser class.
 * This class has an entry point for both parsing XML and HTML.  The way the
@@ -61,7 +62,7 @@ public class Parser
     // Update our notion of what the character set is
     startingCharset = bomEncodingDetector.getEncoding();
     if (startingCharset == null)
-      startingCharset = "utf-8";
+      startingCharset = StandardCharsets.UTF_8.name();
     // Reset the stream
     replayableInputStream.restart(false);
     // Set up a detection chain that includes the XML detector.
@@ -92,7 +93,7 @@ public class Parser
     throws IOException, ManifoldCFException
   {
     if (startingCharset == null)
-      startingCharset = "utf-8";
+      startingCharset = StandardCharsets.UTF_8.name();
     ByteReceiver byteReceiver = new DecodingByteReceiver(65536, startingCharset, characterReceiver);
     // Process to completion
     if (byteReceiver.dealWithBytes(inputStream) == false)

Modified: manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ManifoldCFInstance.java
Tue Jul 22 11:33:59 2014
@@ -442,7 +442,7 @@ public class ManifoldCFInstance
     HttpPut method = new HttpPut(apiURL);
     try
     {
-      method.setEntity(new StringEntity(input,ContentType.create("text/plain","UTF-8")));
+      method.setEntity(new StringEntity(input,ContentType.create("text/plain",StandardCharsets.UTF_8)));
       HttpResponse response = client.execute(method);
       int responseCode = response.getStatusLine().getStatusCode();
       String responseString = convertToString(response);
@@ -470,7 +470,7 @@ public class ManifoldCFInstance
     HttpPost method = new HttpPost(apiURL);
     try
     {
-      method.setEntity(new StringEntity(input,ContentType.create("text/plain","UTF-8")));
+      method.setEntity(new StringEntity(input,ContentType.create("text/plain",StandardCharsets.UTF_8)));
       HttpResponse response = client.execute(method);
       int responseCode = response.getStatusLine().getStatusCode();
       String responseString = convertToString(response);

Modified: manifoldcf/trunk/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java?rev=1612549&r1=1612548&r2=1612549&view=diff
==============================================================================
--- manifoldcf/trunk/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java
(original)
+++ manifoldcf/trunk/framework/ui-core/src/main/java/org/apache/manifoldcf/ui/i18n/Messages.java
Tue Jul 22 11:33:59 2014
@@ -156,7 +156,7 @@ public class Messages extends org.apache
       String resourcePath = localizeResourceName(pathName, resourceKey, locale);
           
       Writer outputWriter = new OutputWriter(output);
-      engine.mergeTemplate(resourcePath, "UTF-8", context, outputWriter);
+      engine.mergeTemplate(resourcePath, StandardCharsets.UTF_8.name(), context, outputWriter);
       outputWriter.flush();
     } catch (IOException e) {
       throw new ManifoldCFException(e.getMessage(),e);



Mime
View raw message