Closed glassfishrobot closed 11 years ago
Reported by mvatkina
mvatkina said: Added notes as described in #2
Was assigned to mvatkina
This issue was imported from java.net JIRA INTERCEPTORS_SPEC-8
Marked as fixed on Monday, February 11th 2013, 3:53:13 pm
WHAT's WRONG? The interceptors spec contradicts itself when describing an interceptor method exceptions rules and defining the interceptor method:
A. The Interceptors spec restrictions on exceptions that can be thrown by an interceptor method:
2.4Exceptions "Interceptor methods are allowed to throw runtime exceptions or any checked exceptions that the associated target method allows within its throws clause. Interceptor methods are allowed to catch and suppress exceptions and to recover by calling the theInvocationContext.proceed method."
B. The EJB spec requirements on the timeout method: 13.2.5.3Timeout Callback Method Requirements
void()
void (Timer timer)
"Timeout callback methods must not throw application exceptions."
C. The interceptor spec requirements on around-invoke and around-timeout method signatures
2.5Business Method Interceptors
Object(InvocationContext) throws Exception
2.7Timeout Method Interceptors
Object(InvocationContext) throws Exception
============
As you can see, not only the around-timeout returns a value that the method it interposes on doesn't, but it also must declare the "throws Exception" clause while the target instance method can only throw RuntimeException's.
The around-invoke requirement to declare "throws Exception" does not allow to be more specific.
PROPOSED CHANGES
There are 2 ways to fix the problem. Unless I hear an overwhelming support for #1, and overwhelming rejection of both options (#3), I'll go with option #2 to reduce the amount of changes in this version of the Interceptors spec.
1
Change method signatures for both around-invoke to make throws clause optional: Object(InvocationContext) [throws Exception]
Add a note to for the above: "An around-invoke interceptor method may declare to throw any checked exceptions that the associated target method allows within its throws clause. It may declare to throw a java.lang.Exception if it interposes on several methods that can throw unrelated checked exception."
Remove "throws Exception" clause from the around-timeout method
2
Add a note under the around-invoke method signature: "An around-invoke interceptor method may declare to throw any checked exceptions that the associated target method allows within its throws clause. It may declare to throw the java.lang.Exception if it interposes on several methods that can throw unrelated checked exception."
Add a note under the around-timeout method signature: "An around-timeout interceptor method must not throw application exceptions, but it may declare to throw checked exceptions or the java.lang.Exception if the same interceptor method interposes on business methods in addition to the timeout methods."
3
The proposed changes do not make any sense
Affected Versions
[1.2]