java-10

How to customise “host” header in Java http client

跟風遠走 提交于 2019-11-29 11:11:49
Here's my code: HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("http://127.0.0.1:8081/")) .header("Host", "test.example.com") .build(); client.send(request, HttpResponse.BodyHandlers.ofString()); As a result I see that the above code sends: GET / HTTP/1.1 Connection: Upgrade, HTTP2-Settings Content-Length: 0 Host: 127.0.0.1:8081 HTTP2-Settings: AAEAAEAAAAIAAAABAAMAAABkAAQBAAAAAAUAAEAA Upgrade: h2c User-Agent: Java-http-client/10 Host: test.example.com As you can see it sends two Host headers (the one from URI and the one I

Does Cassandra support Java 10?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 06:33:48
We're planning on migrating our environment from Java 8 to OpenJDK 10. Doing this on my local machine, I've found that Cassandra will no longer start for me, giving the following error : I can't find any solid information online that says it is definitely not supported. This post from 4 months ago suggests that they do not support Java 10, but doesn't say it is confirmed, and is more inferred. There is also a comment on it from another user saying they have managed to get it running on Java 11. The final comment on this ticket on datastax says "We've updated our CI matrix to include Java 10

Internal changes for limit and unordered stream

孤者浪人 提交于 2019-11-29 06:10:52
问题 Basically this came up while trying to answer another question. Suppose this code: AtomicInteger i = new AtomicInteger(0); AtomicInteger count = new AtomicInteger(0); IntStream.generate(() -> i.incrementAndGet()) .parallel() .peek(x -> count.incrementAndGet()) .limit(5) .forEach(System.out::println); System.out.println("count = " + count); I understand the fact that IntStream#generate is an unordered infinite stream and for it to finish there has to be a short-circuiting operation ( limit in

Migrate Jersey project to use Java 10 results in java.lang.IllegalArgumentException at jersey.repackaged.org.objectweb.asm.ClassReader.<init>

陌路散爱 提交于 2019-11-29 04:04:07
Previously project is on Tomcat 8 and JDK 8 it was Working Fine But when i migrated my project on Tomcat 9 and JDK 10 it is giving me error as follows : Oct 05, 2018 11:02:01 AM org.apache.catalina.core.ApplicationContext log SEVERE: StandardWrapper.Throwable java.lang.IllegalArgumentException at jersey.repackaged.org.objectweb.asm.ClassReader.<init>(ClassReader.java:170) at jersey.repackaged.org.objectweb.asm.ClassReader.<init>(ClassReader.java:153) at jersey.repackaged.org.objectweb.asm.ClassReader.<init>(ClassReader.java:424) at org.glassfish.jersey.server.internal.scanning

SimpleDateFormat with German Locale - Java 8 vs Java 10+

血红的双手。 提交于 2019-11-29 00:52:38
I have code and a test-case in a legacy application, which can be summarized as follows: @Test public void testParseDate() throws ParseException { String toParse = "Mo Aug 18 11:25:26 MESZ +0200 2014"; String pattern = "EEE MMM dd HH:mm:ss z Z yyyy"; DateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.GERMANY); Date date = dateFormatter.parse(toParse); //skipped assumptions } This test passes in Java 8 and below. However with Java 10 upwards this leads to a java.text.ParseException: Unparseable date: "Mo Aug 18 11:25:26 MESZ +0200 2014" . For the record : Besides de_DE , the

Does Java 9 include Graal?

允我心安 提交于 2019-11-28 21:24:26
I'm reading JEP 317 . It says that Graal (a new experimental Java-based JIT compiler) will be part of JDK 10, but then it says that is already available in JDK 9. So, what's the point of JEP 317 then? Does Java 9 include Graal or not? From one of my memos, on linux-x64 (out-of-the-box) to use Graal on JDK 9, you can enable it using : -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler Source : Tweet from Chris . If you're explicitly willing to make use of the org.graalvm.* classes, they are not present in the JDK-9 build except for the Linux distribution here and the JEP

Difference in behaviour of the ternary operator on JDK8 and JDK10

我们两清 提交于 2019-11-28 16:36:42
问题 Consider the following code public class JDK10Test { public static void main(String[] args) { Double d = false ? 1.0 : new HashMap<String, Double>().get("1"); System.out.println(d); } } When running on JDK8, this code prints null whereas on JDK10 this code results in NullPointerException Exception in thread "main" java.lang.NullPointerException at JDK10Test.main(JDK10Test.java:5) The bytecode produced by the compilers is almost identical apart from two additional instructions produced by the

Can Java 10 compiled classes run on 9? [duplicate]

只愿长相守 提交于 2019-11-28 11:36:52
This question already has an answer here: Can Java 8 code be compiled to run on Java 7 JVM? 5 answers List of Java class file format major version numbers? 2 answers If I understand correctly the binary form of Java 10 is 100% identical to Java 9 so it shouldn't make any problems. Is my assumption correct? This has nothing to do with Java 10; the rules are the same as they've always been. In every version of Java, the classfile version number has been incremented. You can run older classfiles on a newer Java runtime (you can run files compiled twenty years ago under Java 1.0 on Java 10!), but

Can't create project on Netbeans 8.2 with JDK 10

蓝咒 提交于 2019-11-28 05:17:37
问题 I am trying to create project on Ubuntu.It just can't do it. Doesn't give me an error or something, just this blank screen. Help/About: Product Version: NetBeans IDE 8.2 (Build 201609300101) Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 2 Java: 10.0.2; OpenJDK 64-Bit Server VM 10.0.2+13-Ubuntu-1ubuntu0.18.04.1 Runtime: OpenJDK Runtime Environment 10.0.2+13-Ubuntu-1ubuntu0.18.04.1 System: Linux version 4.15.0-33-generic running on amd64; UTF-8; en_US (nb) User directory: /home

Swing Issue on Java 10

时光毁灭记忆、已成空白 提交于 2019-11-28 05:14:43
问题 I am currently trying to move our application from Java 8 to Java 10 and in few months will be moving to Java 11. We have a legacy system which uses a bit of API's which are removed or will be removed I guess. We are using ant script (1.10.1) for our application compilation. Below is the same of the part that build our application: <target name="javac-setup" depends="flags, with.clover, jaxb-apply, flamingo.javac"/> <target name="javac" depends="javac-setup"> <mkdir dir="${workmanager.dir