public static String rebuildJobUrl ( String build , String server ) throws URISyntaxException , MalformedURLException , UnsupportedEncodingException { URL instanceUrl = new URL ( server ) ; String userInfo = instanceUrl . getUserInfo ( ) ; String instanceProtocol = instanceUrl . getProtocol ( ) ; //decode to handle spaces in the job name. URL buildUrl = new URL ( URLDecoder . decode ( build , "UTF-8" ) ) ; String buildPath = buildUrl . getPath ( ) ; String host = buildUrl . getHost ( ) ; int port = buildUrl . getPort ( ) ; URI newUri = new URI ( instanceProtocol , userInfo , host , port , buildPath , null , null ) ; return newUri . toString ( ) ; }
does not save the auth user info and we need to add it back .