You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/11/30 19:50:32 UTC

[GitHub] [ignite] ptupitsyn commented on a change in pull request #8509: IGNITE-10075 .NET: Avoid binary configurations of Ignite Java service params

ptupitsyn commented on a change in pull request #8509:
URL: https://github.com/apache/ignite/pull/8509#discussion_r532856526



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java
##########
@@ -368,12 +369,27 @@ public void onMappingAccepted(final MarshallerMappingItem item) {
 
     /** {@inheritDoc} */
     @Override public Class getClass(int typeId, ClassLoader ldr) throws ClassNotFoundException, IgniteCheckedException {
-        String clsName = getClassName(JAVA_ID, typeId);
+        String clsName;
+
+        ClassNotFoundException err = null;
+
+        for (byte platformId : new byte[] {JAVA_ID, DOTNET_ID}) {

Review comment:
       `JAVA_ID` should come last - in most cases, platform type will be resolved, not a Java type.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/platform/binary/PlatformBinaryProcessor.java
##########
@@ -126,16 +128,28 @@ public PlatformBinaryProcessor(PlatformContext platformCtx) {
             case OP_GET_TYPE: {
                 int typeId = reader.readInt();
 
-                try {
-                    String typeName = platformContext().kernalContext().marshallerContext()
-                        .getClassName(MarshallerPlatformIds.DOTNET_ID, typeId);
+                ClassNotFoundException err = null;
 
-                    writer.writeString(typeName);
-                }
-                catch (ClassNotFoundException e) {
-                    throw new BinaryObjectException(e);
+                for (byte platformId : new byte[] {DOTNET_ID, JAVA_ID}) {
+                    try {
+                        String typeName = platformContext().kernalContext().marshallerContext()
+                            .getClassName(platformId, typeId);
+
+                        writer.writeString(typeName);
+
+                        err = null;
+
+                        break;
+                    }
+                    catch (ClassNotFoundException e) {

Review comment:
       Let's not use exceptions for control flow - may be introduce an overload for `MarshallerContext.getClassName` that does not throw exceptions?




----------------------------------------------------------------
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.

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