Resolve "Validator new feature: Pruefbericht Gesamtuebersicht bei Batch Verarbeitung"

This commit is contained in:
Andreas Penski 2020-08-10 06:38:20 +00:00
parent c781316509
commit e265667f25
31 changed files with 791 additions and 110 deletions

View file

@ -52,7 +52,7 @@ public class SourceInput extends AbstractInput {
}
private void validate() {
if (!isHashcodeComputed() && !isSupported()) {
if (!isHashcodeComputed() && isNotSupported()) {
throw new IllegalStateException("Unsupported source. Only StreamSource supported yet");
}
if (!isHashcodeComputed() && ((StreamSource) this.source).getInputStream() == null) {
@ -62,7 +62,7 @@ public class SourceInput extends AbstractInput {
@Override
public Source getSource() throws IOException {
if (!isHashcodeComputed() && !isSupported()) {
if (!isHashcodeComputed() && isNotSupported()) {
throw new IllegalStateException("Unsupported source. Only InputStream-based StreamSource supported yet");
}
if (isConsumed()) {
@ -71,8 +71,8 @@ public class SourceInput extends AbstractInput {
return isHashcodeComputed() ? this.source : wrappedSource();
}
private boolean isSupported() {
return isStreamSource();
private boolean isNotSupported() {
return !isStreamSource();
}
private boolean isConsumed() throws IOException {
@ -107,9 +107,7 @@ public class SourceInput extends AbstractInput {
return result;
}
private boolean isWrappingRequired() {
return !isHashcodeComputed();
}
@Override
public boolean supportsMultipleReads() {

View file

@ -24,6 +24,7 @@ public class StreamHelper {
* Helper class, which generates the hashcode while reading the stream e.g. for parsing the document. This allows
* generating the hashcode without an aditional reading step.
*/
@SuppressWarnings("squid:S4929") // efficient read is done by internally used stream
private static class DigestingInputStream extends FilterInputStream {
private final MessageDigest digest;
@ -44,6 +45,7 @@ public class StreamHelper {
}
@SuppressWarnings("squid:S4929") // efficient read is done by internally used stream
private static class CountInputStream extends FilterInputStream {
private final LazyReadInput reference;
@ -123,10 +125,12 @@ public class StreamHelper {
* @param input the input
* @throws IOException on I/O errors
*/
@SuppressWarnings("squid:S1854")
public static void drain(final InputStream input) throws IOException {
final byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int n;
while (EOF != (n = input.read(buffer))) {
// nothing
}