All Downloads are FREE. Search and download functionalities are using the official Maven repository.

util.InterruptibleMatchingString Maven / Gradle / Ivy

Go to download

A tool to perform static analysis on regexes to determine whether they are vulnerable to ReDoS.

There is a newer version: 1.0.8
Show newest version
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