List of usage examples for org.apache.commons.codec DecoderException toString
public String toString()
From source file:com.bringcommunications.etherpay.Payment_Processor.java
private String create_transaction(String acct_addr, String key, String to_addr, long size_wei, long nonce, long gas_limit, long gas_price, byte data[]) { String to_addr_no_0x = to_addr.startsWith("0x") ? to_addr.substring(2) : to_addr; //create signed transaction byte[] bytes_key = null; byte[] bytes_to_addr = null; try {/*from w ww . ja va2 s .co m*/ bytes_key = hex.decode(key.getBytes()); bytes_to_addr = hex.decode(to_addr_no_0x.getBytes()); } catch (DecoderException e) { System.out.println("payment_processor: create_transaction decoder exception: " + e.toString()); return (""); } byte[] bytes_gas_price = longToBytesNoLeadZeroes(gas_price); byte[] bytes_gas_limit = longToBytesNoLeadZeroes(gas_limit); byte[] bytes_value = longToBytesNoLeadZeroes(size_wei); byte[] bytes_nonce = longToBytesNoLeadZeroes(nonce); Transaction tx = new Transaction(bytes_nonce, bytes_gas_price, bytes_gas_limit, bytes_to_addr, bytes_value, data); // tx.sign(bytes_key); byte[] rlp_encoded_tx = tx.getEncoded(); String hex_tx = new String(hex.encodeHex(rlp_encoded_tx)); return hex_tx; }
From source file:org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.java
public static DelegationKey delegationKeyFromXml(Stanza st) throws InvalidXmlException { int keyId = Integer.parseInt(st.getValue("KEY_ID")); long expiryDate = Long.parseLong(st.getValue("EXPIRY_DATE")); byte key[] = null; try {/*from w ww . ja v a2 s . c om*/ key = Hex.decodeHex(st.getValue("KEY").toCharArray()); } catch (DecoderException e) { throw new InvalidXmlException(e.toString()); } catch (InvalidXmlException e) { } return new DelegationKey(keyId, expiryDate, key); }
From source file:org.jivesoftware.community.util.StringUtils.java
public static byte[] decodeHex(String hex) { if (hex == null) return null; try {/*from w w w. j a v a2s . c o m*/ return Hex.decodeHex(hex.toCharArray()); } catch (DecoderException e) { Log.error(e.toString()); } return null; }
From source file:phex.utils.URLCodecUtils.java
/** * Decodes a URL safe string into its original form. Escaped * characters are converted back to their original representation. * * @param pString URL safe string to convert into its original form * @return original string /*w w w. ja v a2 s . c om*/ * @throws RuntimeException Thrown if URL decoding is unsuccessful. * This only happens in the case of a UnsupportedEncodingException * which should never occur in reality. */ public static String decodeURL(String url) { try { return urlCodec.decode(url); } catch (DecoderException exp) { // NLogger.error( URLCodecUtils.class, exp, exp ); throw new RuntimeException(exp.toString() + ": " + exp.getMessage()); } }