Source:
public Object execute(ExecutionEvent event) throws ExecutionException { final Shell shell = HandlerUtil.getActiveShellChecked(event); final SpecfileParser specparser = new SpecfileParser(); final IResource resource = RPMHandlerUtils.getResource(event); final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); final IFile workFile = (IFile) rpj.getSpecFile(); final Specfile specfile = specparser.parse(workFile); final List<SpecfileSource> sourceURLList = specfile != null ? (List<SpecfileSource>) specfile .getSources() : null; for (final SpecfileSource sourceurls : sourceURLList) { try { String rawURL = sourceurls.getFileName().toString(); String resolvedURL = UiUtils.resolveDefines(specfile, rawURL); URL url = null; try { url = new URL(resolvedURL); } catch(MalformedURLException e) { SpecfileLog.logError(Messages.DownloadSources_malformedURL + resolvedURL, e); RPMUtils.showErrorDialog(shell, "Error", Messages.DownloadSources_malformedURL + resolvedURL); return null; } HttpURLConnection connection = (HttpURLConnection) url.openConnection(); if (connection.getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { int offset = url.toString().lastIndexOf("/"); String filename = url.toString().substring(offset + 1); IFile file = rpj.getConfiguration().getSourcesFolder().getFile(new Path(filename)); Job downloadJob = new DownloadJob(file, connection); downloadJob.setUser(true); downloadJob.schedule(); } } catch (IOException e) { SpecfileLog.logError(Messages.DownloadSources_cannotConnectToURL, e); RPMUtils.showErrorDialog(shell, "Error", Messages.DownloadSources_cannotConnectToURL); return null; } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final Shell shell = HandlerUtil.getActiveShellChecked(event); final SpecfileParser specparser = new SpecfileParser(); final IResource resource = RPMHandlerUtils.getResource(event); final RPMProject rpj = RPMHandlerUtils.getRPMProject(resource); final IFile workFile = (IFile) rpj.getSpecFile(); final Specfile specfile = specparser.parse(workFile); final List<SpecfileSource> sourceURLList = specfile != null ? (List<SpecfileSource>) specfile .getSources() : null; for (final SpecfileSource sourceurls : sourceURLList) { try { String rawURL = sourceurls.getFileName().toString(); String resolvedURL = UiUtils.resolveDefines(specfile, rawURL); URL url = null; try { url = new URL(resolvedURL); } catch(MalformedURLException e) { SpecfileLog.logError(NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL), e); RPMUtils.showErrorDialog(shell, "Error", NLS.bind(Messages.DownloadSources_malformedURL, resolvedURL)); return null; } HttpURLConnection connection = (HttpURLConnection) url.openConnection(); if (connection.getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { int offset = url.toString().lastIndexOf("/"); String filename = url.toString().substring(offset + 1); IFile file = rpj.getConfiguration().getSourcesFolder().getFile(new Path(filename)); Job downloadJob = new DownloadJob(file, connection); downloadJob.setUser(true); downloadJob.schedule(); } } catch (IOException e) { SpecfileLog.logError(Messages.DownloadSources_cannotConnectToURL, e); RPMUtils.showErrorDialog(shell, "Error", Messages.DownloadSources_cannotConnectToURL); return null; } } return null; }