Example usage for java.net URISyntaxException printStackTrace

List of usage examples for java.net URISyntaxException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:info.rmapproject.core.model.impl.openrdf.ORMapEventCreationTest.java

/**
 * Test method for {@link info.rmapproject.core.model.impl.openrdf.ORMapEventCreation#ORMapEventCreation(info.rmapproject.core.model.RMapIri, info.rmapproject.core.model.event.RMapEventTargetType, info.rmapproject.core.model.RMapValue, java.util.List)}.
 *//*from   w w  w .j  a  v  a 2  s  . c o  m*/
@Test
public void testORMapEventCreationRMapIriRMapEventTargetTypeRMapValueListOfRMapIri() throws Exception {
    List<java.net.URI> resourceList = new ArrayList<java.net.URI>();
    try {
        IRI creatorIRI = vf.createIRI("http://orcid.org/0000-0003-2069-1219");
        resourceList.add(new java.net.URI("http://rmap-info.org"));
        resourceList.add(new java.net.URI("https://rmap-project.atlassian.net/wiki/display/RMAPPS/RMap+Wiki"));
        RMapIri associatedAgent = ORAdapter.openRdfIri2RMapIri(creatorIRI);
        ORMapDiSCO disco = new ORMapDiSCO(associatedAgent, resourceList);
        // Make list of created objects
        List<IRI> iris = new ArrayList<IRI>();
        IRI discoContext = disco.getDiscoContext();
        iris.add(discoContext);
        Model model = disco.getAsModel();
        assertEquals(4, model.size());
        List<RMapIri> createdObjIds = new ArrayList<RMapIri>();
        for (IRI iri : iris) {
            createdObjIds.add(ORAdapter.openRdfIri2RMapIri(iri));
        }
        RMapRequestAgent requestAgent = new RMapRequestAgent(associatedAgent.getIri());
        ORMapEventCreation event = new ORMapEventCreation(requestAgent, RMapEventTargetType.DISCO, null,
                createdObjIds);
        Date end = new Date();
        event.setEndTime(end);
        Model eventModel = event.getAsModel();
        assertEquals(7, eventModel.size());
        IRI context = event.getContext();
        for (Statement stmt : eventModel) {
            assertEquals(context, stmt.getContext());
        }
        assertEquals(1, event.getCreatedObjectStatements().size());
        assertEquals(createdObjIds.size(), event.getCreatedObjectIds().size());
        assertEquals(RMapEventType.CREATION, event.getEventType());
        assertEquals(RMapEventTargetType.DISCO, event.getEventTargetType());

        //Date sdate = event.getStartTime();
        //Date edate = event.getEndTime();

        Statement tStmt = event.getTypeStatement();
        assertEquals(RMAP.EVENT, tStmt.getObject());
        IRI crEventId = eventmgr.createEvent(event, triplestore);
        assertEquals(context, crEventId);
        assertFalse(context.stringValue().equals(discoContext.stringValue()));
        assertTrue(eventmgr.isEventId(context, triplestore));
    } catch (URISyntaxException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }

}

From source file:pct.droid.base.providers.subs.OpenSubsProvider.java

/**
 * Search for subtitles by imdbId, season and episode
 *
 * @param show    Show/*from   www  . j  a  va2  s.  co  m*/
 * @param season  Season number
 * @param episode Episode number
 * @param token   Login token
 * @return SRT URL
 */
private void search(Show show, String season, String episode, String token, XMLRPCCallback callback) {
    try {
        XMLRPCClient client = new XMLRPCClient(new URI(mApiUrl), "", "", mUserAgent);
        Map<String, String> option = new HashMap<String, String>();
        option.put("imdbid", show.imdbId.replace("tt", ""));
        option.put("season", season);
        option.put("episode", episode);
        option.put("sublanguageid", "all");
        client.callAsync(callback, "SearchSubtitles", new Object[] { token, new Object[] { option } });
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}

From source file:org.deviceconnect.android.uiapp.fragment.profile.PhoneProfileFragment.java

private void callPhone(final String number) {
    (new AsyncTask<Void, Void, DConnectMessage>() {
        public DConnectMessage doInBackground(final Void... args) {

            try {
                URIBuilder builder = new URIBuilder();
                builder.setProfile(PhoneProfileConstants.PROFILE_NAME);
                builder.setAttribute(PhoneProfileConstants.ATTRIBUTE_CALL);
                builder.addParameter(DConnectMessage.EXTRA_DEVICE_ID, getSmartDevice().getId());
                builder.addParameter(PhoneProfileConstants.PARAM_PHONE_NUMBER, number);
                builder.addParameter(DConnectMessage.EXTRA_ACCESS_TOKEN, getAccessToken());

                HttpResponse response = getDConnectClient().execute(getDefaultHost(),
                        new HttpPost(builder.build()));
                return (new HttpMessageFactory()).newDConnectMessage(response);
            } catch (URISyntaxException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();//from   w  w  w.  ja v a2s .  c o m
            }
            return null;
        }

        @Override
        protected void onPostExecute(final DConnectMessage result) {
            if (getActivity().isFinishing()) {
                return;
            }

            TextView tv = (TextView) getView().findViewById(R.id.fragment_phone_result);
            if (result == null) {
                tv.setText("failed");
            } else {
                tv.setText(result.toString());
            }
        }
    }).execute();
}

From source file:com.mellanox.jxio.tests.benchmarks.DataPathTest.java

protected URI generateUri() {
    String url_string = "rdma://" + server_ip + ":" + server_port;
    try {/*from   w w w .  j  a v  a 2s  . c om*/
        return new URI(url_string);
    } catch (URISyntaxException e) {
        System.out.println("Bad URI given\n");
        LOG.error("Bad URI given");
        e.printStackTrace();
    }
    return null;
}

From source file:gr.ntua.ivml.awareness.search.SearchServiceAccess.java

private URI constructURIRecord(String recid) {
    URI uri = null;/*w  w w  .  j av a2  s .c  o m*/
    List<NameValuePair> qparams = new ArrayList<NameValuePair>();
    qparams.add(new BasicNameValuePair("wskey", "api2demo"));
    try {
        uri = URIUtils.createURI("http", "preview.europeana.eu", 80, "/api/v2/record" + recid + ".json",
                URLEncodedUtils.format(qparams, "UTF-8"), null);
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
    return uri;
}

From source file:com.squid.kraken.v4.auth.LostServlet.java

@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    if (request.getParameter(EMAIL) != null) {
        // perform auth
        try {/*from w  w w  .jav  a 2s.c o m*/
            proceed(request, response);
        } catch (URISyntaxException e) {
            e.printStackTrace();
            show(request, response);
        }
    } else {
        // forward to login page
        show(request, response);
    }
}

From source file:asterixReadOnlyClient.AsterixReadOnlyClientUtility.java

@Override
public void init() {
    httpclient = new DefaultHttpClient();
    httpGet = new HttpGet();
    try {/* ww  w.  j a  va2 s.c o m*/
        roBuilder = new URIBuilder("http://" + ccUrl + ":" + Constants.ASTX_AQL_REST_API_PORT + "/query");
    } catch (URISyntaxException e) {
        System.err.println("Problem in initializing Read-Only URI Builder");
        e.printStackTrace();
    }
}

From source file:com.ushahidi.swiftriver.core.mail.EmailHelper.java

/**
 * Returns the mail body for the specified <code>emailType</code>
 * with all the properties in <code>templateParams</code> having been
 * set/*from w w  w.  ja v a2s  . c o m*/
 *  
 * @param emailType
 * @param templateParams
 * @param name
 * @return
 */
public String getEmailBody(EmailType emailType, Map<String, Object> templateParams, String name) {
    Map<String, Object> body = new HashMap<String, Object>();
    try {
        URIBuilder uriBuilder = new URIBuilder(getBaseUrl(emailType));
        for (Map.Entry<String, Object> entry : templateParams.entrySet()) {
            uriBuilder.addParameter(entry.getKey(), (String) entry.getValue());
        }

        body.put("name", name);
        body.put("url", uriBuilder.toString());
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }

    String templateLocation = EmailType.getTemplateLocation(emailType);

    return VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, templateLocation, "UTF-8", body);
}

From source file:crawl.BasicCrawler.java

/**
 * You should implement this function to specify whether the given url
 * should be crawled or not (based on your crawling logic).
 *//*from  w  w  w. j  a  v  a  2 s.  c  om*/
@Override
public boolean shouldVisit(Page referringPage, WebURL url) {
    String href = url.getURL().toLowerCase();
    // Ignore the url if it has an extension that matches our defined set of image extensions.
    if (IMAGE_EXTENSIONS.matcher(href).matches()) {
        return false;
    }
    // Don't crawl the same pages too many times

    try {
        if (!visitStats.intendToVisit(url.getURL())) {
            return false;
        }
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }

    // Only accept the url if it is in the "www.ics.uci.edu" domain and protocol is "http".
    return href.contains(".ics.uci.edu/");
}

From source file:elaborate.publication.resources.SearchResource.java

protected URI createURI(SearchData e) {
    URI uri;// w w w .jav  a  2  s. c o m
    try {
        uri = new URI(String.valueOf(e.getId()));
    } catch (URISyntaxException ue) {
        uri = null;
        ue.printStackTrace();
    }
    return uri;
}