List of usage examples for org.apache.commons.lang3 SerializationException getMessage
public String getMessage()
From source file:example.RepoChain.java
@Override public String query(ChaincodeStub stub, String function, String[] args) { String returnString;//from w w w.ja va 2 s . c o m switch (function) { case "query": if (args.length < 5) { returnString = "Incorrect query parameters"; } else { String reqkey = (args[4].equalsIgnoreCase("M") ? "" : "~") + getKeyFromArgs(args); log.info("Querying ledger with key - " + reqkey); RepoContract repoObj = RepoContract.toRepoObj(stub.getRawState(reqkey).toByteArray()); log.info("Returned repoObj - " + repoObj); returnString = repoObj.toString(); } break; case "keys": returnString = stub.rangeQueryState(args[0], args[1]).keySet().toString(); break; case "trades": log.info("Inside all trades query"); Map<String, ByteString> allTrades = null; StringBuffer sb = new StringBuffer(""); try { allTrades = stub.rangeQueryRawState("", ""); for (Map.Entry<String, ByteString> repoIter : allTrades.entrySet()) { RepoContract iterTrade = null; try { iterTrade = RepoContract.toRepoObj(repoIter.getValue().toByteArray()); } catch (SerializationException e) { log.info("Failed to deserialize for key " + repoIter.getKey()); continue; } sb.append("==> " + iterTrade.toString() + "\n"); } } catch (Exception e) { e.printStackTrace(); log.info(e.getMessage()); } log.info(sb.toString()); returnString = sb.toString(); break; default: returnString = "Invalid function input"; } return returnString; }
From source file:eu.stratosphere.api.common.typeutils.SerializerTestBase.java
@Test public void testSerializabilityAndEquals() { try {//from w w w . ja v a 2 s .c om TypeSerializer<T> ser1 = getSerializer(); TypeSerializer<T> ser2; try { ser2 = SerializationUtils.clone(ser1); } catch (SerializationException e) { fail("The serializer is not serializable."); return; } assertEquals("The copy of the serializer is not equal to the original one.", ser1, ser2); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); fail("Exception in test: " + e.getMessage()); } }
From source file:org.apache.flink.api.common.typeutils.SerializerTestBase.java
@Test public void testSerializabilityAndEquals() { try {/* w ww . j av a 2 s. co m*/ TypeSerializer<T> ser1 = getSerializer(); TypeSerializer<T> ser2; try { ser2 = SerializationUtils.clone(ser1); } catch (SerializationException e) { fail("The serializer is not serializable: " + e); return; } assertEquals("The copy of the serializer is not equal to the original one.", ser1, ser2); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); fail("Exception in test: " + e.getMessage()); } }