Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2154

Python to Java IPC converts boolean inside a union to integer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.8.2
    • None
    • java
    • None
    • macOS 10.13.3

      Java(TM) SE Runtime Environment (build 1.8.0_161-b12)

      Python 2.7.10

    • java python rpc

    Description

      Using the following IDL:

      @namespace("us.codemug")
      protocol BooleanTestProtocol {
        void booleanInUnion(union{boolean, int, string} myunion);
      }
      

      and the following Java implementation:

      package us.codemug;
      
      import java.util.Map;
      import org.apache.avro.AvroRemoteException;
      
      public class BooleanTestResponder implements BooleanTestProtocol {
      
        public Void booleanInUnion(Object myunion) throws AvroRemoteException {
          print(myunion);
          return null;
        }
      
        private void print(Object value) {
          System.out.println("Type: " + value.getClass().getName());
          System.out.println("Value: " + value);
        }
      }
      
      

      When performing the IPC from python with the input:

      args = dict()
      args['myunion'] = True
      requestor.request('booleanInUnion', args)
      

      Produces this output at the server side:

      Type: java.lang.Integer
      Value: 1
      

      The booleans are being converted to integers

      Attachments

        Activity

          People

            Unassigned Unassigned
            codemug Usman Shahid
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: