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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;

import org.jboss.tools.rsp.api.dao.DownloadRuntimeDescription;
Expand Down Expand Up @@ -66,13 +67,16 @@ public String getLicense(IProgressMonitor monitor) throws CoreException {
try(ByteArrayOutputStream out = new ByteArrayOutputStream()) {
if (getLicenseURL() == null)
return null;

URL url = new URL(getLicenseURL());
InputStream in = url.openStream();
URLConnection conn = url.openConnection();
conn.setConnectTimeout(2500); // 2.5 second connection timeout
conn.setReadTimeout(5000); // 5 second read timeout
InputStream in = conn.getInputStream();
copyWithSize(in, out, monitor, 0);
return new String(out.toByteArray());
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR,
throw new CoreException(new Status(IStatus.ERROR,
RuntimeCoreActivator.PLUGIN_ID, 0,
NLS.bind(Messages.DownloadRuntime_Unable_to_fetch_license, e.getLocalizedMessage()), e));
}
Expand Down
Loading