[
https://issues.apache.org/jira/browse/JCR-752?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jukka Zitting updated JCR-752:
------------------------------
Component/s: (was: test)
jackrabbit-jcr-tests
> Test cases leak sessions
> ------------------------
>
> Key: JCR-752
> URL: https://issues.apache.org/jira/browse/JCR-752
> Project: Jackrabbit
> Issue Type: Bug
> Components: jackrabbit-jcr-tests
> Reporter: Julian Reschke
> Priority: Minor
>
> Many of the JCR test cases currently leak Sessions when an exception occurs
> during the setUp() method. For some repository implementations, lots of
> non-closed Session objects can cause subsequent test cases not to run at all
> (because of no additional Sessions being available).
> For instance, in org.apache.jackrabbit.test.api.SetValueBinaryTest:
> protected void setUp() throws Exception {
> super.setUp();
> // initialize some binary value
> data = createRandomString(10).getBytes();
> value = superuser.getValueFactory().createValue(new
> ByteArrayInputStream(data));
> // create a new node under the testRootNode
> node = testRootNode.addNode(nodeName1, testNodeType);
> // create a new single-value property and save it
> property1 = node.setProperty(propertyName1,
> superuser.getValueFactory().createValue(new ByteArrayInputStream(new
> byte[0])));
> superuser.save();
> }
> This code should be enhanced like this:
> protected void setUp() throws Exception {
> super.setUp();
> try {
> // initialize some binary value
> data = createRandomString(10).getBytes();
> value = superuser.getValueFactory().createValue(new
> ByteArrayInputStream(data));
> // create a new node under the testRootNode
> node = testRootNode.addNode(nodeName1, testNodeType);
> // create a new single-value property and save it
> property1 = node.setProperty(propertyName1,
> superuser.getValueFactory().createValue(new ByteArrayInputStream(new
> byte[0])));
> superuser.save();
> }
> catch (RepositoryException ex) {
> super.cleanUp();
> throw ex;
> }
> }
> This applies to many other test cases as well, some of which also allocate an
> additional Session which would need to be logged out as well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.