List of usage examples for javax.websocket EncodeException EncodeException
public EncodeException(Object object, String message)
From source file:ws.util.AbstractJSONCoder.java
@Override public String encode(T pojo) throws EncodeException { StringBuilder log = new StringBuilder().append(type).append("| [coder] encoding..").append(pojo); String json = null;/*from w ww . j a va 2s .c o m*/ try { ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); // Jackson jr ??@JsonManagedReference, @JsonBackReference???? // json = JSON.std.asString(pojo); json = ow.writeValueAsString(pojo); log.append(" DONE."); } catch (IOException e) { log.append(" **NG**."); logger.log(Level.SEVERE, e.toString()); e.printStackTrace(); throw new EncodeException(json, e.getMessage()); } catch (Exception e) { log.append(" **NG**."); logger.log(Level.SEVERE, e.toString()); e.printStackTrace(); throw new EncodeException(json, e.getMessage()); } finally { logger.log(Level.INFO, log.toString()); } // logger.log(Level.INFO, new StringBuilder() // .append("[coder] done: ") // .append(json) // .toString()); return json; }