-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TCK] Read-only naming context and close() #138
Comments
I think the focus of this requirement is to disallow applications from
modifying bean's environment through a Context, e.g., by calling its bind,
rebind or other similar methods. Application should have the ability to
bring a Context into existence (through instantiation or lookup), and
dispose of such a Context when done (by calling Context.close() method).
The disposition of a Context does not modify a bean's environment.
From a practical point of view, applications need such a way to indicate to
the container that the Context is no longer needed and the container can
free associated resources.
https://docs.oracle.com/javase/8/docs/api/javax/naming/Context.html#close--
So I would say it's a valid test.
Cheng
…On Fri, Dec 18, 2020 at 4:55 AM Jean-Louis Monteiro < ***@***.***> wrote:
Hi,
I was working on Apache TomEE TCK and investigating a failure.
https://github.com/eclipse-ee4j/jakartaee-tck/blob/master/src/com/sun/ts/tests/ejb30/lite/naming/context/Client.java#L127
It calls this
https://github.com/eclipse-ee4j/jakartaee-tck/blob/master/src/com/sun/ts/tests/ejb30/lite/naming/context/Test.java#L277
In essence, it was failing on TomEE because close was not allowed like
bind for instance (close considered as changing the naming context)
The specification says
https://jakarta.ee/specifications/enterprise-beans/4.0/jakarta-enterprise-beans-spec-core-4.0.html#container-provider-responsibility
I checked Tomcat
https://github.com/apache/tomcat/blob/master/java/org/apache/naming/NamingContext.java#L758
It seems to also not allow close.
TCK seems to be considering close() as a read-only operation.
The specification does not seem to make any difference for close().
The container must ensure that the enterprise bean instances have only
read access to their environment variables. The container must throw the
javax.naming.OperationNotSupportedException from all the methods of the
javax.naming.Context interface that modify the environment naming context
and its subcontexts.
Does this require an additional not in the spec to clarify what the TCK is
actually testing?
Or is the TCK behaviour questionable?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#138>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAP3UEYU33BJ3T7GEI4FYWTSVMRIJANCNFSM4VA6A76Q>
.
|
Thanks for the quick response.
This is effectively what the test is doing. And the test seems to be inline with your reading as well. I fixed already Apache TomEE to relax a bit the constraints. What I would probably suggest is add a small mention to the close() operation in the spec and API javadoc, so it's cristal clear, close() does not modify the bean's environment. |
+1 for clarifyingthe close() in the spec. API javadoc belongs to Java SE so we probably don't want to modify it. This applies not only to ejb, but also to other components, so EE platform spec may be a better place to have this clarification. |
Agreed, thanks |
Hi,
I was working on Apache TomEE TCK and investigating a failure.
https://github.com/eclipse-ee4j/jakartaee-tck/blob/master/src/com/sun/ts/tests/ejb30/lite/naming/context/Client.java#L127
It calls this
https://github.com/eclipse-ee4j/jakartaee-tck/blob/master/src/com/sun/ts/tests/ejb30/lite/naming/context/Test.java#L277
In essence, it was failing on TomEE because close was not allowed like bind for instance (close considered as changing the naming context)
The specification says
https://jakarta.ee/specifications/enterprise-beans/4.0/jakarta-enterprise-beans-spec-core-4.0.html#container-provider-responsibility
I checked Tomcat
https://github.com/apache/tomcat/blob/master/java/org/apache/naming/NamingContext.java#L758
It seems to also not allow close.
TCK seems to be considering close() as a read-only operation.
The specification does not seem to make any difference for close().
The container must ensure that the enterprise bean instances have only read access to their environment variables. The container must throw the javax.naming.OperationNotSupportedException from all the methods of the javax.naming.Context interface that modify the environment naming context and its subcontexts.
Does this require an additional not in the spec to clarify what the TCK is actually testing?
Or is the TCK behaviour questionable?
The text was updated successfully, but these errors were encountered: