Skip to content

Commit bb513de

Browse files
committed
Merge branch '6.2.x'
2 parents 86b5679 + d0b186a commit bb513de

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

spring-core/src/main/java/org/springframework/cglib/core/ReflectUtils.java

+15-4
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,21 @@ public static Class defineClass(String className, byte[] b, ClassLoader loader,
463463
c = lookup.defineClass(b);
464464
}
465465
catch (LinkageError | IllegalArgumentException ex) {
466-
// in case of plain LinkageError (class already defined)
467-
// or IllegalArgumentException (class in different package):
468-
// fall through to traditional ClassLoader.defineClass below
469-
t = ex;
466+
if (ex instanceof LinkageError) {
467+
// Could be a ClassLoader mismatch with the class pre-existing in a
468+
// parent ClassLoader -> try loadClass before giving up completely.
469+
try {
470+
c = contextClass.getClassLoader().loadClass(className);
471+
}
472+
catch (ClassNotFoundException cnfe) {
473+
}
474+
}
475+
if (c == null) {
476+
// in case of plain LinkageError (class already defined)
477+
// or IllegalArgumentException (class in different package):
478+
// fall through to traditional ClassLoader.defineClass below
479+
t = ex;
480+
}
470481
}
471482
catch (Throwable ex) {
472483
throw new CodeGenerationException(ex);

spring-core/src/main/java/org/springframework/util/backoff/ExponentialBackOff.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -85,6 +85,7 @@ public class ExponentialBackOff implements BackOff {
8585
*/
8686
public static final int DEFAULT_MAX_ATTEMPTS = Integer.MAX_VALUE;
8787

88+
8889
private long initialInterval = DEFAULT_INITIAL_INTERVAL;
8990

9091
private double multiplier = DEFAULT_MULTIPLIER;
@@ -204,6 +205,7 @@ public int getMaxAttempts() {
204205
return this.maxAttempts;
205206
}
206207

208+
207209
@Override
208210
public BackOffExecution start() {
209211
return new ExponentialBackOffExecution();
@@ -225,6 +227,7 @@ public String toString() {
225227
.toString();
226228
}
227229

230+
228231
private class ExponentialBackOffExecution implements BackOffExecution {
229232

230233
private long currentInterval = -1;

spring-core/src/main/java/org/springframework/util/backoff/FixedBackOff.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ public class FixedBackOff implements BackOff {
3535
*/
3636
public static final long UNLIMITED_ATTEMPTS = Long.MAX_VALUE;
3737

38+
3839
private long interval = DEFAULT_INTERVAL;
3940

4041
private long maxAttempts = UNLIMITED_ATTEMPTS;
@@ -86,6 +87,7 @@ public long getMaxAttempts() {
8687
return this.maxAttempts;
8788
}
8889

90+
8991
@Override
9092
public BackOffExecution start() {
9193
return new FixedBackOffExecution();

0 commit comments

Comments
 (0)