com.undefinedlabs.scope.deps.okhttp3.internal.cache.FaultHidingSink Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scope-deps Show documentation
Show all versions of scope-deps Show documentation
Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly
identify, troubleshoot and fix failed builds.
This artifact contains dependencies for Scope.
package com.undefinedlabs.scope.deps.okhttp3.internal.cache;
import com.undefinedlabs.scope.deps.okio.Buffer;
import com.undefinedlabs.scope.deps.okio.ForwardingSink;
import com.undefinedlabs.scope.deps.okio.Sink;
import java.io.IOException;
public class FaultHidingSink extends ForwardingSink {
private boolean hasErrors;
FaultHidingSink(Sink delegate) {
super(delegate);
}
@Override public void write(Buffer source, long byteCount) throws IOException {
if (hasErrors) {
source.skip(byteCount);
return;
}
try {
super.write(source, byteCount);
} catch (IOException e) {
hasErrors = true;
onException(e);
}
}
@Override public void flush() throws IOException {
if (hasErrors) return;
try {
super.flush();
} catch (IOException e) {
hasErrors = true;
onException(e);
}
}
@Override public void close() throws IOException {
if (hasErrors) return;
try {
super.close();
} catch (IOException e) {
hasErrors = true;
onException(e);
}
}
protected void onException(IOException e) {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy