Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CONRAD.getClasses when running with pyconrad #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

theHamsta
Copy link
Contributor

@theHamsta theHamsta commented Apr 20, 2019

On pyconrad, the thread that runs CONRAD GUI is not the first thread on the JVM.
Therefore or for some other reason, Thread.currentThread().getContextClassLoader() returns null.
We can solve this problem by patching a private member from pyconrad.

Any better ideas? Setting the setContextClassLoader on the pyconrad side did not work. Patching the whole getClasses method with pyconrad was to drastic for me.

@akmaier
Copy link
Owner

akmaier commented Apr 21, 2019

Did you check whether the StandAlone Version still works after this change? Do we need a new Conrad release then?

@theHamsta
Copy link
Contributor Author

I only tested it with the compiled Java code. With and without pyconrad.

Since the patch only does things if classLoader == null, I don't fear any deteriorations. classLoadder != null is even a assertion in the next line of the original code and we only try to fix things if that condition is not fulfilled.

Finding all filter classes when launched by pyconrad would require this patch and a new CONRAD release.

On pyconrad, the thread that runs CONRAD GUI gets detached from JVM.
Therefore, `Thread.currentThread().getContextClassLoader()` returns
`null`.
We can solve this problem by patching a private member from pyconrad.
@theHamsta theHamsta force-pushed the fix-getContextClassLoader-on-pyconrad branch from 8674665 to 1ca58eb Compare April 21, 2019 19:39
@theHamsta
Copy link
Contributor Author

JAR can be tested by

pip install pyconrad --upgrade
export CONRAD_DEV_DIRS=/folder/of/fixed/jar/file/
conrad

Expected result: Loading CONRAD filters in CONRAD GUI only works if CONRAD_DEV_DIRS is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants