You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sharad Agarwal (JIRA)" <ji...@apache.org> on 2011/01/13 10:26:46 UTC

[jira] Created: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Generated protocol's method should not throw AvroRemoteException
----------------------------------------------------------------

                 Key: AVRO-732
                 URL: https://issues.apache.org/jira/browse/AVRO-732
             Project: Avro
          Issue Type: Bug
          Components: java
            Reporter: Sharad Agarwal


If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981384#action_12981384 ] 

Doug Cutting commented on AVRO-732:
-----------------------------------

This sounds like it would be a good improvement.  I can't recall why I did things this way.  It looks to be a mistake.

> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Philip Zeyliger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985775#action_12985775 ] 

Philip Zeyliger commented on AVRO-732:
--------------------------------------

Serializing Java exceptions only works for Java: I think you've more or less got to coerce the exception into a string.

> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Holger Hoffstätte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985746#action_12985746 ] 

Holger Hoffstätte commented on AVRO-732:
----------------------------------------

My vote would be to:

- get rid of AvroRemoteException in interfaces
- serialize service-level remote exceptions & pass them through (most exceptions are serializable)
- throw AvroRemoteExceptions for caught non-RuntimeExceptions, i.e. transport errors as cause

AvroRemoteException should therefore not be a subclass of IOException.

This allows clients and any client-side infrastructure (proxy interceptors etc.) to distinguish between interface-declared service exceptions and undeclared transport exceptions via AvroRemoteExceptions with a cause.


> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Commented] (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Tino Kissig (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13474868#comment-13474868 ] 

Tino Kissig commented on AVRO-732:
----------------------------------

This issue is still present in 1.7.2. Are there any plans to do this improvement in one of the next releases?
                
> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Holger Hoffstätte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985793#action_12985793 ] 

Holger Hoffstätte commented on AVRO-732:
----------------------------------------

Philip: you are of course completely correct - thanks for pointing it out. This means that every implementation needs to be aware of exceptional return values in general, and at least understand the returned "special" payload enough to extract meaningful information from it.
I guess this brings us to the question whether we should force lowest-common-denominator behaviour on all languages, or allow semantic differences & capabilities to shine through.


> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986570#action_12986570 ] 

Doug Cutting commented on AVRO-732:
-----------------------------------

For specific and reflect code, the natural mapping to me is that errors declared in the protocol should be declared as thrown in the generated interface methods.  Generic code needs to throw something that's both an exception and contains GenericRecord.  Currently this is done by wrapping a GenericData.Record within a AvroRemoteException.

I am still +1 for removing AvroRemoteException from the list of exceptions thrown by generated code.  Perhaps other exception-related improvements could be made, but I'd prefer to limit this issue to that improvement if possible.

> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-732:
------------------------------

    Fix Version/s: 1.6.0

This is an incompatible change to generated interfaces, so we'll schedule it for 1.6.0.

> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>             Fix For: 1.6.0
>
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Sharad Agarwal (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12981189#action_12981189 ] 

Sharad Agarwal commented on AVRO-732:
-------------------------------------

More details and Example. 
a) For idl:
  void test();
Generated code is:
  public void test() throws AvroRemoteException;

b) For idl:
  void test1() throws TestError;
Generated code is:
  public void test1() throws AvroRemoteException, TestException;


The generated code should add the throws clause only for the errors defined in idl. 

For above example the generated code should be:
a) public void test();
b) public void test1() throws TestException;

> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Scott Carey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985032#action_12985032 ] 

Scott Carey commented on AVRO-732:
----------------------------------

The code always adds AvroRemoteException if is not a one-way message:

in the compiler's velocity template protocol.vm there is:
{quote}
)#if (! $message.isOneWay())
 throws org.apache.avro.AvroRemoteException##
{quote}

and corresponding logic in the Avro14SpecificCompiler test class.


Is it OK to remove this?  Or is the suggestion that if an exception is declared, then omit the AvroRemoteException?   If we get rid of it completely, what is the expected behavior when the remote side sends back an error?  I'm not familiar enough with the protocols to fix this, but we should do so for 1.5.0 since the exception signature is changing due to AVRO-737.

> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] [Updated] (AVRO-732) Generated protocol's method should not throw AvroRemoteException

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AVRO-732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Doug Cutting updated AVRO-732:
------------------------------

    Fix Version/s: 1.8.0

Tino> Are there any plans to do this improvement in one of the next releases?

We just need a patch and some tests.  This could go into 1.8.0.  I will not have time to work on this for the next few weeks.

                
> Generated protocol's method should not throw AvroRemoteException
> ----------------------------------------------------------------
>
>                 Key: AVRO-732
>                 URL: https://issues.apache.org/jira/browse/AVRO-732
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>            Reporter: Sharad Agarwal
>             Fix For: 1.8.0
>
>
> If user does NOT define the throws clause in the idl, the code is generated with "throws AvroRemoteException" clause. However on throwing the AvroRemoteException from the implementation, the serialization fails. This is not intuitive to users.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira