List of usage examples for java.net MalformedURLException getMessage
public String getMessage()
From source file:api.LabdooClient.java
public LabdooClient(String url, String apikey) throws APIException { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); client = new XmlRpcClient(); try {/* ww w. j ava 2 s. c om*/ config.setServerURL(new URL(url + "?APIKEY=" + apikey)); } catch (MalformedURLException e) { log.error(e.getMessage()); APIException apiException = new APIException(); apiException.initCause(e.getCause()); throw apiException; } client.setConfig(config); }
From source file:GrabandFadewithRasters.java
public void init() { URL url;/*from w w w. j a v a 2s.co m*/ try { url = new URL(imageURLString); originalImage = getImage(url); } catch (MalformedURLException me) { showStatus("Malformed URL: " + me.getMessage()); } try { PixelGrabber grabber = new PixelGrabber(originalImage, 0, 0, -1, -1, true); if (grabber.grabPixels()) { width = grabber.getWidth(); height = grabber.getHeight(); originalPixelArray = (int[]) grabber.getPixels(); mis = new MemoryImageSource(width, height, originalPixelArray, 0, width); mis.setAnimated(true); newImage = createImage(mis); } else { System.err.println("Grabbing Failed"); } } catch (InterruptedException ie) { System.err.println("Pixel Grabbing Interrupted"); } DataBufferInt dbi = new DataBufferInt(originalPixelArray, width * height); int bandmasks[] = { 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff }; SampleModel sm; sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT, width, height, bandmasks); raster = Raster.createWritableRaster(sm, dbi, null); }
From source file:com.turborep.turbotracker.home.WeatherSer.java
/** * This method is used to connect the weather webservice of world weather online. * @return weather webservice response as {@link String} * @throws WeatherException/*from w w w .jav a 2 s .c om*/ */ private String connectWebservice() throws WeatherException { String aUrlStr = "http://api.worldweatheronline.com/free/v1/weather.ashx?q=" + getZipCode() + "&format=json&num_of_days=" + getForecastDays() + "&key=" + getApiKey(); try { /** ========================= Proxy settings ================================ **/ /**System.getProperties().put("http.proxyHost", "http://192.168.43.1"); System.getProperties().put("http.proxyPort", "3128"); System.getProperties().put("http.proxyUser", "vish_pepala"); System.getProperties().put("http.proxyPassword", "S@Naidu"); System.getProperties().put("http.proxySet", "true"); /******************************************************************/ PostMethod post = new PostMethod(aUrlStr); post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1"); HttpClient httpclient = new HttpClient(); httpclient.executeMethod(post); String aResponse = post.getResponseBodyAsString(); //logger.info(aResponse); return aResponse; } catch (MalformedURLException e) { logger.error(e.getMessage(), e); WeatherException aWeatherException = new WeatherException(e.getMessage(), e); throw aWeatherException; } catch (HttpException e) { logger.error(e.getMessage(), e); WeatherException aWeatherException = new WeatherException(e.getMessage(), e); throw aWeatherException; } catch (IOException e) { logger.error(e.getMessage(), e); WeatherException aWeatherException = new WeatherException(e.getMessage(), e); throw aWeatherException; } }
From source file:org.apache.wicket.security.examples.springsecurity.SpringSecureWicketTestApplication.java
@Override protected void setUpHive() { PolicyFileHiveFactory factory = new SwarmPolicyFileHiveFactory(getActionFactory()); try {/*from w ww .j a v a 2 s. c om*/ log.debug("realpath:" + getServletContext().getResource(".")); if (!factory.addPolicyFile(getServletContext().getResource("WEB-INF/standard.hive"))) { log.error("Could not add the standard.hive policy file, authorization will not work"); return; } } catch (MalformedURLException e) { log.error(e.getMessage(), e); } HiveMind.registerHive(this.getHiveKey(), factory); }
From source file:com.aurel.track.util.PluginUtils.java
/** * Gets the classes from the specified classResourcePath and the specified servletContextResourcePath * which are in jars beginning with and ending with which extend/implement a class * @param servletContext// w ww . j a va 2 s . c o m * @param superClass * @param jarStartsWith * @param jarEndsWith * @param classResourcePath * @param servletContextResourcePath * @return */ private static Set<String> getClassesFromLibJars(ServletContext servletContext, Class superClass, String jarStartsWith, String jarEndsWith, String classResourcePath, String servletContextResourcePath, Class[] constructorClasses, Object[] constructorParameters) { Set<String> foundAnalyzersSet = new TreeSet<String>(); try { File lib = PluginUtils.getFileFromURL(PluginUtils.class.getResource(classResourcePath)); //define the file filter FileFilterByStartAndEnd filter = new FileFilterByStartAndEnd(); filter.setStartsWith(jarStartsWith); filter.setEndsWith(jarEndsWith); //get the analyzers from the jars File[] foundJars = PluginUtils.getFilesFromDir(lib, filter); if (foundJars != null) { for (int i = 0; i < foundJars.length; i++) { foundAnalyzersSet.addAll(PluginUtils.getSubclassesFromJarInLib(foundJars[i], superClass, constructorClasses, constructorParameters)); } } //if .jars not yet found - probably because we use unexpaned .war (for ex. by weblogic) - try to get the resources through the servlet context if (foundJars == null || foundJars.length == 0) { URL urlLib = null; try { urlLib = servletContext.getResource(servletContextResourcePath); } catch (MalformedURLException e) { LOGGER.error("Getting the URL through getServletContext().getResource(path) failed with " + e.getMessage()); } lib = PluginUtils.getFileFromURL(urlLib); foundJars = PluginUtils.getFilesFromDir(lib, filter); if (foundJars != null) { for (int i = 0; i < foundJars.length; i++) { foundAnalyzersSet.addAll(PluginUtils.getSubclassesFromJarInLib(foundJars[i], superClass, constructorClasses, constructorParameters)); } } } } catch (Exception e) { LOGGER.warn("Getting the other lucene analysers failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } return foundAnalyzersSet; }
From source file:be.fedict.eid.dss.client.DSSProxySelector.java
/** * Sets the proxy for a certain location URL. If the proxyHost is * <code>null</code, we go DIRECT. * //from w w w . j av a 2 s . co m * @param location * the location to proxy. * @param proxyHost * proxy hostname * @param proxyPort * proxy port */ public void setProxy(String location, String proxyHost, int proxyPort) { String hostname; try { hostname = new URL(location).getHost(); } catch (MalformedURLException e) { throw new RuntimeException("URL error: " + e.getMessage(), e); } if (null == proxyHost) { LOG.debug("removing proxy for: " + hostname); this.proxies.remove(hostname); } else { LOG.debug("setting proxy for: " + hostname); this.proxies.put(hostname, new Proxy(Type.HTTP, new InetSocketAddress(proxyHost, proxyPort))); } }
From source file:GrabandFade.java
public void init() { URL url;//from ww w . j a v a2 s. c om try { // set imageURLString here url = new URL(imageURLString); originalImage = getImage(url); } catch (MalformedURLException me) { showStatus("Malformed URL: " + me.getMessage()); } /* * Create PixelGrabber and use it to fill originalPixelArray with image * pixel data. This array will then by used by the MemoryImageSource. */ try { PixelGrabber grabber = new PixelGrabber(originalImage, 0, 0, -1, -1, true); if (grabber.grabPixels()) { width = grabber.getWidth(); height = grabber.getHeight(); originalPixelArray = (int[]) grabber.getPixels(); mis = new MemoryImageSource(width, height, originalPixelArray, 0, width); mis.setAnimated(true); newImage = createImage(mis); } else { System.err.println("Grabbing Failed"); } } catch (InterruptedException ie) { System.err.println("Pixel Grabbing Interrupted"); } }
From source file:com.ge.predix.sample.blobstore.config.LocalConfig.java
@Bean public BlobstoreService objectStoreService() { log.info("objectStoreService(): " + objectStoreProperties.getAccessKey() + objectStoreProperties.getSecretKey() + ", " + objectStoreProperties.getBucket()); AmazonS3Client s3Client = new AmazonS3Client(new BasicAWSCredentials(objectStoreProperties.getAccessKey(), objectStoreProperties.getSecretKey())); s3Client.setEndpoint(objectStoreProperties.getUrl()); try {//w ww .ja va 2s. c o m // Remove the Credentials from the Object Store URL URL url = new URL(objectStoreProperties.getUrl()); String urlWithoutCredentials = url.getProtocol() + "://" + url.getHost(); // Return BlobstoreService return new BlobstoreService(s3Client, objectStoreProperties.getBucket(), urlWithoutCredentials); } catch (MalformedURLException e) { log.error("create(): Couldnt parse the URL provided by VCAP_SERVICES. Exception = " + e.getMessage()); throw new RuntimeException("Blobstore URL is Invalid", e); } }
From source file:be.fedict.eid.dss.document.ooxml.OOXMLSignatureService.java
@Override protected URL getOfficeOpenXMLDocumentURL() { try {//w w w. jav a 2s.com return this.tmpFile.toURI().toURL(); } catch (MalformedURLException e) { throw new RuntimeException("URL error: " + e.getMessage(), e); } }
From source file:be.fedict.eid.idp.sp.protocol.saml2.artifact.ArtifactProxySelector.java
/** * Sets the proxy for a certain location URL. If the proxyHost is null, we * go DIRECT.//from www .ja va 2 s . co m * * @param location * location * @param proxyHost * proxy hostname * @param proxyPort * proxy port */ public void setProxy(String location, String proxyHost, int proxyPort) { String hostname; try { hostname = new URL(location).getHost(); } catch (MalformedURLException e) { throw new RuntimeException("URL error: " + e.getMessage(), e); } if (null == proxyHost) { LOG.debug("removing proxy for: " + hostname); this.proxies.remove(hostname); } else { LOG.debug("setting proxy for: " + hostname); this.proxies.put(hostname, new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort))); } }