Support URLs that start with protocol:/ as well as protocol://

Project: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/commit/4c8ba760
Tree: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/tree/4c8ba760
Diff: http://git-wip-us.apache.org/repos/asf/logging-chainsaw/diff/4c8ba760

Branch: refs/heads/master
Commit: 4c8ba7609f5efbf039e3fdc0649fcce0ac6aa0e0
Parents: 51e80e4
Author: Scott Deboy <[email protected]>
Authored: Fri Oct 29 07:42:02 2010 +0000
Committer: Scott Deboy <[email protected]>
Committed: Fri Oct 29 07:42:02 2010 +0000

----------------------------------------------------------------------
 .../log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java  | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-chainsaw/blob/4c8ba760/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java 
b/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
index 982b298..fadc480 100644
--- a/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
+++ b/src/main/java/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.java
@@ -302,7 +302,20 @@ public class VFSLogFilePatternReceiver extends 
LogFilePatternReceiver implements
                          });
                  }}).start();
       } else {
+        //starts with protocol:/  but not protocol://
         String oldURL = getFileURL();
+        if (oldURL != null && oldURL.indexOf(":/") > -1 && 
oldURL.indexOf("://") == -1) {
+          int index = oldURL.indexOf(":/");
+          String lastPart = oldURL.substring(index + ":/".length());
+          int passEndIndex = lastPart.indexOf("@");
+          if (passEndIndex > -1) { //we have a username/password
+              setHost(oldURL.substring(0, index + ":/".length()));
+              setPath(lastPart.substring(passEndIndex + 1));
+          }
+          vfsReader = new VFSReader();
+          new Thread(vfsReader).start();
+        }
+        //starts with protocol://
         if (oldURL != null && oldURL.indexOf("://") > -1) {
             int index = oldURL.indexOf("://");
             String lastPart = oldURL.substring(index + "://".length());

Reply via email to