List of usage examples for java.net URISyntaxException printStackTrace
public void printStackTrace()
From source file:com.cimmyt.zk.welcome.LoginWelcome.java
/** * Devuelve un bean de usuario si la autentificacion es correcta, * de lo contrario devuelve null.//w w w . j av a2 s .co m * <br><b>Nota: Reemplazar con llamada a servicio de autentificacion</b> * */ private UserBean validateUserBD(String user, String pass, String idCrop) { UserBean userBean = null; HttpClient httpclient = new DefaultHttpClient(); URIBuilder builder = new URIBuilder(); builder.setScheme(Executions.getCurrent().getScheme()).setHost(Executions.getCurrent().getLocalName()) .setPort(Executions.getCurrent().getLocalPort()) .setPath(Executions.getCurrent().getContextPath() + "/login").setParameter("user", user) .setParameter("password", pass).setParameter("organismid", idCrop); System.out.println("Builder :: " + builder.toString()); try { URI uri = builder.build(); HttpPost post = new HttpPost(uri); HttpResponse response = httpclient.execute(post); System.out.println("Status code :: " + response.getStatusLine().getStatusCode()); response.getEntity(); System.out.println(response.getEntity().getContent()); InputStream input = response.getEntity().getContent(); if (response.getStatusLine().getStatusCode() == 200) { //UserBean userS = (UserBean)response.getEntity().getContent(); //System.out.println("User :: "+ userS); ObjectInputStream ois = new ObjectInputStream(input); userBean = (UserBean) ois.readObject(); } else if (response.getStatusLine().getStatusCode() == 500) { System.out.println(input); System.out.println(getStringFromInputStream(input)); response.getEntity(); } } catch (URISyntaxException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (Exception exg) { exg.printStackTrace(); } return userBean; }
From source file:de.fu_berlin.inf.dpp.intellij.project.fs.ProjectImp.java
@Override public URI getLocationURI() { try {//from ww w . jav a 2 s. com return new URI(fullPath.toString()); } catch (URISyntaxException e) { e.printStackTrace(); return null; } }
From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientSP.java
/** * Stops the automatic eco-assessment of a service. * * @param serviceId Service identifier./* w w w . ja v a 2 s. com*/ */ public void stopAssessment(String serviceId) { try { if (serviceId != null) { WebResource resource = client.resource(this.getAddress()); resource.path("service").path(serviceId).delete(); } } catch (UniformInterfaceException ex) { ClientResponse cr = ex.getResponse(); log.error(cr.getStatus()); ex.printStackTrace(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.diversityarrays.update.UpdateDialog.java
private void openWebpage(URL url) { try {//from w w w .j av a2 s. c om openWebpage(url.toURI()); } catch (URISyntaxException e) { e.printStackTrace(); } }
From source file:com.almende.eve.goldemo.Cell.java
/** * Ask cycle state.//from www . j a va2s.com * * @param neighbor * the neighbor * @throws JSONRPCException * the jSONRPC exception * @throws IOException * Signals that an I/O exception has occurred. * @throws URISyntaxException * the uRI syntax exception */ public void askCycleState(@Sender final String neighbor) throws JSONRPCException, IOException, URISyntaxException { final String neighborId = getAgentHost().getAgentId(URI.create(neighbor)); ObjectNode params = JOM.createObjectNode(); params.put("cycle", getState().get("current_cycle", Integer.class) - 1); sendAsync(URI.create(neighbor), "getCycleState", params, new AsyncCallback<CycleState>() { @Override public void onSuccess(CycleState state) { if (state != null) { getState().put(neighborId + "_" + state.getCycle(), state); try { calcCycle(false); } catch (URISyntaxException e) { e.printStackTrace(); } } } @Override public void onFailure(Exception exception) { // TODO Auto-generated method stub } }, CycleState.class); }
From source file:org.rifidi.designer.library.basemodels.boxproducer.BoxproducerEntity.java
@Override public void init() { if (model == null) { URI modelpath = null;//from w w w . ja va 2 s . c o m try { modelpath = getClass().getClassLoader() .getResource("org/rifidi/designer/library/basemodels/boxproducer/blankdisc.jme") // .getResource("org/rifidi/designer/library/basemodels/boxproducer/boxproducer_saucer.jme") .toURI(); } catch (URISyntaxException e) { e.printStackTrace(); } try { model = (Node) BinaryImporter.getInstance().load(modelpath.toURL()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } BinaryPattern pattern = new BinaryPattern(); pattern.setPattern(new boolean[][] { { false, true, true, false }, { true, true, true, true }, { true, true, true, true }, { false, true, true, false }, }); setPattern(pattern); setCollides(false); AlphaState as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState(); as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA); as.setSrcFunction(AlphaState.SB_SRC_ALPHA); as.setBlendEnabled(true); as.setEnabled(true); MaterialState ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState(); ms.setDiffuse(new ColorRGBA(.2f, .75f, .8f, 1).multLocal(.7f)); ms.setEnabled(true); model.setRenderState(ms); Node node = new Node(getEntityId()); Node sharednode = new SharedNode("shared_", model); sharednode.setLocalTranslation(0, 12, 0); // sharednode.setRenderState(ms); node.attachChild(sharednode); node.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT); node.setRenderState(as); node.setModelBound(new BoundingBox()); node.updateModelBound(); setNode(node); logger.debug(NodeHelper.printNodeHierarchy(getNode(), 3)); thread = new BoxproducerEntityThread(this, productService, products); thread.setInterval((int) speed * 1000); thread.start(); }
From source file:misc.DesktopDemo.java
/** * Launch the default email client using the "mailto" * protocol and the text supplied by the user. * */// w ww . ja va2s . c o m private void onLaunchMail(ActionEvent evt) { String mailTo = txtMailTo.getText(); URI uriMailTo = null; try { if (mailTo.length() > 0) { uriMailTo = new URI("mailto", mailTo, null); desktop.mail(uriMailTo); } else { desktop.mail(); } } catch (IOException ioe) { ioe.printStackTrace(); } catch (URISyntaxException use) { use.printStackTrace(); } }
From source file:com.kurento.demo.cpbrazil.CpbWebRtc.java
@Override public void onContentRequest(final WebRtcContentSession contentSession) throws Exception { String contentId = contentSession.getContentId(); final boolean recordOnRepository = contentId != null && contentId.equalsIgnoreCase("repositoryRecorder"); recorderUrl = contentSession.getHttpServletRequest().getScheme() + "://" + config.getHandlerAddress() + ":" + contentSession.getHttpServletRequest().getServerPort(); handlerUrl = recorderUrl + contentSession.getHttpServletRequest().getContextPath(); cpbWindows = new CpbWindows(handlerUrl); mediaPipeline = contentSession.getMediaPipelineFactory().create(); contentSession.releaseOnTerminate(mediaPipeline); rateLimiter = mediaPipeline.newGStreamerFilter("videorate max-rate=15 average-period=200000000").build(); mirrorFilter = mediaPipeline.newGStreamerFilter("videoflip method=4").build(); chromaFilter = mediaPipeline.newChromaFilter(new WindowParam(100, 10, 500, 400)).build(); pointerDetectorAdvFilter = mediaPipeline.newPointerDetectorAdvFilter(new WindowParam(5, 5, 50, 50)).build(); pointerDetectorAdvFilter.addWindow(cpbWindows.start); activeWindow = Windows.START;/* w ww .j av a 2 s . co m*/ faceOverlayFilter = mediaPipeline.newFaceOverlayFilter().build(); rateLimiter.connect(mirrorFilter); mirrorFilter.connect(pointerDetectorAdvFilter); pointerDetectorAdvFilter.connect(chromaFilter); chromaFilter.connect(faceOverlayFilter); pointerDetectorAdvFilter.addWindow(cpbWindows.fiware); pointerDetectorAdvFilter.addWindowInListener(new MediaEventListener<WindowInEvent>() { @Override public void onEvent(WindowInEvent event) { try { Windows windowId = Windows.valueOf(event.getWindowId()); switch (windowId) { case DK: setDK(); break; case FIWARE: break; case MARIO: setMario(); break; case SF: setSF(); break; case SONIC: setSonic(); break; case START: addRecorder(contentSession, recordOnRepository); setStart(); break; case TRASH: case YOUTUBE: setEnding(windowId, recordOnRepository); break; default: break; } } catch (URISyntaxException e) { e.printStackTrace(); } } }); WebRtcEndpoint webRtcEndpoint = mediaPipeline.newWebRtcEndpoint().build(); webRtcEndpoint.connect(rateLimiter); faceOverlayFilter.connect(webRtcEndpoint); contentSession.start(webRtcEndpoint); }
From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientSP.java
/** * Predicts the services eco-efficiency upon its deployment if it doesnt * exist in the system, or it just predicts its future eco-efficiency * otherwise.// w ww .j a v a 2s .c o m * * @param providerId IP provider identificator, where the service is (to be) * deployed. * @param manifest Service manifest XML descriptor. * @param timeSpan Specifies the amount of time in the future in which the * prediction will be made. * @param type Type of eco-efficiency forecast: energy (energy?) or * ecological (ecological?) efficiency. * @return Eco-efficiency forecast of the service (to be deployed if it * doesnt exist). */ public String forecastServiceEcoEfficiency(String providerId, String manifest, Long timeSpan, String type) { String ret = null; try { WebResource resource = client.resource(this.getAddress()).path("service/forecastecoefficiency") .queryParam("providerId", providerId); if (type != null) { resource = resource.queryParam("type", type); } if (timeSpan != null) { resource = resource.queryParam("timeSpan", timeSpan.toString()); } //if (manifest != null) resource = resource.queryParam("manifest", manifest); ret = resource.type(MediaType.APPLICATION_XML).accept(MediaType.TEXT_PLAIN).post(String.class, manifest); } catch (UniformInterfaceException ex) { ClientResponse cr = ex.getResponse(); log.error(cr.getStatus()); ex.printStackTrace(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ret; }
From source file:eu.optimis.ecoefficiencytool.rest.client.EcoEfficiencyToolRESTClientSP.java
/** * Predicts the services energy and ecological efficiency upon its * deployment if it doesnt exist in the system, or it just predicts its * future energy and ecological efficiency otherwise. * * @param providerId IP provider identificator, where the service is (to be) * deployed./*from ww w. j a v a2 s . co m*/ * @param manifest Service manifest XML descriptor. * @param timeSpan Specifies the amount of time in the future in which the * prediction will be made. * @return Energy efficiency forecast of the service (to be deployed if it * doesnt exist). Ecological efficiency forecast of the service (to be * deployed if it doesnt exist). */ public double[] forecastServiceEnEcoEff(String providerId, String manifest, Long timeSpan) { ListStrings result = null; double[] ret = { -1.0, -1.0 }; try { WebResource resource = client.resource(this.getAddress()).path("/service/forecastenecoeff"); if (providerId != null) { resource = resource.queryParam("providerId", providerId); } if (timeSpan != null) { resource = resource.queryParam("timeSpan", timeSpan.toString()); } result = resource.type(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML) .post(ListStrings.class, manifest); ret[0] = Double.parseDouble(result.get(0)); ret[1] = Double.parseDouble(result.get(1)); } catch (UniformInterfaceException ex) { ClientResponse cr = ex.getResponse(); log.error(cr.getStatus()); ex.printStackTrace(); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ret; }