Mercurial > hg > Database > Alice
changeset 460:4e7514007ae1 dispose
bug fix asClass method.
author | sugi |
---|---|
date | Mon, 03 Nov 2014 20:26:41 +0900 |
parents | 4419a2415661 |
children | 99e309768ac9 |
files | src/main/java/alice/datasegment/ReceiveData.java |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/datasegment/ReceiveData.java Mon Nov 03 20:26:05 2014 +0900 +++ b/src/main/java/alice/datasegment/ReceiveData.java Mon Nov 03 20:26:41 2014 +0900 @@ -86,19 +86,26 @@ @SuppressWarnings("unchecked") public <T> T asClass(Class<T> clazz) { try { - if (!serialized) + if (!byteArray) { return (T) val; + } + byte[] b = null; if (compressed) { - b = unzip((byte[]) val); + b = unzip((byte[]) val); } else { b = (byte[]) val; } - return SingletonMessage.getInstance().read(b, clazz); + + if (serialized) { + return SingletonMessage.getInstance().read(b, clazz); + } else { + return (T) b; + } } catch (IOException e) { e.printStackTrace(); + return null; } - return null; } public byte[] unzip(byte[] zipped) throws IOException{