You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Roman S. Bushmanov (JIRA)" <ji...@apache.org> on 2007/02/21 15:54:06 UTC
[jira] Updated: (GERONIMO-2860) PropertyEditorsTest unit test may
harm editorSearchPath
[ https://issues.apache.org/jira/browse/GERONIMO-2860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Roman S. Bushmanov updated GERONIMO-2860:
-----------------------------------------
Description:
This unit test may harm editorSearchPath being run first in a testlist.
In that case subsequent runs of other unit tests for this module in the same environment will result in NPE.
The reason is simple. If the first test in test run is PropertyEditorsTest than its setUp() method is called before org.apache.geronimo.common.propertyeditor.PropertyEditors was loaded and initialized. So setUp() method stores wrong value of editorSearchPath because it is modified upon PropertyEditors class initialization. After both test cases of the test are completed and PropertyEditors class is loaded the method tearDown() sets back the wrong value of editorSearchPath. As a result after the test run editorSearchPath has incorrect value.
The suggested fix is to load PropertyEditors clas explicitly before caching the value of editorSearchPath as follows
protected void setUp() throws Exception {
Class.forName("org.apache.geronimo.common.propertyeditor.PropertyEditors");
editorSearchPath = PropertyEditorManager.getEditorSearchPath();
}
was:
This unit test may harm editorSearchPath being run first in a testlist.
In that case subsequent runs of other unit tests for this module in the same environment will result in NPE.
The reason is simple. If the first test in test run is PropertyEditorsTest than its setUp() method is called before org.apache.geronimo.common.propertyeditor.PropertyEditors was loaded and initialized. So setUp() method stores wrong value of editorSearchPath because it is modified upon PropertyEditors class initialization. After both test cases of the test are completed and PropertyEditors class is loaded the method tearDown() sets back the wrong value of editorSearchPath. As a result after the test run editorSearchPath has incorrect value.
The suggested fix is to load PropertyEditors clas explicitly before caching the value of editorSearchPath as follows
protected void setUp() throws Exception {
Class.forName("org.apache.geronimo.common.propertyeditor.PropertyEditors");
editorSearchPath = PropertyEditorManager.getEditorSearchPath();
}
> PropertyEditorsTest unit test may harm editorSearchPath
> -------------------------------------------------------
>
> Key: GERONIMO-2860
> URL: https://issues.apache.org/jira/browse/GERONIMO-2860
> Project: Geronimo
> Issue Type: Bug
> Security Level: public(Regular issues)
> Components: common
> Reporter: Roman S. Bushmanov
>
> This unit test may harm editorSearchPath being run first in a testlist.
> In that case subsequent runs of other unit tests for this module in the same environment will result in NPE.
> The reason is simple. If the first test in test run is PropertyEditorsTest than its setUp() method is called before org.apache.geronimo.common.propertyeditor.PropertyEditors was loaded and initialized. So setUp() method stores wrong value of editorSearchPath because it is modified upon PropertyEditors class initialization. After both test cases of the test are completed and PropertyEditors class is loaded the method tearDown() sets back the wrong value of editorSearchPath. As a result after the test run editorSearchPath has incorrect value.
> The suggested fix is to load PropertyEditors clas explicitly before caching the value of editorSearchPath as follows
> protected void setUp() throws Exception {
> Class.forName("org.apache.geronimo.common.propertyeditor.PropertyEditors");
> editorSearchPath = PropertyEditorManager.getEditorSearchPath();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.