java-9

Alternative to sslSocketFactory in Java10

回眸只為那壹抹淺笑 提交于 2020-08-19 07:31:27
问题 I am using OkHttp and I need to ignore SSL errors for application debugging. This used to work in Java 8. final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { } @Override public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { } @Override public java.security.cert

How to access to resources in external resource folder in Java 9 modular project [duplicate]

ぐ巨炮叔叔 提交于 2020-08-06 05:01:06
问题 This question already has answers here : Accessing resource files from external modules (2 answers) How to work with resources in Java 9 modules (1 answer) Java 9 Module system Resources files location (2 answers) Closed 2 years ago . When I have the following code that attempts accessing to a resource: foo/Main.java package foo; import java.io.*; public class Main{ public static void main(String... args) throws IOException{ try(BufferedReader in = new BufferedReader(new InputStreamReader(

How to access to resources in external resource folder in Java 9 modular project [duplicate]

爷,独闯天下 提交于 2020-08-06 05:01:06
问题 This question already has answers here : Accessing resource files from external modules (2 answers) How to work with resources in Java 9 modules (1 answer) Java 9 Module system Resources files location (2 answers) Closed 2 years ago . When I have the following code that attempts accessing to a resource: foo/Main.java package foo; import java.io.*; public class Main{ public static void main(String... args) throws IOException{ try(BufferedReader in = new BufferedReader(new InputStreamReader(

How to access to resources in external resource folder in Java 9 modular project [duplicate]

江枫思渺然 提交于 2020-08-06 05:01:01
问题 This question already has answers here : Accessing resource files from external modules (2 answers) How to work with resources in Java 9 modules (1 answer) Java 9 Module system Resources files location (2 answers) Closed 2 years ago . When I have the following code that attempts accessing to a resource: foo/Main.java package foo; import java.io.*; public class Main{ public static void main(String... args) throws IOException{ try(BufferedReader in = new BufferedReader(new InputStreamReader(

Is it possible to access package scoped methods by reflection in Java 9 with Jigsaw?

谁说我不能喝 提交于 2020-08-04 23:19:32
问题 I have the following code to retrieve the default URLStreamHandlers for http and https which works in Java 8 by accessing the static package scoped method URL.getURLStreamHandler() : private URLStreamHandler getURLStreamHandler(String protocol) { try { Method method = URL.class.getDeclaredMethod("getURLStreamHandler", String.class); method.setAccessible(true); return (URLStreamHandler) method.invoke(null, protocol); } catch (Exception e) { logger.warning("could not access URL

JDK 9: JUnit 5 test compile with SpringExtension produces java.lang.NoClassDefFoundError: org/w3c/dom/ls/DocumentLS

爷,独闯天下 提交于 2020-07-28 19:05:29
问题 I believe this problem not to be related to module exclusions in JDK 9 (as with java.se.ee), but rather with the fact that JDK 9 includes a newer version of org.w3c.dom.ls in the java.xml module that does not have the DocumentLS class. The important bit of the stack trace is this: Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [spring-test/test-container.xml]; nested exception is java.lang