zrlw commented on code in PR #92: URL: https://github.com/apache/dubbo-hessian-lite/pull/92#discussion_r2355446668
########## hessian-lite/src/main/java/com/alibaba/com/caucho/hessian/io/chronology/AbstractChronologySerializer.java: ########## @@ -16,21 +16,14 @@ */ package com.alibaba.com.caucho.hessian.io.chronology; -import com.alibaba.com.caucho.hessian.io.AbstractHessianOutput; import com.alibaba.com.caucho.hessian.io.AbstractSerializer; -import java.io.IOException; import java.time.chrono.AbstractChronology; public class AbstractChronologySerializer<T> extends AbstractSerializer { @Override - public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { - if (obj == null) { - out.writeNull(); - return; - } - - out.writeObject(new AbstractChronologyHandle((AbstractChronology) obj)); + public Object writeReplace(Object obj) { + return new AbstractChronologyHandle((AbstractChronology) obj); Review Comment: ``` if (obj == null) { out.writeNull(); return; } ``` Null checking should be done in each ```writeReplace``` to avoid NPE during handle construction. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org