Merge branch '6.2.x'
This commit is contained in:
@@ -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.
|
||||
@@ -98,13 +98,11 @@ public class FastByteArrayOutputStream extends OutputStream {
|
||||
if (this.closed) {
|
||||
throw new IOException("Stream closed");
|
||||
}
|
||||
else {
|
||||
if (this.buffers.peekLast() == null || this.buffers.getLast().length == this.index) {
|
||||
addBuffer(1);
|
||||
}
|
||||
// store the byte
|
||||
this.buffers.getLast()[this.index++] = (byte) datum;
|
||||
if (this.buffers.peekLast() == null || this.buffers.getLast().length == this.index) {
|
||||
addBuffer(1);
|
||||
}
|
||||
// store the byte
|
||||
this.buffers.getLast()[this.index++] = (byte) datum;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -384,22 +382,20 @@ public class FastByteArrayOutputStream extends OutputStream {
|
||||
// This stream doesn't have any data in it...
|
||||
return -1;
|
||||
}
|
||||
if (this.nextIndexInCurrentBuffer < this.currentBufferLength) {
|
||||
this.totalBytesRead++;
|
||||
return this.currentBuffer[this.nextIndexInCurrentBuffer++] & 0xFF;
|
||||
}
|
||||
else {
|
||||
if (this.nextIndexInCurrentBuffer < this.currentBufferLength) {
|
||||
this.totalBytesRead++;
|
||||
return this.currentBuffer[this.nextIndexInCurrentBuffer++] & 0xFF;
|
||||
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;
|
||||
}
|
||||
return read();
|
||||
this.currentBuffer = null;
|
||||
}
|
||||
return read();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -226,14 +226,12 @@ public class MethodInvoker {
|
||||
Method matchingMethod = null;
|
||||
|
||||
for (Method candidate : candidates) {
|
||||
if (candidate.getName().equals(targetMethod)) {
|
||||
if (candidate.getParameterCount() == argCount) {
|
||||
Class<?>[] paramTypes = candidate.getParameterTypes();
|
||||
int typeDiffWeight = getTypeDifferenceWeight(paramTypes, arguments);
|
||||
if (typeDiffWeight < minTypeDiffWeight) {
|
||||
minTypeDiffWeight = typeDiffWeight;
|
||||
matchingMethod = candidate;
|
||||
}
|
||||
if (candidate.getName().equals(targetMethod) && candidate.getParameterCount() == argCount) {
|
||||
Class<?>[] paramTypes = candidate.getParameterTypes();
|
||||
int typeDiffWeight = getTypeDifferenceWeight(paramTypes, arguments);
|
||||
if (typeDiffWeight < minTypeDiffWeight) {
|
||||
minTypeDiffWeight = typeDiffWeight;
|
||||
matchingMethod = candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,9 +243,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
if (s.length() < 2) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return ((s.startsWith("\"") && s.endsWith("\"")) || (s.startsWith("'") && s.endsWith("'")));
|
||||
}
|
||||
return ((s.startsWith("\"") && s.endsWith("\"")) || (s.startsWith("'") && s.endsWith("'")));
|
||||
}
|
||||
|
||||
protected String unquote(String s) {
|
||||
|
||||
@@ -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.
|
||||
@@ -110,10 +110,8 @@ public abstract class NumberUtils {
|
||||
// do not lose precision - use BigDecimal's own conversion
|
||||
return (T) bigDecimal.toBigInteger();
|
||||
}
|
||||
else {
|
||||
// original value is not a Big* number - use standard long conversion
|
||||
return (T) BigInteger.valueOf(number.longValue());
|
||||
}
|
||||
// original value is not a Big* number - use standard long conversion
|
||||
return (T) BigInteger.valueOf(number.longValue());
|
||||
}
|
||||
else if (Float.class == targetClass) {
|
||||
return (T) Float.valueOf(number.floatValue());
|
||||
|
||||
@@ -702,8 +702,7 @@ public abstract class ObjectUtils {
|
||||
if (array == null) {
|
||||
return NULL_STRING;
|
||||
}
|
||||
int length = array.length;
|
||||
if (length == 0) {
|
||||
if (array.length == 0) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
StringJoiner stringJoiner = new StringJoiner(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END);
|
||||
@@ -726,8 +725,7 @@ public abstract class ObjectUtils {
|
||||
if (array == null) {
|
||||
return NULL_STRING;
|
||||
}
|
||||
int length = array.length;
|
||||
if (length == 0) {
|
||||
if (array.length == 0) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
StringJoiner stringJoiner = new StringJoiner(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END);
|
||||
@@ -750,8 +748,7 @@ public abstract class ObjectUtils {
|
||||
if (array == null) {
|
||||
return NULL_STRING;
|
||||
}
|
||||
int length = array.length;
|
||||
if (length == 0) {
|
||||
if (array.length == 0) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
StringJoiner stringJoiner = new StringJoiner(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END);
|
||||
@@ -774,8 +771,7 @@ public abstract class ObjectUtils {
|
||||
if (array == null) {
|
||||
return NULL_STRING;
|
||||
}
|
||||
int length = array.length;
|
||||
if (length == 0) {
|
||||
if (array.length == 0) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
StringJoiner stringJoiner = new StringJoiner(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END);
|
||||
@@ -798,8 +794,7 @@ public abstract class ObjectUtils {
|
||||
if (array == null) {
|
||||
return NULL_STRING;
|
||||
}
|
||||
int length = array.length;
|
||||
if (length == 0) {
|
||||
if (array.length == 0) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
StringJoiner stringJoiner = new StringJoiner(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END);
|
||||
@@ -846,8 +841,7 @@ public abstract class ObjectUtils {
|
||||
if (array == null) {
|
||||
return NULL_STRING;
|
||||
}
|
||||
int length = array.length;
|
||||
if (length == 0) {
|
||||
if (array.length == 0) {
|
||||
return EMPTY_ARRAY;
|
||||
}
|
||||
StringJoiner stringJoiner = new StringJoiner(ARRAY_ELEMENT_SEPARATOR, ARRAY_START, ARRAY_END);
|
||||
|
||||
Reference in New Issue
Block a user