Forums

Full Version: isUrlString() should return true for https
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Images with an url starting with "https" is not being shown because IOLib.java's isUrlString() returns false for "https":

Current:
Code:
/**
     * Indicates if a given String is a URL string. Checks to see if the string
     * begins with the "http:/", "ftp:/", or "file:/" protocol strings.
     * @param s the string to check
     * @return true if a url string matching the listed protocols,
     * false otherwise
     */
    public static boolean isUrlString(String s) {
        return s.startsWith("http:/") ||
               s.startsWith("ftp:/")  ||
               s.startsWith("file:/");
    }

Simple fix is:
Code:
/**
     * Indicates if a given String is a URL string. Checks to see if the string
     * begins with the "https:/", "http:/", "ftp:/", or "file:/" protocol strings.
     * @param s the string to check
     * @return true if a url string matching the listed protocols,
     * false otherwise
     */
    public static boolean isUrlString(String s) {
        return s.startsWith("https:/") ||
               s.startsWith("http:/") ||
               s.startsWith("ftp:/")  ||
               s.startsWith("file:/");
    }

Guest

Images from Jar file are also excluded now, I changed it to allow that now:

/**
* Indicates if a given String is a URL string. Checks to see if the string
* begins with the "https:/", "http:/", "ftp:/", "file:/", or "jar:file:/" protocol strings.
* @param s the string to check
* @return true if a url string matching the listed protocols,
* false otherwise
*/
public static boolean isUrlString(String s) {
return s.startsWith("https:/") ||
s.startsWith("http:/") ||
s.startsWith("ftp:/") ||
s.startsWith("file:/") ||
s.startsWith("jar:file:/");
}
Reference URL's