You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the code review of #181, we talked about try-with-resources statements and the implementation details of AEM-20 (ResourceResolver can be closed using try-with-resources Java 7 feature).
and recommended the cast should be preceded by resource being checked using instanceof.
I've read into it a little further and it seems there's a new way to write a try-with-resources block in Java 9 and above.
The type check we proposed helps us allow a class cast exception but we now know of a case that AEM-6 doesn't cover, which could be encountered in AEM 6.5 projects (due to Java 11 support).
The rule should be revised, taking into account:
whether or not it provides any benefits over the rule java:S2095, Resources should be closed, which comes with the built-in Sonar way profile in SonarQube LTS 7.9.3 and could, in theory, highlight the misuse of ResourceResolver instances.
if it does provide an extra benefit, make it work for Java 11 AEM projects:
-- Provide unit test cases with examples of new syntax
-- Modify ResourceResolverTryWithResourcesCheck accordingly
The text was updated successfully, but these errors were encountered:
toniedzwiedz
changed the title
Revise AEM-6 (ResourceResolver should be closed in finally block.) (Java 9+ support and possible redundancy)
Revise AEM-6 (ResourceResolver should be closed in finally block.) Java 9+ support and possible redundancy.
Apr 9, 2020
toniedzwiedz
changed the title
Revise AEM-6 (ResourceResolver should be closed in finally block.) Java 9+ support and possible redundancy.
Revise AEM-20 (ResourceResolver can be closed using try-with-resources Java 7 feature.) and AEM-6 (ResourceResolver should be closed in finally block.) Java 9+ support and possible redundancy.
May 22, 2020
toniedzwiedz
changed the title
Revise AEM-20 (ResourceResolver can be closed using try-with-resources Java 7 feature.) and AEM-6 (ResourceResolver should be closed in finally block.) Java 9+ support and possible redundancy.
Revise AEM-20 (ResourceResolver can be closed using try-with-resources Java 7 feature) Java 9+ support and possible redundancy.
May 22, 2020
During the code review of #181, we talked about try-with-resources statements and the implementation details of AEM-20 (ResourceResolver can be closed using try-with-resources Java 7 feature).
We noticed a suspicious cast
and recommended the cast should be preceded by
resource
being checked usinginstanceof
.I've read into it a little further and it seems there's a new way to write a try-with-resources block in Java 9 and above.
The type check we proposed helps us allow a class cast exception but we now know of a case that AEM-6 doesn't cover, which could be encountered in AEM 6.5 projects (due to Java 11 support).
The rule should be revised, taking into account:
java:S2095
, Resources should be closed, which comes with the built-in Sonar way profile in SonarQube LTS 7.9.3 and could, in theory, highlight the misuse of ResourceResolver instances.-- Provide unit test cases with examples of new syntax
-- Modify
ResourceResolverTryWithResourcesCheck
accordinglyThe text was updated successfully, but these errors were encountered: