package bndtools.utils;

import java.net.MalformedURLException;
import java.net.URL;

import org.eclipse.jface.dialogs.IInputValidator;

public class URLInputValidator implements IInputValidator {

    @SuppressWarnings("unused")
    public String isValid(String newText) {
        String s = null;
        try {
            if (new URL(newText) == null)
                s = "Invalid URL " + newText;
        } catch (MalformedURLException e) {
            s = "Invalid URL " + newText + ": " + e.getMessage();
        }

        return s;
    }
}

@@ -193,41 +193,8 @@
 or %7B
-%0A%0A    @SuppressWarnings(%22unused%22)
 %0A   
@@ -271,100 +271,87 @@
     
-try %7B%0A            if (new URL(newText) == null)%0A                s = %22Invalid URL %22 + newText
+boolean valid = true;%0A        try %7B%0A            s = new URL(newText).toString()
 ;%0A  
@@ -454,24 +454,108 @@
 tMessage();%0A
+            valid = false;%0A        %7D%0A%0A        if (valid) %7B%0A            return null;%0A
         %7D%0A%0A 
@@ -578,9 +578,8 @@
 %0A    %7D%0A%7D
-%0A

restructure code to avoid warnings