|
|
@@ -13,18 +13,17 @@ public class CloneUtils {
|
|
|
|
|
|
|
|
|
public static <T> T clone(T obj) {
|
|
|
-// try {
|
|
|
-// ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
-// ObjectOutputStream oos = new ObjectOutputStream(bos);
|
|
|
-// oos.writeObject(obj);
|
|
|
-// ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
|
|
|
-// ObjectInputStream ois = new ObjectInputStream(bis);
|
|
|
-// return (T) ois.readObject();
|
|
|
-// }catch (Exception e) {
|
|
|
-// log.error("clone error", e);
|
|
|
-// return null;
|
|
|
-// }
|
|
|
- return ObjectUtil.clone(obj);
|
|
|
+ try {
|
|
|
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
+ ObjectOutputStream oos = new ObjectOutputStream(bos);
|
|
|
+ oos.writeObject(obj);
|
|
|
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
|
|
|
+ ObjectInputStream ois = new ObjectInputStream(bis);
|
|
|
+ return (T) ois.readObject();
|
|
|
+ }catch (Exception e) {
|
|
|
+ log.error("clone error", e);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|