From: jprocter Date: Wed, 17 Aug 2011 13:44:30 +0000 (+0100) Subject: remove any trailing '/' from the URL before validation and acceptance X-Git-Tag: Release_2_7~101 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e7cd0278f781c32ec71c0a812c3fcf08ebf4371c;p=jalview.git remove any trailing '/' from the URL before validation and acceptance --- diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java index e14b358..b88f27e 100644 --- a/src/jalview/gui/WsPreferences.java +++ b/src/jalview/gui/WsPreferences.java @@ -262,8 +262,14 @@ public class WsPreferences extends GWsPreferences { // TODO: do a better job of checking that the url is a valid discovery // URL for web services. - foo = new URL(urltf.getText().trim()); + String tx = urltf.getText().trim(); + while (tx.length()>0 && tx.lastIndexOf('/')==tx.length()-1) + { + tx = tx.substring(0, tx.length()-1); + } + foo = new URL(tx); valid = true; + urltf.setText(tx); } catch (Exception e) { valid = false;