Browse Source

Merge pull request #4336 in CORE/base-third from release/10.0 to final/10.0

* commit 'b699edc67ddff3964ae9d41c2ad03e429d96941b':
  DEC-20671 fix: was下请求服务器数据失败
  DEC-21348 fix: java security适配
final/10.0
superman 3 years ago
parent
commit
d4e8891270
  1. 11
      fine-byte-buddy/src/main/java/com/fr/third/net/bytebuddy/dynamic/NexusAccessor.java
  2. 6
      fine-spring/src/main/java/com/fr/third/springframework/core/MethodParameter.java

11
fine-byte-buddy/src/main/java/com/fr/third/net/bytebuddy/dynamic/NexusAccessor.java

@ -19,20 +19,19 @@ import com.fr.third.net.bytebuddy.build.HashCodeAndEqualsPlugin;
import com.fr.third.net.bytebuddy.description.method.MethodDescription; import com.fr.third.net.bytebuddy.description.method.MethodDescription;
import com.fr.third.net.bytebuddy.description.type.TypeDescription; import com.fr.third.net.bytebuddy.description.type.TypeDescription;
import com.fr.third.net.bytebuddy.dynamic.loading.ClassInjector; import com.fr.third.net.bytebuddy.dynamic.loading.ClassInjector;
import com.fr.third.net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
import com.fr.third.net.bytebuddy.implementation.Implementation; import com.fr.third.net.bytebuddy.implementation.Implementation;
import com.fr.third.net.bytebuddy.implementation.LoadedTypeInitializer; import com.fr.third.net.bytebuddy.implementation.LoadedTypeInitializer;
import com.fr.third.net.bytebuddy.implementation.bytecode.ByteCodeAppender; import com.fr.third.net.bytebuddy.implementation.bytecode.ByteCodeAppender;
import com.fr.third.net.bytebuddy.implementation.bytecode.Removal; import com.fr.third.net.bytebuddy.implementation.bytecode.Removal;
import com.fr.third.net.bytebuddy.implementation.bytecode.StackManipulation; import com.fr.third.net.bytebuddy.implementation.bytecode.StackManipulation;
import com.fr.third.net.bytebuddy.implementation.bytecode.member.MethodInvocation;
import com.fr.third.research.annotations.SuppressFBWarnings;
import com.fr.third.net.bytebuddy.implementation.bytecode.collection.ArrayFactory; import com.fr.third.net.bytebuddy.implementation.bytecode.collection.ArrayFactory;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.ClassConstant; import com.fr.third.net.bytebuddy.implementation.bytecode.constant.ClassConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.IntegerConstant; import com.fr.third.net.bytebuddy.implementation.bytecode.constant.IntegerConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.NullConstant; import com.fr.third.net.bytebuddy.implementation.bytecode.constant.NullConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.constant.TextConstant; import com.fr.third.net.bytebuddy.implementation.bytecode.constant.TextConstant;
import com.fr.third.net.bytebuddy.implementation.bytecode.member.MethodInvocation;
import com.fr.third.org.objectweb.asm.MethodVisitor; import com.fr.third.org.objectweb.asm.MethodVisitor;
import com.fr.third.research.annotations.SuppressFBWarnings;
import java.lang.ref.Reference; import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue; import java.lang.ref.ReferenceQueue;
@ -223,7 +222,11 @@ public class NexusAccessor {
return new Unavailable("Nexus injection was explicitly disabled"); return new Unavailable("Nexus injection was explicitly disabled");
} else { } else {
try { try {
Class<?> nexusType = new ClassInjector.UsingReflection(ClassLoader.getSystemClassLoader(), ClassLoadingStrategy.NO_PROTECTION_DOMAIN) /*
* 实例化UsingReflection时要指定非null的ProtectionDomain否则开启-security后经由这里调用具体方法时会校验权限失败
* 这里指定为NexusAccessor的ProtectionDomain即fine-third jar
*/
Class<?> nexusType = new ClassInjector.UsingReflection(ClassLoader.getSystemClassLoader(), getClass().getProtectionDomain())
.inject(Collections.singletonMap(TypeDescription.ForLoadedType.of(Nexus.class), ClassFileLocator.ForClassLoader.read(Nexus.class))) .inject(Collections.singletonMap(TypeDescription.ForLoadedType.of(Nexus.class), ClassFileLocator.ForClassLoader.read(Nexus.class)))
.get(TypeDescription.ForLoadedType.of(Nexus.class)); .get(TypeDescription.ForLoadedType.of(Nexus.class));
return new Dispatcher.Available(nexusType.getMethod("register", String.class, ClassLoader.class, ReferenceQueue.class, int.class, Object.class), return new Dispatcher.Available(nexusType.getMethod("register", String.class, ClassLoader.class, ReferenceQueue.class, int.class, Object.class),

6
fine-spring/src/main/java/com/fr/third/springframework/core/MethodParameter.java

@ -503,6 +503,12 @@ public class MethodParameter {
*/ */
public Annotation[] getParameterAnnotations() { public Annotation[] getParameterAnnotations() {
Annotation[] paramAnns = this.parameterAnnotations; Annotation[] paramAnns = this.parameterAnnotations;
// https://work.fineres.com/browse/DEC-20671 IBM WebSphere OpenJ9 JDK
if (this.method != null) {
this.method.getDeclaredAnnotations();
}
if (paramAnns == null) { if (paramAnns == null) {
Annotation[][] annotationArray = (this.method != null ? Annotation[][] annotationArray = (this.method != null ?
this.method.getParameterAnnotations() : this.constructor.getParameterAnnotations()); this.method.getParameterAnnotations() : this.constructor.getParameterAnnotations());

Loading…
Cancel
Save