[jira] [Commented] (GEODE-4008) InvalidClassException when deserializing FunctionAdapter from pre Geode clients
[ https://issues.apache.org/jira/browse/GEODE-4008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16310022#comment-16310022 ] ASF subversion and git services commented on GEODE-4008: Commit 2e3c6b9e089aa22abab1e0f020d94a4723c0e9e4 in geode's branch refs/heads/develop from [~huynhja] [ https://gitbox.apache.org/repos/asf?p=geode.git;h=2e3c6b9 ] GEODE-4008: Added serialVersionUID to FunctionAdapter (#1119) This reverts commit 36eeafefc3597cfcb1b2d2673734effd806e686d. > InvalidClassException when deserializing FunctionAdapter from pre Geode > clients > --- > > Key: GEODE-4008 > URL: https://issues.apache.org/jira/browse/GEODE-4008 > Project: Geode > Issue Type: Bug > Components: functions >Reporter: Jason Huynh >Assignee: Jason Huynh > > There was a change to deprecate FunctionAdapter in Geode, and this removed > the method signatures of the class. This causes Java to assign a new > serialVersionUID to the class. However we have clients pre Geode that when > they attempt to execute a function by serializing the function across (not > using a function id), the FunctionAdapter class is unable to deserialize > properly. > The proposed fix is to assign a serialVersionUID to the class that matches > that of the pre Geode FunctionAdapter. This will cause any Geode 1.0-1.3 > clients to run into this same error. However FunctionAdapter has been > deprecated and it would be easy enough to just change the classes to > implement Function. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GEODE-4008) InvalidClassException when deserializing FunctionAdapter from pre Geode clients
[ https://issues.apache.org/jira/browse/GEODE-4008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286550#comment-16286550 ] ASF subversion and git services commented on GEODE-4008: Commit 36eeafefc3597cfcb1b2d2673734effd806e686d in geode's branch refs/heads/develop from [~huynhja] [ https://gitbox.apache.org/repos/asf?p=geode.git;h=36eeafe ] Revert "GEODE-4008: Added serialVersionUID to FunctionAdapter (#1119)" This reverts commit 6578ecce6705b33a47264db72cab72aa6a991d51. > InvalidClassException when deserializing FunctionAdapter from pre Geode > clients > --- > > Key: GEODE-4008 > URL: https://issues.apache.org/jira/browse/GEODE-4008 > Project: Geode > Issue Type: Bug > Components: functions >Reporter: Jason Huynh >Assignee: Jason Huynh > Fix For: 1.4.0 > > > There was a change to deprecate FunctionAdapter in Geode, and this removed > the method signatures of the class. This causes Java to assign a new > serialVersionUID to the class. However we have clients pre Geode that when > they attempt to execute a function by serializing the function across (not > using a function id), the FunctionAdapter class is unable to deserialize > properly. > The proposed fix is to assign a serialVersionUID to the class that matches > that of the pre Geode FunctionAdapter. This will cause any Geode 1.0-1.3 > clients to run into this same error. However FunctionAdapter has been > deprecated and it would be easy enough to just change the classes to > implement Function. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GEODE-4008) InvalidClassException when deserializing FunctionAdapter from pre Geode clients
[ https://issues.apache.org/jira/browse/GEODE-4008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286361#comment-16286361 ] ASF subversion and git services commented on GEODE-4008: Commit 6578ecce6705b33a47264db72cab72aa6a991d51 in geode's branch refs/heads/develop from [~huynhja] [ https://gitbox.apache.org/repos/asf?p=geode.git;h=6578ecc ] GEODE-4008: Added serialVersionUID to FunctionAdapter (#1119) > InvalidClassException when deserializing FunctionAdapter from pre Geode > clients > --- > > Key: GEODE-4008 > URL: https://issues.apache.org/jira/browse/GEODE-4008 > Project: Geode > Issue Type: Bug > Components: functions >Reporter: Jason Huynh >Assignee: Jason Huynh > > There was a change to deprecate FunctionAdapter in Geode, and this removed > the method signatures of the class. This causes Java to assign a new > serialVersionUID to the class. However we have clients pre Geode that when > they attempt to execute a function by serializing the function across (not > using a function id), the FunctionAdapter class is unable to deserialize > properly. > The proposed fix is to assign a serialVersionUID to the class that matches > that of the pre Geode FunctionAdapter. This will cause any Geode 1.0-1.3 > clients to run into this same error. However FunctionAdapter has been > deprecated and it would be easy enough to just change the classes to > implement Function. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GEODE-4008) InvalidClassException when deserializing FunctionAdapter from pre Geode clients
[ https://issues.apache.org/jira/browse/GEODE-4008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286360#comment-16286360 ] ASF GitHub Bot commented on GEODE-4008: --- jhuynh1 closed pull request #1119: GEODE-4008: Add serialVersionUID of older clients to FunctionAdapter URL: https://github.com/apache/geode/pull/1119 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionAdapter.java b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionAdapter.java index e10664e1f2..ff494480f1 100755 --- a/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionAdapter.java +++ b/geode-core/src/main/java/org/apache/geode/cache/execute/FunctionAdapter.java @@ -35,4 +35,7 @@ * */ public abstract class FunctionAdapter implements Function { + + private static final long serialVersionUID = -4891043890440825485L; + } diff --git a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt index e7cd276582..e914089b2b 100644 --- a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt +++ b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-core-serializables.txt @@ -121,7 +121,7 @@ org/apache/geode/cache/client/internal/ContainsKeyOp$MODE,false org/apache/geode/cache/client/internal/TXSynchronizationOp$CompletionType,false org/apache/geode/cache/client/internal/pooling/ConnectionDestroyedException,true,-6918516787578041316 org/apache/geode/cache/execute/EmptyRegionFunctionException,true,1 -org/apache/geode/cache/execute/FunctionAdapter,false +org/apache/geode/cache/execute/FunctionAdapter,true,-4891043890440825485 org/apache/geode/cache/execute/FunctionException,true,4893171227542647452 org/apache/geode/cache/execute/FunctionInvocationTargetException,true,1,id:org/apache/geode/distributed/DistributedMember org/apache/geode/cache/operations/OperationContext$OperationCode,false diff --git a/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionAdapterJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionAdapterJUnitTest.java index 127e4b226c..7271d6820e 100644 --- a/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionAdapterJUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/cache/execute/FunctionAdapterJUnitTest.java @@ -16,15 +16,29 @@ import static org.junit.Assert.*; +import java.io.BufferedOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.Serializable; + import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.geode.internal.InternalDataSerializer; +import org.apache.geode.internal.Version; +import org.apache.geode.internal.VersionedDataInputStream; +import org.apache.geode.internal.VersionedDataOutputStream; import org.apache.geode.test.junit.categories.UnitTest; +import org.apache.geode.util.test.TestUtil; @Category(UnitTest.class) public class FunctionAdapterJUnitTest { + private static final long serialVersionUID = 1L; private FunctionAdapter adapter; @Before @@ -59,4 +73,39 @@ public void isHADefaultsTrue() { public void execute(final FunctionContext context) {} } + + @Test + public void deserializePreGeodeFunctionAdapterShouldNotThrowIncompatibleException() + throws Exception { +FileInputStream fis = +new FileInputStream(TestUtil.getResourcePath(getClass(), getClass().getSimpleName() + "." ++ "serializedFunctionAdapterWithDifferentSerialVersionUID")); + +DataInputStream dis = new VersionedDataInputStream(new DataInputStream(fis), Version.GFE_82); +Object o = InternalDataSerializer.basicReadObject(dis); +assertTrue(o instanceof FunctionAdapter); + } + + private static class SomeFunction extends FunctionAdapter { + +private static final long serialVersionUID = -6417837315839543937L; + +@Override +public void execute(FunctionContext context) { + context.getResultSender().lastResult("S"); +} + +@Override +public String getId() { + return "I"; +} + +public boolean equals(Object o) { + if (o instanceof FunctionAdapter) { +return ((FunctionAdapter) o).getId().equals(("I")); + } + return false; +} + } + } diff --git a/geode-core/src/test/resources/org/apache/geode/cache/execute/FunctionAdapterJUnitT
[jira] [Commented] (GEODE-4008) InvalidClassException when deserializing FunctionAdapter from pre Geode clients
[ https://issues.apache.org/jira/browse/GEODE-4008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16281046#comment-16281046 ] ASF GitHub Bot commented on GEODE-4008: --- jhuynh1 commented on a change in pull request #1119: GEODE-4008: Add serialVersionUID of older clients to FunctionAdapter URL: https://github.com/apache/geode/pull/1119#discussion_r155382746 ## File path: geode-core/src/test/java/org/apache/geode/cache/execute/FunctionAdapterJUnitTest.java ## @@ -16,15 +16,26 @@ import static org.junit.Assert.*; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.Serializable; + import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.geode.internal.InternalDataSerializer; +import org.apache.geode.internal.Version; +import org.apache.geode.internal.VersionedDataInputStream; import org.apache.geode.test.junit.categories.UnitTest; +import org.apache.geode.util.test.TestUtil; @Category(UnitTest.class) -public class FunctionAdapterJUnitTest { +public class FunctionAdapterJUnitTest implements Serializable { Review comment: Good point, I'll make the change This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > InvalidClassException when deserializing FunctionAdapter from pre Geode > clients > --- > > Key: GEODE-4008 > URL: https://issues.apache.org/jira/browse/GEODE-4008 > Project: Geode > Issue Type: Bug > Components: functions >Reporter: Jason Huynh >Assignee: Jason Huynh > > There was a change to deprecate FunctionAdapter in Geode, and this removed > the method signatures of the class. This causes Java to assign a new > serialVersionUID to the class. However we have clients pre Geode that when > they attempt to execute a function by serializing the function across (not > using a function id), the FunctionAdapter class is unable to deserialize > properly. > The proposed fix is to assign a serialVersionUID to the class that matches > that of the pre Geode FunctionAdapter. This will cause any Geode 1.0-1.3 > clients to run into this same error. However FunctionAdapter has been > deprecated and it would be easy enough to just change the classes to > implement Function. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GEODE-4008) InvalidClassException when deserializing FunctionAdapter from pre Geode clients
[ https://issues.apache.org/jira/browse/GEODE-4008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16279401#comment-16279401 ] ASF GitHub Bot commented on GEODE-4008: --- pivotal-jbarrett commented on a change in pull request #1119: GEODE-4008: Add serialVersionUID of older clients to FunctionAdapter URL: https://github.com/apache/geode/pull/1119#discussion_r155112748 ## File path: geode-core/src/test/java/org/apache/geode/cache/execute/FunctionAdapterJUnitTest.java ## @@ -16,15 +16,26 @@ import static org.junit.Assert.*; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.Serializable; + import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.geode.internal.InternalDataSerializer; +import org.apache.geode.internal.Version; +import org.apache.geode.internal.VersionedDataInputStream; import org.apache.geode.test.junit.categories.UnitTest; +import org.apache.geode.util.test.TestUtil; @Category(UnitTest.class) -public class FunctionAdapterJUnitTest { +public class FunctionAdapterJUnitTest implements Serializable { Review comment: Is the test class only `Serializable` to serialize the anonymous inner class? Seems cleaner to have a static inner class and not make the test class `Serializable`. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > InvalidClassException when deserializing FunctionAdapter from pre Geode > clients > --- > > Key: GEODE-4008 > URL: https://issues.apache.org/jira/browse/GEODE-4008 > Project: Geode > Issue Type: Bug > Components: functions >Reporter: Jason Huynh >Assignee: Jason Huynh > > There was a change to deprecate FunctionAdapter in Geode, and this removed > the method signatures of the class. This causes Java to assign a new > serialVersionUID to the class. However we have clients pre Geode that when > they attempt to execute a function by serializing the function across (not > using a function id), the FunctionAdapter class is unable to deserialize > properly. > The proposed fix is to assign a serialVersionUID to the class that matches > that of the pre Geode FunctionAdapter. This will cause any Geode 1.0-1.3 > clients to run into this same error. However FunctionAdapter has been > deprecated and it would be easy enough to just change the classes to > implement Function. -- This message was sent by Atlassian JIRA (v6.4.14#64029)