MCPcopy Create free account
hub / github.com/apache/storm / javaDeserialize

Method javaDeserialize

storm-client/src/jvm/org/apache/storm/utils/Utils.java:539–561  ·  view source on GitHub ↗
(byte[] serialized, Class<T> clazz)

Source from the content-addressed store, hash-verified

537 }
538
539 public static <T> T javaDeserialize(byte[] serialized, Class<T> clazz) {
540 if ("true".equalsIgnoreCase(System.getProperty("java.deserialization.disabled"))) {
541 throw new AssertionError("java deserialization has been disabled and is only safe from within a worker process");
542 }
543
544 try {
545 ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
546 ObjectInputStream ois = null;
547 if (null == Utils.cl) {
548 ois = new ObjectInputStream(bis);
549 } else {
550 // Use custom class loader set in testing environment
551 ois = new ClassLoaderObjectInputStream(Utils.cl, bis);
552 }
553 Object ret = ois.readObject();
554 ois.close();
555 return (T) ret;
556 } catch (IOException ioe) {
557 throw new RuntimeException(ioe);
558 } catch (ClassNotFoundException e) {
559 throw new RuntimeException(e);
560 }
561 }
562
563 public static <S, T> T get(Map<S, T> m, S key, T def) {
564 T ret = m.get(key);

Callers 7

getSetComponentObjectMethod · 0.95
isIdentityPartitionMethod · 0.95
mkGrouperMethod · 0.95
newTransactionalBoltMethod · 0.95
getLeaderMethod · 0.95

Calls 2

closeMethod · 0.65
readObjectMethod · 0.45

Tested by

no test coverage detected