Nullability refinements (based on IntelliJ IDEA 2018.1 introspection)
Issue: SPR-15756
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -222,12 +222,14 @@ public class Jaxb2XmlDecoder extends AbstractDecoder<Object> {
|
||||
this.elementDepth++;
|
||||
}
|
||||
if (this.elementDepth > this.barrier) {
|
||||
Assert.state(this.events != null, "No XMLEvent List");
|
||||
this.events.add(event);
|
||||
}
|
||||
if (event.isEndElement()) {
|
||||
this.elementDepth--;
|
||||
if (this.elementDepth == this.barrier) {
|
||||
this.barrier = Integer.MAX_VALUE;
|
||||
Assert.state(this.events != null, "No XMLEvent List");
|
||||
return Mono.just(this.events);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,9 +180,9 @@ class DefaultPathContainer implements PathContainer {
|
||||
return EMPTY_PATH;
|
||||
}
|
||||
|
||||
Assert.isTrue(fromIndex < toIndex, () -> "fromIndex: " + fromIndex + " should be < toIndex " + toIndex);
|
||||
Assert.isTrue(fromIndex >= 0 && fromIndex < elements.size(), () -> "Invalid fromIndex: " + fromIndex);
|
||||
Assert.isTrue(toIndex >= 0 && toIndex <= elements.size(), () -> "Invalid toIndex: " + toIndex);
|
||||
Assert.isTrue(fromIndex < toIndex, () -> "fromIndex: " + fromIndex + " should be < toIndex " + toIndex);
|
||||
|
||||
List<Element> subList = elements.subList(fromIndex, toIndex);
|
||||
String path = subList.stream().map(Element::value).collect(Collectors.joining(""));
|
||||
|
||||
@@ -109,9 +109,7 @@ class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse impl
|
||||
public Mono<Void> writeWith(File file, long position, long count) {
|
||||
return doCommit(() ->
|
||||
Mono.defer(() -> {
|
||||
FileChannel source = null;
|
||||
try {
|
||||
source = FileChannel.open(file.toPath(), StandardOpenOption.READ);
|
||||
try (FileChannel source = FileChannel.open(file.toPath(), StandardOpenOption.READ)) {
|
||||
StreamSinkChannel destination = this.exchange.getResponseChannel();
|
||||
Channels.transferBlocking(destination, source, position, count);
|
||||
return Mono.empty();
|
||||
@@ -119,17 +117,6 @@ class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse impl
|
||||
catch (IOException ex) {
|
||||
return Mono.error(ex);
|
||||
}
|
||||
finally {
|
||||
if (source != null) {
|
||||
try {
|
||||
source.close();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user