harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vasily Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-5477) [classlib][beans][geronimo] PropertyEditorManager.findEditor() uses wrong classloader
Date Thu, 14 Feb 2008 15:03:10 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-5477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Vasily Zakharov closed HARMONY-5477.
------------------------------------


The fix seems to work fine, closing the issue.


> [classlib][beans][geronimo] PropertyEditorManager.findEditor() uses wrong classloader
> -------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5477
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5477
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib
>    Affects Versions: 5.0M5
>            Reporter: Vasily Zakharov
>            Assignee: Vasily Zakharov
>             Fix For: 5.0M5
>
>         Attachments: Harmony-5477-Test.patch, Harmony-5477.patch
>
>
> PropertyEditorManager.findEditor() always uses the target class loader to locate the
editor, while it should use thread context class loader when a particular editor is not found
the the target class loader.
> Here's the test demonstrating the problem:
> import java.beans.*;
> import java.net.*;
> public class Test {
>     public static void main(String[] args) {
>         try {
>             PropertyEditorManager.setEditorSearchPath(new String[] { "myPackage" });
>             ClassLoader editorLoader = new URLClassLoader(new URL[] { new URL("file:./editor/")
});
>             Thread.currentThread().setContextClassLoader(editorLoader);
>             PropertyEditor editor = PropertyEditorManager.findEditor(MyClass.class);
>             if (editor == null) {
>                 System.out.println("FAIL: null");
>             } else {
>                 String editorName = editor.getClass().getName();
>                 System.out.println(editorName.equals("myPackage.MyClassEditor") ? "SUCCESS"
: ("FAIL: " + editorName));
>             }
>         } catch (Throwable e) {
>             System.out.print("ERROR: ");
>             e.printStackTrace(System.out);
>         }
>     }
> }
> class MyClass {
> }
> package myPackage;
> public class MyClassEditor extends java.beans.PropertyEditorSupport {
> }
> Compiled MyClassEditor.class should be put to ./editor/myPackage/MyClassEditor.class
for the test to work.
> Output on RI:
> SUCCESS
> Output on Harmony:
> FAIL: null
> The reason the test fails is the editor is available in other classloader than the original
class. That classloader is preliminarily specified by Thread.currentThread().setContextClassLoader(),
but Harmony implementation doesn't use it. To fix, the classloader handling mechanism in PropertyEditorManager.findEditor()
needs to be changed.
> This testcase was derived from org.apache.geronimo.common.propertyeditor.PropertyEditors.findEditor(String,
ClassLoader) method.
> This issue prevents Geronimo 2.1-snapshot from starting on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message