He-Pin commented on code in PR #1912: URL: https://github.com/apache/pekko/pull/1912#discussion_r2157930408
########## cluster-metrics/src/main/scala/org/apache/pekko/cluster/metrics/protobuf/NumberInputStream.scala: ########## @@ -32,20 +33,21 @@ import pekko.annotation.InternalApi @InternalApi private[protobuf] class NumberInputStream( classLoader: ClassLoader, - inputStream: InputStream) extends ObjectInputStream(inputStream) { + inputStream: InputStream) extends ClassLoaderObjectInputStream(classLoader, inputStream) { /** * Resolve a class specified by the descriptor using the provided classloader - * and that treats any class that is not a primitive or a subclass of - * <code>java.lang.Number</code> as not found. + * and that treats any class that is not a primitive, an array of primitives + * or a subclass of <code>java.lang.Number</code> as not found. * * @param objectStreamClass descriptor of the class * @return the Class object described by the ObjectStreamClass * @throws ClassNotFoundException if the Class cannot be found (or is rejected) */ override protected def resolveClass(objectStreamClass: ObjectStreamClass): Class[_] = { - val clazz = Class.forName(objectStreamClass.getName(), false, classLoader) - if (clazz.isPrimitive() || classOf[Number].isAssignableFrom(clazz)) { + val clazz = super.resolveClass(objectStreamClass) + if (clazz.isPrimitive() || (clazz.isArray() && clazz.getComponentType.isPrimitive) || + classOf[Number].isAssignableFrom(clazz)) { Review Comment: 1. we should fix the error messages too, at line 54 2. add a test for BigDecimal and BigInteger cases? -- 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...@pekko.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org