[FEATURE] Секретная магия

This commit is contained in:
Gravit 2019-10-17 01:43:40 +07:00
parent a7db7184db
commit 8a52340b1a
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -7,6 +7,7 @@
import java.lang.management.RuntimeMXBean; import java.lang.management.RuntimeMXBean;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.security.cert.X509Certificate;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Locale; import java.util.Locale;
@ -110,6 +111,13 @@ public static URL[] getClassPathURL() {
return list; return list;
} }
public static X509Certificate[] getCertificates(Class<?> clazz)
{
Object[] signers = clazz.getSigners();
if(signers == null) return new X509Certificate[] {};
return Arrays.stream(signers).filter((c) -> c instanceof X509Certificate).map((c) -> (X509Certificate) c).toArray(X509Certificate[]::new);
}
public static void checkStackTrace(Class<?> mainClass) { public static void checkStackTrace(Class<?> mainClass) {
LogHelper.debug("Testing stacktrace"); LogHelper.debug("Testing stacktrace");
Exception e = new Exception("Testing stacktrace"); Exception e = new Exception("Testing stacktrace");