mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diagnostics for EA-48275 - SIOOBE: TextRange.substring
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.ClassExtension;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
@@ -77,7 +77,12 @@ public class TextRange implements Segment, Serializable {
|
||||
|
||||
@NotNull
|
||||
public String substring(@NotNull String str) {
|
||||
return str.substring(myStartOffset, myEndOffset);
|
||||
try {
|
||||
return str.substring(myStartOffset, myEndOffset);
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e) {
|
||||
throw new StringIndexOutOfBoundsException("Can't extract " + this + " range from " + str);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+3
-3
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
|
||||
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.ElementManipulators;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.ElementManipulators;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user