From e7cd0278f781c32ec71c0a812c3fcf08ebf4371c Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 17 Aug 2011 14:44:30 +0100 Subject: [PATCH] remove any trailing '/' from the URL before validation and acceptance --- src/jalview/gui/WsPreferences.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- 1.7.10.2