Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -508,30 +508,31 @@ public void updateMessageDigest(MessageDigest messageDigest, int len) {
// This stream doesn't have any data in it...
return;
}
else if (len == 0) {

if (len == 0) {
return;
}
else if (len < 0) {

if (len < 0) {
throw new IllegalArgumentException("len must be 0 or greater: " + len);
}

if (this.nextIndexInCurrentBuffer < this.currentBufferLength) {
int bytesToCopy = Math.min(len, this.currentBufferLength - this.nextIndexInCurrentBuffer);
messageDigest.update(this.currentBuffer, this.nextIndexInCurrentBuffer, bytesToCopy);
this.nextIndexInCurrentBuffer += bytesToCopy;
updateMessageDigest(messageDigest, len - bytesToCopy);
}
else {
if (this.nextIndexInCurrentBuffer < this.currentBufferLength) {
int bytesToCopy = Math.min(len, this.currentBufferLength - this.nextIndexInCurrentBuffer);
messageDigest.update(this.currentBuffer, this.nextIndexInCurrentBuffer, bytesToCopy);
this.nextIndexInCurrentBuffer += bytesToCopy;
updateMessageDigest(messageDigest, len - bytesToCopy);
if (this.buffersIterator.hasNext()) {
this.currentBuffer = this.buffersIterator.next();
updateCurrentBufferLength();
this.nextIndexInCurrentBuffer = 0;
}
else {
if (this.buffersIterator.hasNext()) {
this.currentBuffer = this.buffersIterator.next();
updateCurrentBufferLength();
this.nextIndexInCurrentBuffer = 0;
}
else {
this.currentBuffer = null;
}
updateMessageDigest(messageDigest, len);
this.currentBuffer = null;
}
updateMessageDigest(messageDigest, len);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ public Collection<V> values() {
Collection<V> values = this.values;
if (values == null) {
Collection<List<V>> targetValues = this.targetMap.values();
values = new AbstractCollection<V>() {
values = new AbstractCollection<>() {
@Override
public Iterator<V> iterator() {
Iterator<List<V>> targetIterator = targetValues.iterator();
return new Iterator<V>() {
return new Iterator<>() {
@Override
public boolean hasNext() {
return targetIterator.hasNext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected void printResolvedException(@Nullable Exception resolvedException) thr
protected void printModelAndView(@Nullable ModelAndView mav) throws Exception {
this.printer.printValue("View name", (mav != null) ? mav.getViewName() : null);
this.printer.printValue("View", (mav != null) ? mav.getView() : null);
if (mav == null || mav.getModel().size() == 0) {
if (mav == null || mav.getModel().isEmpty()) {
this.printer.printValue("Model", null);
}
else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -65,7 +65,8 @@ public void handleReturnValue(@Nullable Object returnValue, MethodParameter retu
if (returnValue == null) {
return;
}
else if (returnValue instanceof Model model) {

if (returnValue instanceof Model model) {
mavContainer.addAllAttributes(model.asMap());
}
else {
Expand Down