List of usage examples for java.net MalformedURLException getMessage
public String getMessage()
From source file:com.jerrellmardis.amphitheatre.task.DownloadTaskHelper.java
public static List<SmbFile> getFiles(String user, String password, String path) { Log.d(TAG, path + " " + user + "//" + password); NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", user, password); List<SmbFile> files = Collections.emptyList(); //Manually delete all entries. Is this the best way to do it? No. List<Video> videos = Select.from(Video.class).where(Condition.prop("video_url").like("%" + path + "%")) .list();/*from ww w .j a va 2 s . c om*/ Log.d(TAG, "Purging " + videos.size() + " videos from source"); for (Video vx : videos) { vx.delete(); } //Let's do this in a way that's not going to blow out the memory of the device Log.d(TAG, "getting files from dir " + path + " with auth " + auth.getDomain() + " " + auth.getName() + " " + auth.getUsername() + " " + auth.getPassword()); SmbFile baseDir = null; try { baseDir = new SmbFile(path, auth); Log.d(TAG, "Base Directory: " + baseDir.getName() + ", " + baseDir.getPath()); traverseSmbFiles(baseDir, auth); } catch (MalformedURLException e) { e.printStackTrace(); Log.e(TAG, "MalformedURLException: " + e.getMessage()); } catch (SmbException e) { e.printStackTrace(); Log.e(TAG, "SmbException: " + e.getMessage()); } return files; }
From source file:org.apache.ignite.yardstick.IgniteNode.java
/** * @param springCfgPath Spring configuration file path. * @return Grid configuration./*from w ww . j ava 2 s .c o m*/ * @throws Exception If failed. */ protected static IgniteConfiguration loadConfiguration(String springCfgPath) throws Exception { URL url; try { url = new URL(springCfgPath); } catch (MalformedURLException e) { url = IgniteUtils.resolveIgniteUrl(springCfgPath); if (url == null) throw new IgniteCheckedException("Spring XML configuration path is invalid: " + springCfgPath + ". Note that this path should be either absolute or a relative local file system path, " + "relative to META-INF in classpath or valid URL to IGNITE_HOME.", e); } GenericApplicationContext springCtx; try { springCtx = new GenericApplicationContext(); new XmlBeanDefinitionReader(springCtx).loadBeanDefinitions(new UrlResource(url)); springCtx.refresh(); } catch (BeansException e) { throw new Exception("Failed to instantiate Spring XML application context [springUrl=" + url + ", err=" + e.getMessage() + ']', e); } Map<String, IgniteConfiguration> cfgMap; try { cfgMap = springCtx.getBeansOfType(IgniteConfiguration.class); } catch (BeansException e) { throw new Exception("Failed to instantiate bean [type=" + IgniteConfiguration.class + ", err=" + e.getMessage() + ']', e); } if (cfgMap == null || cfgMap.isEmpty()) throw new Exception("Failed to find ignite configuration in: " + url); return cfgMap.values().iterator().next(); }
From source file:edu.ucsb.eucalyptus.admin.server.EucalyptusWebBackendImpl.java
private static List<DownloadsWeb> getDownloadsFromUrl(final String downloadsUrl) { List<DownloadsWeb> downloadsList = new ArrayList<DownloadsWeb>(); HttpClient httpClient = new HttpClient(); //support for http proxy if (HttpServerBootstrapper.httpProxyHost != null && (HttpServerBootstrapper.httpProxyHost.length() > 0)) { String proxyHost = HttpServerBootstrapper.httpProxyHost; if (HttpServerBootstrapper.httpProxyPort != null && (HttpServerBootstrapper.httpProxyPort.length() > 0)) { int proxyPort = Integer.parseInt(HttpServerBootstrapper.httpProxyPort); httpClient.getHostConfiguration().setProxy(proxyHost, proxyPort); } else {/*w ww . j a v a2 s. c o m*/ httpClient.getHostConfiguration().setProxyHost(new ProxyHost(proxyHost)); } } GetMethod method = new GetMethod(downloadsUrl); Integer timeoutMs = new Integer(3 * 1000); method.getParams().setSoTimeout(timeoutMs); try { httpClient.executeMethod(method); String str = ""; InputStream in = method.getResponseBodyAsStream(); byte[] readBytes = new byte[1024]; int bytesRead = -1; while ((bytesRead = in.read(readBytes)) > 0) { str += new String(readBytes, 0, bytesRead); } String entries[] = str.split("[\\r\\n]+"); for (int i = 0; i < entries.length; i++) { String entry[] = entries[i].split("\\t"); if (entry.length == 3) { downloadsList.add(new DownloadsWeb(entry[0], entry[1], entry[2])); } } } catch (MalformedURLException e) { LOG.warn("Malformed URL exception: " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { LOG.warn("I/O exception: " + e.getMessage()); e.printStackTrace(); } finally { method.releaseConnection(); } return downloadsList; }
From source file:org.yardstickframework.gridgain.GridGainNode.java
/** * @param springCfgPath Spring configuration file path. * @return Grid configuration.// ww w.j a v a2s. c o m * @throws Exception If failed. */ private static GridConfiguration loadConfiguration(String springCfgPath) throws Exception { URL url; try { url = new URL(springCfgPath); } catch (MalformedURLException e) { url = GridUtils.resolveGridGainUrl(springCfgPath); if (url == null) throw new GridException("Spring XML configuration path is invalid: " + springCfgPath + ". Note that this path should be either absolute or a relative local file system path, " + "relative to META-INF in classpath or valid URL to GRIDGAIN_HOME.", e); } GenericApplicationContext springCtx; try { springCtx = new GenericApplicationContext(); new XmlBeanDefinitionReader(springCtx).loadBeanDefinitions(new UrlResource(url)); springCtx.refresh(); } catch (BeansException e) { throw new Exception("Failed to instantiate Spring XML application context [springUrl=" + url + ", err=" + e.getMessage() + ']', e); } Map<String, GridConfiguration> cfgMap; try { cfgMap = springCtx.getBeansOfType(GridConfiguration.class); } catch (BeansException e) { throw new Exception( "Failed to instantiate bean [type=" + GridConfiguration.class + ", err=" + e.getMessage() + ']', e); } if (cfgMap == null || cfgMap.isEmpty()) throw new Exception("Failed to find grid configuration in: " + url); return cfgMap.values().iterator().next(); }
From source file:DoubleBufferedImage.java
public void init() { URL url = null;/*from ww w .j a v a 2 s . co m*/ try { url = new URL(imageURLString); } catch (MalformedURLException me) { showStatus("Malformed URL: " + me.getMessage()); } originalImage = getImage(url); MediaTracker mt = new MediaTracker(this); mt.addImage(originalImage, 0); try { mt.waitForID(0); } catch (InterruptedException ie) { } imageWidth = originalImage.getWidth(null); imageHeight = originalImage.getHeight(null); dbImage = this.createImage(imageWidth, imageHeight); dbImageGraphics = dbImage.getGraphics(); }
From source file:com.nanosheep.bikeroute.parser.XMLParser.java
protected XMLParser(final String feedUrl) { try {//www. ja v a2s . com this.feedUrl = new URL(feedUrl); } catch (MalformedURLException e) { Log.e(e.getMessage(), "XML parser - " + feedUrl); } }
From source file:com.jbrisbin.vpc.jobsched.SpringResourceConnector.java
public URLConnection getResourceConnection(String name) throws ResourceException { Resource res = null;// w ww . ja va2s . co m if (name.startsWith("classpath:")) { res = new ClassPathResource(name.substring(10)); } else if (name.startsWith("http")) { try { res = new UrlResource(name); } catch (MalformedURLException e) { log.error(e.getMessage(), e); } } else { res = new FileSystemResource(name); } try { return res.getURI().toURL().openConnection(); } catch (IOException e) { log.error(e.getMessage(), e); throw new ResourceException(e); } }
From source file:at.madexperts.logmynight.facebook.AsyncRequestListener.java
public void onMalformedURLException(MalformedURLException e) { Log.e("stream", "Invalid URL:" + e.getMessage()); }
From source file:ImageLoaderApplet.java
public void init() { URL url;/*from w ww . j a v a2 s . c o m*/ try { // set imageURL here url = new URL(imageURLString); img = getImage(url); } catch (MalformedURLException me) { showStatus("Malformed URL: " + me.getMessage()); } }
From source file:net.noday.cat.web.admin.DwzManager.java
@RequestMapping(method = RequestMethod.POST) public Model gen(@RequestParam("url") String url, @RequestParam("alias") String alias, Model m) { try {/*from ww w . j a v a 2 s .co m*/ String urlstr = "http://dwz.cn/create.php"; URL requrl = new URL(urlstr); URLConnection conn = requrl.openConnection(); conn.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(conn.getOutputStream()); String param = String.format(Locale.CHINA, "url=%s&alias=%s", url, alias); out.write(param); out.flush(); out.close(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line = reader.readLine(); //{"longurl":"http:\/\/www.hao123.com\/","status":0,"tinyurl":"http:\/\/dwz.cn\/1RIKG"} ObjectMapper mapper = new ObjectMapper(); Dwz dwz = mapper.readValue(line, Dwz.class); if (dwz.getStatus() == 0) { responseData(m, dwz.getTinyurl()); } else { responseMsg(m, false, dwz.getErr_msg()); } } catch (MalformedURLException e) { log.error(e.getMessage(), e); responseMsg(m, false, e.getMessage()); } catch (IOException e) { log.error(e.getMessage(), e); responseMsg(m, false, e.getMessage()); } return m; }