• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tomdesair / tus-java-server / 27465232708

13 Jun 2026 11:17AM UTC coverage: 92.468% (-2.1%) from 94.575%
27465232708

Pull #80

github

web-flow
Merge 3c0ac21fb into 73dcffedd
Pull Request #80: feat: Add upload lock contention resolution for HEAD requests

603 of 694 branches covered (86.89%)

Branch coverage included in aggregate %.

150 of 197 new or added lines in 7 files covered. (76.14%)

1 existing line in 1 file now uncovered.

1754 of 1855 relevant lines covered (94.56%)

5.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.38
/src/main/java/me/desair/tus/server/util/InterruptibleInputStream.java
1
package me.desair.tus.server.util;
2

3
import java.io.IOException;
4
import java.io.InputStream;
5

6
/**
7
 * An InputStream wrapper that can be interrupted by another thread. When interrupted, it throws an
8
 * IOException on subsequent or blocking read operations.
9
 */
10
public class InterruptibleInputStream extends InputStream {
11

12
  private final InputStream delegate;
13
  private volatile boolean interrupted = false;
6✔
14

15
  public InterruptibleInputStream(InputStream delegate) {
4✔
16
    if (delegate == null) {
4!
NEW
17
      throw new IllegalArgumentException("Delegate InputStream cannot be null");
×
18
    }
19
    this.delegate = delegate;
6✔
20
  }
2✔
21

22
  private void checkInterrupted() throws IOException {
23
    if (interrupted) {
6✔
24
      throw new IOException("Stream was interrupted by the upload locking service watchdog");
10✔
25
    }
26
  }
2✔
27

28
  public void interrupt() {
29
    interrupted = true;
6✔
30
    try {
31
      delegate.close();
6✔
32
    } catch (IOException e) {
1✔
33
      // Ignore close exception during interrupt
34
    }
2✔
35
  }
2✔
36

37
  public boolean isInterrupted() {
38
    return interrupted;
3✔
39
  }
40

41
  @Override
42
  public int read() throws IOException {
43
    checkInterrupted();
2✔
44
    try {
45
      int result = delegate.read();
4✔
46
      checkInterrupted();
2✔
47
      return result;
2✔
NEW
48
    } catch (IOException e) {
×
NEW
49
      checkInterrupted();
×
NEW
50
      throw e;
×
51
    }
52
  }
53

54
  @Override
55
  public int read(byte[] b) throws IOException {
56
    checkInterrupted();
2✔
57
    try {
58
      int result = delegate.read(b);
5✔
59
      checkInterrupted();
2✔
60
      return result;
2✔
NEW
61
    } catch (IOException e) {
×
NEW
62
      checkInterrupted();
×
NEW
63
      throw e;
×
64
    }
65
  }
66

67
  @Override
68
  public int read(byte[] b, int off, int len) throws IOException {
69
    checkInterrupted();
4✔
70
    try {
71
      int result = delegate.read(b, off, len);
14✔
72
      checkInterrupted();
4✔
73
      return result;
4✔
74
    } catch (IOException e) {
1✔
NEW
75
      checkInterrupted();
×
NEW
76
      throw e;
×
77
    }
78
  }
79

80
  @Override
81
  public long skip(long n) throws IOException {
NEW
82
    checkInterrupted();
×
NEW
83
    return delegate.skip(n);
×
84
  }
85

86
  @Override
87
  public int available() throws IOException {
88
    checkInterrupted();
2✔
89
    return delegate.available();
4✔
90
  }
91

92
  @Override
93
  public void close() throws IOException {
94
    delegate.close();
6✔
95
  }
2✔
96

97
  @Override
98
  public synchronized void mark(int readlimit) {
NEW
99
    delegate.mark(readlimit);
×
NEW
100
  }
×
101

102
  @Override
103
  public synchronized void reset() throws IOException {
NEW
104
    checkInterrupted();
×
NEW
105
    delegate.reset();
×
NEW
106
  }
×
107

108
  @Override
109
  public boolean markSupported() {
NEW
110
    return delegate.markSupported();
×
111
  }
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc