Skip to content
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

Open
jeanouii opened this issue Dec 18, 2020 · 4 comments
Open

[TCK] Read-only naming context and close() #138

jeanouii opened this issue Dec 18, 2020 · 4 comments

Comments

@jeanouii
Copy link
Contributor

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?

@chengfang
Copy link
Contributor

chengfang commented Dec 18, 2020 via email

@jeanouii
Copy link
Contributor Author

Thanks for the quick response.

The disposition of a Context does not modify a bean's environment.

This is effectively what the test is doing. And the test seems to be inline with your reading as well.
I was more asking because I realised at least 2 implementations were having a different reading and were considering the close() operation to be modifying the bean's environment.

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.

@chengfang
Copy link
Contributor

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

@jeanouii
Copy link
Contributor Author

Agreed, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants