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.