chrisrueger commented on code in PR #507:
URL: https://github.com/apache/felix-dev/pull/507#discussion_r3328293246
##########
gogo/shell/src/main/java/org/apache/felix/gogo/shell/Posix.java:
##########
@@ -200,4 +210,65 @@ public static void copy(InputStream in, OutputStream out)
throws IOException
out.flush();
}
+ private static final long REGEX_TIMEOUT_MS = 1000;
+
+ private static class RegexTimeoutException extends RuntimeException
+ {
+ public RegexTimeoutException(String message)
+ {
+ super(message);
+ }
+ }
+
+ private static class TimeoutCharSequence implements CharSequence
+ {
+ private final CharSequence seq;
+ private final long timeoutTime;
+ private int count = 0;
+ private static final int CHECK_INTERVAL = 1000;
+
+ public TimeoutCharSequence(CharSequence seq, long timeoutMs)
+ {
+ this.seq = seq;
+ this.timeoutTime = System.currentTimeMillis() + timeoutMs;
Review Comment:
"in theory" this `System.currentTimeMillis() + timeoutMs;` could overun and
lead to `timeoutTime` become negative which would cause checkTimeout() to
always throw.
e.g. if somebody passes `timeoutMs = Long.MAX_VALUE` to mean "no timeout"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]