Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions src/main/java/com/neuronrobotics/bowlerstudio/BowlerStudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -178,7 +179,7 @@ public static void main(String[] args) throws Exception {
renderSplashFrame(2, "Testing Internet");

try {
final URL url = new URL("http://github.com");
final URL url = new URI("http://github.com").toURL();
final URLConnection conn = url.openConnection();
conn.connect();
conn.getInputStream();
Expand Down Expand Up @@ -429,10 +430,14 @@ public boolean get(String name, String url) {
@Override
public void onInstallFail(String url) {
try {
BowlerStudio.openExternalWebpage(new URL(url));
URL urlObject = new URI(url).toURL();
BowlerStudio.openExternalWebpage(urlObject);
} catch (MalformedURLException e) {
// Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// Auto-generated catch block
e.printStackTrace();
}
}

Expand Down Expand Up @@ -1165,27 +1170,32 @@ public static void showExceptionAlert(Exception ex, String message) {

alert.showAndWait();
}

public static boolean checkValidURL(String url) {
try {
if(url==null)
throw new NullPointerException();
if(url.length()<5)
if ((url == null) || (url.length() < 5))
throw new NullPointerException();
if(url.startsWith("http"))
new URL(url);// check that the URL string contains a valid URL

if (url.startsWith("http"))
new URI(url).toURL();// check that the URL string contains a valid URL
else
if(url.startsWith("git@")) {
if (url.startsWith("git@")) {
// assume this is a URL
}
}catch(Exception e) {
} catch(MalformedURLException e) {
// not a url
//Log.debug("Invalid URL "+url);
//e.printStackTrace();
return false;
} catch(URISyntaxException e) {
// not a url
//
//Log.debug("Invalid URL "+url);
//e.printStackTrace();
return false;
}
return true;
}

public static String getInstallDirStub() {
return DownloadManager.getSTUDIO_INSTALL();
}
Expand Down