You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/10/22 13:41:18 UTC

[GitHub] [spark] srowen commented on a change in pull request #33879: [SPARK-36627][CORE] Fix java deserialization of proxy classes

srowen commented on a change in pull request #33879:
URL: https://github.com/apache/spark/pull/33879#discussion_r734551484



##########
File path: core/src/test/java/org/apache/spark/serializer/ProxySerializerTest.java
##########
@@ -0,0 +1,33 @@
+package org.apache.spark.serializer;

Review comment:
       Copyright header

##########
File path: core/src/test/java/org/apache/spark/serializer/ProxySerializerTest.java
##########
@@ -0,0 +1,33 @@
+package org.apache.spark.serializer;
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+class ContainsProxyClass implements Serializable {
+    final MyInterface proxy = (MyInterface) Proxy.newProxyInstance(

Review comment:
       Likewise 2-space

##########
File path: core/src/main/scala/org/apache/spark/serializer/JavaSerializer.scala
##########
@@ -71,6 +71,13 @@ private[spark] class JavaDeserializationStream(in: InputStream, loader: ClassLoa
         case e: ClassNotFoundException =>
           JavaDeserializationStream.primitiveMappings.getOrElse(desc.getName, throw e)
       }
+
+    override def resolveProxyClass(ifaces: Array[String]): Class[_] = {
+        // scalastyle:off classforname
+        val resolved = ifaces.map(iface => Class.forName(iface, false, loader))

Review comment:
       2-space indent, and maybe you can use the Utils method in Spark for loading the class?




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org