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:lh.api.showcase.server.api.lh.operations.OperationsServiceImpl.java

@Override
public String getSchedules(AirportCode origin, AirportCode destination, String departureDate,
        Boolean directFlight) throws HttpErrorResponseException {

    // e.g., https://api.lufthansa.com/v1/operations/schedules/FRA/KIX/2014-11-01?directFlights=true
    OperationsRequestFactoryImpl reqFact = new OperationsRequestFactoryImpl();
    try {/*  www.  j a v  a 2 s .  c  o m*/
        URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("schedules", ""),
                (List<NameValuePair>) Arrays.asList(
                        (NameValuePair) new BasicNameValuePair(origin.toString(), ""),
                        (NameValuePair) new BasicNameValuePair(destination.toString(), ""),
                        (NameValuePair) new BasicNameValuePair(departureDate, "")),
                Arrays.asList((NameValuePair) new BasicNameValuePair("directFlights",
                        (directFlight == null) ? ("false") : (directFlight.toString().toLowerCase()))));

        return HttpQueryUtils.executeQuery(uri);

    } catch (URISyntaxException e) {
        logger.log(Level.SEVERE, e.getMessage());
    }
    return null;
}

From source file:org.dataconservancy.ui.it.support.CitableLocatorRequest.java

public HttpGet reserveAsHttpGet() throws MalformedURLException {

    HttpGet get = null;// ww w . ja v a2 s. c o  m
    try {
        get = new HttpGet(urlConfig.getCitableLocatorGetUrl(collectionId, reservedCitableLocator).toURI());
    } catch (URISyntaxException e) {
        throw new RuntimeException(e.getMessage(), e);
    }

    if (collectionId == null) {
        throw new RuntimeException("reserveAsHttpGet must not have a null collectionId.");
    }
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("collectionId", collectionId));
    params.add(new BasicNameValuePair("reservedCitableLocator", reservedCitableLocator));
    params.add(new BasicNameValuePair(RESERVE_STRIPES_EVENT, "Reserve EZID"));

    return get;
}

From source file:asciidoc.maven.plugin.AbstractAsciiDocMojo.java

/**
 * No-arg constructor.// www  .  jav a  2s  .com
 */
public AbstractAsciiDocMojo() {
    try {
        File jarFile = new File(AbstractAsciiDocMojo.class.getProtectionDomain().getCodeSource().getLocation()
                .toURI().getPath());
        if (getLog().isDebugEnabled())
            getLog().debug("sourceJarFile: " + jarFile.getAbsolutePath());
        if (asciiDocHome == null) {
            ZipEntry zipEntry = null;
            String zipEntryName = null;
            ZipFile jarZipFile = new ZipFile(jarFile);
            Enumeration<? extends ZipEntry> e = jarZipFile.entries();
            while (e.hasMoreElements()) {
                zipEntry = (ZipEntry) e.nextElement();
                zipEntryName = zipEntry.getName();
                if (zipEntryName.startsWith("asciidoc") && zipEntryName.endsWith(".zip")) {
                    if (getLog().isInfoEnabled())
                        getLog().info("Found AsciiDoc in " + zipEntryName);
                    asciiDocHome = new File(jarFile.getParent(), FilenameUtils.removeExtension(zipEntryName));
                    break;
                }
            }
            if (asciiDocHome != null && !asciiDocHome.exists()) {
                unzipEntry(jarZipFile, zipEntry, jarFile.getParentFile());
                File asciiDocArchive = new File(jarFile.getParent(), zipEntryName);
                unzipArchive(asciiDocArchive, jarFile.getParentFile());
                asciiDocArchive.deleteOnExit();
            }
            if (getLog().isInfoEnabled())
                getLog().info("asciiDocHome: " + asciiDocHome);
        }
    } catch (URISyntaxException use) {
        getLog().error(use.getMessage(), use);
        // don't throw use;
    } catch (ZipException ze) {
        getLog().error(ze.getMessage(), ze);
        // don't throw ze;
    } catch (IOException ioe) {
        getLog().error(ioe.getMessage(), ioe);
        // don't throw ioe;
    }
}

From source file:ch.cyberduck.core.azure.AzureMetadataFeature.java

@Override
public Map<String, String> getMetadata(final Path file) throws BackgroundException {
    try {/*from w  ww. j a  v a 2  s.c o m*/
        if (containerService.isContainer(file)) {
            final CloudBlobContainer container = session.getClient()
                    .getContainerReference(containerService.getContainer(file).getName());
            container.downloadAttributes();
            return container.getMetadata();
        } else {
            final CloudBlob blob = session.getClient()
                    .getContainerReference(containerService.getContainer(file).getName())
                    .getBlobReferenceFromServer(containerService.getKey(file));
            // Populates the blob properties and metadata
            blob.downloadAttributes(null, null, context);
            final Map<String, String> metadata = new HashMap<String, String>();
            metadata.putAll(blob.getMetadata());
            final BlobProperties properties = blob.getProperties();
            if (StringUtils.isNotBlank(properties.getCacheControl())) {
                metadata.put(HttpHeaders.CACHE_CONTROL, properties.getCacheControl());
            }
            if (StringUtils.isNotBlank(properties.getContentType())) {
                metadata.put(HttpHeaders.CONTENT_TYPE, properties.getContentType());
            }
            return metadata;
        }
    } catch (URISyntaxException e) {
        throw new NotfoundException(e.getMessage(), e);
    } catch (StorageException e) {
        throw new AzureExceptionMappingService().map("Failure to read attributes of {0}", e, file);
    }
}

From source file:ca.ualberta.physics.cssdp.util.JSONURIDeserializer.java

@Override
public URI deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    try {//from   w  ww. j  av a2 s.co  m
        return new URI(jp.getText());
    } catch (URISyntaxException e) {
        logger.error("Could not deserialize json representation of URI " + jp.getText()
                + " into URI object because " + e.getMessage(), e);
    }
    return null;
}

From source file:lh.api.showcase.server.api.lh.referencedata.ReferenceDataServiceImpl.java

@Override
public String getAirports(AirportCode airportCode, LanguageCode lang) throws HttpErrorResponseException {
    ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl();
    try {//  w w w.  jav  a2s .  c om
        URI uri = reqFact.getRequestUri(
                (NameValuePair) new BasicNameValuePair("airports",
                        (airportCode == null) ? ("") : (airportCode.toString())),
                null, Arrays.asList((NameValuePair) new BasicNameValuePair("lang",
                        (lang == null) ? ("") : (lang.toString()))));

        return HttpQueryUtils.executeQuery(uri);

    } catch (URISyntaxException e) {
        logger.log(Level.SEVERE, e.getMessage());
    }
    return null;
}

From source file:lh.api.showcase.server.api.lh.referencedata.ReferenceDataServiceImpl.java

@Override
public String getCountries(CountryCode countryCode, LanguageCode lang) throws HttpErrorResponseException {

    ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl();
    try {//from w w  w.ja va 2 s  . co m
        URI uri = reqFact.getRequestUri(
                (NameValuePair) new BasicNameValuePair("countries",
                        (countryCode == null) ? ("") : (countryCode.toString())),
                null, Arrays.asList((NameValuePair) new BasicNameValuePair("lang",
                        (lang == null) ? ("") : (lang.toString()))));

        return HttpQueryUtils.executeQuery(uri);

    } catch (URISyntaxException e) {
        logger.log(Level.SEVERE, e.getMessage());
    }
    return null;
}

From source file:lh.api.showcase.server.api.lh.referencedata.ReferenceDataServiceImpl.java

@Override
public String getCities(CityCode cityCode, LanguageCode lang) throws HttpErrorResponseException {

    ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl();
    try {/*from   w ww. ja  v a 2s .c o  m*/
        URI uri = reqFact.getRequestUri(
                (NameValuePair) new BasicNameValuePair("cities",
                        (cityCode == null) ? ("") : (cityCode.toString())),
                null, Arrays.asList((NameValuePair) new BasicNameValuePair("lang",
                        (lang == null) ? ("") : (lang.toString()))));

        return HttpQueryUtils.executeQuery(uri);

    } catch (URISyntaxException e) {
        logger.log(Level.SEVERE, e.getMessage());
    }
    return null;
}

From source file:lh.api.showcase.server.api.lh.referencedata.ReferenceDataServiceImpl.java

@Override
public String getNearestAirports(Double latitude, Double longitude, LanguageCode lang)
        throws HttpErrorResponseException {
    ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl();
    try {/*from w w w  .j  a v  a 2s  .c  o  m*/
        URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("airports", ""),
                (List<NameValuePair>) Arrays.asList((NameValuePair) new BasicNameValuePair("nearest",
                        latitude.toString() + "," + longitude.toString())),
                Arrays.asList((NameValuePair) new BasicNameValuePair("lang",
                        (lang == null) ? ("") : (lang.toString()))));

        return HttpQueryUtils.executeQuery(uri);

    } catch (URISyntaxException e) {
        logger.log(Level.SEVERE, e.getMessage());
    }
    return null;
}

From source file:com.siahmsoft.soundwaper.net.NetManager.java

public HttpResponse getHTTPResponse(URL tracksUrl) throws IllegalArgumentException {
    HttpGet request = null;//from   w ww.j  a va  2s . c  o  m
    HttpResponse response = null;

    if (tracksUrl == null) {
        throw new IllegalArgumentException("Tracks URL was null");
    }

    try {//"http://waveforms.soundcloud.com/v5rXPhwTWiNy_m.png"
        request = new HttpGet(tracksUrl.toURI());
    } catch (URISyntaxException e) {
        Log.e(TAG, "Could not create GetRequest: " + e.getMessage(), e);
    } catch (NullPointerException e) {
        Log.e(TAG, "Could not create GetRequest as URL is null", e);
        throw new IllegalArgumentException(e);
    }

    try {
        response = httpClient.execute(request);
    } catch (ClientProtocolException e) {
        Log.e(TAG, "Client Protocol exception: " + e.getMessage(), e);
    } catch (IOException e) {
        Log.e(TAG, "IOException exception: " + e.getMessage(), e);
    }

    if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
        Log.i(TAG,
                "Response code:[" + HttpStatus.SC_OK + "] Msg:[" + response.getStatusLine().getReasonPhrase()
                        + "] Type:[" + response.getEntity().getContentType() + "] length:["
                        + response.getEntity().getContentLength() + "]");
    } else {
        Log.e(TAG, "Unsuccessful Connection response: " + response.getStatusLine().getStatusCode());
    }
    return response;
}