From f3d9c60d875e898fc3898e18b3368b608b5c78a4 Mon Sep 17 00:00:00 2001 From: "Cloud.Liu" Date: Thu, 25 Nov 2021 10:46:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?DEC-21348=20fix:=20java=20security=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/third/net/bytebuddy/dynamic/NexusAccessor.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fine-byte-buddy/src/main/java/com/fr/third/net/bytebuddy/dynamic/NexusAccessor.java b/fine-byte-buddy/src/main/java/com/fr/third/net/bytebuddy/dynamic/NexusAccessor.java index ef0ed37d8..fd724fc43 100644 --- a/fine-byte-buddy/src/main/java/com/fr/third/net/bytebuddy/dynamic/NexusAccessor.java +++ b/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.type.TypeDescription; 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.LoadedTypeInitializer; 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.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.constant.ClassConstant; 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.TextConstant; +import com.fr.third.net.bytebuddy.implementation.bytecode.member.MethodInvocation; import com.fr.third.org.objectweb.asm.MethodVisitor; +import com.fr.third.research.annotations.SuppressFBWarnings; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; @@ -223,7 +222,11 @@ public class NexusAccessor { return new Unavailable("Nexus injection was explicitly disabled"); } else { 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))) .get(TypeDescription.ForLoadedType.of(Nexus.class)); return new Dispatcher.Available(nexusType.getMethod("register", String.class, ClassLoader.class, ReferenceQueue.class, int.class, Object.class), From e90d644b999ff908decd3268a367963824a8862b Mon Sep 17 00:00:00 2001 From: "Cloud.Liu" Date: Mon, 29 Nov 2021 13:49:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?DEC-20671=20fix:=20was=E4=B8=8B=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/third/springframework/core/MethodParameter.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fine-spring/src/main/java/com/fr/third/springframework/core/MethodParameter.java b/fine-spring/src/main/java/com/fr/third/springframework/core/MethodParameter.java index 4882da0a6..489b18fdc 100644 --- a/fine-spring/src/main/java/com/fr/third/springframework/core/MethodParameter.java +++ b/fine-spring/src/main/java/com/fr/third/springframework/core/MethodParameter.java @@ -503,6 +503,12 @@ public class MethodParameter { */ public Annotation[] getParameterAnnotations() { 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) { Annotation[][] annotationArray = (this.method != null ? this.method.getParameterAnnotations() : this.constructor.getParameterAnnotations());