Example usage for java.net URISyntaxException getMessage

List of usage examples for java.net URISyntaxException getMessage

Introduction

In this page you can find the example usage for java.net URISyntaxException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns a string describing the parse error.

Usage

From source file:kontrol.HttpUtil.java

public static boolean exists(String url) {
    try {/*w w w  .  j  ava 2  s. c  o m*/
        return getCookielessHttpClient(1000).execute(new HttpHead(new URI(url)), new BasicHttpContext())
                .getStatusLine().getStatusCode() < 400;
    } catch (URISyntaxException e) {
        log.warn(e.getMessage());
        return false;
    } catch (ClientProtocolException e) {
        log.warn(e.getMessage());
        return false;
    } catch (IOException e) {
        log.warn(e.getMessage());
        return false;
    }
}

From source file:com.amazonaws.eclipse.core.HttpClientFactory.java

private static void configureProxy(DefaultHttpClient client, String url) {
    AwsToolkitCore plugin = AwsToolkitCore.getDefault();
    if (plugin != null) {
        IProxyService proxyService = AwsToolkitCore.getDefault().getProxyService();

        if (proxyService.isProxiesEnabled()) {
            try {
                IProxyData[] proxyData;/*w  ww .j a  v a  2  s  . com*/
                proxyData = proxyService.select(new URI(url));
                if (proxyData.length > 0) {

                    IProxyData data = proxyData[0];
                    client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
                            new HttpHost(data.getHost(), data.getPort()));

                    if (data.isRequiresAuthentication()) {
                        client.getCredentialsProvider().setCredentials(
                                new AuthScope(data.getHost(), data.getPort()),
                                new NTCredentials(data.getUserId(), data.getPassword(), null, null));
                    }
                }
            } catch (URISyntaxException e) {
                plugin.getLog().log(new Status(Status.ERROR, AwsToolkitCore.PLUGIN_ID, e.getMessage(), e));
            }
        }
    }
}

From source file:de.shadowhunt.subversion.RepositoryFactory.java

private static URI sanitise(final URI uri, final Resource path) {
    try {/*from  w w  w.jav  a  2s  .c  om*/
        return new URI(uri.getScheme(), DEFAULT_USER_INFO, uri.getHost(), uri.getPort(), path.getValue(),
                DEFAULT_QUERY, DEFAULT_FRAGMENT);
    } catch (final URISyntaxException e) {
        throw new IllegalArgumentException(e.getMessage(), e);
    }
}

From source file:eu.planets_project.services.datatypes.Content.java

/**
 * Create content by reference./*ww w  . j a v  a  2s .  com*/
 * @param reference The URL reference to the actual content
 * @return A content instance referencing the given location
 */
public static DigitalObjectContent byReference(final URL reference) {
    URI uriReference = null;
    /* we do not really expect a URI syntax exception on conversion from URL ... */
    try {
        uriReference = reference.toURI();
    } catch (URISyntaxException use) {
        System.out.println(use.getClass().getName() + ": " + use.getMessage());
    }
    return new ImmutableContent(uriReference);
}

From source file:org.jboss.spring.vfs.VFSResource.java

static Object getChild(URL url) throws IOException {
    try {/*from   ww  w  . ja  va 2  s . c  o  m*/
        return VFSUtil.invokeMethodWithExpectedExceptionType(VFSUtil.VFS_METHOD_GET_ROOT_URL, null,
                URISyntaxException.class, url);
    } catch (URISyntaxException e) {
        IOException ioe = new IOException(e.getMessage());
        ioe.initCause(e);
        throw ioe;
    }
}

From source file:net.modelbased.proasense.storage.registry.RegisterSensorSSN.java

public static String postSensor(Sensor sensor) throws RequestErrorException {
    String content = JsonPrinter.sensorToJson(sensor);
    URI target;/*from  w  w  w  . java 2s  .c om*/
    try {
        target = new URI(sensor.getUri().toString() + SENSOR_PATH);
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
        throw new RequestErrorException(e1.getMessage());
    }
    HttpClient client = new DefaultHttpClient();
    HttpPost request = new HttpPost(target);
    request.setHeader("Content-type", "application/json");
    String response = null;
    try {
        StringEntity seContent = new StringEntity(content);
        seContent.setContentType("text/json");
        request.setEntity(seContent);
        response = resolveResponse(client.execute(request));
    } catch (Exception e) {
        throw new RequestErrorException(e.getMessage());
    }
    return response;
}

From source file:com.databasepreservation.visualization.api.utils.ApiUtils.java

public static URI getUriFromRequest(HttpServletRequest request) throws RODAException {
    try {/* w  w  w.j a  v a  2  s. c om*/
        return new URI(request.getRequestURI());
    } catch (URISyntaxException e) {
        throw new GenericException("Error creating URI from String: " + e.getMessage());
    }
}

From source file:com.izforge.izpack.compiler.packager.impl.AbstractPackagerTest.java

public static File getBaseDir() {
    File path = null;//from ww w  .  java 2  s.  c o  m
    try {
        URL url = AbstractPackagerTest.class.getClassLoader().getResource("");
        if (url != null) {
            URI uri = url.toURI();
            path = new File(uri);
            // path: <root>/target/test-classes
            path = path.getParentFile(); // <root>/target/
            path = path.getParentFile(); // <root>
        } else {
            Assert.fail("Resource not found");
        }
    } catch (URISyntaxException e) {
        Assert.fail(e.getMessage());
    }
    return path;
}

From source file:uk.ac.sanger.cgp.wwdocker.actions.Utils.java

public static File thisJarFile() {
    File thisJar = null;/*from w w  w . j  a v a  2 s.  c om*/
    try {
        thisJar = new File(Remote.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());

    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    return thisJar;
}

From source file:org.yaoha.ApiConnector.java

public static URI getRequestUriApiGetNode(String id) {
    URI uri = null;/* w ww. j ava2s  .  c o m*/
    try {
        uri = new URI("http", apiUrl, "/api/0.6/node/" + id, null);
    } catch (URISyntaxException e) {
        Log.d(ApiConnector.class.getSimpleName(), e.getMessage());
    }

    return uri;
}