-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Jdk19 regexp fix #11016
base: master
Are you sure you want to change the base?
Jdk19 regexp fix #11016
Changes from 12 commits
d14ba19
de77114
bf95c0b
1fdbfd8
c2e3242
7c78310
be43eed
129852d
bd299bd
47c9805
3d94338
8e7f853
d5920b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -776,7 +776,8 @@ private void createRules(List<PatternToken> elemList, | |||||||||
rule.setDistanceTokens(distanceTokens); | ||||||||||
rule.setXmlLineNumber(xmlLineNumber); | ||||||||||
} else if (regex.length() > 0) { | ||||||||||
int flags = regexCaseSensitive ? 0 : Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE; | ||||||||||
// int flags = regexCaseSensitive ? 0 : Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CASE; | ||||||||||
int flags = regexCaseSensitive ? Pattern.UNICODE_CHARACTER_CLASS : Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CHARACTER_CLASS; | ||||||||||
Comment on lines
+779
to
+780
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirm the replacement of In the previous implementation (now commented out), when If the intent is to support both Unicode character classes and case-insensitive matching for Unicode characters when Consider applying the following change to include both flags: -int flags = regexCaseSensitive ? Pattern.UNICODE_CHARACTER_CLASS : Pattern.CASE_INSENSITIVE|Pattern.UNICODE_CHARACTER_CLASS;
+int flags = regexCaseSensitive ? Pattern.UNICODE_CHARACTER_CLASS : Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.UNICODE_CHARACTER_CLASS; This ensures that both case-insensitive matching and Unicode character classes are enabled when 📝 Committable suggestion
Suggested change
|
||||||||||
String regexStr = regex.toString(); | ||||||||||
if (regexMode == RegexpMode.SMART) { | ||||||||||
// Note: it's not that easy to add \b because the regex might look like '(foo)' or '\d' so we cannot just look at the last character | ||||||||||
|
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.
🛠️ Refactor suggestion
Prevent potential deadlocks by handling both standard and error streams
In the
readProcessOutput
method, only the process's standard output stream is read. If the process writes to its error stream and the buffer fills up, it could cause the process to hang due to unhandled data. It's important to read both the standard output and error streams to prevent this issue.Apply this diff to read both the standard output and error streams:
This ensures that both output streams are consumed, preventing the process from hanging due to full buffers.
📝 Committable suggestion