package com.myyearbook.hudson.plugins.confluence;

import java.net.URI;
import java.util.logging.Logger;

/**
 * Utility methods
 *
 * @author Joe Hansche <jhansche@myyearbook.com>
 */
public class Util {
    private static final Logger LOGGER = Logger.getLogger(Util.class.getName());

    /** Relative path to resolve the XmlRpc endpoint URL */
    private static final String XML_RPC_URL_PATH = "/rpc/xmlrpc";

    /** Relative path to resolve the SOAP endpoint URL */
    private static final String SOAP_URL_PATH = "/rpc/soap-axis/confluenceservice-v1";

    /**
     * Convert a generic Confluence URL into the XmlRpc endpoint URL
     *
     * @param url
     * @return
     * @see #XML_RPC_URL_PATH
     */
    public static String confluenceUrlToXmlRpcUrl(String url) {
	URI uri = URI.create(url);
	return uri.resolve(uri.getPath() + XML_RPC_URL_PATH).normalize().toString();
    }

    /**
     * Convert a generic Confluence URL into the SOAP endpoint URL
     *
     * @param url
     * @return
     * @see #SOAP_URL_PATH
     */
    public static String confluenceUrlToSoapUrl(String url) {
	URI uri = URI.create(url);
	return uri.resolve(uri.getPath() + SOAP_URL_PATH).normalize().toString();
    }
}

@@ -1,8 +1,9 @@
+%0A
 package 
@@ -69,41 +69,8 @@
 URI;
-%0Aimport java.util.logging.Logger;
 %0A%0A/*
@@ -92,16 +92,17 @@
 thods%0A *
+ 
 %0A * @aut
@@ -171,90 +171,8 @@
 l %7B%0A
-    private static final Logger LOGGER = Logger.getLogger(Util.class.getName());%0A%0A
     
@@ -275,25 +275,24 @@
 URL_PATH = %22
-/
 rpc/xmlrpc%22;
@@ -400,17 +400,16 @@
 PATH = %22
-/
 rpc/soap
@@ -513,32 +513,33 @@
 point URL%0A     *
+ 
 %0A     * @param u
@@ -650,33 +650,40 @@
 l(String url) %7B%0A
-%09
+        
 URI uri = URI.cr
@@ -685,33 +685,40 @@
 RI.create(url);%0A
-%09
+        
 return uri.resol
@@ -720,32 +720,16 @@
 resolve(
-uri.getPath() + 
 XML_RPC_
@@ -850,16 +850,17 @@
 L%0A     *
+ 
 %0A     * 
@@ -982,17 +982,24 @@
  url) %7B%0A
-%09
+        
 URI uri 
@@ -1021,9 +1021,16 @@
 l);%0A
-%09
+        
 retu
@@ -1048,24 +1048,8 @@
 lve(
-uri.getPath() + 
 SOAP

Fix bug with GH-1 for root-installations.