List of usage examples for java.lang Exception toString
public String toString()
From source file:musicmetadatak1009705.Main.java
public static boolean alphaFX(String[] args) { try {/* w w w. j a va2 s . c o m*/ MainView.launch(); } catch (Exception e) { System.err.println("GUI Failed Switching to command line\n" + e.toString()); return false; } return true; }
From source file:Main.java
public static String toString(NodeList nodes) { try {//from w ww . j a va2 s.c om StringWriter stw = new StringWriter(); Transformer serializer = TransformerFactory.newInstance().newTransformer(); for (int i = 0; i < nodes.getLength(); i++) { Node item = nodes.item(i); switch (item.getNodeType()) { case Node.TEXT_NODE: stw.append(item.getTextContent()); break; default: serializer.transform(new DOMSource(item), new StreamResult(stw)); } } return stw.toString(); } catch (Exception e) { return e.toString(); } }
From source file:com.example.JobUtil.java
public static Resource getResource(final String resourcePath) { if (resourcePath == null) { return null; }//from www . j av a2s. c o m Resource resource = null; String profile = System.getProperty("spring.profiles.active"); if (!StringUtils.hasText(profile) || ("loc").equals(profile)) { resource = new ClassPathResource(resourcePath); return resource; } try { resource = new UrlResource(resourcePath); } catch (Exception e) { log.error("resource error : {}", e.toString()); return null; } return resource; }
From source file:com.streamsets.pipeline.stage.origin.spooldir.TestOffsetUtil.java
static void compare(String offsetV1, Map<String, String> offsetV2, boolean removeAbsolutePaths) { try {/*from ww w . java 2 s. c o m*/ Offset offset = new Offset(VERSION_ONE, offsetV1); offsetV2.remove(OFFSET_VERSION); if (removeAbsolutePaths) { offsetV2 = removeAbsolutePaths(offsetV2); } Assert.assertTrue(String.format("offset does not contain file: %s", offset.getFile()), offsetV2.containsKey(offset.getFile())); Assert.assertEquals(offset.getOffset(), OffsetUtil.deserializeOffsetMap(offsetV2.get(offset.getFile())).get(POS)); Assert.assertEquals(offset.getOffsetString(), offsetV2.get(offset.getFile())); } catch (Exception ex) { Assert.fail(ex.toString()); } }
From source file:Main.java
/** * Produce una vibracion corta/*from w w w . ja v a 2 s . c om*/ * * @author Toni * @ * @param el contexto donde se va a utilizar * @return nada * @see utilidades */ public static void vibrar(Context c) { try { Vibrator v = (Vibrator) c.getSystemService(c.VIBRATOR_SERVICE); v.vibrate(30); } catch (Exception e) { escribeLog("VIBRAR", "Error al intentar vibrar " + e.toString()); } }
From source file:neembuu.uploader.versioning.CheckUser.java
private static boolean getCanCustomizeNormalizingFromXml(String str) { boolean canCustomizeNormalizing = true; try {/* www.j a va 2 s .com*/ String start = "<canCustomizeNormalizing>"; String end = "</canCustomizeNormalizing>"; str = str.substring(str.indexOf(start) + start.length()); str = str.substring(0, str.indexOf(end)); canCustomizeNormalizing = findBooleanValue(str); } catch (Exception any) { NULogger.getLogger().severe(any.toString()); } return canCustomizeNormalizing; }
From source file:neembuu.uploader.versioning.CheckUser.java
private static String getNormalization(String str) { String normalization = ".neembuu"; try {//from w w w . j a v a2s . c om String start = "<normalization>"; String end = "</normalization>"; str = str.substring(str.indexOf(start) + start.length()); str = str.substring(0, str.indexOf(end)); normalization = str; } catch (Exception any) { NULogger.getLogger().severe(any.toString()); } return normalization; }
From source file:Main.java
public static String toString(Element e) { try {// www. j ava 2 s .c o m TransformerFactory tfactory = TransformerFactory.newInstance(); Transformer xform = tfactory.newTransformer(); Source src = new DOMSource(e); java.io.StringWriter writer = new StringWriter(); Result result = new javax.xml.transform.stream.StreamResult(writer); xform.transform(src, result); return writer.toString(); } catch (Exception ex) { return "Unable to convert to string: " + ex.toString(); } }
From source file:com.boundary.plugin.sdk.PluginUtil.java
/** * Returns the localhost name the JVM is running on * // ww w . j a v a2s .c o m * @return {@link String} local host name */ public static String getHostname() { String hostname = null; try { InetAddress addr; addr = InetAddress.getLocalHost(); hostname = addr.getHostName(); } catch (Exception e) { LOG.info(e.toString()); } return hostname; }
From source file:com.cisco.oss.foundation.http.netlifx.netty.NettyNetflixHttpClientFactory.java
public static HttpClient<HttpRequest, NettyNetflixHttpResponse> createHttpClient(String apiName, Configuration configuration, boolean enableLoadBalancing, HostnameVerifier hostnameVerifier) { try {/*from ww w.ja v a2s. c o m*/ HttpClient client = null; client = new NettyNetflixHttpClient(apiName, configuration, enableLoadBalancing, hostnameVerifier); return client; } catch (Exception e) { throw new ClientException(e.toString(), e); } }