-
Notifications
You must be signed in to change notification settings - Fork 184
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 IllegalArgumentException
with non-ascii paths
#1195
Conversation
IllegalArgumentException
with non-ascii paths
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1195 +/- ##
=======================================
Coverage 87.21% 87.21%
=======================================
Files 113 113
Lines 10277 10280 +3
Branches 4088 4088
=======================================
+ Hits 8963 8966 +3
Misses 718 718
Partials 596 596
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LTGM
Looks like I have some maintenance tasks before the CI will run. |
@Thrameos I'm working on a test and it seems emoji still don't work although that appears to be a different reason. |
The emoji thing seems to be a problem with java itself
|
I am hoping it is safe to ignore emoji. Although a coworker of mine had great fun using the poop emoji when we added internationalization to string conversions, I think that it is an edge case. It is also a good idea to add a line to "doc/CHANGELOG.rst" describing the change so that others will know it is fixes. Thanks for taking the time to add tests. |
Since Java appears to have difficulties with emojis in classpaths, it's probably impossible to fix this issue. The important thing is to support non-English character sets that are likely in user paths. That is the problem that prompted me to open this issue in the first place. Although a poop emoji directory does sound like a good place to store certain parts of java :D. I've added my changes to the changelog. Let me know if its not in the right place or the wording is bad. |
f4b6d88
to
af03e98
Compare
Honestly I do not understand right now, why the pipeline isnt converging. On the main branch everything was fine. |
@tachyonicClock I think the hung tests are due to the process creation within the new regression test. Could you please check, if using https://pypi.org/project/pytest-forked/ and marking the test with the provided marker could be a solution? @pytest.mark.forked
def test_with_leaky_state():
run_some_monkey_patches() This would require of course to install pytest-forked for the test suite. It should go to test-requirements.txt. Thank you! |
9463137
to
693c6f5
Compare
I fixed the hanging issue and packaged it with the related tests in |
Last week I tried fixing this on windows but ran into some other issues related to UTF-8 vs UTF-16 character encoding on Windows in the JNI. It will likely take me a little longer to figure out a solution or workaround. |
@tachyonicClock Thanks for your work on this so far! Any updates on this one? We would like to conclude a set of changes for the next release and I would like to include this fix if it also works on Windows. |
a242500
to
dea04b7
Compare
dea04b7
to
e2e60a5
Compare
|
// by re-encoding the URI after decoding it. | ||
uri = new URI( | ||
uri.getScheme(), | ||
URLDecoder.decode(uri.getSchemeSpecificPart()), |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note
URLDecoder.decode
"""Prior versions of JPype used the jvmargs to setup the class paths via | ||
JNI (Java Native Interface) option strings: | ||
i.e -Djava.class.path=... | ||
See: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html | ||
|
||
Unfortunately, unicode is unsupported by this interface on windows, since | ||
windows uses wide-byte (16bit) character encoding. | ||
See: https://stackoverflow.com/questions/20052455/jni-start-jvm-with-unicode-support | ||
|
||
To resolve this issue we add the classpath after initialization since jpype | ||
itself supports unicode class paths. | ||
""" | ||
for cp in _handleClassPath(classpath): | ||
addClassPath(Path.cwd() / Path(cp).resolve()) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears this code is going to cause some serious issues because certain types of classpath absolutely must be loaded prior to starting the JVM. The two that come to mind are database drivers and anything containing a classloader.
I believe there is a solution in that we just need to send a bytes with the correct encoding, but I need to test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry this ended up breaking things.
I believe there is a solution in that we just need to send a bytes with the correct encoding, but I need to test it.
I wish you luck. I spent some time struggling to get this to work, but did not try exhaustively since I found the stack-overflow response suggesting I set the properties at runtime. I found some discussion of this problem from 2017 but it does not look like it went anywhere: https://mail.openjdk.org/pipermail/jdk10-dev/2017-May/000191.html.
Fix #1194