mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IPP: don't replace unicode carriage return with character (EA-92213)
This commit is contained in:
@@ -110,7 +110,7 @@ public class UnicodeUnescapeIntention extends Intention {
|
||||
/**
|
||||
* see JLS 3.3. Unicode Escapes
|
||||
*/
|
||||
private static int indexOfUnicodeEscape(@NotNull String text, int offset) {
|
||||
static int indexOfUnicodeEscape(@NotNull String text, int offset) {
|
||||
final int length = text.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
final char c = text.charAt(i);
|
||||
@@ -143,6 +143,8 @@ public class UnicodeUnescapeIntention extends Intention {
|
||||
StringUtil.isHexDigit(text.charAt(nextChar + 3))) {
|
||||
final int escapeEnd = nextChar + 4;
|
||||
if (offset <= escapeEnd) {
|
||||
final char d = (char)Integer.parseInt(text.substring(nextChar, nextChar + 4), 16);
|
||||
if (d == '\r') return -1; // carriage return not allowed
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
// \u000D<caret>
|
||||
+1
@@ -29,6 +29,7 @@ public class UnicodeUnescapeIntentionTest extends IPPTestCase {
|
||||
public void testSurrogatePairs2() { doTest(); }
|
||||
public void testNoException() { assertIntentionNotAvailable(); }
|
||||
public void testU() { assertIntentionNotAvailable(); }
|
||||
public void testNoCarriageReturn() { assertIntentionNotAvailable(); }
|
||||
|
||||
@Override
|
||||
protected String getRelativePath() {
|
||||
|
||||
Reference in New Issue
Block a user