Pull up fix for CONNECTORS-760 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/manifoldcf/branches/release-1.3-branch@1506905 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES.txt b/CHANGES.txt
index 4f18eec..a1baa85 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,9 @@
======================= Release 1.3 =====================
+CONNECTORS-760: HDFSRepositoryConnector's version string is always start with '-'.
+(Minoru Osuka)
+
CONNECTORS-759: Fix broken content type for login page.
(Shinichiro Abe, Karl Wright)
diff --git a/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSRepositoryConnector.java b/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSRepositoryConnector.java
index c69a3eb..9c7fe5b 100644
--- a/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSRepositoryConnector.java
+++ b/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSRepositoryConnector.java
@@ -352,7 +352,8 @@
StringBuilder sb = new StringBuilder();
// Check if the path is to be converted. We record that info in the version string so that we'll reindex documents whose
// URI's change.
- String convertPath = findConvertPath(spec, fileStatus.getPath());
+ String nameNode = "hdfs://" + nameNodeHost + ":" + nameNodePort;
+ String convertPath = findConvertPath(nameNode, spec, fileStatus.getPath());
if (convertPath != null)
{
// Record the path.
@@ -1340,7 +1341,7 @@
*@param documentIdentifier is the document identifier.
*@return the part of the path to be converted, or null.
*/
- protected static String findConvertPath(DocumentSpecification spec, Path theFile)
+ protected static String findConvertPath(String nameNode, DocumentSpecification spec, Path theFile)
{
String fullpath = theFile.toString();
for (int j = 0; j < spec.getChildCount(); j++)
@@ -1352,6 +1353,7 @@
String convertToURI = sn.getAttributeValue("converttouri");
if (path.length() > 0 && convertToURI != null && convertToURI.equals("true"))
{
+ path = nameNode + path;
if (!path.endsWith("/"))
path += "/";
if (fullpath.startsWith(path))
@@ -1382,13 +1384,6 @@
protected static boolean checkInclude(String nameNode, FileStatus fileStatus, String fileName, DocumentSpecification documentSpecification)
throws ManifoldCFException
{
- /*
- * TODO:
- * fileName = hdfs://localhost:9000/user/minoru/KEN_ALL_UTF-8_UNIX_SHRINK.CSV
- * pathPart = hdfs://localhost:9000/user/minoru
- * fliePart = KEN_ALL_UTF-8_UNIX_SHRINK.CSV
- * path = /user/minoru => hdfs://localhost:9000/user/minoru
- */
if (Logging.connectors.isDebugEnabled())
{
Logging.connectors.debug("Checking whether to include file '"+fileName+"'");