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 11A52CA28 for ; Mon, 3 Jun 2013 06:48:00 +0000 (UTC) Received: (qmail 60431 invoked by uid 500); 3 Jun 2013 06:48:00 -0000 Delivered-To: apmail-manifoldcf-commits-archive@manifoldcf.apache.org Received: (qmail 60380 invoked by uid 500); 3 Jun 2013 06:47:58 -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 60362 invoked by uid 99); 3 Jun 2013 06:47:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 06:47:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 06:47:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F07BF2388906; Mon, 3 Jun 2013 06:47:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1488860 - /manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java Date: Mon, 03 Jun 2013 06:47:33 -0000 To: commits@manifoldcf.apache.org From: minoru@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130603064733.F07BF2388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: minoru Date: Mon Jun 3 06:47:33 2013 New Revision: 1488860 URL: http://svn.apache.org/r1488860 Log: (empty) Modified: manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java Modified: manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java?rev=1488860&r1=1488859&r2=1488860&view=diff ============================================================================== --- manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java (original) +++ manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java Mon Jun 3 06:47:33 2013 @@ -24,8 +24,10 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URISyntaxException; +import java.net.URLEncoder; import java.nio.channels.ClosedChannelException; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; @@ -502,45 +504,50 @@ public class FileOutputConnector extends if (!path.toString().endsWith("/")) { path.append("/"); } - path.append(uri.getAuthority().replaceAll(":", "_")); + try { + path.append(URLEncoder.encode(uri.getAuthority(), "UTF-8")); + } catch(UnsupportedEncodingException e) { + path.append(uri.getAuthority()); + } } else { if (uri.getSchemeSpecificPart() != null) { - if (!path.toString().endsWith("/")) { - path.append("/"); + for (String name : uri.getSchemeSpecificPart().split("/")) { + if (name.length() > 0) { + path.append("/"); + try { + path.append(URLEncoder.encode(name, "UTF-8")); + } catch(UnsupportedEncodingException e) { + path.append(name); + } + } } - path.append(uri.getSchemeSpecificPart().replaceAll(":", "_")); - } - } - - /* - if (uri.getUserInfo() != null) { - if (!path.toString().endsWith("/")) { - path.append("/"); - } - path.append(uri.getUserInfo()); - } - if (uri.getHost() != null) { - if (!path.toString().endsWith("/")) { - path.append("/"); - } - path.append(uri.getHost()); - } + if (path.toString().endsWith("/")) { + path.append(".content"); + } - if (uri.getPort() != -1) { - if (!path.toString().endsWith("/")) { - path.append("/"); + return path.toString(); } - path.append(uri.getPort()); } - */ if (uri.getPath() != null) { - if (!uri.getPath().startsWith("/")) { - path.append("/"); + if (uri.getPath().length() == 0) { + path.append("/"); + } else if (uri.getPath().equals("/")) { + path.append(uri.getPath()); + } else { + for (String name : uri.getPath().split("/")) { + if (name.length() > 0) { + path.append("/"); + try { + path.append(URLEncoder.encode(name, "UTF-8")); + } catch(UnsupportedEncodingException e) { + path.append(name); + } + } + } + } } - path.append(uri.getPath()); - } if (path.toString().endsWith("/")) { path.append(".content");