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:com.mellanox.jxio.tests.benchmarks.StatClientSession.java

public StatClientSession(EventQueueHandler eqh, String uriString, int num_clients) {
    this.clients_count = 0;
    this.eqh = eqh;
    this.clients = new ClientSession[num_clients];

    URI uri = null;// w ww.j a  v a 2 s  .com
    try {
        uri = new URI(uriString);
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    for (int i = 0; i < num_clients; i++) {
        this.clients[i] = new ClientSession(eqh, uri, new StatSesClientCallbacks(i));
    }
}

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

/**
 * ??.//from   w  w w.  ja va2s  .c o m
 * @param view ?
 */
protected void onClickSend(final View view) {
    mLogger.entering(getClass().getName(), "onClickSend", view);

    CharSequence body = ((TextView) getView().findViewById(R.id.fragment_notification_service_body)).getText();

    (new AsyncTask<String, Integer, DConnectMessage>() {
        public DConnectMessage doInBackground(final String... args) {

            if (args == null || args.length == 0) {
                return new DConnectResponseMessage(DConnectMessage.RESULT_ERROR);
            }

            String type = String.valueOf(mSpinner.getSelectedItemPosition());
            String body = args[0];

            DConnectMessage message = new DConnectResponseMessage(DConnectMessage.RESULT_ERROR);
            try {
                URIBuilder uriBuilder = new URIBuilder();
                uriBuilder.setProfile(NotificationProfileConstants.PROFILE_NAME);
                uriBuilder.setAttribute(NotificationProfileConstants.ATTRIBUTE_NOTIFY);
                uriBuilder.addParameter(DConnectMessage.EXTRA_DEVICE_ID, getSmartDevice().getId());
                uriBuilder.addParameter(NotificationProfileConstants.PARAM_TYPE, type);
                uriBuilder.addParameter(NotificationProfileConstants.PARAM_BODY, body);
                uriBuilder.addParameter(DConnectMessage.EXTRA_ACCESS_TOKEN, getAccessToken());

                HttpResponse response = getDConnectClient().execute(getDefaultHost(),
                        new HttpPost(uriBuilder.build()));
                message = (new HttpMessageFactory()).newDConnectMessage(response);
            } catch (URISyntaxException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return message;
        }
    }).execute(body.toString());

    mLogger.exiting(getClass().getName(), "onClickSend");
}

From source file:com.jpeterson.littles3.bo.GroupBaseTest.java

/**
 * Test the constructor.//from   w  w  w .  j a va2 s .  c o  m
 */
public void test_constructor() {
    GroupBase group;
    URI uri;
    String uriString = "http://www.foo.com";

    try {
        uri = new URI(uriString);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        fail("Unexpected exception");
        return;
    }

    group = new MyGroupBase(uri);

    assertEquals("Unexpected value", uri, group.getUri());
}

From source file:com.jpeterson.littles3.bo.GroupBaseTest.java

/**
 * Test the <code>getName()</code> method.
 */// w ww . ja v  a  2  s.c o  m
public void test_getName() {
    GroupBase group;
    URI uri;
    String uriString = "http://www.foo.com";

    try {
        uri = new URI(uriString);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        fail("Unexpected exception");
        return;
    }

    group = new MyGroupBase(uri);

    assertEquals("Unexpected value", uriString, group.getName());
}

From source file:com.jpeterson.littles3.bo.GroupBaseTest.java

/**
 * Test the <code>toString()</code> method.
 *//* w w  w  . j ava 2 s  . co  m*/
public void test_getString() {
    GroupBase group;
    URI uri;
    String uriString = "http://www.foo.com";

    try {
        uri = new URI(uriString);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        fail("Unexpected exception");
        return;
    }

    group = new MyGroupBase(uri);

    assertEquals("Unexpected value", "uri " + uriString, group.toString());
}

From source file:com.natixis.appdynamics.traitements.GetInfoLicense.java

public Map<String, Object> RetrieveInfoLicense() throws ClientProtocolException, IOException {
    Map<String, Object> myMapInfoLicense = new HashMap<String, Object>();

    HttpClient client = new DefaultHttpClient();

    String[] chaineUrl = GetParamApplication.urlApm.split("/" + "/");
    String hostApm = chaineUrl[1];

    URI uri = null;//w  ww. j  a  v  a2s. co m
    try {
        uri = new URIBuilder().setScheme("http").setHost(hostApm).setPath(GetParamApplication.uriInfoLicense)
                .setParameter("startdate", GetDateInfoLicence()).setParameter("enddate", GetDateInfoLicence())
                .build();
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    ((DefaultHttpClient) client).getCredentialsProvider().setCredentials(new AuthScope(hostApm, 80),
            new UsernamePasswordCredentials(GetParamApplication.userApm, GetParamApplication.passwordApm));
    HttpGet request = new HttpGet(uri);
    HttpResponse response = client.execute(request);
    HttpEntity entity = response.getEntity();
    String jsonContent = EntityUtils.toString(entity);
    Reader stringReader = new StringReader(jsonContent);
    JsonReader rdr = Json.createReader(stringReader);
    JsonObject obj = rdr.readObject();
    JsonArray results = obj.getJsonArray("usages");

    for (JsonObject result : results.getValuesAs(JsonObject.class)) {
        BeanInfoLicense myBeanInfoLicense = new BeanInfoLicense(result.getString("agentType"),
                result.getInt("avgUnitsAllowed"), result.getInt("avgUnitsUsed"));
        myMapInfoLicense.put(result.getString("agentType"), myBeanInfoLicense);
        //System.out.println(result.getString("agentType")+","+result.getInt("avgUnitsAllowed")+","+result.getInt("avgUnitsUsed"));
    }

    return myMapInfoLicense;
}

From source file:org.eclipse.vorto.codegen.api.CopyResourceTask.java

public void generate(Context metaData, IMappingContext mappingContext, final IGeneratedWriter outputter) {
    try {/*from w w w  .  jav  a2s.  c  o  m*/
        Path start = Paths.get(basePath.toURI());
        Files.walkFileTree(start, new FileVisitor<Path>() {

            @Override
            public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
                return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                outputter.write(new Generated(file.getFileName().toFile().getName(),
                        getOutputPath(file).isEmpty() ? null : getOutputPath(file),
                        FileUtils.readFileToByteArray((file.toFile()))));
                return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {

                return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {

                return FileVisitResult.CONTINUE;
            }
        });
    } catch (IOException ioEx) {
        throw new RuntimeException(ioEx);
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

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

/**
 * Login to server and get token/*from   w w w.j ava 2  s.  c o m*/
 *
 * @return Token
 */
private void login(XMLRPCCallback callback) {
    try {
        XMLRPCClient client = new XMLRPCClient(new URI(mApiUrl), "", "", mUserAgent);
        client.callAsync(callback, "LogIn", new String[] { "", "", "en", mUserAgent });
    } catch (URISyntaxException e) {
        e.printStackTrace();
        // Just catch and fail
    }
}

From source file:com.github.technosf.posterer.modules.commons.transport.CommonsResponseModelTaskImplTest.java

@BeforeClass
public void beforeClass() throws ClientProtocolException, IOException {
    classUnderTest = new CommonsResponseModelTaskImpl(1, new Auditor(), httpClientBuilder, TIMEOUT, request,
            bsTrue);/*from   w w w . j a v  a2s  . c o  m*/

    reset(httpClientBuilder, closeableHttpClient, closeableHttpResponse, request);

    expect(httpClientBuilder.build()).andStubReturn(closeableHttpClient);
    expect(closeableHttpClient.execute(notNull(HttpUriRequest.class))).andStubReturn(closeableHttpResponse);

    try {
        expect(request.getUri()).andStubReturn(new URI("http://testuri"));
        expect(request.getMethod()).andStubReturn("GET");
        expect(request.getPayload()).andStubReturn("-=Payload=-");
    } catch (URISyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    replay(httpClientBuilder, closeableHttpClient, closeableHttpResponse, request);
}

From source file:org.gatherdata.data.dao.jpa.model.JpaFlatForm.java

public URI getUid() {
    if (uid == null) {
        try {/*from  w  ww. ja v  a  2  s  .  co m*/
            this.uid = new URI(uidAsString);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
    }
    return uid;
}