Merge pull request #3355 from oddityyyy/master

Update JdkSerializeTool.java
2.4.2
许雪里 10 months ago committed by GitHub
commit a877d9ad63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -51,16 +51,18 @@ public class JdkSerializeTool {
* @return * @return
*/ */
public static <T> Object deserialize(byte[] bytes, Class<T> clazz) { public static <T> Object deserialize(byte[] bytes, Class<T> clazz) {
ObjectInputStream ois = null;
ByteArrayInputStream bais = null; ByteArrayInputStream bais = null;
try { try {
// 反序列化 // 反序列化
bais = new ByteArrayInputStream(bytes); bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais); ois = new ObjectInputStream(bais);
return ois.readObject(); return ois.readObject();
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} finally { } finally {
try { try {
ois.close();
bais.close(); bais.close();
} catch (IOException e) { } catch (IOException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);

Loading…
Cancel
Save