
util.InterruptibleMatchingString Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of regex-static-analysis Show documentation
Show all versions of regex-static-analysis Show documentation
A tool to perform static analysis on regexes to determine whether they are vulnerable to ReDoS.
package util;
public final class InterruptibleMatchingString implements CharSequence {
private final CharSequence string;
public InterruptibleMatchingString(CharSequence string) {
this.string = string;
}
public char charAt(int index) {
if (Thread.interrupted()) {
throw new RuntimeException(new InterruptedException());
}
return string.charAt(index);
}
public int length() {
return string.length();
}
public CharSequence subSequence(int start, int end) {
if (Thread.interrupted()) {
throw new RuntimeException(new InterruptedException());
}
return new InterruptibleMatchingString(string.subSequence(start, end));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy