You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by mi...@apache.org on 2013/06/03 08:47:33 UTC
svn commit: r1488860 -
/manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java
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");