-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fixing the backward compatible issue that existing metadata may contain unescaped characters #12393
Conversation
c43f366
to
6fad229
Compare
try { | ||
value = StringEscapeUtils.unescapeJava(value); | ||
} catch (Exception e) { | ||
// If the value is not a valid escaped string, ignore the exception and continue |
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.
Can we log an error message/exception here ?
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 don't think we want to log error here. If we want to find all old segments that contains unescaped special character, a metric might be helpful.
IMO we can just leave it as is since the overhead is minimal.
@@ -241,7 +241,11 @@ public static String replaceSpecialCharacterInPropertyValue(String value) { | |||
* {@link #replaceSpecialCharacterInPropertyValue(String)}. | |||
*/ | |||
public static String recoverSpecialCharacterInPropertyValue(String value) { | |||
value = StringEscapeUtils.unescapeJava(value); | |||
try { |
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 saw a similar change in another method (introduced by the same PR). I did not see similar issue, but wanted to just point out.
public static String replaceSpecialCharacterInPropertyValue(String value) {
value = StringEscapeUtils.**escapeJava**(value);
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.
Please add some comments stating this is for backward compatibility, where the old commons library escapes character in a different way
@@ -241,7 +241,11 @@ public static String replaceSpecialCharacterInPropertyValue(String value) { | |||
* {@link #replaceSpecialCharacterInPropertyValue(String)}. | |||
*/ | |||
public static String recoverSpecialCharacterInPropertyValue(String value) { | |||
value = StringEscapeUtils.unescapeJava(value); | |||
try { |
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.
Please add some comments stating this is for backward compatibility, where the old commons library escapes character in a different way
try { | ||
value = StringEscapeUtils.unescapeJava(value); | ||
} catch (Exception e) { | ||
// If the value is not a valid escaped string, ignore the exception and continue |
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 don't think we want to log error here. If we want to find all old segments that contains unescaped special character, a metric might be helpful.
IMO we can just leave it as is since the overhead is minimal.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #12393 +/- ##
============================================
- Coverage 61.74% 61.72% -0.03%
Complexity 207 207
============================================
Files 2425 2428 +3
Lines 132766 132828 +62
Branches 20535 20545 +10
============================================
+ Hits 81980 81990 +10
- Misses 44771 44833 +62
+ Partials 6015 6005 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…in unescaped characters
6fad229
to
bfa4fd0
Compare
Observed the issue that existing metadata with escaped characters failed the segment metadata loading.
Introduced by #11985.
Stacktrace: