Support trailing slash in sharepoint.server

Previously a trailing slash worked fine, but when we started using
spUrlToUri() to handle spaces in URLs we inadvertently broke trailing
slashes. This restores the ability to use them in sharepoint.server
config.
diff --git a/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java b/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
index 11a467a..d8ab6a6 100644
--- a/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
+++ b/src/com/google/enterprise/adaptor/sharepoint/SharePointAdaptor.java
@@ -342,6 +342,9 @@
     context.setPollingIncrementalLister(this);
     Config config = context.getConfig();
     virtualServer = config.getValue("sharepoint.server");
+    if (virtualServer.endsWith("/")) {
+      virtualServer = virtualServer.substring(0, virtualServer.length() - 1);
+    }
     String username = config.getValue("sharepoint.username");
     String password = context.getSensitiveValueDecoder().decodeValue(
         config.getValue("sharepoint.password"));
diff --git a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
index 770c7a7..c3bd6e5 100644
--- a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
+++ b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
@@ -312,6 +312,14 @@
   }
 
   @Test
+  public void testTrailingSlashInit() throws Exception {
+    adaptor = new SharePointAdaptor(initableSoapFactory,
+        new UnsupportedHttpClient(), executorFactory);
+    config.overrideKey("sharepoint.server", "http://localhost:1/");
+    adaptor.init(new MockAdaptorContext(config, pusher));
+  }
+
+  @Test
   public void testSpUrlToUriPassthrough() throws Exception {
     assertEquals("http://somehost:1/path/file",
         SharePointAdaptor.spUrlToUri("http://somehost:1/path/file").toString());