List of usage examples for com.fasterxml.jackson.core JsonProcessingException printStackTrace
public void printStackTrace()
From source file:mmo.client.Main.java
public static void main(String[] args) { final ServerConnection connection = new ServerConnection("localhost", 8080); connection.addMessageListener(new MessageListener() { private boolean didGreeting = false; @Override/*from w w w. j ava 2 s. com*/ public void messageReceived(Message message) { System.out.println("message: " + message); if (!didGreeting) { try { connection.sendMessage(new Chat("hello there!")); } catch (JsonProcessingException e) { e.printStackTrace(); // TODO } didGreeting = true; } } }); connection.open(); connection.getData("/status", ServerInfo.class).addListener(new FutureListener<ServerInfo>() { @Override public void operationComplete(Future<ServerInfo> future) { System.out.println(future.getNow()); } }); }
From source file:com.juhnowski.sanskrvar.Main.java
public static void main(String[] args) { String word = "Siva"; Main m = new Main(); Entry e = m.checkWord(word);/*from w ww . j av a 2s. c o m*/ if (e != null) { m.entrySet.add(e); try { System.out.println(m.mainMapper.writeValueAsString(m.entrySet)); } catch (JsonProcessingException ex) { ex.printStackTrace(); } } }
From source file:com.hendi.printarray.PrintUtils.java
public static void print(Object object) { String result;/*from w w w .j a va 2 s . co m*/ try { result = om.writerWithDefaultPrettyPrinter().writeValueAsString(object); System.out.println(result); } catch (JsonProcessingException e) { e.printStackTrace(); } }
From source file:pl.vane.factory.JSONFactory.java
public static String toJSON(Object value) { String out = null;/* w w w . ja va 2s . c o m*/ try { out = mapper.writeValueAsString(value); } catch (JsonProcessingException e) { e.printStackTrace(); log.error(e); } return out; }
From source file:DataLoader.java
private static String toJSON(Object entity) { String json = null;/*from w w w. j ava 2s . c om*/ ObjectifyJacksonModule ojm = new ObjectifyJacksonModule(); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(ojm); try { json = mapper.writeValueAsString(entity); } catch (JsonProcessingException jpe) { jpe.printStackTrace(); } return json; }
From source file:org.wikidata.wdtk.datamodel.json.jackson.JsonComparator.java
/** * Compares two JSON objects represented by Strings to each other. Both * Strings are supposed to be valid JSON. From the given Strings the JSON * tree is build and both trees are compared. * * @param string1/*ww w . j a v a 2 s .c om*/ * @param string2 */ public static void compareJsonStrings(String string1, String string2) { try { JsonNode tree1 = mapper.readTree(string1); JsonNode tree2 = mapper.readTree(string2); Assert.assertEquals(tree1, tree2); } catch (JsonProcessingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.difference.historybook.importer.HistoryRecordJSONSerialization.java
/** * Convert a HistoryRecord to a JSON representation * /*from www .ja v a 2s . c om*/ * @param record the record to convert * @return JSON representation of record */ public static String toJSONString(HistoryRecord record) { try { return MAPPER.writeValueAsString(record); } catch (JsonProcessingException e) { e.printStackTrace(); return null; } }
From source file:com.microsoft.azure.hdinsight.sdk.rest.ObjectConvertUtils.java
public static <T> Optional<String> convertObjectToJsonString(@NotNull T obj) { try {/*from w ww. ja va 2s . c om*/ return Optional.ofNullable(objectMapper.writeValueAsString(obj)); } catch (JsonProcessingException e) { e.printStackTrace(); } return Optional.empty(); }
From source file:com.microsoft.azure.hdinsight.sdk.rest.ObjectConvertUtils.java
public static <T> Optional<String> convertObjectToXmlString(@NotNull T obj) { try {//from w ww . j a va2 s. c om return Optional.ofNullable(xmlMapper.writeValueAsString(obj)); } catch (JsonProcessingException e) { e.printStackTrace(); } return Optional.empty(); }
From source file:me.qisthi.cuit.helper.StorageHelper.java
public static void writePreferenceStatusValue(Activity activity, String key, List<String[]> statuses) { String rawStatuses = ""; ObjectMapper mapper = new ObjectMapper(); // for(Status status : statuses) // {// w w w.ja v a 2s .c om // String rawStatus = null; // try { // rawStatus = mapper.writeValueAsString(status); // } catch (JsonProcessingException e) { // e.printStackTrace(); // } // rawStatuses.add(rawStatus); // } try { rawStatuses = mapper.writeValueAsString(statuses); } catch (JsonProcessingException e) { e.printStackTrace(); } SharedPreferences sharedPreferences = activity.getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(key, rawStatuses); editor.apply(); }