List of usage examples for java.io UnsupportedEncodingException printStackTrace
public void printStackTrace()
From source file:com.haythem.integration.ByteArrayToStringConverter.java
public String convert(byte[] bytes) { try {//from w w w . ja v a 2 s . co m return new String(bytes, this.charSet); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return new String(bytes); } }
From source file:net.asplode.tumblr.PhotoPost.java
public PhotoPost() { try {/*from w w w. ja v a 2 s. co m*/ entity.addPart("type", new StringBody("photo")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
From source file:cn.edu.xmu.comm.action.json.TempParkingRegisterAction.java
@Override public String execute() { try {/*from www .j a v a 2s .c o m*/ license = URLDecoder.decode(license, "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } data = new HashMap<String, Object>(); if (parkingService.isRentCar(license)) data.put("TYPE", "RENT"); else data.put("TYPE", "TEMP"); return SUCCESS; }
From source file:com.codenjoy.dojo.web.controller.GameDataController.java
@RequestMapping(value = "/settings/{gameType}/{key}", method = RequestMethod.POST) public @ResponseBody String set(@PathVariable("gameType") String gameType, @PathVariable("key") String key, @RequestBody String value) { try {// w w w .jav a2 s .c o m gameData.set(gameType, key, URLDecoder.decode(value, "UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return "{}"; }
From source file:com.jennifer.ui.util.dom.Svg.java
public String toDataURL() { try {/* w ww . ja v a 2 s .c o m*/ return "data:image/svg+xml;base64," + new String(Base64.encodeBase64(toXml().getBytes("UTF-8")), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return ""; }
From source file:com.dc.gameserver.extComponents.SpringRabbitmq.FastJsonMessageConverter.java
@SuppressWarnings("unchecked") public <T> T fromMessage(Message message, T t) { String json = ""; try {//w ww . ja va2s . co m json = new String(message.getBody(), defaultCharset); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return (T) JSON.parseObject(json, t.getClass()); }
From source file:org.privatenotes.sync.web.AnonymousConnection.java
@Override public String put(String uri, String data) throws UnknownHostException { // Prepare a request object HttpPut httpPut = new HttpPut(uri); try {/*from w w w . ja v a2 s . c o m*/ // The default http content charset is ISO-8859-1, JSON requires UTF-8 httpPut.setEntity(new StringEntity(data, "UTF-8")); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); return null; } httpPut.setHeader("Content-Type", "application/json"); HttpResponse response = execute(httpPut); return parseResponse(response); }
From source file:com.anjibei.app.framework.listeners.ApplicationListener.java
@Override public void contextInitialized(ServletContextEvent sce) { System.out.println("Hello. Application Started."); System.out.println("Working Dir: " + Application.getWorkingDir().getAbsolutePath()); String s = new String("tangfuqiang"); System.out.println("" + s); String md5 = MD5Utils.md5(s); System.out.println(md5);//from w w w. j ava 2s . c om SecretKey key = AESUtils.generateSecretKey(); byte[] keyBytes = AESUtils.getKeyBytes(key); key = AESUtils.getSecretKey(keyBytes); String encrypted = null; try { encrypted = Base64.encodeBase64String(AESUtils.encrypt(md5, key)); byte[] decrypted = AESUtils.decrypt(Base64.decodeBase64(encrypted.getBytes("utf-8")), key); System.out.println(encrypted); System.out.println(new String(decrypted)); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
From source file:com.evolveum.midpoint.web.util.Base64Model.java
@Override public void setObject(String object) { if (object == null) { model.setObject(null);//from w ww . j a v a2 s .c o m } try { byte[] val = Base64.encodeBase64(object.getBytes("utf-8")); model.setObject(val); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
From source file:lv.semti.morphology.webservice.NormalizePhraseResource.java
@Get public String retrieve() { String query = (String) getRequest().getAttributes().get("phrase"); try {//from w ww . ja v a 2 s .c om query = URLDecoder.decode(query, "UTF8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String category = getQuery().getValues("category"); MorphoServer.analyzer.enableGuessing = true; MorphoServer.analyzer.enableVocative = true; MorphoServer.analyzer.guessVerbs = false; MorphoServer.analyzer.guessParticiples = false; MorphoServer.analyzer.guessAdjectives = false; MorphoServer.analyzer.guessInflexibleNouns = true; MorphoServer.analyzer.enableAllGuesses = true; Expression e = new Expression(query, category, false); //e.describe(new PrintWriter(System.err)); // ko tad tageris im ir sadom?jis String pamatforma = e.normalize(); MorphoServer.analyzer.defaultSettings(); return pamatforma; }