mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix SIOOBE
This commit is contained in:
@@ -69,8 +69,12 @@ public class UnicodeUnescapeIntention extends Intention {
|
||||
final Document document = editor.getDocument();
|
||||
final int offset = caretModel.getOffset();
|
||||
final String text = document.getText(new TextRange(Math.max(offset - 6, 0), Math.min(offset + 6, document.getTextLength())));
|
||||
final int max = Math.min(7, text.length());
|
||||
final int textLength = text.length();
|
||||
final int max = Math.min(7, textLength);
|
||||
for (int i = 0; i < max; i++) {
|
||||
if (i + 5 >= textLength) {
|
||||
//return false;
|
||||
}
|
||||
if (text.charAt(i) == '\\' &&
|
||||
text.charAt(i + 1) == 'u' &&
|
||||
StringUtil.isHexDigit(text.charAt(i + 2)) &&
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
// \u<caret>0
|
||||
+4
@@ -3,9 +3,13 @@ package com.siyeh.ipp.unicode;
|
||||
import com.siyeh.IntentionPowerPackBundle;
|
||||
import com.siyeh.ipp.IPPTestCase;
|
||||
|
||||
/**
|
||||
* @see com.siyeh.ipp.unicode.UnicodeUnescapeIntention
|
||||
*/
|
||||
public class UnicodeUnescapeIntentionTest extends IPPTestCase {
|
||||
|
||||
public void testSimple() { doTest(); }
|
||||
public void testNoException() { assertIntentionNotAvailable(); }
|
||||
|
||||
@Override
|
||||
protected String getRelativePath() {
|
||||
|
||||
Reference in New Issue
Block a user