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 F31E018CD4 for ; Mon, 22 Feb 2016 13:11:43 +0000 (UTC) Received: (qmail 19667 invoked by uid 500); 22 Feb 2016 12:54:22 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 18876 invoked by uid 500); 22 Feb 2016 12:54:21 -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 17203 invoked by uid 99); 22 Feb 2016 12:50:12 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2016 12:50:12 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 4BBA21A41B0 for ; Mon, 22 Feb 2016 12:50:12 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.671 X-Spam-Level: X-Spam-Status: No, score=0.671 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.329] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id nR7a6S9aY5uY for ; Mon, 22 Feb 2016 12:50:09 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 27CF95F1E3 for ; Mon, 22 Feb 2016 12:50:09 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 79F17E0288 for ; Mon, 22 Feb 2016 12:50:07 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 0F7A33A0249 for ; Mon, 22 Feb 2016 12:50:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1731633 - /manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java Date: Mon, 22 Feb 2016 12:50:07 -0000 To: commits@manifoldcf.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160222125008.0F7A33A0249@svn01-us-west.apache.org> Author: kwright Date: Mon Feb 22 12:50:04 2016 New Revision: 1731633 URL: http://svn.apache.org/viewvc?rev=1731633&view=rev Log: SharePoint connector: check for 302 response and treat like 404. This is a stopgap solution for external site references in SharePoint. Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java?rev=1731633&r1=1731632&r2=1731633&view=diff ============================================================================== --- manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java (original) +++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SPSProxyHelper.java Mon Feb 22 12:50:04 2016 @@ -228,11 +228,12 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) { - // Page did not exist + // Page did not exist or was external reference if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist; assuming list/library deleted"); + Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist or was external; skipping list/library"); return null; } else if (httpErrorCode.equals("401")) @@ -260,7 +261,7 @@ public class SPSProxyHelper { { // List did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The list "+guid+" in site "+site+" did not exist; assuming list/library deleted"); + Logging.connectors.debug("SharePoint: The list "+guid+" in site "+site+" did not exist or was external; skipping list/library"); return null; } else @@ -439,11 +440,12 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) { // Page did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist; assuming library deleted"); + Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist or was external; skipping library"); return null; } else if (httpErrorCode.equals("401")) @@ -471,7 +473,7 @@ public class SPSProxyHelper { { // List did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The file "+file+" in site "+site+" did not exist; assuming file deleted"); + Logging.connectors.debug("SharePoint: The file "+file+" in site "+site+" did not exist or was external; skipping file"); return null; } else @@ -692,11 +694,12 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) { // Page did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist; assuming library deleted"); + Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist or was external; skipping library"); return false; } else if (httpErrorCode.equals("401")) @@ -724,7 +727,7 @@ public class SPSProxyHelper { { // List did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The list "+guid+" in site "+site+" did not exist; assuming library deleted"); + Logging.connectors.debug("SharePoint: The list "+guid+" in site "+site+" did not exist or was external; skipping library"); return false; } else @@ -895,11 +898,12 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) { // Page did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The page at "+baseUrl+parentSite+" did not exist; assuming library deleted"); + Logging.connectors.debug("SharePoint: The page at "+baseUrl+parentSite+" did not exist or was external; skipping library"); return null; } else if (httpErrorCode.equals("401")) @@ -927,7 +931,7 @@ public class SPSProxyHelper { { // List did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The list "+docLibrary+" in site "+parentSite+" did not exist; assuming library deleted"); + Logging.connectors.debug("SharePoint: The list "+docLibrary+" in site "+parentSite+" did not exist or was external; skipping library"); return null; } else @@ -1104,11 +1108,12 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) { // Page did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The page at "+baseUrl+parentSite+" did not exist; assuming list deleted"); + Logging.connectors.debug("SharePoint: The page at "+baseUrl+parentSite+" did not exist or was external; skipping list"); return null; } else if (httpErrorCode.equals("401")) @@ -1136,7 +1141,7 @@ public class SPSProxyHelper { { // List did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The list "+listName+" in site "+parentSite+" did not exist; assuming list deleted"); + Logging.connectors.debug("SharePoint: The list "+listName+" in site "+parentSite+" did not exist or was external; skipping list"); return null; } else @@ -1248,11 +1253,12 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) { // Page did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist; assuming library deleted"); + Logging.connectors.debug("SharePoint: The page at "+baseUrl+site+" did not exist or was external; skipping library"); return null; } else if (httpErrorCode.equals("401")) @@ -1280,7 +1286,7 @@ public class SPSProxyHelper { { // List did not exist if (Logging.connectors.isDebugEnabled()) - Logging.connectors.debug("SharePoint: The docpath "+docPath+" in site "+site+" did not exist; assuming library deleted"); + Logging.connectors.debug("SharePoint: The docpath "+docPath+" in site "+site+" did not exist or was external; skipping library"); return null; } else @@ -1555,10 +1561,11 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) { // Page did not exist - throw new ManifoldCFException("The site at "+baseUrl+site+" did not exist"); + throw new ManifoldCFException("The site at "+baseUrl+site+" did not exist or was external; skipping"); } else if (httpErrorCode.equals("401")) throw new ManifoldCFException("Crawl user did not authenticate properly, or has insufficient permissions to access "+baseUrl+site+": "+e.getMessage(),e); @@ -1689,7 +1696,8 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) return null; else if (httpErrorCode.equals("403")) throw new ManifoldCFException("Remote procedure exception: "+e.getMessage(),e); @@ -1822,7 +1830,8 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) return null; else if (httpErrorCode.equals("403")) throw new ManifoldCFException("Remote procedure exception: "+e.getMessage(),e); @@ -2099,7 +2108,8 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) return null; else if (httpErrorCode.equals("403")) throw new ManifoldCFException("Remote procedure exception: "+e.getMessage(),e); @@ -2233,7 +2243,8 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) return null; else if (httpErrorCode.equals("403")) throw new ManifoldCFException("Remote procedure exception: "+e.getMessage(),e); @@ -2394,7 +2405,8 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) return null; else if (httpErrorCode.equals("403")) throw new ManifoldCFException("Remote procedure exception: "+e.getMessage(),e); @@ -2559,7 +2571,8 @@ public class SPSProxyHelper { { elem.normalize(); String httpErrorCode = elem.getFirstChild().getNodeValue().trim(); - if (httpErrorCode.equals("404")) + // 302 is what SharePoint returns for external sites + if (httpErrorCode.equals("404") || httpErrorCode.equals("302")) return null; else if (httpErrorCode.equals("403")) throw new ManifoldCFException("Remote procedure exception: "+e.getMessage(),e);